diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-10 05:57:51 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-10 05:57:51 +0000 |
commit | 1265ef2c9979752024588a8aacbde31fed1e6df1 (patch) | |
tree | 986ece3dd1b45fa8829d95ba1f2c835da9e7b554 | |
parent | 6c21cd40d156d91d02d1a2ea6c658fbfac3c0d3a (diff) |
Create the runtime version of Endpoint2 for serialization
Serialize the EP using XML
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@783213 13f79535-47bb-0310-9956-ffa450edef68
11 files changed, 372 insertions, 25 deletions
diff --git a/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java new file mode 100644 index 0000000000..be209cb681 --- /dev/null +++ b/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java @@ -0,0 +1,122 @@ +/*
+ * 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.assembly.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+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.processor.StAXAttributeProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ *
+ */
+public class EndpointProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<Endpoint2> {
+ private final static String ENDPOINT = "endpoint";
+ private final static QName ENDPOINT_QNAME = new QName(Constants.SCA11_TUSCANY_NS, ENDPOINT);
+
+ private ExtensionPointRegistry registry;
+
+ public EndpointProcessor(ExtensionPointRegistry registry,
+ StAXArtifactProcessor extensionProcessor,
+ StAXAttributeProcessor extensionAttributeProcessor,
+ Monitor monitor) {
+
+ super(modelFactories(registry), extensionProcessor, monitor);
+ this.registry = registry;
+ }
+
+ /**
+ * Returns the model factory extension point to use.
+ *
+ * @param extensionPoints
+ * @return
+ */
+ private static FactoryExtensionPoint modelFactories(ExtensionPointRegistry extensionPoints) {
+ return extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+ }
+
+ public QName getArtifactType() {
+ return ENDPOINT_QNAME;
+ }
+
+ public Endpoint2 read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ Endpoint2 endpoint = assemblyFactory.createEndpoint();
+ reader.nextTag();
+ Object model = extensionProcessor.read(reader);
+ if (model instanceof Composite) {
+ Composite composite = (Composite)model;
+ Component component = composite.getComponents().get(0);
+ ComponentService service = component.getServices().get(0);
+ Binding binding = service.getBindings().get(0);
+ endpoint.setComponent(component);
+ endpoint.setService(service);
+ endpoint.setBinding(binding);
+ }
+ return endpoint;
+ }
+
+ public void write(Endpoint2 model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ // writeStart(writer, ENDPOINT_QNAME);
+ extensionProcessor.write(wrap(model), writer);
+ // writeEnd(writer);
+ }
+
+ private Composite wrap(Endpoint2 endpoint) {
+ try {
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(ENDPOINT_QNAME);
+ Component component = (Component)endpoint.getComponent().clone();
+ composite.getComponents().add(component);
+ component.getReferences().clear();
+ component.getServices().clear();
+ ComponentService service = (ComponentService)endpoint.getService().clone();
+ component.getServices().add(service);
+ service.getBindings().clear();
+ service.setInterfaceContract(endpoint.getInterfaceContract());
+ Binding binding = (Binding)endpoint.getBinding().clone();
+ service.getBindings().add(binding);
+ return composite;
+ } catch (CloneNotSupportedException e) {
+ return null;
+ }
+ }
+
+ public Class<Endpoint2> getModelType() {
+ return Endpoint2.class;
+ }
+
+ public void resolve(Endpoint2 model, ModelResolver resolver) throws ContributionResolveException {
+ }
+}
diff --git a/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor index 7b69e6760b..68859d3d98 100644 --- a/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ b/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -5,18 +5,19 @@ # 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.
+# under the License.
# Implementation class for the artifact processor extension
org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200903#componentType,model=org.apache.tuscany.sca.assembly.ComponentType
org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200903#constrainingType,model=org.apache.tuscany.sca.assembly.ConstrainingType
org.apache.tuscany.sca.assembly.xml.CompositeProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200903#composite,model=org.apache.tuscany.sca.assembly.Composite
org.apache.tuscany.sca.assembly.xml.SCABindingProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200903#binding.sca,model=org.apache.tuscany.sca.assembly.SCABinding
+org.apache.tuscany.sca.assembly.xml.EndpointProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#binding.rmi#endpoint,model=org.apache.tuscany.sca.assembly.Endpoint2
\ No newline at end of file diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java index 32506e63e2..26bf3bcda6 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java @@ -18,10 +18,6 @@ */ package org.apache.tuscany.sca.assembly.impl; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; import java.util.ArrayList; import java.util.List; @@ -42,8 +38,10 @@ import org.apache.tuscany.sca.policy.PolicySubject; * * @version $Rev$ $Date$ */ -public class Endpoint2Impl implements Endpoint2, Externalizable { - private ExtensionPointRegistry registry; +public class Endpoint2Impl implements Endpoint2 { + private static final long serialVersionUID = 7344399683703812593L; + + protected ExtensionPointRegistry registry; private Boolean unresolved; private String componentName; private Component component; @@ -186,16 +184,4 @@ public class Endpoint2Impl implements Endpoint2, Externalizable { return output; } - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - // TODO: Lookup an endpoint serializer utility from the UtilityExtensionPoint - // Read the EP from the XML document - // See javax.xml.ws.wsaddressing.W3CEndpointReference - } - - public void writeExternal(ObjectOutput out) throws IOException { - // TODO: Lookup an endpoint serializer utility from the UtilityExtensionPoint - // Write the EP as XML document - // See javax.xml.ws.wsaddressing.W3CEndpointReference - } - } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java new file mode 100644 index 0000000000..1cdc1c6209 --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java @@ -0,0 +1,40 @@ +/*
+ * 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.core.assembly;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
+
+/**
+ * A utility to seralize/deserialize Endpoint/EndpointReference objects
+ */
+public interface EndpointSerializer {
+ void readExternal(Endpoint2 endpoint, ObjectInput input) throws IOException;
+
+ void writeExternal(Endpoint2 endpoint, ObjectOutput output) throws IOException;
+
+ void readExternal(EndpointReference2 endpointReference, ObjectInput input) throws IOException;
+
+ void writeExternal(EndpointReference2 endpointReference, ObjectOutput output) throws IOException;
+}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java index 547c8f6750..27845b445c 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java @@ -26,7 +26,10 @@ import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; +import org.apache.tuscany.sca.assembly.Endpoint2; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl; import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl; import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentImpl; @@ -78,4 +81,16 @@ public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements As return new ReferenceParametersImpl(); } + @Override + public Endpoint2 createEndpoint() { + // Create an instance of EndpointImpl that can be serialized/deserialized using the Tuscany + // runtime extension points and extensions + return new RuntimeEndpointImpl(registry); + } + + @Override + public EndpointReference2 createEndpointReference() { + return super.createEndpointReference(); + } + } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java new file mode 100644 index 0000000000..bf3339d8ad --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java @@ -0,0 +1,109 @@ +/*
+ * 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.core.assembly.impl;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+
+public class EndpointSerializerImpl implements EndpointSerializer {
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Endpoint2> processor;
+ private StAXArtifactProcessor<EndpointReference2> refProcessor;
+
+ public EndpointSerializerImpl(ExtensionPointRegistry registry) {
+ FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+ inputFactory = factories.getFactory(XMLInputFactory.class);
+ outputFactory = factories.getFactory(XMLOutputFactory.class);
+ StAXArtifactProcessorExtensionPoint processors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ processor = processors.getProcessor(Endpoint2.class);
+ refProcessor = processors.getProcessor(EndpointReference2.class);
+ }
+
+ public void readExternal(Endpoint2 endpoint, ObjectInput input) throws IOException {
+ try {
+ String xml = input.readUTF();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
+ Endpoint2 result = processor.read(reader);
+ endpoint.setComponent(result.getComponent());
+ endpoint.setService(result.getService());
+ endpoint.setBinding(result.getBinding());
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+
+ }
+
+ public void writeExternal(Endpoint2 endpoint, ObjectOutput output) throws IOException {
+ StringWriter sw = new StringWriter();
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
+ processor.write(endpoint, writer);
+ writer.flush();
+ output.writeUTF(sw.toString());
+ writer.close();
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+ }
+
+ public void readExternal(EndpointReference2 endpointReference, ObjectInput input) throws IOException {
+ try {
+ String xml = input.readUTF();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
+ EndpointReference2 result = refProcessor.read(reader);
+ reader.close();
+ endpointReference.setComponent(result.getComponent());
+ endpointReference.setReference(result.getReference());
+ endpointReference.setBinding(result.getBinding());
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+ }
+
+ public void writeExternal(EndpointReference2 endpointReference, ObjectOutput output) throws IOException {
+ StringWriter sw = new StringWriter();
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
+ refProcessor.write(endpointReference, writer);
+ writer.flush();
+ output.writeUTF(sw.toString());
+ } catch (Exception e) {
+ throw new IOException(e);
+ }
+ }
+}
\ No newline at end of file diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java new file mode 100644 index 0000000000..41222a1148 --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java @@ -0,0 +1,61 @@ +/*
+ * 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.core.assembly.impl;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.apache.tuscany.sca.assembly.impl.Endpoint2Impl;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+
+/**
+ * Runtime model for Endpoint that supports java serialization
+ */
+public class RuntimeEndpointImpl extends Endpoint2Impl implements Externalizable {
+ private static EndpointSerializer serializer;
+
+ /**
+ * No-arg constructor for Java serilization
+ */
+ public RuntimeEndpointImpl() {
+ super(null);
+ }
+
+ public RuntimeEndpointImpl(ExtensionPointRegistry registry) {
+ super(registry);
+ if (registry != null) {
+ serializer = new EndpointSerializerImpl(registry);
+ }
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ // When this method is invoked, the instance is created using the no-arg constructor
+ // We need to keep the serializer as a static
+ serializer.readExternal(this, in);
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ serializer.writeExternal(this, out);
+ }
+
+}
diff --git a/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF b/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF index 8b2bc031b8..3dcd06da81 100644 --- a/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF +++ b/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF @@ -14,4 +14,8 @@ Bundle-DocURL: http://www.apache.org/ Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6 Import-Package: org.apache.tuscany.sca.assembly;version="2.0.0",
org.apache.tuscany.sca.policy;version="2.0.0",
- org.apache.tuscany.sca.runtime;version="2.0.0"
+ org.apache.tuscany.sca.runtime;version="2.0.0",
+ org.apache.catalina.tribes,
+ org.apache.catalina.tribes.group,
+ org.apache.catalina.tribes.membership,
+ org.apache.catalina.tribes.tipis
diff --git a/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java index e0c4430edb..70873310f2 100644 --- a/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java +++ b/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java @@ -38,11 +38,14 @@ import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.runtime.EndpointListener;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
+/**
+ * A replicated EndpointRegistry based on Apache Tomcat Tribes
+ */
public class ReplicatedEndpointRegistry implements EndpointRegistry {
private final static Logger logger = Logger.getLogger(ReplicatedEndpointRegistry.class.getName());
private static final String MULTICAST_ADDRESS = "228.0.0.100";
private static final int MULTICAST_PORT = 50000;
- private String domainURI;
+ private String domainURI = "default";
private List<EndpointReference2> endpointreferences = new CopyOnWriteArrayList<EndpointReference2>();
private List<EndpointListener> listeners = new CopyOnWriteArrayList<EndpointListener>();
@@ -64,6 +67,8 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry { mcastService.setBind(bindAddress);
}
+ // mcastService.setBind("192.168.1.100");
+
try {
channel.start(Channel.DEFAULT);
} catch (ChannelException e) {
@@ -72,6 +77,10 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry { return channel;
}
+ public ReplicatedEndpointRegistry() {
+ this("default");
+ }
+
public ReplicatedEndpointRegistry(String domainURI) {
this.domainURI = domainURI;
map =
diff --git a/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry b/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry index 1d0e5ffe6d..1b7d0e7d89 100644 --- a/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry +++ b/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry @@ -14,4 +14,4 @@ # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpointRegistry
\ No newline at end of file +org.apache.tuscany.sca.endpoint.tribes.ReplicatedEndpointRegistry;ranking=100
\ No newline at end of file diff --git a/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java b/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java index 3857151bec..a5048859f0 100644 --- a/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java +++ b/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java @@ -100,7 +100,7 @@ public final class ServiceDiscovery implements ServiceDiscoverer { public ServiceDeclaration getServiceDeclaration(final String name) throws IOException { // ServiceDeclaration service = getServiceDiscoverer().getFirstServiceDeclaration(name); // return service; - Collection<ServiceDeclaration> declarations = getServiceDeclarations(name); + Collection<ServiceDeclaration> declarations = getServiceDeclarations(name, true); if (!declarations.isEmpty()) { List<ServiceDeclaration> declarationList = new ArrayList<ServiceDeclaration>(declarations); Collections.sort(declarationList, ServiceComparator.DESCENDING_ORDER); |