org.eclipse.corona.container.manager.manage
Class ContainerManager

java.lang.Object
  extended by org.eclipse.corona.container.manager.manage.ContainerManager
All Implemented Interfaces:
IContainerManager, IContainerHome, IManagedContainerHome, org.osgi.framework.ServiceFactory
Direct Known Subclasses:
ProjectContainerManager

public class ContainerManager
extends java.lang.Object
implements IContainerHome, org.osgi.framework.ServiceFactory, IContainerManager


Field Summary
protected  org.osgi.framework.BundleContext bundleContext
           
protected  java.util.Map containerNameToContainerUri
           
protected  java.util.Map containerUriToContainerName
           
protected static java.util.HashMap openContainerMap
           
protected  java.util.Map uriToRefCountMap
           
 
Constructor Summary
ContainerManager(org.osgi.framework.BundleContext bundleContext)
           
 
Method Summary
 void addRelatedContainerUri(java.lang.String containerUri, java.lang.String relatedContainerUri)
          Add a containerUri String to the list of related Containers in specified ContextContainer
 void close()
          Close the ContainerManager.
 void closeContainer(java.lang.String containerUri)
          Close the ContextContainer (however, a reference count of Container users is kept so it may not "really" close.
 void configure(IContainerConfiguration config)
          Not sure how configuration of the ContainerManager is really going to work.
(package private)  java.lang.String containerToXML(java.lang.String containerUri)
           
 void dumpFile(java.io.File file)
           
protected  ContextContainer getContainer(java.lang.String containerUri)
           
 java.lang.String getHomeIdentifier()
          return the uri of the ContainerManager, Container manager is a singleton
 java.util.Map getNameToContainerUriMap()
          Provides a mapping from Container Name to Container Uri uses information from ContainerConfigurations so Containers do not have to be opened.
protected  PropertyConfigurationStore getPropertyConfigurationStore()
           
 java.lang.Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration)
           
 java.util.Map getUriToContainerNameMap()
          Provides a mapping from Container Uri to Container Name uses information from ContainerConfigurations so Containers do not have to be opened.
protected  void initContainerNameToContainerUriAndContainerUriToContainerNameMaps()
           
 java.util.List listAllRelatedContainerUris(ContextContainer startContainer)
          Get a list of all containers directly and indirectly related to this container.
 java.util.List listAllRelatedContainerUris(java.lang.String containerUri)
          Get a list of all containers directly and indirectly related to this container.
 java.util.List listContainerUris()
           
 java.util.List listOpenContainers()
           
 java.util.List listOpenContainersWithRepository(java.lang.String repositoryName)
          Find a list of ProjectContextContainer names which contain a RepositoryDescriptor with the given name
 java.util.List listRelatedContainerNames(java.lang.String containerUri)
           
 java.util.List listRelatedContainerUris(ContextContainer container)
          Get a list of the containers list as related to this container.
 java.util.List listRelatedContainerUris(java.lang.String containerUri)
          Get a list of the containers list as related to this container.
 IContainerConfiguration loadConfiguration(java.lang.String containerUri)
          Load the configuration for this ContextContainer
 ContextContainer loadContainer(java.lang.String containerUri)
           
 ContextContainer loadContainer(java.lang.String containerUri, IContainerConfiguration config)
           
 ContextContainer openContainer(java.lang.String containerUri)
          Open an existing ContextContainer,
 void removeRelatedContainerUri(java.lang.String containerUri, java.lang.String relatedContainerUri)
          Remove a containerUri String from the list of related Containers in specified ContextContainer
 java.lang.Object resolveContainer(java.lang.String containerUri, IContainerConfiguration config)
          Finds an existing Container if none exists with specified containerUri a new one is created.
 void saveContainer(java.lang.String containerUri)
          serializes the ContextContainer object to disk location specified in the ContainerConfiguration
 void sendCollaborationEvent(CollaborationEvent event)
          Send a collaboration event on behalf of the context container
 void ungetService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration registration, java.lang.Object service)
           
 void updateContainerName(java.lang.String oldName, java.lang.String newName)
           
 void updateContainerUri(java.lang.String oldContainerUri, java.lang.String newContainerUri)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

openContainerMap

protected static java.util.HashMap openContainerMap

uriToRefCountMap

protected java.util.Map uriToRefCountMap

containerNameToContainerUri

protected java.util.Map containerNameToContainerUri

containerUriToContainerName

protected java.util.Map containerUriToContainerName

bundleContext

protected org.osgi.framework.BundleContext bundleContext
Constructor Detail

ContainerManager

public ContainerManager(org.osgi.framework.BundleContext bundleContext)
Method Detail

getHomeIdentifier

public java.lang.String getHomeIdentifier()
Description copied from interface: IContainerManager
return the uri of the ContainerManager, Container manager is a singleton

Specified by:
getHomeIdentifier in interface IContainerManager
Specified by:
getHomeIdentifier in interface IManagedContainerHome
Returns:
uri of the ContainerManager

updateContainerName

public void updateContainerName(java.lang.String oldName,
                                java.lang.String newName)

updateContainerUri

public void updateContainerUri(java.lang.String oldContainerUri,
                               java.lang.String newContainerUri)

getPropertyConfigurationStore

protected PropertyConfigurationStore getPropertyConfigurationStore()

configure

public void configure(IContainerConfiguration config)
Description copied from interface: IContainerManager
Not sure how configuration of the ContainerManager is really going to work.

Specified by:
configure in interface IContainerManager

loadConfiguration

public IContainerConfiguration loadConfiguration(java.lang.String containerUri)
Description copied from interface: IContainerManager
Load the configuration for this ContextContainer

Specified by:
loadConfiguration in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer
Returns:
the ContainerConfiguration object

resolveContainer

public java.lang.Object resolveContainer(java.lang.String containerUri,
                                         IContainerConfiguration config)
Description copied from interface: IContainerManager
Finds an existing Container if none exists with specified containerUri a new one is created. If containerConfig is is null a new containerConfig is created and written

Specified by:
resolveContainer in interface IContainerManager
Specified by:
resolveContainer in interface IManagedContainerHome
Parameters:
containerUri - uri used to uniquely identify the ContextContainer
config - the configuration object for this this type of Container

initContainerNameToContainerUriAndContainerUriToContainerNameMaps

protected void initContainerNameToContainerUriAndContainerUriToContainerNameMaps()
                                                                          throws ContainerConfigException
Throws:
ContainerConfigException

getNameToContainerUriMap

public java.util.Map getNameToContainerUriMap()
Description copied from interface: IContainerManager
Provides a mapping from Container Name to Container Uri uses information from ContainerConfigurations so Containers do not have to be opened.

Specified by:
getNameToContainerUriMap in interface IContainerManager
Returns:
map of Container Name String to Container Uri String

getUriToContainerNameMap

public java.util.Map getUriToContainerNameMap()
Description copied from interface: IContainerManager
Provides a mapping from Container Uri to Container Name uses information from ContainerConfigurations so Containers do not have to be opened.

Specified by:
getUriToContainerNameMap in interface IContainerManager
Returns:
map of Container Uri String to Container Name String

getService

public java.lang.Object getService(org.osgi.framework.Bundle bundle,
                                   org.osgi.framework.ServiceRegistration registration)
Specified by:
getService in interface IContainerManager
Specified by:
getService in interface org.osgi.framework.ServiceFactory

ungetService

public void ungetService(org.osgi.framework.Bundle bundle,
                         org.osgi.framework.ServiceRegistration registration,
                         java.lang.Object service)
Specified by:
ungetService in interface IContainerManager
Specified by:
ungetService in interface org.osgi.framework.ServiceFactory

openContainer

public ContextContainer openContainer(java.lang.String containerUri)
Description copied from interface: IContainerManager
Open an existing ContextContainer,

Specified by:
openContainer in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer
Returns:
ContextContainer object

containerToXML

java.lang.String containerToXML(java.lang.String containerUri)

closeContainer

public void closeContainer(java.lang.String containerUri)
Description copied from interface: IContainerManager
Close the ContextContainer (however, a reference count of Container users is kept so it may not "really" close.

Specified by:
closeContainer in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer

saveContainer

public void saveContainer(java.lang.String containerUri)
Description copied from interface: IContainerManager
serializes the ContextContainer object to disk location specified in the ContainerConfiguration

Specified by:
saveContainer in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer

loadContainer

public ContextContainer loadContainer(java.lang.String containerUri)

loadContainer

public ContextContainer loadContainer(java.lang.String containerUri,
                                      IContainerConfiguration config)

getContainer

protected ContextContainer getContainer(java.lang.String containerUri)

listOpenContainers

public java.util.List listOpenContainers()
Specified by:
listOpenContainers in interface IContainerManager
Returns:

listContainerUris

public java.util.List listContainerUris()
Specified by:
listContainerUris in interface IContainerManager
Returns:

listRelatedContainerNames

public java.util.List listRelatedContainerNames(java.lang.String containerUri)

listRelatedContainerUris

public java.util.List listRelatedContainerUris(java.lang.String containerUri)
Description copied from interface: IContainerManager
Get a list of the containers list as related to this container. This list includes only directly referenced containers it does not "chase" related related containers.

Specified by:
listRelatedContainerUris in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer
Returns:
List of String of related Containers' uris

listRelatedContainerUris

public java.util.List listRelatedContainerUris(ContextContainer container)
Description copied from interface: IContainerManager
Get a list of the containers list as related to this container. This list includes only directly referenced containers it does not "chase" related related containers.

Specified by:
listRelatedContainerUris in interface IContainerManager
Parameters:
container - ContextContainer object
Returns:
List of String of related Containers' uris

listAllRelatedContainerUris

public java.util.List listAllRelatedContainerUris(java.lang.String containerUri)
Description copied from interface: IContainerManager
Get a list of all containers directly and indirectly related to this container. This list includes all referenced containers it "chases" all the related containers but the list will not contain duplicate containers

Specified by:
listAllRelatedContainerUris in interface IContainerManager
Returns:
List of containerUri Strings of ALL related and indirectly related Containers duplicates are not included in the list.

listAllRelatedContainerUris

public java.util.List listAllRelatedContainerUris(ContextContainer startContainer)
Description copied from interface: IContainerManager
Get a list of all containers directly and indirectly related to this container. This list includes all referenced containers it "chases" all the related containers but the list will not contain duplicate containers

Specified by:
listAllRelatedContainerUris in interface IContainerManager
Parameters:
startContainer - uri used to uniquely identify the ContextContainer to start finding related containers from.
Returns:
List of containerUri Strings of ALL related and indirectly related Containers duplicates are not included in the list.

sendCollaborationEvent

public void sendCollaborationEvent(CollaborationEvent event)
Send a collaboration event on behalf of the context container

Parameters:
event -

dumpFile

public void dumpFile(java.io.File file)

addRelatedContainerUri

public void addRelatedContainerUri(java.lang.String containerUri,
                                   java.lang.String relatedContainerUri)
Description copied from interface: IContainerManager
Add a containerUri String to the list of related Containers in specified ContextContainer

Specified by:
addRelatedContainerUri in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer
relatedContainerUri - uri used to uniquely identify the related ContextContainer

removeRelatedContainerUri

public void removeRelatedContainerUri(java.lang.String containerUri,
                                      java.lang.String relatedContainerUri)
Description copied from interface: IContainerManager
Remove a containerUri String from the list of related Containers in specified ContextContainer

Specified by:
removeRelatedContainerUri in interface IContainerManager
Parameters:
containerUri - uri used to uniquely identify the ContextContainer
relatedContainerUri - uri used to uniquely identify the related ContextContainer

listOpenContainersWithRepository

public java.util.List listOpenContainersWithRepository(java.lang.String repositoryName)
Find a list of ProjectContextContainer names which contain a RepositoryDescriptor with the given name

Specified by:
listOpenContainersWithRepository in interface IContainerManager
Parameters:
repositoryName - the name of the repository to search for in the open ProjectContextContainers
Returns:
a list of Strings of ProjectContextContainer Names which hold a RepositoryDescriptor with the name repositoryName

close

public void close()
Description copied from interface: IContainerManager
Close the ContainerManager. This method is called when the container manager is being closed and no longer needed. It provides the opportunity for the container manager to clean-up and close its resources.

Specified by:
close in interface IContainerManager
See Also:
IContainerManager.close()

Copyright 2006 IBM Corporation and others.
All Rights Reserved.