JBoss Portal SVN: r5746 - in trunk/core: . src/main/org/jboss/portal/core/aspects/controller src/main/org/jboss/portal/core/controller/classic src/main/org/jboss/portal/core/controller/portlet src/main/org/jboss/portal/core/deployment/jboss src/main/org/jboss/portal/core/impl/model/portal src/main/org/jboss/portal/core/metadata src/main/org/jboss/portal/core/model/portal src/main/org/jboss/portal/core/model/portal/portlet src/main/org/jboss/portal/core/portlet/dashboard src/main/org/jboss/p
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-30 17:53:29 -0500 (Thu, 30 Nov 2006)
New Revision: 5746
Added:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
Removed:
trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java
Modified:
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/resources/portal-core-sar/portal-aop.xml
Log:
minor improvements to portal objects :
- more complete javadoc
- introducer PortalContainer interface which is a container for portal objects
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/build.xml 2006-11-30 22:53:29 UTC (rev 5746)
@@ -246,10 +246,10 @@
<include name="org/jboss/portal/core/aspects/server/TransactionInterceptor.class"/>
<include name="org/jboss/portal/core/aspects/server/UserInterceptor$UserFinalizer.class"/>
<include name="org/jboss/portal/core/aspects/portlet/TransactionInterceptor.class"/>
- <include name="org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.class"/>
<include name="org/jboss/portal/core/deployment/jboss/ObjectDeployment.class"/>
<include name="org/jboss/portal/core/deployment/jboss/PortletAppDeployment.class"/>
<include name="org/jboss/portal/core/impl/model/instance/PersistentInstanceContainer.class"/>
+ <include name="org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.class"/>
<include name="org/jboss/portal/core/impl/portlet/state/ProducerPortletInvoker.class"/>
<include name="org/jboss/portal/core/hibernate/SessionFactoryBinder.class"/>
</aopc>
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -31,7 +31,7 @@
import org.jboss.portal.core.controller.command.SignOutCommand;
import org.jboss.portal.core.model.portal.command.ViewDashboardCommand;
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -381,7 +381,7 @@
private static float getOrder(Object o)
{
- if (o instanceof Context)
+ if (o instanceof PortalContainer)
{
return 0;
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -28,7 +28,6 @@
import org.jboss.portal.theme.PageRendition;
import org.jboss.portal.core.controller.command.response.SignOutResponse;
import org.jboss.portal.core.controller.command.response.StreamContentResponse;
-import org.jboss.portal.core.controller.classic.AbstractResponseHandler;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.model.portal.Portal;
@@ -48,6 +47,8 @@
public class ClassicResponseHandler extends AbstractResponseHandler
{
+ private String defaultPortalPath = "default";
+
public CommandForward handleResponse(ControllerContext ctx, ControllerCommand cmd, Object response) throws IOException, ServletException, ServerException
{
ServerInvocation invocation = ctx.getServerInvocation();
@@ -70,7 +71,7 @@
if (location == null)
{
PortalObjectContainer portalObjectContainer = ctx.getController().getPortalObjectContainer();
- Portal portal = portalObjectContainer.getContext().getDefaultPortal();
+ Portal portal = (Portal)portalObjectContainer.getObject(defaultPortalPath);
RenderPageCommand renderCmd = new RenderPageCommand(portal.getId());
boolean secure = invocation.getServerContext().getURLContext().getSecure();
URLContext urlContext = URLContext.newInstance(secure, false);
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletContextFactory.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -67,8 +67,8 @@
this.requestContext = new AbstractRequestContext(controllerContext.getServerInvocation().getServerContext().getClientRequest(), controllerContext.getServerInvocation().getServerContext().getClientResponse());
this.securityContext = new AbstractSecurityContext(controllerContext.getServerInvocation().getServerContext().getClientRequest());
this.userContext = new ControllerUserContext(controllerContext.getServerInvocation());
- this.portalContext = new org.jboss.portal.core.model.portal.PortalContextImpl(portal);
- this.windowContext = new org.jboss.portal.core.model.portal.WindowContextImpl(window);
+ this.portalContext = new org.jboss.portal.core.model.portal.portlet.PortalContextImpl(portal);
+ this.windowContext = new org.jboss.portal.core.model.portal.portlet.WindowContextImpl(window);
}
public PortletContextFactory(ControllerContext controllerContext)
Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploymentFactory.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -24,7 +24,6 @@
import org.jboss.deployment.DeploymentException;
import org.jboss.portal.common.transaction.TransactionManagerProvider;
-import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.server.deployment.PortalWebApp;
import org.jboss.portal.server.deployment.jboss.AbstractDeploymentFactory;
@@ -80,24 +79,4 @@
{
this.portalObjectContainer = portalObjectContainer;
}
-
- public void registerFactory()
- {
- createContextIfNotExist();
-
- //
- super.registerFactory();
- }
-
- public void createContextIfNotExist()
- {
- // Create context if not exist
- Context ctx = portalObjectContainer.getContext();
-
- //
- if (ctx == null)
- {
- portalObjectContainer.createContext();
- }
- }
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPortalObjectContainer.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.impl.model.portal;
-import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectPermission;
@@ -66,9 +65,9 @@
}
}
- public Context getContext()
+ public PortalObject getRootObject()
{
- return (Context)getObject("");
+ return getObject("");
}
public String getType()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ContextImpl.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.impl.model.portal;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -31,7 +31,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ContextImpl extends PortalObjectImpl implements Context
+public class ContextImpl extends PortalObjectImpl implements PortalContainer
{
public ContextImpl()
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -45,9 +45,6 @@
public class PersistentPortalObjectContainer extends AbstractPortalObjectContainer
{
- /** The query for lookup. */
- private static final String LOOKUP_QUERY = "from ObjectNode where path=:path";
-
/** The query for lookup when the path is null. */
private static final String LOOKUP_QUERY_FOR_NULL_PATH = "from ObjectNode where path=:path or path is null";
@@ -78,6 +75,9 @@
/** . */
protected boolean cacheNaturalId;
+ /** . */
+ protected String rootName;
+
public PersistentPortalObjectContainer()
{
ctx = new ContainerContext()
@@ -116,6 +116,16 @@
cache = new ConcurrentReaderHashMap();
}
+ public String getRootName()
+ {
+ return rootName;
+ }
+
+ public void setRootName(String rootName)
+ {
+ this.rootName = rootName;
+ }
+
public void flushNaturalIdCache()
{
cache.clear();
@@ -173,6 +183,9 @@
//
contextualizer.attach(sessionFactory);
+ // todo : move to use the ha singleton stuff
+ createRootIfNotExist();
+
// Add ourself as the authorization domain
if (authorizationDomainRegistry != null)
{
@@ -197,28 +210,13 @@
sessionFactory = null;
}
- /** @see PortalObjectContainer#getAuthorizationDomain() */
public AuthorizationDomain getAuthorizationDomain()
{
return this;
}
- public boolean createContext()
+ public boolean createRootIfNotExist() throws Exception
{
- try
- {
- return createContextIfNotExist();
- }
- catch (Exception e)
- {
- log.error("Was not able to create root context", e);
- return false;
- }
- }
-
- /** todo : use AOP for tx demarcation. */
- public boolean createContextIfNotExist() throws Exception
- {
log.debug("Detecting the existence of the portal object root context");
Session session = sessionFactory.getCurrentSession();
@@ -248,10 +246,6 @@
}
}
- //*******************************************************************
- // AuthorizationDomain interface methods
- //*******************************************************************
-
protected ObjectNode getObjectNode(String uri)
{
return getObjectNode(sessionFactory.getCurrentSession(), uri);
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -112,11 +112,6 @@
return objectNode.getPath();
}
- public PortalObjectContainer getContainer()
- {
- return objectNode.getContext().getContainer();
- }
-
public String getName()
{
return objectNode.getName();
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -30,7 +30,6 @@
* @version $Revision$
*/
public class TransientPortalObjectContainer extends AbstractPortalObjectContainer
-// implements AuthorizationDomain, DomainConfigurator, PermissionRepository, PermissionFactory
{
/** . */
@@ -65,7 +64,7 @@
};
}
- public boolean createContext()
+ public boolean createRootObject()
{
if (root != null)
{
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.util.XML;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.portlet.impl.jsr168.metadata.ModesMetaData;
@@ -79,13 +79,13 @@
public PortalObject create(PortalObject parent, BuildContext buildContext) throws Exception
{
- if (!(parent instanceof Context))
+ if (!(parent instanceof PortalContainer))
{
throw new IllegalArgumentException("Not a context");
}
//
- Portal portal = ((Context)parent).createPortal(getName());
+ Portal portal = ((PortalContainer)parent).createPortal(getName());
//
configure(portal, buildContext);
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -1,49 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal;
-
-/**
- * Contains nodes of type portal.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public interface Context extends PortalObject
-{
- /** Return an existing portal. */
- Portal getPortal(String name);
-
- /**
- * Create a new portal.
- *
- * @throws DuplicatePortalObjectException
- * @throws IllegalArgumentException
- */
- Portal createPortal(String name) throws DuplicatePortalObjectException, IllegalArgumentException;
-
- /**
- * Get the default portal of the context based on some criteria. For instance a shared context get the portal with
- * the "default" name, for a private portal it gets the only portal owned by the user.
- */
- Portal getDefaultPortal();
-}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -36,6 +36,9 @@
*/
public class DefaultPortalCommandFactory extends AbstractCommandFactory
{
+
+ private String defaultPortalPath = "default";
+
private CommandFactory nextFactory;
private PortalObjectContainer container;
@@ -65,12 +68,7 @@
ControllerCommand cmd = nextFactory.doMapping(invocation, portalContextPath, portalRequestPath);
if (cmd == null)
{
- Context ctx = container.getContext();
- if (ctx == null)
- {
- throw new IllegalStateException("Default context does not exist");
- }
- Portal portal = ctx.getDefaultPortal();
+ Portal portal = (Portal)container.getObject(defaultPortalPath);
if (portal == null)
{
throw new IllegalStateException("Default portal does not exist");
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -23,22 +23,37 @@
package org.jboss.portal.core.model.portal;
/**
+ * A page contains window and is also a page container which can contain nested pages.
+ *
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
* @version $Revision$
*/
public interface Page extends PageContainer
{
- /** Return the portal containing this page. */
+ /**
+ * Return the portal containing this page.
+ *
+ * @return the portal for this page
+ */
Portal getPortal();
- /** Get an existing windows. */
- Window getWindow(String name);
+ /**
+ * Return a page window or null if the portal object does not exist or
+ * does not have the appropriate type.
+ *
+ * @param name the window name
+ * @return the specified page window
+ * @throws IllegalArgumentException if the name is null
+ */
+ Window getWindow(String name) throws IllegalArgumentException;
/**
* Create a new window.
*
- * @throws DuplicatePortalObjectException
- * @throws IllegalArgumentException
+ * @param name window name
+ * @return the created window
+ * @throws DuplicatePortalObjectException if a portal object with the specified name already exist
+ * @throws IllegalArgumentException if the name is null
*/
Window createWindow(String name) throws DuplicatePortalObjectException, IllegalArgumentException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -23,14 +23,28 @@
package org.jboss.portal.core.model.portal;
/**
+ * An interface which defines a page container.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface PageContainer extends PortalObject
{
- /** Return an existing page. */
- Page getPage(String name);
+ /**
+ * Return an existing page or null if the child does not exist or does not have the right type.
+ *
+ * @return the specified page
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ Page getPage(String name) throws IllegalArgumentException;
- /** Create a new page. */
- Page createPage(String name) throws DuplicatePortalObjectException;
+ /**
+ * Create a new page in the scope of this container.
+ *
+ * @param name the name of the child page to create
+ * @return the create page
+ * @throws DuplicatePortalObjectException if an object with the specified name already exist
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ Page createPage(String name) throws DuplicatePortalObjectException, IllegalArgumentException;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -25,28 +25,31 @@
import java.util.Set;
/**
+ * Defines a logical portal.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface Portal extends PageContainer
{
- /** Return the window state provider of this portal. */
+ /**
+ * Return the window states supported by this portal.
+ *
+ * @return the supported window states by this portal
+ */
Set getSupportedWindowStates();
- /** Return the mode provider of this portal. */
+ /**
+ * Return the modes supported of this portal.
+ *
+ * @return the supported modes by this portal
+ */
Set getSupportedModes();
- /** Return an existing page. */
- Page getPage(String name);
-
/**
- * Create a new page.
+ * Return the default page of this portal.
*
- * @throws DuplicatePortalObjectException
- * @throws IllegalArgumentException
+ * @return the default page
*/
- Page createPage(String name) throws DuplicatePortalObjectException, IllegalArgumentException;
-
- /** Return the default page. */
Page getDefaultPage();
}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java (from rev 5730, trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -0,0 +1,59 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal;
+
+/**
+ * Contains nodes of type portal.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public interface PortalContainer extends PortalObject
+{
+ /**
+ * Return an existing portal or null if such a child does not exist or does not have
+ * the right type.
+ *
+ * @param name the portal name
+ * @return the specified portal
+ * @throws IllegalArgumentException if the specified name is null
+ */
+ Portal getPortal(String name) throws IllegalArgumentException;
+
+ /**
+ * Create a new portal.
+ *
+ * @param name the portal name
+ * @return the newly created portal
+ * @throws DuplicatePortalObjectException if a child with the specified name already exists
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ Portal createPortal(String name) throws DuplicatePortalObjectException, IllegalArgumentException;
+
+ /**
+ * Returns the default portal.
+ *
+ * @return the default portal of that container
+ */
+ Portal getDefaultPortal();
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContainer.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal;
-
-import org.jboss.portal.portlet.spi.PortalContext;
-
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PortalContextImpl implements PortalContext
-{
-
- /** . */
- protected Portal portal;
-
- public PortalContextImpl(Portal portal)
- {
- if (portal == null)
- {
- throw new IllegalStateException();
- }
- this.portal = portal;
- }
-
- public Set getWindowStates()
- {
- return portal.getSupportedWindowStates();
- }
-
- public Set getModes()
- {
- return portal.getSupportedModes();
- }
-
- public Map getProperties()
- {
- // This should be filtered somehow
- return portal.getDeclaredProperties();
- }
-}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -40,39 +40,51 @@
/** The default portal name. */
String DEFAULT_OBJECT_NAME = "default";
+ /** . */
int TYPE_CONTEXT = 0;
+
+ /** . */
int TYPE_PORTAL = 1;
+
+ /** . */
int TYPE_PAGE = 2;
+
+ /** . */
int TYPE_WINDOW = 3;
- /** Return the id in the scope of its container. */
+ /**
+ * Return the object id unique in the scope of its container.
+ *
+ * @return the object id
+ */
String getId();
- /** Return the container of this object. */
- PortalObjectContainer getContainer();
-
/**
- * A numerical type that discriminates the object.
+ * Returns the type of the object which is a value that discriminates the object type.
*
* @return the object type.
*/
int getType();
/**
- * Return the name.
+ * Return the object name unique in the scope of its parent.
*
- * @return the name
+ * @return the object name
*/
String getName();
/**
- * Return the listener id.
+ * Returns the listener id or null if there is none.
*
* @return the listener
*/
String getListener();
- /** Set a listener id. */
+ /**
+ * Set a listener id.
+ *
+ * @param listener the listener id
+ */
void setListener(String listener);
/**
@@ -99,24 +111,48 @@
/**
* Destroy an existing child.
*
- * @param name
+ * @param name the child name
* @throws NoSuchPortalObjectException if the child does not exist
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException if the name argument is null
*/
void destroyChild(String name) throws NoSuchPortalObjectException, IllegalArgumentException;
- /** Return a property of that object. */
- String getProperty(String name);
+ /**
+ * Return a property of that object.
+ *
+ * @return the property value
+ * @throws IllegalArgumentException if the name is null
+ */
+ String getProperty(String name) throws IllegalArgumentException;
- /** Returns a read only map that contains the object properties. */
+ /**
+ * Returns a read only map that contains the object properties.
+ *
+ * @return a map of the object properties
+ */
Map getProperties();
- /** Return a map that contains the object declared properties. */
- Map getDeclaredProperties();
+ /**
+ * Return a property declared on that object.
+ *
+ * @return the property value
+ * @throws IllegalArgumentException if the name is null
+ */
+ String getDeclaredProperty(String name) throws IllegalArgumentException;
- /** Return a property declared on that object. */
- String getDeclaredProperty(String name);
+ /**
+ * Update a property declared on that object.
+ *
+ * @param name the property name
+ * @param value the property value
+ * @throws IllegalArgumentException if the name argument is null
+ */
+ void setDeclaredProperty(String name, String value) throws IllegalArgumentException;
- /** Update a property declared on that object. */
- void setDeclaredProperty(String name, String value);
+ /**
+ * Return a map that contains the object declared properties.
+ *
+ * @return a map of the properties declared by the object
+ */
+ Map getDeclaredProperties();
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -61,7 +61,7 @@
{
public Object getRoot()
{
- return container.getContext();
+ return container.getRootObject();
}
public Object getChild(Object parent, String name)
@@ -93,7 +93,7 @@
Object target = null;
if (portalRequestPath.length() == 0)
{
- target = container.getContext();
+ target = container.getRootObject();
}
else
{
@@ -150,9 +150,9 @@
}
else
{
- if (target instanceof Context)
+ if (target instanceof PortalContainer)
{
- Context ctx = (Context)target;
+ PortalContainer ctx = (PortalContainer)target;
target = ctx.getDefaultPortal();
}
if (target instanceof Portal)
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -33,13 +33,6 @@
public interface PortalObjectContainer
{
/**
- * Create the root context
- *
- * @return true if the context was created
- */
- boolean createContext();
-
- /**
* Return a container object.
*
* @return the specified portal object
@@ -48,11 +41,11 @@
PortalObject getObject(String id) throws IllegalArgumentException;
/**
- * Return the root context of this container.
+ * Return the root object of this container.
*
- * @return the root context
+ * @return the root object
*/
- Context getContext();
+ PortalObject getRootObject();
/**
* Get the authorization domain.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/Window.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -23,16 +23,25 @@
package org.jboss.portal.core.model.portal;
/**
- * Represents a window, i.e the state of the ternary relationship a page has with instances.
+ * Represents a window, i.e the state of the ternary relationship a page has with portlet instances.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface Window extends PortalObject
{
- /** Return the instance ref. */
+ /**
+ * Return the instance reference.
+ *
+ * @return the instance reference
+ *
+ */
String getInstanceRef();
- /** Update the instance ref. */
+ /**
+ * Update the instance ref.
+ *
+ * @param instanceRef the instance ref
+ */
void setInstanceRef(String instanceRef);
}
Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -1,49 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.model.portal;
-
-import org.jboss.portal.portlet.spi.WindowContext;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class WindowContextImpl implements WindowContext
-{
-
- private final Window window;
-
- public WindowContextImpl(Window window)
- {
- if (window == null)
- {
- throw new IllegalArgumentException();
- }
- this.window = window;
- }
-
- public String getId()
- {
- return window.getId();
- }
-}
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java (from rev 5730, trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.portlet;
+
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.core.model.portal.Portal;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortalContextImpl implements PortalContext
+{
+
+ /** . */
+ protected Portal portal;
+
+ public PortalContextImpl(Portal portal)
+ {
+ if (portal == null)
+ {
+ throw new IllegalStateException();
+ }
+ this.portal = portal;
+ }
+
+ public Set getWindowStates()
+ {
+ return portal.getSupportedWindowStates();
+ }
+
+ public Set getModes()
+ {
+ return portal.getSupportedModes();
+ }
+
+ public Map getProperties()
+ {
+ // This should be filtered somehow
+ return portal.getDeclaredProperties();
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java (from rev 5730, trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java)
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImpl.java 2006-11-28 05:41:09 UTC (rev 5730)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.model.portal.portlet;
+
+import org.jboss.portal.portlet.spi.WindowContext;
+import org.jboss.portal.core.model.portal.Window;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class WindowContextImpl implements WindowContext
+{
+
+ private final Window window;
+
+ public WindowContextImpl(Window window)
+ {
+ if (window == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.window = window;
+ }
+
+ public String getId()
+ {
+ return window.getId();
+ }
+}
Property changes on: trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowContextImpl.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -57,6 +57,11 @@
*/
public class Configurator extends JBossPortlet
{
+
+ private static final int MOVE_UP = 0;
+
+ private static final int MOVE_DOWN = 1;
+
private Logger log = Logger.getLogger(Configurator.class);
private InstanceContainer instanceContainer;
@@ -65,9 +70,6 @@
private LayoutService layoutService;
- private static final int MOVE_UP = 0;
- private static final int MOVE_DOWN = 1;
-
public void init()
throws PortletException
{
@@ -107,32 +109,53 @@
if (req.getParameter("editPageSelect") != null)
{
String editPageSelect = req.getParameter("editPageSelect");
- page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPageSelect);
+ page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPageSelect);
}
else
{
- page = portalObjectContainer.getContext().getPortal("dashboard").getPage(req.getUser().getUserName());
+ page = (Page)portalObjectContainer.getObject("dashboard").getChild(req.getUser().getUserName());
}
List available_instances = (List)instanceContainer.getInstances();
+ List left_instances = new ArrayList();
+ List center_instances = new ArrayList();
+ List right_instances = new ArrayList();
- resp.setContentType("text/html");
try
{
Map windowMap = getWindows(page);
-
List regions = new ArrayList(windowMap.keySet());
Collections.sort(regions);
- req.setAttribute("windowMap", windowMap);
- req.setAttribute("regions", regions);
+ for (Iterator i = regions.iterator(); i.hasNext();)
+ {
+ String region = (String)i.next();
+
+ TreeSet windows = (TreeSet)windowMap.get(region);
+ for (Iterator j = windows.iterator(); j.hasNext();)
+ {
+ Window window = (Window)j.next();
+ if (region.equals("left"))
+ {
+ left_instances.add(window);
+ //System.out.println(window.getInstanceRef() + ":" + window.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER));
+ }
+ else if (region.equals("center"))
+ {
+ center_instances.add(window);
+ }
+ else if (region.equals("right"))
+ {
+ right_instances.add(window);
+ }
+ }
+ }
}
catch (Exception e)
{
e.printStackTrace();
}
- // page select box
List pages = new ArrayList();
for (Iterator j = page.getPortal().getChildren().iterator(); j.hasNext();)
{
@@ -143,10 +166,13 @@
}
}
+ resp.setContentType("text/html");
req.setAttribute("available_instances", available_instances);
+ req.setAttribute("left_instances", left_instances);
+ req.setAttribute("center_instances", center_instances);
+ req.setAttribute("right_instances", right_instances);
req.setAttribute("pages", pages);
req.setAttribute("currentPage", page.getName());
-
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/dashboard/editpage.jsp");
rd.include(req, resp);
}
@@ -164,7 +190,7 @@
String toRegion = actionRequest.getParameter("toRegion");
String[] copyInstance = actionRequest.getParameterValues("available_instances");
- Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
+ Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
try
{
for (int i = 0; i < copyInstance.length; i++)
@@ -191,26 +217,20 @@
{
String fromRegion = actionRequest.getParameter("fromRegion");
String[] removeWindows = null;
-
- Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
- try
+ if ("left".equals(fromRegion))
{
- Map windowMap = getWindows(page);
- List regions = new ArrayList(windowMap.keySet());
- for (int i = 0; i < regions.size(); i++)
- {
- String region = (String)regions.get(i);
- if (region.equalsIgnoreCase(fromRegion))
- {
- removeWindows = actionRequest.getParameterValues(region + "_instances");
- }
- }
+ removeWindows = actionRequest.getParameterValues("left_instances");
}
- catch (Exception e)
+ else if ("center".equals(fromRegion))
{
- // todo
+ removeWindows = actionRequest.getParameterValues("center_instances");
}
+ else if ("right".equals(fromRegion))
+ {
+ removeWindows = actionRequest.getParameterValues("right_instances");
+ }
+ Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
try
{
for (int i = 0; i < removeWindows.length; i++)
@@ -228,51 +248,40 @@
{
String sortRegion = actionRequest.getParameter("sortRegion");
String[] moveWindows = null;
+ if ("left".equals(sortRegion))
+ {
+ moveWindows = actionRequest.getParameterValues("left_instances");
+ }
+ else if ("center".equals(sortRegion))
+ {
+ moveWindows = actionRequest.getParameterValues("center_instances");
+ }
+ else if ("right".equals(sortRegion))
+ {
+ moveWindows = actionRequest.getParameterValues("right_instances");
+ }
- Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(editPage);
- try
+ Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(editPage);
+ for (int i = 0; i < moveWindows.length; i++)
{
- Map windowMap = getWindows(page);
- List regions = new ArrayList(windowMap.keySet());
- for (int i = 0; i < regions.size(); i++)
+ Window window = page.getWindow(moveWindows[i]);
+ if ("up".equals(op))
{
- String region = (String)regions.get(i);
- if (region.equalsIgnoreCase(sortRegion))
- {
- moveWindows = actionRequest.getParameterValues(region + "_instances");
- }
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(getOrder(window) - 1));
}
-
- SortedSet windows = (SortedSet)windowMap.get(sortRegion);
-
- for (int i = 0; i < moveWindows.length; i++)
+ else if ("down".equals(op))
{
- Window window = page.getWindow(moveWindows[i]);
- if ("up".equals(op))
- {
- int order = getMoveUpOrder(window, windows);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(order));
- }
- else if ("down".equals(op))
- {
- int order = getMoveDownOrder(window, windows);
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(order));
- }
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(getOrder(window) + 1));
}
}
- catch (Exception e)
- {
- // todo
- }
-
actionResponse.setRenderParameter("editPageSelect", editPage);
}
else if ("newpage".equals(op))
{
String pageName = actionRequest.getParameter("pagename");
- Page page = portalObjectContainer.getContext().getPortal("dashboard").getPage(actionRequest.getUser().getUserName());
- PageContainer pageContainer = (PageContainer)page.getPortal();
+ Page page = (Page)portalObjectContainer.getObject("dashboard").getChild(actionRequest.getUser().getUserName());
+ PageContainer pageContainer = page.getPortal();
try
{
@@ -357,50 +366,4 @@
return Integer.MAX_VALUE;
}
}
-
- private static int getMoveUpOrder(Window window, SortedSet set)
- {
- Window previous = null;
- for (Iterator i = set.iterator(); i.hasNext();)
- {
- Window current = (Window)i.next();
-
- if (current.getName().equalsIgnoreCase(window.getName()))
- {
- if (previous == null)
- {
- return getOrder(current);
- }
- else
- {
- return (getOrder(previous) - 1);
- }
- }
- previous = current;
- }
- return 0;
- }
-
- private int getMoveDownOrder(Window window, SortedSet set)
- {
- for (Iterator i = set.iterator(); i.hasNext();)
- {
- Window current = (Window)i.next();
-
- if (current.getName().equalsIgnoreCase(window.getName()))
- {
- Window next = (Window)i.next();
-
- if (next == null)
- {
- return getOrder(current);
- }
- else
- {
- return (getOrder(next) + 1);
- }
- }
- }
- return 0;
- }
}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortalObjectTreeNode.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -23,7 +23,7 @@
package org.jboss.portal.core.portlet.management;
import org.apache.myfaces.custom.tree2.TreeNode;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -155,7 +155,7 @@
private static int getOrder(Object o)
{
- if (o instanceof Context)
+ if (o instanceof PortalContainer)
{
return 0;
}
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -35,7 +35,6 @@
import org.jboss.portal.core.impl.model.portal.PortalObjectImpl;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
-import org.jboss.portal.core.model.portal.Context;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
@@ -413,8 +412,8 @@
public TreeNode getTreeData()
{
- Context context = portalObjectContainer.getContext();
- return new LazyPortalObjectTreeNode(context);
+ PortalObject root = portalObjectContainer.getRootObject();
+ return new LazyPortalObjectTreeNode(root);
}
public SelectItem[] getInstanceItems()
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/PortalAction.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -24,7 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -135,8 +135,8 @@
{
try
{
- Context context = (Context)pomgr.getSelectedObject();
- Portal portal = context.createPortal(portalName);
+ PortalContainer portalContainer = (PortalContainer)pomgr.getSelectedObject();
+ Portal portal = portalContainer.createPortal(portalName);
DomainConfigurator configurator = pomgr.getDomainConfigurator();
// Initial portal permissions
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-11-30 22:53:29 UTC (rev 5746)
@@ -24,7 +24,7 @@
import junit.framework.TestSuite;
import org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer;
-import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.PortalContainer;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObject;
@@ -37,8 +37,6 @@
import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.common.test.junit.POJOJUnitTest;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.net.URL;
/**
@@ -109,7 +107,6 @@
//
hibernate.openSession();
- container.createContext();
assertTrue(hibernate.commitTransaction());
//
@@ -128,12 +125,11 @@
//
hibernate.openSession();
- container.createContext();
assertTrue(hibernate.commitTransaction());
//
hibernate.openSession();
- Context ctx = container.getContext();
+ PortalContainer ctx = (PortalContainer)container.getRootObject();
Portal portal = ctx.createPortal("default");
String portalId = portal.getId();
assertNotNull(portalId);
@@ -190,7 +186,7 @@
//
hibernate.openSession();
- ctx = container.getContext();
+ ctx = (PortalContainer)container.getRootObject();
assertNotNull(ctx);
portal = ctx.getPortal("default");
assertNotNull(portal);
@@ -205,7 +201,7 @@
//
hibernate.openSession();
- ctx = container.getContext();
+ ctx = (PortalContainer)container.getRootObject();
assertNotNull(ctx);
ctx.destroyChild("default");
portal = ctx.getPortal("default");
@@ -214,7 +210,7 @@
//
hibernate.openSession();
- ctx = container.getContext();
+ ctx = (PortalContainer)container.getRootObject();
portal = ctx.getPortal("default");
assertNull(portal);
assertTrue(hibernate.commitTransaction());
@@ -229,12 +225,11 @@
//
hibernate.openSession();
- container.createContext();
assertTrue(hibernate.commitTransaction());
//
hibernate.openSession();
- Context ctx = container.getContext();
+ PortalContainer ctx = (PortalContainer)container.getRootObject();
Portal portal = ctx.createPortal("default");
assertNotNull(portal);
Modified: trunk/core/src/resources/portal-core-sar/portal-aop.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/portal-aop.xml 2006-11-30 07:43:40 UTC (rev 5745)
+++ trunk/core/src/resources/portal-core-sar/portal-aop.xml 2006-11-30 22:53:29 UTC (rev 5746)
@@ -43,7 +43,6 @@
</method>
<method name="invokeSupports">
<trans-attribute>supports</trans-attribute>
- <!--<application-exceptions>,</application-exceptions>-->
</method>
<method name="invokeRequired">
<trans-attribute>Required</trans-attribute>
@@ -81,8 +80,8 @@
</metadata>
<metadata
tag="transaction"
- class="org.jboss.portal.core.deployment.jboss.ObjectDeploymentFactory">
- <method name="createContextIfNotExist">
+ class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
+ <method name="createRootIfNotExist">
<trans-attribute>Required</trans-attribute>
</method>
</metadata>
17 years, 5 months
JBoss Portal SVN: r5745 - in trunk/core/src/main/org/jboss/portal/core: impl/model/portal model/portal
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-30 02:43:40 -0500 (Thu, 30 Nov 2006)
New Revision: 5745
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
Log:
minor javadoc improvement
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-11-29 16:35:29 UTC (rev 5744)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentPortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
@@ -203,20 +203,21 @@
return this;
}
- public void createContext()
+ public boolean createContext()
{
try
{
- createContextIfNotExist();
+ return createContextIfNotExist();
}
catch (Exception e)
{
- log.error("", e);
+ log.error("Was not able to create root context", e);
+ return false;
}
}
/** todo : use AOP for tx demarcation. */
- public void createContextIfNotExist() throws Exception
+ public boolean createContextIfNotExist() throws Exception
{
log.debug("Detecting the existence of the portal object root context");
Session session = sessionFactory.getCurrentSession();
@@ -238,10 +239,12 @@
//
log.info("Created portal object root context");
+ return true;
}
else
{
log.debug("Portal object root context has been found");
+ return false;
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-11-29 16:35:29 UTC (rev 5744)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
@@ -65,12 +65,19 @@
};
}
- public void createContext()
+ public boolean createContext()
{
+ if (root != null)
+ {
+ return false;
+ }
+
+ //
root = new ObjectNode(ctx, "", "");
ContextImpl ctx = new ContextImpl();
root.setObject(ctx);
ctx.setObjectNode(root);
+ return true;
}
/** @see PortalObjectContainer#getAuthorizationDomain() */
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-11-29 16:35:29 UTC (rev 5744)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745)
@@ -32,15 +32,32 @@
*/
public interface PortalObjectContainer
{
- /** Create the root context. */
- void createContext();
+ /**
+ * Create the root context
+ *
+ * @return true if the context was created
+ */
+ boolean createContext();
- /** Return a container object. */
- PortalObject getObject(String id);
+ /**
+ * Return a container object.
+ *
+ * @return the specified portal object
+ * @throws IllegalArgumentException if the id is null
+ */
+ PortalObject getObject(String id) throws IllegalArgumentException;
- /** Return the root context of this container. */
+ /**
+ * Return the root context of this container.
+ *
+ * @return the root context
+ */
Context getContext();
- /** Get the authorization domain */
+ /**
+ * Get the authorization domain.
+ *
+ * @return the authorization domain
+ */
AuthorizationDomain getAuthorizationDomain();
}
17 years, 5 months
JBoss Portal SVN: r5744 - in trunk: cms/src/main/org/jboss/portal/test/cms cms/src/resources/portal-cms-jar/org/jboss/portal/cms common/src/main/org/jboss/portal/common/test/junit common/src/main/org/jboss/portal/common/util core core/src/main/org/jboss/portal/test/core core/src/main/org/jboss/portal/test/core/model/instance core/src/main/org/jboss/portal/test/core/model/portal core/src/main/org/jboss/portal/test/core/state core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-29 11:35:29 -0500 (Wed, 29 Nov 2006)
New Revision: 5744
Added:
trunk/test/src/etc/hibernates.xml
Modified:
trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
trunk/common/src/main/org/jboss/portal/common/util/XML.java
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/jboss-beans.xml
trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml
trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml
trunk/portlet/build.xml
trunk/test/src/etc/datasources.xml
trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
Log:
JBPORTAL-1134 : explicitly set up hibernate dialect for portal testsuite
Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -28,6 +28,7 @@
import org.jboss.portal.common.test.junit.JUnitAdapter;
import org.jboss.portal.test.framework.TestRuntimeContext;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
import java.net.URL;
import java.util.Map;
@@ -66,6 +67,7 @@
runtimeContext = new TestRuntimeContext("org/jboss/portal/cms/jboss-beans.xml");
runtimeContext.addBean("TestBean", this);
runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getDisplayName()));
runtimeContext.start();
}
Modified: trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml
===================================================================
--- trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -34,6 +34,13 @@
</constructor>
</bean>
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -48,13 +55,11 @@
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
<property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
property="connectionManagerReference"/></property>
- <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
- <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
- <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
- <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="jNDIName">java:/SessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
Modified: trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -154,6 +154,10 @@
{
setUpMethod.invoke(test, new Object[0]);
}
+ else
+ {
+ // Maybe print a warn !!! ???
+ }
}
catch (NoSuchMethodException ignore)
{
Modified: trunk/common/src/main/org/jboss/portal/common/util/XML.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/XML.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/common/src/main/org/jboss/portal/common/util/XML.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -181,8 +181,7 @@
StringReader reader = new StringReader(text);
InputSource source = new InputSource();
source.setCharacterStream(reader);
- Document doc = builder.parse(source);
- return doc;
+ return builder.parse(source);
}
/** Parse a string into an element. */
@@ -192,6 +191,20 @@
return doc.getDocumentElement();
}
+ public static Document toDocument(Element element) throws ParserConfigurationException, SAXException, IOException
+ {
+ if (element == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Document doc = buildFactory.newDocumentBuilder().newDocument();
+ element = (Element)doc.importNode(element, true);
+ doc.appendChild(element);
+ return doc;
+ }
+
/**
* Perform trimming by default
*
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/build.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -598,6 +598,9 @@
<parameter name="CloneOnCreate" value="false"/>
<parameter name="CacheNaturalId" value="true"/>
</zest>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.state.ProducerTestCase"
+ outfile="TEST-ProducerTestCase">
+ </zest>
<test todir="${test.reports}"
name="org.jboss.portal.test.core.deployment.JBossApplicationMetaDataFactoryTestCase"/>
<test todir="${test.reports}"
Modified: trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/main/org/jboss/portal/test/core/PortalBaseTestCase.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -67,7 +67,7 @@
protected TestRuntimeContext runtimeContext;
/** . */
- protected DataSourceSupport.Config dsCfg;
+ protected DataSourceSupport.Config dataSourceConfigParameter;
/** . */
protected HibernateSupport hibernate;
@@ -85,6 +85,16 @@
return hibernate;
}
+ public DataSourceSupport.Config getDataSourceConfigParameter()
+ {
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
+ {
+ this.dataSourceConfigParameter = dataSourceConfigParameter;
+ }
+
public void setHibernate(HibernateSupport hibernate)
{
this.hibernate = hibernate;
@@ -92,7 +102,7 @@
public String getName()
{
- return super.getName() + "_" + dsCfg.getDriverClass().replaceAll("\\.", "_");
+ return super.getName() + ",ds=" + dataSourceConfigParameter.getDisplayName();
}
protected Set getDefaultSecurityConstraints()
@@ -118,7 +128,8 @@
{
runtimeContext = new TestRuntimeContext(getConfigLocation());
runtimeContext.addBean("TestBean", this);
- runtimeContext.addBean("DataSourceConfig", dsCfg);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getDisplayName()));
runtimeContext.start();
//
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/instance/InstanceContainerTestCase.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -302,6 +302,7 @@
runtimeContext.addBean("TestCaseConfig", this);
runtimeContext.addBean("TestBean", this);
runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getDisplayName()));
runtimeContext.start();
}
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -33,6 +33,9 @@
import org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory;
import org.jboss.portal.test.core.PortalBaseTestCase;
import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.common.test.TestParametrization;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -53,40 +56,16 @@
public static TestSuite suite() throws Exception
{
-
- TestSuite suite = new TestSuite();
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
- DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
- for (int i = 0; i < configs.length; i++)
- {
- DataSourceSupport.Config config = configs[i];
- //
- Method[] methods = PortalObjectContainerTestCase.class.getMethods();
- for (int j = 0; j < methods.length; j++)
- {
- Method method = methods[j];
- int modifiers = method.getModifiers();
- if (Modifier.isPublic(modifiers) && !Modifier.isAbstract(modifiers)
- && !Modifier.isStatic(modifiers) && method.getName().startsWith("test"))
- {
- PortalBaseTestCase testCase = new PortalObjectContainerTestCase(config);
- testCase.setName(method.getName());
- suite.addTest(testCase);
-
- }
- }
- }
-
- //
+ parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(PortalObjectContainerTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
return suite;
}
-
- public PortalObjectContainerTestCase(DataSourceSupport.Config config)
- {
- this.dsCfg = config;
- }
-
protected String getConfigLocation()
{
return "org/jboss/portal/test/core/model/portal/jboss-beans.xml";
@@ -95,7 +74,7 @@
JBossAuthorizationDomainRegistryImpl registry;
JACCPortalAuthorizationManagerFactory factory;
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
Modified: trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.core.state;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
@@ -31,6 +32,9 @@
import org.jboss.portal.Mode;
import org.jboss.portal.common.junit.TransactionAssert;
import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.test.TestParametrization;
+import org.jboss.portal.common.test.junit.JUnitAdapter;
+import org.jboss.portal.common.test.junit.POJOJUnitTest;
import org.jboss.portal.core.impl.portlet.state.PersistentStateStore;
import org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker;
import org.jboss.portal.portlet.NoSuchPortletException;
@@ -60,6 +64,7 @@
import java.util.Collections;
import java.util.List;
+import java.net.URL;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -76,20 +81,23 @@
Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
}
-// public static TestSuite suite() throws Exception
-// {
-// URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
-// DataSourceSupport.Config[] configs = DataSourceSupport.Config.fromXML(configsURL);
-// DatabaseTestSuite suite = new DatabaseTestSuite(configs);
-// suite.addTestCase(ProducerTestCase.class);
-// return suite;
-// }
+ public static TestSuite suite() throws Exception
+ {
+ TestParametrization parametrization = JUnitAdapter.getParametrization();
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("datasources.xml");
+ parametrization.setParameterValue("DataSourceConfig", DataSourceSupport.Config.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(ProducerTestCase.class);
+ JUnitAdapter adapter = new JUnitAdapter(abc, parametrization);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }
/** . */
private TestRuntimeContext runtimeContext;
/** . */
- private DataSourceSupport.Config dsCfg;
+ private DataSourceSupport.Config dataSourceConfigParameter;
/** . */
private HibernateSupport hibernateSupport;
@@ -103,9 +111,9 @@
/** . */
private PortletInvokerSupport portletContainer;
- public ProducerTestCase(DataSourceSupport.Config config)
+ public String getName()
{
- this.dsCfg = config;
+ return super.getName() + ",ds=" + dataSourceConfigParameter.getDisplayName();
}
public HibernateSupport getHibernateSupport()
@@ -148,11 +156,22 @@
this.portletContainer = portletContainer;
}
- protected void setUp() throws Exception
+ public DataSourceSupport.Config getDataSourceConfigParameter()
{
+ return dataSourceConfigParameter;
+ }
+
+ public void setDataSourceConfigParameter(DataSourceSupport.Config dataSourceConfigParameter)
+ {
+ this.dataSourceConfigParameter = dataSourceConfigParameter;
+ }
+
+ public void setUp() throws Exception
+ {
runtimeContext = new TestRuntimeContext("org/jboss/portal/test/core/state/jboss-beans.xml");
runtimeContext.addBean("TestBean", this);
- runtimeContext.addBean("DataSourceConfig", dsCfg);
+ runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getDisplayName()));
runtimeContext.start();
portletContainer.addPortlet("SimplePortlet", new PortletSupport()
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/instance/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -40,6 +40,13 @@
</constructor>
</bean>
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -52,15 +59,12 @@
<bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
- <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
- property="connectionManagerReference"/></property>
- <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
- <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
- <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
- <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
</bean>
<bean name="InstanceHibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="mappings">
<list elementClass="java.lang.String">
<value>conf/hibernate/instance/domain.hbm.xml</value>
@@ -70,6 +74,7 @@
</bean>
<bean name="PortletHibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="mappings">
<list elementClass="java.lang.String">
<value>conf/hibernate/portlet/domain.hbm.xml</value>
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/jboss-beans.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -34,6 +34,13 @@
</constructor>
</bean>
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -46,15 +53,12 @@
<bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
- <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
- property="connectionManagerReference"/></property>
- <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
- <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
- <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
- <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="mappings">
<list elementClass="java.lang.String">
<value>conf/hibernate/portal/domain.hbm.xml</value>
Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml
===================================================================
--- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/state/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -34,6 +34,13 @@
</constructor>
</bean>
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -46,15 +53,12 @@
<bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
- <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
- property="connectionManagerReference"/></property>
- <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
- <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
- <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
- <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="mappings">
<list elementClass="java.lang.String">
<value>conf/hibernate/portlet/domain.hbm.xml</value>
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCase.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -121,6 +121,7 @@
runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/db-beans.xml");
runtimeContext.addBean("DBTestBean", this);
runtimeContext.addBean("DataSourceConfig", dataSourceConfigParameter);
+ runtimeContext.addBean("HibernateConfig", HibernateSupport.getConfig(dataSourceConfigParameter.getDisplayName()));
runtimeContext.start();
//
Modified: trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml
===================================================================
--- trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/db-beans.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -34,6 +34,13 @@
</constructor>
</bean>
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
<bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
</bean>
@@ -46,15 +53,12 @@
<bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
<property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
- <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
- property="connectionManagerReference"/></property>
- <property name="driverClass"><inject bean="DataSourceConfig" property="driverClass"/></property>
- <property name="connectionURL"><inject bean="DataSourceConfig" property="connectionURL"/></property>
- <property name="userName"><inject bean="DataSourceConfig" property="userName"/></property>
- <property name="password"><inject bean="DataSourceConfig" property="password"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport" property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
</bean>
<bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
<property name="jNDIName">java:/SessionFactory</property>
<property name="mappings">
<list elementClass="java.lang.String">
@@ -71,5 +75,4 @@
<property name="hibernate"><inject bean="HibernateSupport"/></property>
</bean>
-
</deployment>
Modified: trunk/portlet/build.xml
===================================================================
--- trunk/portlet/build.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/portlet/build.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -584,7 +584,7 @@
</x-sysproperty>
<x-test>
- <!--test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.SessionTestSuite"/-->
+ <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.SessionTestSuite"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.info.InfoTestSuite"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.session.SessionSynchronizationTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
Modified: trunk/test/src/etc/datasources.xml
===================================================================
--- trunk/test/src/etc/datasources.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/test/src/etc/datasources.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -22,6 +22,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<datasources>
+ <!-- The hsqldb datasource -->
<datasource>
<display-name>hsqldb</display-name>
<connection-url>jdbc:hsqldb:file:test</connection-url>
Added: trunk/test/src/etc/hibernates.xml
===================================================================
--- trunk/test/src/etc/hibernates.xml 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/test/src/etc/hibernates.xml 2006-11-29 16:35:29 UTC (rev 5744)
@@ -0,0 +1,50 @@
+<configurations>
+ <!-- The default configuration that will apply everywhere -->
+ <configuration>
+ <configuration-name>default</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.show_sql</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hibernate.auto_close_session</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hibernate.transaction.flush_before_completion</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>hibernate.transaction.factory_class</name>
+ <value>org.hibernate.transaction.JTATransactionFactory</value>
+ </property>
+ <property>
+ <name>hibernate.transaction.manager_lookup_class</name>
+ <value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
+ </property>
+ <property>
+ <name>hibernate.cache.provider_class</name>
+ <value>org.hibernate.cache.HashtableCacheProvider</value>
+ </property>
+ <property>
+ <name>hibernate.cache.use_second_level_cache</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>hibernate.cache.use_query_cache</name>
+ <value>false</value>
+ </property>
+ </properties>
+ </configuration>
+ <!-- The hsqldb configuration -->
+ <configuration>
+ <configuration-name>hsqldb</configuration-name>
+ <properties>
+ <property>
+ <name>hibernate.dialect</name>
+ <value>org.hibernate.dialect.HSQLDialect</value>
+ </property>
+ </properties>
+ </configuration>
+</configurations>
\ No newline at end of file
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -59,7 +59,7 @@
private CachedConnectionManagerReference connectionManagerReference;
//
- private Config cfg;
+ private Config config;
private String jndiName = "java:/DefaultDS";
@@ -68,7 +68,7 @@
public DataSourceSupport(Config cfg)
{
- this.cfg = cfg;
+ this.config = cfg;
}
public DataSourceSupport()
@@ -85,10 +85,10 @@
//
ds = new LocalTxDataSource();
- ds.setConnectionURL(cfg.getConnectionURL());
- ds.setDriverClass(cfg.getDriverClass());
- ds.setUserName(cfg.getUserName());
- ds.setPassword(cfg.getPassword());
+ ds.setConnectionURL(config.getConnectionURL());
+ ds.setDriverClass(config.getDriverClass());
+ ds.setUserName(config.getUserName());
+ ds.setPassword(config.getPassword());
ds.setJndiName(jndiName);
ds.setMaxSize(10);
ds.setMinSize(0);
@@ -103,7 +103,7 @@
public void stop()
{
// Make hsqldb flush its data on the disk
- if ("org.hsqldb.jdbcDriver".equals(cfg.driverClass))
+ if ("org.hsqldb.jdbcDriver".equals(config.driverClass))
{
try
{
@@ -136,56 +136,16 @@
{
}
- public String getConnectionURL()
+ public Config getConfig()
{
- return cfg.connectionURL;
+ return config;
}
- public void setConnectionURL(String connectionURL)
+ public void setConfig(Config config)
{
- this.cfg.connectionURL = connectionURL;
+ this.config = config;
}
- public String getDriverClass()
- {
- return cfg.driverClass;
- }
-
- public void setDriverClass(String driverClass)
- {
- this.cfg.driverClass = driverClass;
- }
-
- public String getUserName()
- {
- return cfg.userName;
- }
-
- public void setUserName(String userName)
- {
- this.cfg.userName = userName;
- }
-
- public String getPassword()
- {
- return cfg.password;
- }
-
- public void setPassword(String password)
- {
- this.cfg.password = password;
- }
-
- public String getJndiName()
- {
- return jndiName;
- }
-
- public void setJndiName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
public TransactionManager getTransactionManager()
{
return transactionManager;
@@ -209,10 +169,19 @@
public static class Config
{
+ /** . */
private String displayName;
+
+ /** . */
private String connectionURL;
+
+ /** . */
private String driverClass;
+
+ /** . */
private String userName;
+
+ /** . */
private String password;
public Config(String displayName, String connectionURL, String driverClass, String userName, String password)
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java 2006-11-29 13:29:37 UTC (rev 5743)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSupport.java 2006-11-29 16:35:29 UTC (rev 5744)
@@ -31,11 +31,20 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Settings;
import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.util.Tools;
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
import javax.transaction.Synchronization;
import java.util.Collection;
import java.util.Iterator;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.HashMap;
import java.util.Properties;
+import java.io.InputStream;
+import java.net.URL;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -44,8 +53,6 @@
public class HibernateSupport
{
- public static final String DS_JNDI_NAME = "java:/DefaultDS";
-
/** . */
protected String jndiName;
@@ -53,17 +60,20 @@
protected Collection mappings;
/** . */
- protected Configuration cfg;
+ protected Config config;
/** . */
protected SessionFactory factory;
/** . */
- protected Settings settings;
+ protected Session session;
/** . */
- protected Session session;
+ protected Configuration cfg;
+ /** . */
+ protected Settings settings;
+
public Collection getMappings()
{
return mappings;
@@ -74,11 +84,16 @@
this.mappings = mappings;
}
- public Configuration getConfig()
+ public Config getConfig()
{
- return cfg;
+ return config;
}
+ public void setConfig(Config config)
+ {
+ this.config = config;
+ }
+
public SessionFactory getSessionFactory()
{
return factory;
@@ -96,10 +111,8 @@
protected void createConfiguration()
{
- //
- cfg = new Configuration();
+ Configuration cfg = new Configuration();
- //
for (Iterator i = mappings.iterator(); i.hasNext();)
{
String mapping = (String)i.next();
@@ -108,25 +121,21 @@
//
Properties props = new Properties();
- props.setProperty("hibernate.show_sql", "true");
- props.setProperty("hibernate.transaction.flush_before_completion", "true");
- props.setProperty("hibernate.transaction.auto_close_session", "true");
- props.setProperty("hibernate.transaction.factory_class", "org.hibernate.transaction.JTATransactionFactory");
- props.setProperty("hibernate.transaction.manager_lookup_class", "org.hibernate.transaction.JBossTransactionManagerLookup");
- props.setProperty("hibernate.connection.datasource", DS_JNDI_NAME);
- props.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
+ props.putAll(config.properties);
+ cfg.addProperties(props);
//
+ cfg.setProperty("hibernate.connection.datasource", "java:/DefaultDS");
+
+ //
if (jndiName != null)
{
- props.setProperty("hibernate.session_factory_name", jndiName);
+ cfg.setProperty("hibernate.session_factory_name", jndiName);
}
//
- cfg.setProperties(props);
-
- //
- settings = cfg.buildSettings();
+ this.settings = cfg.buildSettings();
+ this.cfg = cfg;
}
protected void createSessionFactory()
@@ -153,7 +162,7 @@
protected void destroyConfiguration()
{
- cfg = null;
+ config = null;
}
public void create() throws Exception
@@ -305,4 +314,105 @@
});
return session;
}
+
+ public static class Config
+ {
+
+ /** . */
+ private String name;
+
+ /** . */
+ private Map properties;
+
+ public Config(String name, Map properties)
+ {
+ this.name = name;
+ this.properties = properties;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map getProperties()
+ {
+ return properties;
+ }
+ }
+
+ /** . */
+ private static Map configs;
+
+ public static Map fromXML(URL url) throws Exception
+ {
+ Map configs = new LinkedHashMap();
+ InputStream in = null;
+ try
+ {
+ in = Tools.safeBufferedWrapper(url.openStream());
+ Document doc = XML.getDocumentBuilderFactory().newDocumentBuilder().parse(in);
+ for (Iterator i = XML.getChildrenIterator(doc.getDocumentElement(), "configuration"); i.hasNext();)
+ {
+ Element childElt = (Element)i.next();
+
+ //
+ Element configurationNameElt = XML.getUniqueChild(childElt, "configuration-name", true);
+ String configurationName = XML.asString(configurationNameElt);
+
+ //
+ Map properties = new HashMap();
+ Element propertiesElt = XML.getUniqueChild(childElt, "properties", false);
+ if (propertiesElt != null)
+ {
+ for (Iterator j = XML.getChildrenIterator(propertiesElt, "property");j.hasNext();)
+ {
+ Element propertyElt = (Element)j.next();
+ Element nameElt = XML.getUniqueChild(propertyElt, "name", true);
+ Element valueElt = XML.getUniqueChild(propertyElt, "value", true);
+ String name = XML.asString(nameElt);
+ String value = XML.asString(valueElt);
+ properties.put(name, value);
+ }
+ }
+
+ //
+ Config config = new Config(configurationName, properties);
+ configs.put(configurationName, config);
+ }
+ return configs;
+ }
+ finally
+ {
+ Tools.safeClose(in);
+ }
+ }
+
+ public synchronized static Config getConfig(String name) throws Exception
+ {
+ if (configs == null)
+ {
+ URL url = Thread.currentThread().getContextClassLoader().getResource("hibernates.xml");
+ configs = fromXML(url);
+
+ // Remove and merge default with all
+ Config defaultCfg = (Config)configs.remove("default");
+
+ //
+ for (Iterator i = configs.values().iterator();i.hasNext();)
+ {
+ Config cfg = (Config)i.next();
+ if ("default".equals(cfg.getName()) == false)
+ {
+ Map tmp = new HashMap(defaultCfg.properties);
+ tmp.putAll(cfg.properties);
+ cfg.properties = tmp;
+ }
+ }
+
+ }
+
+ //
+ return (Config)configs.get(name);
+ }
}
17 years, 5 months
JBoss Portal SVN: r5743 - in trunk: build/ide/intellij/idea50/modules/identity core/src/main/org/jboss/portal/core/aspects/controller identity identity/src/main/org/jboss/portal/identity2 identity/src/main/org/jboss/portal/identity2/config identity/src/main/org/jboss/portal/identity2/config/metadata identity/src/main/org/jboss/portal/identity2/ldap identity/src/main/org/jboss/portal/identity2/service identity/src/main/org/jboss/portal/test/identity identity/src/main/org/jboss/portal/test/id
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2006-11-29 08:29:37 -0500 (Wed, 29 Nov 2006)
New Revision: 5743
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigOptionMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java
Removed:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java
Modified:
trunk/build/ide/intellij/idea50/modules/identity/identity.iml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java
trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java
trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
trunk/identity/src/resources/draft/standardidentity-config.xml
trunk/identity/src/resources/test/config/standardidentity-config.xml
trunk/test/src/etc/identityconfig/opends-config.xml
trunk/test/src/etc/identityconfig/rhds-config.xml
trunk/test/src/etc/identityconfig/standardidentity-config.xml
Log:
- use microcontainer to instantiate identity modules
- introduce datasource into config
- update testsuite
Modified: trunk/build/ide/intellij/idea50/modules/identity/identity.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -103,6 +103,33 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-dependency.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-container.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
===================================================================
Modified: trunk/identity/build.xml
===================================================================
Modified: trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -31,13 +31,13 @@
{
//TODO: move to safe type enum
- public static final String TYPE_USER_MODULE = "UserModule";
+ public static final String TYPE_USER_MODULE = "User";
- public static final String TYPE_ROLE_MODULE = "RoleModule";
+ public static final String TYPE_ROLE_MODULE = "Role";
- public static final String TYPE_MEMBERSHIP_MODULE = "MembershipModule";
+ public static final String TYPE_MEMBERSHIP_MODULE = "Membership";
- public static final String TYPE_USER_PROFILE_MODULE = "UserProfileModule";
+ public static final String TYPE_USER_PROFILE_MODULE = "UserProfile";
public static final String TYPE_CONNECTION_CONTEXT = "ConnectionContext";
Modified: trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -27,15 +27,22 @@
import org.jboss.portal.identity2.config.IdentityConfigurationMetaDataFactory;
import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleConfigOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigOptionMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourceMetaData;
import org.jboss.portal.identity2.service.IdentityModuleService;
import org.jboss.portal.identity2.service.IdentityConfigurationService;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
import javax.management.ObjectName;
import java.net.URL;
@@ -44,8 +51,7 @@
import java.util.Iterator;
import java.util.HashMap;
import java.util.List;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
@@ -67,6 +73,16 @@
private String defaultConfigFile;
+ /**
+ * .
+ */
+ protected Kernel kernel;
+
+ /**
+ * .
+ */
+ protected List beans;
+
protected void startService() throws Exception
{
if (jndiName != null)
@@ -75,6 +91,19 @@
jndiBinding.bind();
}
+ //initialize microcontainer stuff
+ try
+ {
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+ kernel = bootstrap.getKernel();
+ beans = new ArrayList();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException(e);
+ }
+
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
//TODO: make a dtd for config files.
@@ -83,10 +112,22 @@
IdentityConfigurationMetaData meta = parseConfiguration(configFile);
IdentityConfigurationMetaData defaultMeta = parseConfiguration(defaultConfigFile);
- IdentityContextImpl context = new IdentityContextImpl();
- identityContext = context;
- context.start();
+ KernelControllerContext identityKernelContext;
+ try
+ {
+ AbstractBeanMetaData contextBMD = new AbstractBeanMetaData(
+ "portal:identity=IdentityContext",
+ IdentityContextImpl.class.getName());
+ beans.add(contextBMD);
+ identityKernelContext = kernel.getController().install(contextBMD);
+ identityContext = (IdentityContext)identityKernelContext.getTarget();
+ }
+ catch (Throwable throwable)
+ {
+ throw new IdentityException(throwable);
+ }
+
//TODO:update meta options using defaultMeta options
//create detault modules set
@@ -94,7 +135,7 @@
//Map[implementation] --> Map[Type] --> ModuleMetaData
Map defaultImplementations = new HashMap();
-
+ //update modules data with defaults
try
{
List defaultModules = defaultMeta.getModules().getModules();
@@ -104,10 +145,10 @@
//check if defaults contains all information
if (module.getType() == null ||
- module.getImplementation() == null ||
- module.getJndiName() == null ||
- module.getServiceName() == null ||
- module.getConfig() == null)
+ module.getImplementation() == null ||
+ //module.getJndiName() == null ||
+ module.getServiceName() == null ||
+ module.getConfig() == null)
{
throw new IdentityException("Default module configuration must be complete");
}
@@ -124,6 +165,7 @@
implementation = new HashMap();
}
+ //store per implementation
implementation.put(module.getType(), module);
defaultImplementations.put(implType, implementation);
}
@@ -133,15 +175,21 @@
throw new IdentityException("Error during processing default configuration file", e);
}
+ //map default datasources by name
+ Map defaultDatasources = new HashMap();
+ for (Iterator iterator = defaultMeta.getDatasources().getDatasources().iterator(); iterator.hasNext();)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
+ defaultDatasources.put(ds.getName(), ds);
+ }
+
//process the list of modules, instantiate them, configure them, tide them
try
{
+ List datasources = meta.getDatasources().getDatasources();
List modules = meta.getModules().getModules();
- //TODO: update configuration options from defaultMeta
- //OptionsMetaData options = meta.getOptions();
-
//inject configuration service
IdentityConfigurationService configuration = new IdentityConfigurationService(meta.getOptions());
configuration.setIdentityContext(identityContext);
@@ -149,63 +197,143 @@
//TODO:set proper jndiName and serviceName
configuration.start();
- updateOptionsWithDefaults(configuration,defaultMeta.getOptions());
+ //update options with defaults
+ updateOptionsWithDefaults(configuration, defaultMeta.getOptions());
-
- for (Iterator iterator = modules.iterator(); iterator.hasNext();)
+ //process datasources
+ for (Iterator iterator = datasources.iterator(); iterator.hasNext();)
{
+ DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
+ if (log.isDebugEnabled()) log.debug("processing datasource: " + ds.getName() + "/" + ds.getClassName());
+ updateDatasourceWithDefaults(ds, defaultDatasources);
- ModuleMetaData module = (ModuleMetaData)iterator.next();
- log.debug("Processing module: " + module.getType() + "/" + module.getImplementation());
- updateModuleWithDefaults(module, defaultImplementations);
+ //generate initial options
+ //TODO:presence of config tag should be forced in dtd
+ Map configOptions = ds.getConfig().getOptions();
+ Map optionMap = new HashMap();
+ for (Iterator iterator1 = configOptions.keySet().iterator(); iterator1.hasNext();)
+ {
+ String optionName = (String)iterator1.next();
+ ConfigOptionMetaData option = (ConfigOptionMetaData)configOptions.get(optionName);
+ optionMap.put(optionName, option.getValue());
+ }
//instantiate the module
+ //IdentityModuleService moduleService = null;
- IdentityModuleService moduleService = null;
- if (module.getClassName() == null)
+ if (ds.getClassName() == null)
{
- throw new IdentityException("Class name not found for module type: " + module.getType() + " wrong configuration");
+ throw new IdentityException("Class name not found for datasource type: " + ds.getName() + " wrong configuration");
}
- try
+ /*try
{
moduleService = (IdentityModuleService)tcl.loadClass(module.getClassName()).newInstance();
}
- catch (InstantiationException e)
+ catch (Exception e)
{
throw new IdentityException("Unable to instantiate the class: " + module.getClassName() );
+ }*/
+
+ //instantiate datasource using MC
+ String entryName = "portal:identity=Datasource,type=" + ds.getName();
+ AbstractBeanMetaData dsBMD = new AbstractBeanMetaData(entryName,
+ ds.getClassName());
+ //AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
+ //moduleBMD.addProperty(propertyBMD);
+
+ //initiate parameters from <config>
+ for (Iterator iterator1 = optionMap.keySet().iterator(); iterator1.hasNext();)
+ {
+ String propertyKey = (String)iterator1.next();
+ String propertyValue = (String)optionMap.get(propertyKey);
+ AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
+ dsBMD.addProperty(propertyBMD);
}
- catch (IllegalAccessException e)
+
+ // Installation
+ beans.add(dsBMD);
+ KernelControllerContext controllerContext = kernel.getController().install(dsBMD);
+ Object datasource = controllerContext.getTarget();
+
+ //make a part of identityContext
+ //moduleService.setIdentityContext(identityContext);
+
+ //register as an mbean
+ if (isRegisterMBeans())
{
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ getServer().registerMBean(datasource, new ObjectName(ds.getServiceName()));
}
- catch (ClassNotFoundException e)
+
+
+ }
+
+
+
+ //process modules for instantiation
+ for (Iterator iterator = modules.iterator(); iterator.hasNext();)
+ {
+
+ ModuleMetaData module = (ModuleMetaData)iterator.next();
+ if (log.isDebugEnabled())
{
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ log.debug("Processing module: " + module.getType() + "/" + module.getImplementation());
}
+ updateModuleWithDefaults(module, defaultImplementations);
- //make a part of identityContext
- moduleService.setIdentityContext(identityContext);
-
//generate initial options
Map configOptions = module.getConfig().getOptions();
Map optionMap = new HashMap();
for (Iterator iterator1 = configOptions.keySet().iterator(); iterator1.hasNext();)
{
String optionName = (String)iterator1.next();
- ModuleConfigOptionMetaData option = (ModuleConfigOptionMetaData)configOptions.get(optionName);
- optionMap.put(optionName,option.getValue());
+ ConfigOptionMetaData option = (ConfigOptionMetaData)configOptions.get(optionName);
+ optionMap.put(optionName, option.getValue());
}
- //set options
- moduleService.setInitOptions(optionMap);
+ //instantiate the module
+ //IdentityModuleService moduleService = null;
- moduleService.setJndiName(module.getJndiName());
- //start
- moduleService.start();
+ if (module.getClassName() == null)
+ {
+ throw new IdentityException("Class name not found for module type: " + module.getType() + " wrong configuration");
+ }
+ /*try
+ {
+ moduleService = (IdentityModuleService)tcl.loadClass(module.getClassName()).newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Unable to instantiate the class: " + module.getClassName() );
+ }*/
+
+ //instantiate module using MC
+ String entryName = "portal:identity=Module,type=" + module.getType();
+ AbstractBeanMetaData moduleBMD = new AbstractBeanMetaData(entryName,
+ module.getClassName());
+ AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
+ moduleBMD.addProperty(propertyBMD);
+
+ //initiate parameters from <config>
+ for (Iterator iterator1 = optionMap.keySet().iterator(); iterator1.hasNext();)
+ {
+ String propertyKey = (String)iterator1.next();
+ String propertyValue = (String)optionMap.get(propertyKey);
+ propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
+ moduleBMD.addProperty(propertyBMD);
+ }
+
+ // Installation
+ beans.add(moduleBMD);
+ KernelControllerContext controllerContext = kernel.getController().install(moduleBMD);
+ Object moduleService = (IdentityModuleService)controllerContext.getTarget();
+
+ //make a part of identityContext
+ //moduleService.setIdentityContext(identityContext);
+
//register as an mbean
if (isRegisterMBeans())
{
@@ -215,7 +343,7 @@
}
- catch (Exception e)
+ catch (Throwable e)
{
throw new IdentityException("Cannot initiate identity modules: ", e);
}
@@ -264,6 +392,7 @@
/**
* updates module with proper defaults
+ *
* @param module
* @param defaultModules
*/
@@ -288,10 +417,6 @@
{
module.setClassName(def.getClassName());
}
- if (module.getJndiName() == null)
- {
- module.setJndiName(def.getJndiName());
- }
if (module.getServiceName() == null)
{
module.setServiceName(def.getServiceName());
@@ -316,7 +441,7 @@
String key = (String)iterator.next();
if (!moduleOptions.containsKey(key))
{
- ModuleConfigOptionMetaData o = (ModuleConfigOptionMetaData)defOptions.get(key);
+ ConfigOptionMetaData o = (ConfigOptionMetaData)defOptions.get(key);
module.getConfig().addOption(o);
}
}
@@ -324,7 +449,57 @@
}
/**
+ * updates module with proper defaults
+ */
+ private void updateDatasourceWithDefaults(DatasourceMetaData ds, Map defaultDS)
+ {
+ if (ds.getName() == null)
+ {
+ return;
+ }
+ if (!defaultDS.containsKey(ds.getName()))
+ {
+ return;
+ }
+ DatasourceMetaData def = (DatasourceMetaData)defaultDS.get(ds.getName());
+ if (ds.getClassName() == null)
+ {
+ ds.setClassName(def.getClassName());
+ }
+ if (ds.getServiceName() == null)
+ {
+ ds.setServiceName(def.getServiceName());
+ }
+
+ //now check if config options are overwritten
+ if (ds.getConfig() == null)
+ {
+ ds.setConfig(def.getConfig());
+ }
+ else
+ {
+ Map dsOptions = ds.getConfig().getOptions();
+ if (dsOptions == null)
+ {
+ return;
+ }
+ Map defOptions = def.getConfig().getOptions();
+
+ for (Iterator iterator = defOptions.keySet().iterator(); iterator.hasNext();)
+ {
+ String key = (String)iterator.next();
+ if (!dsOptions.containsKey(key))
+ {
+ ConfigOptionMetaData o = (ConfigOptionMetaData)defOptions.get(key);
+ ds.getConfig().addOption(o);
+ }
+ }
+ }
+ }
+
+ /**
* Check current options and update them with defaults if not exists;
+ *
* @param config
* @param defaults
*/
@@ -353,9 +528,9 @@
if (config.getValues(groupKey, optionKey) == null)
{
-
+
//config.setValues(groupKey, optionKey, new HashSet());
- config.setValues(groupKey,optionKey,option.getValues());
+ config.setValues(groupKey, optionKey, option.getValues());
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -27,10 +27,12 @@
import org.jboss.portal.identity2.config.metadata.ModulesMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleConfigMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleConfigOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigOptionMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourcesMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourceMetaData;
import org.xml.sax.Attributes;
/**
@@ -59,11 +61,29 @@
{
return new ModulesMetaData();
}
+ else if ("datasources".equals(localName))
+ {
+ return new DatasourcesMetaData();
+ }
else if("options".equals(localName))
{
return new OptionsMetaData();
}
}
+ if (root instanceof DatasourcesMetaData)
+ {
+ if ("datasource".equals(localName))
+ {
+ return new DatasourceMetaData();
+ }
+ }
+ if (root instanceof DatasourceMetaData)
+ {
+ if ("config".equals(localName))
+ {
+ return new ConfigMetaData();
+ }
+ }
else if (root instanceof ModulesMetaData)
{
if ("module".equals(localName))
@@ -75,14 +95,14 @@
{
if ("config".equals(localName))
{
- return new ModuleConfigMetaData();
+ return new ConfigMetaData();
}
}
- else if (root instanceof ModuleConfigMetaData)
+ else if (root instanceof ConfigMetaData)
{
if ("option".equals(localName))
{
- return new ModuleConfigOptionMetaData();
+ return new ConfigOptionMetaData();
}
}
else if (root instanceof OptionsMetaData)
@@ -111,12 +131,32 @@
{
identity.setModules((ModulesMetaData)child);
}
+ else if (child instanceof DatasourcesMetaData)
+ {
+ identity.setDatasources((DatasourcesMetaData)child);
+ }
else if (child instanceof OptionsMetaData)
{
identity.setOptions((OptionsMetaData)child);
}
-
}
+ else if (parent instanceof DatasourcesMetaData)
+ {
+ DatasourcesMetaData datasources = (DatasourcesMetaData)parent;
+ if (child instanceof DatasourceMetaData)
+ {
+ datasources.addDatasource((DatasourceMetaData)child);
+ }
+ }
+ else if (parent instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData datasource = (DatasourceMetaData)parent;
+ if (child instanceof ConfigMetaData)
+ {
+ datasource.setConfig((ConfigMetaData)child);
+ }
+ }
+
else if (parent instanceof ModulesMetaData)
{
ModulesMetaData modules = (ModulesMetaData)parent;
@@ -128,17 +168,17 @@
else if (parent instanceof ModuleMetaData)
{
ModuleMetaData module = (ModuleMetaData)parent;
- if (child instanceof ModuleConfigMetaData)
+ if (child instanceof ConfigMetaData)
{
- module.setConfig((ModuleConfigMetaData)child);
+ module.setConfig((ConfigMetaData)child);
}
}
- else if (parent instanceof ModuleConfigMetaData)
+ else if (parent instanceof ConfigMetaData)
{
- ModuleConfigMetaData config = (ModuleConfigMetaData)parent;
- if (child instanceof ModuleConfigOptionMetaData)
+ ConfigMetaData config = (ConfigMetaData)parent;
+ if (child instanceof ConfigOptionMetaData)
{
- config.addOption((ModuleConfigOptionMetaData)child);
+ config.addOption((ConfigOptionMetaData)child);
}
}
else if (parent instanceof OptionsMetaData)
@@ -180,14 +220,29 @@
{
module.setClassName(value);
}
- else if ("jndi-name".equals(localName))
+ }
+ if (object instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)object;
+ if ("name".equals(localName))
{
- module.setJndiName(value);
+ log.info("@@@@ adding name: " + value);
+ ds.setName(value);
}
+ else if ("service-name".equals(localName))
+ {
+ log.info("@@@@ adding service name: " + value);
+ ds.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ log.info("@@@@ class name: " + value);
+ ds.setClassName(value);
+ }
}
- else if (object instanceof ModuleConfigOptionMetaData)
+ else if (object instanceof ConfigOptionMetaData)
{
- ModuleConfigOptionMetaData option = (ModuleConfigOptionMetaData)object;
+ ConfigOptionMetaData option = (ConfigOptionMetaData)object;
if ("name".equals(localName))
{
option.setName(value);
Copied: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigMetaData.java (from rev 5721, trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java)
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-26 02:55:41 UTC (rev 5721)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -0,0 +1,61 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigMetaData
+{
+ private Map options;
+
+
+ public ConfigMetaData()
+ {
+ options = new HashMap();
+ }
+
+
+ public Map getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map options)
+ {
+ this.options = options;
+ }
+
+ public void addOption(ConfigOptionMetaData option)
+ {
+ options.put(option.getName(), option);
+ }
+
+ public ConfigOptionMetaData getOption(String name)
+ {
+ return (ConfigOptionMetaData)options.get(name);
+ }
+}
Copied: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigOptionMetaData.java (from rev 5733, trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java)
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-28 07:53:40 UTC (rev 5733)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigOptionMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -0,0 +1,58 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigOptionMetaData
+{
+ private String name;
+ private String value;
+
+
+ public ConfigOptionMetaData()
+ {
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -0,0 +1,92 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class DatasourceMetaData
+{
+ private String name;
+ private String serviceName;
+ private String className;
+ //private String jndiName;
+ private ConfigMetaData config;
+
+
+ public DatasourceMetaData()
+ {
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ /*public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }*/
+
+ public ConfigMetaData getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(ConfigMetaData config)
+ {
+ this.config = config;
+ }
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -0,0 +1,56 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class DatasourcesMetaData
+{
+ private List datasources;
+
+
+ public DatasourcesMetaData()
+ {
+ datasources = new LinkedList();
+ }
+
+
+ public List getDatasources()
+ {
+ return datasources;
+ }
+
+ public void setDatasources(List datasources)
+ {
+ this.datasources = datasources;
+ }
+
+ public void addDatasource(DatasourceMetaData datasource)
+ {
+ datasources.add(datasource);
+ }
+}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -32,6 +32,7 @@
{
private ModulesMetaData modules;
private OptionsMetaData options;
+ private DatasourcesMetaData datasources;
public IdentityConfigurationMetaData()
@@ -58,4 +59,15 @@
{
this.options = options;
}
+
+
+ public DatasourcesMetaData getDatasources()
+ {
+ return datasources;
+ }
+
+ public void setDatasources(DatasourcesMetaData datasources)
+ {
+ this.datasources = datasources;
+ }
}
Deleted: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -1,61 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.identity2.config.metadata;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class ModuleConfigMetaData
-{
- private Map options;
-
-
- public ModuleConfigMetaData()
- {
- options = new HashMap();
- }
-
-
- public Map getOptions()
- {
- return options;
- }
-
- public void setOptions(Map options)
- {
- this.options = options;
- }
-
- public void addOption(ModuleConfigOptionMetaData option)
- {
- options.put(option.getName(), option);
- }
-
- public ModuleConfigOptionMetaData getOption(String name)
- {
- return (ModuleConfigOptionMetaData)options.get(name);
- }
-}
Deleted: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -1,58 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portal.identity2.config.metadata;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class ModuleConfigOptionMetaData
-{
- private String name;
- private String value;
-
-
- public ModuleConfigOptionMetaData()
- {
- }
-
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -31,8 +31,8 @@
private String implementation;
private String serviceName;
private String className;
- private String jndiName;
- private ModuleConfigMetaData config;
+ //private String jndiName;
+ private ConfigMetaData config;
public ModuleMetaData()
@@ -80,7 +80,7 @@
this.className = className;
}
- public String getJndiName()
+ /*public String getJndiName()
{
return jndiName;
}
@@ -88,14 +88,14 @@
public void setJndiName(String jndiName)
{
this.jndiName = jndiName;
- }
+ }*/
- public ModuleConfigMetaData getConfig()
+ public ConfigMetaData getConfig()
{
return config;
}
- public void setConfig(ModuleConfigMetaData config)
+ public void setConfig(ConfigMetaData config)
{
this.config = config;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -27,6 +27,7 @@
import org.jboss.portal.identity2.IdentityConfiguration;
import org.jboss.portal.identity2.service.IdentityModuleService;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.common.util.JNDI;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -39,17 +40,17 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
*/
-public class LDAPConnectionContext extends IdentityModuleService
+public class LDAPConnectionContext extends AbstractJBossService
{
private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityModuleService.class);
+ private String jndiName;
+ private JNDI.Binding jndiBinding;
- /*private String name;
+ private String name;
- private String providerUrl;
-
private String contextFactory;
private String adminDN;
@@ -58,8 +59,12 @@
private String protocol;
- private String authentication = "simple";*/
+ private String authentication = "simple";
+ private String host;
+
+ private String port;
+
/*public LDAPConnectionContext(String name,
String url,
String context,
@@ -77,12 +82,14 @@
this.authentication = authentication;
}*/
- public LDAPConnectionContext()
+ /*public LDAPConnectionContext()
{
super(IdentityContext.TYPE_CONNECTION_CONTEXT);
- }
+ }*/
+
+
public InitialLdapContext createInitialContext() throws IdentityException
{
try
@@ -106,14 +113,28 @@
protected void startService() throws Exception
{
- /*if (getInitOptions() == null)
+
+ //
+ if (jndiName != null)
{
- throw new IdentityException("Cannot initialize ConnectionContext - lack of module init options");
- }*/
+ log.debug("Binding identity module to JNDI with name: " + jndiName);
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
- super.startService(); //To change body of overridden methods use File | Settings | File Templates.
}
+
+ protected void stopService() throws Exception
+ {
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+
+ }
+
public String toString()
{
StringBuffer str = new StringBuffer();
@@ -130,69 +151,82 @@
//************************************
//******* Getters and Setters ********
//************************************
+ public String getAuthentication()
+ {
+ if (authentication == null)
+ {
+ return "simple";
+ }
+ return authentication;
+ }
- public String getName()
+ public void setAuthentication(String authentication)
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_NAME);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_NAME);
+ this.authentication = authentication;
}
- /*public void setName(String name)
+
+ public String getJndiName()
{
- this.name = name;
- }*/
+ return jndiName;
+ }
- public String getHost()
+ public void setJndiName(String jndiName)
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_HOST);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_HOST);
+ this.jndiName = jndiName;
}
- /*public void setProviderUrl(String providerUrl)
+ public JNDI.Binding getJndiBinding()
{
- this.providerUrl = providerUrl;
- }*/
+ return jndiBinding;
+ }
- public String getPort()
+ public void setJndiBinding(JNDI.Binding jndiBinding)
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_PORT);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_PORT);
+ this.jndiBinding = jndiBinding;
}
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
public String getContextFactory()
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_CONTEXT_FACTORY);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_CONTEXT_FACTORY);
+ return contextFactory;
}
- /*public void setContextFactory(String contextFactory)
+ public void setContextFactory(String contextFactory)
{
this.contextFactory = contextFactory;
- }*/
+ }
public String getAdminDN()
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_ADMIN_DN);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_ADMIN_DN);
+ return adminDN;
}
- /*public void setAdminDN(String adminDN)
+ public void setAdminDN(String adminDN)
{
this.adminDN = adminDN;
- }*/
+ }
public String getAdminPassword()
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_ADMIN_PASSWORD);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_ADMIN_PASSWORD);
+ return adminPassword;
}
- /*public void setAdminPassword(String adminPassword)
+ public void setAdminPassword(String adminPassword)
{
this.adminPassword = adminPassword;
- }*/
+ }
- /*public String getProtocol()
+ public String getProtocol()
{
return protocol;
}
@@ -200,27 +234,26 @@
public void setProtocol(String protocol)
{
this.protocol = protocol;
- }*/
+ }
- public String getAuthentication()
+ public String getHost()
{
- String auth = getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_AUTHENTICATION);
- //String auth = (String)getInitOptions().get(IdentityConfiguration.CONNECTION_AUTHENTICATION);
- if (auth == null)
- {
- return "simple";
- }
- return auth;
+ return host;
}
- /*public void setAuthentication(String authentication)
+ public void setHost(String host)
{
- this.authentication = authentication;
- }*/
+ this.host = host;
+ }
-
+ public String getPort()
+ {
+ return port;
+ }
-
-
+ public void setPort(String port)
+ {
+ this.port = port;
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -26,6 +26,8 @@
import org.jboss.portal.identity2.service.MembershipModuleService;
import org.jboss.portal.identity.IdentityException;
+import javax.naming.InitialContext;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -40,7 +42,12 @@
private LDAPRoleModule roleModule;
+ protected void startService() throws Exception
+ {
+ connectionContext = (LDAPConnectionContext)new InitialContext().lookup(getConnectionJNDIName());
+ super.startService(); //To change body of overridden methods use File | Settings | File Templates.
+ }
//************************************
//******* Getters and Setters ********
@@ -48,17 +55,10 @@
protected LDAPConnectionContext getConnectionContext() throws IdentityException
{
-
if (connectionContext == null)
{
- try
- {
- this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
- }
- catch (ClassCastException e)
- {
- throw new IdentityException("Not supported object as part of the context", e);
- }
+ //this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
}
return connectionContext;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -31,6 +31,7 @@
import javax.naming.directory.Attribute;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
+import javax.naming.InitialContext;
import java.util.NoSuchElementException;
/**
@@ -43,6 +44,15 @@
private LDAPConnectionContext connectionContext;
+
+ protected void startService() throws Exception
+ {
+ connectionContext = (LDAPConnectionContext)new InitialContext().lookup(getConnectionJNDIName());
+
+ super.startService(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+
protected LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws IdentityException
{
LDAPRoleImpl ldapr = null;
@@ -143,7 +153,8 @@
{
if (connectionContext == null)
{
- this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ //this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
}
return connectionContext;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -33,6 +33,7 @@
import javax.naming.directory.Attribute;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
+import javax.naming.InitialContext;
import java.util.NoSuchElementException;
import java.util.Map;
@@ -48,9 +49,16 @@
private LDAPConnectionContext connectionContext;
- private UserProfileModule userProfileModule;
+ private UserProfileModule userProfileModule;
-
+
+ protected void startService() throws Exception
+ {
+ connectionContext = (LDAPConnectionContext)new InitialContext().lookup(getConnectionJNDIName());
+
+ super.startService(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
//TODO: add enabled
public LDAPUserImpl createUserInstance(Attributes attrs, String dn) throws IdentityException
{
@@ -184,7 +192,8 @@
{
if (connectionContext == null)
{
- this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ //this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
}
return connectionContext;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -23,7 +23,10 @@
package org.jboss.portal.identity2.ldap;
import org.jboss.portal.identity2.service.UserProfileModuleService;
+import org.jboss.portal.identity.IdentityException;
+import javax.naming.InitialContext;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -32,8 +35,20 @@
{
private LDAPConnectionContext connectionContext;
- public LDAPConnectionContext getConnectionContext()
+ protected void startService() throws Exception
{
+ connectionContext = (LDAPConnectionContext)new InitialContext().lookup(getConnectionJNDIName());
+
+ super.startService(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ protected LDAPConnectionContext getConnectionContext() throws IdentityException
+ {
+ if (connectionContext == null)
+ {
+ //this.connectionContext = (LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
+ }
return connectionContext;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -39,6 +39,8 @@
private String jndiName;
+ private String connectionJNDIName;
+
private IdentityContext identityContext;
private IdentityConfiguration identityConfiguration;
@@ -160,4 +162,15 @@
{
return moduleType;
}
+
+
+ public String getConnectionJNDIName()
+ {
+ return connectionJNDIName;
+ }
+
+ public void setConnectionJNDIName(String connectionJNDIName)
+ {
+ this.connectionJNDIName = connectionJNDIName;
+ }
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -45,3 +45,4 @@
}
+
Added: trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -0,0 +1,156 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.test.identity;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.jboss.portal.identity2.IdentityContextImpl;
+import org.jboss.portal.identity2.IdentityServiceControllerImpl;
+import org.jboss.portal.identity2.IdentityContext;
+import org.jboss.portal.identity2.service.IdentityModuleService;
+import org.jboss.portal.identity2.config.SimpleConfigurationImpl;
+import org.jboss.portal.test.framework.TestRuntimeContext;
+
+
+import java.util.Set;
+import java.util.Iterator;
+
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss dot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5247 $
+ */
+public class ConfigurationTestCase extends junit.framework.TestCase
+{
+
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(ConfigurationTestCase.class);
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity2").setLevel(Level.DEBUG);
+ }
+
+ /*public static TestSuite createTestSuite(Class clazz) throws Exception
+ {
+ URL configsURL = Thread.currentThread().getContextClassLoader().getResource("directories.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DirectoryServerConfig", DSConfig.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(clazz);
+ JUnitAdapter adapter = new JUnitAdapter(abc);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }*/
+
+ public ConfigurationTestCase()
+ {
+
+ }
+
+ /*public ConfigurationTestCase(DSConfig dsConfig)
+ {
+ this.directoryServerConfigParameter = dsConfig;
+ }
+
+ private DSConfig directoryServerConfigParameter;
+
+ public String getName()
+ {
+ return super.getName();// + "," + directoryServerConfigParameter.getName() + "," + directoryServerConfigParameter.getDescription();
+ }
+
+ public DSConfig getDirectoryServerConfigParameter()
+ {
+ return directoryServerConfigParameter;
+ }
+
+ public void setDirectoryServerConfigParameter(DSConfig directoryServerConfigParameter)
+ {
+ this.directoryServerConfigParameter = directoryServerConfigParameter;
+ }*/
+
+ IdentityContextImpl context;
+
+
+ public void setUp() throws Exception
+ {
+ TestRuntimeContext runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/ldap-beans.xml");
+ runtimeContext.addBean("LDAPTestBean", this);
+ runtimeContext.start();
+ this.context = new IdentityContextImpl();
+ context.start();
+
+
+ }
+
+ /*public void testSimpleConfigurationFactory() throws Exception
+ {
+ SimpleConfigurationImpl configuration = new SimpleConfigurationImpl();
+ configuration.setIdentityContext(context);
+ configuration.setConfigFile("identityconfig/test-config.xml");
+ configuration.start();
+ Set keys = configuration.getOptionGroups().keySet();
+ log.info("Option Groups:");
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();)
+ {
+ String group = (String)iterator.next();
+ log.info("option-group: " + group);
+
+ log.info("Options:");
+ Set names = configuration.getOptions(group).keySet();
+ for (Iterator iterator1 = names.iterator(); iterator1.hasNext();)
+ {
+ String optionName = (String)iterator1.next();
+ log.info("Name: " + optionName);
+
+ }
+
+ }
+
+
+ assertEquals("uid",configuration.getValue("user.uidAttributeId"));
+ }*/
+
+
+ public void testIdentityServiceController() throws Exception
+ {
+ IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+ controller.setRegisterMBeans(false);
+ controller.setConfigFile("config/minimal-ldap-identity-config.xml");
+ controller.setDefaultConfigFile("config/standardidentity-config.xml");
+ controller.start();
+
+ IdentityModuleService service = (IdentityModuleService)controller.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ assertEquals("java:/portal/UserModule", service.getJndiName());
+ }
+
+
+
+
+}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2006-11-29 13:29:37 UTC (rev 5743)
@@ -86,6 +86,7 @@
((MembershipModuleService)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE)).stop();
MembershipModuleService membership = new LDAPStaticRoleMembershipModuleImpl();
membership.setIdentityContext(identityContext);
+ membership.setConnectionJNDIName("java:/portal/LDAPConnectionContext");
membership.start();
userModule = (UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
Modified: trunk/identity/src/resources/draft/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/draft/standardidentity-config.xml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/resources/draft/standardidentity-config.xml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -22,6 +22,68 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasouce>
+ <!--schema that maps hibernate objects-->
+ <name>Identity</name>
+
+ <class>blah.IdentitySessionFactoryBinder</class>
+ <service-name>portal:service=Hibernate,type=Identity</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/UserSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ <datasouce>
+ <!--schema that provides dynamic database property store for ldap impl-->
+ <name>Dynamic</name>
+
+ <class>org.jboss.portal.jems.hibernate.SessionFactoryBinder</class>
+ <service-name>portal:service=Hibernate,type=UserDynProfile</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/DynamicProfileSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
Modified: trunk/identity/src/resources/test/config/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -22,6 +22,68 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasouce>
+ <!--schema that maps hibernate objects-->
+ <name>Identity</name>
+
+ <class>blah.IdentitySessionFactoryBinder</class>
+ <service-name>portal:service=Hibernate,type=Identity</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/UserSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ <datasouce>
+ <!--schema that provides dynamic database property store for ldap impl-->
+ <name>Dynamic</name>
+
+ <class>org.jboss.portal.jems.hibernate.SessionFactoryBinder</class>
+ <service-name>portal:service=Hibernate,type=UserDynProfile</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/DynamicProfileSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
Modified: trunk/test/src/etc/identityconfig/opends-config.xml
===================================================================
--- trunk/test/src/etc/identityconfig/opends-config.xml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/test/src/etc/identityconfig/opends-config.xml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -22,53 +22,55 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
-
- <!--For ldap configuration this is needed additionally to use ldap connection...-->
- <module>
- <type>ConnectionContext</type>
- <implementation>LDAP</implementation>
- </module>
</modules>
<options>
<option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>localhost</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- </option-group>
- <option-group>
<group-name>common</group-name>
<option>
<name>userContainerDN</name>
Modified: trunk/test/src/etc/identityconfig/rhds-config.xml
===================================================================
--- trunk/test/src/etc/identityconfig/rhds-config.xml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/test/src/etc/identityconfig/rhds-config.xml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -22,23 +22,50 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev39.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<!--For ldap configuration this is needed additionally to use ldap connection...-->
@@ -47,28 +74,8 @@
<implementation>LDAP</implementation>
</module>
</modules>
-
<options>
<option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>dev39.qa.atl.jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>qpq123qpq</value>
- </option>
- </option-group>
- <option-group>
<group-name>common</group-name>
<option>
<name>userContainerDN</name>
Modified: trunk/test/src/etc/identityconfig/standardidentity-config.xml
===================================================================
--- trunk/test/src/etc/identityconfig/standardidentity-config.xml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/test/src/etc/identityconfig/standardidentity-config.xml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -22,10 +22,44 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <!--name of service and class for creating mbean-->
+ <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
+ <class>org.jboss.portal.identity2.ldap.LDAPConnectionContext</class>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>389</value>
+ </option>
+ <option>
+ <name>contextFactory</name>
+ <value>com.sun.jndi.ldap.LdapCtxFactory</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -39,12 +73,16 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
</config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -58,12 +96,16 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
</config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -77,12 +119,16 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
</config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -96,13 +142,17 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserProfileModule</value>
+ </option>
</config>
</module>
<!--for ldap modules...-->
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -111,12 +161,21 @@
<jndi-name>java:/portal/UserModule</jndi-name>
<!--set of options that are passed to a class constructor-->
- <config/>
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -125,12 +184,21 @@
<jndi-name>java:/portal/RoleModule</jndi-name>
<!--set of options that are passed to a class constructor-->
- <config/>
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -139,12 +207,21 @@
<jndi-name>java:/portal/MembershipModule</jndi-name>
<!--set of options that are passed to a class constructor-->
- <config/>
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -159,58 +236,28 @@
<value>java:/portal/UserSessionFactory</value>
</option>-->
<!--Hibernate mappings for db level store (dynamic properties not mapped as ldap attributes)-->
- <option>
+ <!--<option>
<name>SessionFactoryJNDIName</name>
<value>java:/portal/PropertyStoreSessionFactory</value>
</option>
<option>
<name>profileMappings</name>
<value>ldap-profile.xml</value>
+ </option>-->
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserProfileModule</value>
</option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
</config>
</module>
- <!--For ldap configuration this is needed additionally to use ldap connection...-->
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>ConnectionContext</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
- <service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
- <class>org.jboss.portal.identity2.ldap.LDAPConnectionContext</class>
- <jndi-name>java:/portal/LDAPConnectionContext</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config/>
- </module>
</modules>
<options>
- <option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>389</value>
- </option>
- <option>
- <name>context-factory</name>
- <value>com.sun.jndi.ldap.LdapCtxFactory</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- </option-group>
-
<!--Common options section-->
<option-group>
<group-name>common</group-name>
@@ -293,5 +340,101 @@
<value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
</option>
</option-group>
+ <option-group>
+ <group-name>userProfileMappings</group-name>
+ <option>
+ <name>portal.user.name.given</name>
+ <!--inetOrgPerson-->
+ <value>givenName</value>
+ </option>
+ <!--<option>
+ <name>portal.user.name.family</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.location</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.occupation</name>
+ <!--inetOrgPerson-->
+ <value>title</value>
+ </option>
+ <!--<option>
+ <name>portal.user.extra</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.signature</name>
+ <!--newPilotPerson-->
+ <value>personalSignature</value>
+ </option>
+ <!--<option>
+ <name>portal.user.interests</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.locale</name>
+ <!--inetOrgPerson-->
+ <value>localityName</value><!--or prefferedLanguage-->
+ </option>
+ <!--<option>
+ <name>portal.user.im.icq</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.aim</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.msnm</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.yim</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.skype</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.homepage</name>
+ <!--inetOrgPerson-->
+ <value>seeAlso</value>
+ </option>
+ <!--<option>
+ <name>portal.user.time-zone-offset</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.theme</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.security.question</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.security.answer</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.email.fake</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.email.view-real</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.last-login-date</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.registration-date</name>
+ <value></value>
+ </option>-->
+ </option-group>
</options>
</identity-configuration>
\ No newline at end of file
17 years, 5 months
JBoss Portal SVN: r5742 - branches/JBoss_Portal_Branch_2_4/portlet
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-28 19:55:35 -0500 (Tue, 28 Nov 2006)
New Revision: 5742
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/build.xml
Log:
add an ant target to execute ha tests (test-ha)
Modified: branches/JBoss_Portal_Branch_2_4/portlet/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-29 00:44:02 UTC (rev 5741)
+++ branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-29 00:55:35 UTC (rev 5742)
@@ -582,6 +582,37 @@
</execute-tests>
</target>
+ <target name="test-ha" depends="init">
+ <execute-tests>
+ <x-sysproperty>
+<!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+-->
+ <sysproperty key="test.root" value="${build.lib}"/>
+ <sysproperty key="test.uri" value="/test/redirect/"/>
+ </x-sysproperty>
+ <x-test>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.ReplicateMutableValueTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.ReplicateMutableValueTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase"/>
+ </x-test>
+ <x-classpath>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="jboss.remoting.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="apache.xerces.classpath"/>
+ <path refid="jbossas/core.libs.classpath"/>
+ <pathelement location="${source.java}"/>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${build.resources}"/>
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ </x-classpath>
+ </execute-tests>
+ </target>
+
<target name="test2" depends="init">
<execute-tests>
<x-sysproperty>
17 years, 5 months
JBoss Portal SVN: r5741 - in branches/JBoss_Portal_Branch_2_4: portlet portlet/src/main/org/jboss/portal/test/framework/portlet/components portlet/src/main/org/jboss/portal/test/portlet/ha/session test/src/main/org/jboss/portal/test/framework/container/client
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-28 19:44:02 -0500 (Tue, 28 Nov 2006)
New Revision: 5741
Added:
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java
Modified:
branches/JBoss_Portal_Branch_2_4/portlet/build.xml
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java
branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java
branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java
Log:
- separate the session clustering tests as they conflict when they are executed in the same test case (xfiles, needs to be figured out)
Modified: branches/JBoss_Portal_Branch_2_4/portlet/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/build.xml 2006-11-29 00:44:02 UTC (rev 5741)
@@ -593,7 +593,9 @@
<sysproperty key="test.uri" value="/test/redirect/"/>
</x-sysproperty>
<x-test>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.SessionTestSuite"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.ReplicateMutableValueTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.ReplicateMutableValueTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.portlet.ha.session.ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase"/>
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.info.InfoTestSuite"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.session.SessionSynchronizationTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
@@ -606,10 +608,13 @@
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.deployment.UnmarshallerTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.PortletRequestDecoderTestCase"/>-->
<!--<test todir="${test.reports}" name="org.jboss.portal.test.portlet.state.StatefulPortletInvokerTestCase"/>-->
+
+<!--
<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.ext.nocache.NoCacheTestSuite"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.portlet.jsr168.ext.expiringcache.ExpiringCacheTestSuite"/>
+-->
</x-test>
<x-classpath>
<path refid="oswego.concurrent.classpath"/>
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/framework/portlet/components/AbstractUniversalTestPortlet.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -162,7 +162,7 @@
}
else
{
- log.debug("Found action for jointpoint " + actionJoinpoint + " : " + action);
+ log.info("Found action for jointpoint " + actionJoinpoint + " : " + action);
//
Result result = ((PortletActionTestAction)action).execute(this, req, resp);
@@ -209,7 +209,7 @@
//
if (action != null && action instanceof PortletRenderTestAction)
{
- log.debug("Found action for jointpoint " + renderJoinpoint + " : " + action);
+ log.info("Found action for jointpoint " + renderJoinpoint + " : " + action);
// Get the result
Result sr = ((PortletRenderTestAction)action).execute(this, req, resp);
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.ha.session;
+
+import junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+import org.jboss.portal.test.framework.server.NodeId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTestCase
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-ha-session.war", new NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
+ suite.addTest(new TestCase(NodeId.PORTS_01, "TestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate"));
+ return suite;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/MutableValue.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.portlet.ha.session;
import java.io.Serializable;
+import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -61,4 +62,16 @@
}
return false;
}
+
+ private void writeObject(java.io.ObjectOutputStream out) throws IOException
+ {
+ out.writeUTF(string);
+ System.out.print("Serializing " + string);
+ }
+
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ string = in.readUTF();
+ System.out.print("Unserializing " + string);
+ }
}
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateImmutableValueTestCase.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.ha.session;
+
+import junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+import org.jboss.portal.test.framework.server.NodeId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ReplicateImmutableValueTestCase
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-ha-session.war", new NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
+ suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateImmutableValue"));
+ return suite;
+ }
+}
Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/ReplicateMutableValueTestCase.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.portlet.ha.session;
+
+import junit.framework.Test;
+import org.jboss.portal.test.framework.container.client.TestSuite;
+import org.jboss.portal.test.framework.container.client.TestCase;
+import org.jboss.portal.test.framework.server.NodeId;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ReplicateMutableValueTestCase
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("test-ha-session.war", new NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
+ suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateMutableValue"));
+ return suite;
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionSequenceBuilder.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -32,6 +32,7 @@
import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAction;
import org.jboss.portal.test.framework.portlet.universal.UTP1;
import org.jboss.portal.test.framework.server.NodeId;
+import org.jboss.portal.common.util.Tools;
import javax.portlet.Portlet;
import javax.portlet.PortletException;
@@ -41,6 +42,7 @@
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import java.io.IOException;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -51,7 +53,7 @@
public void createTestReplicateImmutableValue(SequenceRegistry registry)
{
Sequence seq = new Sequence();
- registry.addSequence("ABC", seq);
+ registry.addSequence("TestReplicateImmutableValue", seq);
seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
@@ -80,7 +82,7 @@
public void createTestReplicateMutableValue(SequenceRegistry registry)
{
Sequence seq = new Sequence();
- registry.addSequence("ABC", seq);
+ registry.addSequence("TestReplicateMutableValue", seq);
seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException
@@ -111,7 +113,7 @@
public void createTestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate(SequenceRegistry registry)
{
Sequence seq = new Sequence();
- registry.addSequence("ABC", seq);
+ registry.addSequence("TestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate", seq);
seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new PortletRenderTestAction()
{
protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException
@@ -119,6 +121,7 @@
assertNull(request.getPortletSession(false));
PortletSession session = request.getPortletSession();
assertNotNull(session);
+ assertEquals(Collections.EMPTY_LIST, Tools.toList(session.getAttributeNames()));
MutableValue value = new MutableValue("abcdef");
session.setAttribute("mutable", value);
PortletURL portletURL = response.createRenderURL();
@@ -131,6 +134,7 @@
protected Result run(Portlet portlet, RenderRequest request, RenderResponse response) throws IOException
{
PortletSession session = request.getPortletSession();
+ assertEquals(Collections.singletonList("mutable"), Tools.toList(session.getAttributeNames()));
Object o = session.getAttribute("mutable");
assertNotNull(o);
assertEquals(MutableValue.class, o.getClass());
@@ -147,6 +151,7 @@
{
PortletSession session = request.getPortletSession();
assertNotNull(session);
+ assertEquals(Collections.singletonList("mutable"), Tools.toList(session.getAttributeNames()));
assertEquals(new MutableValue("abcdef"), session.getAttribute("mutable"));
return new EndTestResult();
}
Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestSuite.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -36,7 +36,9 @@
public static Test suite()
{
TestSuite suite = new TestSuite("test-ha-session.war", new NodeId[]{NodeId.PORTS_01, NodeId.PORTS_02});
- suite.addTest(new TestCase(NodeId.PORTS_01, "ABC"));
+ suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateMutableValue"));
+ suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateImmutableValue"));
+ suite.addTest(new TestCase(NodeId.PORTS_01, "TestModifyExistingAttributeWithoutExplicitSetDoesNotReplicate"));
return suite;
}
}
Added: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/ExtendedSimpleHttpConnectionManager.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.framework.container.client;
+
+import org.apache.commons.httpclient.SimpleHttpConnectionManager;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ExtendedSimpleHttpConnectionManager extends SimpleHttpConnectionManager
+{
+ public void closeConnection()
+ {
+ httpConnection.close();
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java 2006-11-28 23:04:49 UTC (rev 5740)
+++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/framework/container/client/TestCase.java 2006-11-29 00:44:02 UTC (rev 5741)
@@ -29,7 +29,6 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
@@ -89,6 +88,9 @@
/** . */
private Node currentNode;
+ /** . */
+ private ExtendedSimpleHttpConnectionManager connManager;
+
public TestCase(String testCaseId)
{
this(testCaseId, "/test/");
@@ -124,7 +126,8 @@
this.uri = uri;
this.testCaseId = testCaseId;
this.requestCount = 0;
- this.client = new HttpClient(new SimpleHttpConnectionManager());
+ this.connManager = new ExtendedSimpleHttpConnectionManager();
+ this.client = new HttpClient(connManager);
// Configure client
client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, null);
@@ -216,6 +219,9 @@
if (post != null)
{
post.releaseConnection();
+
+ //
+ connManager.closeConnection();
}
}
}
@@ -243,6 +249,9 @@
if (get != null)
{
get.releaseConnection();
+
+ //
+ connManager.closeConnection();
}
}
}
@@ -334,6 +343,7 @@
//
log.info("# Invoking test case over http " + cfg + " " + method.getURI());
+ //
return client.executeMethod(cfg, method);
}
17 years, 5 months
JBoss Portal SVN: r5740 - docs/tags
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-11-28 18:04:49 -0500 (Tue, 28 Nov 2006)
New Revision: 5740
Added:
docs/tags/JBoss_Portal_2_4_1_CR2/
Log:
tagging CR2 docs
Copied: docs/tags/JBoss_Portal_2_4_1_CR2 (from rev 5739, docs/branches/JBoss_Portal_Branch_2_4)
17 years, 5 months
JBoss Portal SVN: r5739 - docs/branches/JBoss_Portal_Branch_2_4/referenceGuide/en
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-28 17:03:46 -0500 (Tue, 28 Nov 2006)
New Revision: 5739
Modified:
docs/branches/JBoss_Portal_Branch_2_4/referenceGuide/en/master.xml
Log:
bad markup was causing pdf gen to fail
Modified: docs/branches/JBoss_Portal_Branch_2_4/referenceGuide/en/master.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_4/referenceGuide/en/master.xml 2006-11-28 18:48:42 UTC (rev 5738)
+++ docs/branches/JBoss_Portal_Branch_2_4/referenceGuide/en/master.xml 2006-11-28 22:03:46 UTC (rev 5739)
@@ -42,8 +42,6 @@
<email>boleslaw.dawidowicz(a)jboss.com</email>
</author>
</bookinfo>
- <para>Release 2.4 "Devil"</para>
- <para>July 2006</para>
<toc/>
<!-- portal overview - marketing stuff --> &overview;
<!-- comprehensive list of included features --> &featurelist;
17 years, 5 months
JBoss Portal SVN: r5738 - docs/trunk/referenceGuide/en
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-28 13:48:42 -0500 (Tue, 28 Nov 2006)
New Revision: 5738
Modified:
docs/trunk/referenceGuide/en/master.xml
Log:
bad markup was causing pdf gen to fail
Modified: docs/trunk/referenceGuide/en/master.xml
===================================================================
--- docs/trunk/referenceGuide/en/master.xml 2006-11-28 18:18:11 UTC (rev 5737)
+++ docs/trunk/referenceGuide/en/master.xml 2006-11-28 18:48:42 UTC (rev 5738)
@@ -43,8 +43,6 @@
<email>boleslaw.dawidowicz(a)jboss.com</email>
</author>
</bookinfo>
- <para>Release 2.6DR "Ninja"</para>
- <para>October 2006</para>
<toc/>
<!-- portal overview - marketing stuff --> &overview;
<!-- comprehensive list of included features --> &featurelist;
17 years, 5 months
JBoss Portal SVN: r5737 - trunk/core/src/main/org/jboss/portal/core/portlet/dashboard
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-11-28 13:18:11 -0500 (Tue, 28 Nov 2006)
New Revision: 5737
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
Log:
JBPORTAL-1139 - fixed window ordering
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-28 17:21:10 UTC (rev 5736)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java 2006-11-28 18:18:11 UTC (rev 5737)
@@ -242,24 +242,29 @@
moveWindows = actionRequest.getParameterValues(region + "_instances");
}
}
+
+ SortedSet windows = (SortedSet)windowMap.get(sortRegion);
+
+ for (int i = 0; i < moveWindows.length; i++)
+ {
+ Window window = page.getWindow(moveWindows[i]);
+ if ("up".equals(op))
+ {
+ int order = getMoveUpOrder(window, windows);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(order));
+ }
+ else if ("down".equals(op))
+ {
+ int order = getMoveDownOrder(window, windows);
+ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(order));
+ }
+ }
}
catch (Exception e)
{
// todo
}
- for (int i = 0; i < moveWindows.length; i++)
- {
- Window window = page.getWindow(moveWindows[i]);
- if ("up".equals(op))
- {
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(getOrder(window) - 1));
- }
- else if ("down".equals(op))
- {
- window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, Integer.toString(getOrder(window) + 1));
- }
- }
actionResponse.setRenderParameter("editPageSelect", editPage);
}
else if ("newpage".equals(op))
@@ -352,4 +357,50 @@
return Integer.MAX_VALUE;
}
}
+
+ private static int getMoveUpOrder(Window window, SortedSet set)
+ {
+ Window previous = null;
+ for (Iterator i = set.iterator(); i.hasNext();)
+ {
+ Window current = (Window)i.next();
+
+ if (current.getName().equalsIgnoreCase(window.getName()))
+ {
+ if (previous == null)
+ {
+ return getOrder(current);
+ }
+ else
+ {
+ return (getOrder(previous) - 1);
+ }
+ }
+ previous = current;
+ }
+ return 0;
+ }
+
+ private int getMoveDownOrder(Window window, SortedSet set)
+ {
+ for (Iterator i = set.iterator(); i.hasNext();)
+ {
+ Window current = (Window)i.next();
+
+ if (current.getName().equalsIgnoreCase(window.getName()))
+ {
+ Window next = (Window)i.next();
+
+ if (next == null)
+ {
+ return getOrder(current);
+ }
+ else
+ {
+ return (getOrder(next) + 1);
+ }
+ }
+ }
+ return 0;
+ }
}
17 years, 5 months