You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/12/25 00:14:49 UTC

svn commit: r893821 - in /geronimo/server/trunk/plugins: console/console-core/src/main/java/org/apache/geronimo/console/util/ console/console-core/src/main/resources/OSGI-INF/blueprint/ pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/ plut...

Author: djencks
Date: Thu Dec 24 23:14:48 2009
New Revision: 893821

URL: http://svn.apache.org/viewvc?rev=893821&view=rev
Log:
GERONIMO-4965 update to DI changes in pluto

Modified:
    geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java
    geronimo/server/trunk/plugins/console/console-core/src/main/resources/OSGI-INF/blueprint/pluto-portal-services.xml
    geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalStartupListener.java
    geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PropertyConfigServiceImpl.java

Modified: geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java?rev=893821&r1=893820&r2=893821&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java (original)
+++ geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/KernelManagementHelper.java Thu Dec 24 23:14:48 2009
@@ -16,25 +16,6 @@
  */
 package org.apache.geronimo.console.util;
 
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-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 org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
@@ -42,34 +23,17 @@
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
-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.ConfigurationModuleType;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.EditableConfigurationManager;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.config.NoSuchStoreException;
+import org.apache.geronimo.kernel.config.*;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.osgi.BundleClassLoader;
-import org.apache.geronimo.kernel.proxy.GeronimoManagedBean;
 import org.apache.geronimo.kernel.proxy.ProxyManager;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.management.AppClientModule;
-import org.apache.geronimo.management.EJB;
-import org.apache.geronimo.management.EJBModule;
-import org.apache.geronimo.management.J2EEDeployedObject;
-import org.apache.geronimo.management.J2EEModule;
-import org.apache.geronimo.management.J2EEResource;
-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.Servlet;
+import org.apache.geronimo.logging.SystemLog;
+import org.apache.geronimo.management.*;
 import org.apache.geronimo.management.geronimo.J2EEApplication;
 import org.apache.geronimo.management.geronimo.J2EEDomain;
 import org.apache.geronimo.management.geronimo.J2EEServer;
-import org.apache.geronimo.management.geronimo.JCAAdminObject;
+import org.apache.geronimo.management.geronimo.*;
 import org.apache.geronimo.management.geronimo.JCAConnectionFactory;
 import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
 import org.apache.geronimo.management.geronimo.JCAResource;
@@ -78,7 +42,13 @@
 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
 import org.apache.geronimo.management.geronimo.WebModule;
 import org.apache.geronimo.security.jaas.JaasLoginModuleUse;
-import org.apache.geronimo.logging.SystemLog;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.*;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+import java.lang.reflect.Array;
+import java.util.*;
 
 /**
  * An implementation of the ManagementHelper interface that uses a Geronimo
@@ -94,14 +64,23 @@
     }
 
     public J2EEDomain[] getDomains() {
-        Set domainNames = kernel.listGBeans(new AbstractNameQuery(J2EEDomain.class.getName()));
-        J2EEDomain[] result = new J2EEDomain[domainNames.size()];
-        int i = 0;
-        for (Iterator iterator = domainNames.iterator(); iterator.hasNext();) {
-            AbstractName domainName = (AbstractName) iterator.next();
-            result[i++] = (J2EEDomain) kernel.getProxyManager().createProxy(domainName, J2EEDomain.class);
+        Set<AbstractName> domainNames = kernel.listGBeans(new AbstractNameQuery(J2EEDomain.class.getName()));
+        List<J2EEDomain> domains = new ArrayList<J2EEDomain>();
+        for (AbstractName domainName: domainNames) {
+            try {
+                domains.add((J2EEDomain) kernel.getGBean(domainName));
+            } catch (GBeanNotFoundException e) {
+                //ignore
+            }
         }
-        return result;
+        return domains.toArray(new J2EEDomain[domains.size()]);
+//        J2EEDomain[] result = new J2EEDomain[domainNames.size()];
+//        int i = 0;
+//        for (Iterator iterator = domainNames.iterator(); iterator.hasNext();) {
+//            AbstractName domainName = (AbstractName) iterator.next();
+//            result[i++] = (J2EEDomain) kernel.getProxyManager().createProxy(domainName, J2EEDomain.class);
+//        }
+//        return result;
     }
 
     public J2EEServer[] getServers(J2EEDomain domain) {
@@ -597,10 +576,10 @@
     }
 
     private<T> T proxify(T t, Class<T> clazz) {
-        if (!(t instanceof GeronimoManagedBean)) {
-            AbstractName name = kernel.getAbstractNameFor(t);
-            t = (T) kernel.getProxyManager().createProxy(name, clazz);
-        }
+//        if (!(t instanceof GeronimoManagedBean)) {
+//            AbstractName name = kernel.getAbstractNameFor(t);
+//            t = (T) kernel.getProxyManager().createProxy(name, clazz);
+//        }
         return t;
     }
 

Modified: geronimo/server/trunk/plugins/console/console-core/src/main/resources/OSGI-INF/blueprint/pluto-portal-services.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-core/src/main/resources/OSGI-INF/blueprint/pluto-portal-services.xml?rev=893821&r1=893820&r2=893821&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-core/src/main/resources/OSGI-INF/blueprint/pluto-portal-services.xml (original)
+++ geronimo/server/trunk/plugins/console/console-core/src/main/resources/OSGI-INF/blueprint/pluto-portal-services.xml Thu Dec 24 23:14:48 2009
@@ -42,6 +42,17 @@
 
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
 
+    <service id="PortletContainerService" interface="org.apache.pluto.container.PortletContainer"
+             ref="PortletContainer"/>
+    <bean id="PortletContainer" class="org.apache.pluto.container.impl.PortletContainerImpl" init-method="init">
+        <argument>
+            <bean factory-ref="DriverConfiguration" factory-method="getPortalName"/>
+        </argument>
+        <argument>
+            <ref component-id="PortalDriverServices"/>
+        </argument>
+    </bean>
+
     <bean id="PlutoServices"
           class="org.apache.pluto.container.driver.PlutoServices">
         <argument>
@@ -68,6 +79,19 @@
         <argument>
             <ref component-id="PortletURLListenerService"/>
         </argument>
+        <argument>
+            <null/>
+            <!--<bean class="org.apache.pluto.driver.container.DefaultOptionalContainerServices"/>-->
+        </argument>
+        <argument>
+            <ref component-id="PortletContextService"/>
+        </argument>
+        <argument>
+            <ref component-id="PortletContextService"/>
+        </argument>
+        <argument>
+            <bean class="org.apache.pluto.driver.container.DefaultPortalAdministrationService"/>
+        </argument>
     </bean>
 
     <bean id="PortalContext"
@@ -91,7 +115,7 @@
             <ref component-id="PortalURLParser"/>
         </argument>
         <argument>
-            <ref component-id="PropertyConfigService"/>
+            <ref component-id="ResourceConfigFactory"/>
         </argument>
         <argument>
             <ref component-id="RenderConfigService"/>
@@ -135,12 +159,12 @@
           factory-method="getParser">
     </bean>
 
-    <bean id="PropertyConfigService"
-          class="org.apache.pluto.driver.services.impl.resource.PropertyConfigServiceImpl">
-        <argument>
-            <ref component-id="ResourceConfigFactory"/>
-        </argument>
-    </bean>
+    <!--<bean id="PropertyConfigService"-->
+          <!--class="org.apache.pluto.driver.services.impl.resource.PropertyConfigServiceImpl">-->
+        <!--<argument>-->
+            <!--<ref component-id="ResourceConfigFactory"/>-->
+        <!--</argument>-->
+    <!--</bean>-->
 
     <bean id="RenderConfigService"
           class="org.apache.pluto.driver.services.impl.resource.RenderConfigServiceImpl">
@@ -152,7 +176,10 @@
     <bean id="SupportedModesService"
           class="org.apache.pluto.driver.services.impl.resource.SupportedModesServiceImpl">
         <argument>
-            <ref component-id="PropertyConfigService"/>
+            <ref component-id="ResourceConfigFactory"/>
+        </argument>
+        <argument>
+            <ref component-id="PortletContextService"/>
         </argument>
         <argument>
             <ref component-id="PortletContextService"/>
@@ -162,7 +189,10 @@
     <bean id="SupportedWindowStatesService"
           class="org.apache.pluto.driver.services.impl.resource.SupportedWindowStateServiceImpl">
         <argument>
-            <ref component-id="PropertyConfigService"/>
+            <ref component-id="ResourceConfigFactory"/>
+        </argument>
+        <argument>
+            <ref component-id="PortletContextService"/>
         </argument>
     </bean>
 
@@ -174,6 +204,12 @@
     </bean>
     <bean id="EventCoordinationService"
           class="org.apache.pluto.driver.services.container.EventCoordinationServiceImpl">
+        <argument>
+            <ref component-id="PortletContextService"/>
+        </argument>
+        <argument>
+            <ref component-id="PortletContextService"/>
+        </argument>
     </bean>
     <bean id="FilterManagerService"
           class="org.apache.pluto.driver.services.container.FilterManagerServiceImpl">
@@ -186,6 +222,9 @@
         <argument>
             <ref component-id="RequestDispatcherService"/>
         </argument>
+        <argument>
+            <bean class="org.apache.pluto.container.impl.PortletAppDescriptorServiceImpl"/>
+        </argument>
     </bean>
     <bean id="RequestDispatcherService"
           class="org.apache.pluto.container.impl.RequestDispatcherServiceImpl">
@@ -203,7 +242,7 @@
         </property>
         <!--<property name="portalCallbackService"><ref component-id="PortalCallbackService"/></property>-->
         <property name="propertyConfigService">
-            <ref component-id="PropertyConfigService"/>
+            <ref component-id="ResourceConfigFactory"/>
         </property>
         <property name="driverConfiguration">
             <ref component-id="DriverConfiguration"/>

Modified: geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalStartupListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalStartupListener.java?rev=893821&r1=893820&r2=893821&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalStartupListener.java (original)
+++ geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalStartupListener.java Thu Dec 24 23:14:48 2009
@@ -16,25 +16,19 @@
  */
 package org.apache.geronimo.pluto;
 
-import java.io.InputStream;
-
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.pluto.container.PortletContainer;
 import org.apache.pluto.container.PortletContainerException;
-import org.apache.pluto.container.driver.PortalDriverServices;
-import org.apache.pluto.container.impl.PortletContainerFactory;
+import org.apache.pluto.driver.AttributeKeys;
 import org.apache.pluto.driver.config.AdminConfiguration;
 import org.apache.pluto.driver.config.DriverConfiguration;
 import org.apache.pluto.driver.config.DriverConfigurationException;
-import org.apache.pluto.driver.container.ResourceSource;
-import org.apache.pluto.driver.AttributeKeys;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Listener used to start up / shut down the Pluto Portal Driver upon startup /
@@ -118,7 +112,7 @@
 
         LOG.debug(" [2a] Loading Optional AdminConfiguration. . .");
         serviceReference = bundleContext.getServiceReference(AdminConfiguration.class.getName());
-        AdminConfiguration adminConfiguration = (AdminConfiguration)bundleContext.getService(serviceReference);
+        AdminConfiguration adminConfiguration = (AdminConfiguration) bundleContext.getService(serviceReference);
 
         if (adminConfiguration != null) {
             LOG.debug(" [2b] Registering Optional AdminConfiguration");
@@ -132,32 +126,16 @@
         DriverConfiguration driverConfig = (DriverConfiguration)
                 servletContext.getAttribute(DRIVER_CONFIG_KEY);
 
-        try {
-            LOG.info("Initializing Portlet Container. . .");
+        LOG.info("Initializing Portlet Container. . .");
 
-            // Create portlet container.
-            LOG.debug(" [1] Creating portlet container...");
-            serviceReference = bundleContext.getServiceReference(PortalDriverServices.class.getName());
-            PortletContainerFactory factory =
-                    PortletContainerFactory.getInstance();
-            PortalDriverServices portalDriverServices = (PortalDriverServices) bundleContext.getService(serviceReference);
-            PortletContainer container = factory.createContainer(driverConfig.getContainerName(), portalDriverServices);
-
-            // Initialize portlet container.
-            LOG.debug(" [2] Initializing portlet container...");
-            container.init();
-
-            // Save portlet container to the servlet context scope.
-            servletContext.setAttribute(CONTAINER_KEY, container);
-            LOG.info("Pluto portlet container started.");
-
-        } catch (DriverConfigurationException ex) {
-            LOG.error("Unable to retrieve driver configuration "
-                    + "due to configuration error: " + ex.getMessage(), ex);
-        } catch (PortletContainerException ex) {
-            LOG.error("Unable to start up portlet container: "
-                    + ex.getMessage(), ex);
-        }
+        // Create portlet container.
+        LOG.debug(" [1] Creating portlet container...");
+        serviceReference = bundleContext.getServiceReference(PortletContainer.class.getName());
+        PortletContainer container = (PortletContainer) bundleContext.getService(serviceReference);
+
+        // Save portlet container to the servlet context scope.
+        servletContext.setAttribute(CONTAINER_KEY, container);
+        LOG.info("Pluto portlet container started.");
 
         LOG.info("********** Pluto Portal Driver Started **********\n\n");
     }
@@ -196,17 +174,7 @@
         PortletContainer container = (PortletContainer)
                 servletContext.getAttribute(CONTAINER_KEY);
         if (container != null) {
-            try {
-                container.destroy();
-                if (LOG.isInfoEnabled()) {
-                    LOG.info("Pluto Portal Driver shut down.");
-                }
-            } catch (PortletContainerException ex) {
-                LOG.error("Unable to shut down portlet container: "
-                        + ex.getMessage(), ex);
-            } finally {
-                servletContext.removeAttribute(CONTAINER_KEY);
-            }
+            servletContext.removeAttribute(CONTAINER_KEY);
         }
     }
 
@@ -219,17 +187,17 @@
         DriverConfiguration driverConfig = (DriverConfiguration)
                 servletContext.getAttribute(DRIVER_CONFIG_KEY);
         if (driverConfig != null) {
-            try {
-                driverConfig.destroy();
-                if (LOG.isInfoEnabled()) {
-                    LOG.info("Pluto Portal Driver Config destroyed.");
-                }
-            } catch (DriverConfigurationException ex) {
-                LOG.error("Unable to destroy portal driver config: "
-                        + ex.getMessage(), ex);
-            } finally {
+//            try {
+//                driverConfig.destroy();
+//                if (LOG.isInfoEnabled()) {
+//                    LOG.info("Pluto Portal Driver Config destroyed.");
+//                }
+//            } catch (DriverConfigurationException ex) {
+//                LOG.error("Unable to destroy portal driver config: "
+//                        + ex.getMessage(), ex);
+//            } finally {
                 servletContext.removeAttribute(DRIVER_CONFIG_KEY);
-            }
+//            }
         }
     }
 
@@ -242,17 +210,17 @@
         AdminConfiguration adminConfig = (AdminConfiguration)
                 servletContext.getAttribute(ADMIN_CONFIG_KEY);
         if (adminConfig != null) {
-            try {
-                adminConfig.destroy();
-                if (LOG.isInfoEnabled()) {
-                    LOG.info("Pluto Portal Admin Config destroyed.");
-                }
-            } catch (DriverConfigurationException ex) {
-                LOG.error("Unable to destroy portal admin config: "
-                        + ex.getMessage(), ex);
-            } finally {
+//            try {
+//                adminConfig.destroy();
+//                if (LOG.isInfoEnabled()) {
+//                    LOG.info("Pluto Portal Admin Config destroyed.");
+//                }
+//            } catch (DriverConfigurationException ex) {
+//                LOG.error("Unable to destroy portal admin config: "
+//                        + ex.getMessage(), ex);
+//            } finally {
                 servletContext.removeAttribute(ADMIN_CONFIG_KEY);
-            }
+//            }
         }
     }
 

Modified: geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PropertyConfigServiceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PropertyConfigServiceImpl.java?rev=893821&r1=893820&r2=893821&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PropertyConfigServiceImpl.java (original)
+++ geronimo/server/trunk/plugins/pluto/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/impl/PropertyConfigServiceImpl.java Thu Dec 24 23:14:48 2009
@@ -16,13 +16,10 @@
  */
 package org.apache.geronimo.pluto.impl;
 
-import java.io.InputStream;
 import java.util.Set;
 
-import org.apache.pluto.driver.config.DriverConfigurationException;
-import org.apache.pluto.driver.container.ResourceSource;
-import org.apache.pluto.driver.services.portal.PropertyConfigService;
 import org.apache.pluto.driver.services.impl.resource.ResourceConfig;
+import org.apache.pluto.driver.services.portal.PropertyConfigService;
 
 /**
  * Default implementation of all of the portal Services.
@@ -49,28 +46,20 @@
         this.config = config;
     }
 
-    /**
-     * Initialization Lifecycle Method
-     * @param ctx ServletContext for finding resources
-     */
-    public void init(ResourceSource ctx) {
-        try {
-            InputStream in = ctx.getResourceAsStream(ResourceConfigReader.CONFIG_FILE);
-            config = ResourceConfigReader.getFactory().parse(in);
-        }
-        catch(Exception e) {
-//            LOG.error("Unable to parse resource config "+e.getMessage(), e);
-            throw new DriverConfigurationException(e);
-        }
-    }
-
-    /**
-     * Shutdown the ResourceService.
-     */
-    public void destroy() {
-        config = null;
-    }
-
+//    /**
+//     * Initialization Lifecycle Method
+//     * @param ctx ServletContext for finding resources
+//     */
+//    public void init(ResourceSource ctx) {
+//    }
+//
+//    /**
+//     * Shutdown the ResourceService.
+//     */
+//    public void destroy() {
+//        config = null;
+//    }
+//
 
     public String getPortalName() {
         return config.getPortalName();