public class GatewayCmdUtils extends Object
| Constructor and Description |
|---|
GatewayCmdUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copyFilesToSources(String sourcePath,
String destinationPath)
Copy files to resources directory
|
static void |
createDeploymentConfig(String projectName,
String deploymentConfPath)
Create initial deployment configuration file.
|
static void |
createProjectGWDistribution(String projectName)
Create a micro gateway distribution for the provided project name
|
static void |
createProjectStructure(String projectName)
Create a project structure for a particular project name.
|
static CliLauncherException |
createUsageException(String errorMsg)
Create usage exception
|
static String |
decrypt(String value,
String secret)
Decrypt given value with provided secret
|
static void |
deleteProject(String projectPath)
Delete project folder
|
static String |
encrypt(String value,
String secret)
Encrypt given value with provided secret
|
static String |
getCLIHome()
Get cli home location
|
static CodeGenerationContext |
getCodeGenerationContext() |
static Config |
getConfig() |
static ContainerConfig |
getContainerConfig() |
static APICorsConfigurationDTO |
getDefaultCorsConfig() |
static String |
getDeploymentConfigLocation(String projectName)
Returns location of the deployment configuration file of given project
|
static String |
getFiltersFolderLocation()
Get filters folder location
|
static String |
getLoggingPropertiesFileLocation()
Get resources file directory path
|
static String |
getMainConfigLocation()
Returns location of the main configuration file of given project root
|
static String |
getProjectDirectoryPath(String projectName)
Returns path to the given project in the current working directory
|
static String |
getProjectName(List<String> mainArgs)
Validate the list of main args and returns the first element as the project name
|
static String |
getProjectSrcDirectoryPath(String projectName)
Returns path to the /src of a given project in the current working directory
|
static String |
getUnixPath(String path)
Replace backslashes `\` in windows path string with forward slashes `/`
|
static String |
getUserDir()
Returns current user dir
|
static String |
loadStoredResourceHashes(String projectName)
Load the stored resource hash content from the CLI temp folder
|
static String |
makeFirstLetterLowerCase(String s)
Convert first letter to lower case
|
static String |
readFileAsString(String path,
boolean inResource)
Read file as string
|
static void |
saveConfig(Config config,
String configPath) |
static void |
setCodeGenerationContext(CodeGenerationContext codeGenerationContext) |
static void |
setConfig(Config configFromFile) |
static void |
setContainerConfig(ContainerConfig containerConfig) |
static void |
storeResourceHashesFileContent(String content,
String projectName)
Saves the resource hash content to the CLI temp folder
|
public static Config getConfig()
public static void setConfig(Config configFromFile)
public static void setCodeGenerationContext(CodeGenerationContext codeGenerationContext)
public static CodeGenerationContext getCodeGenerationContext()
public static String readFileAsString(String path, boolean inResource) throws IOException
path - to the fileinResource - whether file is in resources directory of jar or notIOException - if file read went wrongpublic static CliLauncherException createUsageException(String errorMsg)
errorMsg - error messagepublic static String makeFirstLetterLowerCase(String s)
s - stringpublic static String encrypt(String value, String secret)
value - value to encryptsecret - encryption keypublic static String decrypt(String value, String secret)
value - value to decryptsecret - decryption keypublic static String getUserDir()
public static String getCLIHome()
public static String getLoggingPropertiesFileLocation()
public static String getFiltersFolderLocation()
public static void createProjectStructure(String projectName)
projectName - name of the projectpublic static void createProjectGWDistribution(String projectName) throws IOException
projectName - name of the projectIOException - erro while creating micro gateway distributionpublic static String loadStoredResourceHashes(String projectName) throws IOException
projectName - name of the projectIOException - error while loading stored resource hash contentpublic static void storeResourceHashesFileContent(String content, String projectName) throws IOException
content - resource hash contentprojectName - name of the projectIOException - error while saving resource hash contentpublic static String getProjectName(List<String> mainArgs)
mainArgs - List of main args provided to the commandpublic static String getMainConfigLocation()
public static String getDeploymentConfigLocation(String projectName)
projectName - name of the projectpublic static String getProjectDirectoryPath(String projectName)
projectName - name of the projectpublic static String getProjectSrcDirectoryPath(String projectName)
projectName - name of the projectpublic static void copyFilesToSources(String sourcePath, String destinationPath) throws IOException
sourcePath - source directory pathdestinationPath - destionation directory pathIOException - if file copy went wrongpublic static void createDeploymentConfig(String projectName, String deploymentConfPath) throws IOException
projectName - project namedeploymentConfPath - path to deployment configIOException - if file create went wrongpublic static ContainerConfig getContainerConfig()
public static void setContainerConfig(ContainerConfig containerConfig)
public static APICorsConfigurationDTO getDefaultCorsConfig()
public static String getUnixPath(String path)
path - Location of a resource (file or directory)public static void deleteProject(String projectPath)
projectPath - project pathCopyright © 2018 WSO2. All rights reserved.