// Get the token GBean from the remote deployment configuration
Set set = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.deployment.remote.RemoteDeployToken"));
if (set.size() == 0) {
return null;
}
AbstractName token = (AbstractName) set.iterator().next();
// Identify the parent configuration for that GBean
set = kernel.getDependencyManager().getParents(token);
ObjectName config = null;
for (Iterator it = set.iterator(); it.hasNext();) {
AbstractName name = (AbstractName) it.next();
if (Configuration.isConfigurationObjectName(name.getObjectName())) {
config = name.getObjectName();
break;
}
}
if (config == null) {
log.warn("Unable to find remote deployment configuration; is the remote deploy web application running?");
return null;
}
// Generate the URL based on the remote deployment configuration
Hashtable hash = new Hashtable();
hash.put("J2EEApplication", token.getObjectName().getKeyProperty("J2EEApplication"));
hash.put("j2eeType", "WebModule");
try {
hash.put("name", Configuration.getConfigurationID(config).toString());
Set names = kernel.listGBeans(new AbstractNameQuery(null, hash));
if (names.size() != 1) {
log.error("Unable to look up remote deploy upload URL");
return null;
}
AbstractName module = (AbstractName) names.iterator().next();
String contextPath = (String) kernel.getAttribute(module, "contextPath");
if (null == contextPath) {
throw new IllegalStateException("Cannot find contextPath attribute for [" + module + "]");
}
String temp = remoteDeployAddress + "/" + contextPath + "/upload";