aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1704106 - in /aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin: Generator.java OsgiServiceRefWriter.java model/Context.java
Date Sun, 20 Sep 2015 07:49:00 GMT
Author: cschneider
Date: Sun Sep 20 07:48:59 2015
New Revision: 1704106

URL: http://svn.apache.org/viewvc?rev=1704106&view=rev
Log:
[ARIES-1373] Use new namespace

Added:
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceRefWriter.java
Modified:
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java

Modified: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java?rev=1704106&r1=1704105&r2=1704106&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
(original)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
Sun Sep 20 07:48:59 2015
@@ -39,7 +39,7 @@ public class Generator implements Proper
     private static final String NS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
     private static final String NS_EXT = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";
     private static final String NS_JPA = "http://aries.apache.org/xmlns/jpa/v1.1.0";
-    private static final String NS_JPA2 = "http://aries.apache.org/xmlns/jpan/v1.0.0";
+    private static final String NS_JPA2 = "http://aries.apache.org/xmlns/jpa/v2.0.0";
     private static final String NS_TX = "http://aries.apache.org/xmlns/transactions/v1.2.0";
 
     private Context context;
@@ -59,6 +59,7 @@ public class Generator implements Proper
             writer.writeStartDocument();
             writer.writeCharacters("\n");
             writeBlueprint();
+            writer.writeCharacters("\n");
             
             if (persistenceAnnotated) {
                 if (isJpaUsed()) {
@@ -78,7 +79,7 @@ public class Generator implements Proper
                 writer.writeCharacters("\n");
             }
             
-            writeServiceRefs();
+            new OsgiServiceRefWriter(writer).write(context.getServiceRefs());
             new OsgiServiceProviderWriter(writer).write(context.getBeans());
             
             writer.writeEndElement();
@@ -188,22 +189,6 @@ public class Generator implements Proper
         }
     }
 
-    private void writeServiceRefs() throws XMLStreamException {
-        for (OsgiServiceRef serviceBean : context.getServiceRefs()) {
-            writeServiceRef(serviceBean);
-        }
-    }
-
-    private void writeServiceRef(OsgiServiceRef serviceBean) throws XMLStreamException {
-        writer.writeEmptyElement("reference");
-        writer.writeAttribute("id", serviceBean.id);
-        writer.writeAttribute("interface", serviceBean.clazz.getName());
-        if (serviceBean.filter != null && !"".equals(serviceBean.filter)) {
-            writer.writeAttribute("filter", serviceBean.filter);
-        }
-        writer.writeCharacters("\n");
-    }
-
     @Override
     public void writeProperty(Property property) {
         try {

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceRefWriter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceRefWriter.java?rev=1704106&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceRefWriter.java
(added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceRefWriter.java
Sun Sep 20 07:48:59 2015
@@ -0,0 +1,51 @@
+/**
+ * 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.aries.blueprint.plugin;
+
+import java.util.Collection;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.aries.blueprint.plugin.model.OsgiServiceRef;
+
+public class OsgiServiceRefWriter {
+    private XMLStreamWriter writer;
+
+    public OsgiServiceRefWriter(XMLStreamWriter writer) {
+        this.writer = writer;
+    }
+
+    public void write(Collection<OsgiServiceRef> serviceRefs) throws XMLStreamException
{
+        for (OsgiServiceRef serviceBean : serviceRefs) {
+            writeServiceRef(serviceBean);
+        }
+    }
+
+    private void writeServiceRef(OsgiServiceRef serviceBean) throws XMLStreamException {
+        writer.writeEmptyElement("reference");
+        writer.writeAttribute("id", serviceBean.id);
+        writer.writeAttribute("interface", serviceBean.clazz.getName());
+        if (serviceBean.filter != null && !"".equals(serviceBean.filter)) {
+            writer.writeAttribute("filter", serviceBean.filter);
+        }
+        writer.writeCharacters("\n");
+    }
+
+}

Modified: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java?rev=1704106&r1=1704105&r2=1704106&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
(original)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
Sun Sep 20 07:48:59 2015
@@ -50,13 +50,17 @@ public class Context implements Matcher
 
     private void addBeans(Collection<Class<?>> beanClasses) {
         for (Class<?> clazz : beanClasses) {
-            Bean bean = new Bean(clazz);
-            beans.add(bean);
-            addServiceRefs(clazz);
-            addProducedBeans(clazz, bean.id);
+            addBean(clazz);
         }
     }
 
+    private void addBean(Class<?> clazz) {
+        Bean bean = new Bean(clazz);
+        beans.add(bean);
+        addServiceRefs(clazz);
+        addProducedBeans(clazz, bean.id);
+    }
+
     private void addProducedBeans(Class<?> clazz, String factoryBeanId) {
         for (Method method : clazz.getMethods()) {
             Produces produces = method.getAnnotation(Produces.class);



Mime
View raw message