summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-21 07:03:47 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-21 07:03:47 +0000
commitab6904bc2f622129bc548391745b08eb0c219e57 (patch)
tree5c7599119182bfa8e65c0d6605e933396aedffd2 /java/sca/modules/core/src
parent8d70ef6d556ad29b93d5d40e91c4c9304638c9e9 (diff)
Fix svn:eol-style and svn:keywords properties for java/xml files
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@796166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core/src')
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java76
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java214
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java200
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java200
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java140
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java98
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/impl/WorkListener.java64
7 files changed, 496 insertions, 496 deletions
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
index 4617901c5b..b9c9c7032b 100644
--- 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
@@ -1,38 +1,38 @@
-/*
- * 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 org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-
-/**
- * A utility to seralize/deserialize Endpoint/EndpointReference objects
- */
-public interface EndpointSerializer {
- void read(Endpoint endpoint, String xml) throws IOException;
-
- String write(Endpoint endpoint) throws IOException;
-
- void read(EndpointReference endpointReference, String xml) throws IOException;
-
- String write(EndpointReference endpointReference) throws IOException;
-}
+/*
+ * 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 org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+
+/**
+ * A utility to seralize/deserialize Endpoint/EndpointReference objects
+ */
+public interface EndpointSerializer {
+ void read(Endpoint endpoint, String xml) throws IOException;
+
+ String write(Endpoint endpoint) throws IOException;
+
+ void read(EndpointReference endpointReference, String xml) throws IOException;
+
+ String write(EndpointReference endpointReference) throws IOException;
+}
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
index b9eb6c117b..f4cc957f26 100644
--- 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
@@ -1,108 +1,108 @@
-/*
- * 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.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.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-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<Endpoint> processor;
- private StAXArtifactProcessor<EndpointReference> 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(Endpoint.class);
- refProcessor = processors.getProcessor(EndpointReference.class);
- }
-
- public void read(Endpoint endpoint, String xml) throws IOException {
- try {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
- Endpoint result = processor.read(reader);
- endpoint.setComponent(result.getComponent());
- endpoint.setService(result.getService());
- endpoint.setBinding(result.getBinding());
- endpoint.setInterfaceContract(result.getService().getInterfaceContract());
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
-
- }
-
- public String write(Endpoint endpoint) throws IOException {
- StringWriter sw = new StringWriter();
- try {
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
- processor.write(endpoint, writer);
- writer.flush();
- writer.close();
- return sw.toString();
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public void read(EndpointReference endpointReference, String xml) throws IOException {
- try {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
- EndpointReference result = refProcessor.read(reader);
- reader.close();
- endpointReference.setComponent(result.getComponent());
- endpointReference.setReference(result.getReference());
- endpointReference.setBinding(result.getBinding());
- endpointReference.setInterfaceContract(result.getReference().getInterfaceContract());
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public String write(EndpointReference endpointReference) throws IOException {
- StringWriter sw = new StringWriter();
- try {
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
- refProcessor.write(endpointReference, writer);
- writer.flush();
- writer.close();
- return sw.toString();
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
+/*
+ * 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.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.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+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<Endpoint> processor;
+ private StAXArtifactProcessor<EndpointReference> 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(Endpoint.class);
+ refProcessor = processors.getProcessor(EndpointReference.class);
+ }
+
+ public void read(Endpoint endpoint, String xml) throws IOException {
+ try {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
+ Endpoint result = processor.read(reader);
+ endpoint.setComponent(result.getComponent());
+ endpoint.setService(result.getService());
+ endpoint.setBinding(result.getBinding());
+ endpoint.setInterfaceContract(result.getService().getInterfaceContract());
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+
+ }
+
+ public String write(Endpoint endpoint) throws IOException {
+ StringWriter sw = new StringWriter();
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
+ processor.write(endpoint, writer);
+ writer.flush();
+ writer.close();
+ return sw.toString();
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public void read(EndpointReference endpointReference, String xml) throws IOException {
+ try {
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
+ EndpointReference result = refProcessor.read(reader);
+ reader.close();
+ endpointReference.setComponent(result.getComponent());
+ endpointReference.setReference(result.getReference());
+ endpointReference.setBinding(result.getBinding());
+ endpointReference.setInterfaceContract(result.getReference().getInterfaceContract());
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ public String write(EndpointReference endpointReference) throws IOException {
+ StringWriter sw = new StringWriter();
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
+ refProcessor.write(endpointReference, writer);
+ writer.flush();
+ writer.close();
+ return sw.toString();
+ } catch (Exception e) {
+ throw new IOException(e.getMessage());
+ }
+ }
} \ 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
index f2ec7f8019..d37d62c5cd 100644
--- 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
@@ -1,100 +1,100 @@
-/*
- * 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.EndpointImpl;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
-
-/**
- * Runtime model for Endpoint that supports java serialization
- */
-public class RuntimeEndpointImpl extends EndpointImpl implements Externalizable {
- private EndpointSerializer serializer;
- private String xml;
-
- /**
- * No-arg constructor for Java serilization
- */
- public RuntimeEndpointImpl() {
- super(null);
- }
-
- public RuntimeEndpointImpl(ExtensionPointRegistry registry) {
- super(registry);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- this.uri = in.readUTF();
- this.xml = in.readUTF();
- // Defer the loading to resolve();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(getURI());
- out.writeUTF(getSerializer().write(this));
- }
-
- private synchronized EndpointSerializer getSerializer() {
- if (serializer == null) {
- if (registry != null) {
- serializer =
- registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(EndpointSerializer.class);
- } else {
- throw new IllegalStateException("No extension registry is set");
- }
- }
- return serializer;
- }
-
- @Override
- protected void reset() {
- super.reset();
- this.xml = null;
- }
-
- @Override
- protected void resolve() {
- if (component == null && xml != null) {
- try {
- getSerializer().read(this, xml);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
- super.resolve();
- }
-
- @Override
- public void setExtensionPointRegistry(ExtensionPointRegistry registry) {
- if (this.registry != registry) {
- super.setExtensionPointRegistry(registry);
- serializer = null;
- }
- // resolve();
- }
-
-}
+/*
+ * 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.EndpointImpl;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+
+/**
+ * Runtime model for Endpoint that supports java serialization
+ */
+public class RuntimeEndpointImpl extends EndpointImpl implements Externalizable {
+ private EndpointSerializer serializer;
+ private String xml;
+
+ /**
+ * No-arg constructor for Java serilization
+ */
+ public RuntimeEndpointImpl() {
+ super(null);
+ }
+
+ public RuntimeEndpointImpl(ExtensionPointRegistry registry) {
+ super(registry);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ this.uri = in.readUTF();
+ this.xml = in.readUTF();
+ // Defer the loading to resolve();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeUTF(getURI());
+ out.writeUTF(getSerializer().write(this));
+ }
+
+ private synchronized EndpointSerializer getSerializer() {
+ if (serializer == null) {
+ if (registry != null) {
+ serializer =
+ registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(EndpointSerializer.class);
+ } else {
+ throw new IllegalStateException("No extension registry is set");
+ }
+ }
+ return serializer;
+ }
+
+ @Override
+ protected void reset() {
+ super.reset();
+ this.xml = null;
+ }
+
+ @Override
+ protected void resolve() {
+ if (component == null && xml != null) {
+ try {
+ getSerializer().read(this, xml);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ super.resolve();
+ }
+
+ @Override
+ public void setExtensionPointRegistry(ExtensionPointRegistry registry) {
+ if (this.registry != registry) {
+ super.setExtensionPointRegistry(registry);
+ serializer = null;
+ }
+ // resolve();
+ }
+
+}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
index 36f49eac5e..5543ec1225 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
@@ -1,100 +1,100 @@
-/*
- * 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.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
-
-/**
- * Runtime model for Endpoint that supports java serialization
- */
-public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implements Externalizable {
- private EndpointSerializer serializer;
- private String xml;
-
- /**
- * No-arg constructor for Java serilization
- */
- public RuntimeEndpointReferenceImpl() {
- super(null);
- }
-
- public RuntimeEndpointReferenceImpl(ExtensionPointRegistry registry) {
- super(registry);
- }
-
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- this.uri = in.readUTF();
- this.xml = in.readUTF();
- // Defer the loading to resolve();
- }
-
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeUTF(getURI());
- out.writeUTF(getSerializer().write(this));
- }
-
- private synchronized EndpointSerializer getSerializer() {
- if (serializer == null) {
- if (registry != null) {
- serializer =
- registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(EndpointSerializer.class);
- } else {
- throw new IllegalStateException("No extension registry is set");
- }
- }
- return serializer;
- }
-
- @Override
- protected void reset() {
- super.reset();
- this.xml = null;
- }
-
- @Override
- protected void resolve() {
- if (component == null && xml != null) {
- try {
- getSerializer().read(this, xml);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
- super.resolve();
- }
-
- @Override
- public void setExtensionPointRegistry(ExtensionPointRegistry registry) {
- if (this.registry != registry) {
- super.setExtensionPointRegistry(registry);
- serializer = null;
- }
- // resolve();
- }
-
-}
+/*
+ * 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.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+
+/**
+ * Runtime model for Endpoint that supports java serialization
+ */
+public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implements Externalizable {
+ private EndpointSerializer serializer;
+ private String xml;
+
+ /**
+ * No-arg constructor for Java serilization
+ */
+ public RuntimeEndpointReferenceImpl() {
+ super(null);
+ }
+
+ public RuntimeEndpointReferenceImpl(ExtensionPointRegistry registry) {
+ super(registry);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ this.uri = in.readUTF();
+ this.xml = in.readUTF();
+ // Defer the loading to resolve();
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeUTF(getURI());
+ out.writeUTF(getSerializer().write(this));
+ }
+
+ private synchronized EndpointSerializer getSerializer() {
+ if (serializer == null) {
+ if (registry != null) {
+ serializer =
+ registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(EndpointSerializer.class);
+ } else {
+ throw new IllegalStateException("No extension registry is set");
+ }
+ }
+ return serializer;
+ }
+
+ @Override
+ protected void reset() {
+ super.reset();
+ this.xml = null;
+ }
+
+ @Override
+ protected void resolve() {
+ if (component == null && xml != null) {
+ try {
+ getSerializer().read(this, xml);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ super.resolve();
+ }
+
+ @Override
+ public void setExtensionPointRegistry(ExtensionPointRegistry registry) {
+ if (this.registry != registry) {
+ super.setExtensionPointRegistry(registry);
+ serializer = null;
+ }
+ // resolve();
+ }
+
+}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java
index 8c8f001eb9..e2467d2e5c 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java
@@ -1,70 +1,70 @@
-/*
- * 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.invocation;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Proxy;
-import java.util.WeakHashMap;
-
-public class CachedProxy extends Proxy {
- private static final long serialVersionUID = 783519311852563060L;
-
- protected CachedProxy(InvocationHandler handler) {
- super(handler);
- }
-
- // This is a cache containing the proxy class constructor for each business interface.
- // This improves performance compared to calling Proxy.newProxyInstance()
- // every time that a proxy is needed.
- private final static WeakHashMap<Class<?>, Constructor<?>> cache = new WeakHashMap<Class<?>, Constructor<?>>();
-
- public static Object newProxyInstance(ClassLoader classloader, Class<?> aclass[], InvocationHandler invocationhandler)
- throws IllegalArgumentException {
- try {
- if (invocationhandler == null)
- throw new NullPointerException();
- // Lookup cached constructor. aclass[0] is the reference's business interface.
- Constructor<?> proxyCTOR;
- synchronized (cache) {
- proxyCTOR = cache.get(aclass[0]);
- }
- if (proxyCTOR == null) {
- Class<?> proxyClass = getProxyClass(classloader, aclass);
- proxyCTOR = proxyClass.getConstructor(constructorParams);
- synchronized (cache) {
- cache.put(aclass[0], proxyCTOR);
- }
- }
- return proxyCTOR.newInstance(new Object[] {invocationhandler});
- } catch (NoSuchMethodException e) {
- throw new InternalError(e.toString());
- } catch (IllegalAccessException e) {
- throw new InternalError(e.toString());
- } catch (InstantiationException e) {
- throw new InternalError(e.toString());
- } catch (InvocationTargetException e) {
- throw new InternalError(e.toString());
- }
- }
-
- private static final Class<?> constructorParams[] = {InvocationHandler.class};
-
-}
+/*
+ * 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.invocation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Proxy;
+import java.util.WeakHashMap;
+
+public class CachedProxy extends Proxy {
+ private static final long serialVersionUID = 783519311852563060L;
+
+ protected CachedProxy(InvocationHandler handler) {
+ super(handler);
+ }
+
+ // This is a cache containing the proxy class constructor for each business interface.
+ // This improves performance compared to calling Proxy.newProxyInstance()
+ // every time that a proxy is needed.
+ private final static WeakHashMap<Class<?>, Constructor<?>> cache = new WeakHashMap<Class<?>, Constructor<?>>();
+
+ public static Object newProxyInstance(ClassLoader classloader, Class<?> aclass[], InvocationHandler invocationhandler)
+ throws IllegalArgumentException {
+ try {
+ if (invocationhandler == null)
+ throw new NullPointerException();
+ // Lookup cached constructor. aclass[0] is the reference's business interface.
+ Constructor<?> proxyCTOR;
+ synchronized (cache) {
+ proxyCTOR = cache.get(aclass[0]);
+ }
+ if (proxyCTOR == null) {
+ Class<?> proxyClass = getProxyClass(classloader, aclass);
+ proxyCTOR = proxyClass.getConstructor(constructorParams);
+ synchronized (cache) {
+ cache.put(aclass[0], proxyCTOR);
+ }
+ }
+ return proxyCTOR.newInstance(new Object[] {invocationhandler});
+ } catch (NoSuchMethodException e) {
+ throw new InternalError(e.toString());
+ } catch (IllegalAccessException e) {
+ throw new InternalError(e.toString());
+ } catch (InstantiationException e) {
+ throw new InternalError(e.toString());
+ } catch (InvocationTargetException e) {
+ throw new InternalError(e.toString());
+ }
+ }
+
+ private static final Class<?> constructorParams[] = {InvocationHandler.class};
+
+}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
index 2ca94a659d..866e62abde 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
@@ -1,49 +1,49 @@
-/*
- * 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.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.core.context.impl.ServiceReferenceImpl;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.oasisopen.sca.ServiceReference;
-
-/**
- * Uses a wire to return a CallableReference
- *
- * @version $Rev: 574648 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
- */
-public class CallbackReferenceObjectFactory implements ObjectFactory<ServiceReference<?>> {
- private Class<?> businessInterface;
- private ProxyFactory proxyFactory;
- private List<RuntimeWire> wires;
-
- public CallbackReferenceObjectFactory(Class<?> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
- this.businessInterface = interfaze;
- this.proxyFactory = proxyFactory;
- this.wires = wires;
- }
-
- public ServiceReference<?> getInstance() throws ObjectCreationException {
- return new ServiceReferenceImpl(businessInterface, wires.get(0), proxyFactory);
- }
-
-}
+/*
+ * 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.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.core.context.impl.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.oasisopen.sca.ServiceReference;
+
+/**
+ * Uses a wire to return a CallableReference
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackReferenceObjectFactory implements ObjectFactory<ServiceReference<?>> {
+ private Class<?> businessInterface;
+ private ProxyFactory proxyFactory;
+ private List<RuntimeWire> wires;
+
+ public CallbackReferenceObjectFactory(Class<?> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
+ this.businessInterface = interfaze;
+ this.proxyFactory = proxyFactory;
+ this.wires = wires;
+ }
+
+ public ServiceReference<?> getInstance() throws ObjectCreationException {
+ return new ServiceReferenceImpl(businessInterface, wires.get(0), proxyFactory);
+ }
+
+}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/impl/WorkListener.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/impl/WorkListener.java
index facb2dfe56..38bbaeebe0 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/impl/WorkListener.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/work/impl/WorkListener.java
@@ -1,32 +1,32 @@
-/*
- * 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.work.impl;
-
-public interface WorkListener {
-
- long IMMEDIATE = 0;
- long INDEFINITE = java.lang.Long.MAX_VALUE;
-
- void workAccepted(WorkEvent event);
- void workCompleted(WorkEvent event);
- void workRejected(WorkEvent event);
- void workStarted(WorkEvent event);
-
-}
+/*
+ * 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.work.impl;
+
+public interface WorkListener {
+
+ long IMMEDIATE = 0;
+ long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ void workAccepted(WorkEvent event);
+ void workCompleted(WorkEvent event);
+ void workRejected(WorkEvent event);
+ void workStarted(WorkEvent event);
+
+}