public final class AppDeployerUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areAllFeaturesInstalled(List<Feature> features)
Checks whether the given list of features are already installed in the systme
|
static void |
attachArtifactToOwnerApp(String fileName,
String artifactType,
String runtimeObjectName,
int tenantId)
Finds the owner application of the provided artifact file name and sets the runtime
object name in the corresponding artifact.
|
static Map<String,Boolean> |
buildAcceptanceList(Map<String,List<Feature>> features)
For each artifact type, there's a set of features which are needed to be installed
in the system to properly deploy the artifacts.
|
static String |
computeResourcePath(String basePath,
String resourceName) |
static void |
copyFile(String fromPath,
String toPath)
Copy the artifact file at the fromPath to toPath
|
static String |
createAppExtractionPath(String parentAppName) |
static void |
createDir(String path) |
static String |
extractAppArtifact(String artifactPath,
String parentPath)
Extract an individual cApp artifact at the provided path to the java temp dir.
|
static String |
extractCarbonApp(String appCarPath)
Extract the Carbon application at the provided path to the java temp dir.
|
static String |
formatPath(String path)
Format the string paths to match any platform..
|
static String |
getApplicationLocation()
Finds repo/carbonapps path
|
static String |
getAppUnzipDir() |
static String |
getArchivePathFromBundle(org.osgi.framework.Bundle b)
Computes the application artifact file path when the bundle is given
|
static org.apache.axis2.deployment.Deployer |
getArtifactDeployer(org.apache.axis2.engine.AxisConfiguration axisConfig,
String directory,
String extension)
Finds the correct deployer for the given directory and extension
|
static String |
getAxis2Repo()
Finds the carbon repository location
|
static String |
getFileExtension(String fileName)
Finds teh extension of a given file
|
static String |
getParentAppName(org.osgi.framework.Bundle bundle) |
static String |
getProjectArtifactName(org.osgi.framework.Bundle bundle)
Check whether the given bundle is a project artifact.
|
static int |
getTenantId() |
static int |
getTenantId(org.apache.axis2.engine.AxisConfiguration axisConfig)
Deprecated.
|
static String |
getTenantIdLogString(int tenantId) |
static String |
getTenantIdString() |
static String |
getTenantIdString(org.apache.axis2.engine.AxisConfiguration axisConfig)
Deprecated.
|
static boolean |
hasLibs(List<Artifact.Dependency> deps)
Checks whether the given dependencies has library type artifacts
|
static boolean |
isAppDeployer(org.osgi.framework.Bundle bundle)
Checking whether a bundle contains the WSO2-Application-Deployer header
|
static Artifact |
populateArtifact(org.apache.axiom.om.OMElement artifactEle)
Builds the Artifact object when an artifact element is given
|
static RegistryConfig |
populateRegistryConfig(org.apache.axiom.om.OMElement resourcesElement)
Builds a RegistryConfig instance using an OMElement which is built using the registry
config file inside and cApp Registry/Resource artifact
|
static String |
readAttribute(org.apache.axiom.om.OMElement element,
String attName)
Reads an attribute in the given element and returns the value of that attribute
|
static String |
readChildText(org.apache.axiom.om.OMElement element,
String ln) |
static String |
readChildText(org.apache.axiom.om.OMElement element,
String ln,
String ns)
Reads a text node which is in a child element of the given element and returns the text
value.
|
static String |
readMediaType(String artifactExtractedPath,
String fileName)
Read the mediaType from the meta file of a resource.
|
static Map<String,List<Feature>> |
readRequiredFeaturs(org.apache.axiom.om.OMElement featureSets)
Reads the root element of the required-features.xml file and returns a list of required
features for each and every artifact type.
|
static String[] |
readServerRoles(CarbonAppPersistenceManager capm)
First checks for the "serverRoles" system property.
|
public static String getAppUnzipDir()
public static String getProjectArtifactName(org.osgi.framework.Bundle bundle)
bundle - - bundle to checkpublic static String getParentAppName(org.osgi.framework.Bundle bundle)
public static boolean isAppDeployer(org.osgi.framework.Bundle bundle)
bundle - - input bundlepublic static String getAxis2Repo()
public static void copyFile(String fromPath, String toPath) throws org.apache.axis2.deployment.DeploymentException
fromPath - - path at which the read the file to copytoPath - - path to which the file should be copiedorg.apache.axis2.deployment.DeploymentExceptionpublic static Artifact populateArtifact(org.apache.axiom.om.OMElement artifactEle)
artifactEle - - artifact OMElementpublic static RegistryConfig populateRegistryConfig(org.apache.axiom.om.OMElement resourcesElement)
resourcesElement - - regConfig elementpublic static String readAttribute(org.apache.axiom.om.OMElement element, String attName)
element - - Element to searchattName - - attribute namepublic static String readChildText(org.apache.axiom.om.OMElement element, String ln, String ns)
element - - Element to searchln - - Child element namens - - Child element namespacepublic static String[] readServerRoles(CarbonAppPersistenceManager capm)
capm - - persistance managerpublic static String getArchivePathFromBundle(org.osgi.framework.Bundle b)
b - - App artifact as an OSGi bundlepublic static String getApplicationLocation()
public static String getFileExtension(String fileName)
fileName - - name of the filepublic static String extractCarbonApp(String appCarPath) throws org.wso2.carbon.CarbonException
appCarPath - - Absolute path of the Carbon application .car fileorg.wso2.carbon.CarbonException - - error on extractionpublic static String extractAppArtifact(String artifactPath, String parentPath) throws org.wso2.carbon.CarbonException
artifactPath - - Absolute path of the cApp artifact fileparentPath - - Parent's extracted pathorg.wso2.carbon.CarbonException - - on errorpublic static void attachArtifactToOwnerApp(String fileName, String artifactType, String runtimeObjectName, int tenantId)
fileName - - file name of the artifactartifactType - - this can be a module or a serviceruntimeObjectName - - name of the runtime object corresponding to this filetenantId - - id of the tenant in which the artifact is deployedpublic static String formatPath(String path)
path - - input file pathpublic static boolean hasLibs(List<Artifact.Dependency> deps)
deps - - list of dependenciespublic static boolean areAllFeaturesInstalled(List<Feature> features)
features - - list of featurespublic static Map<String,Boolean> buildAcceptanceList(Map<String,List<Feature>> features)
features - - contains the list of features needed for each artifact typepublic static Map<String,List<Feature>> readRequiredFeaturs(org.apache.axiom.om.OMElement featureSets)
featureSets - - root element of the required-features.xml@Deprecated public static String getTenantIdString(org.apache.axis2.engine.AxisConfiguration axisConfig)
public static String getTenantIdString()
@Deprecated public static int getTenantId(org.apache.axis2.engine.AxisConfiguration axisConfig)
public static int getTenantId()
public static String getTenantIdLogString(int tenantId)
public static String readMediaType(String artifactExtractedPath, String fileName)
artifactExtractedPath - - extracted path of the artifactfileName - - original resource file name. this is used to figure out meta file namepublic static void createDir(String path)
public static org.apache.axis2.deployment.Deployer getArtifactDeployer(org.apache.axis2.engine.AxisConfiguration axisConfig,
String directory,
String extension)
axisConfig - - AxisConfiguration instancedirectory - - Directory to retrieve the deployerextension - - Extension of the deployable artifactCopyright © 2018 WSO2 Inc. All rights reserved.