Author: cziegeler
Date: Mon Aug 6 02:52:45 2007
New Revision: 563080
URL: http://svn.apache.org/viewvc?view=rev&rev=563080
Log:
Update mapping.
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/Components.java
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/xml/ComponentDescriptorIO.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=563080&r1=563079&r2=563080
==============================================================================
---
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:52:45 2007
@@ -28,12 +28,14 @@
import java.util.Map;
import org.apache.felix.sandbox.scrplugin.om.Component;
+import org.apache.felix.sandbox.scrplugin.om.Components;
import org.apache.felix.sandbox.scrplugin.om.Implementation;
import org.apache.felix.sandbox.scrplugin.om.Interface;
import org.apache.felix.sandbox.scrplugin.tags.JavaClassDescription;
import org.apache.felix.sandbox.scrplugin.tags.JavaClassDescriptorManager;
import org.apache.felix.sandbox.scrplugin.tags.JavaField;
import org.apache.felix.sandbox.scrplugin.tags.JavaTag;
+import org.apache.felix.sandbox.scrplugin.xml.ComponentDescriptorIO;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -88,8 +90,10 @@
final List abstractDescriptors = new ArrayList();
final JavaClassDescription[] javaSources =
jManager.getSourceDescriptions();
- // final Components components = new Components();
- // final Components abstractComponents = new Components();
+ // test the new om?
+ boolean testNewOM = false;
+ 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());
@@ -108,16 +112,18 @@
} 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);
- // }
- //}
+ if ( testNewOM ) {
+ 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);
+ }
+ }
+ }
}
}
@@ -149,15 +155,17 @@
FileOutputStream descriptorStream = null;
XMLWriter xw = null;
try {
- // final ComponentDescriptorIO io = new ComponentDescriptorIO();
- //io.write(descriptorFile, components);
-
- descriptorStream = new FileOutputStream(descriptorFile);
- xw = new XMLWriter(descriptorStream);
-
- for (Iterator di=descriptors.iterator(); di.hasNext(); ) {
- SCRDescriptor sd = (SCRDescriptor) di.next();
- sd.generate(xw);
+ if ( testNewOM ) {
+ final ComponentDescriptorIO io = new ComponentDescriptorIO();
+ io.write(descriptorFile, components);
+ } else {
+ descriptorStream = new FileOutputStream(descriptorFile);
+ xw = new XMLWriter(descriptorStream);
+
+ for (Iterator di=descriptors.iterator(); di.hasNext(); ) {
+ SCRDescriptor sd = (SCRDescriptor) di.next();
+ sd.generate(xw);
+ }
}
} catch (IOException ioe) {
Modified:
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Components.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Components.java?view=diff&rev=563080&r1=563079&r2=563080
==============================================================================
---
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Components.java
(original)
+++
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/om/Components.java
Mon Aug 6 02:52:45 2007
@@ -28,16 +28,26 @@
*/
public class Components {
+ /** The list of [EMAIL PROTECTED] Component}s. */
protected List components = new ArrayList();
+ /**
+ * Return the list of [EMAIL PROTECTED] Component}s.
+ */
public List getComponents() {
return this.components;
}
+ /**
+ * Set the list of [EMAIL PROTECTED] Component}s.
+ */
public void setComponents(List components) {
this.components = components;
}
+ /**
+ * Add a component to the list.
+ */
public void addComponent(Component component) {
this.components.add(component);
}
Modified:
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/xml/ComponentDescriptorIO.java
URL:
http://svn.apache.org/viewvc/felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/xml/ComponentDescriptorIO.java?view=diff&rev=563080&r1=563079&r2=563080
==============================================================================
---
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/xml/ComponentDescriptorIO.java
(original)
+++
felix/sandbox/cziegeler/maven-scr-plugin/src/main/java/org/apache/felix/sandbox/scrplugin/xml/ComponentDescriptorIO.java
Mon Aug 6 02:52:45 2007
@@ -59,6 +59,7 @@
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Component.class,
"name");
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Component.class,
"enabled");
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Component.class,
"immediate");
+
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Component.class,
"tag");
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Component.class,
"label");
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Component.class,
"description");
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Component.class,
"isAbstract");
@@ -71,6 +72,7 @@
this.xstream.alias("property",
org.apache.felix.sandbox.scrplugin.om.Property.class);
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Property.class,
"name");
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Property.class,
"value");
+
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Property.class,
"tag");
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Property.class,
"label");
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Property.class,
"description");
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Property.class,
"options");
@@ -81,6 +83,7 @@
this.xstream.alias("provide",
org.apache.felix.sandbox.scrplugin.om.Interface.class);
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Interface.class,
"interfacename");
+
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Interface.class,
"tag");
this.xstream.alias("reference",
org.apache.felix.sandbox.scrplugin.om.Reference.class);
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Reference.class,
"name");
@@ -90,6 +93,7 @@
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Reference.class,
"policy");
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Reference.class,
"bind");
this.xstream.useAttributeFor(org.apache.felix.sandbox.scrplugin.om.Reference.class,
"unbind");
+
this.xstream.omitField(org.apache.felix.sandbox.scrplugin.om.Reference.class,
"tag");
}
public org.apache.felix.sandbox.scrplugin.om.Components read(File file)
throws IOException, MojoExecutionException {