com.eurotech.framework.core.util
Class ComponentUtil

java.lang.Object
  extended by com.eurotech.framework.core.util.ComponentUtil

public class ComponentUtil
extends Object

Utility class to handle the loading of the meta-information of a bundle or one of its Services/Components.


Constructor Summary
ComponentUtil()
           
 
Method Summary
static Map<String,Object> getDefaultProperties(OCD ocd)
           
static Map<String,OCD> getObjectClassDefinition(org.osgi.framework.BundleContext ctx, org.osgi.framework.Bundle bnd)
          Returns a Map with all the MetaType Object Class Definitions contained in the bundle.
static org.osgi.service.metatype.ObjectClassDefinition getObjectClassDefinition(org.osgi.framework.BundleContext ctx, String pid)
          Returns the ObjectClassDefinition for the provided Service pid as returned by the native OSGi MetaTypeService.
static Tocd readObjectClassDefinition(org.osgi.framework.Bundle bundle, String pid)
          Returned the ObjectClassDefinition as parsed from the XML file.
static Tocd readObjectClassDefinition(String pid)
          Returned the ObjectClassDefinition as parsed from the XML file.
static OCD readObjectClassDefinition(URL resourceUrl)
          Returned the ObjectClassDefinition as parsed from the XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentUtil

public ComponentUtil()
Method Detail

getObjectClassDefinition

public static Map<String,OCD> getObjectClassDefinition(org.osgi.framework.BundleContext ctx,
                                                       org.osgi.framework.Bundle bnd)
Returns a Map with all the MetaType Object Class Definitions contained in the bundle.

Parameters:
ctx -
bnd -
Returns:

getObjectClassDefinition

public static org.osgi.service.metatype.ObjectClassDefinition getObjectClassDefinition(org.osgi.framework.BundleContext ctx,
                                                                                       String pid)
Returns the ObjectClassDefinition for the provided Service pid as returned by the native OSGi MetaTypeService. The returned ObjectClassDefinition is a thick object tied to OSGi framework which masks certain attributes of the OCD XML file - like required and min/max values - but which exposes business logic like the validate method for each attribute.

Parameters:
ctx -
pid -
Returns:

readObjectClassDefinition

public static OCD readObjectClassDefinition(URL resourceUrl)
                                     throws IOException,
                                            JAXBException,
                                            XMLStreamException,
                                            FactoryConfigurationError
Returned the ObjectClassDefinition as parsed from the XML file. The returned OCD is just an object representation of the OCD element contained in the XML MetaData file and it does not contain any extra post-processing of the loaded information.

Parameters:
resourceUrl - Url of the MetaData XML file which needs to be loaded
Returns:
Throws:
IOException
JAXBException
XMLStreamException
FactoryConfigurationError

readObjectClassDefinition

public static Tocd readObjectClassDefinition(String pid)
                                      throws IOException,
                                             JAXBException,
                                             XMLStreamException,
                                             FactoryConfigurationError
Returned the ObjectClassDefinition as parsed from the XML file. The returned OCD is just an object representation of the OCD element contained in the XML MetaData file and it does not contain any extra post-processing of the loaded information.

Parameters:
pid - ID of the service whose OCD should be loaded
Returns:
Throws:
IOException
JAXBException
XMLStreamException
FactoryConfigurationError

readObjectClassDefinition

public static Tocd readObjectClassDefinition(org.osgi.framework.Bundle bundle,
                                             String pid)
                                      throws IOException,
                                             JAXBException,
                                             XMLStreamException,
                                             FactoryConfigurationError
Returned the ObjectClassDefinition as parsed from the XML file. The returned OCD is just an object representation of the OCD element contained in the XML MetaData file and it does not contain any extra post-processing of the loaded information.

Parameters:
ctx -
pid - ID of the service whose OCD should be loaded
Returns:
Throws:
IOException
JAXBException
XMLStreamException
FactoryConfigurationError

getDefaultProperties

public static Map<String,Object> getDefaultProperties(OCD ocd)
                                               throws EsfException
Throws:
EsfException


Copyright © 2013. All Rights Reserved.