From fb958a75b99c50cfd90d3d6dd22c5e55447558b5 Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 9 Mar 2009 22:25:59 +0000 Subject: Hook the model and processors with the Tuscany StAX processing pattern git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@751884 13f79535-47bb-0310-9956-ffa450edef68 --- .../osgi/DefaultServiceDescriptionsFactory.java | 33 ++++++++++++++ .../implementation/osgi/OSGiImplementation.java | 9 ++++ .../osgi/OSGiImplementationFactory.java | 6 +++ .../sca/implementation/osgi/OSGiProperty.java | 37 ++++++++++++++++ .../implementation/osgi/ServiceDescription.java | 12 ----- .../implementation/osgi/ServiceDescriptions.java | 13 ++++++ .../osgi/ServiceDescriptionsFactory.java | 29 ++++++++++++ .../osgi/impl/OSGiImplementationFactoryImpl.java | 5 +++ .../implementation/osgi/impl/OSGiPropertyImpl.java | 51 ++++++++++++++++++++++ .../osgi/impl/ServiceDescriptionImpl.java | 2 +- .../osgi/impl/ServiceDescriptionsFactoryImpl.java | 43 ++++++++++++++++++ .../osgi/impl/ServiceDescriptionsImpl.java | 2 +- .../osgi/xml/OSGiImplementationProcessor.java | 27 ++---------- .../osgi/xml/ServiceDescriptionsProcessor.java | 24 ++++++---- ...ca.contribution.processor.StAXArtifactProcessor | 1 + ....implementation.osgi.ServiceDescriptionsFactory | 17 ++++++++ .../osgi/xml/ServiceDescriptionsTestCase.java | 6 ++- 17 files changed, 271 insertions(+), 46 deletions(-) create mode 100644 java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java create mode 100644 java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java create mode 100644 java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java create mode 100644 java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java create mode 100644 java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java create mode 100644 java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.osgi.ServiceDescriptionsFactory (limited to 'java/sca/modules/implementation-osgi/src') diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java new file mode 100644 index 0000000000..d7296e24bb --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/DefaultServiceDescriptionsFactory.java @@ -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(); + } + +} diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java index 964ec6e92d..1b393a5ac0 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java @@ -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 @@ import org.osgi.framework.Bundle; * @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(); diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java index 8521c9e7d4..0a83624e76 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java @@ -28,4 +28,10 @@ public interface OSGiImplementationFactory { * @return */ OSGiImplementation createOSGiImplementation(); + + /** + * + * @return + */ + OSGiProperty createOSGiProperty(); } diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java new file mode 100644 index 0000000000..9a000af031 --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiProperty.java @@ -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; + +/** + * + */ +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); +} diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java index 96ad202b31..832e26a48f 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescription.java @@ -22,23 +22,11 @@ package org.apache.tuscany.sca.implementation.osgi; 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 getInterfaces(); Map getProperties(); diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java index e96aca650d..36968615c0 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptions.java @@ -21,9 +21,22 @@ package org.apache.tuscany.sca.implementation.osgi; import java.util.List; +import javax.xml.namespace.QName; + /** * OSGi RFC 119 service descriptions */ public interface ServiceDescriptions extends List { + + 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"; } diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java new file mode 100644 index 0000000000..0e4c51b1f9 --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/ServiceDescriptionsFactory.java @@ -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(); +} diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java index 79da7708a9..80b68d1728 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.implementation.osgi.impl; 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 @@ public class OSGiImplementationFactoryImpl implements OSGiImplementationFactory return new OSGiImplementationImpl(factoryExtensionPoint); } + public OSGiProperty createOSGiProperty() { + return new OSGiPropertyImpl(); + } + } diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java new file mode 100644 index 0000000000..a3944c66c0 --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiPropertyImpl.java @@ -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; + } + +} diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java index 66c703f55f..eeacdb9702 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java @@ -30,7 +30,7 @@ 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() { + protected ServiceDescriptionImpl() { super(); } diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java new file mode 100644 index 0000000000..8cd3867610 --- /dev/null +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsFactoryImpl.java @@ -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(); + } + +} diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java index 6573c04c96..c249c053a4 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionsImpl.java @@ -30,7 +30,7 @@ import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions; public class ServiceDescriptionsImpl extends ArrayList implements ServiceDescriptions { private static final long serialVersionUID = 6205649013621747968L; - public ServiceDescriptionsImpl() { + protected ServiceDescriptionsImpl() { super(); } } diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java index 3113c1d5be..f5fc2e3747 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java @@ -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.processor.StAXArtifactProcessor; 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.apache.tuscany.sca.monitor.Problem.Severity; 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 @@ import org.w3c.dom.Node; * @version $Rev$ $Date$ */ public class OSGiImplementationProcessor implements StAXArtifactProcessor { - 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 @@ public class OSGiImplementationProcessor implements StAXArtifactProcessor diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java index d2006205ea..bef07d159d 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/ServiceDescriptionsProcessor.java @@ -29,10 +29,11 @@ import org.apache.tuscany.sca.contribution.processor.ContributionResolveExceptio 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; /* @@ -56,17 +57,24 @@ import org.apache.tuscany.sca.implementation.osgi.impl.ServiceDescriptionsImpl; */ public class ServiceDescriptionsProcessor implements StAXArtifactProcessor { + 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 @@ public class ServiceDescriptionsProcessor implements StAXArtifactProcessor descriptions = processor.read(reader); Assert.assertEquals(2, descriptions.size()); System.out.println(descriptions); -- cgit v1.2.3