tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r783213 - in /tuscany/java/sca/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/main/resources/META-INF/services/ assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ core/src/main/java/org/a...
Date Wed, 10 Jun 2009 05:57:51 GMT
Author: rfeng
Date: Wed Jun 10 05:57:51 2009
New Revision: 783213

URL: http://svn.apache.org/viewvc?rev=783213&view=rev
Log:
Create the runtime version of Endpoint2 for serialization
Serialize the EP using XML

Added:
    tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
Modified:
    tuscany/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java
    tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
    tuscany/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
    tuscany/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry
    tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java

Added: tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java?rev=783213&view=auto
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
(added)
+++ tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
Wed Jun 10 05:57:51 2009
@@ -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
{
+    }
+}

Modified: tuscany/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
(original)
+++ tuscany/java/sca/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
Wed Jun 10 05:57:51 2009
@@ -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

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java
Wed Jun 10 05:57:51 2009
@@ -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 @@
  *
  * @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 @@
         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
-    }
-
 }

Added: tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java?rev=783213&view=auto
==============================================================================
--- tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java
(added)
+++ tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java
Wed Jun 10 05:57:51 2009
@@ -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;
+}

Modified: tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
(original)
+++ tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
Wed Jun 10 05:57:51 2009
@@ -26,7 +26,10 @@
 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 @@
         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();
+    }
+
 }

Added: tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java?rev=783213&view=auto
==============================================================================
--- tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
(added)
+++ tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
Wed Jun 10 05:57:51 2009
@@ -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

Added: tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java?rev=783213&view=auto
==============================================================================
--- tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
(added)
+++ tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
Wed Jun 10 05:57:51 2009
@@ -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);
+    }
+
+}

Modified: tuscany/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/endpoint-tribes/META-INF/MANIFEST.MF Wed Jun 10 05:57:51 2009
@@ -14,4 +14,8 @@
 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

Modified: tuscany/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
(original)
+++ tuscany/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java
Wed Jun 10 05:57:51 2009
@@ -38,11 +38,14 @@
 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 @@
             mcastService.setBind(bindAddress);
         }
 
+        // mcastService.setBind("192.168.1.100");
+
         try {
             channel.start(Channel.DEFAULT);
         } catch (ChannelException e) {
@@ -72,6 +77,10 @@
         return channel;
     }
 
+    public ReplicatedEndpointRegistry() {
+        this("default");
+    }
+
     public ReplicatedEndpointRegistry(String domainURI) {
         this.domainURI = domainURI;
         map =

Modified: tuscany/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry
(original)
+++ tuscany/java/sca/modules/endpoint-tribes/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointRegistry
Wed Jun 10 05:57:51 2009
@@ -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

Modified: tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java?rev=783213&r1=783212&r2=783213&view=diff
==============================================================================
--- tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
(original)
+++ tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
Wed Jun 10 05:57:51 2009
@@ -100,7 +100,7 @@
     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);



Mime
View raw message