Class ComponentMetadata
java.lang.Object
org.apache.felix.scr.impl.metadata.ComponentMetadata
This class holds the information associated to a component in the descriptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
private static final String
private String
private boolean
private boolean
private String
private boolean
private String
private boolean
private boolean
private boolean
private final DSVersion
private boolean
private String
private final List
<PropertyMetadata> private Boolean
private String
private String
private String
private String
private Boolean
private boolean
private final List
<PropertyMetadata> private final List
<ReferenceMetadata> private ServiceMetadata
private boolean
private static final ServiceMetadata
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDependency
(ReferenceMetadata newReference) Used to add a reference metadata to the componentvoid
addFactoryProperty
(PropertyMetadata newProperty) Used to add a factory property to the instancevoid
addProperty
(PropertyMetadata newProperty) Used to add a property to the instanceprivate void
void
collectStrings
(Set<String> strings) Returns the name of the activate methodReturns the names of the activation fieldsReturns the configuration pid for the component.Returns the configuration PolicyReturns the name of the deactivate methodReturns the dependency descriptorsReturns the namespace code of the namespace of the component element declaring this component.Returns the factory identifierReturns the factory properties.(package private) List
<PropertyMetadata> Returns the list of factory property meta data.Returns the name of the implementation classReturns the name of the modified methodgetName()
Returns the name of the componentint
Returns the number of constructor parameters (0 is default)int
getPidIndex
(TargetedPID pid) Returns the properties.(package private) List
<PropertyMetadata> Returns the list of property meta data.Returns the associated ServiceMetadataprivate byte
boolean
Returns whether the activate method has been declared in the descriptor or not.boolean
boolean
Returnstrue
if the configuration policy is configured toCONFIGURATION_POLICY_IGNORE
.boolean
Returnstrue
if the configuration policy is configured toCONFIGURATION_POLICY_OPTIONAL
.boolean
Returns whether the configuration-pid has been declared in the descriptor or not.boolean
Returnstrue
if the configuration policy is configured toCONFIGURATION_POLICY_REQUIRE
.boolean
boolean
Returns whether the deactivate method has been declared in the descriptor or not.boolean
boolean
boolean
Returns the value of the enabled flagboolean
Test to see if this service is a factoryboolean
Returns the flag that defines the activation policy for the component.boolean
boolean
static ComponentMetadata
load
(DataInputStream in, MetadataStoreHelper.MetaDataReader metaDataReader) (package private) static Object
loadPropertyValue
(DataInputStream in, MetadataStoreHelper.MetaDataReader metaDataReader) void
setActivate
(String activate) Sets the name of the activate methodvoid
setActivationFields
(String[] fields) void
setConfigurableServiceProperties
(boolean configurableServiceProperties) void
setConfigurationPid
(String[] configurationPid) Setter for the configuration-pid component (since DS 1.2)void
setConfigurationPolicy
(String configurationPolicy) Sets the configuration policyvoid
setConfigureWithInterfaces
(boolean configureWithInterfaces) void
setDeactivate
(String deactivate) Sets the name of the deactivate methodvoid
setDelayedKeepInstances
(boolean delayedKeepInstances) void
setDeleteCallsModify
(boolean deleteCallsModify) void
setEnabled
(boolean enabled) Setter for the enabled propertyvoid
setFactoryIdentifier
(String factoryIdentifier) void
setImmediate
(boolean immediate) Setter for the immediate propertyvoid
setImplementationClassName
(String implementationClassName) Sets the name of the implementation classvoid
void
setModified
(String modified) Sets the name of the modified methodvoid
Setter for the namevoid
setObsoleteFactoryComponentFactory
(boolean obsoleteFactoryComponentFactory) void
setPersistentFactoryComponent
(boolean persistentFactoryComponent) void
setService
(ServiceMetadata service) Used to set a ServiceMetadata object.void
store
(DataOutputStream out, MetadataStoreHelper.MetaDataWriter metaDataWriter) (package private) void
storePropertyValue
(Object value, DataOutputStream out, MetadataStoreHelper.MetaDataWriter metaDataWriter) void
validate()
Method used to verify if the semantics of this metadata are correct(package private) org.osgi.service.component.ComponentException
validationFailure
(String reason) Returns aComponentException
for this component with the given explanation for failure.
-
Field Details
-
CONFIGURATION_POLICY_REQUIRE
- See Also:
-
CONFIGURATION_POLICY_IGNORE
- See Also:
-
CONFIGURATION_POLICY_OPTIONAL
- See Also:
-
CONFIGURATION_POLICY_VALID
-
IMPLEMENTATION_CLASS_DUPLICATE
- See Also:
-
SERVICE_DUPLICATE
-
m_dsVersion
-
m_name
-
m_enabled
private boolean m_enabled -
m_factory
-
m_immediate
-
m_implementationClassName
-
m_activate
-
m_activateDeclared
private boolean m_activateDeclared -
m_deactivate
-
m_deactivateDeclared
private boolean m_deactivateDeclared -
m_modified
-
m_configurationPolicy
-
m_configurationPid
-
m_activationFields
-
m_properties
-
m_factoryProperties
-
m_propertyMetaData
-
m_factoryPropertyMetaData
-
m_service
-
m_references
-
m_configurableServiceProperties
private boolean m_configurableServiceProperties -
m_persistentFactoryComponent
private boolean m_persistentFactoryComponent -
m_deleteCallsModify
private boolean m_deleteCallsModify -
m_obsoleteFactoryComponentFactory
-
m_configureWithInterfaces
private boolean m_configureWithInterfaces -
m_delayedKeepInstances
private boolean m_delayedKeepInstances -
m_init
-
m_validated
private boolean m_validated -
TypeString
private static final byte TypeString- See Also:
-
TypeLong
private static final byte TypeLong- See Also:
-
TypeDouble
private static final byte TypeDouble- See Also:
-
TypeFloat
private static final byte TypeFloat- See Also:
-
TypeInteger
private static final byte TypeInteger- See Also:
-
TypeByte
private static final byte TypeByte- See Also:
-
TypeChar
private static final byte TypeChar- See Also:
-
TypeBoolean
private static final byte TypeBoolean- See Also:
-
TypeShort
private static final byte TypeShort- See Also:
-
-
Constructor Details
-
ComponentMetadata
-
-
Method Details
-
setConfigurationPid
Setter for the configuration-pid component (since DS 1.2)- Parameters:
configurationPid
-
-
setName
Setter for the name- Parameters:
name
-
-
setEnabled
public void setEnabled(boolean enabled) Setter for the enabled property- Parameters:
enabled
-
-
setFactoryIdentifier
- Parameters:
factoryIdentifier
-
-
setImmediate
public void setImmediate(boolean immediate) Setter for the immediate property- Parameters:
immediate
-
-
setImplementationClassName
Sets the name of the implementation class- Parameters:
implementationClassName
- a class name
-
setConfigurationPolicy
Sets the configuration policy- Parameters:
configurationPolicy
- configuration policy- Since:
- 1.2.0 (DS 1.1)
-
setActivate
Sets the name of the activate method- Parameters:
activate
- a method name- Since:
- 1.2.0 (DS 1.1)
-
setDeactivate
Sets the name of the deactivate method- Parameters:
deactivate
- a method name- Since:
- 1.2.0 (DS 1.1)
-
setModified
Sets the name of the modified method- Parameters:
modified
- a method name- Since:
- 1.2.0 (DS 1.1)
-
addProperty
Used to add a property to the instance- Parameters:
newProperty
- a property metadata object
-
addFactoryProperty
Used to add a factory property to the instance- Parameters:
newProperty
- a property metadata object
-
setService
Used to set a ServiceMetadata object.- Parameters:
service
- a ServiceMetadata
-
addDependency
Used to add a reference metadata to the component- Parameters:
newReference
- a new ReferenceMetadata to be added
-
setConfigurableServiceProperties
public void setConfigurableServiceProperties(boolean configurableServiceProperties) -
setPersistentFactoryComponent
public void setPersistentFactoryComponent(boolean persistentFactoryComponent) -
setDeleteCallsModify
public void setDeleteCallsModify(boolean deleteCallsModify) -
setObsoleteFactoryComponentFactory
public void setObsoleteFactoryComponentFactory(boolean obsoleteFactoryComponentFactory) -
setConfigureWithInterfaces
public void setConfigureWithInterfaces(boolean configureWithInterfaces) -
setDelayedKeepInstances
public void setDelayedKeepInstances(boolean delayedKeepInstances) -
setActivationFields
-
setInit
-
getDSVersion
Returns the namespace code of the namespace of the component element declaring this component. This is one of the XmlHandler.DS_VERSION_* constants. -
getName
Returns the name of the component- Returns:
- A string containing the name of the component
-
getConfigurationPid
Returns the configuration pid for the component. The pid is the one specified in the component's configuration-pid DS 1.2 attribute, if specified. Else the component name is used as the pid by default. -
getPidIndex
-
isConfigurationPidDeclared
public boolean isConfigurationPidDeclared()Returns whether the configuration-pid has been declared in the descriptor or not.- Returns:
- whether the configuration-pid has method has been declared in the descriptor or not.
- Since:
- DS 1.2
-
isEnabled
public boolean isEnabled()Returns the value of the enabled flag- Returns:
- a boolean containing the value of the enabled flag
-
getFactoryIdentifier
Returns the factory identifier- Returns:
- A string containing a factory identifier or null
-
isImmediate
public boolean isImmediate()Returns the flag that defines the activation policy for the component.This method may only be trusted after this instance has been validated by the
validate()
call. Else it will either return the value of an explicitly set "immediate" attribute or return false if a service element or the factory attribute is set or true otherwise. This latter default value deduction may be unsafe while the descriptor has not been completely read.- Returns:
- a boolean that defines the activation policy
-
getImplementationClassName
Returns the name of the implementation class- Returns:
- the name of the implementation class
-
getConfigurationPolicy
Returns the configuration Policy- Returns:
- the configuration policy
- Since:
- 1.2.0 (DS 1.1)
-
getActivate
Returns the name of the activate method- Returns:
- the name of the activate method
- Since:
- 1.2.0 (DS 1.1)
-
isActivateDeclared
public boolean isActivateDeclared()Returns whether the activate method has been declared in the descriptor or not.- Returns:
- whether the activate method has been declared in the descriptor or not.
- Since:
- 1.2.0 (DS 1.1)
-
getNumberOfConstructorParameters
public int getNumberOfConstructorParameters()Returns the number of constructor parameters (0 is default)- Returns:
- The number of constructor parameters
- Since:
- 2.1.0 (DS 1.4)
-
getActivationFields
Returns the names of the activation fields- Returns:
- the list of activation fields or
null
- Since:
- 2.1.0 (DS 1.4)
-
getDeactivate
Returns the name of the deactivate method- Returns:
- the name of the deactivate method
- Since:
- 1.2.0 (DS 1.1)
-
isDeactivateDeclared
public boolean isDeactivateDeclared()Returns whether the deactivate method has been declared in the descriptor or not.- Returns:
- whether the deactivate method has been declared in the descriptor or not.
- Since:
- 1.2.0 (DS 1.1)
-
getModified
Returns the name of the modified method- Returns:
- the name of the modified method
- Since:
- 1.2.0 (DS 1.1)
-
getServiceMetadata
Returns the associated ServiceMetadata- Returns:
- a ServiceMetadata object or null if the Component does not provide any service
-
getServiceScope
-
getProperties
Returns the properties.- Returns:
- the properties as a Dictionary
-
getFactoryProperties
Returns the factory properties.- Returns:
- the factory properties as a Dictionary
-
getPropertyMetaData
List<PropertyMetadata> getPropertyMetaData()Returns the list of property meta data. Note: This method is intended for unit testing only- Returns:
- the list of property meta data.
-
getFactoryPropertyMetaData
List<PropertyMetadata> getFactoryPropertyMetaData()Returns the list of factory property meta data. Note: This method is intended for unit testing only- Returns:
- the list of property meta data.
-
getDependencies
Returns the dependency descriptors- Returns:
- a Collection of dependency descriptors
-
isFactory
public boolean isFactory()Test to see if this service is a factory- Returns:
- true if it is a factory, false otherwise
-
isConfigurationRequired
public boolean isConfigurationRequired()Returnstrue
if the configuration policy is configured toCONFIGURATION_POLICY_REQUIRE
. -
isConfigurationIgnored
public boolean isConfigurationIgnored()Returnstrue
if the configuration policy is configured toCONFIGURATION_POLICY_IGNORE
. -
isConfigurationOptional
public boolean isConfigurationOptional()Returnstrue
if the configuration policy is configured toCONFIGURATION_POLICY_OPTIONAL
. -
isConfigurableServiceProperties
public boolean isConfigurableServiceProperties() -
isPersistentFactoryComponent
public boolean isPersistentFactoryComponent() -
isDeleteCallsModify
public boolean isDeleteCallsModify() -
isObsoleteFactoryComponentFactory
public boolean isObsoleteFactoryComponentFactory() -
isConfigureWithInterfaces
public boolean isConfigureWithInterfaces() -
isDelayedKeepInstances
public boolean isDelayedKeepInstances() -
validate
public void validate()Method used to verify if the semantics of this metadata are correct -
validationFailure
Returns aComponentException
for this component with the given explanation for failure.- Parameters:
reason
- The explanation for failing to validate this component.
-
collectStrings
-
collectStrings
-
store
public void store(DataOutputStream out, MetadataStoreHelper.MetaDataWriter metaDataWriter) throws IOException - Throws:
IOException
-
load
public static ComponentMetadata load(DataInputStream in, MetadataStoreHelper.MetaDataReader metaDataReader) throws IOException - Throws:
IOException
-
loadPropertyValue
static Object loadPropertyValue(DataInputStream in, MetadataStoreHelper.MetaDataReader metaDataReader) throws IOException - Throws:
IOException
-
storePropertyValue
void storePropertyValue(Object value, DataOutputStream out, MetadataStoreHelper.MetaDataWriter metaDataWriter) throws IOException - Throws:
IOException
-
getType
-