geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r560010 - in /geronimo/server/trunk: applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/ configs/...
Date Thu, 26 Jul 2007 21:49:44 GMT
Author: djencks
Date: Thu Jul 26 14:49:43 2007
New Revision: 560010

URL: http://svn.apache.org/viewvc?view=rev&rev=560010
Log:
GERONIMO-3350 get rid of questionable getURLFor method

Modified:
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
    geronimo/server/trunk/configs/geronimo-gbean-deployer/src/plan/plan.xml
    geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
    geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
    geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
    geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
    geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java
    geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
Thu Jul 26 14:49:43 2007
@@ -282,7 +282,6 @@
                     WebModule webModule = (WebModule) PortletManager.getModule(renderRequest,
info.getConfigID());
                     if (webModule != null) {
                         details.setContextPath(webModule.getContextPath());
-                        details.setUrlFor(webModule.getURLFor());
                     }
                 }
                 try {
@@ -384,7 +383,6 @@
         private final Artifact configId;
         private final ConfigurationModuleType type;
         private final State state;
-        private URL urlFor;             // only relevant for webapps
         private String contextPath;     // only relevant for webapps
         private List parents = new ArrayList();
         private List children = new ArrayList();
@@ -419,16 +417,8 @@
             return state;
         }
 
-        public URL getUrlFor() {
-            return urlFor;
-        }
-
         public String getContextPath() {
             return contextPath;
-        }
-
-        public void setUrlFor(URL urlFor) {
-            this.urlFor = urlFor;
         }
 
         public void setContextPath(String contextPath) {

Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
(original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/webapp/WEB-INF/view/configmanager/normal.jsp
Thu Jul 26 14:49:43 2007
@@ -42,7 +42,7 @@
     <tr>
         <td class="${backgroundClass}">&nbsp;${moduleDetails.configId}</td>
         <c:if test="${showWebInfo}">
-            <td class="${backgroundClass}">&nbsp;<c:if test="${moduleDetails.state.running}"><a
href="${moduleDetails.urlFor}">${moduleDetails.contextPath}</a></c:if></td>
+            <td class="${backgroundClass}">&nbsp;<c:if test="${moduleDetails.state.running}"><a
href="${moduleDetails.contextPath}">${moduleDetails.contextPath}</a></c:if></td>
         </c:if>
         <td width="100" class="${backgroundClass}">&nbsp;${moduleDetails.state}</td>
         <td width="75" class="${backgroundClass}">

Modified: geronimo/server/trunk/configs/geronimo-gbean-deployer/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/geronimo-gbean-deployer/src/plan/plan.xml?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/configs/geronimo-gbean-deployer/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/geronimo-gbean-deployer/src/plan/plan.xml Thu Jul 26 14:49:43
2007
@@ -20,6 +20,7 @@
     
     <!-- Deployer used to process modules and plans -->
     <gbean name="Deployer" class="org.apache.geronimo.deployment.Deployer">
+        <attribute name="remoteDeployAddress">localhost:8080</attribute>
         <reference name="Store">
             <!--<pattern><gbean-name>*:j2eeType=ConfigurationStore,*</gbean-name></pattern>-->
          </reference>

Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/jmx/JMXDeploymentManager.java
Thu Jul 26 14:49:43 2007
@@ -174,7 +174,7 @@
                     }
                 }
             }
-            CommandSupport.addWebURLs(kernel, result);
+            CommandSupport.addWebContextPaths(kernel, result);
             return result.size() == 0 ? null : result.toArray(new TargetModuleID[result.size()]);
         } catch (Exception e) {
             throw (TargetException) new TargetException(e.getMessage()).initCause(e);

Modified: geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/CommandSupport.java
Thu Jul 26 14:49:43 2007
@@ -274,14 +274,14 @@
     }
 
     protected void addWebURLs(Kernel kernel) throws Exception{
-        addWebURLs(kernel, moduleIDs);
+        addWebContextPaths(kernel, moduleIDs);
     }
 
     /**
      * Given a list of TargetModuleIDs, figure out which ones represent web
      * modules and add a WebURL to each if possible.
      */
-    public static void addWebURLs(Kernel kernel, List moduleIDs) throws Exception{
+    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);
@@ -292,12 +292,12 @@
                 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, "URLFor").toString());
+                        id.setWebURL(kernel.getAttribute(name, "contextPath").toString());
                     }
                 }
             }
             if(id.getChildTargetModuleID() != null) {
-                addWebURLs(kernel, Arrays.asList(id.getChildTargetModuleID()));
+                addWebContextPaths(kernel, Arrays.asList(id.getChildTargetModuleID()));
             }
         }
     }

Modified: geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
Thu Jul 26 14:49:43 2007
@@ -67,14 +67,15 @@
     private final int REAPER_INTERVAL = 60 * 1000;
     private final Properties pendingDeletionIndex = new Properties();
     private DeployerReaper reaper;
+    private final String remoteDeployAddress;
     private final Collection builders;
     private final Collection stores;
     private final Collection watchers;
     private final ArtifactResolver artifactResolver;
     private final Kernel kernel;
 
-    public Deployer(Collection builders, Collection stores, Collection watchers, Kernel kernel)
{
-        this(builders, stores, watchers, getArtifactResolver(kernel), kernel);
+    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection
watchers, Kernel kernel) {
+        this(remoteDeployAddress, builders, stores, watchers, getArtifactResolver(kernel),
kernel);
     }
 
     private static ArtifactResolver getArtifactResolver(Kernel kernel) {
@@ -82,7 +83,8 @@
         return configurationManager.getArtifactResolver();
     }
 
-    public Deployer(Collection builders, Collection stores, Collection watchers, ArtifactResolver
artifactResolver, Kernel kernel) {
+    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection
watchers, ArtifactResolver artifactResolver, Kernel kernel) {
+        this.remoteDeployAddress = remoteDeployAddress;
         this.builders = builders;
         this.stores = stores;
         this.watchers = watchers;
@@ -177,7 +179,7 @@
                 return null;
             }
             AbstractName module = (AbstractName) names.iterator().next();
-            return kernel.getAttribute(module, "URLFor") + "/upload";
+            return remoteDeployAddress + "/" + kernel.getAttribute(module, "contextPath")
+ "/upload";
         } catch (Exception e) {
             log.error("Unable to look up remote deploy upload URL", e);
             return null;
@@ -473,6 +475,7 @@
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Deployer.class, DEPLOYER);
 
         infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addAttribute("remoteDeployAddress", String.class, true, true);
         infoFactory.addAttribute("remoteDeployUploadURL", String.class, false);
         infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class});
         infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class,
String.class});
@@ -482,7 +485,7 @@
         infoFactory.addReference("Store", ConfigurationStore.class, "ConfigurationStore");
         infoFactory.addReference("Watchers", DeploymentWatcher.class);
 
-        infoFactory.setConstructor(new String[]{"Builders", "Store", "Watchers", "kernel"});
+        infoFactory.setConstructor(new String[]{"remoteDeployAddress", "Builders", "Store",
"Watchers", "kernel"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty6/src/main/java/org/apache/geronimo/jetty6/JettyWebAppContext.java
Thu Jul 26 14:49:43 2007
@@ -282,35 +282,6 @@
         return jettyContainer;
     }
 
-    public URL getURLFor() {
-        WebConnector[] connectors = (WebConnector[]) jettyContainer.getConnectors();
-        Map<String, String> map = new HashMap<String, String>();
-        for (WebConnector connector : connectors) {
-            map.put(connector.getProtocol(), connector.getConnectUrl());
-        }
-        String urlPrefix;
-        if ((urlPrefix = map.get("HTTP")) == null) {
-            if ((urlPrefix = map.get("HTTPS")) == null) {
-                urlPrefix = map.get("AJP");
-            }
-        }
-        if (urlPrefix == null) {
-            return null;
-        }
-        StringBuffer buf = new StringBuffer(urlPrefix);
-        String contextPath = getContextPath();
-        if (!contextPath.startsWith("/")) {
-            buf.append("/");
-        }
-        buf.append(contextPath);
-        try {
-            return new URL(buf.toString());
-        } catch (MalformedURLException e) {
-            log.error("Bad URL to connect to web app", e);
-            return null;
-        }
-    }
-
     public void setContextPath(String path) {
         if (path == null || !path.startsWith("/")) {
             throw new IllegalArgumentException("context path must be non-null and start with
'/', not " + path);

Modified: geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
(original)
+++ geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/WebModule.java
Thu Jul 26 14:49:43 2007
@@ -36,13 +36,6 @@
     public WebContainer getContainer();
 
     /**
-     * Gets a URL that can be used to access this web application.  Prefers
-     * HTTP if available, then HTTPS, then AJP, depending on what the hosting
-     * web container makes available.
-     */
-    public URL getURLFor();
-
-    /**
      * Gets a name for this WAR file that can be used to identify the WAR to a
      * user.  This is not guaranteed to be anything in particular.
      */

Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java
(original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/StartupMonitorUtil.java
Thu Jul 26 14:49:43 2007
@@ -57,7 +57,7 @@
                     apps.add("    " + decodeModule(name.getNameProperty("j2eeType")) + ":
" + name.getNameProperty("name"));
                 }
                 if (isWebModule(name)) {
-                    webs.add(kernel.getAttribute(name, "URLFor").toString());
+                    webs.add(kernel.getAttribute(name, "contextPath").toString());
                 }
 
                 int stateValue = kernel.getGBeanState(name);

Modified: geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?view=diff&rev=560010&r1=560009&r2=560010
==============================================================================
--- geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
(original)
+++ geronimo/server/trunk/modules/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
Thu Jul 26 14:49:43 2007
@@ -390,40 +390,6 @@
         this.context = context;
     }
 
-    public URL getURLFor() {
-        //BAD BAD BAD! This is a nasty hack.  The web application should NOT know its connection
url since
-        //connector != web application.  This should be changed to only return a String context
and not a URL
-        try {
-            return new URL("http://localhost" + getContextPath());
-        } catch (MalformedURLException e) {
-            log.error("Bad URL to connect to web app", e);
-            return null;
-        }
-        /**
-        TomcatWebConnector[] connectors = (TomcatWebConnector[]) container.getConnectors();
-        Map map = new HashMap();
-        for (int i = 0; i < connectors.length; i++) {
-            TomcatWebConnector connector = connectors[i];
-            map.put(connector.getProtocol(), connector.getConnectUrl());
-        }
-        String urlPrefix;
-        if((urlPrefix = (String) map.get("HTTP")) == null) {
-            if((urlPrefix = (String) map.get("HTTPS")) == null) {
-                urlPrefix = (String) map.get("AJP");
-            }
-        }
-        if(urlPrefix == null) {
-            return null;
-        }
-        try {
-            return new URL(urlPrefix + getContextPath());
-        } catch (MalformedURLException e) {
-            log.error("Bad URL to connect to web app", e);
-            return null;
-        }
-        **/
-    }
-
     public String getContextPath() {
         return path;
     }



Mime
View raw message