org.eclipse.higgins.idas.registry
Class IdASRegistry

java.lang.Object
  extended byorg.eclipse.higgins.idas.registry.IdASRegistry
All Implemented Interfaces:
org.eclipse.higgins.configuration.api.IConfigurableComponent, org.eclipse.higgins.configuration.api.IConfigurableComponentFactory

public class IdASRegistry
extends Object
implements org.eclipse.higgins.configuration.api.IConfigurableComponent, org.eclipse.higgins.configuration.api.IConfigurableComponentFactory

Manages context factories.

Author:
msabadello at parityinc dot net
See Also:
http://wiki.eclipse.org/ContextDiscoveryComponents, http://wiki.eclipse.org/ContextDiscoveryComponents_withoutXRDS

Field Summary
static String HIGGINS_CONF_NS
           
 
Constructor Summary
IdASRegistry()
          Use getInstance rather than the constructor.
 
Method Summary
 void clear()
          Clears all currently known context factories and context id configurations.
 void configure(Map mapGlobalSettings, String strComponentName, Map mapComponentSettings)
          Configure the IdASRegistry using the Configuration API.
 org.eclipse.higgins.idas.api.IContext createContext(org.eclipse.higgins.idas.api.IContextId contextId)
          Convenience method that creates an IContext based on an IContextId
 org.eclipse.higgins.idas.api.IContext createContext(String contextIdStr)
          Convenience method that creates an IContext based on a string (which must be a valid context ID)
 void discover()
          Configure the IdASRegistry using XRDS documents (an IDiscovery object).
 void discover(String type)
          Configure the IdASRegistry using XRDS documents (an IDiscovery object).
 ClassLoader getClassLoader()
           
 List getContextFactories()
          Return all registered IContextFactory objects.
 List getContextFactories(org.eclipse.higgins.idas.api.IContextId contextId)
          Find suitable IContextFactory objects for a ContextId
 List getContextFactories(String type)
          Find suitable IContextFactory objects for a context type.
 org.eclipse.higgins.idas.api.IContextFactory getContextFactory(org.eclipse.higgins.idas.api.IContextId contextId)
          Find a suitable IContextFactory for a ContextId
 org.eclipse.higgins.idas.api.IContextFactory getContextFactory(String type)
          Find a suitable IContextFactory for a context type.
 Map getContextIdConfiguration(String contextId)
           
 IDiscovery getDiscovery()
           
static IdASRegistry getInstance()
          Get the singleton instance.
 org.eclipse.higgins.configuration.api.IConfigurableComponent getNewInstance()
           
 org.eclipse.higgins.configuration.api.IConfigurableComponent getSingletonInstance()
           
 void registerContextFactory(String[] types, org.eclipse.higgins.idas.api.IContextFactory factory)
          Add context factory to the registered map.
 void registerContextFactory(String[] types, String factoryClassName)
          Add context factory to the registered map.
 void registerContextFactory(String type, org.eclipse.higgins.idas.api.IContextFactory factory)
          Add context factory to the registered map.
 void registerContextFactory(String type, String factoryClassName)
          Add context factory to the registered map.
 void removeContextFactory(org.eclipse.higgins.idas.api.IContextFactory factory)
          Remove context factory from the cache.
 void setClassLoader(ClassLoader classLoader)
           
 void setDiscovery(IDiscovery discovery)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIGGINS_CONF_NS

public static final String HIGGINS_CONF_NS
See Also:
Constant Field Values
Constructor Detail

IdASRegistry

public IdASRegistry()
Use getInstance rather than the constructor.

Method Detail

getInstance

public static IdASRegistry getInstance()
Get the singleton instance.


getNewInstance

public org.eclipse.higgins.configuration.api.IConfigurableComponent getNewInstance()
Specified by:
getNewInstance in interface org.eclipse.higgins.configuration.api.IConfigurableComponentFactory

getSingletonInstance

public org.eclipse.higgins.configuration.api.IConfigurableComponent getSingletonInstance()
Specified by:
getSingletonInstance in interface org.eclipse.higgins.configuration.api.IConfigurableComponentFactory

discover

public void discover()
              throws org.eclipse.higgins.idas.api.IdASException
Configure the IdASRegistry using XRDS documents (an IDiscovery object).

Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
http://wiki.eclipse.org/ContextDiscoveryComponents

discover

public void discover(String type)
              throws org.eclipse.higgins.idas.api.IdASException
Configure the IdASRegistry using XRDS documents (an IDiscovery object).

Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
http://wiki.eclipse.org/ContextDiscoveryComponents

configure

public void configure(Map mapGlobalSettings,
                      String strComponentName,
                      Map mapComponentSettings)
               throws Exception
Configure the IdASRegistry using the Configuration API. This is an alternative way to using XRDS documents / XRI resolution.

Specified by:
configure in interface org.eclipse.higgins.configuration.api.IConfigurableComponent
Throws:
Exception
See Also:
http://wiki.eclipse.org/ContextDiscoveryComponents_withoutXRDS

getContextIdConfiguration

public Map getContextIdConfiguration(String contextId)

getContextFactories

public List getContextFactories()
                         throws org.eclipse.higgins.idas.api.IdASException
Return all registered IContextFactory objects.

Returns:
Iterator of IContextFactory objects
Throws:
org.eclipse.higgins.idas.api.IdASException

getContextFactories

public List getContextFactories(String type)
                         throws org.eclipse.higgins.idas.api.IdASException
Find suitable IContextFactory objects for a context type.

Parameters:
type - The context type to look for
Throws:
org.eclipse.higgins.idas.api.IdASException

getContextFactory

public org.eclipse.higgins.idas.api.IContextFactory getContextFactory(String type)
                                                               throws org.eclipse.higgins.idas.api.IdASException
Find a suitable IContextFactory for a context type.

Parameters:
type - The context type to look for
Returns:
An IContextFactory or null if none was found
Throws:
org.eclipse.higgins.idas.api.IdASException

getContextFactories

public List getContextFactories(org.eclipse.higgins.idas.api.IContextId contextId)
                         throws org.eclipse.higgins.idas.api.IdASException
Find suitable IContextFactory objects for a ContextId

Parameters:
contextId - The IContextId of the context to be instantiated
Returns:
Iterator of IContextFactory objects
Throws:
org.eclipse.higgins.idas.api.IdASException

getContextFactory

public org.eclipse.higgins.idas.api.IContextFactory getContextFactory(org.eclipse.higgins.idas.api.IContextId contextId)
                                                               throws org.eclipse.higgins.idas.api.IdASException
Find a suitable IContextFactory for a ContextId

Parameters:
contextId - The IContextId of the context to be instantiated
Returns:
Iterator of IContextFactory objects
Throws:
org.eclipse.higgins.idas.api.IdASException

createContext

public org.eclipse.higgins.idas.api.IContext createContext(org.eclipse.higgins.idas.api.IContextId contextId)
                                                    throws org.eclipse.higgins.idas.api.IdASException
Convenience method that creates an IContext based on an IContextId

Parameters:
contextId - The IContextId for which an IContext needs to be found.
Returns:
A configured context.
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
http://wiki.eclipse.org/ContextId

createContext

public org.eclipse.higgins.idas.api.IContext createContext(String contextIdStr)
                                                    throws org.eclipse.higgins.idas.api.IdASException
Convenience method that creates an IContext based on a string (which must be a valid context ID)

Returns:
A newly created context.
Throws:
org.eclipse.higgins.idas.api.IdASException
See Also:
http://wiki.eclipse.org/ContextId

registerContextFactory

public void registerContextFactory(String[] types,
                                   org.eclipse.higgins.idas.api.IContextFactory factory)
Add context factory to the registered map.

Parameters:
types - Types of contexts this factory can create
factory - IContextFactory object to be registered

registerContextFactory

public void registerContextFactory(String type,
                                   org.eclipse.higgins.idas.api.IContextFactory factory)
Add context factory to the registered map.

Parameters:
type - Type of context this factory can create
factory - IContextFactory object to be registered

registerContextFactory

public void registerContextFactory(String[] types,
                                   String factoryClassName)
                            throws org.eclipse.higgins.idas.api.IdASException
Add context factory to the registered map.

Parameters:
types - Types of contexts this factory can create
Throws:
org.eclipse.higgins.idas.api.IdASException

registerContextFactory

public void registerContextFactory(String type,
                                   String factoryClassName)
                            throws org.eclipse.higgins.idas.api.IdASException
Add context factory to the registered map.

Throws:
org.eclipse.higgins.idas.api.IdASException

removeContextFactory

public void removeContextFactory(org.eclipse.higgins.idas.api.IContextFactory factory)
Remove context factory from the cache.

Parameters:
factory - IContextFactory object to be removed

clear

public void clear()
Clears all currently known context factories and context id configurations. If after this call you want to use the IdASRegistry again, you need to do one of the following - Call configure() again to initialize it using the Configuration API. - Have a valid and working IDiscovery object (by default pointing to the local file "contextfactories.xrds")


getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

getDiscovery

public IDiscovery getDiscovery()

setDiscovery

public void setDiscovery(IDiscovery discovery)