org.sakaiproject.component.osid.repository.registry
Class RepositoryManager

java.lang.Object
  extended byorg.sakaiproject.component.osid.repository.registry.RepositoryManager
All Implemented Interfaces:
org.osid.OsidManager, org.osid.repository.RepositoryManager, Serializable

public class RepositoryManager
extends Object
implements org.osid.repository.RepositoryManager

This is an implementation of the RepositoryManager interface in the Repository OSID. This implementation federates across other RepositoryManagers. These managers are found in a registry. The details of the registry are hidden within the implementation of a "straw-man" Registry OSID. That OSID's RegistryManager provides access to the individual RepositoryManagers' Repositories. In this implementation of RepositoryManager, in many cases we pass the call to the registered implementations and the result or results.

Version:
Author:
Massachusetts Institute of Techbology, Sakai Software Development Team
See Also:
Serialized Form

Constructor Summary
RepositoryManager()
           
 
Method Summary
 void assignConfiguration(Properties configurationProperties)
          Simply stores the Configuration and then sets up to access implementations of the RegistryManager and an IdManager
 void assignOsidContext(org.osid.OsidContext context)
          Simply stores the OsidContext
 org.osid.shared.Id copyAsset(org.osid.repository.Repository repository, org.osid.shared.Id assetId)
          Unimplemented method
 org.osid.repository.Repository createRepository(String displayName, String description, org.osid.shared.Type repositoryType)
          Unimplemented method.
 void deleteRepository(org.osid.shared.Id repositoryId)
          Unimplemented method.
 org.osid.repository.Asset getAsset(org.osid.shared.Id assetId)
          Working from the current Repository Manager Registry, this method asks each manager to get the asset.
 org.osid.repository.Asset getAssetByDate(org.osid.shared.Id assetId, long date)
          Working from the current Repository Manager Registry, this method asks each manager to get the asset.
 org.osid.shared.LongValueIterator getAssetDates(org.osid.shared.Id assetId)
          Working from the current Repository Manager Registry, this method asks each manager to get the asset's dates.
 org.osid.repository.AssetIterator getAssetsBySearch(org.osid.repository.Repository[] repositories, Serializable searchCriteria, org.osid.shared.Type searchType, org.osid.shared.Properties searchProperties)
          Working from the current Repository Manager Registry, this method asks each manager to search for the assets.
 org.osid.OsidContext getOsidContext()
          Simply return OsidContext set by assignOsidContext
 org.osid.repository.RepositoryIterator getRepositories()
          Working from the current Repository Manager Registry, this method returns the union of Repositories across registered RepositoryManagers.
 org.osid.repository.RepositoryIterator getRepositoriesByType(org.osid.shared.Type repositoryType)
          Working from the current Repository Manager Registry, this method returns the union of Repositories across registered RepositoryManagers.
 org.osid.repository.Repository getRepository(org.osid.shared.Id repositoryId)
          Working from the current Repository Manager Registry, this method checks the repository id provided against the known repositories ids for a match.
 org.osid.shared.TypeIterator getRepositoryTypes()
          Working from the current Repository Manager Registry, this method asks each manager to get all its repository types.
 void osidVersion_2_0()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryManager

public RepositoryManager()
Method Detail

getOsidContext

public org.osid.OsidContext getOsidContext()
                                    throws org.osid.repository.RepositoryException
Simply return OsidContext set by assignOsidContext

Specified by:
getOsidContext in interface org.osid.OsidManager
Throws:
org.osid.repository.RepositoryException

assignOsidContext

public void assignOsidContext(org.osid.OsidContext context)
                       throws org.osid.repository.RepositoryException
Simply stores the OsidContext

Specified by:
assignOsidContext in interface org.osid.OsidManager
Throws:
org.osid.repository.RepositoryException

assignConfiguration

public void assignConfiguration(Properties configurationProperties)
                         throws org.osid.repository.RepositoryException
Simply stores the Configuration and then sets up to access implementations of the RegistryManager and an IdManager

Specified by:
assignConfiguration in interface org.osid.OsidManager
Throws:
org.osid.repository.RepositoryException

createRepository

public org.osid.repository.Repository createRepository(String displayName,
                                                       String description,
                                                       org.osid.shared.Type repositoryType)
                                                throws org.osid.repository.RepositoryException
Unimplemented method. We don't know to which RepositoryManager to delegate this, so we do nothing.

Specified by:
createRepository in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

deleteRepository

public void deleteRepository(org.osid.shared.Id repositoryId)
                      throws org.osid.repository.RepositoryException
Unimplemented method. We could do this by checking all managers, but this seems outside the purpose of this implementation.

Specified by:
deleteRepository in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getRepositories

public org.osid.repository.RepositoryIterator getRepositories()
                                                       throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method returns the union of Repositories across registered RepositoryManagers. Note that the contents of the Registry can change at run-time and the Repositories and their order returned by a registered RepositoryManager can change at any time.

If an exception is thrown by a call to a manager, the exception is logged and processing continues.

This method can throw org.osid.OsidException.OPERATION_FAILED

Specified by:
getRepositories in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getRepositoriesByType

public org.osid.repository.RepositoryIterator getRepositoriesByType(org.osid.shared.Type repositoryType)
                                                             throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method returns the union of Repositories across registered RepositoryManagers. Note that the contents of the Registry can change at run-time and the Repositories and their order returned by a registered RepositoryManager can change at any time.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. Any repository that does not support the repositoryType, should throw the exception org.osid.shared.SharedException.UNKNOWN_TYPE.

This method throws org.osid.shared.SharedException.NULL_ARGUMENT if the repositoryType argument is null. This method throws org.osid.shared.SharedException.UNKNOWN_TYPE if all managers throw this exception. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getRepositoriesByType in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getRepository

public org.osid.repository.Repository getRepository(org.osid.shared.Id repositoryId)
                                             throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method checks the repository id provided against the known repositories ids for a match.

This implementation assumes repository ids are unique and returns the first repository whose id matches the criterion.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. Any repository that does not recognize the repository id, should throw the exception org.osid.shared.SharedException.UNKNOWN_ID. This method throws org.osid.shared.SharedException.NULL_ARGUMENT if the repositoryId argument is null. This method throws org.osid.shared.SharedException.UNKNOWN_ID if all managers throw this exception. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getRepository in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getAsset

public org.osid.repository.Asset getAsset(org.osid.shared.Id assetId)
                                   throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method asks each manager to get the asset.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. Any manager that does not recognize the asset id, should throw the exception org.osid.shared.SharedException.UNKNOWN_ID. This method throws org.osid.shared.SharedException.NULL_ARGUMENT if the assetId argument is null. This method throws org.osid.shared.SharedException.UNKNOWN_ID if all managers throw this exception. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getAsset in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getAssetByDate

public org.osid.repository.Asset getAssetByDate(org.osid.shared.Id assetId,
                                                long date)
                                         throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method asks each manager to get the asset.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. Any manager that does not recognize the asset id, should throw the exception org.osid.shared.SharedException.UNKNOWN_ID. This method throws org.osid.shared.SharedException.NULL_ARGUMENT if the assetId argument is null. This method throws org.osid.shared.SharedException.UNKNOWN_ID if all managers throw this exception. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getAssetByDate in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getAssetDates

public org.osid.shared.LongValueIterator getAssetDates(org.osid.shared.Id assetId)
                                                throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method asks each manager to get the asset's dates.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. Any manager that does not recognize the asset id, should throw the exception org.osid.shared.SharedException.UNKNOWN_ID. This method throws org.osid.shared.SharedException.NULL_ARGUMENT if the repositories argument is null. This method throws org.osid.shared.SharedException.UNKNOWN_ID if all managers throw this exception. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getAssetDates in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getAssetsBySearch

public org.osid.repository.AssetIterator getAssetsBySearch(org.osid.repository.Repository[] repositories,
                                                           Serializable searchCriteria,
                                                           org.osid.shared.Type searchType,
                                                           org.osid.shared.Properties searchProperties)
                                                    throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method asks each manager to search for the assets.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. This method throws org.osid.shared.SharedException.NULL_ARGUMENT if the repositories argument is null. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getAssetsBySearch in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

copyAsset

public org.osid.shared.Id copyAsset(org.osid.repository.Repository repository,
                                    org.osid.shared.Id assetId)
                             throws org.osid.repository.RepositoryException
Unimplemented method

Specified by:
copyAsset in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

getRepositoryTypes

public org.osid.shared.TypeIterator getRepositoryTypes()
                                                throws org.osid.repository.RepositoryException
Working from the current Repository Manager Registry, this method asks each manager to get all its repository types. The method returns distinct values -- no duplicates.

If an exception is thrown by a call to a manager, the exception is logged and processing continues. This method can throw org.osid.OsidException.OPERATION_FAILED.

Specified by:
getRepositoryTypes in interface org.osid.repository.RepositoryManager
Throws:
org.osid.repository.RepositoryException

osidVersion_2_0

public void osidVersion_2_0()
                     throws org.osid.repository.RepositoryException
Specified by:
osidVersion_2_0 in interface org.osid.OsidManager
Throws:
org.osid.repository.RepositoryException