Knopflerfish OSGi 1.3.3

org.knopflerfish.util.metatype
Class SystemMetatypeProvider

java.lang.Object
  extended byorg.knopflerfish.util.metatype.MTP
      extended byorg.knopflerfish.util.metatype.SystemMetatypeProvider
All Implemented Interfaces:
MetaTypeProvider, PIDProvider

public class SystemMetatypeProvider
extends MTP

Class which monitors installed bundles for metatype and CM default data.

When instanciated, SystemMetatypeProvider will listen for installed bundles and try to extract metatype and Cm defaults XML from the bundle jar files. This data will then be available using the getServicePIDs, getFactoryPIDs and getObjectClassDefinition methods.


Field Summary
static java.lang.String ATTRIB_CMDEFAULTSURL
          Manifest attribute name specifying CM defaults XML URL.
static java.lang.String ATTRIB_METATYPEURL
          Manifest attribute name specifying metatype XML URL.
static java.lang.String CMDEFAULTS_RESOURCE
          Default URL to default CM values
static java.lang.String METATYPE_RESOURCE
          Default URL to metatype XML.
 
Constructor Summary
SystemMetatypeProvider(BundleContext bc)
          Create a SystemMetatypeProvider, using the specified bundle context for listeners.
 
Method Summary
 void addMTP(Bundle b, MTP mtp)
           
 void close()
          Stop listening for bundles.
 java.lang.String[] getFactoryPids()
          Get set of factory PIDs.
 java.lang.String[] getLocales()
          Return a list of locales available or null if only 1 The return parameter must be a name that consists of language [ _ country [ _ variation ]] as is customary in the Locale class.
 MTP getMTP(Bundle b)
          Get a loaded metatype provider, given a bundle.
 ObjectClassDefinition getObjectClassDefinition(java.lang.String pid, java.lang.String locale)
          Get an ObjectClassDefinition given a PID.
 java.lang.String[] getPids()
          Get set of service PIDs.
 MTP loadMTP(Bundle b)
          Explictly load a metatype provider from a bundle and cache it for later retrival by getMTP.
 void open()
          Start listening for bundles.
 
Methods inherited from class org.knopflerfish.util.metatype.MTP
addFactory, addService, compareTo, equals, getId, hashCode, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

METATYPE_RESOURCE

public static final java.lang.String METATYPE_RESOURCE
Default URL to metatype XML.

Value is "!/metatype.xml"

See Also:
Constant Field Values

CMDEFAULTS_RESOURCE

public static final java.lang.String CMDEFAULTS_RESOURCE
Default URL to default CM values

Value is "!/cmdefaults.xml"

See Also:
Constant Field Values

ATTRIB_METATYPEURL

public static final java.lang.String ATTRIB_METATYPEURL
Manifest attribute name specifying metatype XML URL.

Value is "Bundle-MetatypeURL"

See Also:
Constant Field Values

ATTRIB_CMDEFAULTSURL

public static final java.lang.String ATTRIB_CMDEFAULTSURL
Manifest attribute name specifying CM defaults XML URL.

Value is "Bundle-CMDefaultsURL"

See Also:
Constant Field Values
Constructor Detail

SystemMetatypeProvider

public SystemMetatypeProvider(BundleContext bc)
Create a SystemMetatypeProvider, using the specified bundle context for listeners.

Method Detail

open

public void open()
Start listening for bundles.


close

public void close()
Stop listening for bundles.


loadMTP

public MTP loadMTP(Bundle b)
            throws java.lang.Exception
Explictly load a metatype provider from a bundle and cache it for later retrival by getMTP.

Throws:
java.lang.Exception - if loading fails

addMTP

public void addMTP(Bundle b,
                   MTP mtp)

getPids

public java.lang.String[] getPids()
Description copied from interface: PIDProvider
Get set of service PIDs.

Specified by:
getPids in interface PIDProvider
Overrides:
getPids in class MTP

getFactoryPids

public java.lang.String[] getFactoryPids()
Description copied from interface: PIDProvider
Get set of factory PIDs.

Specified by:
getFactoryPids in interface PIDProvider
Overrides:
getFactoryPids in class MTP

getLocales

public java.lang.String[] getLocales()
Description copied from interface: MetaTypeProvider
Return a list of locales available or null if only 1 The return parameter must be a name that consists of language [ _ country [ _ variation ]] as is customary in the Locale class. This Locale class is not used because certain profiles do not contain it.

Specified by:
getLocales in interface MetaTypeProvider
Overrides:
getLocales in class MTP

getMTP

public MTP getMTP(Bundle b)
Get a loaded metatype provider, given a bundle.

Returns:
Provider if such provider is found, otherwise null.

getObjectClassDefinition

public ObjectClassDefinition getObjectClassDefinition(java.lang.String pid,
                                                      java.lang.String locale)
Get an ObjectClassDefinition given a PID.

Specified by:
getObjectClassDefinition in interface MetaTypeProvider
Overrides:
getObjectClassDefinition in class MTP
Returns:
ObjectClassDefinition if PID exists, otherwise null.

Knopflerfish OSGi 1.3.3