Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 11662 invoked from network); 22 Dec 2005 06:33:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Dec 2005 06:33:09 -0000 Received: (qmail 39555 invoked by uid 500); 22 Dec 2005 06:33:06 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 39281 invoked by uid 500); 22 Dec 2005 06:33:04 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 39260 invoked by uid 99); 22 Dec 2005 06:33:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2005 22:33:04 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [209.68.5.15] (HELO relay01.pair.com) (209.68.5.15) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 21 Dec 2005 22:33:02 -0800 Received: (qmail 2874 invoked from network); 22 Dec 2005 06:32:37 -0000 Received: from unknown (HELO ?192.168.1.219?) (unknown) by unknown with SMTP; 22 Dec 2005 06:32:37 -0000 X-pair-Authenticated: 222.165.170.99 Subject: [axis2] [Fwd: AXIS2: Holding Policy information in AxisConfiguration object] From: Sanjiva Weerawarana To: "axis-dev@ws.apache.org" Content-Type: multipart/mixed; boundary="=-I7GpXbq3OK6TJI5v+9EW" Organization: Lanka Software Foundation Date: Thu, 22 Dec 2005 14:35:01 +0600 Message-Id: <1135240502.6526.25.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --=-I7GpXbq3OK6TJI5v+9EW Content-Type: text/plain Content-Transfer-Encoding: 7bit Re-sending with proper prefix. Sanjiva. --=-I7GpXbq3OK6TJI5v+9EW Content-Disposition: inline Content-Description: Forwarded message - AXIS2: Holding Policy information in AxisConfiguration object Content-Type: message/rfc822 Return-Path: Delivered-To: lsf-opensource:lk-sanjiva@opensource.lk X-Envelope-To: sanjiva@opensource.lk Received: (qmail 4251 invoked from network); 22 Dec 2005 05:42:03 -0000 Received: from mailwash26.pair.com (66.39.2.26) by tyllur.pair.com with SMTP; 22 Dec 2005 05:42:03 -0000 Received: from localhost (localhost [127.0.0.1]) by mailwash26.pair.com (Postfix) with SMTP id 52F5DFF95B for ; Thu, 22 Dec 2005 00:42:02 -0500 (EST) X-Virus-Check-By: mailwash26.pair.com X-Spam-Check-By: mailwash26.pair.com X-Spam-Status: No, hits=0.3 required=4.0 tests=MIME_MISSING_BOUNDARY,RCVD_BY_IP autolearn=disabled version=3.000000 X-Spam-Flag: NO X-Spam-Level: X-Spam-Filtered: 6fa759a2efd97c7bcde14744d2396add Received: from mail.apache.org (hermes.apache.org [209.237.227.199]) by mailwash26.pair.com (Postfix) with SMTP id B1938FF983 for ; Thu, 22 Dec 2005 00:37:58 -0500 (EST) Received: (qmail 92747 invoked by uid 500); 22 Dec 2005 05:37:56 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 92736 invoked by uid 99); 22 Dec 2005 05:37:55 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2005 21:37:55 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of ssanka@gmail.com designates 66.249.82.203 as permitted sender) Received: from [66.249.82.203] (HELO xproxy.gmail.com) (66.249.82.203) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Dec 2005 21:37:53 -0800 Received: by xproxy.gmail.com with SMTP id t15so191300wxc for ; Wed, 21 Dec 2005 21:37:33 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=e719GbEfXzRfkfNFs1NqdeRL1KUGAXPJn69fGhbJEZBANZGd7GG8+p3+/2iIJtIcnNybb6s5eeggxACP+uoAzy6EmnXc0888pkXC9QtWVJ4YYqxiuhqomKL8+1ehFl0E+0o1F//DilNycsin9o0kkQ4sUMI88zLJNRXca5JAILI= Received: by 10.70.97.12 with SMTP id u12mr1609507wxb; Wed, 21 Dec 2005 21:37:32 -0800 (PST) Received: by 10.70.109.7 with HTTP; Wed, 21 Dec 2005 21:37:32 -0800 (PST) Message-ID: <1e8c1ed40512212137t6de61c1fv4634ae6810b230d0@mail.gmail.com> Date: Wed, 21 Dec 2005 23:37:32 -0600 From: Sanka Samaranayake To: axis-dev@ws.apache.org Subject: AXIS2: Holding Policy information in AxisConfiguration object MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_909_24745145.1135229852957" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_909_24745145.1135229852957 Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 7bit Dear Fellow Axis2 Devs, I would like to propose the following patch which allow the AxisConfiguration to hold policy information define in axis2.xml Thoughts ? Best, Sanka ------=_Part_909_24745145.1135229852957 Content-Type: text/x-patch; name=PolicyInclude.patch; charset=us-ascii Content-Disposition: attachment; filename="PolicyInclude.patch" Content-Transfer-Encoding: 7bit Index: core/src/org/apache/axis2/deployment/AxisConfigBuilder.java =================================================================== --- core/src/org/apache/axis2/deployment/AxisConfigBuilder.java (revision 358452) +++ core/src/org/apache/axis2/deployment/AxisConfigBuilder.java (working copy) @@ -112,6 +112,21 @@ if (hostElement != null) { processHostCongiguration(hostElement, axisConfiguration); } + + // processing .. elements + Iterator policyElements = config_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY)); + + if (policyElements != null) { + processPolicyElements(policyElements, axisConfiguration.getPolicyInclude()); + } + + // processing .. elements + Iterator policyRefElements = config_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF)); + + if (policyRefElements != null) { + processPolicyRefElements(policyElements, axisConfiguration.getPolicyInclude()); + } + } catch (XMLStreamException e) { throw new DeploymentException(e); } Index: core/src/org/apache/axis2/deployment/DeploymentConstants.java =================================================================== --- core/src/org/apache/axis2/deployment/DeploymentConstants.java (revision 358452) +++ core/src/org/apache/axis2/deployment/DeploymentConstants.java (working copy) @@ -90,4 +90,9 @@ String BOOLEAN_FALSE = "false"; char SEPARATOR_DOT = '.'; char SEPARATOR_COLON = ':'; + + String POLICY_NS_URI = "http://schemas.xmlsoap.org/ws/2004/09/policy"; + String TAG_POLICY = "Policy"; + String TAG_POLICY_REF = "PolicyReference"; + } Index: core/src/org/apache/axis2/deployment/DescriptionBuilder.java =================================================================== --- core/src/org/apache/axis2/deployment/DescriptionBuilder.java (revision 358452) +++ core/src/org/apache/axis2/deployment/DescriptionBuilder.java (working copy) @@ -1,20 +1,19 @@ /* -* Copyright 2004,2005 The Apache Software Foundation. -* -* Licensed 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. -*/ + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed 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.axis2.deployment; import org.apache.axis2.AxisFault; @@ -26,6 +25,7 @@ import org.apache.axis2.description.Parameter; import org.apache.axis2.description.ParameterImpl; import org.apache.axis2.description.ParameterInclude; +import org.apache.axis2.description.PolicyInclude; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.MessageReceiver; import org.apache.axis2.i18n.Messages; @@ -36,6 +36,10 @@ import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.ws.policy.Policy; +import org.apache.ws.policy.PolicyReference; +import org.apache.ws.policy.util.OMPolicyReader; +import org.apache.ws.policy.util.PolicyFactory; import javax.xml.namespace.QName; import javax.xml.stream.XMLInputFactory; @@ -50,6 +54,7 @@ */ public class DescriptionBuilder implements DeploymentConstants { protected Log log = LogFactory.getLog(getClass()); + protected AxisConfiguration axisConfig; protected InputStream descriptionStream; @@ -57,22 +62,23 @@ public DescriptionBuilder() { } - public DescriptionBuilder(InputStream serviceInputStream, AxisConfiguration axisConfig) { + public DescriptionBuilder(InputStream serviceInputStream, + AxisConfiguration axisConfig) { this.descriptionStream = serviceInputStream; this.axisConfig = axisConfig; } /** - * This will creat OMElemnt for a given descrition document (axis2.xml , services.xml and - * module.xml) - * + * This will creat OMElemnt for a given descrition document (axis2.xml , + * services.xml and module.xml) + * * @return OMElement OMElement * @throws javax.xml.stream.XMLStreamException - * + * */ public OMElement buildOM() throws XMLStreamException { - XMLStreamReader xmlReader = - XMLInputFactory.newInstance().createXMLStreamReader(descriptionStream); + XMLStreamReader xmlReader = XMLInputFactory.newInstance() + .createXMLStreamReader(descriptionStream); OMFactory fac = OMAbstractFactory.getOMFactory(); StAXOMBuilder staxOMBuilder = new StAXOMBuilder(fac, xmlReader); OMElement element = staxOMBuilder.getDocumentElement(); @@ -82,7 +88,8 @@ return element; } - protected MessageReceiver loadDefaultMessageReceiver() throws DeploymentException { + protected MessageReceiver loadDefaultMessageReceiver() + throws DeploymentException { MessageReceiver receiver; String defaultMessageReceiver = DEFAULT_MESSAGE_RECEIVER; @@ -91,33 +98,33 @@ /** * Setting default Message Recive as Message Receiver */ - ClassLoader loader1 = Thread.currentThread().getContextClassLoader(); - Class messageReceiver = Class.forName(defaultMessageReceiver, true, loader1); + ClassLoader loader1 = Thread.currentThread() + .getContextClassLoader(); + Class messageReceiver = Class.forName(defaultMessageReceiver, true, + loader1); receiver = ((MessageReceiver) messageReceiver.newInstance()); } catch (ClassNotFoundException e) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "ClassNotFoundException", - defaultMessageReceiver)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, + "ClassNotFoundException", defaultMessageReceiver)); } catch (IllegalAccessException e) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "IllegalAccessException", - defaultMessageReceiver)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, + "IllegalAccessException", defaultMessageReceiver)); } catch (InstantiationException e) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "InstantiationException", - defaultMessageReceiver)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, + "InstantiationException", defaultMessageReceiver)); } return receiver; } - protected MessageReceiver loadMessageReceiver(ClassLoader loader, OMElement reciverElement) - throws DeploymentException { - OMAttribute recieverName = reciverElement.getAttribute(new QName(TAG_CLASS_NAME)); + protected MessageReceiver loadMessageReceiver(ClassLoader loader, + OMElement reciverElement) throws DeploymentException { + OMAttribute recieverName = reciverElement.getAttribute(new QName( + TAG_CLASS_NAME)); String className = recieverName.getAttributeValue(); MessageReceiver receiver = null; @@ -129,17 +136,17 @@ receiver = (MessageReceiver) messageReceiver.newInstance(); } } catch (ClassNotFoundException e) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "ClassNotFoundException", className)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, + "ClassNotFoundException", className)); } catch (IllegalAccessException e) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "IllegalAccessException", className)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, + "IllegalAccessException", className)); } catch (InstantiationException e) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, "InstantiationException", className)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER, + "InstantiationException", className)); } return receiver; @@ -147,10 +154,12 @@ /** * To process Flow elements in services.xml - * - * @param flowelement OMElement + * + * @param flowelement + * OMElement * @return - * @throws DeploymentException DeploymentException + * @throws DeploymentException + * DeploymentException */ protected Flow processFlow(OMElement flowelement, ParameterInclude parent) throws DeploymentException { @@ -160,7 +169,8 @@ return flow; } - Iterator handlers = flowelement.getChildrenWithName(new QName(TAG_HANDLER)); + Iterator handlers = flowelement.getChildrenWithName(new QName( + TAG_HANDLER)); while (handlers.hasNext()) { OMElement handlerElement = (OMElement) handlers.next(); @@ -173,40 +183,47 @@ /** * To process Handler element - * - * @param handler_element OMElement + * + * @param handler_element + * OMElement * @return - * @throws DeploymentException DeploymentException + * @throws DeploymentException + * DeploymentException */ - protected HandlerDescription processHandler(OMElement handler_element, ParameterInclude parent) - throws DeploymentException { + protected HandlerDescription processHandler(OMElement handler_element, + ParameterInclude parent) throws DeploymentException { HandlerDescription handler = new HandlerDescription(); // Setting Handler name - OMAttribute name_attribute = handler_element.getAttribute(new QName(ATTRIBUTE_NAME)); + OMAttribute name_attribute = handler_element.getAttribute(new QName( + ATTRIBUTE_NAME)); if (name_attribute == null) { - throw new DeploymentException(Messages.getMessage(DeploymentErrorMsgs.INVALID_HANDLER, - "Name missing")); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.INVALID_HANDLER, "Name missing")); } else { handler.setName(new QName(name_attribute.getAttributeValue())); } // Setting Handler Class name - OMAttribute class_attribute = handler_element.getAttribute(new QName(TAG_CLASS_NAME)); + OMAttribute class_attribute = handler_element.getAttribute(new QName( + TAG_CLASS_NAME)); if (class_attribute == null) { - throw new DeploymentException((Messages.getMessage(DeploymentErrorMsgs.INVALID_HANDLER, + throw new DeploymentException((Messages.getMessage( + DeploymentErrorMsgs.INVALID_HANDLER, "class name is missing"))); } else { handler.setClassName(class_attribute.getAttributeValue()); } // processing phase Rules (order) - OMElement order_element = handler_element.getFirstChildWithName(new QName(TAG_ORDER)); + OMElement order_element = handler_element + .getFirstChildWithName(new QName(TAG_ORDER)); if (order_element == null) { - throw new DeploymentException((Messages.getMessage(DeploymentErrorMsgs.INVALID_HANDLER, + throw new DeploymentException((Messages.getMessage( + DeploymentErrorMsgs.INVALID_HANDLER, "phase rule has not been specified"))); } else { Iterator order_itr = order_element.getAllAttributes(); @@ -241,7 +258,8 @@ } } - Iterator parameters = handler_element.getChildrenWithName(new QName(TAG_PARAMETER)); + Iterator parameters = handler_element + .getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(parameters, handler, parent); } @@ -251,47 +269,53 @@ return handler; } - protected void processOperationModuleRefs(Iterator moduleRefs, AxisOperation operation) - throws DeploymentException { + protected void processOperationModuleRefs(Iterator moduleRefs, + AxisOperation operation) throws DeploymentException { try { while (moduleRefs.hasNext()) { OMElement moduleref = (OMElement) moduleRefs.next(); - OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE)); + OMAttribute moduleRefAttribute = moduleref + .getAttribute(new QName(TAG_REFERENCE)); if (moduleRefAttribute != null) { String refName = moduleRefAttribute.getAttributeValue(); if (axisConfig.getModule(new QName(refName)) == null) { - throw new DeploymentException( - Messages.getMessage(DeploymentErrorMsgs.MODULE_NOT_FOUND, refName)); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.MODULE_NOT_FOUND, refName)); } else { operation.addModule(new QName(refName)); } } } } catch (AxisFault axisFault) { - throw new DeploymentException(Messages.getMessage(DeploymentErrorMsgs.MODULE_NOT_FOUND, - axisFault.getMessage())); + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.MODULE_NOT_FOUND, axisFault + .getMessage())); } } /** * To get the Parameter object out from the OM - * - * @param parameters Parameter - * @param parameterInclude ParameterInclude - * @param parent ParameterInclude - * return : will return parameters , wchih name is WSA-Mapping , since we need to treat them - * separately + * + * @param parameters + * Parameter + * @param parameterInclude + * ParameterInclude + * @param parent + * ParameterInclude return : will return + * parameters , wchih name is WSA-Mapping , since we need to + * treat them separately */ - protected ArrayList processParameters(Iterator parameters, ParameterInclude parameterInclude, - ParameterInclude parent) + protected ArrayList processParameters(Iterator parameters, + ParameterInclude parameterInclude, ParameterInclude parent) throws DeploymentException { ArrayList wsamapping = new ArrayList(); while (parameters.hasNext()) { - // this is to check whether some one has locked the parmter at the top level + // this is to check whether some one has locked the parmter at the + // top level OMElement parameterElement = (OMElement) parameters.next(); Parameter parameter = new ParameterImpl(); @@ -299,11 +323,12 @@ parameter.setParameterElement(parameterElement); // setting parameter Name - OMAttribute paramName = parameterElement.getAttribute(new QName(ATTRIBUTE_NAME)); + OMAttribute paramName = parameterElement.getAttribute(new QName( + ATTRIBUTE_NAME)); if (paramName == null) { - throw new DeploymentException( - Messages.getMessage(DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT)); + throw new DeploymentException(Messages + .getMessage(DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT)); } parameter.setName(paramName.getAttributeValue()); @@ -322,7 +347,8 @@ } // setting locking attribute - OMAttribute paramLocked = parameterElement.getAttribute(new QName(ATTRIBUTE_LOCKED)); + OMAttribute paramLocked = parameterElement.getAttribute(new QName( + ATTRIBUTE_LOCKED)); Parameter parentParam = null; if (parent != null) { @@ -334,11 +360,13 @@ if (BOOLEAN_TRUE.equals(lockedValue)) { - // if the parameter is locked at some level parameter value replace by that - if ((parent != null) && parent.isParameterLocked(parameter.getName())) { - throw new DeploymentException( - Messages.getMessage( - DeploymentErrorMsgs.CONFIG_NOT_FOUND, parameter.getName())); + // if the parameter is locked at some level parameter value + // replace by that + if ((parent != null) + && parent.isParameterLocked(parameter.getName())) { + throw new DeploymentException(Messages.getMessage( + DeploymentErrorMsgs.CONFIG_NOT_FOUND, parameter + .getName())); } else { parameter.setLocked(true); } @@ -350,13 +378,15 @@ if (Constants.WSA_ACTION.equals(paramName.getAttributeValue())) { wsamapping.add(parameter); - // no need to add this parameter , since this is just for mapping + // no need to add this parameter , since this is just for + // mapping continue; } try { if (parent != null) { - if ((parentParam == null) || !parent.isParameterLocked(parameter.getName())) { + if ((parentParam == null) + || !parent.isParameterLocked(parameter.getName())) { parameterInclude.addParameter(parameter); } } else { @@ -370,10 +400,36 @@ return wsamapping; } + protected void processPolicyElements(Iterator policyElements, + PolicyInclude policyInclude) { + OMPolicyReader reader = (OMPolicyReader) PolicyFactory + .getPolicyReader(PolicyFactory.OM_POLICY_READER); + OMElement policyElement; + + while (policyElements.hasNext()) { + Policy p = reader.readPolicy((OMElement) policyElements.next()); + policyInclude.addPolicy(p); + } + } + + protected void processPolicyRefElements(Iterator policyRefElements, + PolicyInclude policyInclude) { + OMPolicyReader reader = (OMPolicyReader) PolicyFactory + .getPolicyReader(PolicyFactory.OM_POLICY_READER); + OMElement policyRefElement; + + while (policyRefElements.hasNext()) { + PolicyReference policyReference = reader + .readPolicyReference((OMElement) policyRefElements.next()); + policyInclude.addPolicyReference(policyReference); + } + } + /** * This method is used to retrive service name form the arechive file name - * if the archive file name is service1.aar , then axis service name would be service1 - * + * if the archive file name is service1.aar , then axis service name would + * be service1 + * * @param fileName * @return String */ @@ -392,9 +448,8 @@ } /** - * this method is to get the value of attribue - * eg xsd:anyVal --> anyVal - * + * this method is to get the value of attribue eg xsd:anyVal --> anyVal + * * @return String */ protected String getValue(String in) { Index: core/src/org/apache/axis2/description/PolicyInclude.java =================================================================== --- core/src/org/apache/axis2/description/PolicyInclude.java (revision 0) +++ core/src/org/apache/axis2/description/PolicyInclude.java (revision 0) @@ -0,0 +1,72 @@ +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed 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.axis2.description; + +import org.apache.ws.policy.Policy; +import org.apache.ws.policy.PolicyReference; +import org.apache.ws.policy.util.PolicyRegistry; + +/** + * @author Sanka Samaranayake (sanka@apache.org) + */ +public class PolicyInclude { + PolicyRegistry reg = null; + + Policy policy = null; + + public PolicyInclude() { + reg = new PolicyRegistry(); + } + + public PolicyInclude(PolicyRegistry reg) { + this.reg = reg; + } + + public void setPolicy(Policy policy) { + this.policy = policy; + } + + public Policy getPolicy() { + return policy; + } + + public void setPolicyRegistry(PolicyRegistry reg) { + this.reg = reg; + } + + public PolicyRegistry getPolicyRegistry() { + return reg; + } + + public void addPolicy(Policy nPolicy) { + + if (policy == null) { + policy = nPolicy; + + } else { + policy = (Policy) policy.merge(nPolicy, reg); + } + + if (policy.getPolicyURI() != null) { + reg.register(policy.getPolicyURI(), policy); + } + } + + public void addPolicyReference(PolicyReference policyReference) { + addPolicy((Policy) policyReference.normalize(reg)); + } +} Index: core/src/org/apache/axis2/engine/AxisConfiguration.java =================================================================== --- core/src/org/apache/axis2/engine/AxisConfiguration.java (revision 358452) +++ core/src/org/apache/axis2/engine/AxisConfiguration.java (working copy) @@ -71,6 +71,9 @@ private ArrayList inFaultPhases; private ArrayList inPhasesUptoAndIncludingPostDispatch; protected HashMap messagReceivers; + + // to store policies which are valid for entire system + private PolicyInclude policyInclude; private ClassLoader moduleClassLoader; private HashMap moduleConfigmap; @@ -96,6 +99,9 @@ faultyModules = new Hashtable(); observersList = new ArrayList(); inPhasesUptoAndIncludingPostDispatch = new ArrayList(); + + policyInclude = new PolicyInclude(); + systemClassLoader = Thread.currentThread().getContextClassLoader(); serviceClassLoader = Thread.currentThread().getContextClassLoader(); moduleClassLoader = Thread.currentThread().getContextClassLoader(); @@ -547,4 +553,12 @@ public void setSystemClassLoader(ClassLoader classLoader) { this.systemClassLoader = classLoader; } + + public void setPolicyInclude(PolicyInclude policyInclude) { + this.policyInclude = policyInclude; + } + + public PolicyInclude getPolicyInclude() { + return policyInclude; + } } ------=_Part_909_24745145.1135229852957-- --=-I7GpXbq3OK6TJI5v+9EW--