... open a topicmap

The StoreManager

All Topicmap-loading in Panckoucke 0.3.0 is done by the PanckouckeStore, which maintains registered providers and loaded topicmaps.

PanckouckeStore itself is not accessible for client applications. Instead you use an instance of StoreManager to manage topicmaps and providers. See accessing panckoucke for a description of how you get the StoreManager instance.

PanckouckeStore loads topicmaps assynchroniously. In order to open a topicmap, you place the demand to open it via one of StoreManagers load(...)-methods. The method returns immediately with a TopicMapReference-Object, which encapsulates the topicmap to be loaded. The state of the returned TopicMapReference indicates that your demand to load is pending. Panckoucke waits until the requested Provider is idle and then initiates the loading of the map. Once the topicmap is completely loaded, a notification gets send to all registered users.

The data model

The StoreManager uses two basic interfaces (ProviderReference and TopicMapReference) to communicate with the applications.

The ProviderReference encapsulates a TopicMapProvider.

The TopicMapReference encapsulates a TopicMap in any state. The states covers the complete lifespan of a TopicMap-Object (from scheduled to being load until removed).

Creating the provider

You obtain a ProviderReference through a call to StoreManagers method

      public ProviderReference createProvider( String factoryClassName, Properties props) 
        throws PanckouckeStoreException;	
		

Parameters

factoryClassName
The name of the TopicMapProviderFactory-Implementation to use to create the provider. An instantiated TopicMapProviderFactory will be cached and reused on subsequent calls.
props
Properties, which are passed to the Provider on Initialisation

Note

If you pass the In-memory-Provider Topicmaps, which it should load on startup, this TopicMaps won't be loaded assynchroniously and no TopicMapReference for them will be created

PanckockeStore enforces no constraints about the numbers of Providers you may create from a distinct TopicMapProviderFactory-Implementation. But in real life it tends to be senseful not to create more than on Provider per TopicMapProviderFactory

Once the provider is created, you may get all the TopicMaps which this providers offers a startup-time, via the StoreManager-Method

      public List getTopicmapReferences(List li, boolean allReferences);
	

Adding TopicMaps to a Provider

To add a TopicMap to a previously created Provider, you pass either an URL or the path to a local file, along with the obtained ProviderReference to the StoreManager-Method:

      public TopicMapReference loadTopicmap(String src, ProviderReference providerReference)
        throws UnknownReferenceException;
	

This method returns immediatley, after scheduling the TopicMap to be loaded. You may observe the StoreState of the returned TopicMapReference or register your Application as a panckoucke NotificationListener in order to remark when the TopicMap is actually loaded.

Once loaded, you may use the TopicMapReference-Method

      public AMNode getAMNode() throws IllegalStateException;
	

to receive an AMNode which you can pass to the ModelProvider (see How to obtain a Model)

Example

A complete example of how to connect to panckoucke and load a topicmap is here.

Please change the path to the map to be loaded, before you run the example.