From 5b1d5f1743a249a9c89f2ef18f1d57337af4cc1d Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 10 Sep 2009 10:06:25 +0000 Subject: Merge ConfiguredOperation Assembly methods from 1.x to 2.x git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@813344 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/assembly/AssemblyFactory.java | 7 ++ .../tuscany/sca/assembly/ConfiguredOperation.java | 61 ++++++++++++++ .../sca/assembly/OperationsConfigurator.java | 33 ++++++++ .../sca/assembly/impl/AssemblyFactoryImpl.java | 5 ++ .../sca/assembly/impl/ConfiguredOperationImpl.java | 95 ++++++++++++++++++++++ 5 files changed, 201 insertions(+) create mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java create mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java create mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java index 6f1aaffc32..88a4224422 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java @@ -163,4 +163,11 @@ public interface AssemblyFactory { * @return a new endpoint reference */ EndpointReference createEndpointReference(); + + /** + * Create a new configured operation. + * + * @return a new ConfiguredOperation + */ + ConfiguredOperation createConfiguredOperation(); } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java new file mode 100644 index 0000000000..9c8f6db912 --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.assembly; + +import org.apache.tuscany.sca.policy.PolicySubject; + +/** + * Represents an Operation. Typically Operation elements are used when there is a + * need to apply certain facets such as intents and policysets only to a specific + * operation provided by a service or reference. + * + * @version $Rev$ $Date$ + */ +public interface ConfiguredOperation extends Base, PolicySubject { + /** + * Returns the name of the operation. + * + * @return the name of the operation + */ + String getName(); + + /** + * Sets the name of the operation. + * + * @param name the name of the operation + */ + void setName(String name); + + /** + * Returns the name of the service or reference to which this operation belongs. + * This method is particularly useful when operation elements are specified under implementation + * elements and it is necessary to identify which of the various services provided by the + * implementation is referred to by the operation element in question + * + * @return the name of the contract to which this operation belongs + */ + String getContractName(); + + /** + * Sets the name of the service or reference to which this operation belongs. + * + * @param contractName the name of the contract to which this operation belongs + */ + void setContractName(String contractName); +} diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java new file mode 100644 index 0000000000..947fcd4c7c --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java @@ -0,0 +1,33 @@ +/* + * 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; + +import java.util.List; + +/** + * Interface to be implemented by SCA artifacts that support configuration of 'operation' child + * elements for policies etc. + * + * @version $Rev$ $Date$ + */ + +public interface OperationsConfigurator { + List getConfiguredOperations(); +} diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java index 421be55db3..9774bb8e93 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java @@ -32,6 +32,7 @@ import org.apache.tuscany.sca.assembly.ComponentType; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeReference; import org.apache.tuscany.sca.assembly.CompositeService; +import org.apache.tuscany.sca.assembly.ConfiguredOperation; import org.apache.tuscany.sca.assembly.ConstrainingType; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; @@ -135,4 +136,8 @@ public abstract class AssemblyFactoryImpl implements AssemblyFactory { public EndpointReference createEndpointReference() { return new EndpointReferenceImpl(registry); } + + public ConfiguredOperation createConfiguredOperation() { + return new ConfiguredOperationImpl(); + } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java new file mode 100644 index 0000000000..32377faf54 --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java @@ -0,0 +1,95 @@ +/* + * 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.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.sca.assembly.ConfiguredOperation; +import org.apache.tuscany.sca.policy.ExtensionType; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.PolicySet; + +/** + * Represents an Operation. + * + * @version $Rev$ $Date$ + */ +public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOperation { + private List policySets = new ArrayList(); + private List requiredIntents = new ArrayList(); + private List applicablePolicySets = new ArrayList(); + + private String name; + private String contractName; + private ExtensionType type; + + /** + * Constructs a new Operation. + */ + protected ConfiguredOperationImpl() { + } + + public List getPolicySets() { + return policySets; + } + + public void setPolicySets(List policySets) { + this.policySets = policySets; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getRequiredIntents() { + return requiredIntents; + } + + public void setRequiredIntents(List intents) { + this.requiredIntents = intents; + } + + public String getContractName() { + return contractName; + } + + public void setContractName(String contractName) { + this.contractName = contractName; + } + + public List getApplicablePolicySets() { + return applicablePolicySets; + } + + public ExtensionType getExtensionType() { + return type; + } + + public void setExtensionType(ExtensionType type) { + this.type = type; + } + + +} -- cgit v1.2.3