java.lang.Object
com.sun.xml.ws.policy.parser.PolicyConfigParser
Reads a policy configuration file and returns the WSDL model generated from it.
- Author:
- Fabian Ritzmann, Marek Potociar (marek.potociar at sun.com)
-
Method Summary
Modifier and TypeMethodDescriptionstatic URLfindConfigFile(String configFileIdentifier, com.sun.xml.ws.api.server.Container container) Find a WSIT config file based on theconfigFileIdentifierparameter according to following pattern:static com.sun.xml.ws.policy.PolicyMapparse(String configFileIdentifier, com.sun.xml.ws.api.server.Container container, com.sun.xml.ws.policy.PolicyMapMutator... mutators) This is a helper method that returns directlyPolicyMapinstance populated from information in WSIT config file.static com.sun.xml.ws.policy.PolicyMapThis is a helper method that returns directlyPolicyMapinstance populated from information in WSIT config file.static com.sun.xml.ws.api.model.wsdl.WSDLModelparseModel(String configFileIdentifier, com.sun.xml.ws.api.server.Container container, com.sun.xml.ws.policy.PolicyMapMutator... mutators) The method usesconfigFileIdentifierparameter to construct a WSIT config file name according to following pattern:static com.sun.xml.ws.api.model.wsdl.WSDLModelparseModel(URL configFileUrl, boolean isClient, com.sun.xml.ws.policy.PolicyMapMutator... mutators) Reads the WSIT config from a file denoted byconfigFileUrlparameter.
-
Method Details
-
parse
public static com.sun.xml.ws.policy.PolicyMap parse(String configFileIdentifier, com.sun.xml.ws.api.server.Container container, com.sun.xml.ws.policy.PolicyMapMutator... mutators) throws com.sun.xml.ws.policy.PolicyException This is a helper method that returns directlyPolicyMapinstance populated from information in WSIT config file. For more details on the whole process seeparseModelmethod.- Parameters:
configFileIdentifier- base of WSIT config file name (web service name for WSIT service config file or "client" for WSIT client configuration). Must not benull.container- if the application is run inside a web container, the container instance should be passed into this function, in order to get access to the servlet context that is used to load config file stored inWEB-INFdirectory of the application. May benull.mutators- to be registered with the populatedPolicyMapobject. May be ommited if user does not plan to modify thePolicyMapinstance.- Returns:
- A
WSDLModelwith aPolicyMapobject populated with information read from the WSIT config file. - Throws:
com.sun.xml.ws.policy.PolicyException- in case of any problems that may occur while reading WSIT config file and constructing theWSDLModelobject or populatingPolicyMapinstance.
-
parse
public static com.sun.xml.ws.policy.PolicyMap parse(URL configFileUrl, boolean isClient, com.sun.xml.ws.policy.PolicyMapMutator... mutators) throws com.sun.xml.ws.policy.PolicyException, IllegalArgumentException This is a helper method that returns directlyPolicyMapinstance populated from information in WSIT config file. For more details on the whole process seeparseModelmethod.- Parameters:
configFileUrl-URLof the config file resource that should be parsed. Must not benull.isClient- must betrueif this method is invoked to parse client configuration,falseotherwisemutators- to be registered with the populatedPolicyMapobject. May be ommited if user does not plan to modify thePolicyMapinstance.- Returns:
- A
WSDLModelwith aPolicyMapobject populated with information read from the WSIT config file. - Throws:
com.sun.xml.ws.policy.PolicyException- in case of any problems that may occur while reading WSIT config file and constructing theWSDLModelobject or populatingPolicyMapinstance.IllegalArgumentException- in caseconfigFileUrlparameter isnull.
-
parseModel
public static com.sun.xml.ws.api.model.wsdl.WSDLModel parseModel(String configFileIdentifier, com.sun.xml.ws.api.server.Container container, com.sun.xml.ws.policy.PolicyMapMutator... mutators) throws com.sun.xml.ws.policy.PolicyException The method usesconfigFileIdentifierparameter to construct a WSIT config file name according to following pattern:wsit-[configFileIdentifier].xmlAfter constructing the WSIT config file name, the function tries to find the WSIT config file and read it from the following locations:
WEB-INF- for servlet-based web service implementationsMETA-INF- for EJB-based web service implementationsclasspath- for web service clients
WSDLModelobject containig the populatedPolicyMapinstance is returned. If config file is not found,nullis returned as a result of this function call. In case of any other problems that may occur while reading the WSIT config file, aPolicyExceptionis thrown.Since
PolicyMapobject is immutable as such, this function gives you also a chance to register your ownPolicyMapMutatorobjects so that you are able to modify thePolicyMapobject later if needed.- Parameters:
configFileIdentifier- base of WSIT config file name (web service name for WSIT service config file or "client" for WSIT client configuration). Must not benull.container- if the application is run inside a web container, the container instance should be passed into this function, in order to get access to the servlet context that is used to load config file stored inWEB-INFdirectory of the application. May benull.mutators- to be registered with the populatedPolicyMapobject. May be ommited if user does not plan to modify thePolicyMapinstance.- Returns:
- A
WSDLModelwith aPolicyMapobject populated with information read from the WSIT config file. - Throws:
com.sun.xml.ws.policy.PolicyException- in case of any problems that may occur while reading WSIT config file and constructing theWSDLModelobject or populatingPolicyMapinstance.
-
parseModel
public static com.sun.xml.ws.api.model.wsdl.WSDLModel parseModel(URL configFileUrl, boolean isClient, com.sun.xml.ws.policy.PolicyMapMutator... mutators) throws com.sun.xml.ws.policy.PolicyException, IllegalArgumentException Reads the WSIT config from a file denoted byconfigFileUrlparameter. If the file exists it is parsed and resultingWSDLModelobject containig the populatedPolicyMapinstance is returned. If config file for givenURLdoes not exist or in case of any other problems that may occur while reading the WSIT config file, aPolicyExceptionis thrown.- Parameters:
configFileUrl-URLof the config file resource that should be parsed. Must not benull.isClient- must betrueif this method is invoked to parse client configuration,falseotherwisemutators- to be registered with the populatedPolicyMapobject. May be ommited if user does not plan to modify thePolicyMapinstance.- Returns:
- A
WSDLModelwith aPolicyMapobject populated with information read from the WSIT config file. - Throws:
com.sun.xml.ws.policy.PolicyException- in case of any problems that may occur while reading WSIT config file and constructing theWSDLModelobject or populatingPolicyMapinstance.IllegalArgumentException- in caseconfigFileUrlparameter isnull.
-
findConfigFile
public static URL findConfigFile(String configFileIdentifier, com.sun.xml.ws.api.server.Container container) throws com.sun.xml.ws.policy.PolicyException Find a WSIT config file based on theconfigFileIdentifierparameter according to following pattern:wsit-[configFileIdentifier].xmlAfter constructing the WSIT config file name, the function tries to find the WSIT config file in the following locations:
WEB-INF- for servlet-based web service implementationsMETA-INF- for EJB-based web service implementationsclasspath- for web service clients
WSDLModelobject containig the populatedPolicyMapinstance is returned. If config file is not found,nullis returned as a result of this method call. In case of any other problems that may occur while locating the WSIT config file, aPolicyExceptionis thrown.- Parameters:
configFileIdentifier- base of WSIT config file name (web service name for WSIT service config file or "client" for WSIT client configuration). Must not benull.container- if the application is run inside a web container, the container instance should be passed into this function, in order to get access to the servlet context that is used to load config file stored inWEB-INFdirectory of the application. May benull.- Returns:
- A
URLpointing to the WSIT configuration file. Null if not found. - Throws:
com.sun.xml.ws.policy.PolicyException- in case of any problems that may occur while locating the WSIT config file.
-