Package com.sun.xml.ws.policy.parser
Class PolicyConfigParser
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, Container container) Find a WSIT config file based on theconfigFileIdentifierparameter according to following pattern:static PolicyMapparse(String configFileIdentifier, Container container, PolicyMapMutator... mutators) This is a helper method that returns directlyPolicyMapinstance populated from information in WSIT config file.static PolicyMapparse(URL configFileUrl, boolean isClient, PolicyMapMutator... mutators) This is a helper method that returns directlyPolicyMapinstance populated from information in WSIT config file.static WSDLModelparseModel(String configFileIdentifier, Container container, PolicyMapMutator... mutators) The method usesconfigFileIdentifierparameter to construct a WSIT config file name according to following pattern:static WSDLModelparseModel(URL configFileUrl, boolean isClient, PolicyMapMutator... mutators) Reads the WSIT config from a file denoted byconfigFileUrlparameter.
-
Method Details
-
parse
public static PolicyMap parse(String configFileIdentifier, Container container, PolicyMapMutator... mutators) throws 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:
PolicyException- in case of any problems that may occur while reading WSIT config file and constructing theWSDLModelobject or populatingPolicyMapinstance.
-
parse
public static PolicyMap parse(URL configFileUrl, boolean isClient, PolicyMapMutator... mutators) throws 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:
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 WSDLModel parseModel(String configFileIdentifier, Container container, PolicyMapMutator... mutators) throws 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:
PolicyException- in case of any problems that may occur while reading WSIT config file and constructing theWSDLModelobject or populatingPolicyMapinstance.
-
parseModel
public static WSDLModel parseModel(URL configFileUrl, boolean isClient, PolicyMapMutator... mutators) throws 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:
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, Container container) throws 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:
PolicyException- in case of any problems that may occur while locating the WSIT config file.
-