Hi Jim, Raymond and others,
I created the model representations for policy artifact and intent
registry for initial work, please review the code attached.

Ant,
Thanks for the information of Eclipse template!

Regards,
Felix
Index: core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java
===================================================================
--- core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java   
(revision 0)
+++ core/src/main/java/org/apache/tuscany/core/policy/IntentRegistryImpl.java   
(revision 0)
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.policy;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.policy.IntentRegistry;
+
+/**
+ * The default implementation of a data intent registry
+ */
+public class IntentRegistryImpl implements IntentRegistry {
+    // SCA artifact QName
+    // for flexibility, maintain a map for each SCA artifact type
+    private Map<QName, Map<IntentName, IntentEntry>> intentRepo = new 
HashMap<QName, Map<IntentName, IntentEntry>>();
+
+    public List<IntentName> getQualifiedIntents(final IntentName qualifiable, 
QName artifact) {
+        Map<IntentName, IntentEntry> entryMap = getEntryMap(artifact);
+        List<IntentName> result = new ArrayList<IntentName>();
+        for (IntentName intentName : entryMap.keySet()) {
+            if(isQualifiedIntentFor(intentName, qualifiable)){
+                result.add(intentName);
+            }
+        }
+        return result;
+    }
+
+    public boolean isQualifiedIntentFor(IntentName qualified, IntentName 
qualifiable) {
+        if (qualified.equals(qualifiable) || 
!qualified.getDomain().equals(qualifiable.getDomain()) ) {
+            return false;
+        }
+        boolean result = true;
+        String[] shortArray = qualifiable.getQualifiedNames();
+        String[] longArray = qualified.getQualifiedNames();
+        if(longArray.length - shortArray.length !=1 ){
+            return false;
+        }
+        for (int i = 0; i < shortArray.length; i++) {
+            if (!shortArray[i].equals(longArray[i])) {
+                result = false;
+                break;
+            }
+        }
+        return result;
+    }
+
+    public List<IntentName> getConcreteIntents(List<IntentName> 
intentNameList, QName artifact) {
+        Map<IntentName, IntentEntry> entryMap = getEntryMap(artifact);
+        return getConcretIntents(intentNameList, entryMap);
+    }
+
+    private List<IntentName> getConcretIntents(List<IntentName> 
intentNameList, Map<IntentName, IntentEntry> entryMap) {
+        List<IntentName> result = new ArrayList<IntentName>();
+        for (IntentName intentName : intentNameList) {
+            IntentEntry intentEntry = entryMap.get(intentName);
+            if (intentEntry.getRequriedIntents().isEmpty()) {
+                result.add(intentEntry.getName());
+            } else {
+                getConcretIntents(intentEntry.requriedIntents, entryMap);
+            }
+        }
+        return result;
+    }
+
+    public boolean isApplicable(IntentName intentName, QName artifact) {
+        Map<IntentName, IntentEntry> entryMap = getEntryMap(artifact);
+        return entryMap.containsKey(intentName);
+    }
+
+    public void register(Intent intent) {
+        List<QName> appliedArtifacts = intent.getAppliedArtifacts();
+        for (QName artifact : appliedArtifacts) {
+            Map<IntentName, IntentEntry> entryMap = getEntryMap(artifact);
+            IntentEntry entry = new IntentEntry(intent.getName(), 
intent.getDescription(), intent.getRequriedIntents());
+            //if the qualified intents have been registered, make the intent 
qualifiable(unqualified)
+            if (!getQualifiedIntents(intent.getName(), artifact).isEmpty()) {
+                entry.setQualified(false);
+            }
+            entryMap.put(intent.getName(), entry);
+            IntentName qualifiable = getQualifiableIntent(intent.getName());
+            //set qualifiable intent of this intent unqualified
+            IntentEntry qualifiableEntry = entryMap.get(qualifiable);
+            if (qualifiableEntry != null && qualifiableEntry.isQualified()) {
+                qualifiableEntry.setQualified(false);
+            }
+
+        }
+
+    }
+    /**
+     * Get the qualifiable intent name for a intent, return <code>null</code> 
if intentName is top level qualifiable intent.
+     * @param intentName name of intent
+     * @return qualifiable intent name for a intent
+     */
+    private IntentName getQualifiableIntent(IntentName intentName) {
+        if (intentName.getQualifiedNames().length == 1) {
+            return null;
+        }
+        IntentName result = null;
+        String[] qualifiedNames = new 
String[intentName.getQualifiedNames().length - 1];
+        System.arraycopy(intentName.getQualifiedNames(), 0, qualifiedNames, 0, 
qualifiedNames.length);
+        result = new IntentName(intentName.getDomain(), qualifiedNames);
+        return result;
+    }
+
+    /*
+     * Get entry map for artitact, create new if it not exits.
+     */
+    private Map<IntentName, IntentEntry> getEntryMap(QName artifact) {
+        Map<IntentName, IntentEntry> result;
+        if (intentRepo.containsKey(artifact)) {
+            result = intentRepo.get(artifact);
+        } else {
+            result = new HashMap<IntentName, IntentEntry>();
+            intentRepo.put(artifact, result);
+        }
+        return result;
+    }
+
+    public void unRegister(Intent intent) {
+        List<QName> appliedArtifacts = intent.getAppliedArtifacts();
+        for (QName artifact : appliedArtifacts) {
+            Map<IntentName, IntentEntry> entryMap = getEntryMap(artifact);
+            if (entryMap.containsKey(intent.getName())) {
+                entryMap.remove(intent.getName());
+            }
+        }
+
+    }
+    /**
+     *
+     *
+     *
+     */
+    private static class IntentEntry {
+        /** name of intent. */
+        private IntentName name;
+
+        /** Whether this intent is qualified */
+        private boolean isQualified;
+
+        /** Description for the intent */
+        private String description;
+
+        /** intents required by this intent, only useful when this intent is a 
profile intent */
+        private List<IntentName> requriedIntents = new ArrayList<IntentName>();
+
+        public IntentEntry(IntentName name, String description, 
List<IntentName> requriedIntents) {
+            super();
+            this.name = name;
+            this.description = description;
+            this.requriedIntents = requriedIntents;
+            this.isQualified = true;
+        }
+
+        public boolean isQualified() {
+            return isQualified;
+        }
+
+        public void setQualified(boolean isQualified) {
+            this.isQualified = isQualified;
+        }
+
+        public String getDescription() {
+            return description;
+        }
+
+        public IntentName getName() {
+            return name;
+        }
+
+        public List<IntentName> getRequriedIntents() {
+            return requriedIntents;
+        }
+    }
+}
Index: 
core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java
===================================================================
--- 
core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java
   (revision 0)
+++ 
core/src/test/java/org/apache/tuscany/core/policy/IntentRegistryImplTestCase.java
   (revision 0)
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.policy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.policy.IntentRegistry;
+
+import junit.framework.TestCase;
+/**
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+public class IntentRegistryImplTestCase extends TestCase {
+    private IntentRegistry intentReg = null;
+    private static final QName wsbinding = new 
QName(XML_NAMESPACE_1_0,"binding.ws");
+    private static final  QName jmsbinding = new 
QName(XML_NAMESPACE_1_0,"binding.jms");
+
+    @Override
+    protected void setUp() throws Exception {
+        intentReg = new IntentRegistryImpl();
+
+        Intent bodyintent = new Intent(new 
IntentName("sec.confidentiality/message/body"),"test");
+        bodyintent.addAppliedArtifacts(wsbinding);
+        bodyintent.addAppliedArtifacts(jmsbinding);
+        intentReg.register(bodyintent);
+
+        Intent headintent = new Intent(new 
IntentName("sec.confidentiality/message/head"),"test");
+        headintent.addAppliedArtifacts(wsbinding);
+        headintent.addAppliedArtifacts(jmsbinding);
+        intentReg.register(headintent);
+
+        Intent confidentialityintent = new Intent(new 
IntentName("sec.confidentiality"),"test");
+        confidentialityintent.addAppliedArtifacts(wsbinding);
+        confidentialityintent.addAppliedArtifacts(jmsbinding);
+        intentReg.register(confidentialityintent);
+
+        Intent messageintent = new Intent(new 
IntentName("sec.confidentiality/message"),null);
+        messageintent.addAppliedArtifacts(wsbinding);
+        messageintent.addAppliedArtifacts(jmsbinding);
+        intentReg.register(messageintent);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        intentReg = null;
+    }
+
+//    public void testGetQualifiedIntent() {
+//        List<IntentName> intentNameList = new ArrayList<IntentName>();
+//        intentReg.get
+//        //intentReg.getConcretIntents(intentNameList, artifact)
+//    }
+
+    public void testGetConcretIntents() {
+        List<IntentName> intentNameList = new ArrayList<IntentName>();
+        //fail("Not yet implemented");
+    }
+
+    public void testGetQualifiedIntents(){
+        IntentName message = new IntentName("sec.confidentiality/message");
+        List<IntentName> qualifiedIntents = 
intentReg.getQualifiedIntents(message, jmsbinding);
+        assertEquals(2,qualifiedIntents.size());
+        assertTrue(qualifiedIntents.contains(new 
IntentName("sec.confidentiality/message/body")));
+        assertTrue(qualifiedIntents.contains(new 
IntentName("sec.confidentiality/message/head")));
+        assertFalse(qualifiedIntents.contains(new 
IntentName("sec.confidentiality/message")));
+        assertFalse(qualifiedIntents.contains(new 
IntentName("sec.confidentiality")));
+    }
+
+    public void testIsApplicable() {
+        assertTrue(intentReg.isApplicable(new 
IntentName("sec.confidentiality/message"), wsbinding));
+        assertFalse(intentReg.isApplicable(new 
IntentName("sec.confidentiality/transport"), wsbinding));
+        assertFalse(intentReg.isApplicable(new 
IntentName("test.confidentiality/transport"), wsbinding));
+    }
+
+    public void testRegister() {
+        Intent messageintent = new Intent(new 
IntentName("sec.confidentiality/transport"),null);
+        messageintent.addAppliedArtifacts(wsbinding);
+        messageintent.addAppliedArtifacts(jmsbinding);
+        intentReg.register(messageintent);
+        assertTrue(intentReg.isApplicable(new 
IntentName("sec.confidentiality/transport"), wsbinding));
+        assertTrue(intentReg.isApplicable(new 
IntentName("sec.confidentiality/transport"), jmsbinding));
+
+    }
+
+    public void testUnRegister() {
+        Intent messageintent = new Intent(new 
IntentName("sec.confidentiality/transport"),null);
+        messageintent.addAppliedArtifacts(wsbinding);
+        messageintent.addAppliedArtifacts(jmsbinding);
+        intentReg.register(messageintent);
+        intentReg.unRegister(messageintent);
+        assertFalse(intentReg.isApplicable(new 
IntentName("sec.confidentiality/transport"), wsbinding));
+        assertFalse(intentReg.isApplicable(new 
IntentName("sec.confidentiality/transport"), jmsbinding));
+
+    }
+
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/Intent.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/Intent.java  (revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/Intent.java  (revision 0)
@@ -0,0 +1,89 @@
+/*
+ * 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.spi.model;
+
+import static java.util.Collections.unmodifiableList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * Model representation for intent. This class is used for intent loader only, 
other SCA model classes will not reference this class directly.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Intent {//extends PolicyBase {
+
+    /** name of intent. */
+    private IntentName name;
+
+    /** Description for this intent */
+    private String description;
+
+    /** QNames of artifacts which this intent can apply to */
+    private List<QName> appliedArtifacts = new ArrayList<QName>();
+
+    /** intents required by this intent, only useful when this intent is a 
profile intent */
+    private List<IntentName> requriedIntents = new ArrayList<IntentName>();
+
+    /**
+     * Create a policy intent.
+     *
+     * @param name name of the intent.
+     * @param isQualified whether this intent is qualified
+     * @param description description of the intent.
+     */
+    public Intent(IntentName name, String description) {
+        super();
+        this.name = name;
+        this.description = description;
+    }
+
+    /*
+     *
+     *
+     */
+    public List<QName> getAppliedArtifacts() {
+        return unmodifiableList(appliedArtifacts);
+
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public IntentName getName() {
+        return name;
+    }
+
+    public List<IntentName> getRequriedIntents() {
+        return unmodifiableList(requriedIntents);
+    }
+
+    public void addRequriedIntents(List<IntentName> intents) {
+        requriedIntents.addAll(intents);
+    }
+
+    public void addAppliedArtifacts(QName artifactName) {
+        appliedArtifacts.add(artifactName);
+    }
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java       
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/IntentMap.java       
(revision 0)
@@ -0,0 +1,59 @@
+/*
+ * 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.spi.model;
+
+import static java.util.Collections.unmodifiableList;
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * Represents an IntentMap within PolicySet.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentMap extends PolicyBase {
+
+    /** Name of default intent provied by this IntentMap */
+    private IntentName defaultProvideIntent;
+
+    /** Name of intent provided by this IntentMap */
+    private List<IntentName> provideIntents = new ArrayList<IntentName>();
+
+    /** Qualifiers of this IntentMap */
+    private List<Qualifier> qualifiers = new ArrayList<Qualifier>();
+
+    public IntentMap(IntentName defaultProvideIntent, List<IntentName> 
provideIntents) {
+        super();
+        this.defaultProvideIntent = defaultProvideIntent;
+        this.provideIntents.addAll(provideIntents);
+    }
+
+    public List<IntentName> getProvideIntents() {
+        return unmodifiableList(provideIntents);
+    }
+
+    public List<Qualifier> getQualifiers() {
+        return unmodifiableList(qualifiers);
+    }
+
+    public IntentName getDefaultProvideIntent() {
+        return defaultProvideIntent;
+    }
+
+
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java      
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/IntentName.java      
(revision 0)
@@ -0,0 +1,140 @@
+/*
+ * 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.spi.model;
+
+import java.util.Arrays;
+
+/**
+ * Model class represnts a name of a intent. An intent name has a domain name 
and one or more qualified name. For example, intent name is
+ * "sec.confidentiality/message/body", its domain name is sec, and its 
qualified names are confidentiality, message and body
+ *
+ *
+ */
+public class IntentName implements java.io.Serializable{
+
+    private static final String QUALIFIED_SEPARATOR = "/";
+
+    private static final String DOMAIN_SEPARATOR = ".";
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = -7030021353149084879L;
+
+    /** domain of the intent */
+    private String domain;
+
+    private String[] qualifiedNames;
+
+    /**
+     * Construct a IntentName from a string representation.
+     *
+     * @param intent string representation for a intent.
+     */
+    public IntentName(String intent) {
+        parse(intent);
+    }
+    /**
+     * Construct a IntentName from domain name and qualified names
+     * @param domain domain name of the intent
+     * @param qualifiedNames qualified names of the intent
+     */
+    public IntentName(String domain, String[] qualifiedNames) {
+        this.domain = domain;
+        this.qualifiedNames = qualifiedNames;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        final IntentName other = (IntentName) obj;
+        if (domain == null) {
+            if (other.domain != null)
+                return false;
+        } else if (!domain.equals(other.domain))
+            return false;
+        if (!Arrays.equals(qualifiedNames, other.qualifiedNames))
+            return false;
+        return true;
+    }
+
+    public String getDomain() {
+        return domain;
+    }
+
+    private String getName() {
+        StringBuilder sbd = new StringBuilder(domain);
+        for (int i = 0; i < qualifiedNames.length; i++) {
+            if (i == 0) {
+                sbd.append(DOMAIN_SEPARATOR);
+            } else {
+                sbd.append(QUALIFIED_SEPARATOR);
+            }
+            sbd.append(qualifiedNames[i]);
+        }
+
+        return sbd.toString();
+    }
+
+    public String[] getQualifiedNames() {
+        String[] results = new String[qualifiedNames.length];
+        System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
+        return results;
+    }
+
+    @Override
+    public int hashCode() {
+        final int PRIME = 17;
+        int result = 1;
+        result = PRIME * result + ((domain == null) ? 0 : domain.hashCode());
+        result = PRIME * result + Arrays.hashCode(qualifiedNames);
+        return result;
+    }
+
+    /**
+     * Parse a string representation of intent.
+     *
+     * @param intent
+     *            string representation of intent
+     */
+    private void parse(String intent) {
+        String iname = validateFormat(intent);
+        int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
+        domain = iname.substring(0, domainIdx);
+        String qualifNamesStr = iname.substring(domainIdx + 1);
+        qualifiedNames = qualifNamesStr.split(QUALIFIED_SEPARATOR);
+
+    }
+
+    @Override
+    public String toString() {
+        return getName();
+    }
+
+    private String validateFormat(String intent) {
+        // TODO validate and canonicalize intent name
+        return intent;
+    }
+
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/PolicyBase.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/PolicyBase.java      
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/PolicyBase.java      
(revision 0)
@@ -0,0 +1,30 @@
+/*
+ * 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.spi.model;
+
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * An abstrat base class for all policy model representation.
+ *
+ * $Version$ $Date$
+ */
+public abstract class PolicyBase  extends ModelObject{
+
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java       
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java       
(revision 0)
@@ -0,0 +1,90 @@
+/*
+ * 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.spi.model;
+
+import static java.util.Collections.unmodifiableList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+import javax.xml.namespace.QName;
+/**
+ * Model representation for PolicySet.
+ *
+ * $Rev$ $Date$
+ */
+public class PolicySet extends PolicyBase{
+
+    /** IntentMap contained in this PolicySet */
+       private List<IntentMap> intentMaps = new ArrayList<IntentMap>();
+
+    /** Name for PolicySet, corresponding to name attribute of PolicySet 
element in SCDL  */
+       private QName name;
+
+    /** References to other PolicySet */
+    private List<PolicySetReference> policySetReferences = new 
ArrayList<PolicySetReference>();
+
+    /** Name of intents provided by this PolicySet */
+    private List<IntentName> provideIntents= new ArrayList<IntentName>();
+
+    /** WSPolicyAttachment contained in this PolicySet */
+    private List<WSPolicyAttachment> wsPolicyAttachments = new 
ArrayList<WSPolicyAttachment>();
+
+       public PolicySet(QName name, List<IntentName> providesIntent) {
+               super();
+               this.name = name;
+               this.provideIntents.addAll(providesIntent);
+       }
+
+
+       public void addPolicySetReference(PolicySetReference ref){
+               policySetReferences.add(ref);
+       }
+
+    public void addWsPolicyAttachments(WSPolicyAttachment attachment){
+        wsPolicyAttachments.add(attachment);
+    }
+
+
+       public List<IntentMap> getIntentMaps() {
+               return unmodifiableList(intentMaps);
+       }
+
+
+       public QName getName() {
+               return name;
+       }
+
+       public List<PolicySetReference> getPolicySetReferences() {
+               return policySetReferences;
+       }
+
+       /* (non-Javadoc)
+        * @see org.apache.tuscany.spi.model.policy.Provides#getProvideIntents()
+        */
+       public List<IntentName> getProvideIntents() {
+               return unmodifiableList(provideIntents);
+       }
+
+
+       public List<WSPolicyAttachment> getWsPolicyAttachments() {
+               return unmodifiableList(wsPolicyAttachments);
+       }
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java      
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java      
(revision 0)
@@ -0,0 +1,39 @@
+/*
+ * 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.spi.model;
+
+import javax.xml.namespace.QName;
+/**
+ *
+ * Presents a PolicySetReference.
+ *
+ */
+public class PolicySetReference extends PolicyBase {
+
+       private QName reference;
+
+       public PolicySetReference(QName reference) {
+               super();
+               this.reference = reference;
+       }
+
+       public QName getReference() {
+               return reference;
+       }
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java       
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java       
(revision 0)
@@ -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.spi.model;
+
+import static java.util.Collections.unmodifiableList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Qualifier extends PolicyBase{
+
+       private String name;
+    /** WSPolicyAttachment contained in this Qualifier */
+    private List<WSPolicyAttachment> wsPolicyAttachments = new 
ArrayList<WSPolicyAttachment>();
+
+       public Qualifier(String name) {
+               super();
+               this.name = name;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+    public void addWsPolicyAttachments(WSPolicyAttachment attachment){
+        wsPolicyAttachments.add(attachment);
+    }
+
+    public List<WSPolicyAttachment> getWsPolicyAttachments() {
+        return unmodifiableList(wsPolicyAttachments);
+    }
+}
Index: spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java      
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java      
(revision 0)
@@ -0,0 +1,25 @@
+/*
+ * 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.spi.model;
+/*
+ * Presents a ws-policy attachment.
+ */
+public class WSPolicyAttachment extends PolicyBase {
+
+}
Index: spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java
===================================================================
--- spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java 
(revision 0)
+++ spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java 
(revision 0)
@@ -0,0 +1,75 @@
+/*
+ * 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.spi.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.Intent;
+import org.apache.tuscany.spi.model.IntentName;
+
+/**
+ * The registry for intents.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface IntentRegistry {
+
+    /**
+     * Register a intent.
+     *
+     * @param intent intent to register
+     */
+    void register(Intent intent);
+
+    /**
+     * Unregister a intent.
+     *
+     * @param intent intent to unregister
+     */
+    void unRegister(Intent intent);
+
+    /**
+     * Replace the profile intents in intentNameList with the real concrete 
intent.
+     *
+     * @param intentNameList intent list that may contains profile intents
+     * @param artifact QName of SCA artifact
+     * @return concrete intents list
+     */
+    public List<IntentName> getConcreteIntents(List<IntentName> 
intentNameList, QName artifact);
+
+    /**
+     * Whether the intent is appplicable for specified SCA artifact.
+     * @param intentName name of intent
+     * @param artifact QName of SCA artifact
+     * @return Whether the intent is appplicable for specified SCA artifact
+     */
+    public boolean isApplicable(IntentName intentName, QName artifact) ;
+
+    /**
+     * Get a list including all qualified intents for a qulifiable intent.
+     * @param qualifiable qualifiable intent
+     * @param artifact QName of SCA artifact
+     * @return list including all qualified intents for a qulifiable intent.
+     */
+    public List<IntentName> getQualifiedIntents(IntentName qualifiable, QName 
artifact);
+
+
+}
Index: spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java
===================================================================
--- spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java      
(revision 0)
+++ spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java      
(revision 0)
@@ -0,0 +1,16 @@
+package org.apache.tuscany.spi.model;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+public class IntentNameTestCase extends TestCase {
+
+    public void testConstructor() throws Exception {
+        String case1 = "sec.confidentiality/message/body";
+        IntentName intentName = new IntentName(case1);
+        assertEquals("sec", intentName.getDomain());
+        assertEquals(case1, intentName.toString());
+        assertTrue(Arrays.equals(new String[] { "confidentiality", "message", 
"body" }, intentName.getQualifiedNames()));
+    }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to