You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/11/16 22:04:48 UTC
svn commit: r475927 [2/2] - in /incubator/tuscany/java/sca/kernel:
core/src/main/java/org/apache/tuscany/core/loader/
core/src/main/java/org/apache/tuscany/core/policy/
core/src/test/java/org/apache/tuscany/core/loader/
core/src/test/java/org/apache/tu...
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,99 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+import static java.util.Collections.unmodifiableList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+/**
+ * Model representation for PolicySet.
+ * <p/>
+ * $Rev$ $Date$
+ */
+public class PolicySet extends PolicyContentModel {
+
+ /**
+ * QNames of artifacts to which this Policy can apply
+ */
+ protected List<QName> appliedArtifacts = new ArrayList<QName>();
+
+ /**
+ * IntentMap contained in this PolicySet
+ */
+ private Collection<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 Collection<PolicySetReference> policySetReferences = new ArrayList<PolicySetReference>();
+
+ /**
+ * Name of intents provided by this PolicySet
+ */
+ private Collection<IntentName> provideIntents = new ArrayList<IntentName>();
+
+ 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 addAppliedArtifacts(QName artifactName) {
+ appliedArtifacts.add(artifactName);
+ }
+
+ public List<QName> getAppliedArtifacts() {
+ return unmodifiableList(appliedArtifacts);
+ }
+
+ public void addIntentMap(IntentMap intentMap) {
+ intentMaps.add(intentMap);
+ }
+
+ public Collection<IntentMap> getIntentMaps() {
+ return unmodifiableCollection(intentMaps);
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public Collection<PolicySetReference> getPolicySetReferences() {
+ return unmodifiableCollection(policySetReferences);
+ }
+
+ public Collection<IntentName> getProvideIntents() {
+ return unmodifiableCollection(provideIntents);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,38 @@
+/*
+ * 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 PolicyModel {
+
+ private QName reference;
+
+ public PolicySetReference(QName reference) {
+ super();
+ this.reference = reference;
+ }
+
+ public QName getReference() {
+ return reference;
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/PolicySetReference.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+/**
+ * Model reprentation for qualifier
+ */
+
+public class Qualifier extends PolicyContentModel {
+
+ private String name;
+
+ /**
+ * IntentMap contained in this Qualifier
+ */
+ private IntentMap intentMap;
+
+ public Qualifier(String name) {
+ super();
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IntentMap getIntentMap() {
+ return intentMap;
+ }
+
+ public void setIntentMap(IntentMap intentMap) {
+ this.intentMap = intentMap;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Qualifier.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,35 @@
+/*
+ * 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<T> extends PolicyModel {
+ private T content;
+
+ public T getContent() {
+ return content;
+ }
+
+ public void setContent(T content) {
+ this.content = content;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WSPolicyAttachment.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,83 @@
+/*
+ * 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.Collection;
+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
+ */
+ Collection<IntentName> inlineProfileIntent(Collection<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
+ */
+ 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.
+ */
+ Collection<IntentName> getQualifiedIntents(IntentName qualifiable, QName artifact);
+
+ /**
+ * Whether the intent is a qualified.
+ *
+ * @param name intent name.
+ * @return whether the intent is a qualified
+ */
+ boolean isQualifiedIntent(IntentName name);
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/IntentRegistry.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,42 @@
+/*
+ * 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.Collection;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.IntentName;
+import org.apache.tuscany.spi.model.PolicyModel;
+
+/**
+ * Responsible for matching concrete policy artifacts required by abstract intent name.
+ */
+public interface PolicyEngine {
+
+ /**
+ * Retrieve policies which match the intents requirement on a SCA artifact. See SCA policy frame spec. 1.4.5 Guided
+ * Selection of PolicySets using Intents
+ *
+ * @param requires Intent names requred by the SCA artifact
+ * @param policySetName PolicySet names specify on the SCA artifact explicitly
+ * @param artifactType QName of SCA artifact type, which may be a abstract artifact type
+ * @return Collection contains all policy matching the intent requirement
+ */
+ Collection<PolicyModel> getPolicy(IntentName[] requires, QName[] policySetName, QName artifactType);
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicyEngine.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,46 @@
+/*
+ * 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.Collection;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.PolicySet;
+
+/**
+ * The host for PolicySet.
+ */
+public interface PolicySetContainer {
+
+ /**
+ * Get all PolicySet of this container
+ *
+ * @return Collection contains all PolicySet of this container
+ */
+ Collection<PolicySet> getAllPolicySet();
+
+ /**
+ * Get PolicySet by name.
+ *
+ * @param name QName of PolicySet.
+ * @return PolicySet with specified name
+ */
+ PolicySet getPolicySet(QName name);
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/PolicySetContainer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java Thu Nov 16 13:04:45 2006
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.policy;
+
+import javax.xml.namespace.QName;
+
+public interface SCATypeManager {
+
+ /**
+ * Whether the <code>subType</code> is a sub type of <code>type</code> or the type itself.
+ */
+ boolean isTypeOf(QName subType, QName type);
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/policy/SCATypeManager.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java?view=auto&rev=475927
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java Thu Nov 16 13:04:45 2006
@@ -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()));
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/IntentNameTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org