You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2005/12/09 00:20:17 UTC

svn commit: r355267 [1/2] - in /geronimo/trunk: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/ applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ applications/console-s...

Author: ammulder
Date: Thu Dec  8 15:20:03 2005
New Revision: 355267

URL: http://svn.apache.org/viewcvs?rev=355267&view=rev
Log:
Bug fixes and patches from yesterday's plane ride

GERONIMO-1128 -- FIXED Derby log viewer doesn't perform well and leaks file
                 handles
GERONIMO-1207 -- FIXED When you start a child configuration, the parent
                 is not started and the child is stuck in status "starting"
                 ConfigurationManager loadRecursive changed to only skip
                 configurations that are actually running (not any that it
                 finds which may be "present" but not loaded or running)
GERONIMO-1225 -- PATCH APPLIED Console welcome page URLs in console-standard
                 hardcode path to /console
GERONIMO-1272 -- PATCH APPLIED show name of connector when editing
GERONIMO-1274 -- FIXED Using certain portlets in Tomcat blows up due to
                 missing Jetty classes

Added:
    geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLog.java
    geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLogGBean.java
    geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/Log.java
Removed:
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogCriteria.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/logmanager/WebAccessLogHelper.java
Modified:
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
    geronimo/trunk/applications/console-standard/project.xml
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/JMSConnectionFactoryManagerPortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/derbylogmanager/view.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/logmanager/search.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTP.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/normal.jsp
    geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/welcome/welcomeNormal.jsp
    geronimo/trunk/assemblies/j2ee-installer/src/var/log/server-log4j.properties   (contents, props changed)
    geronimo/trunk/assemblies/j2ee-jetty-server/src/var/log/server-log4j.properties   (contents, props changed)
    geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/log/server-log4j.properties   (contents, props changed)
    geronimo/trunk/configs/system-database/src/plan/plan.xml
    geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandStart.java
    geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/trunk/modules/derby/project.xml
    geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystem.java
    geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystemGBean.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
    geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManagerImpl.java
    geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/WebAccessLog.java

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java (original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/KernelManagementHelper.java Thu Dec  8 15:20:03 2005
@@ -16,66 +16,69 @@
  */
 package org.apache.geronimo.console.util;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import javax.security.auth.spi.LoginModule;
-import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.NameCallback;
-
-import org.apache.geronimo.management.J2EEDomain;
-import org.apache.geronimo.management.J2EEDeployedObject;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanQuery;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.j2ee.management.impl.Util;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.management.AppClientModule;
-import org.apache.geronimo.management.WebModule;
+import org.apache.geronimo.management.EJB;
 import org.apache.geronimo.management.EJBModule;
+import org.apache.geronimo.management.J2EEDeployedObject;
+import org.apache.geronimo.management.J2EEDomain;
+import org.apache.geronimo.management.J2EEModule;
 import org.apache.geronimo.management.J2EEResource;
+import org.apache.geronimo.management.JCAConnectionFactory;
 import org.apache.geronimo.management.JCAResource;
+import org.apache.geronimo.management.JDBCDataSource;
+import org.apache.geronimo.management.JDBCDriver;
 import org.apache.geronimo.management.JDBCResource;
 import org.apache.geronimo.management.JMSResource;
-import org.apache.geronimo.management.J2EEModule;
-import org.apache.geronimo.management.EJB;
-import org.apache.geronimo.management.Servlet;
 import org.apache.geronimo.management.ResourceAdapter;
-import org.apache.geronimo.management.JDBCDataSource;
-import org.apache.geronimo.management.JDBCDriver;
-import org.apache.geronimo.management.JCAConnectionFactory;
-import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.Servlet;
+import org.apache.geronimo.management.WebModule;
+import org.apache.geronimo.management.geronimo.EJBConnector;
+import org.apache.geronimo.management.geronimo.EJBManager;
 import org.apache.geronimo.management.geronimo.J2EEApplication;
+import org.apache.geronimo.management.geronimo.J2EEServer;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+import org.apache.geronimo.management.geronimo.JMSBroker;
+import org.apache.geronimo.management.geronimo.JMSConnector;
+import org.apache.geronimo.management.geronimo.JMSManager;
 import org.apache.geronimo.management.geronimo.JVM;
 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
-import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebAccessLog;
 import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.management.geronimo.WebContainer;
 import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.management.geronimo.WebAccessLog;
-import org.apache.geronimo.management.geronimo.EJBManager;
-import org.apache.geronimo.management.geronimo.EJBConnector;
-import org.apache.geronimo.management.geronimo.JMSManager;
-import org.apache.geronimo.management.geronimo.JMSBroker;
-import org.apache.geronimo.management.geronimo.JMSConnector;
-import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
-import org.apache.geronimo.j2ee.management.impl.Util;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.geronimo.kernel.proxy.ProxyManager;
-import org.apache.geronimo.system.logging.SystemLog;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
 import org.apache.geronimo.pool.GeronimoExecutor;
-import org.apache.geronimo.security.realm.SecurityRealm;
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
 import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.security.realm.SecurityRealm;
+import org.apache.geronimo.system.logging.SystemLog;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * An implementation of the ManagementHelper interface that uses a Geronimo
@@ -953,6 +956,17 @@
             module.abort();
         }
         return null;
+    }
+
+    public Object[] findByInterface(Class iface) {
+        Set set = kernel.listGBeans(new GBeanQuery(null, iface.getName()));
+        Object[] result = new Object[set.size()];
+        int i=0;
+        for (Iterator it = set.iterator(); it.hasNext();) {
+            ObjectName name = (ObjectName) it.next();
+            result[i++] = kernel.getProxyManager().createProxy(name, iface.getClassLoader());
+        }
+        return result;
     }
 
     /**

Modified: geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java (original)
+++ geronimo/trunk/applications/console-core/src/java/org/apache/geronimo/console/util/ManagementHelper.java Thu Dec  8 15:20:03 2005
@@ -16,10 +16,6 @@
  */
 package org.apache.geronimo.console.util;
 
-import java.util.Map;
-import javax.security.auth.spi.LoginModule;
-import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
 import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.geronimo.management.AppClientModule;
 import org.apache.geronimo.management.EJB;
@@ -52,10 +48,15 @@
 import org.apache.geronimo.management.geronimo.WebContainer;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
+import org.apache.geronimo.security.realm.SecurityRealm;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.security.realm.SecurityRealm;
-import org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean;
+
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import java.util.Map;
 
 /**
  * A helper interface to navigate between management objects.  This is not
@@ -151,6 +152,7 @@
     String getGBeanDescription(String objectName);
 
     // Misc
-   void testLoginModule(J2EEServer server, LoginModule module, Map options);
-   Subject testLoginModule(J2EEServer server, LoginModule module, Map options, String username, String password) throws LoginException;
+    void testLoginModule(J2EEServer server, LoginModule module, Map options);
+    Subject testLoginModule(J2EEServer server, LoginModule module, Map options, String username, String password) throws LoginException;
+    Object[] findByInterface(Class iface);
 }

Modified: geronimo/trunk/applications/console-standard/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/project.xml?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/project.xml (original)
+++ geronimo/trunk/applications/console-standard/project.xml Thu Dec  8 15:20:03 2005
@@ -32,6 +32,11 @@
          </dependency>
          <dependency>
              <groupId>geronimo</groupId>
+             <artifactId>geronimo-derby</artifactId>
+             <version>${pom.currentVersion}</version>
+         </dependency>
+         <dependency>
+             <groupId>geronimo</groupId>
              <artifactId>geronimo-deployment</artifactId>
              <version>${pom.currentVersion}</version>
          </dependency>

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java Thu Dec  8 15:20:03 2005
@@ -17,38 +17,35 @@
 
 package org.apache.geronimo.console.configmanager;
 
-import java.io.IOException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.ObjectName;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-
 import org.apache.geronimo.console.BasePortlet;
-import org.apache.geronimo.console.util.ObjectNameConstants;
 import org.apache.geronimo.console.util.SecurityConstants;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.NoSuchConfigException;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
 import org.apache.geronimo.kernel.management.State;
 
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 public class ConfigManagerPortlet extends BasePortlet {
 
     private static final String START_ACTION = "start";
@@ -100,11 +97,12 @@
             URI configID = URI.create(config);
 
             if (START_ACTION.equals(action)) {
-                if (!configurationManager.isLoaded(configID)) {
-                    configurationManager.load(configID);
+                List list = configurationManager.loadRecursive(configID);
+                for (Iterator it = list.iterator(); it.hasNext();) {
+                    URI uri = (URI) it.next();
+                    configurationManager.loadGBeans(uri);
+                    configurationManager.start(uri);
                 }
-                configurationManager.loadGBeans(configID);
-                configurationManager.start(configID);
                 messageStatus = "Started application<br /><br />";
             } else if (STOP_ACTION.equals(action)) {
                 configurationManager.stop(configID);

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseInfo.java Thu Dec  8 15:20:03 2005
@@ -30,9 +30,9 @@
     /**
      * todo: EVIL!!!  Should be replaced with something, somehow!
      */
-    private final static String TRANQL_RAR_NAME = "tranql/tranql-connector/1.0/rar";
-    private final static String DERBY_EMBEDDED_RAR_NAME = "tranql/tranql-connector-derby-embed-xa/1.0/rar";
-    private final static String DERBY_NETWORK_RAR_NAME = "tranql/tranql-connector-derby-client-xa/1.0/rar";
+    private final static String TRANQL_RAR_NAME = "tranql/tranql-connector/1.1-SNAPSHOT/rar";
+    private final static String DERBY_EMBEDDED_RAR_NAME = "tranql/tranql-connector-derby-embed-xa/1.1-SNAPSHOT/rar";
+    private final static String DERBY_NETWORK_RAR_NAME = "tranql/tranql-connector-derby-client-xa/1.1-SNAPSHOT/rar";
 
     //todo: Load this from a config file or something
     public static final DatabaseInfo[] ALL_DATABASES = new DatabaseInfo[]{

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/derbylogmanager/DerbyLogViewerPortlet.java Thu Dec  8 15:20:03 2005
@@ -17,18 +17,23 @@
 
 package org.apache.geronimo.console.derbylogmanager;
 
-import java.io.IOException;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.derby.DerbyLog;
 
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletContext;
 import javax.portlet.PortletException;
 import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSession;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-
-import org.apache.geronimo.console.BasePortlet;
+import javax.portlet.WindowState;
+import java.io.IOException;
+import java.io.Serializable;
 
 public class DerbyLogViewerPortlet extends BasePortlet {
+    private final static String CRITERIA_KEY = "org.apache.geronimo.console.derby.log.CRITERIA";
 
     protected PortletRequestDispatcher normalView;
 
@@ -41,28 +46,57 @@
     }
 
     protected void doHelp(RenderRequest renderRequest,
-            RenderResponse renderResponse) throws PortletException, IOException {
+                          RenderResponse renderResponse) throws PortletException, IOException {
         helpView.include(renderRequest, renderResponse);
     }
 
     protected void doView(RenderRequest renderRequest,
-            RenderResponse renderResponse) throws PortletException, IOException {
+                          RenderResponse renderResponse) throws PortletException, IOException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
         String action = renderRequest.getParameter("action");
+
+        DerbyLog log = (DerbyLog) PortletManager.getManagedBeans(renderRequest, DerbyLog.class)[0];//todo: what if it's not there?
+        Criteria criteria;
         if ("refresh".equals(action)) {
-            DerbyLogHelper.refresh();
+            criteria = (Criteria) renderRequest.getPortletSession(true).getAttribute(CRITERIA_KEY, PortletSession.PORTLET_SCOPE);
+        } else {
+            String startPos = renderRequest.getParameter("startPos");
+            String endPos = renderRequest.getParameter("endPos");
+            String maxRows = renderRequest.getParameter("maxRows");
+            String searchString = renderRequest.getParameter("searchString");
+            if(maxRows == null || maxRows.equals("")) {
+                maxRows = "10";
+            }
+            criteria = new Criteria();
+            criteria.max = new Integer(maxRows);
+            criteria.start = startPos == null || startPos.equals("") ? null : new Integer(startPos);
+            criteria.stop = endPos == null || endPos.equals("") ? null : new Integer(endPos);
+            criteria.text = searchString == null || searchString.equals("") ? null : searchString;
+            renderRequest.getPortletSession(true).setAttribute(CRITERIA_KEY, criteria, PortletSession.PORTLET_SCOPE);
         }
-        try {
-            renderRequest.setAttribute("logs", DerbyLogHelper.getLogs());
-            renderRequest.setAttribute("lines", new Integer(DerbyLogHelper
-                    .getLineCount()));
-            normalView.include(renderRequest, renderResponse);
-        } catch (Exception e) {
-            renderResponse.setContentType("text/html");
-            renderResponse.getWriter().println(
-                    "<b>Could not load portlet: " + e.getMessage()
-                            + "</b></br>");
-            throw new PortletException(e);
+
+        DerbyLog.SearchResults results = log.searchLog(criteria.start, criteria.stop,
+                         criteria.max, criteria.text);
+        renderRequest.setAttribute("searchResults", results.getResults());
+        renderRequest.setAttribute("lineCount", new Integer(results.getLineCount()));
+        renderRequest.setAttribute("startPos", criteria.start);
+        renderRequest.setAttribute("endPos", criteria.stop);
+        renderRequest.setAttribute("searchString", criteria.text);
+        renderRequest.setAttribute("maxRows", criteria.max);
+        if(results.isCapped()) {
+            renderRequest.setAttribute("capped", Boolean.TRUE);
         }
+
+        normalView.include(renderRequest, renderResponse);
+    }
+
+    private static class Criteria implements Serializable {
+        Integer max;
+        Integer start;
+        Integer stop;
+        String text;
     }
 
     public void init(PortletConfig portletConfig) throws PortletException {

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/JMSConnectionFactoryManagerPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/JMSConnectionFactoryManagerPortlet.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/JMSConnectionFactoryManagerPortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/JMSConnectionFactoryManagerPortlet.java Thu Dec  8 15:20:03 2005
@@ -17,15 +17,14 @@
 
 package org.apache.geronimo.console.jmsmanager;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.databasemanager.DataSourceInfo;
+import org.apache.geronimo.console.jmsmanager.activemqCF.ActiveMQConnectorHelper;
+import org.apache.geronimo.gbean.GAttributeInfo;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.jmx.JMXUtil;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -40,21 +39,21 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.WindowState;
-
-import org.apache.geronimo.console.BasePortlet;
-import org.apache.geronimo.console.databasemanager.DataSourceInfo;
-import org.apache.geronimo.console.jmsmanager.activemqCF.ActiveMQConnectorHelper;
-import org.apache.geronimo.gbean.GAttributeInfo;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.kernel.jmx.JMXUtil;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 public class JMSConnectionFactoryManagerPortlet extends BasePortlet {
 
     private final static ActiveMQConnectorHelper helper = new ActiveMQConnectorHelper();
 
-    private final static String PARENT_ID = "org/apache/geronimo/SystemJMS";
+    private final static String PARENT_ID = "geronimo/activemq-broker/1.0-SNAPSHOT/car";
 
     private final static String ADD_MODE = "addACF";
 
@@ -126,7 +125,7 @@
                         trimStr(acfName), trimStr(serverURL),
                         trimStr(userName), pword, trimStr(acfName),
                         trimStr(poolMaxSize), trimStr(blocking) };
-                helper.deployPlan(args);
+                helper.deployPlan(actionRequest, args);
                 // Set mode to list after creating the new ConnectionFactories
                 actionResponse.setRenderParameter("mode", "list");
             }
@@ -146,7 +145,7 @@
             return;
         }
 
-        List dependencies = helper.getDependencies();
+        List dependencies = helper.getDependencies(renderRequest);
         // pass them to the render request
         renderRequest.setAttribute("dependencies", (String[]) dependencies
                 .toArray(new String[dependencies.size()]));

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/activemqCF/ActiveMQConnectorHelper.java Thu Dec  8 15:20:03 2005
@@ -17,39 +17,38 @@
 
 package org.apache.geronimo.console.jmsmanager.activemqCF;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.console.util.ObjectNameConstants;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.ListableRepository;
+
+import javax.portlet.PortletRequest;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.console.util.ObjectNameConstants;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.KernelRegistry;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-
 public class ActiveMQConnectorHelper {
+    //todo: this class is horrible and needs to be burned!
+    private final static Log log = LogFactory.getLog(ActiveMQConnectorHelper.class);
 
-    private final static File REPO_FOLDER;
+    private static String MODULE_FILE;
 
-    private final static String PLAN_FILE;
-
-    private final static String MODULE_FILE;
-
-    private final static String ACTIVEMQ_RA = "/activemq/activemq-ra/3.2/rar";
-
-    private final static String PLAN_XML = "/activemq/rars/amqconnectorPlan.xml";
+    private final static String ACTIVEMQ_RAR = "repository/activemq/rars/activemq-ra-3.2.1.rar";
 
     private static final String LINE_SEP = System.getProperty("line.separator");
 
@@ -60,44 +59,12 @@
 
     private static final String DEPLOY_METHOD = "deploy";
 
-    private static final String[] REPO_ARGS = { URI.class.getName() };
-
-    private static final String GETURL_METHOD = "getURL";
-
-    static {
-        // Initialize static vars
-        REPO_FOLDER = getRepositoryFile();
-        MODULE_FILE = REPO_FOLDER.getAbsolutePath() + ACTIVEMQ_RA;
-        PLAN_FILE = REPO_FOLDER.getAbsolutePath() + PLAN_XML;
-    }
-
-    private static File getRepositoryFile() {
-        File repoFile = null;
-
-        try {
-            Kernel kernel = KernelRegistry.getSingleKernel();
-            URI uri = new URI(".");
-            URL rootURL = (URL) kernel.invoke(ObjectNameConstants.REPO_OBJECT_NAME, GETURL_METHOD,
-                    new Object[] {uri}, REPO_ARGS);
-            uri = new URI(rootURL.toString());
-            repoFile = new File(uri);
-        } catch (URISyntaxException e) {
-            System.out.println("ERROR: Invalid repository URL");
-            e.printStackTrace();
-        } catch (Exception e) {
-            System.out.println("ERROR: Problem getting repository location");
-            e.printStackTrace();
-        }
-
-        return repoFile;
-    }
-
     private static String getPlanTemplate() {
         StringBuffer sb = new StringBuffer();
         sb.append("<?xml version=\"1.0\"?>\n");
         sb
                 .append("<connector xmlns=\"http://geronimo.apache.org/xml/ns/j2ee/connector-1.0\"\n");
-        sb.append("    version=\"1.5\" configId=\"{0}\" parentId=\"{1}\">\n");
+        sb.append("    configId=\"{0}\" parentId=\"{1}\">\n");
         sb.append("  <resourceadapter>\n");
         sb.append("    <resourceadapter-instance>\n");
         sb.append("      <resourceadapter-name>{2}</resourceadapter-name>\n");
@@ -131,8 +98,6 @@
         sb.append("              <match-one/>\n");
         sb.append("            </single-pool>\n");
         sb.append("          </connectionmanager>\n");
-        sb
-                .append("          <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>\n");
         sb.append("        </connectiondefinition-instance>\n");
         sb.append("      </connection-definition>\n");
         sb.append("    </outbound-resourceadapter>\n");
@@ -142,12 +107,11 @@
         return sb.toString();
     }
 
-    private void savePlan(String filename, Object[] args) {
+    private void savePlan(File f, Object[] args) {
         MessageFormat mf = new MessageFormat(PLAN_TEMPLATE);
         String plan = mf.format(args);
 
         try {
-            File f = new File(filename);
             f.createNewFile();
             FileOutputStream fos = new FileOutputStream(f);
             OutputStreamWriter osw = new OutputStreamWriter(fos);
@@ -163,9 +127,18 @@
         }
     }
 
-    public void deployPlan(Object[] args) {
-        savePlan(PLAN_FILE, args);
-        deployPlan(new File(MODULE_FILE), new File(PLAN_FILE));
+    public void deployPlan(PortletRequest request, Object[] args) {
+        try {
+            File file = File.createTempFile("console-jms-connector-plan-", ".xml");
+            file.deleteOnExit();
+            savePlan(file, args);
+            if(MODULE_FILE == null) {
+                MODULE_FILE = PortletManager.getServerInfo(request).resolvePath(ACTIVEMQ_RAR);
+            }
+            deployPlan(new File(MODULE_FILE), file);
+        } catch (IOException e) {
+            log.error("Unable to write deployment plan", e);
+        }
     }
 
     public void deployPlan(File moduleFile, File planFile) {
@@ -206,48 +179,22 @@
         }
     }
 
-    public List getDependencies() {
-        List dependencies = null;
-
-        try {
-            dependencies = getListing(REPO_FOLDER, REPO_FOLDER
-                    .getCanonicalPath());
-            Collections.sort(dependencies);
-        } catch (Exception e) {
-            System.out.println("ERROR: Problem getting dependencies");
-            e.printStackTrace();
+    public List getDependencies(PortletRequest request) {
+        ListableRepository[] repo = PortletManager.getListableRepositories(request);
+        List dependencies = new ArrayList();
+        for (int i = 0; i < repo.length; i++) {
+            ListableRepository repository = repo[i];
+            try {
+                URI[] uris = repository.listURIs();
+                for (int j = 0; j < uris.length; j++) {
+                    URI uri = uris[j];
+                    dependencies.add(uri.toString());
+                }
+            } catch (URISyntaxException e) {
+                e.printStackTrace();
+            }
         }
 
         return dependencies;
     }
-
-    private List getListing(File dir, String basepath)
-            throws java.io.IOException {
-        if (dir == null) {
-            throw new IllegalArgumentException("directory argument is null");
-        }
-
-        if (!dir.isDirectory()) {
-            throw new IllegalArgumentException("directory argument expected");
-        }
-
-        List listing = new ArrayList();
-
-        List ls = Arrays.asList(dir.listFiles());
-        Iterator iter = ls.iterator();
-
-        while (iter.hasNext()) {
-            File f = (File) iter.next();
-
-            if (f.isDirectory()) {
-                List listing1 = getListing(f, basepath);
-                listing.addAll(listing1);
-            } else {
-                listing.add(f.getCanonicalPath().substring(
-                        basepath.length() + 1).replace('\\', '/'));
-            }
-        }
-        return listing;
-    }
-
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/jmsmanager/handlers/CreateDestinationHandler.java Thu Dec  8 15:20:03 2005
@@ -17,21 +17,6 @@
 
 package org.apache.geronimo.console.jmsmanager.handlers;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-import java.util.Arrays;
-
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.management.ObjectName;
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-
-import org.activemq.message.ActiveMQQueue;
-import org.activemq.message.ActiveMQTopic;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.connector.AdminObjectWrapper;
@@ -48,13 +33,23 @@
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 
-public class CreateDestinationHandler extends AbstractJMSManager implements
-        PortletResponseHandler {
+import javax.jms.Queue;
+import javax.jms.Topic;
+import javax.management.ObjectName;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
 
+public class CreateDestinationHandler extends AbstractJMSManager implements PortletResponseHandler {
     protected static Log log = LogFactory
             .getLog(CreateDestinationHandler.class);
 
-    private static final List parentId = Arrays.asList(new URI[] {URI.create("org/apache/geronimo/Console")});
+    private static final List parentId = Arrays.asList(new URI[] {URI.create("geronimo/activemq-broker/1.0-SNAPSHOT/car")});
 
     static final GBeanInfo QUEUE_INFO;
 
@@ -91,16 +86,12 @@
             GBeanData adminObjectData;
             if (Topic.class.getName().equals(destinationType)) {
                 adminObjectData = new GBeanData(adminObjectName, TOPIC_INFO);
-                adminObjectData.setAttribute("adminObjectInterface",
-                        Topic.class.getName());
-                adminObjectData.setAttribute("adminObjectClass",
-                        ActiveMQTopic.class.getName());
+                adminObjectData.setAttribute("adminObjectInterface", "javax.jms.Topic");
+                adminObjectData.setAttribute("adminObjectClass", "org.activemq.message.ActiveMQTopic");
             } else if (Queue.class.getName().equals(destinationType)) {
                 adminObjectData = new GBeanData(adminObjectName, QUEUE_INFO);
-                adminObjectData.setAttribute("adminObjectInterface",
-                        Queue.class.getName());
-                adminObjectData.setAttribute("adminObjectClass",
-                        ActiveMQQueue.class.getName());
+                adminObjectData.setAttribute("adminObjectInterface", "javax.jms.Queue");
+                adminObjectData.setAttribute("adminObjectClass", "org.activemq.message.ActiveMQQueue.class");
             } else {
                 throw new PortletException(
                         "Invalid choice destination, must be FQCL of Topic or Queue, not "

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/ObjectNameConstants.java Thu Dec  8 15:20:03 2005
@@ -17,45 +17,24 @@
 
 package org.apache.geronimo.console.util;
 
-import java.util.Set;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.KernelRegistry;
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import java.util.Set;
+
 public final class ObjectNameConstants {
 
     // Security object names
     public static final ObjectName SE_REALM_MBEAN_NAME;
-    //= "geronimo.server:J2EEApplication=org/apache/geronimo/Console,J2EEModule=null,J2EEServer=geronimo,j2eeType=GBean,name=PropertiesLoginManager";
-
-//    public static final ObjectName SE_REALM_IMMUTABLE_MBEAN_NAME;
-    //= "geronimo.server:name=PropertiesLoginManager,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=null";
-
-    public static final ObjectName REQUEST_LOGGER_OBJECT_NAME;
-    //= "geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/Jetty,J2EEServer=geronimo,j2eeType=GBean,name=JettyRequestLog";
-
-    public static final ObjectName REPO_OBJECT_NAME;
-    //= "geronimo.server:name=Repository,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=org/apache/geronimo/System";
-
-    public static final ObjectName SERVER_INFO_OBJECT_NAME;
-    //= "geronimo.server:name=ServerInfo,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=org/apache/geronimo/System";
-
     public static final ObjectName DEPLOYER_OBJECT_NAME;
-    //= "geronimo.server:J2EEApplication=null,J2EEModule=org/apache/geronimo/RuntimeDeployer,J2EEServer=geronimo,j2eeType=Deployer,name=Deployer";
-
     public static final ObjectName KEYSTORE_OBJ_NAME;
-    //= "geronimo.security:type=KeyStore";
 
     static {
         Kernel kernel = KernelRegistry.getSingleKernel();
         try {
             SE_REALM_MBEAN_NAME = getUniquename("*:J2EEModule=null,j2eeType=GBean,name=PropertiesLoginManager,*", kernel);
-//            SE_REALM_IMMUTABLE_MBEAN_NAME = getUniquename("geronimo.server:name=PropertiesLoginManager,J2EEServer=geronimo,J2EEApplication=null,j2eeType=GBean,J2EEModule=null", kernel);
-            REQUEST_LOGGER_OBJECT_NAME = getUniquename("*:J2EEApplication=null,j2eeType=GBean,name=JettyRequestLog,*", kernel);
-            REPO_OBJECT_NAME = getUniquename("*:J2EEApplication=null,j2eeType=GBean,name=Repository,*", kernel);
-            SERVER_INFO_OBJECT_NAME = getUniquename("*:J2EEApplication=null,j2eeType=GBean,name=ServerInfo,*", kernel);
             DEPLOYER_OBJECT_NAME = getUniquename("*:J2EEApplication=null,j2eeType=Deployer,name=Deployer,*", kernel);
             KEYSTORE_OBJ_NAME = getUniquename("*:J2EEModule=null,j2eeType=GBean,name=KeyStore,*", kernel);
         } catch (MalformedObjectNameException e) {

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/util/PortletManager.java Thu Dec  8 15:20:03 2005
@@ -16,19 +16,6 @@
  */
 package org.apache.geronimo.console.util;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import javax.enterprise.deploy.spi.DeploymentManager;
-import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletSession;
-import javax.servlet.http.HttpSession;
-import javax.security.auth.spi.LoginModule;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.Subject;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
@@ -52,9 +39,25 @@
 import org.apache.geronimo.management.geronimo.WebContainer;
 import org.apache.geronimo.management.geronimo.WebManager;
 import org.apache.geronimo.pool.GeronimoExecutor;
+import org.apache.geronimo.security.realm.SecurityRealm;
 import org.apache.geronimo.system.logging.SystemLog;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.security.realm.SecurityRealm;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+import javax.portlet.RenderResponse;
+import javax.security.auth.Subject;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
@@ -370,8 +373,37 @@
         return log;
     }
 
+    public static GeronimoManagedBean[] getManagedBeans(PortletRequest request, Class intrface) {
+        ManagementHelper helper = getManagementHelper(request);
+        Object[] obs = helper.findByInterface(intrface);
+        GeronimoManagedBean[] results = new GeronimoManagedBean[obs.length];
+        for (int i = 0; i < results.length; i++) {
+            results[i] = (GeronimoManagedBean) obs[i];
+        }
+        return results;
+    }
+
     public static GeronimoManagedBean getManagedBean(PortletRequest request, String name) {
         ManagementHelper helper = getManagementHelper(request);
         return (GeronimoManagedBean) helper.getObject(name);
+    }
+
+    /**
+     * Looks up the context prefix used by the portal, even if the thing running
+     * is in one of the portlets.  We're kind of hacking our way there, but hey,
+     * it beats hardcoding.
+     */
+    public static String getConsoleFrameworkServletPath (HttpServletRequest request) {
+        String contextPath = "";
+        Object o = request.getAttribute("javax.portlet.response");
+        if (o!=null && o instanceof RenderResponse) { // request came from a portlet
+            RenderResponse renderResponse = (RenderResponse)o;
+            contextPath = renderResponse.createRenderURL().toString();
+            int index = contextPath.indexOf(request.getPathInfo());
+            contextPath = contextPath.substring(0,index);
+        } else { // request did not come from a portlet
+            contextPath = request.getContextPath();
+        }
+        return contextPath;
     }
 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java (original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/webmanager/ConnectorPortlet.java Thu Dec  8 15:20:03 2005
@@ -17,30 +17,31 @@
 
 package org.apache.geronimo.console.webmanager;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
+import org.apache.geronimo.management.geronimo.SecureConnector;
+import org.apache.geronimo.management.geronimo.WebConnector;
+import org.apache.geronimo.management.geronimo.WebContainer;
+import org.apache.geronimo.management.geronimo.WebManager;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
 import javax.portlet.PortletException;
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.portlet.WindowState;
-import javax.portlet.PortletContext;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import org.apache.geronimo.console.BasePortlet;
-import org.apache.geronimo.console.util.PortletManager;
-import org.apache.geronimo.management.geronimo.WebContainer;
-import org.apache.geronimo.management.geronimo.WebConnector;
-import org.apache.geronimo.management.geronimo.SecureConnector;
-import org.apache.geronimo.management.geronimo.WebManager;
-import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * A portlet that lets you list, add, remove, start, stop, and edit web
@@ -68,14 +69,21 @@
         if(managerName != null) actionResponse.setRenderParameter("managerObjectName", managerName);
         if(containerName != null) actionResponse.setRenderParameter("containerObjectName", containerName);
 
-        WebContainer container = PortletManager.getWebContainer(actionRequest, containerName);
-        String server = getWebServerType(container.getClass());
+        String server = null;
+        if(containerName != null) {
+            WebContainer container = PortletManager.getWebContainer(actionRequest, containerName);
+            server = getWebServerType(container.getClass());
+        } else {
+            server = "unknown";
+        }
         actionResponse.setRenderParameter("server", server);
         if(mode.equals("new")) {
             // User selected to add a new connector, need to show criteria portlet
             actionResponse.setRenderParameter("mode", "new");
             String protocol = actionRequest.getParameter("protocol");
+            String containerDisplayName = actionRequest.getParameter("containerDisplayName");
             actionResponse.setRenderParameter("protocol", protocol);
+            actionResponse.setRenderParameter("containerDisplayName", containerDisplayName);
         } else if(mode.equals("add")) { // User just submitted the form to add a new connector
             // Get submitted values
             //todo: lots of validation
@@ -295,6 +303,7 @@
 
             if(mode.equals("new")) {
                 String protocol = renderRequest.getParameter("protocol");
+                String containerDisplayName = renderRequest.getParameter("containerDisplayName");
                 renderRequest.setAttribute("maxThreads", "50");
                 if(server.equals(WEB_SERVER_JETTY)) {
                     renderRequest.setAttribute("minThreads", "10");
@@ -307,6 +316,7 @@
                 }
                 renderRequest.setAttribute("protocol", protocol);
                 renderRequest.setAttribute("mode", "add");
+                renderRequest.setAttribute("containerDisplayName", containerDisplayName);
                 if(protocol.equals(WebManager.PROTOCOL_HTTPS)) {
                     editHttpsView.include(renderRequest, renderResponse);
                 } else {
@@ -327,6 +337,14 @@
                 if(connector == null) {
                     doList(renderRequest, renderResponse);
                 } else {
+                    String displayName = PortletManager.getGBeanDescription(renderRequest, objectName);
+                    try {
+                        ObjectName realName = ObjectName.getInstance(objectName);
+                        displayName = realName.getKeyProperty("name");
+                    } catch (MalformedObjectNameException e) {
+                        log.error("Bad object name for web connector", e);
+                    }
+                    renderRequest.setAttribute("name", displayName);
                     renderRequest.setAttribute("objectName", objectName);
                     renderRequest.setAttribute("port", new Integer(connector.getPort()));
                     renderRequest.setAttribute("host", connector.getHost());

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/derbylogmanager/view.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/derbylogmanager/view.jsp?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/derbylogmanager/view.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/derbylogmanager/view.jsp Thu Dec  8 15:20:03 2005
@@ -1,37 +1,50 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
-<c:set var="increment" value="10"/>
+
 <table>
 <tr>
 <td>
-<a href="<portlet:renderURL><portlet:param name="action" value="refresh"/></portlet:renderURL>">Refresh</a> 
-</td>     
+<a href="<portlet:renderURL><portlet:param name="action" value="refresh"/></portlet:renderURL>">Refresh</a>
+</td>
 </tr>
 <tr>
-    <td>     
+    <td class="Smaller" valign="middle">
+    <form action="<portlet:renderURL/>" name="<portlet:namespace/>searchForm" >
+    <b>Filter results:</b>
+    <input type="hidden" value="search" name="action"/>
+    Lines <input type="text" name="startPos" value="${startPos}" size="3"/>
+    to <input type="text" name="endPos" value="${endPos}" size="3"/>
+    Max Results <input type="text" name="maxRows" value="${maxRows}" size="3"/>
+    Containing text <input type="text" name="searchString" value="${searchString}"/>
+    <input type="submit" value="Go"/>
+    </form>
+    </td>
+</tr>
+<tr>
+    <td>
 <c:choose>
-<c:when test="${logs != null && fn:length(logs) > 0}">
+<c:when test="${searchResults != null && fn:length(searchResults) > 0}">
     <table>
         <tr>
             <td class="Smaller">
-            <b>${lines} total line(s) in log file.</b>
+            <b>${lineCount} total message(s) in log file. ${fn:length(searchResults)} matched your criteria<c:if test="${!empty capped}"> (number of results capped)</c:if>.</b>
             </td>
-        </tr>    
-            
-    <c:forEach var="line" items="${logs}">
+        </tr>
+
+    <c:forEach var="line" items="${searchResults}">
         <tr>
             <td class="Smaller">
-            ${line}
+            ${line.lineNumber}:&nbsp;${line.lineContent}
             </td>
         </tr>
     </c:forEach>
     </table>
 </c:when>
 <c:otherwise>
- No logs found.
+ No entries found with the specified criteria.
 </c:otherwise>
-</c:choose>  
-</td>     
+</c:choose>
+</td>
 </tr>
 </table>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/logmanager/search.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/logmanager/search.jsp?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/logmanager/search.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/logmanager/search.jsp Thu Dec  8 15:20:03 2005
@@ -48,7 +48,6 @@
 }
 </script>
 
-<c:set var="increment" value="10"/>
 <table>
 <tr>
 <td>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTP.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTP.jsp?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTP.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTP.jsp Thu Dec  8 15:20:03 2005
@@ -12,6 +12,16 @@
 </c:if>
 <table width="100%%"  border="0">
 
+<!-- Current Task -->
+<c:choose>
+  <c:when test="${mode eq 'add'}">
+    <tr><th colspan="2" align="left">Add new ${protocol} listener for ${containerDisplayName}</th></tr>
+  </c:when>
+  <c:otherwise>
+    <tr><th colspan="2" align="left">Edit connector ${name}</th></tr>
+  </c:otherwise>
+</c:choose>
+
 <!-- Name Field -->
 <c:if test="${mode eq 'add'}">
   <tr>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/editHTTPS.jsp Thu Dec  8 15:20:03 2005
@@ -14,6 +14,16 @@
 
 <%-- THIS PART SHOULD BE THE SAME AS THE HTTP CONNECTOR --%>
 
+<!-- Current Task -->
+<c:choose>
+  <c:when test="${mode eq 'add'}">
+    <tr><th colspan="2" align="left">Add new ${protocol} listener for ${containerDisplayName}</th></tr>
+  </c:when>
+  <c:otherwise>
+    <tr><th colspan="2" align="left">Edit connector ${name}</th></tr>
+  </c:otherwise>
+</c:choose>
+
 <!-- Name Field -->
 <c:if test="${mode eq 'add'}">
   <tr>

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/normal.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/normal.jsp?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/normal.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/webmanager/connector/normal.jsp Thu Dec  8 15:20:03 2005
@@ -75,6 +75,7 @@
            <portlet:param name="protocol" value="${protocol}" />
            <portlet:param name="managerObjectName" value="${container.managerObjectName}" />
            <portlet:param name="containerObjectName" value="${container.containerObjectName}" />
+           <portlet:param name="containerDisplayName" value="${container.name}" />
          </portlet:actionURL>">Add new ${protocol} listener for ${container.name}</a>
 </c:forEach>
 

Modified: geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/welcome/welcomeNormal.jsp
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/welcome/welcomeNormal.jsp?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/welcome/welcomeNormal.jsp (original)
+++ geronimo/trunk/applications/console-standard/src/webapp/WEB-INF/view/welcome/welcomeNormal.jsp Thu Dec  8 15:20:03 2005
@@ -1,5 +1,6 @@
 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<%@ page import="org.apache.geronimo.console.util.PortletManager" %>
 <portlet:defineObjects/>
 
 
@@ -48,16 +49,13 @@
                 <tr>
                     <td bgcolor="#FFFFFF" nowrap>
                         &nbsp;<br />
-                        <%-- Is there any way to not hardcode /console?  The problem is, this
-                             code runs from /console-standard, so the context root is not correct.
-                             Perhaps there's some tag to point to a different portlet, but what
-                             about the images?  --%>
-                        <img src="/console/images/ico_db_16x16.gif" /><a href="/console/portal/services/services_jdbc">Database Pools</a><br />
-                        <img src="/console/images/ico_lock_16x16.gif" /><a href="/console/portal/Security/Security_realms">Security Realms</a><br />
-                        <img src="/console/images/ico_beanjar_16x16.gif" /><a href="/console/portal/services/services_jms">JMS Resources</a><br />
-                        <img src="/console/images/ico_list_16x16.gif" /><a href="/console/portal/apps/apps_all">Deploy Applications</a><br />
-                        <img src="/console/images/ico_servcomp_16x16.gif" /><a href="/console/portal/server/server_web">Web Server Ports</a><br />
-                        <img src="/console/images/ico_look_16x16.gif" /><a href="/console/portal/server/server_info">Memory &amp; Uptime</a><br />
+	                    <% String consoleServletPath = PortletManager.getConsoleFrameworkServletPath(request); %>
+                        <img src="<%=consoleServletPath%>/../images/ico_db_16x16.gif" /><a href="<%=consoleServletPath%>/services/services_jdbc">Database Pools</a><br />
+                        <img src="<%=consoleServletPath%>/../images/ico_lock_16x16.gif" /><a href="<%=consoleServletPath%>/Security/Security_realms">Security Realms</a><br />
+                        <img src="<%=consoleServletPath%>/../images/ico_beanjar_16x16.gif" /><a href="<%=consoleServletPath%>/services/services_jms">JMS Resources</a><br />
+                        <img src="<%=consoleServletPath%>/../images/ico_list_16x16.gif" /><a href="<%=consoleServletPath%>/apps/apps_all">Deploy Applications</a><br />
+                        <img src="<%=consoleServletPath%>/../images/ico_servcomp_16x16.gif" /><a href="<%=consoleServletPath%>/server/server_web">Web Server Ports</a><br />
+                        <img src="<%=consoleServletPath%>/../images/ico_look_16x16.gif" /><a href="<%=consoleServletPath%>/server/server_info">Memory &amp; Uptime</a><br />
                         &nbsp;<br />
                     </td>
                 </tr>

Modified: geronimo/trunk/assemblies/j2ee-installer/src/var/log/server-log4j.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/assemblies/j2ee-installer/src/var/log/server-log4j.properties?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-installer/src/var/log/server-log4j.properties (original)
+++ geronimo/trunk/assemblies/j2ee-installer/src/var/log/server-log4j.properties Thu Dec  8 15:20:03 2005
@@ -88,6 +88,7 @@
 log4j.category.org.apache.jk.common.ChannelSocket=WARN
 log4j.category.org.apache.jk.server.JkMain=WARN
 log4j.category.org.apache.coyote.http11.Http11BaseProtocol=WARN
+log4j.category.org.apache.catalina.core.ContainerBase=WARN
 
 # Emits a spurious WARN during startup on /some-path/* security mappings
 log4j.category.org.apache.catalina.deploy.SecurityCollection=ERROR
@@ -108,4 +109,4 @@
 # Prints stuff for AJAX calls
 log4j.category.uk.ltd.getahead.dwr.impl.DefaultConfiguration=WARN
 log4j.category.uk.ltd.getahead.dwr.impl.ExecuteQuery=WARN
-log4j.category.uk.ltd.getahead.util.Logger=WARN
+log4j.category.uk.ltd.getahead.dwr.util.Logger=WARN

Propchange: geronimo/trunk/assemblies/j2ee-installer/src/var/log/server-log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/assemblies/j2ee-jetty-server/src/var/log/server-log4j.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/assemblies/j2ee-jetty-server/src/var/log/server-log4j.properties?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-jetty-server/src/var/log/server-log4j.properties (original)
+++ geronimo/trunk/assemblies/j2ee-jetty-server/src/var/log/server-log4j.properties Thu Dec  8 15:20:03 2005
@@ -88,6 +88,7 @@
 log4j.category.org.apache.jk.common.ChannelSocket=WARN
 log4j.category.org.apache.jk.server.JkMain=WARN
 log4j.category.org.apache.coyote.http11.Http11BaseProtocol=WARN
+log4j.category.org.apache.catalina.core.ContainerBase=WARN
 
 # Emits a spurious WARN during startup on /some-path/* security mappings
 log4j.category.org.apache.catalina.deploy.SecurityCollection=ERROR
@@ -108,4 +109,4 @@
 # Prints stuff for AJAX calls
 log4j.category.uk.ltd.getahead.dwr.impl.DefaultConfiguration=WARN
 log4j.category.uk.ltd.getahead.dwr.impl.ExecuteQuery=WARN
-log4j.category.uk.ltd.getahead.util.Logger=WARN
+log4j.category.uk.ltd.getahead.dwr.util.Logger=WARN

Propchange: geronimo/trunk/assemblies/j2ee-jetty-server/src/var/log/server-log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/log/server-log4j.properties
URL: http://svn.apache.org/viewcvs/geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/log/server-log4j.properties?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/log/server-log4j.properties (original)
+++ geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/log/server-log4j.properties Thu Dec  8 15:20:03 2005
@@ -88,6 +88,7 @@
 log4j.category.org.apache.jk.common.ChannelSocket=WARN
 log4j.category.org.apache.jk.server.JkMain=WARN
 log4j.category.org.apache.coyote.http11.Http11BaseProtocol=WARN
+log4j.category.org.apache.catalina.core.ContainerBase=WARN
 
 # Emits a spurious WARN during startup on /some-path/* security mappings
 log4j.category.org.apache.catalina.deploy.SecurityCollection=ERROR
@@ -108,4 +109,4 @@
 # Prints stuff for AJAX calls
 log4j.category.uk.ltd.getahead.dwr.impl.DefaultConfiguration=WARN
 log4j.category.uk.ltd.getahead.dwr.impl.ExecuteQuery=WARN
-log4j.category.uk.ltd.getahead.util.Logger=WARN
+log4j.category.uk.ltd.getahead.dwr.util.Logger=WARN

Propchange: geronimo/trunk/assemblies/j2ee-tomcat-server/src/var/log/server-log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/configs/system-database/src/plan/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/configs/system-database/src/plan/plan.xml?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/configs/system-database/src/plan/plan.xml (original)
+++ geronimo/trunk/configs/system-database/src/plan/plan.xml Thu Dec  8 15:20:03 2005
@@ -56,6 +56,10 @@
         <attribute name="host">localhost</attribute>
         <attribute name="port">1527</attribute>
     </gbean>
+    <gbean name="DerbyLog" class="org.apache.geronimo.derby.DerbyLogGBean">
+        <reference name="DerbySystem"><moduleType>J2EEModule</moduleType><name>D
+erbySystem</name></reference>
+    </gbean>
 
     <gbean name="TransactionalThreadPooledTimer" class="org.apache.geronimo.timer.jdbc.JDBCStoreThreadPooledTransactionalTimer">
         <attribute name="repeatCount">5</attribute>

Modified: geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandStart.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandStart.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandStart.java (original)
+++ geronimo/trunk/modules/deploy-tool/src/java/org/apache/geronimo/deployment/cli/CommandStart.java Thu Dec  8 15:20:03 2005
@@ -69,6 +69,7 @@
         boolean multiple = isMultipleTargets(ids);
         ProgressObject po = runCommand(out, mgr, ids);
         TargetModuleID[] done = po.getResultTargetModuleIDs();
+        out.println();
         for(int i = 0; i < done.length; i++) {
             TargetModuleID id = done[i];
             out.print(DeployUtils.reformat(getAction()+" "+id.getModuleID()+(multiple ? " on "+id.getTarget().getName() : "")+(id.getWebURL() == null || !getAction().equals("Started") ? "" : " @ "+id.getWebURL()),4, 72));

Modified: geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/trunk/modules/deployment/src/java/org/apache/geronimo/deployment/DeploymentContext.java Thu Dec  8 15:20:03 2005
@@ -17,6 +17,26 @@
 
 package org.apache.geronimo.deployment;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.Configuration;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.MultiParentClassLoader;
+import org.apache.geronimo.kernel.config.NoSuchConfigException;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.repository.Repository;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -30,40 +50,20 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.HashSet;
-import java.util.Map;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.deployment.util.DeploymentUtil;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationModuleType;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.MultiParentClassLoader;
-import org.apache.geronimo.kernel.config.NoSuchConfigException;
-import org.apache.geronimo.kernel.management.State;
-import org.apache.geronimo.kernel.repository.Repository;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * @version $Rev$ $Date$
@@ -646,10 +646,12 @@
                 Collections.reverse(loadedAncestors);
                 for (Iterator iterator = loadedAncestors.iterator(); iterator.hasNext();) {
                     URI configID = (URI) iterator.next();
-                    try {
-                        configurationManager.unload(configID);
-                    } catch (NoSuchConfigException e) {
-                        throw new DeploymentException("Could not find a configuration we previously loaded! " + configID, e);
+                    if(configurationManager.isLoaded(configID)) {
+                        try {
+                            configurationManager.unload(configID);
+                        } catch (NoSuchConfigException e) {
+                            throw new DeploymentException("Could not find a configuration we previously loaded! " + configID, e);
+                        }
                     }
                 }
                 loadedAncestors.clear();

Modified: geronimo/trunk/modules/derby/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/derby/project.xml?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/modules/derby/project.xml (original)
+++ geronimo/trunk/modules/derby/project.xml Thu Dec  8 15:20:03 2005
@@ -51,6 +51,11 @@
             <artifactId>geronimo-system</artifactId>
             <version>${pom.currentVersion}</version>
         </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.derby</groupId>

Added: geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLog.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLog.java?rev=355267&view=auto
==============================================================================
--- geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLog.java (added)
+++ geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLog.java Thu Dec  8 15:20:03 2005
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.derby;
+
+import org.apache.geronimo.management.geronimo.Log;
+
+/**
+ * ReplaceMe
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public interface DerbyLog extends Log {
+    public SearchResults searchLog(Integer startLine, Integer endLine, Integer max, String regex);
+}

Added: geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLogGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLogGBean.java?rev=355267&view=auto
==============================================================================
--- geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLogGBean.java (added)
+++ geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbyLogGBean.java Thu Dec  8 15:20:03 2005
@@ -0,0 +1,121 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.derby;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+
+import java.io.File;
+import java.io.RandomAccessFile;
+import java.nio.CharBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.charset.Charset;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * ReplaceMe
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class DerbyLogGBean implements DerbyLog {
+    // Pattern that matches a single line  (used to calculate line numbers and text search in a line)
+    private final static Pattern FULL_LINE_PATTERN = Pattern.compile("^.*", Pattern.MULTILINE);
+    private final DerbySystem derby;
+    private File logFile = null;
+
+    public DerbyLogGBean(DerbySystem derby) {
+        this.derby = derby;
+    }
+
+    public SearchResults searchLog(Integer startLine, Integer endLine, Integer max, String text) {
+        // Get log file
+        if(logFile == null) {
+            logFile = new File(derby.getDerbyHome(), "derby.log");
+            if(!logFile.canRead()) {
+                throw new IllegalStateException("Cannot read Derby log file at '"+logFile.getAbsolutePath()+"'");
+            }
+        }
+        // Check that the text pattern is valid
+        Pattern textPattern;
+        try {
+            textPattern = text == null || text.equals("") ? null : Pattern.compile(text);
+        } catch (PatternSyntaxException e) {
+            throw new IllegalArgumentException("Bad regular expression '"+text+"'");
+        }
+        return searchFile(logFile, textPattern, startLine, endLine,
+                max == null ? MAX_SEARCH_RESULTS : Math.min(MAX_SEARCH_RESULTS, max.intValue()));
+    }
+
+    private static SearchResults searchFile(File file, Pattern textSearch, Integer start, Integer stop, int max) {
+        List list = new LinkedList();
+        boolean capped = false;
+        int lineCount = 0;
+        try {
+            RandomAccessFile raf = new RandomAccessFile(file, "r");
+            FileChannel fc = raf.getChannel();
+            MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            CharBuffer cb = Charset.forName("US-ASCII").decode(bb); //todo: does Derby use a different charset on a foreign PC?
+            Matcher lines = FULL_LINE_PATTERN.matcher(cb);
+            Matcher text = textSearch == null ? null : textSearch.matcher("");
+            max = Math.min(max, MAX_SEARCH_RESULTS);
+            while(lines.find()) {
+                ++lineCount;
+                if(start != null && start.intValue() > lineCount) {
+                    continue;
+                }
+                if(stop != null && stop.intValue() < lineCount) {
+                    continue;
+                }
+                CharSequence line = cb.subSequence(lines.start(), lines.end());
+                if(text != null) {
+                    text.reset(line);
+                    if(!text.find()) {
+                        continue;
+                    }
+                }
+                list.add(new LogMessage(lineCount,line.toString()));
+                if(list.size() > max) {
+                    list.remove(0);
+                    capped = true;
+                }
+            }
+            fc.close();
+            raf.close();
+        } catch (Exception e) {}
+        return new SearchResults(lineCount, (LogMessage[]) list.toArray(new LogMessage[list.size()]), capped);
+    }
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Derby Log", DerbyLogGBean.class);
+
+        infoFactory.addReference("DerbySystem", DerbySystem.class, "GBean");
+        infoFactory.addInterface(DerbyLog.class);
+        infoFactory.setConstructor(new String[]{"DerbySystem"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Modified: geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystem.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystem.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystem.java (original)
+++ geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystem.java Thu Dec  8 15:20:03 2005
@@ -18,7 +18,10 @@
 package org.apache.geronimo.derby;
 
 /**
+ * Management interface for the Derby system GBean
+ *
  * @version $Rev$ $Date$
  */
 public interface DerbySystem {
+    public String getDerbyHome();
 }

Modified: geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystemGBean.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystemGBean.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystemGBean.java (original)
+++ geronimo/trunk/modules/derby/src/java/org/apache/geronimo/derby/DerbySystemGBean.java Thu Dec  8 15:20:03 2005
@@ -17,9 +17,6 @@
 
 package org.apache.geronimo.derby;
 
-import java.sql.DriverManager;
-import java.sql.SQLException;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
@@ -27,6 +24,9 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.system.serverinfo.ServerInfo;
 
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
 /**
  * A GBean that represents an instance of an Apache Derby system (a system being
  * a collection of different databases).
@@ -40,15 +40,20 @@
 
     private final ServerInfo serverInfo;
     private final String systemHome;
+    private String actualHome;
 
     public DerbySystemGBean(ServerInfo serverInfo, String derbySystemHome) {
         this.serverInfo = serverInfo;
         this.systemHome = derbySystemHome;
     }
 
+    public String getDerbyHome() {
+        return actualHome;
+    }
+
     public void doStart() throws Exception {
         // set up the system property for the database home
-        String actualHome = System.getProperty(SYSTEM_HOME);
+        actualHome = System.getProperty(SYSTEM_HOME);
         if (actualHome == null) {
             actualHome = serverInfo.resolvePath(systemHome);
         }
@@ -92,6 +97,7 @@
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(DerbySystemGBean.class);
         infoFactory.addAttribute("derbySystemHome", String.class, true);
+        infoFactory.addAttribute("derbyHome", String.class, false);
         infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
         infoFactory.setConstructor(new String[]{"ServerInfo", "derbySystemHome"});
         GBEAN_INFO = infoFactory.getBeanInfo();

Modified: geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=355267&r1=355266&r2=355267&view=diff
==============================================================================
--- geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/trunk/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Thu Dec  8 15:20:03 2005
@@ -16,11 +16,10 @@
  */
 package org.apache.geronimo.kernel.config;
 
+import javax.management.ObjectName;
 import java.io.IOException;
 import java.net.URI;
 import java.util.List;
-import java.util.Collection;
-import javax.management.ObjectName;
 
 /**
  * Encapsulates logic for dealing with configurations.
@@ -63,10 +62,12 @@
 
     /**
      * Load the specified configuration and all parent configurations into the kernel. This does not
-     * start any configuration gbeans or load any gbeans from the configurations loaded.
+     * start any configuration gbeans or load any gbeans from the configurations loaded.  It does
+     * not hurt to call this even if some or all of the GBeans are already loaded -- though only
+     * configurations actually loaded by this call will be returned.
      *
      * @param configID the id of the configuration
-     * @return a list of names of configurations loaded into the kernel
+     * @return a list of URIs (names of configurations that were actually loaded)
      * @throws NoSuchConfigException if no configuration with the given id exists in the configuration stores
      * @throws IOException if there is a problem loading te configuration from the store
      * @throws InvalidConfigException if the configuration is corrupt