You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2012/05/14 15:21:05 UTC
svn commit: r1338189 [2/4] - in /felix/sandbox/cziegeler:
eventadmin-tests/src/test/java/org/apache/felix/eventadmin/tests/
scrplugin/annotations/
scrplugin/annotations/src/main/java/org/apache/felix/scr/annotations/
scrplugin/annotations/src/main/java...
Modified: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java?rev=1338189&r1=1338188&r2=1338189&view=diff
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java (original)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java Mon May 14 13:21:02 2012
@@ -20,17 +20,10 @@ package org.apache.felix.scrplugin;
import java.io.File;
-import java.util.*;
-import org.apache.felix.scrplugin.helper.*;
-import org.apache.felix.scrplugin.om.*;
-import org.apache.felix.scrplugin.om.metatype.*;
-import org.apache.felix.scrplugin.tags.*;
-import org.apache.felix.scrplugin.tags.annotation.AnnotationJavaClassDescription;
-import org.apache.felix.scrplugin.tags.qdox.QDoxJavaClassDescription;
-import org.apache.felix.scrplugin.xml.ComponentDescriptorIO;
-import org.apache.felix.scrplugin.xml.MetaTypeIO;
-import org.osgi.service.metatype.MetaTypeService;
+import org.apache.felix.scrplugin.helper.AnnotationProcessorManager;
+import org.apache.felix.scrplugin.helper.ClassScanner;
+import org.apache.felix.scrplugin.helper.IssueLog;
/**
@@ -46,64 +39,55 @@ import org.osgi.service.metatype.MetaTyp
* <p>
* Instances of this class are not thread save and should not be reused.
*/
-public class SCRDescriptorGenerator
-{
+public class SCRDescriptorGenerator {
private final Log logger;
- private File outputDirectory = null;
-
- private JavaClassDescriptorManager descriptorManager;
+ private File outputDirectory;
private String finalName = "serviceComponents.xml";
private String metaTypeName = "metatype.xml";
- private boolean generateAccessors = true;
-
- protected boolean strictMode = false;
-
- private Map<String, String> properties = new HashMap<String, String>();
-
- private String specVersion = null;
+ /** The project. */
+ private Project project;
+ /** The options. */
+ private Options options = new Options();
/**
* Create an instance of this generator using the given {@link Log}
* instance of logging.
*/
- public SCRDescriptorGenerator( Log logger )
- {
+ public SCRDescriptorGenerator(final Log logger ) {
this.logger = logger;
}
-
/**
- * Sets the directory where the descriptor files will be created.
- * <p>
- * This field has no default value and this setter <b>must</b> called prior
- * to calling {@link #execute()}.
+ * Set the project.
+ * This is required.
*/
- public void setOutputDirectory( File outputDirectory )
- {
- this.outputDirectory = outputDirectory;
+ public void setProject(final Project p) {
+ this.project = p;
}
+ /**
+ * Set the options.
+ */
+ public void setOptions(final Options p) {
+ this.options = p;
+ }
/**
- * Sets the {@link JavaClassDescriptorManager} instance used to access
- * existing descriptors and to parse JavaDoc tags as well as interpret
- * the SCR annotations.
+ * Sets the directory where the descriptor files will be created.
* <p>
* This field has no default value and this setter <b>must</b> called prior
* to calling {@link #execute()}.
*/
- public void setDescriptorManager( JavaClassDescriptorManager descriptorManager )
- {
- this.descriptorManager = descriptorManager;
+ public void setOutputDirectory( final File outputDirectory ) {
+ this.outputDirectory = outputDirectory;
}
-
/**
* Sets the name of the SCR declaration descriptor file. This file will be
* created in the <i>OSGI-INF</i> directory below the
@@ -114,12 +98,10 @@ public class SCRDescriptorGenerator
* <p>
* The default value of this property is <code>serviceComponents.xml</code>.
*/
- public void setFinalName( String finalName )
- {
+ public void setFinalName( final String finalName ) {
this.finalName = finalName;
}
-
/**
* Sets the name of the file taking the Metatype Service descriptors. This
* file will be created in the <i>OSGI-INF/metatype</i> directory below the
@@ -130,73 +112,10 @@ public class SCRDescriptorGenerator
* <p>
* The default value of this property is <code>metatype.xml</code>.
*/
- public void setMetaTypeName( String metaTypeName )
- {
+ public void setMetaTypeName( final String metaTypeName ) {
this.metaTypeName = metaTypeName;
}
-
- /**
- * Defines whether bind and unbind methods are automatically created by
- * the SCR descriptor generator.
- * <p>
- * The generator uses the ASM library to create the method byte codes
- * directly inside the class files. If bind and unbind methods are not
- * to be created, the generator fails if such methods are missing.
- * <p>
- * The default value of this property is <code>true</code>.
- */
- public void setGenerateAccessors( boolean generateAccessors )
- {
- this.generateAccessors = generateAccessors;
- }
-
-
- /**
- * Defines whether warnings should be considered as errors and thus cause
- * the generation process to fail.
- * <p>
- * The default value of this property is <code>false</code>.
- */
- public void setStrictMode( boolean strictMode )
- {
- this.strictMode = strictMode;
- }
-
-
- /**
- * Sets global properties to be set for each descriptor. If a descriptor
- * provides properties of the same name, the descriptor properties are preferred
- * over the properties provided here.
- * <p>
- * The are no default global properties.
- */
- public void setProperties( Map<String, String> properties )
- {
- this.properties = new HashMap<String, String>( properties );
- }
-
-
- /**
- * Sets the Declarative Services specification version number to be forced
- * on the declarations.
- * <p>
- * Supported values for this property are <code>null</code> to autodetect
- * the specification version, <code>1.0</code> to force 1.0 descriptors and
- * <code>1.1</code> to force 1.1 descriptors. If 1.0 descriptors are forced
- * the generation fails if a descriptor requires 1.1 functionality.
- * <p>
- * The default is to generate the descriptor version according to the
- * capabilities used by the descriptors. If no 1.1 capabilities, such as
- * <code>configuration-policy</code>, are used, version 1.0 is used,
- * otherwise a 1.1 descriptor is generated.
- */
- public void setSpecVersion( String specVersion )
- {
- this.specVersion = specVersion;
- }
-
-
/**
* Actually generates the Declarative Services and Metatype descriptors
* scanning the java sources provided by the
@@ -207,26 +126,35 @@ public class SCRDescriptorGenerator
* @throws SCRDescriptorException
* @throws SCRDescriptorFailureException
*/
- public boolean execute() throws SCRDescriptorException, SCRDescriptorFailureException
- {
+ public boolean execute()
+ throws SCRDescriptorException, SCRDescriptorFailureException {
+ if ( this.project == null ) {
+ throw new SCRDescriptorFailureException("Project has not been set!");
+ }
+
this.logger.debug( "Starting SCRDescriptorMojo...." );
- this.logger.debug( "..generating accessors: " + this.generateAccessors );
- this.logger.debug( "..parsing javadocs: " + this.descriptorManager.isParseJavadocs() );
- this.logger.debug( "..processing annotations: " + this.descriptorManager.isProcessAnnotations() );
+ this.logger.debug( "..generating accessors: " + this.options.isGenerateAccessors() );
// check speck version configuration
- int specVersion = toSpecVersionCode( this.specVersion, null );
- if ( this.specVersion == null )
- {
+ if ( this.options.getSpecVersion() == null ) {
this.logger.debug( "..auto detecting spec version" );
- }
- else
- {
- this.logger.debug( "..using spec version " + this.specVersion + " (" + specVersion + ")" );
+ } else {
+ this.logger.debug( "..using spec version " + this.options.getSpecVersion().getName());
}
- final IssueLog iLog = new IssueLog( this.strictMode );
+ // create a log
+ final IssueLog iLog = new IssueLog( this.options.isStrictMode() );
+ // create the annotation processor manager
+ final AnnotationProcessor aProcessor = new AnnotationProcessorManager(options.getAnnotationProcessors(),
+ this.project.getClassLoader());
+
+ // create the class scanner - and start scanning
+ final ClassScanner scanner = new ClassScanner();
+ scanner.execute(logger, project, aProcessor);
+
+ return true;
+ /*
final MetaData metaData = new MetaData();
metaData.setLocalization( MetaTypeService.METATYPE_DOCUMENTS_LOCATION + "/metatype" );
@@ -257,30 +185,21 @@ public class SCRDescriptorGenerator
}
else
{
- try
- {
+ try {
final Component comp = this.createComponent( javaSources[i], tag, metaData, iLog );
- if ( comp.getSpecVersion() > specVersion )
- {
+ if ( this.specVersion == null || comp.getSpecVersion().ordinal() > specVersion.ordinal() ) {
// if a spec version has been configured and a component requires a higher
// version, this is considered an error!
- if ( this.specVersion != null )
- {
- String v = Constants.COMPONENT_DS_SPEC_VERSION_10;
- if ( comp.getSpecVersion() == Constants.VERSION_1_1 )
- {
- v = Constants.COMPONENT_DS_SPEC_VERSION_11;
- }
- iLog.addError( "Component " + comp + " requires spec version " + v
+ if ( this.specVersion != null ) {
+ iLog.addError( "Component " + comp + " requires spec version " + comp.getSpecVersion().name()
+ " but plugin is configured to use version " + this.specVersion, tag
.getSourceLocation(), tag.getLineNumber() );
+ } else {
+ specVersion = comp.getSpecVersion();
}
- specVersion = comp.getSpecVersion();
}
scannedComponents.add( comp );
- }
- catch ( SCRDescriptorException sde )
- {
+ } catch ( final SCRDescriptorException sde ) {
iLog.addError( sde.getMessage(), sde.getSourceLocation(), sde.getLineNumber() );
}
}
@@ -451,561 +370,6 @@ public class SCRDescriptorGenerator
addResources = true;
}
- return addResources;
- }
-
-
- /**
- * Create a component for the java class description.
- * @param description
- * @return The generated component descriptor or null if any error occurs.
- * @throws SCRDescriptorException
- */
- protected Component createComponent( JavaClassDescription description, JavaTag componentTag, MetaData metaData,
- final IssueLog iLog ) throws SCRDescriptorException
- {
- // create a new component
- final Component component = new Component( componentTag );
-
- // set implementation
- component.setImplementation( new Implementation( description.getName() ) );
-
- final boolean inherited = getBoolean( componentTag, Constants.COMPONENT_INHERIT, true );
- final OCD ocd = this.doComponent( componentTag, component, metaData,inherited, iLog );
-
- this.doServices( description.getTagsByName( Constants.SERVICE, inherited ), component, description );
-
- // collect references from class tags and fields
- final Map<String, Object[]> references = new LinkedHashMap<String, Object[]>();
- // Utility handler for propertie
- final PropertyHandler propertyHandler = new PropertyHandler( component, ocd );
-
- JavaClassDescription currentDescription = description;
- do
- {
- // properties
- final JavaTag[] props = currentDescription.getTagsByName( Constants.PROPERTY, false );
- for ( int i = 0; i < props.length; i++ )
- {
- propertyHandler.testProperty( props[i], null, description == currentDescription );
- }
-
- // references
- final JavaTag[] refs = currentDescription.getTagsByName( Constants.REFERENCE, false );
- for ( int i = 0; i < refs.length; i++ )
- {
- this.testReference( references, refs[i], null, description == currentDescription );
- }
-
- // fields
- final JavaField[] fields = currentDescription.getFields();
- for ( int i = 0; i < fields.length; i++ )
- {
- JavaTag tag = fields[i].getTagByName( Constants.REFERENCE );
- if ( tag != null )
- {
- this.testReference( references, tag, fields[i].getName(), description == currentDescription );
- }
-
- propertyHandler.handleField( fields[i], description == currentDescription );
- }
-
- currentDescription = currentDescription.getSuperClass();
- }
- while ( inherited && currentDescription != null );
-
- // process properties
- propertyHandler.processProperties( this.properties, iLog );
-
- // process references
- final Iterator<Map.Entry<String, Object[]>> refIter = references.entrySet().iterator();
- while ( refIter.hasNext() )
- {
- final Map.Entry<String, Object[]> entry = refIter.next();
- final String refName = entry.getKey();
- final Object[] values = entry.getValue();
- final JavaTag tag = ( JavaTag ) values[0];
- this.doReference( tag, refName, component, values[1].toString(), ((Boolean)values[2]).booleanValue() );
- }
-
- // pid handling
- final boolean createPid = getBoolean( componentTag, Constants.COMPONENT_CREATE_PID, true );
- if ( createPid )
- {
- // check for an existing pid first
- boolean found = false;
- final Iterator<Property> iter = component.getProperties().iterator();
- while ( !found && iter.hasNext() )
- {
- final Property prop = iter.next();
- found = org.osgi.framework.Constants.SERVICE_PID.equals( prop.getName() );
- }
- if ( !found )
- {
- final Property pid = new Property();
- component.addProperty( pid );
- pid.setName( org.osgi.framework.Constants.SERVICE_PID );
- pid.setValue( component.getName() );
- }
- }
- return component;
- }
-
-
- /**
- * Fill the component object with the information from the tag.
- * @param tag
- * @param component
- */
- protected OCD doComponent( final JavaTag tag,
- final Component component,
- final MetaData metaData,
- final boolean inherit,
- final IssueLog iLog )
- throws SCRDescriptorException
- {
-
- // check if this is an abstract definition
- final String abstractType = tag.getNamedParameter( Constants.COMPONENT_ABSTRACT );
- if ( abstractType != null )
- {
- component.setAbstract( "yes".equalsIgnoreCase( abstractType ) || "true".equalsIgnoreCase( abstractType ) );
- }
- else
- {
- // default true for abstract classes, false otherwise
- component.setAbstract( tag.getJavaClassDescription().isAbstract() );
- }
-
- // check if this is a definition to ignore
- final String ds = tag.getNamedParameter( Constants.COMPONENT_DS );
- component.setDs( ( ds == null ) ? true : ( "yes".equalsIgnoreCase( ds ) || "true".equalsIgnoreCase( ds ) ) );
-
- String name = tag.getNamedParameter( Constants.COMPONENT_NAME );
- component.setName( StringUtils.isEmpty( name ) ? component.getImplementation().getClassame() : name );
-
- component.setEnabled( Boolean.valueOf( getBoolean( tag, Constants.COMPONENT_ENABLED, true ) ) );
- component.setFactory( tag.getNamedParameter( Constants.COMPONENT_FACTORY ) );
-
- // FELIX-1703: support explicit SCR version declaration
- final String dsSpecVersion = tag.getNamedParameter( Constants.COMPONENT_DS_SPEC_VERSION );
- if ( dsSpecVersion != null )
- {
- component.setSpecVersion( toSpecVersionCode( dsSpecVersion, tag ) );
- }
-
- // FELIX-593: immediate attribute does not default to true all the
- // times hence we only set it if declared in the tag
- if ( tag.getNamedParameter( Constants.COMPONENT_IMMEDIATE ) != null )
- {
- component.setImmediate( Boolean.valueOf( getBoolean( tag, Constants.COMPONENT_IMMEDIATE, true ) ) );
- }
-
- // check for V1.1 attributes: configuration policy
- if ( tag.getNamedParameter( Constants.COMPONENT_CONFIG_POLICY ) != null )
- {
- component.setSpecVersion( Constants.VERSION_1_1 );
- component.setConfigurationPolicy( tag.getNamedParameter( Constants.COMPONENT_CONFIG_POLICY ) );
- }
- // check for V1.1 attributes: activate, deactivate, modified
- component.setActivate(this.checkLifecycleMethod(component, Constants.COMPONENT_ACTIVATE, tag, inherit));
- component.setDeactivate(this.checkLifecycleMethod(component, Constants.COMPONENT_DEACTIVATE, tag, inherit));
- component.setModified(this.checkLifecycleMethod(component, Constants.COMPONENT_MODIFIED, tag, inherit));
-
- // whether metatype information is to generated for the component
- final String metaType = tag.getNamedParameter( Constants.COMPONENT_METATYPE );
- final boolean hasMetaType = metaType == null || "yes".equalsIgnoreCase( metaType )
- || "true".equalsIgnoreCase( metaType );
- if ( !component.isAbstract() && hasMetaType )
- {
- // ocd
- final OCD ocd = new OCD();
- metaData.addOCD( ocd );
- ocd.setId( component.getName() );
- String ocdName = tag.getNamedParameter( Constants.COMPONENT_LABEL );
- if ( ocdName == null )
- {
- ocdName = "%" + component.getName() + ".name";
- }
- ocd.setName( ocdName );
- String ocdDescription = tag.getNamedParameter( Constants.COMPONENT_DESCRIPTION );
- if ( ocdDescription == null )
- {
- ocdDescription = "%" + component.getName() + ".description";
- }
- ocd.setDescription( ocdDescription );
- // designate
- final Designate designate = new Designate();
- metaData.addDesignate( designate );
- designate.setPid( component.getName() );
-
- // factory pid
- final String setFactoryPidValue = tag.getNamedParameter( Constants.COMPONENT_SET_METATYPE_FACTORY_PID );
- final boolean setFactoryPid = setFactoryPidValue != null
- && ( "yes".equalsIgnoreCase( setFactoryPidValue ) || "true".equalsIgnoreCase( setFactoryPidValue ) );
- if ( setFactoryPid )
- {
- if ( component.getFactory() == null )
- {
- designate.setFactoryPid( component.getName() );
- }
- else
- {
- iLog.addWarning( "Component factory " + component.getName()
- + " should not set metatype factory pid.", tag.getSourceLocation(), tag.getLineNumber() );
- }
- }
- // designate.object
- final MTObject mtobject = new MTObject();
- designate.setObject( mtobject );
- mtobject.setOcdref( component.getName() );
- return ocd;
- }
- return null;
- }
-
- private String checkLifecycleMethod(final Component component,
- final String methodTagName,
- final JavaTag tag,
- final boolean inherit)
- throws SCRDescriptorException
- {
- String method = null;
- if ( tag.getNamedParameter( methodTagName ) != null )
- {
- method = tag.getNamedParameter( methodTagName );
- }
- else if ( inherit )
- {
- // check if a super class has the activate method specified
- JavaClassDescription desc = tag.getJavaClassDescription().getSuperClass();
- while ( desc != null && method == null )
- {
- final JavaTag componentTag = desc.getTagByName( Constants.COMPONENT );
- if ( componentTag != null && componentTag.getNamedParameter( methodTagName ) != null )
- {
- method = componentTag.getNamedParameter( methodTagName );
- }
- desc = desc.getSuperClass();
- }
- }
- if ( method != null )
- {
- component.setSpecVersion( Constants.VERSION_1_1 );
- }
- return method;
- }
-
- /**
- * Process the service annotations
- * @param services
- * @param component
- * @param description
- * @throws SCRDescriptorException
- */
- protected void doServices( JavaTag[] services, Component component, JavaClassDescription description )
- throws SCRDescriptorException
- {
- // no services, hence certainly no service factory
- if ( services == null || services.length == 0 )
- {
- return;
- }
-
- final Service service = new Service();
- component.setService( service );
- boolean serviceFactory = false;
- for ( int i = 0; i < services.length; i++ )
- {
- final String name = services[i].getNamedParameter( Constants.SERVICE_INTERFACE );
- if ( StringUtils.isEmpty( name ) )
- {
-
- this.addInterfaces( service, services[i], description );
- }
- else
- {
- String interfaceName = name;
- // check if the value points to a class/interface
- // and search through the imports
- // but only for local services
- if ( description instanceof QDoxJavaClassDescription )
- {
- final JavaClassDescription serviceClass = description.getReferencedClass( name );
- if ( serviceClass == null )
- {
- throw new SCRDescriptorException( "Interface '" + name + "' in class " + description.getName()
- + " does not point to a valid class/interface.", services[i] );
- }
- interfaceName = serviceClass.getName();
- }
- final Interface interf = new Interface( services[i] );
- interf.setInterfacename( interfaceName );
- service.addInterface( interf );
- }
-
- serviceFactory |= getBoolean( services[i], Constants.SERVICE_FACTORY, false );
- }
-
- service.setServicefactory( serviceFactory );
- }
-
-
- /**
- * Recursively add interfaces to the service.
- */
- protected void addInterfaces( final Service service, final JavaTag serviceTag,
- final JavaClassDescription description ) throws SCRDescriptorException
- {
- if ( description != null )
- {
- JavaClassDescription[] interfaces = description.getImplementedInterfaces();
- for ( int j = 0; j < interfaces.length; j++ )
- {
- final Interface interf = new Interface( serviceTag );
- interf.setInterfacename( interfaces[j].getName() );
- service.addInterface( interf );
- // recursivly add interfaces implemented by this interface
- this.addInterfaces( service, serviceTag, interfaces[j] );
- }
-
- // try super class
- this.addInterfaces( service, serviceTag, description.getSuperClass() );
- }
- }
-
-
- /**
- * Test a newly found reference
- * @param references
- * @param reference
- * @param defaultName
- * @param isInspectedClass
- * @throws SCRDescriptorException
- */
- protected void testReference( Map<String, Object[]> references, JavaTag reference, String defaultName,
- boolean isInspectedClass ) throws SCRDescriptorException
- {
- String refName = this.getReferenceName( reference, defaultName );
-
- boolean setName = refName != null;
- if ( refName == null)
- {
- refName = this.getReferencedInterface(reference, isInspectedClass, null);
- }
-
- if ( refName != null )
- {
- if ( references.containsKey( refName ) )
- {
- // if the current class is the class we are currently inspecting, we
- // have found a duplicate definition
- if ( isInspectedClass )
- {
- throw new SCRDescriptorException( "Duplicate definition for reference " + refName + " in class "
- + reference.getJavaClassDescription().getName(), reference );
- }
- }
- else
- {
- // ensure interface
- final String type = this.getReferencedInterface(reference, isInspectedClass, refName);
- references.put( refName, new Object[]
- { reference, type, (setName ? Boolean.TRUE : Boolean.FALSE) } );
- }
- }
- else
- {
- throw new SCRDescriptorException( "No name detectable for reference in class "
- + reference.getJavaClassDescription().getName(), reference );
- }
- }
-
- protected String getReferencedInterface(final JavaTag reference,
- final boolean isInspectedClass,
- final String refName) throws SCRDescriptorException
- {
- String type = reference.getNamedParameter( Constants.REFERENCE_INTERFACE );
- if ( StringUtils.isEmpty( type ) )
- {
- if ( reference.getField() != null )
- {
- type = reference.getField().getType();
- }
- else
- {
- throw new SCRDescriptorException( "Interface missing for reference " + (refName == null ? "" : refName) + " in class "
- + reference.getJavaClassDescription().getName(), reference );
- }
- }
- else if ( isInspectedClass )
- {
- // check if the value points to a class/interface
- // and search through the imports
- final JavaClassDescription serviceClass = reference.getJavaClassDescription().getReferencedClass(
- type );
- if ( serviceClass == null )
- {
- throw new SCRDescriptorException( "Interface '" + type + "' in class "
- + reference.getJavaClassDescription().getName()
- + " does not point to a valid class/interface.", reference );
- }
- type = serviceClass.getName();
- }
- return type;
- }
-
- protected String getReferenceName( final JavaTag reference,
- final String defaultName) throws SCRDescriptorException
- {
- String name = reference.getNamedParameter( Constants.REFERENCE_NAME );
- if ( !StringUtils.isEmpty( name ) )
- {
- return name;
- }
- name = reference.getNamedParameter( Constants.REFERENCE_NAME_REF );
- if ( !StringUtils.isEmpty( name ) )
- {
- final JavaField refField = this.getReferencedField( reference, name );
- final String[] values = refField.getInitializationExpression();
- if ( values == null || values.length == 0 )
- {
- throw new SCRDescriptorException( "Referenced field for " + name
- + " has no values for a reference name.", reference );
- }
- if ( values.length > 1 )
- {
- throw new SCRDescriptorException( "Referenced field " + name
- + " has more than one value for a reference name.", reference );
- }
- return values[0];
- }
-
- return defaultName;
- }
-
-
- protected JavaField getReferencedField( final JavaTag tag, String ref ) throws SCRDescriptorException
- {
- int classSep = ref.lastIndexOf( '.' );
- JavaField field = null;
- if ( classSep == -1 )
- {
- // local variable
- field = tag.getJavaClassDescription().getFieldByName( ref );
- }
- if ( field == null )
- {
- field = tag.getJavaClassDescription().getExternalFieldByName( ref );
- }
- if ( field == null )
- {
- throw new SCRDescriptorException( "Reference references unknown field " + ref + " in class "
- + tag.getJavaClassDescription().getName(), tag );
- }
- return field;
- }
-
-
- /**
- * Process a reference
- * @param reference
- * @param defaultName
- * @param component
- */
- protected void doReference( JavaTag reference, String name, Component component, String type,
- final boolean setName)
- throws SCRDescriptorException
- {
- final Reference ref = new Reference( reference, component.getJavaClassDescription() );
- if ( setName )
- {
- ref.setName( name );
- }
- ref.setInterfacename( type );
- ref.setCardinality( reference.getNamedParameter( Constants.REFERENCE_CARDINALITY ) );
- if ( ref.getCardinality() == null )
- {
- ref.setCardinality( "1..1" );
- }
- ref.setPolicy( reference.getNamedParameter( Constants.REFERENCE_POLICY ) );
- if ( ref.getPolicy() == null )
- {
- ref.setPolicy( "static" );
- }
- ref.setTarget( reference.getNamedParameter( Constants.REFERENCE_TARGET ) );
- final String bindValue = reference.getNamedParameter( Constants.REFERENCE_BIND );
- if ( bindValue != null )
- {
- ref.setBind( bindValue );
- }
- final String unbindValue = reference.getNamedParameter( Constants.REFERENCE_UNDBIND );
- if ( unbindValue != null )
- {
- ref.setUnbind( unbindValue );
- }
- final String updatedValue = reference.getNamedParameter( Constants.REFERENCE_UPDATED );
- if ( updatedValue != null )
- {
- ref.setUpdated( updatedValue );
- }
- final String isChecked = reference.getNamedParameter( Constants.REFERENCE_CHECKED );
- if ( isChecked != null )
- {
- ref.setChecked( Boolean.valueOf( isChecked ).booleanValue() );
- }
- final String strategy = reference.getNamedParameter( Constants.REFERENCE_STRATEGY );
- if ( strategy != null )
- {
- ref.setStrategy( strategy );
- }
-
- component.addReference( ref );
- }
-
-
- public static boolean getBoolean( JavaTag tag, String name, boolean defaultValue )
- {
- String value = tag.getNamedParameter( name );
- return ( value == null ) ? defaultValue : Boolean.valueOf( value ).booleanValue();
- }
-
-
-
- /**
- * Converts the specification version string to a specification version
- * code. Currently the following conversions are supported:
- * <table>
- * <tr><td><code>null</code></td><td>0</td></tr>
- * <tr><td>1.0</td><td>0</td></tr>
- * <tr><td>1.1</td><td>1</td></tr>
- * <tr><td>1.1-felix</td><td>2</td></tr>
- * </table>
- *
- * @param specVersion The specification version to convert. This may be
- * <code>null</code> to assume the default version.
- *
- * @return The specification version code.
- *
- * @throws SCRDescriptorException if the <code>specVersion</code> parameter
- * is not a supported value.
- */
- private int toSpecVersionCode( String specVersion, JavaTag tag ) throws SCRDescriptorException
- {
- if ( specVersion == null || specVersion.equals( Constants.COMPONENT_DS_SPEC_VERSION_10 ) )
- {
- return Constants.VERSION_1_0;
- }
- else if ( specVersion.equals( Constants.COMPONENT_DS_SPEC_VERSION_11 ) )
- {
- return Constants.VERSION_1_1;
- }
- else if ( specVersion.equals( Constants.COMPONENT_DS_SPEC_VERSION_11_FELIX ) )
- {
- return Constants.VERSION_1_1_FELIX;
- }
-
- // unknown specVersion string
- throw new SCRDescriptorException( "Unsupported or unknown DS spec version: " + specVersion, tag );
+ return addResources;*/
}
}
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+
+
+/**
+ * <code>AbstractDescription</code> is the base class for all descriptions.
+ */
+public abstract class AbstractDescription {
+
+ protected final ScannedAnnotation annotation;
+
+ public AbstractDescription(final ScannedAnnotation annotation) {
+ this.annotation = annotation;
+ }
+
+ public ScannedAnnotation getAnnotation() {
+ return this.annotation;
+ }
+}
\ No newline at end of file
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/AbstractDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <code>ClassDescription</code> is a described class.
+ */
+public class ClassDescription {
+
+ final List<AbstractDescription> descriptions = new ArrayList<AbstractDescription>();
+
+ private final Class<?> describedClass;
+
+ private final String source;
+
+ public ClassDescription(final Class<?> describedClass, final String source) {
+ this.describedClass = describedClass;
+ this.source = source;
+ }
+
+ public Class<?> getDescribedClass() {
+ return this.describedClass;
+ }
+
+ public String getSource() {
+ return this.source;
+ }
+
+ public void add(final AbstractDescription desc) {
+ this.descriptions.add(desc);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends AbstractDescription> List<T> getDescriptions(final Class<T> descType) {
+ final List<T> result = new ArrayList<T>();
+ for(final AbstractDescription desc : descriptions) {
+ if ( descType.isAssignableFrom(desc.getClass()) ) {
+ result.add((T) desc);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "ClassDescription [descriptions=" + descriptions
+ + ", describedClass=" + describedClass + ", source=" + source
+ + "]";
+ }
+}
\ No newline at end of file
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ClassDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java Mon May 14 13:21:02 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+/**
+ * Options for {@link ComponentDescription#getConfigurationPolicy()}.
+ */
+public enum ComponentConfigurationPolicy {
+
+ /**
+ * If a configuration is available it will be used, if not the component
+ * will be activated anyway (this is the default).
+ */
+ OPTIONAL,
+
+ /**
+ * The configuration admin is not consulted for a configuration for this component.
+ */
+ IGNORE,
+
+ /**
+ * In order to activate this component a configuration is required.
+ */
+ REQUIRE;
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentConfigurationPolicy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+
+/**
+ * <code>ComponentDescription</code>
+ * is a described component.
+ *
+ */
+public class ComponentDescription extends AbstractDescription {
+
+ /** The name of the component. */
+ private String name;
+
+ /** The label of the component. */
+ private String label;
+
+ /** The description of the component. */
+ private String description;
+
+ /** Is this component enabled? */
+ private Boolean enabled;
+
+ /** Is this component immediately started. */
+ private Boolean immediate;
+
+ /** The factory. */
+ private String factory;
+
+ /** The set metatype factory pid flag. */
+ private boolean isSetMetatypeFactoryPid;
+
+ /** Is this an abstract description? */
+ private boolean isAbstract = false;
+
+ /** Does this inherit? */
+ private boolean isInherit = true;
+
+ /** Create ds info */
+ private boolean createDs = true;
+
+ /** Create pid */
+ private boolean createPid = true;
+
+ /** Create metatype info. */
+ private boolean createMetatype = false;
+
+ /** Configuration policy. (V1.1) */
+ private ComponentConfigurationPolicy configurationPolicy;
+
+ /** Activation method. (V1.1) */
+ private MethodDescription activate;
+
+ /** Deactivation method. (V1.1) */
+ private MethodDescription deactivate;
+
+ /** Modified method. (V1.1) */
+ private MethodDescription modified;
+
+ /** The spec version. */
+ private SpecVersion specVersion;
+
+ public ComponentDescription(final ScannedAnnotation annotation) {
+ super(annotation);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Boolean getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(Boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public Boolean getImmediate() {
+ return immediate;
+ }
+
+ public void setImmediate(Boolean immediate) {
+ this.immediate = immediate;
+ }
+
+ public String getFactory() {
+ return factory;
+ }
+
+ public void setFactory(String factory) {
+ this.factory = factory;
+ }
+
+ public boolean isSetMetatypeFactoryPid() {
+ return isSetMetatypeFactoryPid;
+ }
+
+ public void setSetMetatypeFactoryPid(boolean isSetMetatypeFactoryPid) {
+ this.isSetMetatypeFactoryPid = isSetMetatypeFactoryPid;
+ }
+
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public void setAbstract(boolean isAbstract) {
+ this.isAbstract = isAbstract;
+ }
+
+ public boolean isInherit() {
+ return isInherit;
+ }
+
+ public void setInherit(boolean isInherit) {
+ this.isInherit = isInherit;
+ }
+
+ public boolean isCreateDs() {
+ return createDs;
+ }
+
+ public void setCreateDs(boolean createDs) {
+ this.createDs = createDs;
+ }
+
+ public boolean isCreatePid() {
+ return createPid;
+ }
+
+ public void setCreatePid(boolean createPid) {
+ this.createPid = createPid;
+ }
+
+ public boolean isCreateMetatype() {
+ return createMetatype;
+ }
+
+ public void setCreateMetatype(boolean createMetatype) {
+ this.createMetatype = createMetatype;
+ }
+
+ public ComponentConfigurationPolicy getConfigurationPolicy() {
+ return configurationPolicy;
+ }
+
+ public void setConfigurationPolicy(ComponentConfigurationPolicy configurationPolicy) {
+ this.configurationPolicy = configurationPolicy;
+ }
+
+ public MethodDescription getActivate() {
+ return activate;
+ }
+
+ public void setActivate(MethodDescription activate) {
+ this.activate = activate;
+ }
+
+ public MethodDescription getDeactivate() {
+ return deactivate;
+ }
+
+ public void setDeactivate(MethodDescription deactivate) {
+ this.deactivate = deactivate;
+ }
+
+ public MethodDescription getModified() {
+ return modified;
+ }
+
+ public void setModified(MethodDescription modified) {
+ this.modified = modified;
+ }
+
+ public SpecVersion getSpecVersion() {
+ return specVersion;
+ }
+
+ public void setSpecVersion(SpecVersion specVersion) {
+ this.specVersion = specVersion;
+ }
+
+ @Override
+ public String toString() {
+ return "ComponentDescription [name=" + name + ", label=" + label
+ + ", description=" + description + ", enabled=" + enabled
+ + ", immediate=" + immediate + ", factory=" + factory
+ + ", isSetMetatypeFactoryPid=" + isSetMetatypeFactoryPid
+ + ", isAbstract=" + isAbstract + ", isInherit=" + isInherit
+ + ", createDs=" + createDs + ", createPid=" + createPid
+ + ", createMetatype=" + createMetatype
+ + ", configurationPolicy=" + configurationPolicy
+ + ", activate=" + activate + ", deactivate=" + deactivate
+ + ", modified=" + modified + ", specVersion=" + specVersion
+ + ", annotation=" + annotation + "]";
+ }
+}
\ No newline at end of file
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ComponentDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import java.lang.reflect.Method;
+
+/**
+ * A method description describes a reference to a method,
+ * this can either just be the name or a real method object.
+ */
+public class MethodDescription {
+
+ private final String name;
+
+ private final Method method;
+
+ public MethodDescription(final String name) {
+ this.name = name;
+ this.method = null;
+ }
+
+ public MethodDescription(final Method method) {
+ this.name = method.getName();
+ this.method = method;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public Method getMethod() {
+ return this.method;
+ }
+
+ @Override
+ public String toString() {
+ return "MethodDescription [name=" + name + ", method=" + method + "]";
+ }
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/MethodDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+
+
+/**
+ * <code>PropertyDescription.java</code>...
+ * // TODO PropertyOptions
+ */
+public class PropertyDescription extends AbstractDescription {
+
+ private String name;
+ private String value;
+ private PropertyType type;
+ private String[] multiValue;
+
+ private boolean isPrivate;
+ private String label;
+ private String description;
+ private int cardinality;
+ private PropertyUnbounded unbounded;
+ private Field field;
+
+ public PropertyDescription(final ScannedAnnotation annotation) {
+ super(annotation);
+ }
+
+ public Field getField() {
+ return field;
+ }
+
+ public void setField(Field field) {
+ this.field = field;
+ }
+
+ public PropertyUnbounded getUnbounded() {
+ return unbounded;
+ }
+
+ public void setUnbounded(PropertyUnbounded unbounded) {
+ this.unbounded = unbounded;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ this.multiValue = null;
+ }
+
+ public PropertyType getType() {
+ return this.type;
+ }
+
+ public void setType(PropertyType type) {
+ this.type = type;
+ }
+
+ public String[] getMultiValue() {
+ return this.multiValue;
+ }
+
+ public void setMultiValue(String[] values) {
+ this.multiValue = values;
+ this.value = null;
+ }
+ public boolean isPrivate() {
+ return isPrivate;
+ }
+
+ public void setPrivate(boolean isPrivate) {
+ this.isPrivate = isPrivate;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getCardinality() {
+ return cardinality;
+ }
+
+ public void setCardinality(int cardinality) {
+ this.cardinality = cardinality;
+ }
+
+ @Override
+ public String toString() {
+ return "PropertyDescription [name=" + name + ", value=" + value
+ + ", type=" + type + ", multiValue="
+ + Arrays.toString(multiValue) + ", isPrivate=" + isPrivate
+ + ", label=" + label + ", description=" + description
+ + ", cardinality=" + cardinality + ", unbounded=" + unbounded
+ + ", field=" + field + ", annotation=" + annotation + "]";
+ }
+
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java Mon May 14 13:21:02 2012
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+public enum PropertyType {
+
+ String,
+ Long,
+ Double,
+ Float,
+ Integer,
+ Byte,
+ Char,
+ Character,
+ Boolean,
+ Short;
+
+ public static PropertyType from(final Class<?> javaClass) {
+ if ( javaClass.getName().equals(Long.class.getName())) {
+ return PropertyType.Long;
+ }
+ if ( javaClass.getName().equals(Double.class.getName())) {
+ return PropertyType.Double;
+ }
+ if ( javaClass.getName().equals(Float.class.getName())) {
+ return PropertyType.Float;
+ }
+ if ( javaClass.getName().equals(Integer.class.getName())) {
+ return PropertyType.Integer;
+ }
+ if ( javaClass.getName().equals(Byte.class.getName())) {
+ return PropertyType.Byte;
+ }
+ if ( javaClass.getName().equals(Character.class.getName())) {
+ return PropertyType.Char;
+ }
+ if ( javaClass.getName().equals(Boolean.class.getName())) {
+ return PropertyType.Boolean;
+ }
+ if ( javaClass.getName().equals(Short.class.getName())) {
+ return PropertyType.Short;
+ }
+ // default
+ return PropertyType.String;
+ }
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java Mon May 14 13:21:02 2012
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+/**
+ * Options for {@link PropertyDescription#getUnbounded()}
+ */
+public enum PropertyUnbounded {
+
+ /** Property is not unbounded. This is the default. */
+ DEFAULT,
+
+ /** Property is an unbounded array. */
+ ARRAY,
+
+ /** Property is an unbounded vector. */
+ VECTOR
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/PropertyUnbounded.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java Mon May 14 13:21:02 2012
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+/**
+ * Options for {@link ReferenceDescription#getCardinality()}
+ */
+public enum ReferenceCardinality {
+
+ /**
+ * Optional, unary reference: No service required to be available for the
+ * refernce to be satisfied. Only a single service is available through this
+ * reference.
+ */
+ OPTIONAL_UNARY("0..1"),
+
+ /**
+ * Mandatory, unary reference: At least one service must be available for
+ * the reference to be satisfied. Only a single service is available through
+ * this reference.
+ */
+ MANDATORY_UNARY("1..1"),
+
+ /**
+ * Optional, multiple reference: No service required to be available for the
+ * refernce to be satisfied. All matching services are available through
+ * this reference.
+ */
+ OPTIONAL_MULTIPLE("0..n"),
+
+ /**
+ * Mandatory, multiple reference: At least one service must be available for
+ * the reference to be satisified. All matching services are available
+ * through this reference.
+ */
+ MANDATORY_MULTIPLE("1..n");
+
+ private final String cardinalityString;
+
+ private ReferenceCardinality(final String cardinalityString) {
+ this.cardinalityString = cardinalityString;
+ }
+
+ /**
+ * @return String representation of cardinality
+ */
+ public String getCardinalityString() {
+ return this.cardinalityString;
+ }
+
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceCardinality.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import java.lang.reflect.Field;
+
+import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+
+/**
+ * <code>Reference.java</code>...
+ *
+ */
+public class ReferenceDescription extends AbstractDescription {
+
+ private String name;
+ private String interfaceName;
+ private String target;
+ private ReferenceCardinality cardinality;
+ private ReferencePolicy policy;
+ private MethodDescription bind;
+ private MethodDescription unbind;
+ private MethodDescription updated;
+
+ private ReferenceStrategy strategy;
+
+ private Field field;
+
+ public ReferenceDescription(final ScannedAnnotation annotation) {
+ super(annotation);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getInterfaceName() {
+ return interfaceName;
+ }
+
+ public void setInterfaceName(String interfacename) {
+ this.interfaceName = interfacename;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public ReferenceCardinality getCardinality() {
+ return cardinality;
+ }
+
+ public void setCardinality(ReferenceCardinality cardinality) {
+ this.cardinality = cardinality;
+ }
+
+ public ReferencePolicy getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(ReferencePolicy policy) {
+ this.policy = policy;
+ }
+
+ public MethodDescription getBind() {
+ return bind;
+ }
+
+ public void setBind(MethodDescription bind) {
+ this.bind = bind;
+ }
+
+ public MethodDescription getUnbind() {
+ return unbind;
+ }
+
+ public void setUnbind(MethodDescription unbind) {
+ this.unbind = unbind;
+ }
+
+ public MethodDescription getUpdated() {
+ return updated;
+ }
+
+ public void setUpdated(MethodDescription updated) {
+ this.updated = updated;
+ }
+
+ public ReferenceStrategy getStrategy() {
+ return strategy;
+ }
+
+ public void setStrategy(ReferenceStrategy strategy) {
+ this.strategy = strategy;
+ }
+
+ @Override
+ public String toString() {
+ return "ReferenceDescription [name=" + name + ", interfaceName="
+ + interfaceName + ", target=" + target + ", cardinality="
+ + cardinality + ", policy=" + policy + ", bind=" + bind
+ + ", unbind=" + unbind + ", updated=" + updated + ", strategy="
+ + strategy + ", field=" + field + ", annotation=" + annotation
+ + "]";
+ }
+
+ public Field getField() {
+ return field;
+ }
+
+ public void setField(Field field) {
+ this.field = field;
+ }
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java Mon May 14 13:21:02 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+/**
+ * Options for {@link ReferenceDescription#getPolicy()}
+ */
+public enum ReferencePolicy {
+
+ /**
+ * The component will be deactivated and re-activated if the service comes
+ * and/or goes away.
+ */
+ STATIC,
+
+ /**
+ * The service will be made available to the component as it comes and goes.
+ */
+ DYNAMIC;
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferencePolicy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java Mon May 14 13:21:02 2012
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+/**
+ * Options for {@link ReferenceDescription#getStrategy()}
+ */
+public enum ReferenceStrategy {
+
+ EVENT,
+
+ LOOKUP;
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ReferenceStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java Mon May 14 13:21:02 2012
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.felix.scrplugin.scanner.ScannedAnnotation;
+
+/**
+ * If a component is a service, the {@link ClassDescription} should
+ * contain a <code>ServiceDescription</code>.
+ *
+ * The service description defines whether this is a service factory
+ * and which interfaces this service implements.
+ */
+public class ServiceDescription extends AbstractDescription {
+
+ /** Flag for service factory. */
+ private boolean isServiceFactory = false;
+
+ /** The list of implemented interfaces. */
+ protected final Set<String> interfaces = new HashSet<String>();
+
+ public ServiceDescription(final ScannedAnnotation annotation) {
+ super(annotation);
+ }
+
+ public boolean isServiceFactory() {
+ return this.isServiceFactory;
+ }
+
+ public void setServiceFactory(boolean flag) {
+ this.isServiceFactory = flag;
+ }
+
+ public Set<String> getInterfaces() {
+ return this.interfaces;
+ }
+
+ /**
+ * Add an interface to the list of interfaces.
+ * @param interf The interface.
+ */
+ public void addInterface(final String interf) {
+ this.interfaces.add(interf);
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceDescription [isServiceFactory=" + isServiceFactory
+ + ", interfaces=" + interfaces + ", annotation=" + annotation
+ + "]";
+ }
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/ServiceDescription.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java?rev=1338189&view=auto
==============================================================================
--- felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java (added)
+++ felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java Mon May 14 13:21:02 2012
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.felix.scrplugin.description;
+
+
+public enum SpecVersion {
+
+ VERSION_1_0("1.0"), // R4.1
+ VERSION_1_1("1.1"), // R4.2
+ VERSION_1_1_FELIX("1.1_FELIX"); // R4.2 + FELIX-1893
+
+ /**
+ * internal human readable name
+ */
+ private final String name;
+
+ /**
+ * Create a type
+ *
+ * @param name name
+ */
+ private SpecVersion(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the human readable type name of this type.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Creates a version for the given name. if the name cannot be mapped
+ * to a enum type or if it's <code>null</code>, <code>null</code> is
+ * returned.
+ *
+ * @param n the name
+ * @return the type or <code>null</code>
+ */
+ public static SpecVersion fromName(final String n) {
+ if (n == null) {
+ return null;
+ }
+ try {
+ return SpecVersion.valueOf(n.toUpperCase());
+ } catch (final IllegalArgumentException e) {
+ return null;
+ }
+ }
+}
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: felix/sandbox/cziegeler/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/description/SpecVersion.java
------------------------------------------------------------------------------
svn:mime-type = text/plain