You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/08/11 14:24:16 UTC
svn commit: r231430 - in
/portals/pluto/branches/pluto-1.1/pluto-portal/src/main:
java/org/apache/pluto/driver/ java/org/apache/pluto/driver/config/
java/org/apache/pluto/driver/core/ java/org/apache/pluto/driver/services/
java/org/apache/pluto/driver/...
Author: ddewolf
Date: Thu Aug 11 05:24:03 2005
New Revision: 231430
URL: http://svn.apache.org/viewcvs?rev=231430&view=rev
Log:
Introducing Spring Injected Services into the Portal Driver Configuration:
-- Initial Refactor
-- Added Services Interfaces
-- Added "resource" implementation which reads xml config from /WEB-INF/*
Added:
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationException.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/DriverConfigurationService.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PortletRegistryService.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PropertyConfigService.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/RenderConfigService.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/package.html
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/Configuration.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ConfigurationFactory.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PageConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletApplicationConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletWindowConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceServicesImpl.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
Removed:
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/PageConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/PortalDisplayConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/PortletApplicationConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/PortletWindowConfig.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/RenderConfig.java
Modified:
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalStartupListener.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/core/PortletWindowImpl.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/tags/PortletTag.java
portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/fragments/template.jsp
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalDriverServlet.java Thu Aug 11 05:24:03 2005
@@ -15,27 +15,25 @@
*/
package org.apache.pluto.driver;
-import java.io.IOException;
-
-import javax.portlet.PortletException;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletContainerException;
import org.apache.pluto.driver.config.DriverConfiguration;
-import org.apache.pluto.driver.config.PageConfig;
-import org.apache.pluto.driver.config.PortletWindowConfig;
-import org.apache.pluto.driver.config.RenderConfig;
import org.apache.pluto.driver.core.PortalEnvironment;
import org.apache.pluto.driver.core.PortalURL;
import org.apache.pluto.driver.core.PortletWindowImpl;
+import org.apache.pluto.driver.services.impl.resource.PageConfig;
+import org.apache.pluto.driver.services.impl.resource.PortletWindowConfig;
+
+import javax.portlet.PortletException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
/**
* The controller servlet used to drive the Portal Driver. All requests mapped
@@ -127,8 +125,7 @@
LOG.debug("Rendering Portal: Requested Page: " + currentPage);
}
- RenderConfig renderConfig = driverConfig.getRenderConfig();
- return renderConfig.getPageConfig(currentPage);
+ return driverConfig.getPageConfig(currentPage);
}
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalStartupListener.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalStartupListener.java?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalStartupListener.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/PortalStartupListener.java Thu Aug 11 05:24:03 2005
@@ -15,24 +15,20 @@
*/
package org.apache.pluto.driver;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletContainerException;
import org.apache.pluto.PortletContainerFactory;
import org.apache.pluto.driver.config.DriverConfiguration;
+import org.apache.pluto.driver.config.DriverConfigurationException;
import org.apache.pluto.driver.config.DriverConfigurationFactory;
import org.apache.pluto.driver.services.container.ContainerServicesImpl;
import org.apache.pluto.driver.services.container.PortalContextImpl;
-import org.apache.pluto.driver.services.container.PortalContextImpl;
-import org.xml.sax.SAXException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
/**
* Listener used to start up the Pluto Portal Driver upon
@@ -48,8 +44,6 @@
LogFactory.getLog(PortalStartupListener.class);
/** The location of the portal driver configuration. */
- private static final String CONFIG_FILE =
- "/WEB-INF/pluto-portal-driver-config.xml";
/** The KEY with which the container is bound to the context. */
private static final String CONTAINER_KEY = AttributeKeys.PORTLET_CONTAINER;
@@ -76,15 +70,12 @@
ServletContext ctx = event.getServletContext();
try {
if (LOG.isDebugEnabled()) {
- LOG.debug("Starting Pluto Portal Driver. . .");
+ LOG.debug("Starting Pluto Portal Driver . . .");
+ LOG.debug(" - Retreaving Driver Configuration . . .");
}
- InputStream in = ctx.getResourceAsStream(CONFIG_FILE);
- if (LOG.isDebugEnabled()) {
- LOG.debug(" - Reading Configuration. . .");
- }
DriverConfiguration config =
- DriverConfigurationFactory.getFactory().parse(in);
+ DriverConfigurationFactory.getFactory().getConfig(ctx);
if (LOG.isDebugEnabled()) {
LOG.debug(
@@ -107,8 +98,11 @@
}
PortletContainerFactory factory = PortletContainerFactory.getInstance();
- PortletContainer container = factory.createContainer(
- config.getContainerName(), impl);
+ PortletContainer container =
+ factory.createContainer(
+ config.getContainerName(),
+ impl
+ );
if (LOG.isDebugEnabled()) {
LOG.debug(" - Starting Portlet Container");
@@ -122,20 +116,17 @@
ctx.setAttribute(CONFIG_KEY, config);
ctx.setAttribute(CONTAINER_KEY, container);
- } catch (IOException io) {
- LOG.error(
- "Unable to start portal. Configuration not found at '" +
- CONFIG_FILE +
- "'.",
- io);
- } catch (SAXException sax) {
+
+ } catch (DriverConfigurationException exception) {
LOG.error(
- "Unable to start portal. Invalid configuration found at '" +
- CONFIG_FILE +
- "'.",
- sax);
+ "Unable to retrieve driver configuration due to configuration error.",
+ exception
+ );
} catch (PortletContainerException exception) {
- LOG.error("Unable to start portlet container. ", exception);
+ LOG.error(
+ "Unable to start portlet container due to configuration error.",
+ exception
+ );
}
}
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfiguration.java Thu Aug 11 05:24:03 2005
@@ -15,53 +15,34 @@
*/
package org.apache.pluto.driver.config;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Map;
+import org.apache.pluto.driver.services.PortletRegistryService;
+import org.apache.pluto.driver.services.PropertyConfigService;
+import org.apache.pluto.driver.services.RenderConfigService;
+import org.apache.pluto.driver.services.impl.resource.PortletApplicationConfig;
+import org.apache.pluto.driver.services.impl.resource.PortletWindowConfig;
+import org.apache.pluto.driver.services.impl.resource.PageConfig;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.Collection;
/**
- * Encapsulation of the Pluto Driver Configuration Info.
+ * Encapsulation of the Pluto Driver Configuration.
*
* @author <a href="ddewolf@apache.org">David H. DeWolf</a>
* @version 1.0
* @since Sep 23, 2004
*/
public class DriverConfiguration {
- /** Internal Logger. */
- private static final Log LOG =
- LogFactory.getLog(DriverConfiguration.class);
-
- /** The name of the portal. */
- private String portalName;
-
- /** The Version of the Portal. */
- private String portalVersion;
-
- /** The name of the container wrapped by this portal. */
- private String containerName;
-
- /** The portlet modes we will support. */
- private Collection supportedPortletModes;
-
- /** The window states we will support. */
- private Collection supportedWindowStates;
- /** The portlet applications registered with us. */
- private Map portletApplications;
-
- /** Encapsulation of render configuration data. */
- private RenderConfig renderConfig;
-
- /**
- * Default Constructor.
- */
- public DriverConfiguration() {
- this.supportedWindowStates = new ArrayList();
- this.supportedPortletModes = new ArrayList();
- this.portletApplications = new java.util.HashMap();
+ private PropertyConfigService propertyService;
+ private PortletRegistryService registryService;
+ private RenderConfigService renderService;
+
+ public DriverConfiguration(PropertyConfigService propertyService,
+ PortletRegistryService registryService,
+ RenderConfigService renderService) {
+ this.propertyService = propertyService;
+ this.registryService = registryService;
+ this.renderService = renderService;
}
/**
@@ -69,15 +50,7 @@
* @return the name of the portal.
*/
public String getPortalName() {
- return portalName;
- }
-
- /**
- * Standard Getter.
- * @param portalName the name of the portal.
- */
- public void setPortalName(String portalName) {
- this.portalName = portalName;
+ return propertyService.getPortalName();
}
/**
@@ -85,15 +58,7 @@
* @return the portal version.
*/
public String getPortalVersion() {
- return portalVersion;
- }
-
- /**
- * Standard Setter.
- * @param portalVersion the portal version.
- */
- public void setPortalVersion(String portalVersion) {
- this.portalVersion = portalVersion;
+ return propertyService.getPortalVersion();
}
/**
@@ -101,15 +66,7 @@
* @return the name of the container.
*/
public String getContainerName() {
- return containerName;
- }
-
- /**
- * Standard Setter.
- * @param containerName the name of the container.
- */
- public void setContainerName(String containerName) {
- this.containerName = containerName;
+ return propertyService.getContainerName();
}
/**
@@ -117,23 +74,7 @@
* @return the names of the supported portlet modes.
*/
public Collection getSupportedPortletModes() {
- return supportedPortletModes;
- }
-
- /**
- * Standard Setter.
- * @param supportedPortletModes the names of the supported portlet modes.
- */
- public void setSupportedPortletModes(Collection supportedPortletModes) {
- this.supportedPortletModes = supportedPortletModes;
- }
-
- /**
- * Add the named supported portlet mode to the list of supported modes.
- * @param mode a supported mode.
- */
- public void addSupportedPortletMode(String mode) {
- supportedPortletModes.add(mode);
+ return propertyService.getSupportedPortletModes();
}
/**
@@ -141,23 +82,7 @@
* @return the names of the supported window states.
*/
public Collection getSupportedWindowStates() {
- return supportedWindowStates;
- }
-
- /**
- * Standard Setter.
- * @param supportedWindowStates the names of the supported window states.
- */
- public void setSupportedWindowStates(Collection supportedWindowStates) {
- this.supportedWindowStates = supportedWindowStates;
- }
-
- /**
- * Add the named supported window state to the list of supported states.
- * @param state the name of the supported state.
- */
- public void addSupportedWindowState(String state) {
- this.supportedWindowStates.add(state);
+ return propertyService.getSupportedWindowStates();
}
/**
@@ -165,29 +90,16 @@
* @return the configuration data of all configured portlet applications.
*/
public Collection getPortletApplications() {
- return portletApplications.values();
+ return registryService.getPortletApplications();
}
- /**
- * Add a porltet applicaiton conofiguration to this list of portlet apps.
- * @param app portlet application coniguration data.
- */
- public void addPortletApp(PortletApplicationConfig app) {
- if (LOG.isDebugEnabled()) {
- LOG.debug(
- " - - Adding PortletApp Configuration for: " +
- app.getContextPath());
- }
- portletApplications.put(app.getContextPath(), app);
- }
-
- /**
+ /**
* Retrieve the portlet application with the given id.
* @param id the id of the portlet application.
* @return the portlet application configuration data.
*/
public PortletApplicationConfig getPortletApp(String id) {
- return (PortletApplicationConfig) portletApplications.get(id);
+ return registryService.getPortletApplication(id);
}
/**
@@ -196,62 +108,19 @@
* @return the portlet window configuration data.
*/
public PortletWindowConfig getPortletWindowConfig(String id) {
- if (id == null) {
- return null;
- }
- String context = getContextFromPortletId(id);
- String portlet = getPortletNameFromPortletId(id);
-
- PortletApplicationConfig app = getPortletApp(context);
- if (app == null) {
- if (LOG.isErrorEnabled()) {
- LOG.error("Portlet Application '" + context + "' not found.");
- }
- return null;
- }
- return app.getPortlet(portlet);
+ return registryService.getPortlet(id);
}
/**
* Standard Getter.
* @return the render configuration.
*/
- public RenderConfig getRenderConfig() {
- return renderConfig;
- }
-
- /**
- * Standard Setter.
- * @param renderConfig the render configuration.
- */
- public void setRenderConfig(RenderConfig renderConfig) {
- this.renderConfig = renderConfig;
+ public Collection getPages() {
+ return renderService.getPages();
}
- /**
- * Retrieve the id of the context from the portlet id.
- * @param portletId the id of the portlet.
- * @return the context, derived from the portlet id.
- */
- private String getContextFromPortletId(String portletId) {
- int idx = portletId.indexOf(".");
- if (idx < 0) {
- return null;
- }
- return portletId.substring(0, idx);
- }
-
- /**
- * Retreive the porlet name from the given portletId.
- * @param portletId the portlet id.
- * @return the name of the portlet.
- */
- private String getPortletNameFromPortletId(String portletId) {
- int idx = portletId.indexOf(".");
- if (idx < 0) {
- return null;
- }
- return portletId.substring(idx + 1);
+ public PageConfig getPageConfig(String pageId) {
+ return renderService.getPage(pageId);
}
}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationException.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationException.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationException.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationException.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004 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.pluto.driver.config;
+
+/**
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @todo Document
+ * @since Aug 10, 2005
+ */
+public class DriverConfigurationException extends RuntimeException {
+
+ public DriverConfigurationException() {
+ }
+
+ public DriverConfigurationException(String message) {
+ super(message);
+ }
+
+ public DriverConfigurationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DriverConfigurationException(Throwable cause) {
+ super(cause);
+ }
+}
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/config/DriverConfigurationFactory.java Thu Aug 11 05:24:03 2005
@@ -15,13 +15,15 @@
*/
package org.apache.pluto.driver.config;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.commons.digester.Digester;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.xml.sax.SAXException;
+import org.apache.pluto.driver.services.PortletRegistryService;
+import org.apache.pluto.driver.services.PropertyConfigService;
+import org.apache.pluto.driver.services.RenderConfigService;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+
+import javax.servlet.ServletContext;
+import java.io.InputStream;
/**
* @author <a href="ddewolf@apache.org">David H. DeWolf</a>
@@ -33,6 +35,10 @@
private static final Log LOG =
LogFactory.getLog(DriverConfigurationFactory.class);
+ private static final String DRIVER_CONFIG =
+ "/WEB-INF/pluto-portal-driver-services-config.xml";
+
+
private static DriverConfigurationFactory factory;
public static DriverConfigurationFactory getFactory() {
@@ -42,74 +48,43 @@
return factory;
}
- private Digester digester;
-
private DriverConfigurationFactory() {
- digester = new Digester();
- digester.setLogger(LOG);
- digester.setClassLoader(Thread.currentThread().getContextClassLoader());
- init();
- }
- public DriverConfiguration parse(InputStream in)
- throws IOException, SAXException {
- return (DriverConfiguration) digester.parse(in);
}
+ public DriverConfiguration getConfig(ServletContext context) {
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("Retrieving driver configuration from: "+DRIVER_CONFIG);
+ }
-// Digester Setup
+ InputStream in =
+ context.getResourceAsStream(DRIVER_CONFIG);
- private void init() {
- digester.addObjectCreate("pluto-portal-driver",
- DriverConfiguration.class);
- digester.addBeanPropertySetter("pluto-portal-driver/portal-name",
- "portalName");
- digester.addBeanPropertySetter("pluto-portal-driver/portal-version",
- "portalVersion");
- digester.addBeanPropertySetter("pluto-portal-driver/container-name",
- "containerName");
-
- digester.addCallMethod("pluto-portal-driver/supports/portlet-mode",
- "addSupportedPortletMode", 0);
- digester.addCallMethod("pluto-portal-driver/supports/window-state",
- "addSupportedWindowState", 0);
-
- digester.addObjectCreate("pluto-portal-driver/portlet-app",
- PortletApplicationConfig.class);
- digester.addBeanPropertySetter(
- "pluto-portal-driver/portlet-app/context-path", "contextPath");
-
- digester.addObjectCreate(
- "pluto-portal-driver/portlet-app/portlets/portlet",
- PortletWindowConfig.class);
- digester.addSetProperties(
- "pluto-portal-driver/portlet-app/portlets/portlet", "name",
- "portletName");
- digester.addSetNext("pluto-portal-driver/portlet-app/portlets/portlet",
- "addPortlet");
- digester.addSetNext("pluto-portal-driver/portlet-app", "addPortletApp");
-
- digester.addObjectCreate("pluto-portal-driver/render-config",
- RenderConfig.class);
- digester.addSetProperties("pluto-portal-driver/render-config",
- "default", "defaultPageId");
- digester.addObjectCreate("pluto-portal-driver/render-config/page",
- PageConfig.class);
- digester.addSetProperties("pluto-portal-driver/render-config/page");
- digester.addCallMethod(
- "pluto-portal-driver/render-config/page/portlet", "addPortlet", 2);
- digester.addCallParam("pluto-portal-driver/render-config/page/portlet",
- 0, "context");
- digester.addCallParam("pluto-portal-driver/render-config/page/portlet",
- 1, "name");
- digester.addSetNext("pluto-portal-driver/render-config/page",
- "addPage");
- digester.addSetNext("pluto-portal-driver/render-config",
- "setRenderConfig");
+ XmlBeanFactory beanFactory = new XmlBeanFactory(in);
+ PropertyConfigService propService = (PropertyConfigService)
+ beanFactory.getBean("PropertyConfigService");
+ propService.init(context);
+
+ PortletRegistryService registryService = (PortletRegistryService)
+ beanFactory.getBean("PortletRegistryService");
+ registryService.init(context);
+
+ RenderConfigService renderService = (RenderConfigService)
+ beanFactory.getBean("RenderConfigService");
+ renderService.init(context);
+
+ if(LOG.isDebugEnabled()) {
+ LOG.debug("PropertyConfigService Found: "+propService.getClass().getName());
+ LOG.debug("PortletRegistryService Found: "+registryService.getClass().getName());
+ LOG.debug("RenderConfigService Found: "+renderService.getClass().getName());
+ }
+ return new DriverConfiguration(
+ propService,
+ registryService,
+ renderService
+ );
}
-
-
}
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/core/PortletWindowImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/core/PortletWindowImpl.java?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/core/PortletWindowImpl.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/core/PortletWindowImpl.java Thu Aug 11 05:24:03 2005
@@ -23,7 +23,7 @@
import javax.portlet.WindowState;
import org.apache.pluto.PortletWindow;
-import org.apache.pluto.driver.config.PortletWindowConfig;
+import org.apache.pluto.driver.services.impl.resource.PortletWindowConfig;
import org.apache.pluto.driver.util.ObjectIdImpl;
import org.apache.pluto.om.ObjectID;
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/DriverConfigurationService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/DriverConfigurationService.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/DriverConfigurationService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/DriverConfigurationService.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004 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.pluto.driver.services;
+
+import org.apache.pluto.driver.config.DriverConfigurationException;
+
+import javax.servlet.ServletContext;
+
+/**
+ * Abstract interface defining lifecycle methods for
+ * Driver configuration services.
+ *
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @since Aug 10, 2005
+ */
+public interface DriverConfigurationService {
+
+ /**
+ * Initialize the service for use by the driver.
+ * This method allows the service to retrieve required
+ * resources from the context and instantiate any required
+ * services.
+ *
+ * @param ctx the Portal's servlet context in which the
+ * service will be executing.
+ *
+ */
+ void init(ServletContext ctx) throws DriverConfigurationException;
+
+ /**
+ * Destroy the service, notifying it of shutdown.
+ */
+ void destroy() throws DriverConfigurationException;
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PortletRegistryService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PortletRegistryService.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PortletRegistryService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PortletRegistryService.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004 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.pluto.driver.services;
+
+import org.apache.pluto.driver.services.impl.resource.PortletWindowConfig;
+import org.apache.pluto.driver.services.impl.resource.PortletApplicationConfig;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @since Aug 10, 2005
+ */
+public interface PortletRegistryService extends DriverConfigurationService {
+
+ /**
+ * A set of all Portlet Applications
+ * @return a set of uniqe PortletAppConfig instances.
+ */
+ Set getPortletApplications();
+
+ /**
+ * Retrieves the PortletAppConfig associated
+ * with the specified id.
+ * @param id the unique id of the portlet application config
+ * @return the PortletAppConfig instance for the specified id.
+ */
+ PortletApplicationConfig getPortletApplication(String id);
+
+ /**
+ * Utility method used to retrieve a portlet
+ * directly from the service to prevent the driver
+ * from needing to navigate the portlet application
+ * object graph.
+ *
+ * @param id the unique id of the portlet being requested.
+ * @return PortletWindowConfig for the specified id.
+ */
+ PortletWindowConfig getPortlet(String id);
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PropertyConfigService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PropertyConfigService.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PropertyConfigService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/PropertyConfigService.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2004 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.pluto.driver.services;
+
+import java.util.Set;
+
+/**
+ * Service interface which defines the methods required
+ * for a provider wishing to provide property management.
+ *
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @since Aug 10, 2005
+ */
+public interface PropertyConfigService extends DriverConfigurationService {
+
+ /**
+ * Name of the portal driver.
+ * @return the name of this portal implementation
+ */
+ String getPortalName();
+
+ /**
+ * Portal driver version.
+ * @return version information
+ */
+ String getPortalVersion();
+
+ /**
+ * Unique name of the Portlet Container
+ * used to service this portal instance.
+ * @return container name
+ */
+ String getContainerName();
+
+ /**
+ * Set of unique Portlet Modes.
+ * The set must include
+ * {@link javax.portlet.PortletMode.VIEW},
+ * {@link javax.portlet.PortletMode.EDIT}, and
+ * {@link javax.portlet.PortletMode.HELP}
+ * @return set of unique portlet modes.
+ */
+ Set getSupportedPortletModes();
+
+ /**
+ * Set of unique Window States.
+ * The set must include:
+ * {@link javax.portlet.WindowState.NORMAL},
+ * {@link javax.portlet.WindowState.MAXIMIZED}, and
+ * {@link javax.portlet.WindowState.MINIMIZED}
+ * @return set of unique window states.
+ */
+ Set getSupportedWindowStates();
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/RenderConfigService.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/RenderConfigService.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/RenderConfigService.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/RenderConfigService.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 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.pluto.driver.services;
+
+import org.apache.pluto.driver.services.impl.resource.PageConfig;
+
+import java.util.List;
+
+/**
+ * Service interface defining methods necessary for
+ * a provider wishing to manage page administration.
+ *
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @since Aug 10, 2005
+ */
+public interface RenderConfigService extends DriverConfigurationService {
+
+ /**
+ * Retrieve an ordered list of all PageConfig instances.
+ * @return list of all PageConfig instances.
+ */
+ List getPages();
+
+ /**
+ * Retrieve the PageConfig for the default
+ * page.
+ * @return PageConfig instance of the default page.
+ */
+ PageConfig getDefaultPage();
+
+ /**
+ * Retrieve the PageConfig for the given
+ * page id.
+ *
+ * @param id
+ * @return PageConfig instance for the specified id.
+ */
+ PageConfig getPage(String id);
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/package.html
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/package.html?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/package.html (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/package.html Thu Aug 11 05:24:03 2005
@@ -0,0 +1,14 @@
+<HTML>
+<BODY>
+Service implementations of the driver configuration services.
+
+<li><b>rdbms</b>:
+ Relational Database Management System implementations.
+</li>
+
+<li><b>resource</b>:
+ Classpath Resources (file) based implementations.
+</li>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/Configuration.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/Configuration.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/Configuration.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/Configuration.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,255 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.*;
+
+/**
+ * Encapsulation of the Pluto Driver Configuration Info.
+ *
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 23, 2004
+ */
+public class Configuration {
+ /** Internal Logger. */
+ private static final Log LOG =
+ LogFactory.getLog(Configuration.class);
+
+ /** The name of the portal. */
+ private String portalName;
+
+ /** The Version of the Portal. */
+ private String portalVersion;
+
+ /** The name of the container wrapped by this portal. */
+ private String containerName;
+
+ /** The portlet modes we will support. */
+ private Set supportedPortletModes;
+
+ /** The window states we will support. */
+ private Set supportedWindowStates;
+
+ /** The portlet applications registered with us. */
+ private Map portletApplications;
+
+ /** Encapsulation of render configuration data. */
+ private RenderConfig renderConfig;
+
+ /**
+ * Default Constructor.
+ */
+ public Configuration() {
+ this.supportedWindowStates = new HashSet();
+ this.supportedPortletModes = new HashSet();
+ this.portletApplications = new java.util.HashMap();
+ }
+
+ /**
+ * Standard Getter.
+ * @return the name of the portal.
+ */
+ public String getPortalName() {
+ return portalName;
+ }
+
+ /**
+ * Standard Getter.
+ * @param portalName the name of the portal.
+ */
+ public void setPortalName(String portalName) {
+ this.portalName = portalName;
+ }
+
+ /**
+ * Standard Getter.
+ * @return the portal version.
+ */
+ public String getPortalVersion() {
+ return portalVersion;
+ }
+
+ /**
+ * Standard Setter.
+ * @param portalVersion the portal version.
+ */
+ public void setPortalVersion(String portalVersion) {
+ this.portalVersion = portalVersion;
+ }
+
+ /**
+ * Standard Getter.
+ * @return the name of the container.
+ */
+ public String getContainerName() {
+ return containerName;
+ }
+
+ /**
+ * Standard Setter.
+ * @param containerName the name of the container.
+ */
+ public void setContainerName(String containerName) {
+ this.containerName = containerName;
+ }
+
+ /**
+ * Standard Getter.
+ * @return the names of the supported portlet modes.
+ */
+ public Set getSupportedPortletModes() {
+ return supportedPortletModes;
+ }
+
+ /**
+ * Standard Setter.
+ * @param supportedPortletModes the names of the supported portlet modes.
+ */
+ public void setSupportedPortletModes(Set supportedPortletModes) {
+ this.supportedPortletModes = supportedPortletModes;
+ }
+
+ /**
+ * Add the named supported portlet mode to the list of supported modes.
+ * @param mode a supported mode.
+ */
+ public void addSupportedPortletMode(String mode) {
+ supportedPortletModes.add(mode);
+ }
+
+ /**
+ * Standard Getter.
+ * @return the names of the supported window states.
+ */
+ public Set getSupportedWindowStates() {
+ return supportedWindowStates;
+ }
+
+ /**
+ * Standard Setter.
+ * @param supportedWindowStates the names of the supported window states.
+ */
+ public void setSupportedWindowStates(Set supportedWindowStates) {
+ this.supportedWindowStates = supportedWindowStates;
+ }
+
+ /**
+ * Add the named supported window state to the list of supported states.
+ * @param state the name of the supported state.
+ */
+ public void addSupportedWindowState(String state) {
+ this.supportedWindowStates.add(state);
+ }
+
+ /**
+ * Standard Getter.
+ * @return the configuration data of all configured portlet applications.
+ */
+ public Set getPortletApplications() {
+ return new HashSet(portletApplications.values());
+ }
+
+ /**
+ * Add a porltet applicaiton conofiguration to this list of portlet apps.
+ * @param app portlet application coniguration data.
+ */
+ public void addPortletApp(PortletApplicationConfig app) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(
+ " - - Adding PortletApp Configuration for: " +
+ app.getContextPath());
+ }
+ portletApplications.put(app.getContextPath(), app);
+ }
+
+ /**
+ * Retrieve the portlet application with the given id.
+ * @param id the id of the portlet application.
+ * @return the portlet application configuration data.
+ */
+ public PortletApplicationConfig getPortletApp(String id) {
+ return (PortletApplicationConfig) portletApplications.get(id);
+ }
+
+ /**
+ * Retrieve the window configuration associated with the given id.
+ * @param id the id of the portlet window.
+ * @return the portlet window configuration data.
+ */
+ public PortletWindowConfig getPortletWindowConfig(String id) {
+ if (id == null) {
+ return null;
+ }
+ String context = getContextFromPortletId(id);
+ String portlet = getPortletNameFromPortletId(id);
+
+ PortletApplicationConfig app = getPortletApp(context);
+ if (app == null) {
+ if (LOG.isErrorEnabled()) {
+ LOG.error("Portlet Application '" + context + "' not found.");
+ }
+ return null;
+ }
+ return app.getPortlet(portlet);
+ }
+
+ /**
+ * Standard Getter.
+ * @return the render configuration.
+ */
+ public RenderConfig getRenderConfig() {
+ return renderConfig;
+ }
+
+ /**
+ * Standard Setter.
+ * @param renderConfig the render configuration.
+ */
+ public void setRenderConfig(RenderConfig renderConfig) {
+ this.renderConfig = renderConfig;
+ }
+
+ /**
+ * Retrieve the id of the context from the portlet id.
+ * @param portletId the id of the portlet.
+ * @return the context, derived from the portlet id.
+ */
+ private String getContextFromPortletId(String portletId) {
+ int idx = portletId.indexOf(".");
+ if (idx < 0) {
+ return null;
+ }
+ return portletId.substring(0, idx);
+ }
+
+ /**
+ * Retreive the porlet name from the given portletId.
+ * @param portletId the portlet id.
+ * @return the name of the portlet.
+ */
+ private String getPortletNameFromPortletId(String portletId) {
+ int idx = portletId.indexOf(".");
+ if (idx < 0) {
+ return null;
+ }
+ return portletId.substring(idx + 1);
+ }
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ConfigurationFactory.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ConfigurationFactory.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ConfigurationFactory.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ConfigurationFactory.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ * @version 1.0
+ * @since Sep 23, 2004
+ */
+class ConfigurationFactory {
+
+ private static final Log LOG =
+ LogFactory.getLog(ConfigurationFactory.class);
+
+ private static ConfigurationFactory factory;
+
+ public static ConfigurationFactory getFactory() {
+ if (factory == null) {
+ factory = new ConfigurationFactory();
+ }
+ return factory;
+ }
+
+ private Digester digester;
+
+ private ConfigurationFactory() {
+ digester = new Digester();
+ digester.setLogger(LOG);
+ digester.setClassLoader(Thread.currentThread().getContextClassLoader());
+ init();
+ }
+
+ public Configuration parse(InputStream in)
+ throws IOException, SAXException {
+ return (Configuration) digester.parse(in);
+ }
+
+
+// Digester Setup
+
+ private void init() {
+ digester.addObjectCreate("pluto-portal-driver",
+ Configuration.class);
+ digester.addBeanPropertySetter("pluto-portal-driver/portal-name",
+ "portalName");
+ digester.addBeanPropertySetter("pluto-portal-driver/portal-version",
+ "portalVersion");
+ digester.addBeanPropertySetter("pluto-portal-driver/container-name",
+ "containerName");
+
+ digester.addCallMethod("pluto-portal-driver/supports/portlet-mode",
+ "addSupportedPortletMode", 0);
+ digester.addCallMethod("pluto-portal-driver/supports/window-state",
+ "addSupportedWindowState", 0);
+
+ digester.addObjectCreate("pluto-portal-driver/portlet-app",
+ PortletApplicationConfig.class);
+ digester.addBeanPropertySetter(
+ "pluto-portal-driver/portlet-app/context-path", "contextPath");
+
+ digester.addObjectCreate(
+ "pluto-portal-driver/portlet-app/portlets/portlet",
+ PortletWindowConfig.class);
+ digester.addSetProperties(
+ "pluto-portal-driver/portlet-app/portlets/portlet", "name",
+ "portletName");
+ digester.addSetNext("pluto-portal-driver/portlet-app/portlets/portlet",
+ "addPortlet");
+ digester.addSetNext("pluto-portal-driver/portlet-app", "addPortletApp");
+
+ digester.addObjectCreate("pluto-portal-driver/render-config",
+ RenderConfig.class);
+ digester.addSetProperties("pluto-portal-driver/render-config",
+ "default", "defaultPageId");
+ digester.addObjectCreate("pluto-portal-driver/render-config/page",
+ PageConfig.class);
+ digester.addSetProperties("pluto-portal-driver/render-config/page");
+ digester.addCallMethod(
+ "pluto-portal-driver/render-config/page/portlet", "addPortlet", 2);
+ digester.addCallParam("pluto-portal-driver/render-config/page/portlet",
+ 0, "context");
+ digester.addCallParam("pluto-portal-driver/render-config/page/portlet",
+ 1, "name");
+ digester.addSetNext("pluto-portal-driver/render-config/page",
+ "addPage");
+ digester.addSetNext("pluto-portal-driver/render-config",
+ "setRenderConfig");
+
+
+ }
+
+
+}
+
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PageConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PageConfig.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PageConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PageConfig.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+import org.apache.pluto.driver.services.impl.resource.PortletWindowConfig;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class PageConfig {
+
+ private String name;
+ private String uri;
+ private Collection portletIds;
+ private int orderNumber;
+
+ public PageConfig() {
+ this.portletIds = new ArrayList();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public Collection getPortletIds() {
+ return portletIds;
+ }
+
+ public void setPortletIds(Collection ids) {
+ this.portletIds = ids;
+ }
+
+ public void addPortlet(String contextPath, String portletName) {
+ portletIds.add(
+ PortletWindowConfig.createPortletId(contextPath, portletName));
+ }
+
+ void setOrderNumber(int number) {
+ this.orderNumber = number;
+ }
+
+ int getOrderNumber() {
+ return orderNumber;
+ }
+
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletApplicationConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletApplicationConfig.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletApplicationConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletApplicationConfig.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class PortletApplicationConfig {
+ private static final Log LOG =
+ LogFactory.getLog(PortletApplicationConfig.class);
+
+ private String contextPath;
+ private Map portlets;
+
+ public PortletApplicationConfig() {
+ portlets = new java.util.HashMap();
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ public void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+
+ public Collection getPortlets() {
+ return portlets.values();
+ }
+
+ public PortletWindowConfig getPortlet(String portletName) {
+ return (PortletWindowConfig) portlets.get(portletName);
+ }
+
+ public void addPortlet(PortletWindowConfig portlet) {
+ portlet.setContextPath(getContextPath());
+ portlets.put(portlet.getPortletName(), portlet);
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletWindowConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletWindowConfig.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletWindowConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/PortletWindowConfig.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class PortletWindowConfig {
+
+ private String contextPath;
+ private String portletName;
+
+ public PortletWindowConfig() {
+ }
+
+ public String getId() {
+ return createPortletId(contextPath, portletName);
+ }
+
+ public String getContextPath() {
+ return contextPath;
+ }
+
+ /**
+ * Should only be set by the application upon being added.
+ * @param contextPath
+ */
+ void setContextPath(String contextPath) {
+ this.contextPath = contextPath;
+ }
+
+ public String getPortletName() {
+ return portletName;
+ }
+
+ public void setPortletName(String portletName) {
+ this.portletName = portletName;
+ }
+
+ public static String createPortletId(String contextPath,
+ String portletName) {
+ return contextPath + "." + portletName;
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfig.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfig.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfig.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/RenderConfig.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.*;
+
+/**
+ * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
+ */
+public class RenderConfig {
+ private static final Log LOG =
+ LogFactory.getLog(RenderConfig.class);
+
+ private Map pages;
+ private String defaultPageId;
+
+ // internally used.
+ private int orderNumberCounter = 0;
+ private Comparator pageComparator;
+
+ public RenderConfig() {
+ this.pages = new java.util.HashMap();
+ this.pageComparator = new Comparator() {
+ public int compare(Object a, Object b) {
+ PageConfig pa = (PageConfig)a;
+ PageConfig pb = (PageConfig)b;
+ if(pa.getOrderNumber() > pb.getOrderNumber()) {
+ return 1;
+ }
+ else if(pa.getOrderNumber() == pb.getOrderNumber()) {
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ public boolean equals(Object a) {
+ return false;
+ }
+ };
+ }
+
+
+ public String getDefaultPageId() {
+ return defaultPageId;
+ }
+
+ public void setDefaultPageId(String defaultPageId) {
+ this.defaultPageId = defaultPageId;
+ }
+
+ public List getPages() {
+ List col = new ArrayList(pages.values());
+ Collections.sort(col, pageComparator);
+ return col;
+ }
+
+ public PageConfig getPageConfig(String pageId) {
+ if (pageId == null || "".equals(pageId)) {
+ if (LOG.isDebugEnabled()) {
+ LOG.debug(
+ "Requested page is null. Returning default: " +
+ defaultPageId);
+ }
+ pageId = defaultPageId;
+ }
+ return (PageConfig) pages.get(pageId);
+ }
+
+ public void addPage(PageConfig config) {
+ config.setOrderNumber(orderNumberCounter++);
+ pages.put(config.getName(), config);
+ }
+
+}
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceServicesImpl.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceServicesImpl.java?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceServicesImpl.java (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceServicesImpl.java Thu Aug 11 05:24:03 2005
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2004 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.pluto.driver.services.impl.resource;
+
+import org.apache.pluto.driver.config.DriverConfigurationException;
+import org.apache.pluto.driver.services.PortletRegistryService;
+import org.apache.pluto.driver.services.PropertyConfigService;
+import org.apache.pluto.driver.services.RenderConfigService;
+
+import javax.servlet.ServletContext;
+import java.util.List;
+import java.util.Set;
+import java.io.InputStream;
+
+/**
+ * Default implementation of all of the portal Services.
+ *
+ * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
+ * @since Aug 10, 2005
+ */
+public class ResourceServicesImpl implements
+ PropertyConfigService, PortletRegistryService, RenderConfigService {
+
+ private static final String CONFIG_FILE =
+ "/WEB-INF/pluto-portal-driver-config.xml";
+
+ private Configuration config;
+
+//
+// Lifecycle Methods
+//
+ /**
+ * Initialization Lifecycle Method
+ * @param ctx
+ */
+ public void init(ServletContext ctx) {
+ // because we comprise 3 services, we must
+ // prevent reinitialization.
+ if(config != null)
+ return;
+
+ try {
+ InputStream in = ctx.getResourceAsStream(CONFIG_FILE);
+ config = ConfigurationFactory.getFactory().parse(in);
+ }
+ catch(Exception e) {
+ throw new DriverConfigurationException(e);
+ }
+ }
+
+ /**
+ * Shutdown the ResourceService.
+ */
+ public void destroy() {
+ config = null;
+ }
+
+
+ public String getPortalName() {
+ return config.getPortalName();
+ }
+
+ public String getPortalVersion() {
+ return config.getPortalVersion();
+ }
+
+ public String getContainerName() {
+ return config.getContainerName();
+ }
+
+ public Set getSupportedPortletModes() {
+ return config.getSupportedPortletModes();
+ }
+
+ public Set getSupportedWindowStates() {
+ return config.getSupportedWindowStates();
+ }
+
+ public Set getPortletApplications() {
+ return config.getPortletApplications();
+ }
+
+ public PortletApplicationConfig getPortletApplication(String id) {
+ return config.getPortletApp(id);
+ }
+
+ public PortletWindowConfig getPortletWindowConfig(String id) {
+ return config.getPortletWindowConfig(id);
+ }
+
+ public PortletWindowConfig getPortlet(String id) {
+ return config.getPortletWindowConfig(id);
+ }
+
+ public List getPages() {
+ return config.getRenderConfig().getPages();
+ }
+
+ public PageConfig getDefaultPage() {
+ return config.getRenderConfig().getPageConfig(null);
+ }
+
+ public PageConfig getPage(String id) {
+ return config.getRenderConfig().getPageConfig(id);
+ }
+
+}
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/tags/PortletTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/tags/PortletTag.java?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/tags/PortletTag.java (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/java/org/apache/pluto/driver/tags/PortletTag.java Thu Aug 11 05:24:03 2005
@@ -15,8 +15,8 @@
import org.apache.pluto.PortletContainer;
import org.apache.pluto.PortletWindow;
import org.apache.pluto.driver.AttributeKeys;
+import org.apache.pluto.driver.services.impl.resource.PortletWindowConfig;
import org.apache.pluto.driver.config.DriverConfiguration;
-import org.apache.pluto.driver.config.PortletWindowConfig;
import org.apache.pluto.driver.core.PortalEnvironment;
import org.apache.pluto.driver.core.PortalServletRequest;
import org.apache.pluto.driver.core.PortalServletResponse;
Modified: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/fragments/template.jsp
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/fragments/template.jsp?rev=231430&r1=231429&r2=231430&view=diff
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/fragments/template.jsp (original)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/fragments/template.jsp Thu Aug 11 05:24:03 2005
@@ -17,7 +17,7 @@
<TABLE>
<TR class="tab">
- <c:forEach var="page" items="${driverConfig.renderConfig.pages}">
+ <c:forEach var="page" items="${driverConfig.pages}">
<c:choose>
<c:when test="${page == currentPage}">
<TD nowrap="true" class="tab-selected">
@@ -34,6 +34,7 @@
<TR><TD colspan="<c:out value="${span * 2}"/>"> </TD></TR>
</TABLE>
+<TABLE>
<TR><TD>
<%-- This could be dynamic. At this point there's no need --%>
<jsp:include page='<%=(String)pageContext.findAttribute("include")%>'/>
Added: portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml?rev=231430&view=auto
==============================================================================
--- portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml (added)
+++ portals/pluto/branches/pluto-1.1/pluto-portal/src/main/webapp/WEB-INF/pluto-portal-driver-services-config.xml Thu Aug 11 05:24:03 2005
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
+ "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+ <!-- How do we get these to share the same instance. -->
+ <bean name="PropertyConfigService"
+ class="org.apache.pluto.driver.services.impl.resource.ResourceServicesImpl"
+ singleton="true">
+ </bean>
+ <bean name="PortletRegistryService"
+ class="org.apache.pluto.driver.services.impl.resource.ResourceServicesImpl"
+ singleton="true">
+ </bean>
+ <bean name="RenderConfigService"
+ class="org.apache.pluto.driver.services.impl.resource.ResourceServicesImpl"
+ singleton="true">
+ </bean>
+</beans>
\ No newline at end of file