From 65c28a20f12ba4051353ae40558164cd75701026 Mon Sep 17 00:00:00 2001 From: bdaniel Date: Mon, 26 Jul 2010 04:20:17 +0000 Subject: TUSCANY-3630 Add externalAttachment model git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@979149 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/definitions/Definitions.java | 8 ++ .../sca/definitions/impl/DefinitionsImpl.java | 6 ++ .../sca/definitions/util/DefinitionsUtil.java | 2 + .../tuscany/sca/policy/ExternalAttachment.java | 85 ++++++++++++++++++++++ .../apache/tuscany/sca/policy/PolicyFactory.java | 5 ++ .../sca/policy/impl/ExternalAttachmentImpl.java | 76 +++++++++++++++++++ .../tuscany/sca/policy/impl/PolicyFactoryImpl.java | 6 ++ 7 files changed, 188 insertions(+) create mode 100644 sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/ExternalAttachment.java create mode 100644 sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/ExternalAttachmentImpl.java (limited to 'sca-java-2.x/trunk/modules/assembly/src/main') diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java index 7a63bbedc5..9ae5e6f26f 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/Definitions.java @@ -26,6 +26,8 @@ import org.apache.tuscany.sca.policy.ImplementationType; import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.ExternalAttachment; + /** * Represents SCA Definitions. @@ -81,4 +83,10 @@ public interface Definitions { * @return a list of domain wide binding definition objects */ List getBindings(); + + /** + * Returns a list of external attachments + * @return + */ + List getExternalAttachments(); } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java index 224bc0a69a..e58261cda2 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/impl/DefinitionsImpl.java @@ -25,6 +25,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.definitions.Definitions; import org.apache.tuscany.sca.policy.BindingType; +import org.apache.tuscany.sca.policy.ExternalAttachment; import org.apache.tuscany.sca.policy.ImplementationType; import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicySet; @@ -41,6 +42,7 @@ public class DefinitionsImpl implements Definitions { private List bindingTypes = new CopyOnWriteArrayList(); private List implementationTypes = new CopyOnWriteArrayList(); private List bindings = new CopyOnWriteArrayList(); + private List externalAttachments = new CopyOnWriteArrayList(); public List getBindingTypes() { @@ -70,4 +72,8 @@ public class DefinitionsImpl implements Definitions { public List getBindings() { return bindings; } + + public List getExternalAttachments() { + return externalAttachments ; + } } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/util/DefinitionsUtil.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/util/DefinitionsUtil.java index eb74677236..452c3bf883 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/util/DefinitionsUtil.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/definitions/util/DefinitionsUtil.java @@ -103,6 +103,8 @@ public class DefinitionsUtil { } target.getBindings().addAll(source.getBindings()); + + target.getExternalAttachments().addAll(source.getExternalAttachments()); } } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/ExternalAttachment.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/ExternalAttachment.java new file mode 100644 index 0000000000..5bccf51b91 --- /dev/null +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/ExternalAttachment.java @@ -0,0 +1,85 @@ +/* + * 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.policy; + +import java.util.List; + +import javax.xml.xpath.XPathExpression; + +/* + * Represents an external attachment element. See the Policy Framework specification for a + * description of this element. + * + * @version $Rev: 937291 $ $Date: 2010-04-23 06:41:24 -0700 (Fri, 23 Apr 2010) $ + * @tuscany.spi.extension.asclient + */ + + +public interface ExternalAttachment { + + /** + * Get the attachTo attribute + * @return + */ + String getAttachTo(); + + /** + * Set the attachTo attribute + * @param name + */ + void setAttachTo(String name); + + /** + * Get the compiled XPath attachTo expression + * @return + */ + XPathExpression getAttachToXPathExpression(); + + /** + * Set the compiled XPath attachTo expression + * @param expression + */ + void setAttachToXPathExpression(XPathExpression expression); + + /** + * Get the policy sets associated with this ExternalAttachment + * @return + */ + List getPolicySets(); + + /** + * Get the intents associated with this ExternalAttachment + * @return + */ + List getIntents(); + + /** + * Returns true if the model element is unresolved. + * + * @return true if the model element is unresolved. + */ + boolean isUnresolved(); + + /** + * Sets whether the model element is unresolved. + * + * @param unresolved whether the model element is unresolved + */ + void setUnresolved(boolean unresolved); +} diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java index b2ac5ca409..b23060dafb 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java @@ -64,4 +64,9 @@ public interface PolicyFactory { BindingType createBindingType(); ImplementationType createImplementationType(); + /** + * Create a new ExternalAttachment + * @return + */ + ExternalAttachment createExternalAttachment(); } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/ExternalAttachmentImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/ExternalAttachmentImpl.java new file mode 100644 index 0000000000..1e90e26324 --- /dev/null +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/ExternalAttachmentImpl.java @@ -0,0 +1,76 @@ +/* + * 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.policy.impl; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.xpath.XPathExpression; + +import org.apache.tuscany.sca.policy.ExternalAttachment; + +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.PolicySet; + +/** + * An implementation of ExternalAttachment + * + */ +public class ExternalAttachmentImpl implements ExternalAttachment { + + private String attachTo; + private List intents = new ArrayList(); + private List policySets = new ArrayList(); + private XPathExpression xpath; + private boolean isUnresolved; + + + public String getAttachTo() { + return attachTo; + } + + public void setAttachTo(String attachTo) { + this.attachTo = attachTo; + } + + public List getPolicySets() { + return this.policySets; + } + + public List getIntents() { + return this.intents; + } + + public XPathExpression getAttachToXPathExpression() { + return this.xpath; + } + + public void setAttachToXPathExpression(XPathExpression expression) { + this.xpath = expression; + } + + public boolean isUnresolved() { + return this.isUnresolved; + } + + public void setUnresolved(boolean unresolved) { + this.isUnresolved = unresolved; + } + +} diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java index c67ff1eab8..f700f7c41a 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java @@ -28,6 +28,8 @@ import org.apache.tuscany.sca.policy.PolicyFactory; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.Qualifier; +import org.apache.tuscany.sca.policy.ExternalAttachment; + /** * A factory for the policy model. * @@ -66,5 +68,9 @@ public abstract class PolicyFactoryImpl implements PolicyFactory { public ExtensionType createExtensionType() { return new ExtensionTypeImpl(); } + + public ExternalAttachment createExternalAttachment() { + return new ExternalAttachmentImpl(); + } } -- cgit v1.2.3