Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pack config file into the capp #146

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions vscode-car-plugin/src/main/java/org/wso2/maven/CAppHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ void processResourcesFolder(File resourcesFolder, String archiveDirectory, List<
processConnectors(resourcesFolder, archiveDirectory, dependencies);
processRegistryResources(resourcesFolder, archiveDirectory, dependencies);
processMetadata(resourcesFolder, archiveDirectory, metadataDependencies, version);
processPropertyFile(resourcesFolder, archiveDirectory, version, dependencies);
}

/**
Expand Down Expand Up @@ -203,6 +204,20 @@ void processConnectors(File resourcesFolder, String archiveDirectory, List<Artif
}
}

void processPropertyFile(File resourcesFolder, String archiveDirectory, String version,
List<ArtifactDependency> dependencies) {
File confFolder = new File(resourcesFolder, Constants.CONF_DIR_NAME);
File propertyFile = new File(confFolder, Constants.PROPERTY_FILE);
if (!propertyFile.exists()) {
return;
}
mojoInstance.logInfo("Processing property file in " + confFolder.getAbsolutePath());
writeArtifactAndFile(propertyFile, archiveDirectory, Constants.PROPERTY_FILE_NAME, Constants.PROPERTY_TYPE,
Constants.SERVER_ROLE_EI, version, Constants.PROPERTY_FILE,
Constants.PROPERTY_FILE_NAME + "_" + version);
dependencies.add(new ArtifactDependency(Constants.PROPERTY_FILE_NAME, version, Constants.SERVER_ROLE_EI, true));
}

/**
* Method to process registry resources in the resources folder and create corresponding files in the archive directory.
*
Expand Down
4 changes: 4 additions & 0 deletions vscode-car-plugin/src/main/java/org/wso2/maven/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Constants {
static final String TASKS_DIR_NAME = "tasks";
static final String TEMPLATES_DIR_NAME = "templates";
static final String DATASOURCE_DIR_NAME = "data-sources";
static final String CONF_DIR_NAME = "conf";
static final String DATASERVICES_DIR_NAME = "data-services";
static final String METADATA_DIR_NAME = "metadata";
static final String CONNECTORS_DIR_NAME = "connectors";
Expand All @@ -52,6 +53,7 @@ class Constants {
static final String DATASOURCE_TYPE = "datasource/datasource";
static final String DATASERVICE_TYPE = "service/dataservice";
static final String REG_RESOURCE_TYPE = "registry/resource";
static final String PROPERTY_TYPE = "config/property";
static final String CONNECTOR_TYPE = "synapse/lib";
static final String METADATA_TYPE = "synapse/metadata";
static final String CAPP_TYPE = "carbon/application";
Expand Down Expand Up @@ -83,6 +85,8 @@ class Constants {
static final String RESOURCES = "resources";
static final String ARCHIVE_EXCEPTION_MSG = "Error occurred while creating CAR file.";
static final String ARTIFACT_XML = "artifact.xml";
static final String PROPERTY_FILE = "config.properties";
static final String PROPERTY_FILE_NAME = "config";
static final String EMPTY_STRING = "";
static final String MAIN_SEQUENCE = "mainSequence";
static final String TEMP_TARGET_DIR_NAME = "tmp";
Expand Down