You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/04/03 10:52:49 UTC
svn commit: r525093 [4/4] - in /incubator/tuscany/java/sca/scdl4j:
assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/impl/
assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/
assembly/src/main/java/org/apache/tuscany/assembly/ assembly...
Added: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/PolicySetAttachPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/PolicySetAttachPoint.java?view=auto&rev=525093
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/PolicySetAttachPoint.java (added)
+++ incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/PolicySetAttachPoint.java Tue Apr 3 01:52:45 2007
@@ -0,0 +1,37 @@
+/*
+ * 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.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can have policy sets
+ * attached to them.
+ */
+public interface PolicySetAttachPoint extends IntentAttachPoint {
+
+ /**
+ * Returns a list of policy sets. See the Policy Framework specification for
+ * a description of this attribute.
+ *
+ * @return a list of policy sets.
+ */
+ List<PolicySet> getPolicySets();
+
+}
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/PolicySetAttachPoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/PolicySetAttachPoint.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/DefaultPolicyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/DefaultPolicyFactory.java?view=auto&rev=525093
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/DefaultPolicyFactory.java (added)
+++ incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/DefaultPolicyFactory.java Tue Apr 3 01:52:45 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.policy.impl;
+
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.policy.IntentMap;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.PolicySet;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPolicyFactory implements PolicyFactory {
+
+ public Intent createIntent() {
+ return new IntentImpl();
+ }
+
+ public PolicySet createPolicySet() {
+ return new PolicySetImpl();
+ }
+
+ public IntentMap createIntentMap() {
+ return new IntentMapImpl();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/DefaultPolicyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/DefaultPolicyFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentImpl.java?view=auto&rev=525093
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentImpl.java (added)
+++ incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentImpl.java Tue Apr 3 01:52:45 2007
@@ -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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.sca.idl.Operation;
+
+/**
+ * Represents a policy intent.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentImpl implements Intent {
+
+ private QName name;
+ private List<Operation> operations = new ArrayList<Operation>();
+ private List<QName> constrains;
+ private String description;
+ private List<Intent> qualifiedIntents;
+ private List<Intent> requiredIntents;
+ private boolean unresolved;
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public List<QName> getConstrains() {
+ return constrains;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<Intent> getQualifiedIntents() {
+ return qualifiedIntents;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentMapImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentMapImpl.java?view=auto&rev=525093
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentMapImpl.java (added)
+++ incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentMapImpl.java Tue Apr 3 01:52:45 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.policy.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.policy.IntentMap;
+
+/**
+ * Represents an intent map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentMapImpl implements IntentMap {
+
+ private boolean unresolved;
+ private IntentMap defaultQualifiedIntentMap;
+ private List<Object> policies;
+ private Intent providedIntent;
+ private List<IntentMap> qualifiedIntentMaps;
+
+ public IntentMap getDefaultQualifiedIntentMap() {
+ return defaultQualifiedIntentMap;
+ }
+
+ public List<Object> getPolicies() {
+ return policies;
+ }
+
+ 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;
+ }
+}
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentMapImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/IntentMapImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/PolicySetImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/PolicySetImpl.java?view=auto&rev=525093
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/PolicySetImpl.java (added)
+++ incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/PolicySetImpl.java Tue Apr 3 01:52:45 2007
@@ -0,0 +1,80 @@
+/*
+ * 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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.policy.PolicySet;
+import org.apache.tuscany.sca.idl.Operation;
+
+/**
+ * Represents a policy set.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicySetImpl implements PolicySet {
+
+ private QName name;
+ private List<Operation> operations = new ArrayList<Operation>();
+ private List<QName> appliesTo;
+ private List<Intent> providedIntents;
+ private List<PolicySet> referencedPolicySets;
+ private List<Object> policies;
+ private boolean unresolved;
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public List<QName> getAppliesTo() {
+ return appliesTo;
+ }
+
+ public List<Intent> getProvidedIntents() {
+ return providedIntents;
+ }
+
+ public List<PolicySet> getReferencedPolicySets() {
+ return referencedPolicySets;
+ }
+
+ public List<Object> getPolicies() {
+ return policies;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/PolicySetImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/main/java/org/apache/tuscany/policy/impl/PolicySetImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/scdl4j/policy/src/test/java/org/apache/tuscany/policy/PolicyFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/policy/src/test/java/org/apache/tuscany/policy/PolicyFactoryTestCase.java?view=auto&rev=525093
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/policy/src/test/java/org/apache/tuscany/policy/PolicyFactoryTestCase.java (added)
+++ incubator/tuscany/java/sca/scdl4j/policy/src/test/java/org/apache/tuscany/policy/PolicyFactoryTestCase.java Tue Apr 3 01:52:45 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.policy;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.policy.PolicyFactory;
+import org.apache.tuscany.policy.PolicySet;
+import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
+
+/**
+ * Test building of policy model instances using the policy factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyFactoryTestCase extends TestCase {
+
+ PolicyFactory factory;
+
+ public void setUp() throws Exception {
+ factory = new DefaultPolicyFactory();
+ }
+
+ public void tearDown() throws Exception {
+ factory = null;
+ }
+
+ public void testCreateIntent() {
+ Intent intent = factory.createIntent();
+ intent.setName(new QName("http://test", "reliability"));
+ assertEquals(intent.getName(), new QName("http://test", "reliability"));
+ }
+
+ public void testCreatePolicySet() {
+ PolicySet policySet = factory.createPolicySet();
+ policySet.setName(new QName("http://test", "reliability"));
+ assertEquals(policySet.getName(), new QName("http://test", "reliability"));
+ }
+}
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/test/java/org/apache/tuscany/policy/PolicyFactoryTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/scdl4j/policy/src/test/java/org/apache/tuscany/policy/PolicyFactoryTestCase.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