Added: incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java?rev=602541&view=auto ============================================================================== --- incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java (added) +++ incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java Sat Dec 8 12:07:56 2007 @@ -0,0 +1,36 @@ +/* + * 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.util; + +/** + * Exception to be throw for invalid policy intents / policysets + */ +public class PolicyValidationException extends Exception { + private static final long serialVersionUID = 506979037642587755L; + + public PolicyValidationException(String message) { + super(message); + } + + public PolicyValidationException(Throwable e) { + super(e); + } + +}
Added: incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java?rev=602541&view=auto ============================================================================== --- incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java (added) +++ incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java Sat Dec 8 12:07:56 2007 @@ -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.util; + +import org.apache.tuscany.sca.policy.IntentAttachPointType; + +/** + * @version $Rev$ $Date$ + */ +public class PolicyValidationUtils { + public static boolean isPolicySetApplicable(String scdlFragment, + String xpath, + IntentAttachPointType attachPointType) { + + //FIXME: For now do a simple check and later implement whatever is mentioned in the next comment + if ( xpath != null && attachPointType != null && xpath.indexOf(attachPointType.getName().getLocalPart()) != -1) { + return true; + } else { + return false; + } + + + //create a xml node out of the parent object.. i.e. write the parent object as scdl fragment + //invoke PropertyUtil.evaluate(null, node, xpath) + //verify the result Node's QName against the bindingType's name + + /*if (parent instanceof ComponentReference) { + } else if (parent instanceof ComponentReference) { + } else if (parent instanceof Component) { + } else if (parent instanceof CompositeService) { + } else if (parent instanceof CompositeReference) { + + } + return true;*/ + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
