diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-19 05:27:58 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-19 05:27:58 +0000 |
commit | 5f3869c451e46aadc943d00087d6847877dd1c50 (patch) | |
tree | e22baaff1fb9ea42606b7d04af52e032e3bc03bc /java/sca/modules/assembly/src | |
parent | 60744a36aae604ac3c4499ed54f1082ab8f5947d (diff) |
Merging the 1.x delta on top of the equinox based modules
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@718858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly/src')
5 files changed, 147 insertions, 3 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.java new file mode 100644 index 0000000000..5bcbdd40eb --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.assembly; + + +/** + * TODO RRB experiment. + * Represents a binding implemented using Requst/Response binding chains + * Used to test the RRB idea hence no integrated into the Binding interface, yet + * + * @version $Rev$ $Date$ + */ +public interface BindingRRB extends Binding { + + public WireFormat getRequestWireFormat(); + + public void setRequestWireFormat(WireFormat wireFormat); + + public WireFormat getResponseWireFormat(); + + public void setResponseWireFormat(WireFormat wireFormat); + + public OperationSelector getOperationSelector(); + + public void setOperationSelector(OperationSelector operationSelector); + +} diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java new file mode 100644 index 0000000000..6770e87ee1 --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.assembly; + + +/** + * Represents an operationSelector + * + * @version $Rev$ $Date$ + */ +public interface OperationSelector extends Base, Cloneable { + +} diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java new file mode 100644 index 0000000000..d8c530585e --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.assembly; + + +/** + * Represents a wireFormat. + * + * @version $Rev$ $Date$ + */ +public interface WireFormat extends Base, Cloneable { + +} diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java index b026eb0811..041a64d834 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java @@ -506,7 +506,8 @@ class BaseWireBuilderImpl { composite.getName().toString(), componentService.getName()); } } - } else if (componentReference.getReference() != null) { + } else if ((componentReference.getReference() != null) && + (!componentReference.getReference().getTargets().isEmpty())) { // Resolve targets from the corresponding reference in the // componentType @@ -568,7 +569,49 @@ class BaseWireBuilderImpl { composite.getName().toString(), componentService.getName()); } } - } + } else if (componentReference.getAutowire() == Boolean.TRUE) { + + // Find suitable targets in the current composite for an + // autowired reference + Multiplicity multiplicity = componentReference.getMultiplicity(); + for (Component targetComponent : composite.getComponents()) { + // prevent autowire connecting to self + boolean skipSelf = false; + for (ComponentReference targetComponentReference : targetComponent.getReferences()) { + if (componentReference == targetComponentReference){ + skipSelf = true; + } + } + + if (!skipSelf){ + for (ComponentService targetComponentService : targetComponent.getServices()) { + if (componentReference.getInterfaceContract() == null || + interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) { + + Endpoint endpoint = endpointFactory.createEndpoint(); + endpoint.setTargetName(targetComponent.getName()); + endpoint.setSourceComponent(null); // TODO - fixed up at start + endpoint.setSourceComponentReference(componentReference); + endpoint.setInterfaceContract(componentReference.getInterfaceContract()); + endpoint.setTargetComponent(targetComponent); + endpoint.setTargetComponentService(targetComponentService); + endpoint.getCandidateBindings().addAll(componentReference.getBindings()); + endpoints.add(endpoint); + + if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) { + break; + } + } + } + } + } + + if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) { + if (endpoints.size() == 0) { + warning("NoComponentReferenceTarget", componentReference, componentReference.getName()); + } + } + } // if no endpoints have found so far retrieve any target names that are in binding URIs diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java index a0ec95023a..9dd26b5e8e 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java @@ -148,6 +148,6 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon @Override public String toString(){ - return getName().toString(); + return ( this.name != null ) ? getName().toString() : "null"; } } |