Author: rfeng
Date: Mon Mar  9 22:25:59 2009
New Revision: 751884

URL: http://svn.apache.org/viewvc?rev=751884&view=rev
Log:
Hook the model and processors with the Tuscany StAX processing pattern

Added:
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java
   (with props)
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java
   (with props)
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java
   (with props)
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java
   (with props)
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java
   (with props)
    
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory
Modified:
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java
    
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    
tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java

Added: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java?rev=751884&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java
 Mon Mar  9 22:25:59 2009
@@ -0,0 +1,33 @@
+/*
+ * 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.tuscany.sca.implementation.osgi;
+
+import 
org.apache.tuscany.sca.implementation.osgi.impl.ServiceDescriptionsFactoryImpl;
+
+/**
+ * 
+ */
+public class DefaultServiceDescriptionsFactory extends 
ServiceDescriptionsFactoryImpl {
+
+    public DefaultServiceDescriptionsFactory() {
+        super();
+    }
+
+}

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java
 Mon Mar  9 22:25:59 2009
@@ -18,6 +18,8 @@
  */
 package org.apache.tuscany.sca.implementation.osgi;
 
+import javax.xml.namespace.QName;
+
 import org.apache.tuscany.sca.assembly.Extensible;
 import org.apache.tuscany.sca.assembly.Implementation;
 import org.osgi.framework.Bundle;
@@ -29,6 +31,13 @@
  * @version $Rev$ $Date$
  */
 public interface OSGiImplementation extends Implementation, Extensible {
+    String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903";;
+    String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1";;
+
+    String BUNDLE_SYMBOLICNAME = "bundleSymbolicName";
+    String BUNDLE_VERSION = "bundleVersion";
+    QName IMPLEMENTATION_OSGI = new QName(SCA11_TUSCANY_NS, 
"implementation.osgi");
+    QName PROPERTY_QNAME = new QName(SCA11_TUSCANY_NS, "osgi.property");
 
     String getBundleSymbolicName();
 

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java
 Mon Mar  9 22:25:59 2009
@@ -28,4 +28,10 @@
      * @return
      */
     OSGiImplementation createOSGiImplementation();
+    
+    /**
+     * 
+     * @return
+     */
+    OSGiProperty createOSGiProperty();
 }

Added: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java?rev=751884&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java
 Mon Mar  9 22:25:59 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.tuscany.sca.implementation.osgi;
+
+import javax.xml.namespace.QName;
+
+/**
+ * <tuscany:osgi.property> 
+ */
+public interface OSGiProperty {
+    QName OSGI_PROPERTY_QNAME = new QName(OSGiImplementation.SCA11_TUSCANY_NS, 
"property");
+
+    String getValue();
+
+    void setValue(String value);
+
+    String getName();
+
+    void setName(String name);
+}

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
 Mon Mar  9 22:25:59 2009
@@ -22,23 +22,11 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.namespace.QName;
 
 /**
  * The OSGi RFC 119 description of a remote OSGi service
  */
 public interface ServiceDescription {
-    String REMOTE_SERVICE_FOLDER = "OSGI-INF/remote-service";
-    String SD_NS = "http://www.osgi.org/xmlns/sd/v1.0.0";;
-    QName SERVICE_DESCRIPTIONS_QNAME = new QName(SD_NS, 
"service-descriptions");
-    QName SERVICE_DESCRIPTION_QNAME = new QName(SD_NS, "service-description");
-    String REMOTE_SERVICE_HEADER = "Remote-Service";
-    String PROP_SERVICE_INTENTS = "service.intents";
-    String PROP_REQUIRES_INTENTS = "osgi.remote.requires.intents";
-    String PROP_CONFIGURATION_TYPE = "osgi.remote.configuration.type";
-    String CONFIGURATION_TYPE_SCA = "sca";
-    String PROP_CONFIGURATION_SCA_BINDINGS = 
"osgi.remote.configuration.sca.bindings";
-
     List<String> getInterfaces();
 
     Map<String, Object> getProperties();

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
 Mon Mar  9 22:25:59 2009
@@ -21,9 +21,22 @@
 
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 
 /**
  * OSGi RFC 119 service descriptions
  */
 public interface ServiceDescriptions extends List<ServiceDescription> {
+
+    String REMOTE_SERVICE_FOLDER = "OSGI-INF/remote-service";
+    String OSGI_SD_NS = "http://www.osgi.org/xmlns/sd/v1.0.0";;
+    QName SERVICE_DESCRIPTIONS_QNAME = new QName(OSGI_SD_NS, 
"service-descriptions");
+    QName SERVICE_DESCRIPTION_QNAME = new QName(OSGI_SD_NS, 
"service-description");
+    String REMOTE_SERVICE_HEADER = "Remote-Service";
+    String PROP_SERVICE_INTENTS = "service.intents";
+    String PROP_REQUIRES_INTENTS = "osgi.remote.requires.intents";
+    String PROP_CONFIGURATION_TYPE = "osgi.remote.configuration.type";
+    String CONFIGURATION_TYPE_SCA = "sca";
+    String PROP_CONFIGURATION_SCA_BINDINGS = 
"osgi.remote.configuration.sca.bindings";
 }

Added: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java?rev=751884&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java
 Mon Mar  9 22:25:59 2009
@@ -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.tuscany.sca.implementation.osgi;
+
+/**
+ * The factory interface to create OSGi RFC 119 service descriptions
+ */
+public interface ServiceDescriptionsFactory {
+    ServiceDescriptions createServiceDescriptions();
+
+    ServiceDescription createServiceDescription();
+}

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java
 Mon Mar  9 22:25:59 2009
@@ -22,6 +22,7 @@
 import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationFactory;
+import org.apache.tuscany.sca.implementation.osgi.OSGiProperty;
 
 /**
  * 
@@ -38,4 +39,8 @@
         return new OSGiImplementationImpl(factoryExtensionPoint);
     }
 
+    public OSGiProperty createOSGiProperty() {
+        return new OSGiPropertyImpl();
+    }
+
 }

Added: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java?rev=751884&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java
 Mon Mar  9 22:25:59 2009
@@ -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.tuscany.sca.implementation.osgi.impl;
+
+import org.apache.tuscany.sca.implementation.osgi.OSGiProperty;
+
+/**
+ * Implementation of OSGiProperty
+ */
+public class OSGiPropertyImpl implements OSGiProperty {
+    protected OSGiPropertyImpl() {
+        super();
+    }
+
+    private String name;
+    private String value;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+}

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
 Mon Mar  9 22:25:59 2009
@@ -30,7 +30,7 @@
  * The OSGi RFC 119 description of a remote OSGi service
  */
 public class ServiceDescriptionImpl implements ServiceDescription {
-    public ServiceDescriptionImpl() {
+    protected ServiceDescriptionImpl() {
         super();
     }
 

Added: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java?rev=751884&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java
 Mon Mar  9 22:25:59 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.tuscany.sca.implementation.osgi.impl;
+
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions;
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory;
+
+/**
+ * The factory implementation
+ */
+public class ServiceDescriptionsFactoryImpl implements 
ServiceDescriptionsFactory {
+
+    protected ServiceDescriptionsFactoryImpl() {
+        super();
+    }
+
+    public ServiceDescription createServiceDescription() {
+        return new ServiceDescriptionImpl();
+    }
+
+    public ServiceDescriptions createServiceDescriptions() {
+        return new ServiceDescriptionsImpl();
+    }
+
+}

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
 Mon Mar  9 22:25:59 2009
@@ -30,7 +30,7 @@
 public class ServiceDescriptionsImpl extends ArrayList<ServiceDescription> 
implements ServiceDescriptions {
     private static final long serialVersionUID = 6205649013621747968L;
 
-    public ServiceDescriptionsImpl() {
+    protected ServiceDescriptionsImpl() {
         super();
     }
 }

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
 Mon Mar  9 22:25:59 2009
@@ -18,19 +18,17 @@
  */
 package org.apache.tuscany.sca.implementation.osgi.xml;
 
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
-import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static 
org.apache.tuscany.sca.implementation.osgi.OSGiImplementation.BUNDLE_SYMBOLICNAME;
+import static 
org.apache.tuscany.sca.implementation.osgi.OSGiImplementation.BUNDLE_VERSION;
+import static 
org.apache.tuscany.sca.implementation.osgi.OSGiImplementation.IMPLEMENTATION_OSGI;
 
-import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.StringTokenizer;
 
 import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -48,14 +46,12 @@
 import org.apache.tuscany.sca.contribution.resolver.ClassReference;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
 import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationImpl;
 import 
org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationActivator;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.Problem;
@@ -63,10 +59,6 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
 
 /**
  * 
@@ -77,17 +69,6 @@
  * @version $Rev$ $Date$
  */
 public class OSGiImplementationProcessor implements 
StAXArtifactProcessor<OSGiImplementation> {
-    public final static String SCA11_NS = 
"http://docs.oasis-open.org/ns/opencsa/sca/200903";;
-    public final static String SCA11_TUSCANY_NS = 
"http://tuscany.apache.org/xmlns/sca/1.1";;
-
-    public static final QName IMPLEMENTATION_OSGI = new 
QName(SCA11_TUSCANY_NS, "implementation.osgi");
-
-    private static final String BUNDLE_SYMBOLICNAME = "bundleSymbolicName";
-    private static final String BUNDLE_VERSION = "bundleVersion";
-
-    private static final QName PROPERTIES_QNAME = new QName(SCA11_TUSCANY_NS, 
"properties");
-    private static final QName PROPERTY_QNAME = new QName(SCA11_TUSCANY_NS, 
"property");
-
     private JavaInterfaceFactory javaInterfaceFactory;
     private AssemblyFactory assemblyFactory;
     private FactoryExtensionPoint modelFactories;
@@ -176,7 +157,7 @@
             int next = reader.next();
             if (next == END_ELEMENT && 
IMPLEMENTATION_OSGI.equals(reader.getName())) {
                 break;
-            } else if (next == START_ELEMENT && 
PROPERTIES_QNAME.equals(reader.getName())) {
+            } else if (next == START_ELEMENT && 
PROPERTY_QNAME.equals(reader.getName())) {
 
                 // FIXME: This is temporary code which allows reference and 
service properties used
                 //        for filtering OSGi services to be specified in 
<implementation.osgi/>

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java
 Mon Mar  9 22:25:59 2009
@@ -29,10 +29,11 @@
 import 
org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
 import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions;
-import org.apache.tuscany.sca.implementation.osgi.impl.ServiceDescriptionImpl;
-import org.apache.tuscany.sca.implementation.osgi.impl.ServiceDescriptionsImpl;
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory;
+import org.apache.tuscany.sca.monitor.Monitor;
 
 /*
 <?xml version="1.0" encoding="UTF-8"?>
@@ -56,17 +57,24 @@
 </service-descriptions>
 */
 public class ServiceDescriptionsProcessor implements 
StAXArtifactProcessor<ServiceDescriptions> {
+    private ServiceDescriptionsFactory factory;
+    private Monitor monitor;
+
+    public ServiceDescriptionsProcessor(FactoryExtensionPoint modelFactories, 
Monitor monitor) {
+        this.monitor = monitor;
+        this.factory = 
modelFactories.getFactory(ServiceDescriptionsFactory.class);
+    }
 
     public ServiceDescriptions read(XMLStreamReader reader) throws 
XMLStreamException {
         int event = reader.getEventType();
-        ServiceDescriptions sds = new ServiceDescriptionsImpl();
+        ServiceDescriptions sds = factory.createServiceDescriptions();
         ServiceDescription sd = null;
         while (true) {
             switch (event) {
                 case XMLStreamConstants.START_ELEMENT:
                     QName name = reader.getName();
-                    if 
(ServiceDescription.SERVICE_DESCRIPTION_QNAME.equals(name)) {
-                        sd = new ServiceDescriptionImpl();
+                    if 
(ServiceDescriptions.SERVICE_DESCRIPTION_QNAME.equals(name)) {
+                        sd = factory.createServiceDescription();
                         sds.add(sd);
                     } else if ("provide".equals(name.getLocalPart())) {
                         String interfaceName = reader.getAttributeValue(null, 
"interface");
@@ -109,11 +117,11 @@
                     break;
                 case XMLStreamConstants.END_ELEMENT:
                     name = reader.getName();
-                    if 
(ServiceDescription.SERVICE_DESCRIPTION_QNAME.equals(name)) {
+                    if 
(ServiceDescriptions.SERVICE_DESCRIPTION_QNAME.equals(name)) {
                         // Reset the sd
                         sd = null;
                     }
-                    if 
(ServiceDescription.SERVICE_DESCRIPTIONS_QNAME.equals(name)) {
+                    if 
(ServiceDescriptions.SERVICE_DESCRIPTIONS_QNAME.equals(name)) {
                         return sds;
                     }
                     break;
@@ -127,7 +135,7 @@
     }
 
     public QName getArtifactType() {
-        return ServiceDescription.SERVICE_DESCRIPTIONS_QNAME;
+        return ServiceDescriptions.SERVICE_DESCRIPTIONS_QNAME;
     }
 
     public void write(ServiceDescriptions model, XMLStreamWriter writer) 
throws ContributionWriteException,

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 Mon Mar  9 22:25:59 2009
@@ -17,3 +17,4 @@
 
 # Implementation class for the artifact processor extension
 
org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.osgi,model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementation
+org.apache.tuscany.sca.implementation.osgi.xml.ServiceDescriptionsProcessor;qname=http://www.osgi.org/xmlns/sd/v1.0.0#service-descriptions;model=org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions

Added: 
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory?rev=751884&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory
 (added)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory
 Mon Mar  9 22:25:59 2009
@@ -0,0 +1,17 @@
+# 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. 
+org.apache.tuscany.sca.implementation.osgi.DefaultServiceDescriptionsFactory

Modified: 
tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java?rev=751884&r1=751883&r2=751884&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java
 (original)
+++ 
tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java
 Mon Mar  9 22:25:59 2009
@@ -25,6 +25,8 @@
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.DefaultFactoryExtensionPoint;
 import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -68,7 +70,9 @@
 
     @Test
     public void testLoad() throws Exception {
-        ServiceDescriptionsProcessor processor = new 
ServiceDescriptionsProcessor();
+        ServiceDescriptionsProcessor processor =
+            new ServiceDescriptionsProcessor(new 
DefaultFactoryExtensionPoint(new DefaultExtensionPointRegistry()),
+                                             null);
         List<ServiceDescription> descriptions = processor.read(reader);
         Assert.assertEquals(2, descriptions.size());
         System.out.println(descriptions);


Reply via email to