Author: rfeng
Date: Mon Mar 9 22:01:43 2009
New Revision: 751863
URL: http://svn.apache.org/viewvc?rev=751863&view=rev
Log:
Separate ServiceDescription as interfaces
Added:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
- copied, changed from r751855,
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescription.java
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
(with props)
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
(with props)
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
(with props)
Removed:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescription.java
Modified:
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/test/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsTestCase.java
Copied:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
(from r751855,
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/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?p2=tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java&p1=tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescription.java&r1=751855&r2=751863&rev=751863&view=diff
==============================================================================
---
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescription.java
(original)
+++
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java
Mon Mar 9 22:01:43 2009
@@ -17,10 +17,8 @@
* under the License.
*/
-package org.apache.tuscany.sca.implementation.osgi.xml;
+package org.apache.tuscany.sca.implementation.osgi;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -29,30 +27,19 @@
/**
* The OSGi RFC 119 description of a remote OSGi service
*/
-public class ServiceDescription {
- public final static String REMOTE_SERVICE_FOLDER =
"OSGI-INF/remote-service";
- public final static String SD_NS = "http://www.osgi.org/xmlns/sd/v1.0.0";
- public final static QName SERVICE_DESCRIPTIONS_QNAME = new QName(SD_NS,
"service-descriptions");
- public final static QName SERVICE_DESCRIPTION_QNAME = new QName(SD_NS,
"service-description");
- public final static String REMOTE_SERVICE_HEADER = "Remote-Service";
- public final static String PROP_SERVICE_INTENTS = "service.intents";
- public final static String PROP_REQUIRES_INTENTS =
"osgi.remote.requires.intents";
- public final static String PROP_CONFIGURATION_TYPE =
"osgi.remote.configuration.type";
- public final static String CONFIGURATION_TYPE_SCA = "sca";
- public final static String PROP_CONFIGURATION_SCA_BINDINGS =
"osgi.remote.configuration.sca.bindings";
-
- private List<String> interfaces = new ArrayList<String>();
- private Map<String, Object> properties = new HashMap<String, Object>();
-
- public List<String> getInterfaces() {
- return interfaces;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public String toString() {
- return "service-description: interfaces=" + interfaces + "properties="
+ properties;
- }
-}
\ No newline at end of file
+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();
+}
Added:
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=751863&view=auto
==============================================================================
---
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
(added)
+++
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
Mon Mar 9 22:01:43 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;
+
+import java.util.List;
+
+
+/**
+ * OSGi RFC 119 service descriptions
+ */
+public interface ServiceDescriptions extends List<ServiceDescription> {
+}
Propchange:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
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=751863&view=auto
==============================================================================
---
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
(added)
+++
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
Mon Mar 9 22:01:43 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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
+
+/**
+ * The OSGi RFC 119 description of a remote OSGi service
+ */
+public class ServiceDescriptionImpl implements ServiceDescription {
+ public ServiceDescriptionImpl() {
+ super();
+ }
+
+ private List<String> interfaces = new ArrayList<String>();
+ private Map<String, Object> properties = new HashMap<String, Object>();
+
+ public List<String> getInterfaces() {
+ return interfaces;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public String toString() {
+ return "service-description: interfaces=" + interfaces + "properties="
+ properties;
+ }
+}
\ No newline at end of file
Propchange:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
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=751863&view=auto
==============================================================================
---
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
(added)
+++
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
Mon Mar 9 22:01:43 2009
@@ -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.tuscany.sca.implementation.osgi.impl;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions;
+
+/**
+ *
+ */
+public class ServiceDescriptionsImpl extends ArrayList<ServiceDescription>
implements ServiceDescriptions {
+ private static final long serialVersionUID = 6205649013621747968L;
+
+ public ServiceDescriptionsImpl() {
+ super();
+ }
+}
Propchange:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
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=751863&r1=751862&r2=751863&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:01:43 2009
@@ -19,13 +19,20 @@
package org.apache.tuscany.sca.implementation.osgi.xml;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import
org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+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.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;
/*
<?xml version="1.0" encoding="UTF-8"?>
@@ -48,18 +55,18 @@
</service-description>
</service-descriptions>
*/
-public class ServiceDescriptionsProcessor {
+public class ServiceDescriptionsProcessor implements
StAXArtifactProcessor<ServiceDescriptions> {
- public List<ServiceDescription> read(XMLStreamReader reader) throws
XMLStreamException {
+ public ServiceDescriptions read(XMLStreamReader reader) throws
XMLStreamException {
int event = reader.getEventType();
- List<ServiceDescription> sds = new ArrayList<ServiceDescription>();
+ ServiceDescriptions sds = new ServiceDescriptionsImpl();
ServiceDescription sd = null;
while (true) {
switch (event) {
case XMLStreamConstants.START_ELEMENT:
QName name = reader.getName();
if
(ServiceDescription.SERVICE_DESCRIPTION_QNAME.equals(name)) {
- sd = new ServiceDescription();
+ sd = new ServiceDescriptionImpl();
sds.add(sd);
} else if ("provide".equals(name.getLocalPart())) {
String interfaceName = reader.getAttributeValue(null,
"interface");
@@ -118,4 +125,21 @@
}
}
}
+
+ public QName getArtifactType() {
+ return ServiceDescription.SERVICE_DESCRIPTIONS_QNAME;
+ }
+
+ public void write(ServiceDescriptions model, XMLStreamWriter writer)
throws ContributionWriteException,
+ XMLStreamException {
+ // TODO: To be implemented
+ }
+
+ public Class<ServiceDescriptions> getModelType() {
+ return ServiceDescriptions.class;
+ }
+
+ public void resolve(ServiceDescriptions model, ModelResolver resolver)
throws ContributionResolveException {
+ // TODO: To be implemented
+ }
}
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=751863&r1=751862&r2=751863&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:01:43 2009
@@ -25,6 +25,7 @@
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
+import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;