com.sun.mediametadata.impl
Class RepositoryViewImpl

java.lang.Object
  |
  +--com.sun.mediametadata.impl.RepositoryViewImpl

public class RepositoryViewImpl
extends java.lang.Object
implements RepositoryView

This class provides the way to manage the publishing of AMS asset definitions, and instantiating AssetView objects for these definitions. An asset definition defines the actual attributes and structure of an asset. Publishing such a definition causes the AMS to generate the schema/tables necessary to represent these assets. Once an asset definition has been published, an AssetView object can be created, which makes available most of the apis for manipulating assets!

Version:
1.14, 10/26/99
Author:
Andy Nuss
See Also:
StandardAssetDefinition

Constructor Summary
RepositoryViewImpl(ClientConnector connector, java.lang.String schemaName)
          Public constructor for the view on a client machine of the AMS repository of interest.
 
Method Summary
 Infrastructure exposeDatabase()
          Public accessor for the underlying database.
 AssetView getAssetView(java.lang.String assetUUName)
          Creates/gets an AssetView from this repository, and for this asset definition, as specified by uuname.
 DictionaryView getDictionaryView(AMSAsset asset, java.lang.String attributeName)
          Gets a DictionaryView for the dictionary definition, which is referenced by a particular field of an asset.
 DictionaryView getDictionaryView(java.lang.String dictionaryUUName)
          Gets a DictionaryView for this dictionary type and definition.
 java.lang.String getStandardAssetName()
          Get the uuName of the Standard Asset.
 AssetView getStandardAssetView()
          Attention: Gets the asset view for the StandardAssetDefinition.
 java.lang.String[] listAssetTypeNames()
          Return a list of uunames of all asset types that are currently available in this repository.
 java.lang.String[] listDictionaryTypeNames()
          Returns a list of the universally unique names of all dictionary types that are currently available in this repository.
 void publishAssetType(java.net.URL codebase, java.lang.String assetClassName)
          Publishes a new asset class/type with the repository.
 void publishDictionaryType(java.net.URL context, java.lang.String keyRecordClassName)
          Register/publish a new dictionary with the repository.
 void publishStandardAssetType()
          Attention: Publishes the StandardAssetDefinition of the AMS into the repository.
 void transferAssets(java.lang.String assetUUName, RepositoryView otherRepository, java.lang.String otherAssetUUName)
          Attention: This function copies asset metadata, including folder and dictionary links from one repository to another.
 void transferDictionary(java.lang.String sourceDictionaryUUName, RepositoryView destionaryRepository, java.lang.String destinationDictionaryUUName)
          Transfer the contents from the indicated dictionary from one asset repository to another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryViewImpl

public RepositoryViewImpl(ClientConnector connector,
                          java.lang.String schemaName)
                   throws AMSException
Public constructor for the view on a client machine of the AMS repository of interest. Requires an object which represents the client machine to the server.
Method Detail

exposeDatabase

public Infrastructure exposeDatabase()
Public accessor for the underlying database. TODO SOON : rename Infrastructure

publishAssetType

public void publishAssetType(java.net.URL codebase,
                             java.lang.String assetClassName)
                      throws AMSException
Publishes a new asset class/type with the repository. The asset definition is put into the database, meaning all of the bytecodes necessary to build an instance of AMSAsset. Also, tables required to represent these assets in the database are created.

When this asset is read in, its uuName is checked against the existing database and if an asset is already defined there with that uuName, then another check is made, namely does this existing asset have the same serialization id for its bytecodes! If so, it is assumed that its already the same. If not, then the asset definition is updated/created as described above.

Specified by:
publishAssetType in interface RepositoryView
Parameters:
codebase - URL for codebase (i.e. a classpath subsection), otherwise, if null, then use classpath
fullClassName - fully-qualified class name of asset definition
See Also:
StandardAssetDefinition, AMSAsset

listAssetTypeNames

public java.lang.String[] listAssetTypeNames()
                                      throws AMSException
Return a list of uunames of all asset types that are currently available in this repository. Universally unique names for asset registration are the responsibility of the AMS asset class definer. It is recommended to use versioning and descriptive information in this name. The limit on the length is 254 ascii characters.

The list returned does include the AMS StandardAssetDefinition, if published!

Specified by:
listAssetTypeNames in interface RepositoryView
Returns:
list of uunames of published assets
See Also:
StandardAssetDefinition.toUUName(), AMSAsset.toUUName().

transferAssets

public void transferAssets(java.lang.String assetUUName,
                           RepositoryView otherRepository,
                           java.lang.String otherAssetUUName)
                    throws AMSException
Attention: This function copies asset metadata, including folder and dictionary links from one repository to another. Non-compatible metadata is not copied. The way in which asset data is matched is based on alias name. If attribute types differ in the destination repository, a best effort is made to copy the data. Fields in the destination which are not available in the source are set to null. Dictionary records are automatically created (if necessary) in the destination (if referenced).
Specified by:
transferAssets in interface RepositoryView

getAssetView

public AssetView getAssetView(java.lang.String assetUUName)
                       throws AMSException
Creates/gets an AssetView from this repository, and for this asset definition, as specified by uuname.
Specified by:
getAssetView in interface RepositoryView
Parameters:
assetUUName - uuname for asset definition of requested asset view
Returns:
a view or set of methods to manage assets matching this uuname
See Also:
StandardAssetDefinition.toUUName(), AMSAsset.toUUName().

getStandardAssetName

public java.lang.String getStandardAssetName()
                                      throws AMSException
Get the uuName of the Standard Asset.
Specified by:
getStandardAssetName in interface RepositoryView
Returns:
uuname of the StandardAssetDefinition
See Also:
StandardAssetDefinition.toUUName()

publishStandardAssetType

public void publishStandardAssetType()
                              throws AMSException
Attention: Publishes the StandardAssetDefinition of the AMS into the repository. Checks to see if this asset definition has already, been published, and does nothing if it has. Publishing means creating the entire database schema that goes along with an asset definition.
Specified by:
publishStandardAssetType in interface RepositoryView
See Also:
StandardAssetDefinition.toUUName()

getStandardAssetView

public AssetView getStandardAssetView()
                               throws AMSException
Attention: Gets the asset view for the StandardAssetDefinition. However, if the method publishStandardAssetType has never been called for this repository, then an exception is thrown. An asset view is a set of methods for manipulating the assets which match their particular definition, in this case, the StandardAssetDefinition.
Specified by:
getStandardAssetView in interface RepositoryView
Returns:
the asset view for the StandardAssetDefinition
See Also:
StandardAssetDefinition

publishDictionaryType

public void publishDictionaryType(java.net.URL context,
                                  java.lang.String keyRecordClassName)
                           throws AMSException
Register/publish a new dictionary with the repository. Generally, there is no need to use this method, because any dictionary definition referenced by an asset definition is published at the time of publishing the asset definition. A dictionary definition is simply the specific class definition of the AMSKeyRecord being linked by an asset definition. Normally, this is simply StandardDictionaryDefinition supplied by the AMS.

Use this method if the definition needs to add some user attributes, or change/evolve in some other way.

Specified by:
publishDictionaryType in interface RepositoryView
Parameters:
codebase - URL for codebase (i.e. a classpath subsection), otherwise, if null, then use classpath
fullClassName - fully-qualified class name of key record definition
See Also:
StandardDictionaryDefinition, AMSKeyRecord

listDictionaryTypeNames

public java.lang.String[] listDictionaryTypeNames()
                                           throws AMSException
Returns a list of the universally unique names of all dictionary types that are currently available in this repository. A dictionary definition is a special class extending AMSKeyRecord. For an explanation of uuname, see listAssetNames.
Specified by:
listDictionaryTypeNames in interface RepositoryView
Returns:
the list of uunames for published dictionarys (normally just StandardDictionaryDefinition)
See Also:
listAssetTypeNames(), AMSKeyRecord.toUUName(), AMSKeyRecord.toUUName().

transferDictionary

public void transferDictionary(java.lang.String sourceDictionaryUUName,
                               RepositoryView destionaryRepository,
                               java.lang.String destinationDictionaryUUName)
                        throws AMSException
Transfer the contents from the indicated dictionary from one asset repository to another. Normally, this should be done transparently by the transferAssets method.
Specified by:
transferDictionary in interface RepositoryView

getDictionaryView

public DictionaryView getDictionaryView(java.lang.String dictionaryUUName)
                                 throws AMSException
Gets a DictionaryView for this dictionary type and definition. The dictionary requested is by its uuname, but more often than not, this is StandardDictionaryDefinition.toUUName(). For an explanation of uuname, see listAssetNames.
Specified by:
getDictionaryView in interface RepositoryView
Parameters:
dictionaryUUName - uuname for specified dictionary (normally just StandardDictionaryDefinition)
Returns:
view of dictionary containing methods for listing all entries, and adding and deleting an entry
See Also:
#listAssetNames(), AMSKeyRecord.toUUName(), AMSKeyRecord.toUUName()

getDictionaryView

public DictionaryView getDictionaryView(AMSAsset asset,
                                        java.lang.String attributeName)
                                 throws AMSException
Gets a DictionaryView for the dictionary definition, which is referenced by a particular field of an asset. This field be either an AMSKey or an AMSKeyList attribute. The dictionary requested is, more often than not, simply the StandardDictionaryDefinition.
Specified by:
getDictionaryView in interface RepositoryView
Parameters:
asset - an asset previously queried, or the template from the asset factory
attributeSpecifier - the attribute specifier for the AMSKey or AMSKeyList attribute
Returns:
the dictionary containing methods for listing all entries, and adding and deleting an entry
See Also:
AMSKey.toUUName(), com.sun.mediametadata.objects.AMSKeyList#toUUName(), AMSKeyRecord.toUUName(), AssetView.getAssetFactory(), RecordFactory.getTemplate(), AttributeName