Reformat to Apache Felix formatting guidlines
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@741602 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java b/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java
index a40f069..b837989 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ComponentMetadata.java
@@ -18,6 +18,7 @@
*/
package org.apache.felix.scr.impl;
+
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Hashtable;
@@ -27,178 +28,211 @@
import org.osgi.service.component.ComponentException;
+
/**
* This class holds the information associated to a component in the descriptor * */
-public class ComponentMetadata {
- // 112.4.3: A Globally unique component name (required)
- private String m_name;
-
- // 112.4.3: Controls whether the component is enabled when the bundle is started. (optional, default is true).
- private boolean m_enabled = true;
-
- // 112.4.3: Factory identified. If set to a non empty string, it indicates that the component is a factory component (optional).
- private String m_factory = null;
-
- // 112.4.3: Controls whether component configurations must be immediately activated after becoming
- // satisfied or whether activation should be delayed. (optional, default value depends
- // on whether the component has a service element or not).
- private Boolean m_immediate = null;
-
+public class ComponentMetadata
+{
+ // 112.4.3: A Globally unique component name (required)
+ private String m_name;
+
+ // 112.4.3: Controls whether the component is enabled when the bundle is started. (optional, default is true).
+ private boolean m_enabled = true;
+
+ // 112.4.3: Factory identified. If set to a non empty string, it indicates that the component is a factory component (optional).
+ private String m_factory = null;
+
+ // 112.4.3: Controls whether component configurations must be immediately activated after becoming
+ // satisfied or whether activation should be delayed. (optional, default value depends
+ // on whether the component has a service element or not).
+ private Boolean m_immediate = null;
+
// 112.4.4 Implementation Element (required)
private String m_implementationClassName = null;
-
+
// Associated properties (0..*)
private Dictionary m_properties = new Hashtable();
-
+
// List of Property metadata - used while building the meta data
// while validating the properties contained in the PropertyMetadata
// instances are copied to the m_properties Dictionary while this
// list will be cleared
private List m_propertyMetaData = new ArrayList();
-
+
// Provided services (0..1)
private ServiceMetadata m_service = null;
-
+
// List of service references, (required services 0..*)
private List m_references = new ArrayList();
-
+
// Flag that is set once the component is verified (its properties cannot be changed)
private boolean m_validated = false;
-
-
+
+
/////////////////////////////////////////// SETTERS //////////////////////////////////////
-
+
/**
* Setter for the name
*
* @param name
*/
- public void setName(String name) {
- if(m_validated) {
- return;
- }
- m_name = name;
+ public void setName( String name )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
+ m_name = name;
}
-
+
+
/**
* Setter for the enabled property
*
* @param enabled
*/
- public void setEnabled(boolean enabled) {
- if(m_validated) {
- return;
- }
- m_enabled = enabled;
+ public void setEnabled( boolean enabled )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
+ m_enabled = enabled;
}
-
+
+
/**
*
* @param factoryIdentifier
*/
- public void setFactoryIdentifier(String factoryIdentifier) {
- if(m_validated) {
- return;
- }
- m_factory = factoryIdentifier;
+ public void setFactoryIdentifier( String factoryIdentifier )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
+ m_factory = factoryIdentifier;
}
-
+
+
/**
* Setter for the immediate property
*
* @param immediate
*/
- public void setImmediate(boolean immediate) {
- if(m_validated) {
- return;
- }
- m_immediate = immediate ? Boolean.TRUE : Boolean.FALSE;
- }
-
+ public void setImmediate( boolean immediate )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
+ m_immediate = immediate ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+
/**
* Sets the name of the implementation class
*
* @param implementationClassName a class name
*/
- public void setImplementationClassName(String implementationClassName) {
- if(m_validated) {
- return;
- }
+ public void setImplementationClassName( String implementationClassName )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
m_implementationClassName = implementationClassName;
}
+
/**
* Used to add a property to the instance
*
* @param newProperty a property metadata object
*/
- public void addProperty(PropertyMetadata newProperty) {
- if(m_validated) {
- return;
- }
- if(newProperty == null) {
- throw new IllegalArgumentException ("Cannot add a null property");
- }
- m_propertyMetaData.add(newProperty);
+ public void addProperty( PropertyMetadata newProperty )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
+ if ( newProperty == null )
+ {
+ throw new IllegalArgumentException( "Cannot add a null property" );
+ }
+ m_propertyMetaData.add( newProperty );
}
+
/**
* Used to set a ServiceMetadata object.
*
* @param service a ServiceMetadata
*/
- public void setService(ServiceMetadata service) {
- if(m_validated) {
- return;
- }
+ public void setService( ServiceMetadata service )
+ {
+ if ( m_validated )
+ {
+ return;
+ }
m_service = service;
}
+
/**
* Used to add a reference metadata to the component
*
* @param newReference a new ReferenceMetadata to be added
*/
- public void addDependency(ReferenceMetadata newReference) {
- if(m_validated) {
+ public void addDependency( ReferenceMetadata newReference )
+ {
+ if ( m_validated )
+ {
return;
}
- if(newReference == null) {
- throw new IllegalArgumentException ("Cannot add a null ReferenceMetadata");
- }
- m_references.add(newReference);
+ if ( newReference == null )
+ {
+ throw new IllegalArgumentException( "Cannot add a null ReferenceMetadata" );
+ }
+ m_references.add( newReference );
}
-
+
/////////////////////////////////////////// GETTERS //////////////////////////////////////
-
+
/**
* Returns the name of the component
*
* @return A string containing the name of the component
*/
- public String getName() {
- return m_name;
+ public String getName()
+ {
+ return m_name;
}
-
+
+
/**
* Returns the value of the enabled flag
*
* @return a boolean containing the value of the enabled flag
*/
- public boolean isEnabled() {
- return m_enabled;
+ public boolean isEnabled()
+ {
+ return m_enabled;
}
+
/**
* Returns the factory identifier
*
* @return A string containing a factory identifier or null
*/
- public String getFactoryIdentifier() {
- return m_factory;
+ public String getFactoryIdentifier()
+ {
+ return m_factory;
}
-
+
+
/**
* Returns the flag that defines the activation policy for the component.
* <p>
@@ -211,71 +245,85 @@
*
* @return a boolean that defines the activation policy
*/
- public boolean isImmediate() {
+ public boolean isImmediate()
+ {
// return explicit value if known
- if ( m_immediate != null ) {
+ if ( m_immediate != null )
+ {
return m_immediate.booleanValue();
}
// deduce default from service element and factory attribute presence
return m_service == null && m_factory == null;
}
-
+
+
/**
* Returns the name of the implementation class
*
* @return the name of the implementation class
*/
- public String getImplementationClassName() {
+ public String getImplementationClassName()
+ {
return m_implementationClassName;
}
+
/**
* Returns the associated ServiceMetadata
*
* @return a ServiceMetadata object or null if the Component does not provide any service
*/
- public ServiceMetadata getServiceMetadata() {
- return m_service;
+ public ServiceMetadata getServiceMetadata()
+ {
+ return m_service;
}
+
/**
* Returns the properties.
*
* @return the properties as a Dictionary
*/
- public Dictionary getProperties() {
+ public Dictionary getProperties()
+ {
return m_properties;
}
+
/**
* Returns the dependency descriptors
*
* @return a Collection of dependency descriptors
*/
- public List getDependencies() {
+ public List getDependencies()
+ {
return m_references;
}
+
/**
* Test to see if this service is a factory
*
* @return true if it is a factory, false otherwise
*/
- public boolean isFactory() {
+ public boolean isFactory()
+ {
return m_factory != null;
}
-
+
+
/**
* Method used to verify if the semantics of this metadata are correct
*/
void validate()
{
// nothing to do if already validated
- if (m_validated) {
+ if ( m_validated )
+ {
return;
}
-
+
// 112.10 The name of the component is required
if ( m_name == null )
{
@@ -311,7 +359,7 @@
{
ReferenceMetadata refMeta = ( ReferenceMetadata ) referenceIterator.next();
refMeta.validate( this );
-
+
// flag duplicates
if ( !refs.add( refMeta.getName() ) )
{