Difference between revisions of "Metadata Manager"

From Gcube Wiki
Jump to: navigation, search
(Dependencies)
Line 1: Line 1:
 +
[[Image:Alert_icon2.gif]] ''THIS SECTION OF GCUBE DOCUMENTATION IS CURRENTLY UNDER UPDATE.''
 +
 
=== Introduction ===
 
=== Introduction ===
  

Revision as of 15:56, 14 July 2008

Alert icon2.gif THIS SECTION OF GCUBE DOCUMENTATION IS CURRENTLY UNDER UPDATE.

Introduction

The Metadata Catalog service aims at modelling of arbitrary metadata relationships (IDB-relationships). The only assumption it does is that the metadata objects are serialized as well-formed XML documents. The service has a two-fold role:

  • to manage Metadata Objects and Metadata Collections
  • to establish secondary role-typed links. Such relationships can be in place between any type of Information Object and in the scope of a Collection or not

Metadata Object

A Metadata Object (MO) is a source Information Object for an IDB-relationship. An MO can be associated to one and only one target Information Object (even if in the context of different Metadata Collections) which is described by the MO. An MO here is always intended as an XML document wrapped in a well defined envelope. As to content, the Metadata Manager Service adopts an exchange model to add a number of system-level properties needed for the appropriate management of the Metadata Objects within the context of the Metadata Manager Service.

The Metadata Manager Components

The main functionality of the Metadata Manager components is the management of Metadata Objects, Metadata Collection and their relationships. To operate over Metadata Collections, the Metadata Catalog instantiates Collection Managers (or shortly, Managers) for each collection. A Collection Manager is the access point to all the possible operations over a specific Metadata Collection. From an architectural point of view, the Metadata Manager adopts the Factory pattern and Collection Managers are implemented as a stateful WS-Resource. Physically, the service is composed by:

  • the MetadataManagerFactory, a factory service that creates new Collection Managers and offers some cross-Collection operations
  • the MetadataManagerService, a service that operates over Metadata Collections (MCs) and on Metadata Objects as Elements, i.e. members of a specific Metadata Collection


MetadataManagerFactory

The MetadataManagerFactory Service creates new Collection Managers and offers some cross-Collection operations. Moreover, it operates on Metadata Objects as Information Objects related to other Information Objects and not as Members of Metadata Collections.

  • EndPointReferenceType createManager(CollectionID, params): This operation takes a set of creation parameters and creates a new Manager in order to manage a Metadata Collection bound to such a Collection. If a Metadata Collection with the specified Metadata characteristics does not exist, the Manager creates the Metadata Collection, binds it with the Document Collection with the given secondary role relationship and publishes its profile in the IS. The Creation parameters are a set of key-value; the following keys are defined in the MMLibrary and accepted by the operation:
    • COLLECTIONNAME -> name of the collection
    • DESCRIPTION -> description
    • ROLE -> secondary role
    • INDEXABLE -> if the collection is indexable or not (“True”/”False”)
    • USER -> if the collection is a user collection or not (“True”/”False”)
    • METADATANAME -> metadata name (e.g. “dc”)
    • METADATALANG -> metadata language (e.g. “English”), as specified in the ISO 639-2
    • METADATAURI -> metadata URI: the XML Schema that defines the MO payloads
    • GENERATEDBY_COLLID -> the name of the source collection If the collection is the result of a tranformation from another collection
    • GENERATEDBY_NAME -> the source Metadata Collection from which the current one has been generated (by the Metadata Broker), if any
    • GENERATEDBY_URI -> the source XML Schema from which the current one has been generated (by the Metadata Broker), if any
    • Among the others, two parameters can modify the way in which the Metadata Collection is managed:
      • Indexable: if the new Metadata Collection is indexable, the Manager creates also a new MetadataXMLIndexer (see Section 4.2.2.3) for such a Collection using the XMLIndexer Service;
      • User: a user Collection is shown in the Portals and an end-user can operate on it; a non-user Collection is intended for internal puporses (like to collec
  • ResultSetService

t parts of persisted Indexes).

  • EndPointReferenceType createManagerFromCollection (MetadataCollectionID): This operation takes a Metadata Collection ID. It returns:
    • the related CollectionManager, if it already exists
    • creates a new CollectionManager and returns its EPR, if the Metadata Collection exists
    • an error, if the Collection ID is not valid
  • MOID addMetadata(ObjectID, MO, SecondaryRole): This operation takes a new non-collectable Metadata Object and
    • completes the metadata header information (e.g. the MOID, if it is not specified)
    • stores (or updates if the MOID is already included in the MO header) the object on the Storage Management Service as Information Object
    • creates a <is-described-by, <SecondaryRole>> binding in the Storage Management Service between the Metadata Object and the Information Object identified by the given Object ID
    • returns the assigned MOID
  • void deleteMetadata(MOID): This operation deletes from the Storage Management Service the Metadata Object identified by the given ID.
  • (ObjectID, (MO, SecondaryRole)[])[] getMetadata ((ObjectID, SecondaryRole, CollectionID, Rank)[]): For each given ObjectID, this operation returns the Metadata Objets. They are:
    • bound with the specified secondary role (the primary role is, of course, is-described-by) to the Information Object identified by that ObjectID
    • members of the specified Metadata Collection. The operation relies on the String[] retrieveReferred(String targetObjectID, String role, String secondaryrole) operation of the Storage Management Service.

Dependencies

These are the dependencies of the Service :

  • XMLIndexer
  • ResultSetService
  • ContentManagement
  • MMLibrary

Usage Examples

This example shows how to create a MetadataManager:


...
String factoryURI = "http://dlib29.isti.cnr.it:8080/wsrf/services/gcube/metadatamanagement/metadatamanager/MetadataManagerFactory";

		MetadataManagerFactoryServiceAddressingLocator factoryLocator = new MetadataManagerFactoryServiceAddressingLocator();
		//MetadataManagerServiceAddressingLocator  instanceLocator = new MetadataManagerServiceAddressingLocator();
		try {			
			EndpointReferenceType factoryEPR = new EndpointReferenceType();
			MetadataManagerFactoryPortType mFactory;			
			factoryEPR.setAddress(new Address(factoryURI));
			System.out.println("Creating the new Factory portType");
			mFactory= factoryLocator.getMetadataManagerFactoryPortTypePort(factoryEPR);
			
			CreateManagerRequest request = new CreateManagerRequest();
			request.setCollectionID("D4S-test2");
			CollectionParameter [] ss = new CollectionParameter[12];
			CreateCollectionParameters ccp = new CreateCollectionParameters();			
			
			ss[0] = new CollectionParameter();
			ss[1] = new CollectionParameter();
			ss[2] = new CollectionParameter();
			ss[3] = new CollectionParameter();
			ss[4] = new CollectionParameter();
			ss[5] = new CollectionParameter();
			ss[6] = new CollectionParameter();
			ss[7] = new CollectionParameter();
			ss[8] = new CollectionParameter();
			ss[9] = new CollectionParameter();
			ss[10] = new CollectionParameter();
			ss[11] = new CollectionParameter();
			
			ss[0].setName(CreationParameters.COLLECTIONNAME.toString());
			ss[0].setValue("testMCollection");
			ss[1].setName(CreationParameters.DESCRIPTION.toString());
			ss[1].setValue("d4Science Mcollection test");
			ss[2].setName(CreationParameters.GENERATEDBY_NAME.toString());
			ss[2].setValue("example");
			ss[3].setName(CreationParameters.GENERATEDBY_URI.toString());
			ss[3].setValue("http://mail.google.com/mail");
			ss[4].setName(CreationParameters.EDITABLE.toString());
			ss[4].setValue("false");
			ss[5].setName(CreationParameters.INDEXABLE.toString());
			ss[5].setValue("false");
			ss[6].setName(CreationParameters.USER.toString());
			ss[6].setValue("true");
			ss[7].setName(CreationParameters.METADATALANG.toString());
			ss[7].setValue("en");
			ss[8].setName(CreationParameters.METADATANAME.toString());
			ss[8].setValue("dc");
			ss[9].setName(CreationParameters.METADATAURI.toString());
			ss[9].setValue("http://mail.google.com/mail");
			ss[10].setName(CreationParameters.ROLE.toString());
			ss[10].setValue("is-described-by");
			ss[11].setName(CreationParameters.GENERATEDBY_COLLID.toString());
			ss[11].setValue("collid_gen");
			
			
			ccp.setParams(ss);
			request.setCollectionParameters(ccp);
			CreateManagerResponse response  = null;
			try{				
				 mFactory = GCUBERemotePortTypeContext.getProxy(mFactory,GCUBEScope.getScope("/gcube/devsec"));
 	               
				response = mFactory.createManager(request);
			}catch(Exception e ){
				e.printStackTrace();
				return;
			}
			
			System.out.println(response.getEndpointReference().toString());
		} catch (Exception e) {
			
			e.printStackTrace();			
		}
....