geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r351591 - in /geronimo/trunk: applications/console-core/src/java/org/apache/geronimo/console/util/ applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/ applications/console-standard/src/java/org/apache/...
Date Fri, 02 Dec 2005 05:08:22 GMT
Author: ammulder
Date: Thu Dec  1 21:08:11 2005
New Revision: 351591

URL: http://svn.apache.org/viewcvs?rev=351591&view=rev
Log:
Fix database driver download feature to work with new repository URIs
  (GERONIMO-1261)
Fix security realm portlet to use LoginService reference (GERONIMO-1251)

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/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DriverDownloader.java
    geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
    geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
    geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
    geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.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=351591&r1=351590&r2=351591&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  1 21:08:11 2005
@@ -73,6 +73,7 @@
 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;
 
@@ -438,6 +439,16 @@
             return (ServerInfo) pm.createProxy(ObjectName.getInstance(name), KernelManagementHelper.class.getClassLoader());
         } catch (Exception e) {
             log.error("Unable to look up ServerInfo for J2EEServer", e);
+            return null;
+        }
+    }
+
+    public JaasLoginServiceMBean getLoginService(J2EEServer server) {
+        try {
+            String name = server.getServerInfo();
+            return (JaasLoginServiceMBean) pm.createProxy(ObjectName.getInstance(name), KernelManagementHelper.class.getClassLoader());
+        } catch (Exception e) {
+            log.error("Unable to look up LoginService for J2EEServer", e);
             return null;
         }
     }

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=351591&r1=351590&r2=351591&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  1 21:08:11 2005
@@ -55,6 +55,7 @@
 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;
 
 /**
  * A helper interface to navigate between management objects.  This is not
@@ -87,6 +88,7 @@
     Repository[] getRepositories(J2EEServer server);
     SecurityRealm[] getSecurityRealms(J2EEServer server);
     ServerInfo getServerInfo(J2EEServer server);
+    JaasLoginServiceMBean getLoginService(J2EEServer server);
     WebManager[] getWebManagers(J2EEServer server);
     WebAccessLog getWebAccessLog(WebManager manager, WebContainer container);
     WebAccessLog getWebAccessLog(WebManager manager, String containerObjectName);

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java?rev=351591&r1=351590&r2=351591&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
Thu Dec  1 21:08:11 2005
@@ -206,7 +206,6 @@
      * @param rarPath            If we're creating a new RA, the path to identify it
      * @param displayName        If we're editing an existing RA, its name
      * @param adapterObjectName  If we're editing an existing RA, its ObjectName
-     * @return
      */
     public ResourceAdapterParams getRARConfiguration(PortletRequest request, String rarPath,
String displayName, String adapterObjectName) {
         PortletSession session = request.getPortletSession(true);
@@ -291,7 +290,7 @@
                             System.out.println("Finished downloading "+bytes+"b");
                         }
                     });
-                    data.jar1 = found.getRepositoryPath();
+                    data.jar1 = found.getRepositoryURI();
                 } catch (IOException e) {
                     log.error("Unable to download JDBC driver", e);
                 }

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DriverDownloader.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DriverDownloader.java?rev=351591&r1=351590&r2=351591&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DriverDownloader.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/databasemanager/wizard/DriverDownloader.java
Thu Dec  1 21:08:11 2005
@@ -16,31 +16,30 @@
  */
 package org.apache.geronimo.console.databasemanager.wizard;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.kernel.repository.WriteableRepository;
-import org.apache.geronimo.kernel.repository.FileWriteMonitor;
-
-import java.net.URL;
-import java.net.URI;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.File;
-import java.io.OutputStream;
 import java.io.BufferedOutputStream;
+import java.io.File;
 import java.io.FileOutputStream;
-import java.util.Properties;
-import java.util.List;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.ArrayList;
-import java.util.Set;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
 import java.util.Random;
-import java.util.Collections;
-import java.util.jar.JarFile;
+import java.util.Set;
 import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.kernel.repository.FileWriteMonitor;
+import org.apache.geronimo.kernel.repository.WriteableRepository;
 
 /**
  * A utility that handles listing and downloading available JDBC driver JARs.
@@ -88,7 +87,6 @@
             String name = props.getProperty("driver."+driver+".name");
             String repository = props.getProperty("driver."+driver+".repository");
             String unzip = props.getProperty("driver."+driver+".unzip");
-            String rename = props.getProperty("driver."+driver+".rename");
             urls.clear();
             int index = 1;
             while(true) {
@@ -107,7 +105,6 @@
             if(name != null && repository != null && urls.size() > 0)
{
                 DriverInfo info = new DriverInfo(name, repository);
                 info.setUnzipPath(unzip);
-                info.setRenameTo(rename);
                 info.setUrls((URL[]) urls.toArray(new URL[urls.size()]));
                 list.add(info);
             }
@@ -130,7 +127,7 @@
             }
             URL url = driver.urls[urlIndex];
             InputStream in;
-            String fileName = driver.getRepositoryPath();
+            String uri = driver.getRepositoryURI();
             if(driver.unzipPath != null) {
                 byte[] buf = new byte[1024];
                 int size;
@@ -169,7 +166,7 @@
                         log.error("Cannot extract driver JAR "+driver.unzipPath+" from download
file "+url);
                     } else {
                         in = jar.getInputStream(entry);
-                        repo.copyToRepository(in, new URI(fileName), monitor);
+                        repo.copyToRepository(in, new URI(uri), monitor);
                     }
                 } finally {
                     if(jar != null) try{jar.close();}catch(IOException e) {log.error("Unable
to close JAR file", e);}
@@ -177,7 +174,7 @@
                 }
             } else {
                 in = url.openStream();
-                repo.copyToRepository(in, new URI(fileName), monitor);
+                repo.copyToRepository(in, new URI(uri), monitor);
             }
         } catch (URISyntaxException e) {
             throw new IOException("Unable to save to repository URI: "+e.getMessage());
@@ -214,14 +211,13 @@
 
     public static class DriverInfo implements Comparable {
         private String name;
-        private String repositoryDir;
+        private String repositoryURI;
         private String unzipPath;
-        private String renameTo;
         private URL[] urls;
 
-        public DriverInfo(String name, String repositoryDir) {
+        public DriverInfo(String name, String repositoryURI) {
             this.name = name;
-            this.repositoryDir = repositoryDir;
+            this.repositoryURI = repositoryURI;
         }
 
         public String getName() {
@@ -232,12 +228,12 @@
             this.name = name;
         }
 
-        public String getRepositoryDir() {
-            return repositoryDir;
+        public String getRepositoryURI() {
+            return repositoryURI;
         }
 
-        public void setRepositoryDir(String repositoryDir) {
-            this.repositoryDir = repositoryDir;
+        public void setRepositoryURI(String repositoryURI) {
+            this.repositoryURI = repositoryURI;
         }
 
         public String getUnzipPath() {
@@ -254,32 +250,6 @@
 
         public void setUrls(URL[] urls) {
             this.urls = urls;
-        }
-
-        public String getRenameTo() {
-            return renameTo;
-        }
-
-        public void setRenameTo(String renameTo) {
-            this.renameTo = renameTo;
-        }
-
-        public String getRepositoryPath() {
-            String fileName;
-            if(unzipPath != null) {
-                if(renameTo != null) {
-                    fileName = renameTo;
-                } else {
-                    fileName = unzipPath;
-                }
-            } else {
-                fileName = urls[0].toString();
-            }
-            int pos = fileName.lastIndexOf('/');
-            if(pos > -1) {
-                fileName = fileName.substring(pos+1);
-            }
-            return repositoryDir+"/jars/"+fileName;
         }
 
         public int compareTo(Object o) {

Modified: geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java?rev=351591&r1=351590&r2=351591&view=diff
==============================================================================
--- geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
(original)
+++ geronimo/trunk/applications/console-standard/src/java/org/apache/geronimo/console/securitymanager/realm/SecurityRealmPortlet.java
Thu Dec  1 21:08:11 2005
@@ -318,7 +318,7 @@
         ConfigurationDocument doc = ConfigurationDocument.Factory.newInstance();
         ConfigurationType root = doc.addNewConfiguration();
         root.setConfigId("SecurityRealm"+data.getName());
-        root.setParentId("org/apache/geronimo/Server");
+        // Use a parentId of null to pick up the default
         // Dependencies
         if(data.getJar() != null) {
             DependencyType jar = root.addNewDependency();
@@ -334,6 +334,9 @@
         ReferenceType serverInfo = realm.addNewReference();
         serverInfo.setName2("ServerInfo");
         serverInfo.setGbeanName(PortletManager.getCurrentServer(request).getServerInfo());
+        ReferenceType loginService = realm.addNewReference();
+        loginService.setName2("LoginService");
+        loginService.setGbeanName(PortletManager.getCurrentServer(request).getLoginService());
         XmlAttributeType config = realm.addNewXmlReference();
         // Construct the content to put in the XmlAttributeType
         GerLoginConfigDocument lcDoc = GerLoginConfigDocument.Factory.newInstance();

Modified: geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java?rev=351591&r1=351590&r2=351591&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
(original)
+++ geronimo/trunk/modules/j2ee/src/java/org/apache/geronimo/j2ee/management/impl/J2EEServerImpl.java
Thu Dec  1 21:08:11 2005
@@ -205,6 +205,16 @@
         return null;
     }
 
+    public String getLoginService() {
+        GBeanQuery query = new GBeanQuery(null, "org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean");
+        Set set = kernel.listGBeans(query);
+        for (Iterator it = set.iterator(); it.hasNext();) {
+            ObjectName name = (ObjectName) it.next();
+            return name.getCanonicalName();
+        }
+        return null;
+    }
+
     public String getServerVendor() {
         return SERVER_VENDOR;
     }

Modified: geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java?rev=351591&r1=351590&r2=351591&view=diff
==============================================================================
--- geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
(original)
+++ geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
Thu Dec  1 21:08:11 2005
@@ -87,4 +87,14 @@
      * @return The ObjectName of the ServerInfo, in String form.
      */
     public String getServerInfo();
+
+    /**
+     * Gets the ObjectName of the LoginService associated with this
+     * J2EEServer.
+     *
+     * @see org.apache.geronimo.security.jaas.server.JaasLoginServiceMBean
+     *
+     * @return The ObjectName of the LoginService, in String form.
+     */
+    public String getLoginService();
 }

Modified: geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java?rev=351591&r1=351590&r2=351591&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
(original)
+++ geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/jaas/server/JaasLoginService.java
Thu Dec  1 21:08:11 2005
@@ -453,6 +453,7 @@
         infoFactory.addOperation("syncPrincipals", new Class[]{JaasSessionId.class, Set.class});
 
         infoFactory.addReference("Realms", SecurityRealm.class, NameFactory.SECURITY_REALM);
+        infoFactory.addInterface(JaasLoginServiceMBean.class);
 
         infoFactory.setConstructor(new String[]{"algorithm", "password", "classLoader", "objectName"});
 



Mime
View raw message