Framework Professional Edition Package


org.mbs.services.metatype
Interface MetaDataManager

All Superinterfaces:
com.prosyst.util.io.Remote

public interface MetaDataManager
extends com.prosyst.util.io.Remote

Interface for getting metatyping info of bundles deployed on the framework. Admin applications can use this service to get bundles' metatyping info.

Remote use of the service is enabled through the com.prosyst.util.io.Remote interface.

A bundle can publish its metatyping info in the framework either by providing xml resource in its jar file and describing it in the bundle's manifest headers (Config, FactoryConfig or any extended type), or by making its ManagedService & ManagedServiceFactory implement the MetaTypeProvider interface (as specified in ConfigurationManagement API).

To get use of the xml presentation of a metatype provider a bundle should follow the metatype.dtd, described in the documentation.

 A metatype header must follow the syntax:
 header:=subheader[, subheader]*
 subheader:=xml=<resource>; pid=<service.pid>[; name=<display name>][; version=<version>]

 For example:
 FactoryConfig: xml=/com/prosyst/mbs/impl/services/dhcp/dhcp-host-rules.xml;
   pid=mbs.dhcp.rules.host; name=HostRules; version=1.0.0,
   xml=/com/prosyst/mbs/impl/services/dhcp/dhcp-range-rules.xml;
   pid=mbs.dhcp.rules.range; name=RangeRules; version=1.0.1,
   xml=/com/prosyst/mbs/impl/services/dhcp/dhcp-leases.xml;
   pid=mbs.dhcp.leases; name=Leases

 Config: xml=/com/prosyst/mbs/impl/services/dhcp/dhcp-global.xml;
   pid=mbs.dhcp.options; name=Options; version=2.0.0
 


Field Summary
static int TYPE_OSGI
          Used to point that the type of the XML documet is defined by OSGi's R4 Specification
static int TYPE_PROSYST
          Used to point that the type of the XML documet is defined by ProSyst
 
Fields inherited from interface com.prosyst.util.io.Remote
AUTHORIZED_ROLES
 
Method Summary
 void addMetaDataListener(MetaDataListener listener, java.lang.String[] types)
          Adds/Replaces MetaDataListener.
 MetaTypeProviderExtern getAggregatedMetaTypeProvider(java.lang.String pid)
          Returns metatype provider info containing an objectclass(ObjectClassDefinitionImpl) having id equal to supplied pid.
 java.lang.String[] getMetaTypeProvidedFactoryPids(long bundleId)
          Returns all metatype info supported pids of "FactoryConfig" type and the corresponding display names provided by a bundle.
 java.lang.String[] getMetaTypeProvidedPids(long bundleId)
          Returns all metatype info supported pids of "Config" type and the corresponding display names provided by a bundle.
 java.lang.String[] getMetaTypeProvidedPids(long bundleId, java.lang.String[] types)
          Returns all metatype info supported pids of the listed types and the corresponding display names provided by a bundle.
 MetaTypeProviderExtern getMetaTypeProvider(java.lang.String pid, boolean original)
          Returns meta typing info, published in the framework either by the bundle's manifest metatype headers(Config, FactoryConfig, etc.) or as registered ManagedService or ManagedServiceFactory service implementing MetaTypeProvider interface (see OSGi ConfigurationManagement specification).
 java.net.URL getMetaTypeProviderResource(java.lang.String pid)
          Returns the url to the metatype xml for the specified pid if present.
 java.lang.String getMetaTypeProviderVersion(java.lang.String pid)
          Returns the version of the MetaTypeProvider for a pid or null if such information is not available.
 java.io.InputStream getMetaTypeProviderXML(java.lang.String pid)
          Deprecated. use getMetaTypeProviderResource instead
 long getProvidingBundle(java.lang.String pid)
          Returns the id of the bundle within the framework which exports the metatype provider with the specified pid.
 void removeMetaDataListener(MetaDataListener listener)
          Removes MetaDataListener.
 
Methods inherited from interface com.prosyst.util.io.Remote
remoteInterfaces
 

Field Detail

TYPE_OSGI

static final int TYPE_OSGI
Used to point that the type of the XML documet is defined by OSGi's R4 Specification

See Also:
Constant Field Values

TYPE_PROSYST

static final int TYPE_PROSYST
Used to point that the type of the XML documet is defined by ProSyst

See Also:
Constant Field Values
Method Detail

getProvidingBundle

long getProvidingBundle(java.lang.String pid)
                        throws java.io.IOException
Returns the id of the bundle within the framework which exports the metatype provider with the specified pid.

Parameters:
pid - The metatype provider pid.
Returns:
returns the id of the bundle which exports metatype provider with the specified pid within. If such pid is not currently present -1 will be returned.
Throws:
java.io.IOException - is thrown if error occured while accessing the storage.

getAggregatedMetaTypeProvider

MetaTypeProviderExtern getAggregatedMetaTypeProvider(java.lang.String pid)
                                                     throws java.io.IOException,
                                                            java.lang.Exception
Returns metatype provider info containing an objectclass(ObjectClassDefinitionImpl) having id equal to supplied pid. Attribute definition(AD)s of the ObjectClassDefinitionImpl should be calculated as aggregation of its original ADs and ADs of any other ObjectClassDefinitionImpl having id equal to any of the default values of an AD with id ObjectClassDefinitionEx.SUPER "super" belonging to the original ObjectClassDefinitionImpl.

Parameters:
pid - The metatype provider pid.
Returns:
The corresponding aggregated MetaTypeProvider to the pid; null if there is no matching instance or the passed pid is null.
Throws:
java.io.IOException - if an error occurs while getting the MetaTypeProvider.
java.lang.Exception - if an logical error(circular dependence, missing parent, duplicate or missing attribute definition(s)) occurs while calculating the aggreagated MetaTypeProvider.

getMetaTypeProvider

MetaTypeProviderExtern getMetaTypeProvider(java.lang.String pid,
                                           boolean original)
                                           throws java.io.IOException
Returns meta typing info, published in the framework either by the bundle's manifest metatype headers(Config, FactoryConfig, etc.) or as registered ManagedService or ManagedServiceFactory service implementing MetaTypeProvider interface (see OSGi ConfigurationManagement specification).

Parameters:
pid - The metatype provider pid.
original - Specifies whether the provider to be extracted from the metatype xml or to be returned the already stored one. For registered providers this parameter does not make sense.
Returns:
The corresponding MetaTypeProvider to the pid; null if there is no matching instance or the passed pid is null.
Throws:
java.io.IOException - if an error occurs while getting the MetaTypeProvider.
See Also:
MetaDataPlugin

getMetaTypeProviderXML

java.io.InputStream getMetaTypeProviderXML(java.lang.String pid)
                                           throws java.io.IOException
Deprecated. use getMetaTypeProviderResource instead

Returns stream to the metatype provider xml corresponding to the pid argument.

Parameters:
pid - The metatype provider pid.
Returns:
java.io.InputStream to the XML of the metatype with the the specified pid. null if pid is null, provider is not available or the resource is not available.
Throws:
java.io.IOException - if error occurs while accessing the storage or the resource.

getMetaTypeProviderResource

java.net.URL getMetaTypeProviderResource(java.lang.String pid)
                                         throws java.io.IOException
Returns the url to the metatype xml for the specified pid if present.

Parameters:
pid - The metatype provider pid.
Returns:
URL to the xml resource of the metatype provider with the specified pid if present. null otherwise.
Throws:
java.io.IOException - is thrown if error occured while creating this URL.

getMetaTypeProvidedPids

java.lang.String[] getMetaTypeProvidedPids(long bundleId)
Returns all metatype info supported pids of "Config" type and the corresponding display names provided by a bundle. This method is equivalent to getMetaTypeProvidedPids(long, String[]) when called with String[] { "Config" } parameter.

Parameters:
bundleId - The target bundle id.
Returns:
pids and display names in the following order: [pid0, name0, ..., pidN, nameN]; null if no configuration pids are available or an exception occurs while the storage is accessed.

getMetaTypeProvidedFactoryPids

java.lang.String[] getMetaTypeProvidedFactoryPids(long bundleId)
Returns all metatype info supported pids of "FactoryConfig" type and the corresponding display names provided by a bundle. This method is equivalent to getMetaTypeProvidedPids(long, String[]) when called with String[] { "FactoryConfig" } parameter.

Parameters:
bundleId - The target bundle id.
Returns:
pids and display names in the following order: [pid0, name0, ..., pidN, nameN]; null if no configuration pids are available or an exception occurs while the storage is accessed.

getMetaTypeProvidedPids

java.lang.String[] getMetaTypeProvidedPids(long bundleId,
                                           java.lang.String[] types)
Returns all metatype info supported pids of the listed types and the corresponding display names provided by a bundle. Data is extracted either from the storage or from registered metatype providers. In order information about registered metatype provider to be returned by this method, MetaTypeProviderExtern.METADATA_TYPE propery must be present into its registration properties.

Parameters:
bundleId - The target bundle id.
types - Set of the interested meta info types.
Returns:
pids and display names in the following order: [pid0, name0, ..., pidN, nameN]; null if no configuration pids are available or an exception occurs while the storage is accessed. Note that when a metatype provider is registered its display name should be null.

getMetaTypeProviderVersion

java.lang.String getMetaTypeProviderVersion(java.lang.String pid)
Returns the version of the MetaTypeProvider for a pid or null if such information is not available. Such information is optional and could be specified into the meta info header for the pid or when registered, via the MetaTypeProviderExtern.METADATA_VERSION property.
 Config: xml=/com/prosyst/mbs/impl/services/myservice/my-service.xml;
   pid=my-service.pid; name=MyService; version=1.0.0
 

Parameters:
pid - The metatype provider pid.
Returns:
the version of the specified pid, null if the specified metatype is not available or does not provide version information

addMetaDataListener

void addMetaDataListener(MetaDataListener listener,
                         java.lang.String[] types)
Adds/Replaces MetaDataListener.

Parameters:
listener - The listener to be added.
types - The metatypes the listener is interested in.
See Also:
MetaDataListener.metaDataChanged(int, long, java.lang.String, java.lang.String, java.lang.String, int)

removeMetaDataListener

void removeMetaDataListener(MetaDataListener listener)
Removes MetaDataListener.

Parameters:
listener - The listener to be removed.

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved