*
* @return The return value from the command.
* @exception Exception
*/
protected Object doExecute(ServerConnection connection) throws Exception {
CommandListConfigurations command = new CommandListConfigurations();
if (mode == null) {
println("Available custom assembly modes:");
println(" 1: Function Centric");
println(" 2: Application Centric");
println(" 3: Expert Users");
mode = readLine("Please select a custom assembly mode [1,2,3]").trim();
if (mode == null || (mode.compareTo("1") != 0 && mode.compareTo("2") != 0 && mode.compareTo("3") != 0)) {
throw new IllegalArgumentException("Please enter a valid Assembly server mode");
}
}
if (group == null) {
group = readLine("Assembly server group name: ").trim();
if (group.equals("")) {
throw new IllegalArgumentException("Assembly server group name is required");
}
}
if (artifact == null) {
artifact = readLine("Assembly server artifact name: ").trim();
if (artifact.equals("")) {
throw new IllegalArgumentException("Assembly server artifact name is required");
}
}
PluginListType plugins = (PluginListType)session.get("LocalPlugins");
if (refreshList || plugins == null) {
plugins = command.getLocalPluginCategories((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
session.put("LocalPlugins", plugins);
}
if (pluginArtifacts != null) {
command.assembleServer((GeronimoDeploymentManager)connection.getDeploymentManager(), pluginArtifacts, plugins, "repository", relativeServerPath, this);
((GeronimoDeploymentManager)connection.getDeploymentManager()).archive(relativeServerPath, "var/temp", new Artifact(group, artifact, (String)version, format));
} else {
PluginListType pluginsToInstall;
if (mode.compareTo("1") == 0) {
println("Listing plugin groups and application plugins from the local Geronimo server");
PluginListType pluginGroups = (PluginListType)session.get("LocalPluginGroups");
PluginListType appPlugins = (PluginListType)session.get("LocalAppPlugins");
if (refreshList || pluginGroups == null) {
pluginGroups = command.getLocalPluginGroups((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
session.put("LocalPluginGroups", pluginGroups);
}
if (refreshList || appPlugins == null) {
appPlugins = command.getLocalApplicationPlugins((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
session.put("LocalAppPlugins", appPlugins);
}
pluginsToInstall = command.getInstallList(pluginGroups, appPlugins, this, null);
} else if (mode.compareTo("2") == 0) {
println("Listing application plugins and required framework plugin group from the local Geronimo server");
PluginListType appPlugins = (PluginListType)session.get("LocalAppPlugins");
if (refreshList || appPlugins == null) {
appPlugins = command.getLocalApplicationPlugins((GeronimoDeploymentManager)connection.getDeploymentManager(), this);
session.put("LocalAppPlugins", appPlugins);
}
pluginsToInstall = command.getInstallList(appPlugins, this, null);
} else {
println("Listing plugins from the local Geronimo server");
pluginsToInstall = command.getInstallList(plugins, this, null);
}
if (pluginsToInstall == null) {
command.assembleServer((GeronimoDeploymentManager)connection.getDeploymentManager(), pluginsToInstall, "repository", relativeServerPath, this);
((GeronimoDeploymentManager)connection.getDeploymentManager()).archive(relativeServerPath, "var/temp", new Artifact(group, artifact, (String)version, format));
}
}
return null;
}