Package org.apache.axis2.deployment.util
Class Utils
- java.lang.Object
-
- org.apache.axis2.deployment.util.Utils
-
public class Utils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
defaultEncoding
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addEndpointsToService(AxisService axisService)
static void
addEndpointsToService(AxisService axisService, AxisConfiguration axisConfiguration)
static void
addExcludeMethods(List<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, ClassLoader clsLoader)
static void
addHttpEndpoint(AxisService axisService, String url)
static void
addHttpEndpoint(AxisService axisService, String protocol, String endpointName)
static void
addSoap11Endpoint(AxisService axisService, String url)
static void
addSoap11Endpoint(AxisService axisService, String protocol, String endpointName)
static void
addSoap12Endpoint(AxisService axisService, String url)
static void
addSoap12Endpoint(AxisService axisService, String protocol, String endpointName)
static DeploymentClassLoader
createClassLoader(File serviceFile, boolean isChildFirstClassLoading)
static ClassLoader
createClassLoader(URL archiveUrl, URL[] extraUrls, ClassLoader serviceClassLoader, File tmpDir, boolean isChildFirstClassLoading)
static File
createTempFile(String suffix, InputStream in, File tmpDir)
static void
deployModuleServices(AxisModule module, ConfigurationContext configCtx)
Modules can contain services in some cases.static void
fillAxisService(AxisService axisService, AxisConfiguration axisConfig, ArrayList<String> excludeOperations, ArrayList<String> nonRpcMethods)
This guy will create a AxisService using java reflectionstatic String
formatPath(String path)
Format the string paths to match any platform.. windows, linux etc..static AxisOperation
getAxisOperationForJmethod(Method method)
static AxisBindingMessage
getBindingMessage(AxisBindingOperation bindingOperation, AxisMessage message)
static AxisBindingOperation
getBindingOperation(AxisBinding binding, AxisOperation operation)
static ClassLoader
getClassLoader(ClassLoader parent, 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 ClassLoader
getClassLoader(ClassLoader parent, String path, boolean isChildFirstClassLoading)
static String
getClassNameFromResourceName(String resourceName)
Get the class name from a resource name referring to a class file.static AxisBinding
getHttpBinding(AxisService service)
static String
getHTTPInputSerializationFromServicesXML(AxisOperation operation)
get http input mime type from the services xmlstatic String
getHTTPLoacationFromServicesXML(AxisOperation operation)
extract the http location from services xml related to given operationstatic String
getHTTPMethodFromServicesXML(AxisOperation operation)
extract the http method from services xml related to given operationstatic String
getHTTPOutputSerializationFromservicesXML(AxisOperation operation)
get http output mime type from the services xmlstatic List<String>
getListOfClasses(DeploymentFileData deploymentFileData)
Scan a JAR file and return the list of classes contained in the JAR.static OMElement
getParameter(String name, String value, boolean locked)
static String
getPath(String parent, String childPath)
static String
getServiceHierarchy(String filePath, String serviceDir)
Computes the hierarchical part of the service name if this is such a service path.static String
getShortFileName(String filename)
static AxisBinding
getSoap11Binding(AxisService service)
static AxisBinding
getSoap12Binding(AxisService service)
static URL[]
getURLsForAllJars(URL url, File tmpDir)
static boolean
isHttpBinding(AxisBinding binding)
static boolean
isSoap11Binding(AxisBinding binding)
static boolean
isSoap12Binding(AxisBinding binding)
static boolean
loadHandler(ClassLoader loader1, HandlerDescription desc)
static void
logFaultyServiceInfo(AxisConfiguration axisConfig)
Log faulty services info due to unavailability of modules and transportsstatic String
normalize(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(Iterator attachmentElements, AxisService service)
static void
setEndpointsToAllUsedBindings(AxisService axisService)
static File
toFile(URL url)
-
-
-
Field Detail
-
defaultEncoding
public static String defaultEncoding
-
-
Method Detail
-
addFlowHandlers
public static void addFlowHandlers(Flow flow, ClassLoader clsLoader) throws AxisFault
- Throws:
AxisFault
-
loadHandler
public static boolean loadHandler(ClassLoader loader1, HandlerDescription desc) throws DeploymentException
- Throws:
DeploymentException
-
createTempFile
public static File createTempFile(String suffix, InputStream in, File tmpDir) throws IOException
- Throws:
IOException
-
getClassLoader
public static ClassLoader getClassLoader(ClassLoader parent, String path, boolean isChildFirstClassLoading) throws DeploymentException
- Throws:
DeploymentException
-
getClassLoader
public static ClassLoader getClassLoader(ClassLoader parent, File file, boolean isChildFirstClassLoading) throws DeploymentException
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.- Parameters:
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 useful- Returns:
- a new ClassLoader pointing to both the passed dir and jar files under lib/
- Throws:
DeploymentException
- if problems occur
-
fillAxisService
public static void fillAxisService(AxisService axisService, AxisConfiguration axisConfig, ArrayList<String> excludeOperations, ArrayList<String> nonRpcMethods) throws Exception
This guy will create a AxisService using java reflection- Parameters:
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 name- Throws:
Exception
- if a problem occurs
-
getAxisOperationForJmethod
public static AxisOperation getAxisOperationForJmethod(Method method) throws AxisFault
- Throws:
AxisFault
-
deployModuleServices
public static void deployModuleServices(AxisModule module, ConfigurationContext configCtx) throws AxisFault
Modules can contain services in some cases. This method will deploy all the services for a given AxisModule into the current AxisConfiguration.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.
- Parameters:
module
- the AxisModule to search for servicesconfigCtx
- ConfigurationContext in which to deploy- Throws:
AxisFault
-
normalize
public static String normalize(String uri)
Normalize a uri containing ../ and ./ paths.- Parameters:
uri
- The uri path to normalize- Returns:
- The normalized uri
-
addExcludeMethods
public static void addExcludeMethods(List<String> excludeList)
Add the Axis2 lifecycle / session methods to a pre-existing list of names that will be excluded when generating schemas.- Parameters:
excludeList
- an ArrayList containing method names - we'll add ours to this.
-
createClassLoader
public static DeploymentClassLoader createClassLoader(File serviceFile, boolean isChildFirstClassLoading) throws MalformedURLException
- Throws:
MalformedURLException
-
toFile
public static File toFile(URL url) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
createClassLoader
public static ClassLoader createClassLoader(URL archiveUrl, URL[] extraUrls, ClassLoader serviceClassLoader, File tmpDir, boolean isChildFirstClassLoading)
-
processBeanPropertyExclude
public static void processBeanPropertyExclude(AxisService service)
This method is to process bean exclude parameter and the XML format of that would be+ - Parameters:
service
- , AxisService object
-
addEndpointsToService
public static void addEndpointsToService(AxisService axisService) throws AxisFault
- Throws:
AxisFault
-
setEndpointsToAllUsedBindings
public static void setEndpointsToAllUsedBindings(AxisService axisService)
-
addEndpointsToService
public static void addEndpointsToService(AxisService axisService, AxisConfiguration axisConfiguration) throws AxisFault
- Throws:
AxisFault
-
addSoap11Endpoint
public static void addSoap11Endpoint(AxisService axisService, String url) throws Exception
- Throws:
Exception
-
addSoap11Endpoint
public static void addSoap11Endpoint(AxisService axisService, String protocol, String endpointName) throws Exception
- Throws:
Exception
-
addSoap12Endpoint
public static void addSoap12Endpoint(AxisService axisService, String url) throws Exception
- Throws:
Exception
-
addSoap12Endpoint
public static void addSoap12Endpoint(AxisService axisService, String protocol, String endpointName) throws Exception
- Throws:
Exception
-
addHttpEndpoint
public static void addHttpEndpoint(AxisService axisService, String url)
-
addHttpEndpoint
public static void addHttpEndpoint(AxisService axisService, String protocol, String endpointName)
-
processPolicyAttachments
public static void processPolicyAttachments(Iterator attachmentElements, AxisService service) throws XMLStreamException, FactoryConfigurationError
-
isSoap11Binding
public static boolean isSoap11Binding(AxisBinding binding)
-
isSoap12Binding
public static boolean isSoap12Binding(AxisBinding binding)
-
isHttpBinding
public static boolean isHttpBinding(AxisBinding binding)
-
getSoap11Binding
public static AxisBinding getSoap11Binding(AxisService service)
-
getSoap12Binding
public static AxisBinding getSoap12Binding(AxisService service)
-
getHttpBinding
public static AxisBinding getHttpBinding(AxisService service)
-
getBindingOperation
public static AxisBindingOperation getBindingOperation(AxisBinding binding, AxisOperation operation)
-
getBindingMessage
public static AxisBindingMessage getBindingMessage(AxisBindingOperation bindingOperation, AxisMessage message)
-
getHTTPLoacationFromServicesXML
public static String getHTTPLoacationFromServicesXML(AxisOperation operation)
extract the http location from services xml related to given operation- Parameters:
operation
-- Returns:
-
getHTTPMethodFromServicesXML
public static String getHTTPMethodFromServicesXML(AxisOperation operation)
extract the http method from services xml related to given operation- Parameters:
operation
-- Returns:
-
getHTTPInputSerializationFromServicesXML
public static String getHTTPInputSerializationFromServicesXML(AxisOperation operation)
get http input mime type from the services xml- Parameters:
operation
-- Returns:
-
getHTTPOutputSerializationFromservicesXML
public static String getHTTPOutputSerializationFromservicesXML(AxisOperation operation)
get http output mime type from the services xml- Parameters:
operation
-- Returns:
-
logFaultyServiceInfo
public static void logFaultyServiceInfo(AxisConfiguration axisConfig)
Log faulty services info due to unavailability of modules and transports- Parameters:
axisConfig
-
-
getServiceHierarchy
public static String getServiceHierarchy(String filePath, String serviceDir)
Computes the hierarchical part of the service name if this is such a service path. Ex: filePath = .../repository/services/foo/1.0.0/version.aar -> "foo/1.0.0/" filePath = .../repository/services/version.aar -> ""- Parameters:
filePath
- - input file path of the deploying fileserviceDir
- - 'services', 'pojo', 'servicejars' etc..- Returns:
- hierarchical path. either "" or a '/' separated string (Ex: foo/1.0.0/)
-
formatPath
public static String formatPath(String path)
Format the string paths to match any platform.. windows, linux etc..- Parameters:
path
- - input file path- Returns:
- formatted file path
-
getClassNameFromResourceName
public static String getClassNameFromResourceName(String resourceName)
Get the class name from a resource name referring to a class file.- Parameters:
resourceName
- the resource name- Returns:
- the class name
-
getListOfClasses
public static List<String> getListOfClasses(DeploymentFileData deploymentFileData) throws DeploymentException
Scan a JAR file and return the list of classes contained in the JAR.- Parameters:
deploymentFileData
- the JAR to scan- Returns:
- a list of Java class names
- Throws:
DeploymentException
- if an error occurs while scanning the file
-
-