public class CarbonUtils extends Object
Constructor and Description |
---|
CarbonUtils() |
Modifier and Type | Method and Description |
---|---|
static DeployerConfig[] |
addCappDeployer(DeployerConfig[] originalConfigs,
org.apache.axis2.engine.AxisConfiguration axisConfig)
Adds the cApp deployer config into the original DeployerConfig array..
|
static <T> T[] |
arrayCopyOf(T[] original)
Returns a copy of the provided array.
|
static void |
checkSecurity() |
static void |
checkSecurity(List<String> allowedClasses) |
static void |
checkSecurity(Map<String,String> allowedMethods) |
static String |
computeServiceHash(org.apache.axis2.description.AxisServiceGroup serviceGroup)
Get the MD5 hash value of the service artifact corresponding to AxisServiceGroup
serviceGroup
|
static String |
getAxis2Repo() |
static String |
getAxis2ServicesDir(org.apache.axis2.engine.AxisConfiguration axisConfig)
Reads the AAR services dir from the Axis config.
|
static String |
getAxis2Xml() |
static String |
getBackendHttpPort(org.apache.axis2.context.ConfigurationContext configurationContext) |
static byte[] |
getBytesFromFile(File file)
Returns the contents of the file in a byte array.
|
static String |
getCAppDeploymentDirPath(org.apache.axis2.engine.AxisConfiguration axisConfig)
This is method returns deployment dir for carbon apps for current tenant.
|
static String |
getCarbonCatalinaHome() |
static String |
getCarbonConfigDirPath() |
static String |
getCarbonHome() |
static String |
getCarbonLogsPath() |
static String |
getCarbonOSGiDropinsDir() |
static String |
getCarbonRepository() |
static String |
getCarbonSecurityConfigDirPath() |
static String |
getCarbonTenantsDirPath() |
static int |
getCommandListenerPort()
Get the port of the command listener.
|
static String |
getComponentsRepo() |
static org.apache.axis2.deployment.Deployer |
getDeployer(String className) |
static String |
getEtcCarbonConfigDirPath() |
static org.apache.axis2.description.AxisService |
getFaultyService(String serviceName,
org.apache.axis2.context.ConfigurationContext configurationContext)
Get a faulty service
|
static String |
getGhostMetafileDir(org.apache.axis2.engine.AxisConfiguration axisConfig) |
static String |
getManagementTransport() |
static String |
getMD5(byte[] content) |
static int |
getPortFromServerConfig(String property)
This is to read the port values defined in other config files, which are overridden
from those in carbon.xml.
|
static String |
getProxyContextPath(boolean isWorkerNode)
Returns the proxy context path value specified in the carbon.xml.(Duplicated Util Method)
|
static String |
getRegistryXMLPath() |
static org.wso2.carbon.base.ServerConfiguration |
getServerConfiguration() |
static String |
getServerURL(org.wso2.carbon.base.api.ServerConfigurationService serverConfig,
org.apache.axis2.context.ConfigurationContext configCtx) |
static String |
getServerURL(javax.servlet.ServletContext servletContext,
javax.servlet.http.HttpSession httpSession,
org.apache.axis2.context.ConfigurationContext configCtx) |
static String |
getServerXml() |
static String |
getTenantTmpDirPath(org.apache.axis2.engine.AxisConfiguration axisConfig)
There's a separate tmp space for each tenant under java temp dir.
|
static String |
getTmpDir() |
static int |
getTransportPort(org.apache.axis2.engine.AxisConfiguration axisConfig,
String transport)
Get the port corresponding to a particular transport
|
static int |
getTransportPort(ConfigurationContextService configContextService,
String transport)
Get the port corresponding to a particular transport
|
static int |
getTransportPort(org.apache.axis2.context.ConfigurationContext configContext,
String transport)
Get the port corresponding to a particular transport
|
static int |
getTransportProxyPort(org.apache.axis2.engine.AxisConfiguration axisConfig,
String transport)
Get the proxy port corresponding to a particular transport
|
static int |
getTransportProxyPort(org.apache.axis2.context.ConfigurationContext configContext,
String transport)
Get the proxy port corresponding to a particular transport
|
static String |
getUserMgtXMLPath() |
static boolean |
isAdminConsoleEnabled() |
static boolean |
isChildNode()
Check if this is an Instance started by a Java exec
|
static boolean |
isDepSyncEnabled()
utility method to check whether deployment synchronizer enabled.
|
static boolean |
isFilteredOutService(org.apache.axis2.description.AxisService service)
Checks whether the given AxisService is an Admin Service or a Hidden Service
|
static boolean |
isMasterNode()
Check if this is a ChildNode or Not
|
static boolean |
isMultipleInstanceCase()
Check whether this is the multiple Instance scenario- means started the server with -n arg
|
static boolean |
isOptimized()
Check if the current server is optimized or not.
|
static boolean |
isReadOnlyNode()
Check whether this is the a node which should readonly
|
static boolean |
isRemoteRegistry() |
static boolean |
isRunningInStandaloneMode()
Is this Carbon server running in standalone mode?
|
static boolean |
isRunningOnLocalTransportMode() |
static boolean |
isURL(String location)
Check whther the specified Strin corresponds to a URL
|
static boolean |
isWorkerNode()
Check if the current server is a worker node
In clustering setup some servers are run as worker nodes and some as management nodes
|
static Long |
lastUpdatedTime(org.apache.axis2.description.AxisServiceGroup serviceGroup)
Get the last updated time of the service artifact corresponding to AxisServiceGroup
serviceGroup
|
static void |
registerFaultyService(String artifactPath,
String serviceType,
org.apache.axis2.context.ConfigurationContext configurationContext)
Register a faulty service
|
static InputStream |
replaceSystemVariablesInXml(InputStream xmlConfiguration) |
static String |
replaceSystemVariablesInXml(String xmlConfiguration) |
static void |
resolveLeafNodeValue(Node node) |
static String |
resolveSystemProperty(String text) |
static void |
setBasicAccessSecurityHeaders(String userName,
String password,
boolean rememberMe,
org.apache.axis2.context.MessageContext msgContext)
This is a utility method which can be used to set security headers in the message context.
|
static void |
setBasicAccessSecurityHeaders(String userName,
String password,
boolean rememberMe,
org.apache.axis2.client.ServiceClient serviceClient)
This is a utility method which can be used to set security headers in a service client.
|
static void |
setBasicAccessSecurityHeaders(String userName,
String password,
org.apache.axis2.client.ServiceClient serviceClient)
This is a utility method which can be used to set security headers in a service client.
|
static InputStream |
toInputStream(Document doc) |
static boolean |
useRegistryBasedRepository()
Should we use a Registry based repo instead of a FileSystem based one?
|
public static boolean isAdminConsoleEnabled()
public static int getTransportPort(ConfigurationContextService configContextService, String transport)
configContextService
- The OSGi ConfigurationContextServicetransport
- The transporttransport
IllegalStateException
- If no port is associated with the transport, or if this method
has been called before the ListenerManager has startedpublic static int getTransportPort(org.apache.axis2.context.ConfigurationContext configContext, String transport)
configContext
- The Axis2 ConfigurationContexttransport
- The transporttransport
IllegalStateException
- If no port is assocaited with the transport, or if this method
has been called before the ListenerManager has startedpublic static int getTransportProxyPort(org.apache.axis2.context.ConfigurationContext configContext, String transport)
configContext
- The Axis2 ConfigurationContexttransport
- The transporttransport
. -1 if the proxy port is not definedIllegalStateException
- If no port is assocaited with the transport, or if this method
has been called before the ListenerManager has startedpublic static int getTransportPort(org.apache.axis2.engine.AxisConfiguration axisConfig, String transport)
axisConfig
- The AxisConfigurationtransport
- The transporttransport
IllegalStateException
- If no port is assocaited with the transport, or if this method
has been called before the ListenerManager has startedpublic static int getTransportProxyPort(org.apache.axis2.engine.AxisConfiguration axisConfig, String transport)
axisConfig
- The AxisConfigurationtransport
- The transporttransport
.
-1 if this parameter is not definedIllegalStateException
- If no port is assocaited with the transport, or if this method
has been called before the ListenerManager has startedpublic static String getAxis2Xml()
public static String getServerXml()
public static String getCarbonHome()
public static String getCarbonCatalinaHome()
public static String getCarbonTenantsDirPath()
public static String getEtcCarbonConfigDirPath()
public static String getCarbonSecurityConfigDirPath()
public static String getCarbonConfigDirPath()
public static String getCarbonLogsPath()
public static String getComponentsRepo()
public static String getCarbonOSGiDropinsDir()
public static String getAxis2Repo()
public static String getRegistryXMLPath()
public static String getUserMgtXMLPath()
public static boolean isURL(String location)
location
- The String to be checkedlocation
is a URL, false - otherwisepublic static Long lastUpdatedTime(org.apache.axis2.description.AxisServiceGroup serviceGroup)
serviceGroup
- The service group whose last updated time we need to getpublic static String computeServiceHash(org.apache.axis2.description.AxisServiceGroup serviceGroup)
serviceGroup
- The service group whose last updated time we need to getpublic static String getTmpDir()
public static String getTenantTmpDirPath(org.apache.axis2.engine.AxisConfiguration axisConfig)
axisConfig
- - AxisConfiguration instance of the current tenantpublic static int getCommandListenerPort()
public static void registerFaultyService(String artifactPath, String serviceType, org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault
artifactPath
- Path of the faulty service artifactserviceType
- Service type of the faulty serviceconfigurationContext
- ConfigurationContextorg.apache.axis2.AxisFault
- If an error occurs while creating the service type Axis2 parameterpublic static org.apache.axis2.description.AxisService getFaultyService(String serviceName, org.apache.axis2.context.ConfigurationContext configurationContext)
serviceName
- Name of the faulty serviceconfigurationContext
- ConfigurationContextserviceName
public static String getCarbonRepository()
public static org.wso2.carbon.base.ServerConfiguration getServerConfiguration()
public static boolean isMasterNode()
public static boolean isChildNode()
public static boolean isMultipleInstanceCase()
public static boolean isReadOnlyNode()
public static byte[] getBytesFromFile(File file) throws CarbonException
file
- the file the to readCarbonException
- throws if the operation failed.public static String getMD5(byte[] content)
public static boolean isRunningInStandaloneMode()
public static boolean useRegistryBasedRepository()
public static void checkSecurity()
public static String getBackendHttpPort(org.apache.axis2.context.ConfigurationContext configurationContext) throws Exception
Exception
public static String getServerURL(org.wso2.carbon.base.api.ServerConfigurationService serverConfig, org.apache.axis2.context.ConfigurationContext configCtx)
public static String getServerURL(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpSession httpSession, org.apache.axis2.context.ConfigurationContext configCtx)
public static String getManagementTransport()
public static <T> T[] arrayCopyOf(T[] original)
T
- Type of objects in the original arrayoriginal
- The original arraypublic static int getPortFromServerConfig(String property)
property
- public static boolean isFilteredOutService(org.apache.axis2.description.AxisService service)
service
- - AxisService instancepublic static boolean isRunningOnLocalTransportMode()
public static String getAxis2ServicesDir(org.apache.axis2.engine.AxisConfiguration axisConfig)
axisConfig
- - AxisConfiguration instancepublic static void setBasicAccessSecurityHeaders(String userName, String password, boolean rememberMe, org.apache.axis2.client.ServiceClient serviceClient)
userName
- User calling the service.password
- Password of the user.rememberMe
- true
if UI asks to persist remember me cookie.serviceClient
- The service client used in the communication.public static void setBasicAccessSecurityHeaders(String userName, String password, boolean rememberMe, org.apache.axis2.context.MessageContext msgContext) throws org.apache.axis2.AxisFault
userName
- User calling the service.password
- Password of the user.rememberMe
- true
if UI asks to persist remember me cookie.msgContext
- The MessageContext of the message.org.apache.axis2.AxisFault
public static void setBasicAccessSecurityHeaders(String userName, String password, org.apache.axis2.client.ServiceClient serviceClient)
userName
- User calling the service.password
- Password of the user.serviceClient
- The service client used in the communication.public static DeployerConfig[] addCappDeployer(DeployerConfig[] originalConfigs, org.apache.axis2.engine.AxisConfiguration axisConfig)
originalConfigs
- - original DeployerConfig arrayaxisConfig
- - AxisConfiguration instance to get tenant idpublic static String getCAppDeploymentDirPath(org.apache.axis2.engine.AxisConfiguration axisConfig)
axisConfig
- - AxisConfiguration instance of the current tenantpublic static InputStream replaceSystemVariablesInXml(InputStream xmlConfiguration) throws CarbonException
xmlConfiguration
- InputStream that carries xml configurationCarbonException
public static void resolveLeafNodeValue(Node node)
public static String replaceSystemVariablesInXml(String xmlConfiguration) throws CarbonException
CarbonException
public static InputStream toInputStream(Document doc) throws CarbonException
doc
- the DOM.Document to be converted to InputStream.CarbonException
public static boolean isWorkerNode()
public static boolean isOptimized()
public static boolean isDepSyncEnabled()
public static String getGhostMetafileDir(org.apache.axis2.engine.AxisConfiguration axisConfig)
public static org.apache.axis2.deployment.Deployer getDeployer(String className) throws CarbonException
className
- name of the class to build the deployerException
CarbonException
public static String getProxyContextPath(boolean isWorkerNode)
isWorkerNode
- If isWorkerNode is true then this method returns the proxy context path of the
corresponding worker node. If the worker proxy context path is not specified, this method
returns the value specified for the proxy context path.Copyright © 2016 WSO2 Inc. All rights reserved.