felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r563076 - in /felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin: SCRDescriptorMojo.java om/Reference.java
Date Mon, 06 Aug 2007 09:42:34 GMT
Author: cziegeler
Date: Mon Aug  6 02:42:32 2007
New Revision: 563076

URL: http://svn.apache.org/viewvc?view=rev&rev=563076
Log:
Fix reference handling with new om - correct debug output.

Modified:
    felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/SCRDescriptorMojo.java
    felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Reference.java

Modified: felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/SCRDescriptorMojo.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/SCRDescriptorMojo.java?view=diff&rev=563076&r1=563075&r2=563076
==============================================================================
--- felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/SCRDescriptorMojo.java
(original)
+++ felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/SCRDescriptorMojo.java
Mon Aug  6 02:42:32 2007
@@ -88,6 +88,9 @@
         final List abstractDescriptors = new ArrayList();
         final JavaClassDescription[] javaSources = jManager.getSourceDescriptions();
 
+        // final Components components = new Components();
+        // final Components abstractComponents = new Components();
+
         for (int i = 0; i < javaSources.length; i++) {
             this.getLog().debug("Testing source " + javaSources[i].getName());
             final JavaTag tag = javaSources[i].getTagByName(SCRDescriptor.COMPONENT);
@@ -96,15 +99,25 @@
                 final SCRDescriptor descriptor = this.createSCRDescriptor(javaSources[i]);
                 if (descriptor != null) {
                     if ( descriptor.isAbstract() ) {
-                        this.getLog().debug("Adding descriptor " + descriptor);
+                        this.getLog().debug("Adding abstract descriptor " + descriptor);
                         abstractDescriptors.add(descriptor);
                     } else {
-                        this.getLog().debug("Adding abstract descriptor " + descriptor);
+                        this.getLog().debug("Adding descriptor " + descriptor);
                         descriptors.add(descriptor);
                     }
                 } else {
                     hasFailures = true;
                 }
+                //final Component comp = this.createComponent(javaSources[i]);
+                //if (comp != null) {
+                //    if ( comp.isAbstract() ) {
+                //        this.getLog().debug("Adding abstract descriptor " + descriptor);
+                //        abstractComponents.addComponent(comp);
+                //    } else {
+                //        this.getLog().debug("Adding descriptor " + descriptor);
+                //        components.addComponent(comp);
+                //    }
+                //}
             }
         }
 
@@ -136,6 +149,9 @@
         FileOutputStream descriptorStream = null;
         XMLWriter xw = null;
         try {
+            // final ComponentDescriptorIO io = new ComponentDescriptorIO();
+            //io.write(descriptorFile, components);
+
             descriptorStream = new FileOutputStream(descriptorFile);
             xw = new XMLWriter(descriptorStream);
 
@@ -324,7 +340,7 @@
     protected void doComponent(JavaTag tag, Component component) {
 
         // check if this is an abstract definition
-        String abstractType = tag.getNamedParameter(SCRDescriptor.COMPONENT_ABSTRACT);
+        final String abstractType = tag.getNamedParameter(SCRDescriptor.COMPONENT_ABSTRACT);
         component.setAbstract((abstractType == null ? false : "yes".equalsIgnoreCase(abstractType)
|| "true".equalsIgnoreCase(abstractType)));
 
         String name = tag.getNamedParameter(SCRDescriptor.COMPONENT_NAME);
@@ -335,8 +351,8 @@
         component.setImmediate(Boolean.valueOf(this.getBoolean(tag, SCRDescriptor.COMPONENT_IMMEDIATE,
true)));
 
         // whether metatype information is to generated for the component
-        String metaType = tag.getNamedParameter(SCRDescriptor.COMPONENT_METATYPE);
-        boolean hasMetaType = metaType == null || "yes".equalsIgnoreCase(metaType)
+        final String metaType = tag.getNamedParameter(SCRDescriptor.COMPONENT_METATYPE);
+        final boolean hasMetaType = metaType == null || "yes".equalsIgnoreCase(metaType)
             || "true".equalsIgnoreCase(metaType);
         component.setHasMetaType(hasMetaType);
         component.setLabel(tag.getNamedParameter(SCRDescriptor.COMPONENT_LABEL));
@@ -578,8 +594,15 @@
             ref.setCardinality(reference.getNamedParameter(SCRDescriptor.REFERENCE_CARDINALITY));
             ref.setPolicy(reference.getNamedParameter(SCRDescriptor.REFERENCE_POLICY));
             ref.setTarget(reference.getNamedParameter(SCRDescriptor.REFERENCE_TARGET));
-            ref.setBind(reference.getNamedParameter(SCRDescriptor.REFERENCE_BIND));
-            ref.setUnbind(reference.getNamedParameter(SCRDescriptor.REFERENCE_UNDBIND));
+            String value;
+            value = reference.getNamedParameter(SCRDescriptor.REFERENCE_BIND);
+            if ( value != null ) {
+                ref.setBind(value);
+            }
+            value = reference.getNamedParameter(SCRDescriptor.REFERENCE_UNDBIND);
+            if ( value != null ) {
+                ref.setUnbind(value);
+            }
             component.addReference(ref);
         }
     }

Modified: felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Reference.java
URL: http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Reference.java?view=diff&rev=563076&r1=563075&r2=563076
==============================================================================
--- felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Reference.java
(original)
+++ felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Reference.java
Mon Aug  6 02:42:32 2007
@@ -52,6 +52,9 @@
      */
     public Reference(JavaTag t) {
         super(t);
+        // set default values
+        this.setBind("bind");
+        this.setUnbind("unbind");
     }
 
     public String getName() {



Mime
View raw message