Method from org.apache.geronimo.deployment.plugin.local.CommandSupport Detail: |
protected synchronized void addModule(TargetModuleID moduleID) {
moduleIDs.add(moduleID);
}
|
public void addProgressListener(ProgressListener pol) {
ProgressEvent event;
synchronized (this) {
listeners.add(pol);
event = this.event;
}
if(event != null) {
pol.handleProgressEvent(event);
}
}
|
public static void addWebContextPaths(Kernel kernel,
List moduleIDs) throws Exception {
Set webApps = null;
for (int i = 0; i < moduleIDs.size(); i++) {
TargetModuleIDImpl id = (TargetModuleIDImpl) moduleIDs.get(i);
if(id.getType() != null && id.getType().getValue() == ModuleType.WAR.getValue()) {
if(webApps == null) {
webApps = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.management.geronimo.WebModule"));
}
for (Iterator it = webApps.iterator(); it.hasNext();) {
AbstractName name = (AbstractName) it.next();
if(name.getName().get("name").equals(id.getModuleID())) {
id.setWebURL(kernel.getAttribute(name, "contextPath").toString());
break;
}
}
}
if(id.getChildTargetModuleID() != null) {
addWebContextPaths(kernel, Arrays.asList(id.getChildTargetModuleID()));
}
}
}
Given a list of TargetModuleIDs, figure out which ones represent web
modules and add a WebURL to each if possible. |
protected void addWebURLs(Kernel kernel) throws Exception {
addWebContextPaths(kernel, moduleIDs);
}
|
public void cancel() throws OperationUnsupportedException {
throw new OperationUnsupportedException("cancel not supported");
}
|
protected static String clean(String value) {
if(value.startsWith("\"") && value.endsWith("\"")) {
return value.substring(1, value.length()-1);
}
return value;
}
|
protected final void complete(String message) {
sendEvent(message, StateType.COMPLETED);
}
|
public static ModuleType convertModuleType(ConfigurationModuleType type) {
if(type.getValue() == ConfigurationModuleType.WAR.getValue()) {
return ModuleType.WAR;
}
if(type.getValue() == ConfigurationModuleType.RAR.getValue()) {
return ModuleType.RAR;
}
if(type.getValue() == ConfigurationModuleType.EJB.getValue()) {
return ModuleType.EJB;
}
if(type.getValue() == ConfigurationModuleType.EAR.getValue()) {
return ModuleType.EAR;
}
if(type.getValue() == ConfigurationModuleType.CAR.getValue()) {
return ModuleType.CAR;
}
return null;
}
|
public void doFail(Throwable e) {
if (e instanceof InternalKernelException) {
Exception test = (Exception)e.getCause();
if(test != null) {
e = test;
}
}
if (commandContext.isLogErrors()) {
System.err.println("Deployer operation failed: " + e.getMessage());
if (commandContext.isVerbose()) {
e.printStackTrace(System.err);
}
}
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
printWriter.println(e.getMessage());
if (commandContext.isVerbose()) {
e.printStackTrace(printWriter);
} else {
Throwable throwable = e;
while (null != (throwable = throwable.getCause())) {
printWriter.println("\t" + throwable.getMessage());
}
}
fail(writer.toString());
}
|
public final void fail(String message) {
sendEvent(message, StateType.FAILED);
}
|
public ClientConfiguration getClientConfiguration(TargetModuleID id) {
return null;
}
|
public CommandContext getCommandContext() {
return commandContext;
}
|
public synchronized DeploymentStatus getDeploymentStatus() {
return new Status(command, action, state, message);
}
|
protected synchronized int getModuleCount() {
return moduleIDs.size();
}
|
public synchronized TargetModuleID[] getResultTargetModuleIDs() {
return (TargetModuleID[]) moduleIDs.toArray(new TargetModuleID[moduleIDs.size()]);
}
|
public boolean isCancelSupported() {
return false;
}
|
public boolean isStopSupported() {
return false;
}
|
public static boolean isWebApp(Kernel kernel,
String configName) {
Map filter = new HashMap();
filter.put("j2eeType", "WebModule");
filter.put("name", configName);
Set set = kernel.listGBeans(new AbstractNameQuery(null, filter));
return set.size() > 0;
}
|
public static List loadChildren(Kernel kernel,
String configName) {
List kids = new ArrayList();
Map filter = new HashMap();
filter.put("J2EEApplication", configName);
filter.put("j2eeType", "WebModule");
Set test = kernel.listGBeans(new AbstractNameQuery(null, filter));
for (Iterator it = test.iterator(); it.hasNext();) {
AbstractName child = (AbstractName) it.next();
String childName = child.getNameProperty("name");
kids.add(childName);
}
filter.put("j2eeType", "EJBModule");
test = kernel.listGBeans(new AbstractNameQuery(null, filter));
for (Iterator it = test.iterator(); it.hasNext();) {
AbstractName child = (AbstractName) it.next();
String childName = child.getNameProperty("name");
kids.add(childName);
}
filter.put("j2eeType", "AppClientModule");
test = kernel.listGBeans(new AbstractNameQuery(null, filter));
for (Iterator it = test.iterator(); it.hasNext();) {
AbstractName child = (AbstractName) it.next();
String childName = child.getNameProperty("name");
kids.add(childName);
}
filter.put("j2eeType", "ResourceAdapterModule");
test = kernel.listGBeans(new AbstractNameQuery(null, filter));
for (Iterator it = test.iterator(); it.hasNext();) {
AbstractName child = (AbstractName) it.next();
String childName = child.getNameProperty("name");
kids.add(childName);
}
return kids;
}
|
public synchronized void removeProgressListener(ProgressListener pol) {
listeners.remove(pol);
}
|
public void setCommandContext(CommandContext commandContext) {
this.commandContext = new CommandContext(commandContext);
}
|
public void stop() throws OperationUnsupportedException {
throw new OperationUnsupportedException("stop not supported");
}
|
public final void updateStatus(String message) {
sendEvent(message, state);
}
|