tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r746356 [8/8] - in /tuscany/java/sca/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xm...
Date Fri, 20 Feb 2009 20:10:44 GMT
Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ExtensionType.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ExtensionType.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ExtensionType.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ExtensionType.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,81 @@
+/*
+ * 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.namespace.QName;
+
+/**
+ * Definition of extension type: binding or implementation
+ */
+public interface ExtensionType {
+    QName BINDING_BASE = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200712", "binding");
+    QName IMPLEMENTATION_BASE = new QName("http://docs.oasis-open.org/ns/opencsa/sca/200712", "implementation");
+
+    /**
+     * The name of the extension type (binding or implementation). The extension type name 
+     * attribute MUST be the QName of an XSD global element definition used for 
+     * binding/implementation elements of that type
+     * 
+     * @return The QName of this type
+     */
+    QName getType();
+
+    /**
+     * Set the QName for this type
+     * @param type The QName of this type
+     */
+    void setType(QName type);
+    
+    QName getBaseType();
+
+    /**
+     * A set of intents. The intents in the alwaysProvides set are always 
+     * provided by this extension type, whether the intents are attached 
+     * to the using component or not.
+     * 
+     * @return A list of intents that are always provided by this type
+     */
+    List<Intent> getAlwaysProvidedIntents();
+
+    /**
+     * a set of intents. The intents in the mayProvide set are provided by this 
+     * extension type if the intent in question is attached to the using 
+     * component.
+     * 
+     * @return A list of intents that may be provided by this type
+     */
+    List<Intent> getMayProvidedIntents();
+    /**
+     * 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);
+    
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ExtensionType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ExtensionType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ImplementationType.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ImplementationType.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ImplementationType.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ImplementationType.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+
+/**
+ * Definition of an implementation type which extends from sca:implementation
+ */
+public interface ImplementationType extends ExtensionType {
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ImplementationType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ImplementationType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java Fri Feb 20 20:10:37 2009
@@ -29,6 +29,9 @@
  * @version $Rev$ $Date$
  */
 public interface Intent {
+    enum Type {
+        interaction, implementation
+    };
 
     /**
      * Returns the intent name.
@@ -45,45 +48,72 @@
     void setName(QName name);
 
     /**
-     * Get the intent domain (the root intent name before any qualifiers)
-     * @return the domain
+     * Returns the list of SCA constructs that this intent is meant to
+     * configure.
+     * 
+     * @return the list of SCA constructs that this intent is meant to configure
      */
-    String getDomain();
+    List<ExtensionType> getConstrainedTypes();
 
     /**
-     * Get the intent qualifiers
-     * @return the domain
+     * Return a list of required intents
+     * @return The list of required intents
      */
-    String[] getQualifiedNames();
+    List<Intent> getRequiredIntents();
 
     /**
-     * Returns the list of operations that this intent applies to.
+     * Returns the list of intents which are mutually exclusive with this intent.
      * 
-     * @return
+     * @return the list of mutually exclusive intents.
      */
-    //List<Operation> getOperations();
+    List<Intent> getExcludedIntents();
 
     /**
-     * Returns the list of SCA constructs that this intent is meant to
-     * configure.
+     * Returns the list of qualified intents.  
      * 
-     * @return the list of SCA constructs that this intent is meant to configure
+     * @return the list of qualified intents.
      */
-    List<QName> getConstrains();
+    List<Intent> getQualifiedIntents();
 
     /**
-     * Returns the list of intents which are mutually exclusive with this intent.
+     * Get the default qualified intent
      * 
-     * @return the list of mutually exclusive intents.
+     * @return
      */
-    List<Intent> getExcludedIntents();
+    Intent getDefaultQualifiedIntent();
 
     /**
-     * Returns the list of children qualified intents.
+     * Set the default qualified intent
      * 
-     * @return the list of children qualified intents.
+     * @param qualifiedIntent
      */
-    List<Intent> getQualifiedIntents();
+    void setDefaultQualifiedIntent(Intent qualifiedIntent);
+
+    /**
+     * Get the intent type: Interaction or Implementation
+     * @return 
+     */
+    Type getType();
+
+    /**
+     * Set the intent type 
+     * @param type: Interaction or Implementation
+     */
+    void setType(Type type);
+
+    /**
+     * If this attribute is present and has a value of true it indicates that 
+     * the qualified intents defined for this intent are mutually exclusive
+     * 
+     * @return
+     */
+    boolean isMutuallyExclusive();
+
+    /**
+     * Set the value of mutuallyExclusive  
+     * @param mutuallyExclusive
+     */
+    void setMutuallyExclusive(boolean mutuallyExclusive);
 
     /**
      * Returns the intent description.
@@ -104,6 +134,20 @@
      * 
      * @return true if the model element is unresolved.
      */
+
+    /**
+     * Get the parent intent for a qualified intent. If an intent is not qualified,
+     * return null.
+     * @return The parent intent or null if this intent is not qualified
+     */
+    Intent getParent();
+
+    /**
+     * Set the parent intent for a qualified intent
+     * @param intent
+     */
+    void setParent(Intent intent);
+
     boolean isUnresolved();
 
     /**

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java Fri Feb 20 20:10:37 2009
@@ -16,18 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
+
 package org.apache.tuscany.sca.policy;
 
 import java.util.List;
 
+import org.apache.tuscany.sca.policy.Intent;
+
+
 /**
- * Represents a policy intent map. See the Policy Framework specification for a
- * description of this element.
- *
- * @version $Rev$ $Date$
+ * Map policies to the qualified intents
  */
 public interface IntentMap {
-
     /**
      * Returns the intent realized by this intent map.
      * 
@@ -41,49 +41,11 @@
      * @param providedIntent the intent realized by this intent map
      */
     void setProvidedIntent(Intent providedIntent);
-
-    /**
-     * Returns the default qualified intent map.
-     * 
-     * @return the default qualified intent map
-     */
-    IntentMap getDefaultQualifiedIntentMap();
-
-    /**
-     * Sets the default qualified intent map.
-     * 
-     * @param defaultQualifiedIntentMap the default qualified intent map
-     */
-    void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap);
-
+    
     /**
-     * Returns the list of children qualified intent maps.
+     * Get a list of qualifiers  
      * 
-     * @return
+     * @return A list of qualifiers
      */
-    List<IntentMap> getQualifiedIntentMaps();
-
-    /**
-     * Returns the list of concrete policies, either WS-Policy policy
-     * attachments, policy references, or policies expressed in another policy
-     * language.
-     * 
-     * @return the list of concrete policies
-     */
-    List<Object> getPolicies();
-
-    /**
-     * 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);
-
+    List<Qualifier> getQualifiers();
 }

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyAttachment.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyAttachment.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyAttachment.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyAttachment.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * Attach a policySet to a collection of policy subjects
+ */
+public interface PolicyAttachment {
+    PolicySet getPolicySet();
+    void setPolicySet(PolicySet policySet);
+    List<PolicySubject> getPolicySubjects();
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyAttachment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyAttachment.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyExpression.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyExpression.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyExpression.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyExpression.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,65 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+/**
+ * Interface that will abstract various types of policy specifications
+ * and attachments for example WS-Policy
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PolicyExpression {
+    /**
+     * Get the QName of the policy expression
+     * @return the QName of the policy expression
+     */
+    QName getName();
+
+    /**
+     * Set the QName of the policy expression
+     * @param name
+     */
+    void setName(QName name);
+
+    /**
+     * Get the policy definition in the type of the specific domain
+     * @return
+     */
+    <T> T getPolicy();
+
+    /**
+     * Set the policy definition
+     * @param expression
+     */
+    <T> void setPolicy(T policy);
+
+    /**
+     * 
+     * @param unresolved
+     */
+    void setUnresolved(boolean unresolved);
+
+    /**
+     * 
+     * @return
+     */
+    boolean isUnresolved();
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyExpression.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyExpression.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java Fri Feb 20 20:10:37 2009
@@ -47,23 +47,20 @@
     IntentMap createIntentMap();
 
     /**
-     * create a new Profile Intent
+     * create a new Qualifier
      * 
-     * @return a ProfileIntent instance
+     * @return a Qualifier
      */
-    ProfileIntent createProfileIntent();
+    Qualifier createQualifier();
     
     /**
-     * create a new QualifiedIntent
-     * 
-     * @return a QualifiedIntent instance
+     * Create a new PolicyExpression
+     * @return
      */
-    QualifiedIntent createQualifiedIntent();
+    PolicyExpression createPolicyExpression();
     
-    /**
-     * create a new PolicySetReference
-     * 
-     * @return a PolicySetReference instance
-     */
-    PolicySetReference createPolicySetReference();
+    ExtensionType createExtensionType();
+    BindingType createBindingType();
+    ImplementationType createImplementationType();
+
 }

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyResolver.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyResolver.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyResolver.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyResolver.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+/**
+ * 
+ */
+public interface PolicyResolver {
+    /**
+     * Attach a policySet to a given policy subject
+     * @param policySet
+     * @param policySubject
+     * @return
+     */
+    PolicyAttachment attach(PolicySet policySet, PolicySubject policySubject);
+
+    /**
+     * Apply the policySet against the SCA domain composite to 
+     * @param policySet
+     * @param domainComposite
+     * @return
+     */
+    List<PolicyAttachment> apply(PolicySet policySet, PolicySubject domainComposite);
+
+    /**
+     * Calculate a list of effective policies for a given policy subject
+     * @param policySubject
+     * @return
+     */
+    List<PolicyExpression> getEffectivePolicies(PolicySubject policySubject);
+    
+    boolean isIntentProvidedBy(PolicySet policySet, Intent intent);
+    List<PolicyExpression> getPolicies(Intent intent);
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java Fri Feb 20 20:10:37 2009
@@ -19,7 +19,6 @@
 package org.apache.tuscany.sca.policy;
 
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.xpath.XPathExpression;
@@ -47,12 +46,6 @@
     void setName(QName name);
 
     /**
-     * Returns the list of operations that this policy set applies to.
-     * 
-     * @return
-     */
-    //List<Operation> getOperations();
-    /**
      * Returns the list of
      * 
      * @return
@@ -73,7 +66,7 @@
      * 
      * @return the list of concrete policies
      */
-    List<Object> getPolicies();
+    List<PolicyExpression> getPolicies();
 
     /**
      * Returns true if the model element is unresolved.
@@ -91,7 +84,7 @@
 
     /**
      * Returns the XPath expression that is to be used to evaluate
-     * if this PolicySet applies to specific attachment point
+     * if this PolicySet applies to specific policy subject
      * 
      * @return the XPath expression
      */
@@ -99,35 +92,45 @@
 
     /**
      * Sets the XPath expression that is to be used to evaluate
-     * if this PolicySet applies to specific attachment point
+     * if this PolicySet applies to specific policy subject
      * 
      */
     void setAppliesTo(String xpath);
-
+    
     /**
-     * Returns the policies / policy attachments provided thro intent maps
+     * A string which is an XPath 1.0 expression identifying one or more
+     * elements (policy subject) in the Domain. It is used to declare which 
+     * set of elements the policySet is actually attached to.
      * 
+     * @return The attachTo XPath
+     */
+    String getAttachTo();
+    
+    /**
+     * Set the attachTo XPath
+     * @param xpath
+     */
+    void setAttachTo(String xpath);
+    
+    /**
+     * Get the resolved XPathExpression for attachTo
      * @return
      */
-    Map<Intent, List<Object>> getMappedPolicies();
-
+    XPathExpression getAttachToXPathExpression();
+    
     /**
-     * Gets the XPath expression that is to be used to evaluate
-     * the SCA Artifacts that this policyset will always apply to
-     * immaterial of an intent declared on the SCA Artifact
-     * 
-     * @return the XPath expression
+     * Set the resolved XPathExpression for attachTo
+     * @param expression
      */
-    String getAlwaysAppliesTo();
+    void setAttachToXPathExpression(XPathExpression expression);
 
     /**
-     * Sets the XPath expression that is to be used to evaluate
-     * the SCA Artifacts that this policyset will always apply to
-     * immaterial of an intent declared on the SCA Artifact
+     * Returns the policies / policy attachments provided thro intent maps
      * 
+     * @return
      */
-    void setAlwaysAppliesTo(String xpath);
-
+    List<IntentMap> getIntentMaps();
+    
     /**
      * Get the XPath expression for the appliesTo attribute
      * @return the XPath expression for the appliesTo attribute
@@ -140,16 +143,4 @@
      */
     void setAppliesToXPathExpression(XPathExpression xpathExpression);
 
-    /**
-     * Get the XPath expression for the alwaysAppliesTo attribute
-     * @return the XPath expression for the alwaysAppliesTo attribute
-     */
-    XPathExpression getAlwaysAppliesToXPathExpression();
-
-    /**
-     * Set the XPath expression for the alwaysAppliesTo attribute
-     * @param xpathExpression the XPath expression for the alwaysAppliesTo attribute
-     */
-    void setAlwaysAppliesToXPathExpression(XPathExpression xpathExpression);
-
 }

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySubject.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySubject.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySubject.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySubject.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+/**
+ * A policy subject is an entity in the assembly with which a policy can be 
+ * associated. 
+ * 
+ * For example, a policy subject can be one of the following:
+ * <ul>
+ * <li>composite
+ * <li>component
+ * <li>implementation
+ * <li>service
+ * <li>reference
+ * <li>binding
+ * <li>interface
+ * </ul> 
+ */
+public interface PolicySubject {
+    /**
+     * Get a list of required intents
+     * 
+     * @return
+     */
+    List<Intent> getRequiredIntents();
+
+    /**
+     * Get a list of attached policySets 
+     * 
+     * @return A list of policySets 
+     */
+    List<PolicySet> getPolicySets();
+    
+    ExtensionType getType();
+    void setType(ExtensionType type);
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySubject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySubject.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Qualifier.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Qualifier.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Qualifier.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Qualifier.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+/**
+ * A qualifier provides a list of policies for a qualified intent within the IntentMap
+ */
+public interface Qualifier {
+    /**
+     * Get the qualified intent for this qualifier
+     * @return The intent
+     */
+    Intent getIntent();
+
+    /**
+     * Set the qualified intent for this qualifier
+     */
+    void setIntent(Intent intent);
+
+    /**
+     * Get the list of policies provided by this qualifier
+     * @return A list of policies
+     */
+    List<PolicyExpression> getPolicies();
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Qualifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Qualifier.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java Fri Feb 20 20:10:37 2009
@@ -18,73 +18,21 @@
  */
 package org.apache.tuscany.sca.policy.impl;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.BindingType;
 
 /**
  * Concrete implementation for a BindingType
  *
  * @version $Rev$ $Date$
  */
-public class BindingTypeImpl implements IntentAttachPointType {
-
-    private List<Intent> alwaysProvides = new ArrayList<Intent>();
-    private List<Intent> mayProvides = new ArrayList<Intent>();
-    private QName typeName;
-    private boolean unResolved = true;
-    
-    public List<Intent> getAlwaysProvidedIntents() {
-        return alwaysProvides;
-    }
-
-    public List<Intent> getMayProvideIntents() {
-        return mayProvides;
-    }
-
-    public QName getName() {
-        return typeName;
+public class BindingTypeImpl extends ExtensionTypeImpl implements BindingType {
+    protected BindingTypeImpl() {
+        super();
     }
 
-    public void setName(QName type) {
-        this.typeName = type;
-    }
-    
-    public boolean isUnresolved() {
-        return unResolved;
-    }
-
-    public void setUnresolved(boolean unresolved) {
-        this.unResolved = unresolved;
-    }
-    
-    @Override
-    public int hashCode() {
-        return String.valueOf(getName()).hashCode();
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        } else if (obj instanceof BindingTypeImpl ) {
-            if (getName() != null) {
-                return getName().equals(((BindingTypeImpl)obj).getName());
-            } else {
-                return ((BindingTypeImpl)obj).getName() == null;
-            }
-        } else {
-            return false;
-        }
-    }
-    
-    @Override
-    public String toString() {
-    	return ( this.typeName != null ) ? getName().toString() : "null";
+    public QName getBaseType() {
+        return BINDING_BASE;
     }
 }
-;
\ No newline at end of file

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ExtensionTypeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ExtensionTypeImpl.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ExtensionTypeImpl.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ExtensionTypeImpl.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,97 @@
+/*
+ * 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.namespace.QName;
+
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * Concrete implementation for a BindingType
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensionTypeImpl implements ExtensionType {
+
+    private List<Intent> alwaysProvides = new ArrayList<Intent>();
+    private List<Intent> mayProvide = new ArrayList<Intent>();
+    private QName typeName;
+    private boolean unResolved = true;
+
+    protected ExtensionTypeImpl() {
+
+    }
+
+    public List<Intent> getAlwaysProvidedIntents() {
+        return alwaysProvides;
+    }
+
+    public List<Intent> getMayProvidedIntents() {
+        return mayProvide;
+    }
+
+    public QName getType() {
+        return typeName;
+    }
+
+    public void setType(QName type) {
+        this.typeName = type;
+    }
+
+    public boolean isUnresolved() {
+        return unResolved;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        this.unResolved = unresolved;
+    }
+
+    @Override
+    public int hashCode() {
+        return String.valueOf(getType()).hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        } else if (obj instanceof ExtensionTypeImpl) {
+            if (getType() != null) {
+                return getType().equals(((ExtensionTypeImpl)obj).getType());
+            } else {
+                return ((ExtensionTypeImpl)obj).getType() == null;
+            }
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return (this.typeName != null) ? getType().toString() : "null";
+    }
+
+    public QName getBaseType() {
+        return null;
+    }
+};

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ExtensionTypeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ExtensionTypeImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java Fri Feb 20 20:10:37 2009
@@ -18,71 +18,22 @@
  */
 package org.apache.tuscany.sca.policy.impl;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.xml.namespace.QName;
 
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.ImplementationType;
 
 /**
  * Concrete implementation for a Implementation Type
  *
  * @version $Rev$ $Date$
  */
-public class ImplementationTypeImpl implements IntentAttachPointType {
-    private List<Intent> alwaysProvides = new ArrayList<Intent>();
-    private List<Intent> mayProvides = new ArrayList<Intent>();
-    private QName typeName;
-    private boolean unResolved = true;
-    
-    public List<Intent> getAlwaysProvidedIntents() {
-        return alwaysProvides;
-    }
-
-    public List<Intent> getMayProvideIntents() {
-        return mayProvides;
-    }
-
-    public QName getName() {
-        return typeName;
+public class ImplementationTypeImpl extends ExtensionTypeImpl implements ImplementationType {
+    protected ImplementationTypeImpl() {
+        super();
     }
 
-    public void setName(QName type) {
-        this.typeName = type;
-    }
-    
-    public boolean isUnresolved() {
-        return unResolved;
+    public QName getBaseType() {
+        return IMPLEMENTATION_BASE;
     }
 
-    public void setUnresolved(boolean unresolved) {
-        this.unResolved = unresolved;
-    }
-    
-    @Override
-    public int hashCode() {
-        return String.valueOf(getName()).hashCode();
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        } else if (obj instanceof ImplementationTypeImpl ) {
-            if (getName() != null) {
-                return getName().equals(((ImplementationTypeImpl)obj).getName());
-            } else {
-                return ((ImplementationTypeImpl)obj).getName() == null;
-            }
-        } else {
-            return false;
-        }
-    }
-    
-    @Override
-    public String toString() {
-    	return ( this.typeName != null ) ? getName().toString() : "null";
-    }
 }

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java Fri Feb 20 20:10:37 2009
@@ -23,6 +23,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.policy.ExtensionType;
 import org.apache.tuscany.sca.policy.Intent;
 
 /**
@@ -32,18 +33,17 @@
  */
 public class IntentImpl implements Intent {
 
-    private static final String QUALIFIED_SEPARATOR = ".";
-    private static final String DOMAIN_SEPARATOR = ".";
     private QName name;
-    //private List<Operation> operations = new ArrayList<Operation>();
-    private List<QName> constrains = new ArrayList<QName>();
+    private Type type;
+    private List<ExtensionType> constrainedTypes = new ArrayList<ExtensionType>();
     private String description;
     private List<Intent> qualifiedIntents = new ArrayList<Intent>();
-    // private List<Intent> requiredIntents = new ArrayList<Intent>();
+    private Intent defaultQualifiedIntent;
+    private Intent parent;
+    private List<Intent> requiredIntents = new ArrayList<Intent>();
     private List<Intent> excludedIntents = new ArrayList<Intent>();
+    private boolean mutuallyExclusive;
     private boolean unresolved = true;
-    private String domain;
-    private String[] qualifiedNames;
 
     protected IntentImpl() {
     }
@@ -54,33 +54,14 @@
 
     public void setName(QName name) {
         this.name = name;
-        String iname = name.getLocalPart();
-        int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
-        if (domainIdx > -1) {
-            domain = iname.substring(0, domainIdx);
-            String qualifNamesStr = iname.substring(domainIdx + 1);
-            String pattern = "\\" + QUALIFIED_SEPARATOR;
-            qualifiedNames = qualifNamesStr.split(pattern);
-        } else
-            domain = iname;
     }
 
-    public String getDomain() {
-        return domain;
+    public List<ExtensionType> getConstrainedTypes() {
+        return constrainedTypes;
     }
 
-    public String[] getQualifiedNames() {
-        String[] results = new String[qualifiedNames.length];
-        System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
-        return results;
-    }
-
-    /*public List<Operation> getOperations() {
-        return operations;
-    }*/
-
-    public List<QName> getConstrains() {
-        return constrains;
+    public void setConstrainedTypes(List<ExtensionType> constrainedTypes) {
+        this.constrainedTypes = constrainedTypes;
     }
 
     public String getDescription() {
@@ -91,14 +72,38 @@
         this.description = description;
     }
 
+    public Intent getParent() {
+        return parent;
+    }
+
+    public void setParent(Intent parent) {
+        this.parent = parent;
+    }
+
     public List<Intent> getQualifiedIntents() {
         return qualifiedIntents;
     }
 
+    public void setQualifiedIntents(List<Intent> qualifiedIntents) {
+        this.qualifiedIntents = qualifiedIntents;
+    }
+
+    public List<Intent> getRequiredIntents() {
+        return requiredIntents;
+    }
+
+    public void setRequiredIntents(List<Intent> requiredIntents) {
+        this.requiredIntents = requiredIntents;
+    }
+
     public List<Intent> getExcludedIntents() {
         return excludedIntents;
     }
 
+    public void setExcludedIntents(List<Intent> excludedIntents) {
+        this.excludedIntents = excludedIntents;
+    }
+
     public boolean isUnresolved() {
         return unresolved;
     }
@@ -107,45 +112,57 @@
         this.unresolved = unresolved;
     }
 
-    /**
-     * @see java.lang.Object#hashCode()
-     */
+    public Type getType() {
+        return type;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    public boolean isMutuallyExclusive() {
+        return mutuallyExclusive;
+    }
+
+    public void setMutuallyExclusive(boolean mutuallyExclusive) {
+        this.mutuallyExclusive = mutuallyExclusive;
+    }
+
+    public Intent getDefaultQualifiedIntent() {
+        return defaultQualifiedIntent;
+    }
+
+    public void setDefaultQualifiedIntent(Intent defaultQualifiedIntent) {
+        this.defaultQualifiedIntent = defaultQualifiedIntent;
+    }
+    
+
     @Override
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        QName intentName = getName();
-        result = prime * result + ((intentName == null) ? 0 : intentName.hashCode());
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
         return result;
     }
 
-    /**
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
     @Override
     public boolean equals(Object obj) {
-        if (this == obj) {
+        if (this == obj)
             return true;
-        }
-        if (obj == null) {
+        if (obj == null)
             return false;
-        }
-        if (!(obj instanceof IntentImpl)) {
+        if (getClass() != obj.getClass())
             return false;
-        }
-        final IntentImpl other = (IntentImpl)obj;
-        if (getName() == null) {
-            if (other.getName() != null) {
+        IntentImpl other = (IntentImpl)obj;
+        if (name == null) {
+            if (other.name != null)
                 return false;
-            }
-        } else if (!getName().equals(other.getName())) {
+        } else if (!name.equals(other.name))
             return false;
-        }
         return true;
     }
-
-    @Override
+    
     public String toString() {
-        return String.valueOf(getName());
+        return String.valueOf(name);
     }
 }

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java Fri Feb 20 20:10:37 2009
@@ -18,10 +18,12 @@
  */
 package org.apache.tuscany.sca.policy.impl;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentMap;
+import org.apache.tuscany.sca.policy.Qualifier;
 
 /**
  * Represents an intent map.
@@ -31,43 +33,29 @@
 public class IntentMapImpl implements IntentMap {
 
     private boolean unresolved;
-    private IntentMap defaultQualifiedIntentMap;
-    private List<Object> policies;
     private Intent providedIntent;
-    private List<IntentMap> qualifiedIntentMaps;
+    private List<Qualifier> qualifiers = new ArrayList<Qualifier>();
     
     protected IntentMapImpl() {
     }
 
-    public IntentMap getDefaultQualifiedIntentMap() {
-        return defaultQualifiedIntentMap;
+    public boolean isUnresolved() {
+        return unresolved;
     }
 
-    public List<Object> getPolicies() {
-        return policies;
+    public void setUnresolved(boolean unresolved) {
+        this.unresolved = unresolved;
     }
 
     public Intent getProvidedIntent() {
         return providedIntent;
     }
 
-    public List<IntentMap> getQualifiedIntentMaps() {
-        return qualifiedIntentMaps;
-    }
-
-    public void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap) {
-        this.defaultQualifiedIntentMap = defaultQualifiedIntentMap;
-    }
-
     public void setProvidedIntent(Intent providedIntent) {
         this.providedIntent = providedIntent;
     }
 
-    public boolean isUnresolved() {
-        return unresolved;
-    }
-
-    public void setUnresolved(boolean unresolved) {
-        this.unresolved = unresolved;
+    public List<Qualifier> getQualifiers() {
+        return qualifiers;
     }
 }

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyExpressionImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyExpressionImpl.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyExpressionImpl.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyExpressionImpl.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,86 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.PolicyExpression;
+
+public class PolicyExpressionImpl implements PolicyExpression {
+    private QName name;
+    private Object policy;
+    private boolean unresolved = true;
+
+    protected PolicyExpressionImpl() {
+    }
+
+    public QName getName() {
+        return name;
+    }
+
+    public <T> T getPolicy() {
+        return (T)policy;
+    }
+
+    public boolean isUnresolved() {
+        return unresolved;
+    }
+
+    public void setName(QName name) {
+        this.name = name;
+    }
+
+    public <T> void setPolicy(T policy) {
+        this.policy = policy;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        this.unresolved = unresolved;
+    }
+    
+    public String toString() {
+        return String.valueOf(name);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        PolicyExpressionImpl other = (PolicyExpressionImpl)obj;
+        if (name == null) {
+            if (other.name != null)
+                return false;
+        } else if (!name.equals(other.name))
+            return false;
+        return true;
+    }
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyExpressionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyExpressionImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java Fri Feb 20 20:10:37 2009
@@ -18,13 +18,15 @@
  */
 package org.apache.tuscany.sca.policy.impl;
 
+import org.apache.tuscany.sca.policy.BindingType;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.ImplementationType;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentMap;
+import org.apache.tuscany.sca.policy.PolicyExpression;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetReference;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
+import org.apache.tuscany.sca.policy.Qualifier;
 
 /**
  * A factory for the policy model.
@@ -37,10 +39,6 @@
         return new IntentImpl();
     }
 
-    public PolicySetReference createPolicySetReference() {
-        return new PolicySetReferenceImpl();
-    }
-
     public PolicySet createPolicySet() {
         return new PolicySetImpl();
     }
@@ -49,12 +47,24 @@
         return new IntentMapImpl();
     }
 
-    public ProfileIntent createProfileIntent() {
-        return new ProfileIntentImpl();
+    public Qualifier createQualifier() {
+        return new QualifierImpl();
+    }
+
+    public PolicyExpression createPolicyExpression() {
+        return new PolicyExpressionImpl();
+    }
+    
+    public BindingType createBindingType() {
+        return new BindingTypeImpl();
+    }
+    
+    public ImplementationType createImplementationType() {
+        return new ImplementationTypeImpl();
     }
 
-    public QualifiedIntent createQualifiedIntent() {
-        return new QualifiedIntentImpl();
+    public ExtensionType createExtensionType() {
+        return new ExtensionTypeImpl();
     }
 
 }

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java Fri Feb 20 20:10:37 2009
@@ -19,14 +19,14 @@
 package org.apache.tuscany.sca.policy.impl;
 
 import java.util.ArrayList;
-import java.util.Hashtable;
 import java.util.List;
-import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.xpath.XPathExpression;
 
 import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentMap;
+import org.apache.tuscany.sca.policy.PolicyExpression;
 import org.apache.tuscany.sca.policy.PolicySet;
 
 /**
@@ -37,29 +37,17 @@
 public class PolicySetImpl implements PolicySet {
 
     private QName name;
-    //private List<Operation> operations = new ArrayList<Operation>();
-    //private List<QName> appliesTo;
     private String appliesTo;
+    private String attachTo;
     private List<Intent> providedIntents = new ArrayList<Intent>();
     private List<PolicySet> referencedPolicySets = new ArrayList<PolicySet>();
-    private List<Object> policies = new ArrayList<Object>();
-    Map<Intent, List<Object>>  mappedPolicies = new Hashtable<Intent, List<Object>>();
     private boolean unresolved = true;
-    private String alwaysAppliesTo;
-    
-    private XPathExpression appliesToXPathExpression;
-    private XPathExpression alwaysAppliesToXPathExpression;
-    
-    public String getAlwaysAppliesTo() {
-        return alwaysAppliesTo;
-    }
 
-    public void setAlwaysAppliesTo(String alwaysAppliesTo) {
-        this.alwaysAppliesTo = alwaysAppliesTo;
-    }
+    private XPathExpression appliesToXPathExpression;
+    private XPathExpression attachToXPathExpression;
 
-    protected PolicySetImpl() {
-    }
+    private List<IntentMap> intentMaps = new ArrayList<IntentMap>();
+    private List<PolicyExpression> policies = new ArrayList<PolicyExpression>();
 
     public QName getName() {
         return name;
@@ -69,10 +57,6 @@
         this.name = name;
     }
 
-    /*public List<Operation> getOperations() {
-        return operations;
-    }*/
-
     public String getAppliesTo() {
         return appliesTo;
     }
@@ -81,16 +65,12 @@
         this.appliesTo = appliesTo;
     }
 
-    public List<Intent> getProvidedIntents() {
-        return providedIntents;
-    }
-
-    public List<PolicySet> getReferencedPolicySets() {
-        return referencedPolicySets;
+    public String getAttachTo() {
+        return attachTo;
     }
 
-    public List<Object> getPolicies() {
-        return policies;
+    public void setAttachTo(String attachTo) {
+        this.attachTo = attachTo;
     }
 
     public boolean isUnresolved() {
@@ -101,49 +81,65 @@
         this.unresolved = unresolved;
     }
 
-    public Map<Intent, List<Object>> getMappedPolicies() {
-        return mappedPolicies;
+    public XPathExpression getAppliesToXPathExpression() {
+        return appliesToXPathExpression;
     }
-    
-    @Override
-    public int hashCode() {
-        return String.valueOf(getName()).hashCode();
+
+    public void setAppliesToXPathExpression(XPathExpression appliesToXPathExpression) {
+        this.appliesToXPathExpression = appliesToXPathExpression;
     }
-    
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        } else if (obj instanceof PolicySet) {
-            if (getName() != null) {
-                return getName().equals(((PolicySet)obj).getName());
-            } else {
-                return ((PolicySet)obj).getName() == null;
-            }
-        } else {
-            return false;
-        }
+
+    public XPathExpression getAttachToXPathExpression() {
+        return attachToXPathExpression;
     }
-    
-    @Override
-    public String toString() {
-    	return ( this.name != null ) ? getName().toString() : "null";
+
+    public void setAttachToXPathExpression(XPathExpression attachToXPathExpression) {
+        this.attachToXPathExpression = attachToXPathExpression;
     }
 
-    public XPathExpression getAppliesToXPathExpression() {
-        return appliesToXPathExpression;
+    public List<IntentMap> getIntentMaps() {
+        return intentMaps;
     }
 
-    public void setAppliesToXPathExpression(XPathExpression appliesToXPathExpression) {
-        this.appliesToXPathExpression = appliesToXPathExpression;
+    public List<Intent> getProvidedIntents() {
+        return providedIntents;
+    }
+
+    public List<PolicySet> getReferencedPolicySets() {
+        return referencedPolicySets;
     }
 
-    public XPathExpression getAlwaysAppliesToXPathExpression() {
-        return alwaysAppliesToXPathExpression;
+    public List<PolicyExpression> getPolicies() {
+        return policies;
+    }
+    
+    public String toString() {
+        return String.valueOf(name);
+    }    
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
     }
 
-    public void setAlwaysAppliesToXPathExpression(XPathExpression alwaysAppliesToXPathExpression) {
-        this.alwaysAppliesToXPathExpression = alwaysAppliesToXPathExpression;
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        PolicySetImpl other = (PolicySetImpl)obj;
+        if (name == null) {
+            if (other.name != null)
+                return false;
+        } else if (!name.equals(other.name))
+            return false;
+        return true;
     }
 
 }

Added: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifierImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifierImpl.java?rev=746356&view=auto
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifierImpl.java (added)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifierImpl.java Fri Feb 20 20:10:37 2009
@@ -0,0 +1,48 @@
+/*
+ * 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 org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyExpression;
+import org.apache.tuscany.sca.policy.Qualifier;
+
+public class QualifierImpl implements Qualifier {
+    private Intent intent;
+    private List<PolicyExpression> policies = new ArrayList<PolicyExpression>();
+
+    protected QualifierImpl() {
+    }
+
+    public Intent getIntent() {
+        return intent;
+    }
+
+    public List<PolicyExpression> getPolicies() {
+        return policies;
+    }
+
+    public void setIntent(Intent intent) {
+        this.intent = intent;
+    }
+
+}

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifierImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifierImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java Fri Feb 20 20:10:37 2009
@@ -48,10 +48,9 @@
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 
+import org.apache.tuscany.sca.policy.ExtensionType;
 import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.ProfileIntent;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -66,9 +65,9 @@
     private static final String POLICYSET_PREFIX = "tp_";
     private static final String APPLICABLE_POLICYSET_ATTR_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
     private static final String APPLICABLE_POLICYSET_ATTR = "applicablePolicySets";
-    private static final String POLICY_SETS_ATTR = "policySets"; 
+    private static final String POLICY_SETS_ATTR = "policySets";
     private static final String APPLICABLE_POLICYSET_ATTR_PREFIX = "tuscany";
-    private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+    private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200712";
 
     /**
      * This method unconditionally adds intents from the source list to the target list.
@@ -125,8 +124,7 @@
     public static void addDefaultPolicies(List<Intent> sourceIntents,
                                           List<PolicySet> sourcePolicySets,
                                           List<Intent> targetIntents,
-                                          List<PolicySet> targetPolicySets)
-    {
+                                          List<PolicySet> targetPolicySets) {
         // form a list of all intents required by the target
         List<Intent> combinedTargetIntents = new ArrayList<Intent>();
         combinedTargetIntents.addAll(findAndExpandProfileIntents(targetIntents));
@@ -167,14 +165,12 @@
 
     }
 
-    public static void checkForMutuallyExclusiveIntents(
-                         List<Intent> intents,
-                         List<PolicySet> policySets,
-                         IntentAttachPointType intentAttachPointType,
-                         String id) throws PolicyValidationException
-    {
+    public static void checkForMutuallyExclusiveIntents(List<Intent> intents,
+                                                        List<PolicySet> policySets,
+                                                        ExtensionType intentAttachPointType,
+                                                        String id) throws PolicyValidationException {
         // gather all intents (keeping track of where they come from)
-        Map<Intent, PolicySet> combinedIntents = new HashMap<Intent,PolicySet>();
+        Map<Intent, PolicySet> combinedIntents = new HashMap<Intent, PolicySet>();
         for (PolicySet policySet : policySets) {
             for (Intent providedIntent : findAndExpandProfileIntents(policySet.getProvidedIntents())) {
                 combinedIntents.put(providedIntent, policySet);
@@ -192,14 +188,21 @@
                     if (combinedIntents.get(intent) == null)
                         sIntent1 = intent.getName().toString();
                     else
-                        sIntent1 = intent.getName().toString() + " in policy set " + combinedIntents.get(intent).getName().toString();
+                        sIntent1 =
+                            intent.getName().toString() + " in policy set "
+                                + combinedIntents.get(intent).getName().toString();
                     if (combinedIntents.get(excluded) == null)
                         sIntent2 = excluded.getName().toString();
                     else
-                        sIntent2 = excluded.getName().toString() + " in policy set " + combinedIntents.get(excluded).getName().toString();
-                    throw new PolicyValidationException(
-                        intentAttachPointType.getName() + " for " + id +
-                        " uses mutually-exclusive intents " + sIntent1 + " and " + sIntent2);
+                        sIntent2 =
+                            excluded.getName().toString() + " in policy set "
+                                + combinedIntents.get(excluded).getName().toString();
+                    throw new PolicyValidationException(intentAttachPointType.getType() + " for "
+                        + id
+                        + " uses mutually-exclusive intents "
+                        + sIntent1
+                        + " and "
+                        + sIntent2);
                 }
             }
         }
@@ -207,7 +210,7 @@
 
     public static void expandProfileIntents(List<Intent> intents) {
         List<Intent> expandedIntents = null;
-        if ( intents.size() > 0 ) {
+        if (intents.size() > 0) {
             expandedIntents = findAndExpandProfileIntents(intents);
             intents.clear();
             intents.addAll(expandedIntents);
@@ -216,10 +219,9 @@
 
     public static List<Intent> findAndExpandProfileIntents(List<Intent> intents) {
         List<Intent> expandedIntents = new ArrayList<Intent>();
-        for ( Intent intent : intents ) {
-            if ( intent instanceof ProfileIntent ) {
-                ProfileIntent profileIntent = (ProfileIntent)intent;
-                List<Intent> requiredIntents = profileIntent.getRequiredIntents();
+        for (Intent intent : intents) {
+            if (!intent.getRequiredIntents().isEmpty()) {
+                List<Intent> requiredIntents = intent.getRequiredIntents();
                 expandedIntents.addAll(findAndExpandProfileIntents(requiredIntents));
             } else {
                 expandedIntents.add(intent);
@@ -230,15 +232,11 @@
 
     private static byte[] addApplicablePolicySets(Document doc, Collection<PolicySet> policySets)
         throws XPathExpressionException, TransformerConfigurationException, TransformerException {
-        
+
         for (PolicySet policySet : policySets) {
             if (policySet.getAppliesTo() != null) {
                 addApplicablePolicySets(policySet, doc);
             }
-
-            if (policySet.getAlwaysAppliesTo() != null) {
-                addAlwaysApplicablePolicySets(policySet, doc);
-            }
         }
 
         StringWriter sw = new StringWriter();
@@ -258,48 +256,11 @@
         } catch (PrivilegedActionException e) {
             throw (TransformerException)e.getException();
         }
-        
-        return sw.toString().getBytes();
-    }
-
-    private static void addAlwaysApplicablePolicySets(PolicySet policySet,
-                                                      Document doc) throws XPathExpressionException {
-        XPathExpression expression = policySet.getAlwaysAppliesToXPathExpression();
-        NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
-
-        if (result != null) {
-            for (int counter = 0; counter < result.getLength(); ++counter) {
-                Node aResultNode = result.item(counter);
 
-                String alwaysApplicablePolicySets = null;
-
-                String policySetPrefix =
-                    declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
-                String policySetsAttrPrefix =
-                    declareNamespace((Element)aResultNode, SCA10_NS);
-                if (aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR) != null) {
-                    alwaysApplicablePolicySets =
-                        aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR).getNodeValue();
-                }
-
-                if (alwaysApplicablePolicySets != null && alwaysApplicablePolicySets.length() > 0) {
-                    alwaysApplicablePolicySets =
-                        alwaysApplicablePolicySets + " "
-                            + policySetPrefix
-                            + ":"
-                            + policySet.getName().getLocalPart();
-                } else {
-                    alwaysApplicablePolicySets =
-                        policySetPrefix + ":" + policySet.getName().getLocalPart();
-                }
-
-                ((Element)aResultNode).setAttribute(POLICY_SETS_ATTR, alwaysApplicablePolicySets);
-            }
-        }
+        return sw.toString().getBytes();
     }
 
-    private static void addApplicablePolicySets(PolicySet policySet,
-                                         Document doc) throws XPathExpressionException {
+    private static void addApplicablePolicySets(PolicySet policySet, Document doc) throws XPathExpressionException {
         XPathExpression expression = policySet.getAppliesToXPathExpression();
         NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
 
@@ -309,46 +270,37 @@
 
                 String applicablePolicySets = null;
 
-                String policySetPrefix =
-                    declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
-                String appPolicyAttrPrefix =
-                    declareNamespace((Element)aResultNode,
-                                     APPLICABLE_POLICYSET_ATTR_NS);
-                if (aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
-                                                               APPLICABLE_POLICYSET_ATTR) != null) {
+                String policySetPrefix = declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
+                String appPolicyAttrPrefix = declareNamespace((Element)aResultNode, APPLICABLE_POLICYSET_ATTR_NS);
+                if (aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS, APPLICABLE_POLICYSET_ATTR) != null) {
                     applicablePolicySets =
                         aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
-                                                                   APPLICABLE_POLICYSET_ATTR)
-                            .getNodeValue();
+                                                                   APPLICABLE_POLICYSET_ATTR).getNodeValue();
                 }
 
                 if (applicablePolicySets != null && applicablePolicySets.length() > 0) {
                     applicablePolicySets =
-                        applicablePolicySets + " "
-                            + policySetPrefix
-                            + ":"
-                            + policySet.getName().getLocalPart();
+                        applicablePolicySets + " " + policySetPrefix + ":" + policySet.getName().getLocalPart();
                 } else {
-                    applicablePolicySets =
-                        policySetPrefix + ":" + policySet.getName().getLocalPart();
+                    applicablePolicySets = policySetPrefix + ":" + policySet.getName().getLocalPart();
                 }
 
-                ((Element)aResultNode).setAttributeNS(APPLICABLE_POLICYSET_ATTR_NS,
-                                                      appPolicyAttrPrefix + ":"
-                                                          + APPLICABLE_POLICYSET_ATTR,
-                                                      applicablePolicySets);
+                ((Element)aResultNode).setAttributeNS(APPLICABLE_POLICYSET_ATTR_NS, appPolicyAttrPrefix + ":"
+                    + APPLICABLE_POLICYSET_ATTR, applicablePolicySets);
             }
         }
     }
 
-    public static byte[] addApplicablePolicySets(InputStream is, Collection<PolicySet> domainPolicySets, DocumentBuilderFactory documentBuilderFactory) throws Exception {
+    public static byte[] addApplicablePolicySets(InputStream is,
+                                                 Collection<PolicySet> domainPolicySets,
+                                                 DocumentBuilderFactory documentBuilderFactory) throws Exception {
         documentBuilderFactory.setNamespaceAware(true);
         DocumentBuilder db = documentBuilderFactory.newDocumentBuilder();
         Document doc = db.parse(is);
         is.close();
         return addApplicablePolicySets(doc, domainPolicySets);
     }
-    
+
     private static class DOMNamespaceContext implements NamespaceContext {
         private Node node;
 
@@ -373,7 +325,7 @@
         }
 
     }
-    
+
     private static String declareNamespace(Element element, String ns) {
         if (ns == null) {
             ns = "";
@@ -382,7 +334,7 @@
         String prefix = "";
         boolean declared = false;
         while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
-            if ( node.lookupPrefix(ns) != null ) {
+            if (node.lookupPrefix(ns) != null) {
                 prefix = node.lookupPrefix(ns);
                 declared = true;
                 break;
@@ -401,7 +353,7 @@
         }
         if (!declared) {
             // Find an available prefix
-            for (int i=1; ; i++) {
+            for (int i = 1;; i++) {
                 prefix = POLICYSET_PREFIX + i;
                 if (element.lookupNamespaceURI(prefix) == null) {
                     break;

Modified: tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java (original)
+++ tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java Fri Feb 20 20:10:37 2009
@@ -21,27 +21,22 @@
 
 import java.util.List;
 
-import javax.xml.namespace.QName;
-
+import org.apache.tuscany.sca.policy.ExtensionType;
 import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySubject;
 
 /**
  * @version $Rev$ $Date$
  */
 public class PolicyValidationUtils {
 
-    public static boolean isConstrained(QName constrained, IntentAttachPointType attachPointType) {
-        return (attachPointType != null && attachPointType.getName().getNamespaceURI()
-            .equals(constrained.getNamespaceURI()) && attachPointType.getName().getLocalPart()
-            .startsWith(constrained.getLocalPart()));
+    public static boolean isConstrained(ExtensionType constrained, ExtensionType attachPointType) {
+        return (attachPointType != null 
+            && (attachPointType.equals(constrained)) || (attachPointType.getBaseType().equals(constrained)));
     }
 
-    public static void validateIntents(IntentAttachPoint attachPoint,
-                                       IntentAttachPointType attachPointType)
+    public static void validateIntents(PolicySubject attachPoint, ExtensionType attachPointType)
         throws PolicyValidationException {
         boolean found = false;
         if (attachPointType != null) {
@@ -50,7 +45,7 @@
             found = false;
             for (Intent intent : attachPoint.getRequiredIntents()) {
                 if (!intent.isUnresolved()) {
-                    for (QName constrained : intent.getConstrains()) {
+                    for (ExtensionType constrained : intent.getConstrainedTypes()) {
                         if (isConstrained(constrained, attachPointType)) {
                             found = true;
                             break;
@@ -60,7 +55,7 @@
                     if (!found) {
                         throw new PolicyValidationException("Policy Intent '" + intent.getName()
                             + "' does not constrain extension type  "
-                            + attachPointType.getName());
+                            + attachPointType.getType());
                     }
                 } else {
                     throw new PolicyValidationException("Policy Intent '" + intent.getName()
@@ -70,36 +65,28 @@
         }
     }
 
-    public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint)
-        throws PolicyValidationException {
-        validatePolicySets(policySetAttachPoint, 
-                           policySetAttachPoint.getType(),
-                           policySetAttachPoint.getApplicablePolicySets());
+    public static void validatePolicySets(PolicySubject subject) throws PolicyValidationException {
+        // validatePolicySets(subject, subject.getType(), subject.getAttachedPolicySets());
     }
-    
-    public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
-                                          IntentAttachPointType attachPointType)
+
+    public static void validatePolicySets(PolicySubject subject, ExtensionType attachPointType)
         throws PolicyValidationException {
-        validatePolicySets(policySetAttachPoint,
-                           attachPointType,
-                           policySetAttachPoint.getApplicablePolicySets());
+        validatePolicySets(subject, attachPointType, subject.getPolicySets());
     }
 
-    public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
-                                          IntentAttachPointType attachPointType,
-                                          List<PolicySet> applicablePolicySets)
-        throws PolicyValidationException {
-        // Since the applicablePolicySets in a policySetAttachPoint will already
+    public static void validatePolicySets(PolicySubject subject,
+                                          ExtensionType attachPointType,
+                                          List<PolicySet> applicablePolicySets) throws PolicyValidationException {
+        // Since the applicablePolicySets in a subject will already
         // have the list of policysets that might ever be applicable to this attachPoint,
         // just check if the defined policysets feature in the list of applicable
         // policysets
-        for (PolicySet definedPolicySet : policySetAttachPoint.getPolicySets()) {
+        for (PolicySet definedPolicySet : subject.getPolicySets()) {
             if (!definedPolicySet.isUnresolved()) {
                 if (!applicablePolicySets.contains(definedPolicySet)) {
-                    throw new PolicyValidationException("Policy Set '" + definedPolicySet
-                        .getName()
+                    throw new PolicyValidationException("Policy Set '" + definedPolicySet.getName()
                         + "' does not apply to extension type  "
-                        + attachPointType.getName());
+                        + attachPointType.getType());
                 }
             } else {
                 throw new PolicyValidationException("Policy Set '" + definedPolicySet.getName()

Modified: tuscany/java/sca/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/DefaultContributionBuilderExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/DefaultContributionBuilderExtensionPoint.java?rev=746356&r1=746355&r2=746356&view=diff
==============================================================================
--- tuscany/java/sca/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/DefaultContributionBuilderExtensionPoint.java (original)
+++ tuscany/java/sca/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/DefaultContributionBuilderExtensionPoint.java Fri Feb 20 20:10:37 2009
@@ -63,7 +63,7 @@
     /**
      * Load builders declared under META-INF/services.
      */
-    private void loadBuilders() {
+    private synchronized void loadBuilders() {
         if (loaded)
             return;
         



Mime
View raw message