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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDependency(ReferenceMetadata newReference) Used to add a reference metadata to the componentvoidaddFactoryProperty(PropertyMetadata newProperty) Used to add a factory property to the instancevoidaddProperty(PropertyMetadata newProperty) Used to add a property to the instancevoidcollectStrings(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.Returns the name of the implementation classReturns the name of the modified methodgetName()Returns the name of the componentintReturns the number of constructor parameters (0 is default)intgetPidIndex(TargetedPID pid) Returns the properties.Returns the associated ServiceMetadatabooleanReturns whether the activate method has been declared in the descriptor or not.booleanbooleanReturnstrueif the configuration policy is configured toCONFIGURATION_POLICY_IGNORE.booleanReturnstrueif the configuration policy is configured toCONFIGURATION_POLICY_OPTIONAL.booleanReturns whether the configuration-pid has been declared in the descriptor or not.booleanReturnstrueif the configuration policy is configured toCONFIGURATION_POLICY_REQUIRE.booleanbooleanReturns whether the deactivate method has been declared in the descriptor or not.booleanbooleanbooleanReturns the value of the enabled flagbooleanTest to see if this service is a factorybooleanReturns the flag that defines the activation policy for the component.booleanbooleanstatic ComponentMetadataload(DataInputStream in, MetadataStoreHelper.MetaDataReader metaDataReader) voidsetActivate(String activate) Sets the name of the activate methodvoidsetActivationFields(String[] fields) voidsetConfigurableServiceProperties(boolean configurableServiceProperties) voidsetConfigurationPid(String[] configurationPid) Setter for the configuration-pid component (since DS 1.2)voidsetConfigurationPolicy(String configurationPolicy) Sets the configuration policyvoidsetConfigureWithInterfaces(boolean configureWithInterfaces) voidsetDeactivate(String deactivate) Sets the name of the deactivate methodvoidsetDelayedKeepInstances(boolean delayedKeepInstances) voidsetDeleteCallsModify(boolean deleteCallsModify) voidsetEnabled(boolean enabled) Setter for the enabled propertyvoidsetFactoryIdentifier(String factoryIdentifier) voidsetImmediate(boolean immediate) Setter for the immediate propertyvoidsetImplementationClassName(String implementationClassName) Sets the name of the implementation classvoidvoidsetModified(String modified) Sets the name of the modified methodvoidSetter for the namevoidsetObsoleteFactoryComponentFactory(boolean obsoleteFactoryComponentFactory) voidsetPersistentFactoryComponent(boolean persistentFactoryComponent) voidsetService(ServiceMetadata service) Used to set a ServiceMetadata object.voidstore(DataOutputStream out, MetadataStoreHelper.MetaDataWriter metaDataWriter) voidvalidate()Method used to verify if the semantics of this metadata are correct
-
Field Details
-
CONFIGURATION_POLICY_REQUIRE
- See Also:
-
CONFIGURATION_POLICY_IGNORE
- See Also:
-
CONFIGURATION_POLICY_OPTIONAL
- 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
-
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()Returnstrueif the configuration policy is configured toCONFIGURATION_POLICY_REQUIRE. -
isConfigurationIgnored
public boolean isConfigurationIgnored()Returnstrueif the configuration policy is configured toCONFIGURATION_POLICY_IGNORE. -
isConfigurationOptional
public boolean isConfigurationOptional()Returnstrueif 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 -
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
-