public class Utils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
defaultEncoding |
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addEndpointsToService(AxisService axisService) |
static void |
addEndpointsToService(AxisService axisService,
AxisConfiguration axisConfiguration) |
static void |
addExcludeMethods(java.util.ArrayList<java.lang.String> excludeList)
Add the Axis2 lifecycle / session methods to a pre-existing list of names that will be
excluded when generating schemas.
|
static void |
addFlowHandlers(Flow flow,
java.lang.ClassLoader clsLoader) |
static void |
addHttpEndpoint(AxisService axisService,
java.lang.String url) |
static void |
addHttpEndpoint(AxisService axisService,
java.lang.String protocol,
java.lang.String endpointName) |
static void |
addSoap11Endpoint(AxisService axisService,
java.lang.String url) |
static void |
addSoap11Endpoint(AxisService axisService,
java.lang.String protocol,
java.lang.String endpointName) |
static void |
addSoap12Endpoint(AxisService axisService,
java.lang.String url) |
static void |
addSoap12Endpoint(AxisService axisService,
java.lang.String protocol,
java.lang.String endpointName) |
static java.lang.ClassLoader |
createClassLoader(java.util.ArrayList urls,
java.lang.ClassLoader serviceClassLoader,
boolean extractJars,
java.io.File tmpDir,
boolean isChildFirstClassLoading) |
static DeploymentClassLoader |
createClassLoader(java.io.File serviceFile,
boolean isChildFirstClassLoading) |
static java.lang.ClassLoader |
createClassLoader(java.net.URL[] urls,
java.lang.ClassLoader serviceClassLoader,
boolean extractJars,
java.io.File tmpDir,
boolean isChildFirstClassLoading) |
static java.io.File |
createTempFile(java.lang.String suffix,
java.io.InputStream in,
java.io.File tmpDir) |
static void |
deployModuleServices(AxisModule module,
ConfigurationContext configCtx)
Modules can contain services in some cases.
|
static void |
fillAxisService(AxisService axisService,
AxisConfiguration axisConfig,
java.util.ArrayList<java.lang.String> excludeOperations,
java.util.ArrayList<java.lang.String> nonRpcMethods)
This guy will create a AxisService using java reflection
|
static java.util.List |
findLibJars(java.net.URL url)
Get names of all *.jar files inside the lib/ directory of a given jar URL
|
static java.lang.String |
formatPath(java.lang.String path)
Format the string paths to match any platform..
|
static java.lang.String |
getAnnotatedServiceName(java.lang.Class serviceClass,
WebServiceAnnotation serviceAnnotation)
The util method to prepare the JSR 181 annotated service name from given annotation or for
defaults JSR 181 specifies that the in javax.jws.WebService the parameter serviceName
contains the wsdl:service name to mapp.
|
static AxisOperation |
getAxisOperationForJmethod(java.lang.reflect.Method method) |
static AxisOperation |
getAxisOperationForJmethod(java.lang.reflect.Method method,
boolean isHttpSCOKforVoidMethod)
This method returns Axis operation with IN and OUT message exchange pattern for a service method which has void
as the return type.
|
static AxisBindingMessage |
getBindingMessage(AxisBindingOperation bindingOperation,
AxisMessage message) |
static AxisBindingOperation |
getBindingOperation(AxisBinding binding,
AxisOperation operation) |
static java.lang.ClassLoader |
getClassLoader(java.lang.ClassLoader parent,
java.io.File file,
boolean isChildFirstClassLoading)
Get a ClassLoader which contains a classpath of a) the passed directory and b) any jar files
inside the "lib/" or "Lib/" subdirectory of the passed directory.
|
static java.lang.ClassLoader |
getClassLoader(java.lang.ClassLoader parent,
java.lang.String path,
boolean isChildFirstClassLoading) |
static java.lang.String |
getClassNameFromResourceName(java.lang.String resourceName)
Get the class name from a resource name referring to a class file.
|
static AxisBinding |
getHttpBinding(AxisService service) |
static java.lang.String |
getHTTPInputSerializationFromServicesXML(AxisOperation operation)
get http input mime type from the services xml
|
static java.lang.String |
getHTTPLoacationFromServicesXML(AxisOperation operation)
extract the http location from services xml related to given operation
|
static java.lang.String |
getHTTPMethodFromServicesXML(AxisOperation operation)
extract the http method from services xml related to given operation
|
static java.lang.String |
getHTTPOutputSerializationFromservicesXML(AxisOperation operation)
get http output mime type from the services xml
|
static java.util.List<java.lang.String> |
getListOfClasses(DeploymentFileData deploymentFileData)
Scan a JAR file and return the list of classes contained in the JAR.
|
static org.apache.axiom.om.OMElement |
getParameter(java.lang.String name,
java.lang.String value,
boolean locked) |
static java.lang.String |
getPath(java.lang.String parent,
java.lang.String childPath) |
static java.lang.String |
getServiceHierarchy(java.lang.String filePath,
java.lang.String serviceDir)
Computes the hierarchical part of the service name if this is such a service path.
|
static java.lang.String |
getShortFileName(java.lang.String filename) |
static AxisBinding |
getSoap11Binding(AxisService service) |
static AxisBinding |
getSoap12Binding(AxisService service) |
static java.net.URL[] |
getURLsForAllJars(java.net.URL url,
java.io.File tmpDir) |
static boolean |
isHttpBinding(AxisBinding binding) |
static boolean |
isSoap11Binding(AxisBinding binding) |
static boolean |
isSoap12Binding(AxisBinding binding) |
static boolean |
loadHandler(java.lang.ClassLoader loader1,
HandlerDescription desc) |
static void |
logFaultyServiceInfo(AxisConfiguration axisConfig)
Log faulty services info due to unavailability of modules and transports
|
static java.lang.String |
normalize(java.lang.String uri)
Normalize a uri containing ../ and ./ paths.
|
static void |
processBeanPropertyExclude(AxisService service)
This method is to process bean exclude parameter and the XML format of that would be
|
static void |
processPolicyAttachments(java.util.Iterator attachmentElements,
AxisService service) |
static void |
setEndpointsToAllUsedBindings(AxisService axisService) |
static java.io.File |
toFile(java.net.URL url) |
public static void addFlowHandlers(Flow flow, java.lang.ClassLoader clsLoader) throws AxisFault
AxisFaultpublic static boolean loadHandler(java.lang.ClassLoader loader1,
HandlerDescription desc)
throws DeploymentException
DeploymentExceptionpublic static java.net.URL[] getURLsForAllJars(java.net.URL url,
java.io.File tmpDir)
public static java.io.File createTempFile(java.lang.String suffix,
java.io.InputStream in,
java.io.File tmpDir)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parent,
java.lang.String path,
boolean isChildFirstClassLoading)
throws DeploymentException
DeploymentExceptionpublic static java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parent,
java.io.File file,
boolean isChildFirstClassLoading)
throws DeploymentException
parent - parent ClassLoader which will be the parent of the result of this methodfile - a File which must be a directory for this to be usefulDeploymentException - if problems occurpublic static void fillAxisService(AxisService axisService, AxisConfiguration axisConfig, java.util.ArrayList<java.lang.String> excludeOperations, java.util.ArrayList<java.lang.String> nonRpcMethods) throws java.lang.Exception
axisService - the target AxisServiceaxisConfig - the in-scope AxisConfigurationexcludeOperations - a List of Strings (or null), each containing a method to excludenonRpcMethods - a List of Strings (or null), each containing a non-rpc method namejava.lang.Exception - if a problem occurspublic static AxisOperation getAxisOperationForJmethod(java.lang.reflect.Method method) throws AxisFault
AxisFaultpublic static AxisOperation getAxisOperationForJmethod(java.lang.reflect.Method method, boolean isHttpSCOKforVoidMethod) throws AxisFault
Axis services can contain methods throws an exception and void as the return type, Normally in such case the returned Axis operation has IN only message exchange pattern. So that the http status code for the response is 202. This overloaded method added to fix that issue. This will return Axis operation with IN and OUT message exchange pattern for a service method which has void as the return type and the method must throw an checked exception. Then the response http status code will be 200 OK. To get 200 http status code you must set the mepinandout parameter to true in the axis2.xml
method - method object which represents the service methodisHttpSCOKforVoidMethod - is httpSCOKforVoidServiceMethod parameter true or false in the axis2.xmlAxisFaultpublic static org.apache.axiom.om.OMElement getParameter(java.lang.String name,
java.lang.String value,
boolean locked)
public static void deployModuleServices(AxisModule module, ConfigurationContext configCtx) throws AxisFault
The code looks for an "aars/" directory inside the module (either .mar or exploded), and an "aars.list" file inside that to figure out which services to deploy. Note that all services deployed this way will have access to the Module's classes.
module - the AxisModule to search for servicesconfigCtx - ConfigurationContext in which to deployAxisFaultpublic static java.lang.String normalize(java.lang.String uri)
uri - The uri path to normalizepublic static java.lang.String getPath(java.lang.String parent,
java.lang.String childPath)
public static java.util.List findLibJars(java.net.URL url)
url - base URL of a JAR to searchpublic static void addExcludeMethods(java.util.ArrayList<java.lang.String> excludeList)
excludeList - an ArrayList containing method names - we'll add ours to this.public static DeploymentClassLoader createClassLoader(java.io.File serviceFile, boolean isChildFirstClassLoading) throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic static java.lang.ClassLoader createClassLoader(java.util.ArrayList urls,
java.lang.ClassLoader serviceClassLoader,
boolean extractJars,
java.io.File tmpDir,
boolean isChildFirstClassLoading)
public static java.io.File toFile(java.net.URL url)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingExceptionpublic static java.lang.ClassLoader createClassLoader(java.net.URL[] urls,
java.lang.ClassLoader serviceClassLoader,
boolean extractJars,
java.io.File tmpDir,
boolean isChildFirstClassLoading)
public static void processBeanPropertyExclude(AxisService service)
service - , AxisService objectpublic static java.lang.String getShortFileName(java.lang.String filename)
public static java.lang.String getAnnotatedServiceName(java.lang.Class serviceClass,
WebServiceAnnotation serviceAnnotation)
serviceClass - the service ClassserviceAnnotation - a WebService annotation, or nullpublic static void addEndpointsToService(AxisService axisService) throws AxisFault
AxisFaultpublic static void setEndpointsToAllUsedBindings(AxisService axisService)
public static void addEndpointsToService(AxisService axisService, AxisConfiguration axisConfiguration) throws AxisFault
AxisFaultpublic static void addSoap11Endpoint(AxisService axisService, java.lang.String url) throws java.lang.Exception
java.lang.Exceptionpublic static void addSoap11Endpoint(AxisService axisService, java.lang.String protocol, java.lang.String endpointName) throws java.lang.Exception
java.lang.Exceptionpublic static void addSoap12Endpoint(AxisService axisService, java.lang.String url) throws java.lang.Exception
java.lang.Exceptionpublic static void addSoap12Endpoint(AxisService axisService, java.lang.String protocol, java.lang.String endpointName) throws java.lang.Exception
java.lang.Exceptionpublic static void addHttpEndpoint(AxisService axisService, java.lang.String url)
public static void addHttpEndpoint(AxisService axisService, java.lang.String protocol, java.lang.String endpointName)
public static void processPolicyAttachments(java.util.Iterator attachmentElements,
AxisService service)
throws javax.xml.stream.XMLStreamException,
javax.xml.stream.FactoryConfigurationError
javax.xml.stream.XMLStreamExceptionjavax.xml.stream.FactoryConfigurationErrorpublic static boolean isSoap11Binding(AxisBinding binding)
public static boolean isSoap12Binding(AxisBinding binding)
public static boolean isHttpBinding(AxisBinding binding)
public static AxisBinding getSoap11Binding(AxisService service)
public static AxisBinding getSoap12Binding(AxisService service)
public static AxisBinding getHttpBinding(AxisService service)
public static AxisBindingOperation getBindingOperation(AxisBinding binding, AxisOperation operation)
public static AxisBindingMessage getBindingMessage(AxisBindingOperation bindingOperation, AxisMessage message)
public static java.lang.String getHTTPLoacationFromServicesXML(AxisOperation operation)
operation - public static java.lang.String getHTTPMethodFromServicesXML(AxisOperation operation)
operation - public static java.lang.String getHTTPInputSerializationFromServicesXML(AxisOperation operation)
operation - public static java.lang.String getHTTPOutputSerializationFromservicesXML(AxisOperation operation)
operation - public static void logFaultyServiceInfo(AxisConfiguration axisConfig)
axisConfig - public static java.lang.String getServiceHierarchy(java.lang.String filePath,
java.lang.String serviceDir)
filePath - - input file path of the deploying fileserviceDir - - 'services', 'pojo', 'servicejars' etc..public static java.lang.String formatPath(java.lang.String path)
path - - input file pathpublic static java.lang.String getClassNameFromResourceName(java.lang.String resourceName)
resourceName - the resource namepublic static java.util.List<java.lang.String> getListOfClasses(DeploymentFileData deploymentFileData) throws DeploymentException
deploymentFileData - the JAR to scanDeploymentException - if an error occurs while scanning the fileCopyright © 2004-2018 The Apache Software Foundation. All Rights Reserved.