public interface DocumentProviderBridge

The platform seam of the document provider framework, implemented by ports and returned from CodenameOneImplementation.getDocumentProviderBridge() (null on unsupported ports, making the whole public API an inert no-op).

Everything crosses this boundary as data – a JSON index produced by the core serializer and files on disk – never as live model objects. On iOS the reader is an app extension in a separate process that runs while the app is dead, so implementations MUST persist what they are given into a container both processes can reach (the App Group container on Apple platforms; ordinary app storage on Android, where the provider shares the app’s process).

Nothing here blocks on the platform browser: publishing writes the index, and signalChange is a hint that the browser should re-enumerate at its own convenience.

Methods

public abstract boolean isDocumentProviderSupported()Returns true when this port can expose the app’s documents to the system file browser.
public abstract String getSharedDirectory()Returns the absolute com.codename1.io.FileSystemStorage path of the directory whose contents both the app and the platform reader can see, creating it if needed.
public abstract void publishIndex(String indexJson)Atomically replaces the persisted document index and leaves it where the platform reader will find it.
public abstract void setRemoteEndpoint(String endpoint, String authToken)Records where the platform reader should fetch content it cannot find locally.
public abstract void signalChange()Hints that the published index changed and the platform browser should re-enumerate.
public abstract void clear()Forgets the published index, the endpoint and the token, and empties the shared directory.

Method details

isDocumentProviderSupported

public abstract boolean isDocumentProviderSupported()
Returns true when this port can expose the app’s documents to the system file browser.

getSharedDirectory

public abstract String getSharedDirectory()
Returns the absolute com.codename1.io.FileSystemStorage path of the directory whose contents both the app and the platform reader can see, creating it if needed.

Returns

the shared directory path, or null when this port has nowhere to put one

publishIndex

public abstract void publishIndex(String indexJson)

Atomically replaces the persisted document index and leaves it where the platform reader will find it.

Atomically matters: the reader may wake at any moment, including midway through this call, and a half-written index is a file browser showing half a tree.

Parameters

indexJson String
the serialized tree

setRemoteEndpoint

public abstract void setRemoteEndpoint(String endpoint, String authToken)
Records where the platform reader should fetch content it cannot find locally.

Parameters

endpoint String
the HTTPS base URL, or null to serve only from the shared directory
authToken String
a bearer token sent with each request, or null for none

signalChange

public abstract void signalChange()
Hints that the published index changed and the platform browser should re-enumerate.

clear

public abstract void clear()
Forgets the published index, the endpoint and the token, and empties the shared directory.