You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2007/02/17 09:35:25 UTC
svn commit: r508732 [2/8] - in /incubator/tuscany/java/sca:
kernel/core/src/main/java/org/apache/tuscany/core/binding/local/
kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/
kernel/core/src/main/java/org/apache/tuscany/core/builder/ kernel/...
Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java?view=auto&rev=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java Sat Feb 17 00:35:19 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.core.builder;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.builder.WiringException;
+
+/**
+ * Denotes an invalid source type for a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidSourceTypeException extends WiringException {
+
+ public InvalidSourceTypeException(String message, URI sourceUri, URI targetUri) {
+ super(message, sourceUri, targetUri);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/InvalidSourceTypeException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java?view=auto&rev=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java Sat Feb 17 00:35:19 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.core.builder;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.builder.WiringException;
+
+/**
+ * Denotes no binding was specified for a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoBindingException extends WiringException {
+
+ public NoBindingException(String message, URI sourceUri, URI targetUri) {
+ super(message, sourceUri, targetUri);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/NoBindingException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java?view=auto&rev=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java Sat Feb 17 00:35:19 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.builder;
+
+import java.net.URI;
+
+import org.apache.tuscany.spi.builder.WiringException;
+
+/**
+ * Indicates the source service of a wire was not found
+ *
+ * @version $Rev$ $Date$
+ */
+public class SourceServiceNotFoundException extends WiringException {
+
+ public SourceServiceNotFoundException(String message, URI sourceName) {
+ super(message, sourceName, null);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/SourceServiceNotFoundException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/WirePostProcessorRegistryImpl.java Sat Feb 17 00:35:19 2007
@@ -21,9 +21,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.tuscany.spi.component.SCAObject;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.spi.wire.WirePostProcessor;
import org.apache.tuscany.spi.wire.WirePostProcessorRegistry;
@@ -36,15 +34,9 @@
private final List<WirePostProcessor> processors = new ArrayList<WirePostProcessor>();
- public void process(SCAObject source, OutboundWire sourceWire, SCAObject target, InboundWire targetWire) {
+ public void process(Wire wire) {
for (WirePostProcessor processor : processors) {
- processor.process(source, sourceWire, target, targetWire);
- }
- }
-
- public void process(SCAObject source, InboundWire sourceWire, SCAObject target, OutboundWire targetWire) {
- for (WirePostProcessor processor : processors) {
- processor.process(source, sourceWire, target, targetWire);
+ processor.process(wire);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ComponentContextImpl.java Sat Feb 17 00:35:19 2007
@@ -18,16 +18,14 @@
*/
package org.apache.tuscany.core.component;
-import org.osoa.sca.ComponentContext;
import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ComponentContext;
import org.osoa.sca.RequestContext;
-
-import org.apache.tuscany.core.component.ComponentContextProvider;
+import org.osoa.sca.ServiceReference;
/**
* Implementation of ComponentContext that delegates to a ComponentContextProvider.
- *
+ *
* @version $Rev$ $Date$
*/
public class ComponentContextImpl implements ComponentContext {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/ServiceReferenceImpl.java Sat Feb 17 00:35:19 2007
@@ -28,7 +28,7 @@
* @version $Rev$ $Date$
* @param <B> the type of the business interface
*/
-public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReference<B>{
+public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReference<B> {
public ServiceReferenceImpl(Class<B> businessInterface, ObjectFactory<B> factory) {
super(businessInterface, factory);
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/WorkContextImpl.java Sat Feb 17 00:35:19 2007
@@ -38,7 +38,7 @@
public class WorkContextImpl implements WorkContext {
private static final Object REMOTE_CONTEXT = new Object();
private static final Object CORRELATION_ID = new Object();
- private static final Object CALLBACK_ROUTING_CHAIN = new Object();
+ private static final Object CALLBACK_URIS = new Object();
private static final Object CURRENT_ATOMIC = new Object();
private static final Object CURRENT_SERVICE_NAMES = new Object();
@@ -79,17 +79,17 @@
}
@SuppressWarnings("unchecked")
- public LinkedList<URI> getCurrentCallbackRoutingChain() {
+ public LinkedList<URI> getCurrentCallbackUris() {
Map<Object, Object> map = workContext.get();
if (map == null) {
return null;
}
- return (LinkedList<URI>) map.get(CALLBACK_ROUTING_CHAIN);
+ return (LinkedList<URI>) map.get(CALLBACK_URIS);
}
- public void setCurrentCallbackRoutingChain(LinkedList<URI> callbackRoutingChain) {
+ public void setCurrentCallbackUris(LinkedList<URI> uris) {
Map<Object, Object> map = getWorkContextMap();
- map.put(CALLBACK_ROUTING_CHAIN, callbackRoutingChain);
+ map.put(CALLBACK_URIS, uris);
}
public CompositeComponent getRemoteComponent() {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/DataBindingWirePostProcessor.java Sat Feb 17 00:35:19 2007
@@ -19,21 +19,17 @@
package org.apache.tuscany.core.databinding.impl;
+import java.util.Collection;
import java.util.Map;
-import java.util.Set;
import org.osoa.sca.annotations.Constructor;
import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.ReferenceBinding;
-import org.apache.tuscany.spi.component.SCAObject;
import org.apache.tuscany.spi.databinding.Mediator;
import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.wire.InboundInvocationChain;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.Interceptor;
-import org.apache.tuscany.spi.wire.OutboundInvocationChain;
-import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.spi.wire.WirePostProcessorExtension;
/**
@@ -51,12 +47,16 @@
this.mediator = mediator;
}
- public void process(SCAObject source, OutboundWire sourceWire, SCAObject target, InboundWire targetWire) {
- Map<Operation<?>, OutboundInvocationChain> chains = sourceWire.getOutboundInvocationChains();
- for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : chains.entrySet()) {
+ public void process(Wire wire) {
+ Map<Operation<?>, InvocationChain> chains = wire.getInvocationChains();
+ for (Map.Entry<Operation<?>, InvocationChain> entry : chains.entrySet()) {
Operation<?> sourceOperation = entry.getKey();
- Operation<?> targetOperation =
- getTargetOperation(targetWire.getInboundInvocationChains().keySet(), sourceOperation.getName());
+ ServiceContract<?> serviceContract = wire.getTargetContract();
+ if (serviceContract == null) {
+ continue;
+ }
+ Collection<? extends Operation<?>> operations = serviceContract.getOperations().values();
+ Operation<?> targetOperation = getTargetOperation(operations, sourceOperation.getName());
String sourceDataBinding = sourceOperation.getDataBinding();
String targetDataBinding = targetOperation.getDataBinding();
if (sourceDataBinding == null && targetDataBinding == null) {
@@ -68,28 +68,27 @@
// references can be wired
// to the same service
DataBindingInteceptor interceptor =
- new DataBindingInteceptor(sourceWire, sourceOperation, targetOperation);
+ new DataBindingInteceptor(wire, sourceOperation, targetOperation);
interceptor.setMediator(mediator);
entry.getValue().addInterceptor(0, interceptor);
}
}
// Check if there's a callback
- Map callbackOperations = sourceWire.getServiceContract().getCallbackOperations();
+ Map callbackOperations = wire.getSourceContract().getCallbackOperations();
if (callbackOperations == null || callbackOperations.isEmpty()) {
return;
}
//Object targetAddress = UriHelper.getBaseName(source.getUri());
- Map<Operation<?>, OutboundInvocationChain> callbackChains =
- targetWire.getSourceCallbackInvocationChains(sourceWire.getSourceUri());
+ Map<Operation<?>, InvocationChain> callbackChains = wire.getCallbackInvocationChains();
if (callbackChains == null) {
// callback chains could be null
return;
}
- for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : callbackChains.entrySet()) {
+ for (Map.Entry<Operation<?>, InvocationChain> entry : callbackChains.entrySet()) {
Operation<?> sourceOperation = entry.getKey();
Operation<?> targetOperation =
- getTargetOperation(sourceWire.getTargetCallbackInvocationChains().keySet(), sourceOperation
+ getTargetOperation(wire.getCallbackInvocationChains().keySet(), sourceOperation
.getName());
String sourceDataBinding = sourceOperation.getDataBinding();
String targetDataBinding = targetOperation.getDataBinding();
@@ -102,50 +101,15 @@
// references can be wired
// to the same service
DataBindingInteceptor interceptor =
- new DataBindingInteceptor(sourceWire, sourceOperation, targetOperation);
+ new DataBindingInteceptor(wire, sourceOperation, targetOperation);
interceptor.setMediator(mediator);
entry.getValue().addInterceptor(0, interceptor);
}
}
}
- public void process(SCAObject source, InboundWire sourceWire, SCAObject target, OutboundWire targetWire) {
- // Either Service or Reference
- boolean isReference = source instanceof ReferenceBinding;
-
- Map<Operation<?>, InboundInvocationChain> chains = sourceWire.getInboundInvocationChains();
- for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
- Operation<?> sourceOperation = entry.getKey();
- Operation<?> targetOperation =
- getTargetOperation(targetWire.getOutboundInvocationChains().keySet(), sourceOperation.getName());
- String sourceDataBinding = sourceOperation.getDataBinding();
- String targetDataBinding = targetOperation.getDataBinding();
- if (sourceDataBinding == null && targetDataBinding == null) {
- continue;
- }
- if (sourceDataBinding == null || targetDataBinding == null
- || !sourceDataBinding.equals(targetDataBinding)) {
- // Add the interceptor to the source side
- DataBindingInteceptor interceptor =
- new DataBindingInteceptor(sourceWire, sourceOperation, targetOperation);
- interceptor.setMediator(mediator);
- if (isReference) {
- // FIXME: We need a better way to position the interceptors
- targetWire.getOutboundInvocationChains().get(targetOperation).addInterceptor(0, interceptor);
- Interceptor tail = entry.getValue().getTailInterceptor();
- if (tail != null) {
- // HACK to relink the bridging interceptor
- tail.setNext(interceptor);
- }
- } else {
- entry.getValue().addInterceptor(0, interceptor);
- }
-
- }
- }
- }
- private Operation getTargetOperation(Set<Operation<?>> operations, String operationName) {
+ private Operation getTargetOperation(Collection<? extends Operation<?>> operations, String operationName) {
for (Operation<?> op : operations) {
if (op.getName().equals(operationName)) {
return op;
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/databinding/impl/PassByValueWirePostProcessor.java Sat Feb 17 00:35:19 2007
@@ -19,22 +19,9 @@
package org.apache.tuscany.core.databinding.impl;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.tuscany.spi.annotation.Autowire;
-import org.apache.tuscany.spi.component.SCAObject;
-import org.apache.tuscany.spi.databinding.DataBinding;
import org.apache.tuscany.spi.databinding.DataBindingRegistry;
-import org.apache.tuscany.spi.extension.AtomicComponentExtension;
-import org.apache.tuscany.spi.model.DataType;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.InboundInvocationChain;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.Interceptor;
-import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.spi.wire.WirePostProcessorExtension;
/**
@@ -45,7 +32,6 @@
* @version $Rev$ $Date$
*/
public class PassByValueWirePostProcessor extends WirePostProcessorExtension {
-
private DataBindingRegistry dataBindingRegistry;
public PassByValueWirePostProcessor() {
@@ -61,133 +47,135 @@
this.dataBindingRegistry = dataBindingRegistry;
}
- public void process(SCAObject source, OutboundWire sourceWire, SCAObject target, InboundWire targetWire) {
- Interceptor tailInterceptor;
- PassByValueInterceptor passByValueInterceptor;
- Operation<?> targetOperation;
- Operation<?> sourceOperation;
- DataBinding[] argsDataBindings;
- DataBinding resultDataBinding;
-
- boolean allowsPassByReference = false;
- // JFM this nneds to be fixed
- if (target instanceof AtomicComponentExtension) {
- allowsPassByReference =
- ((AtomicComponentExtension) target).isAllowsPassByReference();
- }
- if (targetWire.getServiceContract().isRemotable()
- && !allowsPassByReference) {
- Map<Operation<?>, InboundInvocationChain> chains = targetWire.getInboundInvocationChains();
- for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
- targetOperation = entry.getKey();
- sourceOperation =
- getSourceOperation(sourceWire.getOutboundInvocationChains().keySet(), targetOperation.getName());
-
-
- if (null != sourceOperation) {
- argsDataBindings = resolveArgsDataBindings(targetOperation);
- resultDataBinding = resolveResultDataBinding(targetOperation);
- passByValueInterceptor = new PassByValueInterceptor();
- passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
- passByValueInterceptor.setArgsDataBindings(argsDataBindings);
- passByValueInterceptor.setResultDataBinding(resultDataBinding);
- entry.getValue().addInterceptor(0, passByValueInterceptor);
- tailInterceptor =
- sourceWire.getOutboundInvocationChains().get(sourceOperation).getTailInterceptor();
- if (tailInterceptor != null) {
- tailInterceptor.setNext(passByValueInterceptor);
- }
- }
- }
- }
-
- // Check if there's a callback
- Map callbackOperations = sourceWire.getServiceContract().getCallbackOperations();
- allowsPassByReference = false;
- if (source instanceof AtomicComponentExtension) {
- allowsPassByReference =
- ((AtomicComponentExtension) source).isAllowsPassByReference();
- }
-
- if (sourceWire.getServiceContract().isRemotable()
- && !allowsPassByReference
- && callbackOperations != null
- && !callbackOperations.isEmpty()) {
- //URI targetAddress = UriHelper.getBaseName(source.getUri());
- Map<Operation<?>, InboundInvocationChain> callbackChains = sourceWire.getTargetCallbackInvocationChains();
- for (Map.Entry<Operation<?>, InboundInvocationChain> entry : callbackChains.entrySet()) {
- targetOperation = entry.getKey();
- sourceOperation =
- getSourceOperation(targetWire.getSourceCallbackInvocationChains(sourceWire.getSourceUri()).keySet(),
- targetOperation.getName());
-
- argsDataBindings = resolveArgsDataBindings(targetOperation);
- resultDataBinding = resolveResultDataBinding(targetOperation);
-
- passByValueInterceptor = new PassByValueInterceptor();
- passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
- passByValueInterceptor.setArgsDataBindings(argsDataBindings);
- passByValueInterceptor.setResultDataBinding(resultDataBinding);
-
- entry.getValue().addInterceptor(0, passByValueInterceptor);
- tailInterceptor =
- targetWire.getSourceCallbackInvocationChains(sourceWire.getSourceUri()).get(sourceOperation)
- .getTailInterceptor();
- if (tailInterceptor != null) {
- tailInterceptor.setNext(passByValueInterceptor);
- }
- }
- }
- }
-
- public void process(SCAObject source, InboundWire sourceWire, SCAObject target, OutboundWire targetWire) {
- //to be done if required..
- }
+ public void process(Wire wire) {
- private Operation getSourceOperation(Set<Operation<?>> operations, String operationName) {
- for (Operation<?> op : operations) {
- if (op.getName().equals(operationName)) {
- return op;
- }
- }
- return null;
}
- private DataBinding getDataBinding(Operation<?> operation) {
- String dataBinding = operation.getDataBinding();
- if (dataBinding == null) {
- ServiceContract<?> serviceContract = operation.getServiceContract();
- dataBinding = serviceContract.getDataBinding();
- }
- return dataBindingRegistry.getDataBinding(dataBinding);
-
- }
-
- @SuppressWarnings("unchecked")
- private DataBinding[] resolveArgsDataBindings(Operation operation) {
- List<DataType<?>> argumentTypes = (List<DataType<?>>) operation.getInputType().getLogical();
- DataBinding[] argDataBindings = new DataBinding[argumentTypes.size()];
- int count = 0;
- for (DataType argType : argumentTypes) {
- argDataBindings[count] = null;
- if (argType != null) {
- if (argType.getLogical() instanceof Class) {
- argDataBindings[count] =
- dataBindingRegistry.getDataBinding(((Class) argType.getLogical()).getName());
- }
- }
- ++count;
- }
- return argDataBindings;
- }
-
- private DataBinding resolveResultDataBinding(Operation operation) {
- DataType<?> resultType = (DataType<?>) operation.getOutputType();
- DataBinding resultBinding = null;
- if (resultType != null && resultType.getLogical() instanceof Class) {
- Class<?> logical = (Class<?>) resultType.getLogical();
- resultBinding = dataBindingRegistry.getDataBinding(logical.getName());
- }
- return resultBinding;
- }
+// public void process(SCAObject source, OutboundWire sourceWire, SCAObject target, InboundWire targetWire) {
+// Interceptor tailInterceptor;
+// PassByValueInterceptor passByValueInterceptor;
+// Operation<?> targetOperation;
+// Operation<?> sourceOperation;
+// DataBinding[] argsDataBindings;
+// DataBinding resultDataBinding;
+//
+// boolean allowsPassByReference = false;
+// // JFM this needs to be fixed
+// if (target instanceof AtomicComponentExtension) {
+// allowsPassByReference =
+// ((AtomicComponentExtension) target).isAllowsPassByReference();
+// }
+// if (targetWire.getSourceContract().isRemotable()
+// && !allowsPassByReference) {
+// Map<Operation<?>, InboundInvocationChain> chains = targetWire.getInboundInvocationChains();
+// for (Map.Entry<Operation<?>, InboundInvocationChain> entry : chains.entrySet()) {
+// targetOperation = entry.getKey();
+// sourceOperation =
+// getSourceOperation(sourceWire.getOutboundInvocationChains().keySet(), targetOperation.getName());
+//
+//
+// if (null != sourceOperation) {
+// argsDataBindings = resolveArgsDataBindings(targetOperation);
+// resultDataBinding = resolveResultDataBinding(targetOperation);
+// passByValueInterceptor = new PassByValueInterceptor();
+// passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
+// passByValueInterceptor.setArgsDataBindings(argsDataBindings);
+// passByValueInterceptor.setResultDataBinding(resultDataBinding);
+// entry.getValue().addInterceptor(0, passByValueInterceptor);
+// tailInterceptor =
+// sourceWire.getOutboundInvocationChains().get(sourceOperation).getTailInterceptor();
+// if (tailInterceptor != null) {
+// tailInterceptor.setNext(passByValueInterceptor);
+// }
+// }
+// }
+// }
+//
+// // Check if there's a callback
+// Map callbackOperations = sourceWire.getSourceContract().getCallbackOperations();
+// allowsPassByReference = false;
+// if (source instanceof AtomicComponentExtension) {
+// allowsPassByReference =
+// ((AtomicComponentExtension) source).isAllowsPassByReference();
+// }
+//
+// if (sourceWire.getSourceContract().isRemotable()
+// && !allowsPassByReference
+// && callbackOperations != null
+// && !callbackOperations.isEmpty()) {
+// //URI targetAddress = UriHelper.getBaseName(source.getUri());
+// Map<Operation<?>, InboundInvocationChain> callbackChains = sourceWire.getTargetCallbackInvocationChains();
+// for (Map.Entry<Operation<?>, InboundInvocationChain> entry : callbackChains.entrySet()) {
+// targetOperation = entry.getKey();
+// sourceOperation =
+// getSourceOperation(targetWire.getSourceCallbackInvocationChains(
+// sourceWire.getSourceUri()).keySet(),
+// targetOperation.getName());
+//
+// argsDataBindings = resolveArgsDataBindings(targetOperation);
+// resultDataBinding = resolveResultDataBinding(targetOperation);
+//
+// passByValueInterceptor = new PassByValueInterceptor();
+// passByValueInterceptor.setDataBinding(getDataBinding(targetOperation));
+// passByValueInterceptor.setArgsDataBindings(argsDataBindings);
+// passByValueInterceptor.setResultDataBinding(resultDataBinding);
+//
+// entry.getValue().addInterceptor(0, passByValueInterceptor);
+// tailInterceptor =
+// targetWire.getSourceCallbackInvocationChains(sourceWire.getSourceUri()).get(sourceOperation)
+// .getTailInterceptor();
+// if (tailInterceptor != null) {
+// tailInterceptor.setNext(passByValueInterceptor);
+// }
+// }
+// }
+// }
+
+// private Operation getSourceOperation(Set<Operation<?>> operations, String operationName) {
+// for (Operation<?> op : operations) {
+// if (op.getName().equals(operationName)) {
+// return op;
+// }
+// }
+// return null;
+// }
+//
+// private DataBinding getDataBinding(Operation<?> operation) {
+// String dataBinding = operation.getDataBinding();
+// if (dataBinding == null) {
+// ServiceContract<?> serviceContract = operation.getServiceContract();
+// dataBinding = serviceContract.getDataBinding();
+// }
+// return dataBindingRegistry.getDataBinding(dataBinding);
+//
+// }
+
+// @SuppressWarnings("unchecked")
+// private DataBinding[] resolveArgsDataBindings(Operation operation) {
+// List<DataType<?>> argumentTypes = (List<DataType<?>>) operation.getInputType().getLogical();
+// DataBinding[] argDataBindings = new DataBinding[argumentTypes.size()];
+// int count = 0;
+// for (DataType argType : argumentTypes) {
+// argDataBindings[count] = null;
+// if (argType != null) {
+// if (argType.getLogical() instanceof Class) {
+// argDataBindings[count] =
+// dataBindingRegistry.getDataBinding(((Class) argType.getLogical()).getName());
+// }
+// }
+// ++count;
+// }
+// return argDataBindings;
+// }
+//
+// private DataBinding resolveResultDataBinding(Operation operation) {
+// DataType<?> resultType = (DataType<?>) operation.getOutputType();
+// DataBinding resultBinding = null;
+// if (resultType != null && resultType.getLogical() instanceof Class) {
+// Class<?> logical = (Class<?>) resultType.getLogical();
+// resultBinding = dataBindingRegistry.getDataBinding(logical.getName());
+// }
+// return resultBinding;
+// }
+//
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java Sat Feb 17 00:35:19 2007
@@ -25,15 +25,11 @@
import org.apache.tuscany.spi.builder.BuilderException;
import org.apache.tuscany.spi.builder.BuilderRegistry;
import org.apache.tuscany.spi.builder.Connector;
-import org.apache.tuscany.spi.builder.WiringException;
import org.apache.tuscany.spi.component.Component;
import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.Reference;
import org.apache.tuscany.spi.component.SCAObject;
import org.apache.tuscany.spi.component.ScopeContainer;
import org.apache.tuscany.spi.component.ScopeContainerMonitor;
-import org.apache.tuscany.spi.component.Service;
-import org.apache.tuscany.spi.component.TargetInvokerCreationException;
import org.apache.tuscany.spi.deployer.Deployer;
import org.apache.tuscany.spi.deployer.DeploymentContext;
import org.apache.tuscany.spi.event.Event;
@@ -42,18 +38,10 @@
import org.apache.tuscany.spi.loader.LoaderException;
import org.apache.tuscany.spi.loader.LoaderRegistry;
import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.ComponentType;
-import org.apache.tuscany.spi.model.CompositeComponentType;
import org.apache.tuscany.spi.model.Implementation;
-import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.resolver.ResolutionException;
-import org.apache.tuscany.spi.wire.InboundInvocationChain;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.TargetInvoker;
import org.apache.tuscany.api.annotation.Monitor;
-import org.apache.tuscany.core.builder.WireCreationException;
-import org.apache.tuscany.core.component.ComponentManager;
import org.apache.tuscany.core.component.event.ComponentStop;
import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
import org.apache.tuscany.core.resolver.AutowireResolver;
@@ -69,20 +57,17 @@
private ScopeContainerMonitor monitor;
private Loader loader;
private AutowireResolver resolver;
- private ComponentManager componentManager;
private Connector connector;
public DeployerImpl(XMLInputFactory xmlFactory,
Loader loader,
Builder builder,
AutowireResolver resolver,
- ComponentManager manager,
Connector connector) {
this.xmlFactory = xmlFactory;
this.loader = loader;
this.builder = builder;
this.resolver = resolver;
- this.componentManager = manager;
this.connector = connector;
}
@@ -111,11 +96,6 @@
}
@Autowire
- public void setComponentManager(ComponentManager componentManager) {
- this.componentManager = componentManager;
- }
-
- @Autowire
public void setConnector(Connector connector) {
this.connector = connector;
}
@@ -143,7 +123,7 @@
}
};
component.addListener(listener);
- connect(component, componentDefinition);
+ connector.connect(componentDefinition);
return component;
}
@@ -173,48 +153,6 @@
DeploymentContext deploymentContext)
throws BuilderException {
return builder.build(parent, componentDefinition, deploymentContext);
- }
-
- /**
- * JFM TODO move to connector
- */
- private void connect(Component component, ComponentDefinition componentDefinition) throws WiringException {
- if (component instanceof CompositeComponent) {
- CompositeComponent composite = (CompositeComponent) component;
- for (Service service : composite.getServices()) {
- connector.connect(service);
- }
- for (Reference reference : composite.getReferences()) {
- connector.connect(reference);
- }
- }
- ComponentType<?, ?, ?> type = componentDefinition.getImplementation().getComponentType();
- if (type instanceof CompositeComponentType) {
- CompositeComponentType<?, ?, ?> compositeType = (CompositeComponentType<?, ?, ?>) type;
- for (ComponentDefinition<? extends Implementation<?>> definition : compositeType.getComponents().values()) {
- Component child = componentManager.getComponent(definition.getUri());
- assert child != null;
- connect(child, definition);
- }
- } else {
- connector.connect(component);
- // this will be refactored out, currently for atomic
- for (InboundWire inboundWire : component.getInboundWires()) {
- for (InboundInvocationChain chain : inboundWire.getInboundInvocationChains().values()) {
- Operation<?> operation = chain.getOperation();
- String serviceName = inboundWire.getSourceUri().getFragment();
- TargetInvoker invoker;
- try {
- invoker = component.createTargetInvoker(serviceName, operation, null);
- } catch (TargetInvokerCreationException e) {
- throw new WireCreationException("Error processing inbound wire", component.getUri(), e);
- }
- chain.setTargetInvoker(invoker);
- }
- }
-
- }
-
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java Sat Feb 17 00:35:19 2007
@@ -30,10 +30,21 @@
import org.osoa.sca.ComponentContext;
import org.osoa.sca.ServiceReference;
+import org.apache.tuscany.spi.CoreRuntimeException;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetInitializationException;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.extension.AtomicComponentExtension;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.wire.Wire;
+
+import org.apache.tuscany.core.component.ComponentContextImpl;
import org.apache.tuscany.core.component.ComponentContextProvider;
import org.apache.tuscany.core.component.ServiceReferenceImpl;
-import org.apache.tuscany.core.component.ComponentContextImpl;
import org.apache.tuscany.core.injection.ArrayMultiplicityObjectFactory;
+import org.apache.tuscany.core.injection.CallbackWireObjectFactory;
import org.apache.tuscany.core.injection.ConversationIDObjectFactory;
import org.apache.tuscany.core.injection.EventInvoker;
import org.apache.tuscany.core.injection.FieldInjector;
@@ -45,14 +56,6 @@
import org.apache.tuscany.core.injection.NoMultiplicityTypeException;
import org.apache.tuscany.core.injection.ObjectCallbackException;
import org.apache.tuscany.core.injection.PojoObjectFactory;
-import org.apache.tuscany.spi.ObjectCreationException;
-import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.component.TargetDestructionException;
-import org.apache.tuscany.spi.component.TargetInitializationException;
-import org.apache.tuscany.spi.component.TargetResolutionException;
-import org.apache.tuscany.spi.extension.AtomicComponentExtension;
-import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.wire.OutboundWire;
/**
* Base implementation of an {@link org.apache.tuscany.spi.component.AtomicComponent} whose type is a Java class
@@ -70,21 +73,22 @@
protected Map<String, Member> callbackSites;
protected List<Injector<Object>> injectors;
protected Class implementationClass;
+ protected Map<String, List<Wire>> wires = new HashMap<String, List<Wire>>();
+ protected Map<String, List<Wire>> callBackwires = new HashMap<String, List<Wire>>();
private final ComponentContext componentContext;
private final Map<String, ObjectFactory<?>> propertyFactories = new ConcurrentHashMap<String, ObjectFactory<?>>();
- private final Map<String, OutboundWire> referenceFactories = new ConcurrentHashMap<String, OutboundWire>();
private List<Class<?>> constructorParamTypes = new ArrayList<Class<?>>();
public PojoAtomicComponent(PojoConfiguration configuration) {
super(configuration.getName(),
- configuration.getWireService(),
- configuration.getWorkContext(),
- configuration.getScheduler(),
- configuration.getMonitor(),
- configuration.getInitLevel(),
- configuration.getMaxIdleTime(),
- configuration.getMaxAge());
+ configuration.getWireService(),
+ configuration.getWorkContext(),
+ configuration.getScheduler(),
+ configuration.getMonitor(),
+ configuration.getInitLevel(),
+ configuration.getMaxIdleTime(),
+ configuration.getMaxAge());
assert configuration.getInstanceFactory() != null : "Object factory was null";
initInvoker = configuration.getInitInvoker();
destroyInvoker = configuration.getDestroyInvoker();
@@ -98,14 +102,13 @@
: new HashMap<String, Member>();
resourceSites = configuration.getResourceSites() != null ? configuration.getResourceSites()
: new HashMap<String, Member>();
- callbackSites = configuration.getCallbackSite() != null ? configuration.getCallbackSite()
+ callbackSites = configuration.getCallbackSites() != null ? configuration.getCallbackSites()
: new HashMap<String, Member>();
implementationClass = configuration.getImplementationClass();
componentContext = new ComponentContextImpl(this);
}
-
public boolean isDestroyable() {
return destroyInvoker != null;
}
@@ -154,6 +157,102 @@
return instance;
}
+ public List<Wire> getWires(String name) {
+ return wires.get(name);
+ }
+
+ public void attachWire(Wire wire) {
+ assert wire.getSourceUri().getFragment() != null;
+ String referenceName = wire.getSourceUri().getFragment();
+ List<Wire> wireList = wires.get(referenceName);
+ if (wireList == null) {
+ wireList = new ArrayList<Wire>();
+ wires.put(referenceName, wireList);
+ }
+ wireList.add(wire);
+ Member member = referenceSites.get(referenceName);
+ if (member != null) {
+ injectors.add(createInjector(member, wire));
+ }
+ // cycle through constructor param names as well
+ for (int i = 0; i < constructorParamNames.size(); i++) {
+ if (referenceName.equals(constructorParamNames.get(i))) {
+ ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
+ initializerFactories[i] = createWireFactory(constructorParamTypes.get(i), wire);
+ break;
+ }
+ }
+ //TODO error if ref not set on constructor or ref site
+
+ }
+
+ public void attachWires(List<Wire> attachWires) {
+ assert attachWires.size() > 0;
+ assert attachWires.get(0).getSourceUri().getFragment() != null;
+ String referenceName = attachWires.get(0).getSourceUri().getFragment();
+ List<Wire> wireList = wires.get(referenceName);
+ if (wireList == null) {
+ wireList = new ArrayList<Wire>();
+ wires.put(referenceName, wireList);
+ }
+ wireList.addAll(attachWires);
+ Member member = referenceSites.get(referenceName);
+ if (member == null) {
+ if (constructorParamNames.contains(referenceName)) {
+ // injected on the constructor
+ throw new UnsupportedOperationException();
+ } else {
+ throw new NoAccessorException(referenceName);
+ }
+ }
+
+ Class<?> type = attachWires.get(0).getSourceContract().getInterfaceClass();
+ if (type == null) {
+ throw new NoMultiplicityTypeException("Java interface must be specified for multiplicity", referenceName);
+ }
+ injectors.add(createMultiplicityInjector(member, type, wireList));
+
+ }
+
+ public void attachCallbackWire(Wire wire) {
+ assert wire.getSourceUri().getFragment() != null;
+ String referenceName = wire.getCallbackReferenceName();
+ assert callbackSites.get(referenceName) != null;
+ List<Wire> wireList = callBackwires.get(referenceName);
+ if (wireList == null) {
+ wireList = new ArrayList<Wire>();
+ callBackwires.put(referenceName, wireList);
+ }
+ wireList.add(wire);
+ }
+
+ public void start() throws CoreRuntimeException {
+ if (!callbackSites.isEmpty()) {
+ for (Map.Entry<String, Member> entry : callbackSites.entrySet()) {
+ List<Wire> wires = callBackwires.get(entry.getKey());
+ if (wires == null) {
+ // this is a programming error
+ throw new AssertionError("Start called before wires were added");
+ }
+ Member member = entry.getValue();
+ if (member instanceof Field) {
+ Field field = (Field) member;
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(field.getType(), wireService, wires);
+ injectors.add(new FieldInjector<Object>(field, factory));
+ } else if (member instanceof Method) {
+ Method method = (Method) member;
+ Class<?> type = method.getParameterTypes()[0];
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(type, wireService, wires);
+ injectors.add(new MethodInjector<Object>(method, factory));
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method", member.getName());
+ }
+ }
+ }
+ super.start();
+
+ }
+
public void addPropertyFactory(String name, ObjectFactory<?> factory) {
Member member = propertySites.get(name);
if (member instanceof Field) {
@@ -203,44 +302,6 @@
}
}
- protected void onReferenceWire(OutboundWire wire) {
- String name = wire.getSourceUri().getFragment();
- Member member = referenceSites.get(name);
- if (member != null) {
- injectors.add(createInjector(member, wire));
- }
- // cycle through constructor param names as well
- for (int i = 0; i < constructorParamNames.size(); i++) {
- if (name.equals(constructorParamNames.get(i))) {
- ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
- initializerFactories[i] = createWireFactory(constructorParamTypes.get(i), wire);
- break;
- }
- }
-
- referenceFactories.put(name, wire);
- }
-
- public void onReferenceWires(List<OutboundWire> wires) {
- assert wires.size() > 0 : "Wires were empty";
- String referenceName = wires.get(0).getSourceUri().getFragment();
- Member member = referenceSites.get(referenceName);
- if (member == null) {
- if (constructorParamNames.contains(referenceName)) {
- // injected on the constructor
-
- } else {
- throw new NoAccessorException(referenceName);
- }
- }
- Class<?> type = wires.get(0).getServiceContract().getInterfaceClass();
- if (type == null) {
- throw new NoMultiplicityTypeException("Java interface must be specified for multiplicity", referenceName);
- }
- injectors.add(createMultiplicityInjector(member, type, wires));
- //TODO multiplicity for constructor injection
- }
-
public boolean implementsCallback(Class callbackClass) {
Class<?>[] implementedInterfaces = implementationClass.getInterfaces();
for (Class<?> implementedInterface : implementedInterfaces) {
@@ -252,7 +313,7 @@
return false;
}
- protected Injector<Object> createInjector(Member member, OutboundWire wire) {
+ protected Injector<Object> createInjector(Member member, Wire wire) {
if (member instanceof Field) {
Class<?> type = ((Field) member).getType();
ObjectFactory<?> factory = createWireFactory(type, wire);
@@ -268,9 +329,9 @@
protected Injector<Object> createMultiplicityInjector(Member member,
Class<?> interfaceType,
- List<OutboundWire> wireFactories) {
+ List<Wire> wireFactories) {
List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
- for (OutboundWire wire : wireFactories) {
+ for (Wire wire : wireFactories) {
factories.add(createWireFactory(interfaceType, wire));
}
if (member instanceof Field) {
@@ -292,9 +353,6 @@
}
}
- protected abstract <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, OutboundWire wire);
-
-
public ComponentContext getComponentContext() {
return componentContext;
}
@@ -310,20 +368,29 @@
}
public <B> B getService(Class<B> type, String name) {
- OutboundWire wire = referenceFactories.get(name);
- if (wire == null) {
+ List<Wire> referenceWires = wires.get(name);
+ if (referenceWires == null || referenceWires.size() < 1) {
return null;
+ } else {
+ // TODO support multiplicity
+ Wire wire = referenceWires.get(0);
+ ObjectFactory<B> factory = createWireFactory(type, wire);
+ return factory.getInstance();
}
- ObjectFactory<B> factory = createWireFactory(type, wire);
- return factory.getInstance();
}
public <B> ServiceReference<B> getServiceReference(Class<B> type, String name) {
- OutboundWire wire = referenceFactories.get(name);
- if (wire == null) {
+ List<Wire> referenceWires = wires.get(name);
+ if (referenceWires == null || referenceWires.size() < 1) {
return null;
+ } else {
+ // TODO support multiplicity
+ Wire wire = referenceWires.get(0);
+ ObjectFactory<B> factory = createWireFactory(type, wire);
+ return new ServiceReferenceImpl<B>(type, factory);
}
- ObjectFactory<B> factory = createWireFactory(type, wire);
- return new ServiceReferenceImpl<B>(type, factory);
}
+
+ protected abstract <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire);
+
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java Sat Feb 17 00:35:19 2007
@@ -175,7 +175,7 @@
resourceSites.put(name, member);
}
- public Map<String, Member> getCallbackSite() {
+ public Map<String, Member> getCallbackSites() {
return callbackSites;
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java Sat Feb 17 00:35:19 2007
@@ -29,7 +29,6 @@
import org.apache.tuscany.spi.event.Event;
import org.apache.tuscany.spi.extension.CompositeComponentExtension;
import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
import org.apache.tuscany.core.component.event.ComponentStart;
@@ -91,7 +90,7 @@
super.publish(event);
}
- public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation)
throws TargetInvokerCreationException {
return null;
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java Sat Feb 17 00:35:19 2007
@@ -19,10 +19,13 @@
package org.apache.tuscany.core.implementation.composite;
import java.net.URI;
+import java.util.List;
import java.util.Map;
import org.w3c.dom.Document;
+import org.apache.tuscany.spi.wire.Wire;
+
/**
* The standard implementation of a composite component. Autowiring is performed by delegating to the parent composite.
*
@@ -49,4 +52,19 @@
super(name, null);
}
+ public void attachWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachWires(List<Wire> wires) {
+ throw new UnsupportedOperationException();
+ }
+
+ public List<Wire> getWires(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void attachCallbackWire(Wire wire) {
+ throw new UnsupportedOperationException();
+ }
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ReferenceImpl.java Sat Feb 17 00:35:19 2007
@@ -51,7 +51,6 @@
}
public void addReferenceBinding(ReferenceBinding binding) {
- binding.setReference(this);
bindings.add(binding);
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ServiceImpl.java Sat Feb 17 00:35:19 2007
@@ -61,7 +61,6 @@
}
public void addServiceBinding(ServiceBinding binding) {
- binding.setService(this);
bindings.add(binding);
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/SystemSingletonAtomicComponent.java Sat Feb 17 00:35:19 2007
@@ -20,11 +20,7 @@
import java.net.URI;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.apache.tuscany.spi.ObjectCreationException;
import org.apache.tuscany.spi.component.AtomicComponent;
@@ -38,14 +34,10 @@
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.Scope;
import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireService;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
-import org.apache.tuscany.core.wire.jdk.JDKWireService;
/**
* An {@link org.apache.tuscany.spi.component.AtomicComponent} used when registering objects directly into a composite
@@ -55,21 +47,17 @@
public class SystemSingletonAtomicComponent<S, T extends S> extends AbstractComponentExtension
implements AtomicComponent {
private T instance;
- private Map<String, InboundWire> inboundWires;
- // JFM FIXME JDKWireService
- private WireService wireService = new JDKWireService();
- // JFM FIXME remove
+ // JFM FIXME remove and externalize service contract
private JavaInterfaceProcessorRegistry interfaceProcessorRegistry = new JavaInterfaceProcessorRegistryImpl();
private List<ServiceContract> serviceContracts = new ArrayList<ServiceContract>();
public SystemSingletonAtomicComponent(URI name, Class<S> interfaze, T instance) {
super(name);
this.instance = instance;
- inboundWires = new HashMap<String, InboundWire>();
try {
initWire(interfaze);
} catch (InvalidServiceContractException e) {
- // JFM FIXME
+ // JFM FIXME this will go away when we externalize ServiceContract
e.printStackTrace();
}
}
@@ -77,13 +65,12 @@
public SystemSingletonAtomicComponent(URI name, List<Class<?>> services, T instance) {
super(name);
this.instance = instance;
- inboundWires = new HashMap<String, InboundWire>();
for (Class<?> interfaze : services) {
try {
initWire(interfaze);
} catch (InvalidServiceContractException e) {
- // xcv ficme
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ // JFM FIXME this will go away when we externalize ServiceContract
+ e.printStackTrace();
}
}
}
@@ -132,41 +119,28 @@
throw new UnsupportedOperationException();
}
- public void addInboundWire(InboundWire wire) {
- inboundWires.put(wire.getSourceUri().getFragment(), wire);
+ public boolean isOptimizable() {
+ return true;
}
- public Collection<InboundWire> getInboundWires() {
- return Collections.unmodifiableCollection(inboundWires.values());
+ public void attachWire(Wire wire) {
+ throw new UnsupportedOperationException();
}
- public InboundWire getInboundWire(String serviceName) {
- return inboundWires.get(serviceName);
+ public void attachWires(List<Wire> wires) {
+ throw new UnsupportedOperationException();
}
- public InboundWire getTargetWire(String targetName) {
- return getInboundWire(targetName);
- }
-
- public void addOutboundWire(OutboundWire wire) {
+ public List<Wire> getWires(String name) {
throw new UnsupportedOperationException();
}
- public void addOutboundWires(List<OutboundWire> wires) {
+ public void attachCallbackWire(Wire wire) {
throw new UnsupportedOperationException();
}
- public Map<String, List<OutboundWire>> getOutboundWires() {
- return Collections.emptyMap();
- }
-
-
- public boolean isOptimizable() {
- return true;
- }
-
- public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
return null;
}
@@ -176,12 +150,6 @@
private void initWire(Class<?> interfaze) throws InvalidServiceContractException {
JavaServiceContract serviceContract = interfaceProcessorRegistry.introspect(interfaze);
- // create a relative URI
- URI uri = URI.create("#" + interfaze.getName());
- ServiceDefinition def = new ServiceDefinition(uri, serviceContract, false);
- InboundWire wire = wireService.createWire(def);
- wire.setComponent(this);
- inboundWires.put(wire.getSourceUri().getFragment(), wire);
serviceContracts.add(serviceContract);
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java Sat Feb 17 00:35:19 2007
@@ -18,26 +18,17 @@
*/
package org.apache.tuscany.core.implementation.java;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
import java.lang.reflect.Method;
import org.apache.tuscany.spi.ObjectFactory;
import static org.apache.tuscany.spi.idl.java.JavaIDLUtils.findMethod;
import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.core.wire.WireObjectFactory;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.core.implementation.PojoAtomicComponent;
import org.apache.tuscany.core.implementation.PojoConfiguration;
-import org.apache.tuscany.core.injection.CallbackWireObjectFactory;
-import org.apache.tuscany.core.injection.FieldInjector;
-import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.InvalidAccessorException;
-import org.apache.tuscany.core.injection.MethodInjector;
+import org.apache.tuscany.core.wire.WireObjectFactory;
/**
* The runtime instantiation of Java component implementations
@@ -50,7 +41,7 @@
super(configuration);
}
- public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
Method[] methods;
Class callbackClass = null;
if (operation.isCallback()) {
@@ -61,39 +52,10 @@
methods = implementationClass.getMethods();
}
Method method = findMethod(operation, methods);
- return new JavaTargetInvoker(method, this, callbackWire, callbackClass, workContext, monitor);
- }
-
- protected void onServiceWire(InboundWire wire) {
- String name = wire.getCallbackReferenceName();
- if (name == null) {
- // It's ok not to have one, we just do nothing
- return;
- }
- Member member = callbackSites.get(name);
- if (member != null) {
- injectors.add(createCallbackInjector(member, wire.getServiceContract(), wire));
- }
- }
-
- protected Injector<Object> createCallbackInjector(Member member,
- ServiceContract<?> contract,
- InboundWire inboundWire) {
- if (member instanceof Field) {
- Field field = (Field) member;
- ObjectFactory<?> factory = new CallbackWireObjectFactory(field.getType(), wireService, inboundWire);
- return new FieldInjector<Object>(field, factory);
- } else if (member instanceof Method) {
- Method method = (Method) member;
- Class<?> type = method.getParameterTypes()[0];
- ObjectFactory<?> factory = new CallbackWireObjectFactory(type, wireService, inboundWire);
- return new MethodInjector<Object>(method, factory);
- } else {
- throw new InvalidAccessorException("Member must be a field or method", member.getName());
- }
+ return new JavaTargetInvoker(method, this, callbackClass, workContext, monitor);
}
- protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, OutboundWire wire) {
+ protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) {
return new WireObjectFactory<B>(interfaze, wire, wireService);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaTargetInvoker.java Sat Feb 17 00:35:19 2007
@@ -31,7 +31,6 @@
import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.extension.TargetInvokerExtension;
import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.wire.InboundWire;
import static org.apache.tuscany.core.util.JavaIntrospectionHelper.findClosestMatchingMethod;
import static org.apache.tuscany.core.util.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
@@ -50,11 +49,10 @@
public JavaTargetInvoker(Method operation,
JavaAtomicComponent component,
- InboundWire wire,
Class callbackClass,
WorkContext context,
ExecutionMonitor monitor) {
- super(wire, context, monitor);
+ super(context, monitor);
assert operation != null : "Operation method cannot be null";
this.operation = operation;
this.component = component;
@@ -64,10 +62,9 @@
public JavaTargetInvoker(Method operation,
JavaAtomicComponent component,
- InboundWire callbackWire,
WorkContext context,
ExecutionMonitor monitor) {
- this(operation, component, callbackWire, null, context, monitor);
+ this(operation, component, null, context, monitor);
}
public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java Sat Feb 17 00:35:19 2007
@@ -21,9 +21,8 @@
import org.apache.tuscany.spi.ObjectFactory;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.Scope;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.core.implementation.PojoAtomicComponent;
import org.apache.tuscany.core.implementation.PojoConfiguration;
@@ -41,11 +40,11 @@
scope = Scope.COMPOSITE;
}
- public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire) {
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
return null;
}
- protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, OutboundWire wire) {
+ protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) {
return new OptimizedWireObjectFactory<B>(interfaze, wire);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java Sat Feb 17 00:35:19 2007
@@ -18,9 +18,11 @@
*/
package org.apache.tuscany.core.injection;
+import java.util.List;
+
import org.apache.tuscany.spi.ObjectCreationException;
import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Wire;
import org.apache.tuscany.spi.wire.WireService;
/**
@@ -29,19 +31,18 @@
* @version $Rev$ $Date$
*/
public class CallbackWireObjectFactory implements ObjectFactory {
-
private WireService wireService;
private Class<?> interfaze;
- private InboundWire wire;
+ private List<Wire> wires;
- public CallbackWireObjectFactory(Class<?> interfaze, WireService wireService, InboundWire wire) {
+ public CallbackWireObjectFactory(Class<?> interfaze, WireService wireService, List<Wire> wires) {
this.interfaze = interfaze;
this.wireService = wireService;
- this.wire = wire;
+ this.wires = wires;
}
public Object getInstance() throws ObjectCreationException {
- return wireService.createCallbackProxy(interfaze, wire);
+ return wireService.createCallbackProxy(interfaze, wires);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/loader/ServiceLoader.java Sat Feb 17 00:35:19 2007
@@ -20,6 +20,7 @@
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.List;
import javax.xml.namespace.QName;
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
@@ -69,8 +70,17 @@
String name = reader.getAttributeValue(null, "name");
URI targetUri = null;
ServiceDefinition def = new ServiceDefinition();
+ StringBuilder buf = new StringBuilder();
+ List<String> names = deploymentContext.getPathNames();
+ int len = names.size();
+ if (len > 0) {
+ for (int i = 0; i < len - 1; i++) {
+ buf.append(names.get(i)).append("/");
+ }
+ buf.append(names.get(len - 1));
+ }
try {
- def.setUri(new URI(parent.getUri().toString() + "#" + name));
+ def.setUri(new URI(buf + "#" + name));
} catch (URISyntaxException e) {
throw new IllegalSCDLNameException(e);
}
@@ -84,15 +94,11 @@
String target = text != null ? text.trim() : null;
QualifiedName qName = new QualifiedName(target);
try {
- StringBuilder buf = new StringBuilder();
- for (String path : deploymentContext.getPathNames()) {
- buf.append(path).append("/");
- }
if (qName.getPortName() == null) {
- targetUri = new URI(buf + target);
+ targetUri = new URI(buf + "/" + target);
} else {
targetUri =
- new URI(buf + qName.getPartName() + "#" + qName.getPortName());
+ new URI(buf + "/" + qName.getPartName() + "#" + qName.getPortName());
}
} catch (URISyntaxException e) {
throw new IllegalSCDLNameException(e);
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/policy/PolicyBuilderRegistryImpl.java Sat Feb 17 00:35:19 2007
@@ -21,19 +21,15 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.tuscany.spi.builder.BuilderException;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
-import org.apache.tuscany.spi.model.ServiceDefinition;
import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
import org.apache.tuscany.spi.policy.SourcePolicyBuilder;
import org.apache.tuscany.spi.policy.TargetPolicyBuilder;
-import org.apache.tuscany.spi.wire.InboundWire;
-import org.apache.tuscany.spi.wire.OutboundWire;
/**
* The default policy builder
*
* @version $Rev$ $Date$
+ * @deprecated
*/
public class PolicyBuilderRegistryImpl implements PolicyBuilderRegistry {
@@ -59,21 +55,5 @@
sourceBuilders.get(phase).add(builder);
}
-
- public void buildSource(ReferenceDefinition referenceDefinition, OutboundWire wire) throws BuilderException {
- for (List<SourcePolicyBuilder> builders : sourceBuilders) {
- for (SourcePolicyBuilder builder : builders) {
- builder.build(referenceDefinition, wire);
- }
- }
- }
-
- public void buildTarget(ServiceDefinition serviceDefinition, InboundWire wire) throws BuilderException {
- for (List<TargetPolicyBuilder> builders : targetBuilders) {
- for (TargetPolicyBuilder builder : builders) {
- builder.build(serviceDefinition, wire);
- }
- }
- }
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java Sat Feb 17 00:35:19 2007
@@ -28,28 +28,27 @@
import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
import org.apache.tuscany.spi.builder.BuilderException;
import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.AtomicComponent;
import org.apache.tuscany.spi.component.Component;
import org.apache.tuscany.spi.component.ComponentException;
-import org.apache.tuscany.spi.component.RegistrationException;
import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.RegistrationException;
import org.apache.tuscany.spi.component.TargetResolutionException;
import org.apache.tuscany.spi.deployer.Deployer;
import org.apache.tuscany.spi.loader.LoaderException;
import org.apache.tuscany.spi.model.ComponentDefinition;
-import org.apache.tuscany.spi.model.CompositeImplementation;
import org.apache.tuscany.spi.resolver.ResolutionException;
import org.apache.tuscany.spi.services.management.TuscanyManagementService;
import org.apache.tuscany.core.bootstrap.Bootstrapper;
import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
+import org.apache.tuscany.core.builder.ConnectorImpl;
import org.apache.tuscany.core.component.ComponentManager;
import org.apache.tuscany.core.component.ComponentManagerImpl;
import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
import org.apache.tuscany.core.monitor.NullMonitorFactory;
import org.apache.tuscany.core.resolver.AutowireResolver;
import org.apache.tuscany.core.resolver.DefaultAutowireResolver;
-import org.apache.tuscany.core.builder.ConnectorImpl;
import org.apache.tuscany.host.MonitorFactory;
import org.apache.tuscany.host.RuntimeInfo;
import org.apache.tuscany.host.management.ManagementService;
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/ContentTypeDescriberImpl.java Sat Feb 17 00:35:19 2007
@@ -25,14 +25,16 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.tuscany.core.util.FileHelper;
-import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
import org.osoa.sca.annotations.EagerInit;
import org.osoa.sca.annotations.Service;
+import org.apache.tuscany.spi.deployer.ContentTypeDescriber;
+
+import org.apache.tuscany.core.util.FileHelper;
+
/**
* Implementation of the content describer
- *
+ *
* @version $Rev$ $Date$
*/
@EagerInit
@@ -46,8 +48,7 @@
}
/**
- * Initialize contentType registry with know types based on known file
- * extensions
+ * Initialize contentType registry with know types based on known file extensions
*/
private void init() {
contentTypeRegistry.put("SCDL", "application/v.tuscany.scdl");
@@ -63,11 +64,10 @@
}
/**
- * Build contentType for a specific resource. We first check if the file is
- * a supported one (looking into our registry based on resource extension)
- * If not found, we try to check file contentType Or we return
+ * Build contentType for a specific resource. We first check if the file is a supported one (looking into our
+ * registry based on resource extension) If not found, we try to check file contentType Or we return
* defaultContentType provided
- *
+ *
* @param url
* @param defaultContentType
* @return
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java?view=diff&rev=508732&r1=508731&r2=508732
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/CallbackInterfaceInterceptor.java Sat Feb 17 00:35:19 2007
@@ -24,7 +24,7 @@
import org.apache.tuscany.spi.wire.Message;
/**
- * An interceptor applied to the outbound side of a wire that ensures the callback target implements the required
+ * An interceptor applied to the forward direction of a wire that ensures the callback target implements the required
* service contract. This is required as callback targets may be set dynamically by service implementations.
*
* @version $Rev$ $Date$
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org