Skip to content

Commit 8c891a9

Browse files
committed
Merge branch 'wdt-798' into 'main'
Adding support for WRC extension provisioning See merge request weblogic-cloud/weblogic-deploy-tooling!1557
2 parents 6ec0bd1 + 461389b commit 8c891a9

21 files changed

+853
-74
lines changed

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/add/AddCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
AddSharedLibraryCommand.class,
3535
AddSharedLibraryPlanCommand.class,
3636
AddStructuredApplicationCommand.class,
37+
AddWebLogicRemoteConsoleExtensionCommand.class
3738
}
3839
)
3940
public class AddCommand {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates.
3+
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
*/
5+
package oracle.weblogic.deploy.tool.archive_helper.add;
6+
7+
import java.io.File;
8+
9+
import oracle.weblogic.deploy.logging.PlatformLogger;
10+
import oracle.weblogic.deploy.logging.WLSDeployLogFactory;
11+
import oracle.weblogic.deploy.tool.archive_helper.ArchiveHelperException;
12+
import oracle.weblogic.deploy.tool.archive_helper.CommandResponse;
13+
import oracle.weblogic.deploy.util.ExitCode;
14+
import oracle.weblogic.deploy.util.WLSDeployArchiveIOException;
15+
16+
import picocli.CommandLine.Command;
17+
import picocli.CommandLine.Option;
18+
19+
import static oracle.weblogic.deploy.tool.ArchiveHelper.LOGGER_NAME;
20+
21+
@Command(
22+
name = "weblogicRemoteConsoleExtension",
23+
header = "Add the WebLogic Remote Console Extension file to the archive file.",
24+
description = "%nCommand-line options:"
25+
)
26+
public class AddWebLogicRemoteConsoleExtensionCommand extends AddTypeCommandBase {
27+
private static final String CLASS = AddScriptCommand.class.getName();
28+
private static final PlatformLogger LOGGER = WLSDeployLogFactory.getLogger(LOGGER_NAME);
29+
private static final String TYPE = "WebLogic Remote Console Extension file";
30+
31+
@Option(
32+
names = {"-source"},
33+
paramLabel = "<path>",
34+
description = "File system path to the WebLogic Remote Console Extension file to add",
35+
required = true
36+
)
37+
private String sourcePath;
38+
39+
@Override
40+
public CommandResponse call() throws Exception {
41+
final String METHOD = "call";
42+
LOGGER.entering(CLASS, METHOD);
43+
44+
CommandResponse response;
45+
File sourceFile;
46+
try {
47+
sourceFile = initializeOptions(this.sourcePath);
48+
49+
String resultName;
50+
if (this.overwrite) {
51+
resultName = this.archive.replaceWrcExtensionFile(sourceFile.getName(), sourceFile.getPath());
52+
} else {
53+
resultName = this.archive.addWrcExtensionFile(sourceFile.getPath());
54+
}
55+
response = new CommandResponse(ExitCode.OK, resultName);
56+
} catch (ArchiveHelperException ex) {
57+
LOGGER.severe("WLSDPLY-30010", ex, TYPE, this.sourcePath,
58+
this.archiveFilePath, ex.getLocalizedMessage());
59+
response = new CommandResponse(ex.getExitCode(), "WLSDPLY-30010", TYPE,
60+
this.sourcePath, this.archiveFilePath, ex.getLocalizedMessage());
61+
} catch (WLSDeployArchiveIOException | IllegalArgumentException ex) {
62+
LOGGER.severe("WLSDPLY-30011", ex, TYPE, this.sourcePath,
63+
this.overwrite, this.archiveFilePath, ex.getLocalizedMessage());
64+
response = new CommandResponse(ExitCode.ERROR, "WLSDPLY-30011", TYPE,
65+
this.sourcePath, this.overwrite, this.archiveFilePath, ex.getLocalizedMessage());
66+
}
67+
68+
LOGGER.exiting(CLASS, METHOD, response);
69+
return response;
70+
}
71+
}

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/extract/ExtractCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
ExtractServerKeystoreCommand.class,
3535
ExtractSharedLibraryCommand.class,
3636
ExtractSharedLibraryPlanCommand.class,
37-
ExtractStructuredApplicationCommand.class
37+
ExtractStructuredApplicationCommand.class,
38+
ExtractWebLogicRemoteConsoleExtensionCommand.class
3839
}
3940
)
4041
public class ExtractCommand {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates.
3+
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
*/
5+
package oracle.weblogic.deploy.tool.archive_helper.extract;
6+
7+
import oracle.weblogic.deploy.logging.PlatformLogger;
8+
import oracle.weblogic.deploy.logging.WLSDeployLogFactory;
9+
import oracle.weblogic.deploy.tool.archive_helper.ArchiveHelperException;
10+
import oracle.weblogic.deploy.tool.archive_helper.CommandResponse;
11+
import oracle.weblogic.deploy.util.ExitCode;
12+
import oracle.weblogic.deploy.util.WLSDeployArchiveIOException;
13+
14+
import picocli.CommandLine.Command;
15+
import picocli.CommandLine.Option;
16+
17+
import static oracle.weblogic.deploy.tool.ArchiveHelper.LOGGER_NAME;
18+
19+
@Command(
20+
name = "weblogicRemoteConsoleExtension",
21+
header = "Extract WebLogic Remote Console Extension file from the archive file.",
22+
description = "%nCommand-line options:"
23+
)
24+
public class ExtractWebLogicRemoteConsoleExtensionCommand extends ExtractTypeCommandBase {
25+
private static final String CLASS = ExtractWebLogicRemoteConsoleExtensionCommand.class.getName();
26+
private static final PlatformLogger LOGGER = WLSDeployLogFactory.getLogger(LOGGER_NAME);
27+
private static final String TYPE = "WebLogic Remote Console Extension file";
28+
private static final String ERROR_KEY = "WLSDPLY-30047";
29+
30+
@Option(
31+
names = {"-name"},
32+
description = "Name of the WebLogic Remote Console Extension file to be extracted from the archive file",
33+
required = true
34+
)
35+
private String name;
36+
37+
@Override
38+
public CommandResponse call() throws Exception {
39+
final String METHOD = "call";
40+
LOGGER.entering(CLASS, METHOD);
41+
42+
CommandResponse response;
43+
try {
44+
initializeOptions();
45+
46+
this.archive.extractWrcExtensionFile(this.name, this.targetDirectory);
47+
response = new CommandResponse(ExitCode.OK, "WLSDPLY-30046", TYPE, this.name,
48+
this.archiveFilePath, this.targetDirectory.getPath());
49+
} catch (ArchiveHelperException ex) {
50+
LOGGER.severe(ERROR_KEY, ex, TYPE, this.name, this.archiveFilePath,
51+
this.targetDirectory.getPath(), ex.getLocalizedMessage());
52+
response = new CommandResponse(ex.getExitCode(), ERROR_KEY, TYPE, this.name,
53+
this.archiveFilePath, this.targetDirectory.getPath(), ex.getLocalizedMessage());
54+
} catch (WLSDeployArchiveIOException | IllegalArgumentException ex) {
55+
LOGGER.severe(ERROR_KEY, ex, TYPE, this.name, this.archiveFilePath,
56+
this.targetDirectory.getPath(), ex.getLocalizedMessage());
57+
response = new CommandResponse(ExitCode.ERROR, ERROR_KEY, TYPE, this.name,
58+
this.archiveFilePath, this.targetDirectory.getPath(), ex.getLocalizedMessage());
59+
}
60+
61+
LOGGER.exiting(CLASS, METHOD, response);
62+
return response;
63+
}
64+
}

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/list/ListCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
ListScriptCommand.class,
3232
ListServerKeystoreCommand.class,
3333
ListSharedLibraryCommand.class,
34-
ListStructuredApplicationCommand.class
34+
ListStructuredApplicationCommand.class,
35+
ListWebLogicRemoteConsoleExtensionCommand.class
3536
}
3637
)
3738
public class ListCommand {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates.
3+
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
*/
5+
package oracle.weblogic.deploy.tool.archive_helper.list;
6+
7+
import oracle.weblogic.deploy.logging.PlatformLogger;
8+
import oracle.weblogic.deploy.logging.WLSDeployLogFactory;
9+
import oracle.weblogic.deploy.tool.archive_helper.CommandResponse;
10+
11+
import picocli.CommandLine.Command;
12+
import picocli.CommandLine.Option;
13+
14+
import static oracle.weblogic.deploy.tool.ArchiveHelper.LOGGER_NAME;
15+
import static oracle.weblogic.deploy.util.WLSDeployArchive.ArchiveEntryType.WEBLOGIC_REMOTE_CONSOLE_EXTENSION;
16+
17+
@Command(
18+
name = "weblogicRemoteConsoleExtension",
19+
header = "List WebLogic Remote Console Extension entries in the archive file.",
20+
description = "%nCommand-line options:"
21+
)
22+
public class ListWebLogicRemoteConsoleExtensionCommand extends ListTypeCommandBase {
23+
private static final String CLASS = ListWebLogicRemoteConsoleExtensionCommand.class.getName();
24+
private static final PlatformLogger LOGGER = WLSDeployLogFactory.getLogger(LOGGER_NAME);
25+
26+
@Option(
27+
names = { "-name" },
28+
paramLabel = "<name>",
29+
description = "Name of the WebLogic Remote Console Extension file to list"
30+
)
31+
private String name;
32+
33+
@Override
34+
public CommandResponse call() throws Exception {
35+
final String METHOD = "call";
36+
LOGGER.entering(CLASS, METHOD);
37+
38+
CommandResponse response = listType(WEBLOGIC_REMOTE_CONSOLE_EXTENSION, "WebLogic Remote Console Extension file", name);
39+
40+
LOGGER.exiting(CLASS, METHOD, response);
41+
return response;
42+
}
43+
}

core/src/main/java/oracle/weblogic/deploy/tool/archive_helper/remove/RemoveCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
RemoveServerKeystoreCommand.class,
3434
RemoveSharedLibraryCommand.class,
3535
RemoveSharedLibraryPlanCommand.class,
36-
RemoveStructuredApplicationCommand.class
36+
RemoveStructuredApplicationCommand.class,
37+
RemoveWebLogicRemoteConsoleExtensionCommand.class
3738
}
3839
)
3940
public class RemoveCommand {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates.
3+
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
*/
5+
package oracle.weblogic.deploy.tool.archive_helper.remove;
6+
7+
import oracle.weblogic.deploy.logging.PlatformLogger;
8+
import oracle.weblogic.deploy.logging.WLSDeployLogFactory;
9+
import oracle.weblogic.deploy.tool.archive_helper.ArchiveHelperException;
10+
import oracle.weblogic.deploy.tool.archive_helper.CommandResponse;
11+
import oracle.weblogic.deploy.util.ExitCode;
12+
import oracle.weblogic.deploy.util.WLSDeployArchiveIOException;
13+
14+
import picocli.CommandLine.Command;
15+
import picocli.CommandLine.Option;
16+
17+
import static oracle.weblogic.deploy.tool.ArchiveHelper.LOGGER_NAME;
18+
19+
@Command(
20+
name = "weblogicRemoteConsoleExtension",
21+
header = "Remove WebLogic Remote Console Extension data file from the archive file.",
22+
description = "%nCommand-line options:"
23+
)
24+
public class RemoveWebLogicRemoteConsoleExtensionCommand extends RemoveTypeCommandBase {
25+
private static final String CLASS = RemoveWebLogicRemoteConsoleExtensionCommand.class.getName();
26+
private static final PlatformLogger LOGGER = WLSDeployLogFactory.getLogger(LOGGER_NAME);
27+
private static final String TYPE = "WebLogic Remote Console Extension file";
28+
29+
@Option(
30+
names = {"-name"},
31+
description = "Name of the WebLogic Remote Console Extension file to be removed from the archive file",
32+
required = true
33+
)
34+
private String name;
35+
36+
@Override
37+
public CommandResponse call() throws Exception {
38+
final String METHOD = "call";
39+
LOGGER.entering(CLASS, METHOD);
40+
41+
CommandResponse response;
42+
try {
43+
initializeOptions();
44+
45+
int entriesRemoved;
46+
if (this.force) {
47+
entriesRemoved = this.archive.removeWrcExtensionFile(this.name, true);
48+
} else {
49+
entriesRemoved = this.archive.removeWrcExtensionFile(this.name);
50+
}
51+
response = new CommandResponse(ExitCode.OK, "WLSDPLY-30026", TYPE, this.name,
52+
entriesRemoved, this.archiveFilePath);
53+
} catch (ArchiveHelperException ex) {
54+
LOGGER.severe("WLSDPLY-30027", ex, TYPE, this.name, this.archiveFilePath, ex.getLocalizedMessage());
55+
response = new CommandResponse(ex.getExitCode(), "WLSDPLY-30027", TYPE, this.name,
56+
this.archiveFilePath, ex.getLocalizedMessage());
57+
} catch (WLSDeployArchiveIOException | IllegalArgumentException ex) {
58+
LOGGER.severe("WLSDPLY-30028", ex, TYPE, this.name, this.force,
59+
this.archiveFilePath, ex.getLocalizedMessage());
60+
response = new CommandResponse(ExitCode.ERROR, "WLSDPLY-30028", TYPE, this.name, this.force,
61+
this.archiveFilePath, ex.getLocalizedMessage());
62+
}
63+
64+
LOGGER.exiting(CLASS, METHOD, response);
65+
return response;
66+
}
67+
}

0 commit comments

Comments
 (0)