From portal-commits at lists.jboss.org Tue Nov 21 12:38:32 2006 Content-Type: multipart/mixed; boundary="===============9026765209866035276==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5703 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard Date: Tue, 21 Nov 2006 12:38:32 -0500 Message-ID: --===============9026765209866035276== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: roy.russo(a)jboss.com Date: 2006-11-21 12:38:29 -0500 (Tue, 21 Nov 2006) New Revision: 5703 Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator= .java trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.= jsp Log: added param modifier for page edits Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-21 10:47:24 UTC (rev 5702) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-21 17:38:29 UTC (rev 5703) @@ -21,6 +21,7 @@ */ package org.jboss.portal.core.portlet.dashboard; = +import org.jboss.portlet.JBossActionRequest; import org.jboss.portlet.JBossPortlet; import org.jboss.portlet.JBossRenderRequest; import org.jboss.portlet.JBossRenderResponse; @@ -31,7 +32,7 @@ import java.io.IOException; = /** - * @author Roy Russo + * @author Roy Russo * @version $Revision: 0 $ */ public class Configurator extends JBossPortlet @@ -43,4 +44,9 @@ PortletRequestDispatcher rd =3D getPortletContext().getRequestDispat= cher("/WEB-INF/jsp/dashboard/editpage.jsp"); rd.include(req, resp); } + + protected void processAction(JBossActionRequest actionRequest, JBossRen= derRequest renderRequest) + { + System.out.println("blah"); + } } Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/ed= itpage.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-21 10:47:24 UTC (rev 5702) +++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-21 17:38:29 UTC (rev 5703) @@ -4,39 +4,68 @@ <%@ page isELIgnored=3D"false" %> = + - - - - - - - - - + + + + + + + + - - - - - - + + + + + +
Edi= t Page
- Use this to manage the content on your page. You can control the = page title, select number of columns, and add, - order, or remove portlets. -
-
-
Select a page t= o edit:
+
Edit P= age
+ Use this to manage the content on your page. You can control the pag= e title, select number of columns, and add, + order, or remove portlets. +
+
+
Select a page to e= dit:
= -
- - -
-
-
-
+
+ + +
+
+
+
+
+ " name=3D"instancesForm" method=3D"POST" onsubmit= =3D"debug();"> + + + + +
@@ -48,65 +77,90 @@ Availa= ble Content
- - - - - - - - - - - - - - - - -
>
<
- Left Column
- -
up
dwn
>
<
= Middle Column
-
up
dwn
>
<
= Right Column
-
up
dwn
-
+ + + + + + + + + + + + + +
+ =
+
+ Left Column
+ +
+
+
+ =
= Middle Column
+
+
+
+
= Right Column
+
+
- - - - - - - - + + + + + + + + + --===============9026765209866035276==-- From portal-commits at lists.jboss.org Tue Nov 21 13:05:08 2006 Content-Type: multipart/mixed; boundary="===============2692725544216475555==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5704 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/registration wsrp/producer/registration/api wsrp/producer/registration/impl Date: Tue, 21 Nov 2006 13:05:08 -0500 Message-ID: --===============2692725544216475555== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2006-11-21 13:05:04 -0500 (Tue, 21 Nov 2006) New Revision: 5704 Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGrou= pTestCase.java Removed: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Per= sistentRegistrationObject.java Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTest= Case.java trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registration= PersistenceManagerTestCase.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Regi= strationManager.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Con= sumerGroupImpl.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Con= sumerImpl.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Reg= istrationPersistenceManagerImpl.java Log: - Removed unused PersistentRegistrationObject. - Added ConsumerGroupTestCase. - Cleaned up code. Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Consumer= GroupTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGro= upTestCase.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerGro= upTestCase.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -0,0 +1,116 @@ +/*************************************************************************= ***** + * 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.wsrp.registration; + +import junit.framework.TestCase; +import org.jboss.portal.wsrp.producer.registration.api.Consumer; +import org.jboss.portal.wsrp.producer.registration.api.ConsumerGroup; +import org.jboss.portal.wsrp.producer.registration.api.RegistrationExcepti= on; +import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager; +import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus; +import org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersis= tenceManagerImpl; +import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistr= ationPolicy; + +/** + * @author Chris Laprun + * @version $Revision$ + * @since 2.6 + */ +public class ConsumerGroupTestCase extends TestCase +{ + private RegistrationManager manager; + private ConsumerGroup group; + private static final String NAME =3D "name"; + + + protected void setUp() throws Exception + { + manager =3D new RegistrationManager(); + manager.setPolicy(new DefaultRegistrationPolicy()); + manager.setPersistenceManager(new RegistrationPersistenceManagerImpl= ()); + group =3D manager.createConsumerGroup(NAME); + } + + public void testGetName() + { + assertEquals(NAME, group.getName()); + } + + public void testConsumersManagement() throws RegistrationException + { + assertTrue(group.isEmpty()); + assertEquals(0, group.getConsumers().size()); + + Consumer c1 =3D manager.createConsumer("c1"); + group.addConsumer(c1); + assertTrue(!group.isEmpty()); + assertEquals(1, group.getConsumers().size()); + assertTrue(group.contains(c1)); + assertEquals(group, c1.getGroup()); + assertEquals(c1, group.getConsumer(c1.getIdentity())); + + Consumer c2 =3D manager.createConsumer("c2"); + group.addConsumer(c2); + assertEquals(2, group.getConsumers().size()); + assertTrue(group.contains(c2)); + assertEquals(group, c2.getGroup()); + + group.removeConsumer(c1); + assertEquals(1, group.getConsumers().size()); + assertTrue(!group.contains(c1)); + assertTrue(group.contains(c2)); + assertEquals(null, c1.getGroup()); + } + + public void testAddNullConsumer() throws RegistrationException + { + try + { + group.addConsumer(null); + fail("Shouldn't be possible to add null consumer"); + } + catch (IllegalArgumentException expected) + { + } + } + + public void testStatus() + { + assertEquals(RegistrationStatus.PENDING, group.getStatus()); + group.setStatus(RegistrationStatus.VALID); + assertEquals(RegistrationStatus.VALID, group.getStatus()); + } + + public void testIllegalStatus() + { + try + { + group.setStatus(null); + fail("Shouldn't be possible to set the status to null"); + } + catch (IllegalArgumentException expected) + { + } + } +} Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Consu= merTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTes= tCase.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/ConsumerTes= tCase.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -31,10 +31,6 @@ import org.jboss.portal.wsrp.producer.registration.impl.RegistrationPersis= tenceManagerImpl; import org.jboss.portal.wsrp.producer.registration.policies.DefaultRegistr= ationPolicy; = -import javax.xml.namespace.QName; -import java.util.HashMap; -import java.util.Map; - /** * @author Chris Laprun * @version $Revision$ @@ -44,7 +40,6 @@ { private Consumer consumer; private RegistrationManager manager; - private Map registrationProperties; = protected void setUp() throws Exception { @@ -52,9 +47,6 @@ manager.setPolicy(new DefaultRegistrationPolicy()); manager.setPersistenceManager(new RegistrationPersistenceManagerImpl= ()); consumer =3D manager.createConsumer("name"); - registrationProperties =3D new HashMap(); - registrationProperties.put(new QName("prop1"), "value1"); - registrationProperties.put(new QName("prop2"), "value2"); } = public void testGetName() Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Regis= trationPersistenceManagerTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registratio= nPersistenceManagerTestCase.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registratio= nPersistenceManagerTestCase.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -318,7 +318,9 @@ String regId =3D reg.getId(); manager.removeRegistration(regId); = - // + // remove registration is the only method on RegistrationPersistence= Manager that needs to "cascade" + // this is needed because there is no remove method on Consumer, hen= ce the manager needs to remove the + // registration from its consumer since it's the only class that has= access to the specific consumer impl Collection registrations =3D consumer.getRegistrations(); assertNotNull(registrations); assertEquals(0, registrations.size()); Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/a= pi/RegistrationManager.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Reg= istrationManager.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Reg= istrationManager.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -25,7 +25,6 @@ = import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap; import org.jboss.portal.common.util.ParameterValidation; -import org.jboss.portal.wsrp.producer.registration.impl.ConsumerImpl; = import java.util.ArrayList; import java.util.Collection; @@ -226,7 +225,7 @@ { ParameterValidation.throwIllegalArgExceptionIfNull(registration, "Re= gistration"); String handle =3D registration.getRegistrationHandle(); - ConsumerImpl consumer =3D (ConsumerImpl)getConsumerFor(handle); + Consumer consumer =3D getConsumerFor(handle); = if (consumer =3D=3D null) { Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/ConsumerGroupImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Co= nsumerGroupImpl.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Co= nsumerGroupImpl.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -39,7 +39,7 @@ * @author Julien Viet * @version $Revision:5672 $ */ -public class ConsumerGroupImpl extends PersistentRegistrationObject implem= ents ConsumerGroup +public class ConsumerGroupImpl implements ConsumerGroup { = private String name; @@ -47,16 +47,21 @@ private RegistrationStatus status; = = - public ConsumerGroupImpl() + private ConsumerGroupImpl() { - this.consumers =3D new HashMap(); + init(); } = - public ConsumerGroupImpl(String name, RegistrationPersistenceManagerImp= l manager) + ConsumerGroupImpl(String name) { - super(manager); this.name =3D name; + init(); + } + + private void init() + { this.consumers =3D new HashMap(); + status =3D RegistrationStatus.PENDING; } = public String getName() @@ -93,6 +98,7 @@ = public void setStatus(RegistrationStatus status) { + ParameterValidation.throwIllegalArgExceptionIfNull(status, "Registra= tionStatus"); this.status =3D status; } = @@ -101,10 +107,10 @@ return Collections.unmodifiableCollection(consumers.values()); } = - public Consumer getConsumer(String consumerName) throws IllegalArgument= Exception, RegistrationException + public Consumer getConsumer(String consumerIdentity) throws IllegalArgu= mentException, RegistrationException { - ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerNa= me, "Consumer name", null); - return (Consumer)consumers.get(consumerName); + ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId= entity, "Consumer name", null); + return (Consumer)consumers.get(consumerIdentity); } = public boolean isEmpty() Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/ConsumerImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Co= nsumerImpl.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Co= nsumerImpl.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -41,7 +41,7 @@ * @version $Revision$ * @since 2.6 */ -public class ConsumerImpl extends PersistentRegistrationObject implements = Consumer +public class ConsumerImpl implements Consumer { = private String name; @@ -54,21 +54,47 @@ = private ConsumerImpl() { - super(); + init(); } = - ConsumerImpl(String identity, String name, RegistrationPersistenceManag= erImpl manager) + ConsumerImpl(String identity, String name) { - super(manager); - ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "nam= e", "Consumer"); ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "ide= ntity", "Consumer"); = this.name =3D name; this.identity =3D identity; + init(); + } + + private void init() + { registrations =3D new HashSet(7); + status =3D RegistrationStatus.PENDING; } = + + public boolean equals(Object o) + { + if (this =3D=3D o) + { + return true; + } + if (o =3D=3D null || getClass() !=3D o.getClass()) + { + return false; + } + + ConsumerImpl consumer =3D (ConsumerImpl)o; + + return identity.equals(consumer.identity); + } + + public int hashCode() + { + return identity.hashCode(); + } + public String getName() { return name; Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/im= pl/PersistentRegistrationObject.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Pe= rsistentRegistrationObject.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Pe= rsistentRegistrationObject.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -1,55 +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.wsrp.producer.registration.impl; - -/** - * @author Chris Laprun - * @version $Revision$ - * @since 2.6 - */ -public class PersistentRegistrationObject -{ - protected RegistrationPersistenceManagerImpl manager; - - - public PersistentRegistrationObject() - { - } - - protected PersistentRegistrationObject(RegistrationPersistenceManagerIm= pl manager) - { - this.manager =3D manager; - } - - - public RegistrationPersistenceManagerImpl getManager() - { - return manager; - } - - public void setManager(RegistrationPersistenceManagerImpl manager) - { - this.manager =3D manager; - } -} Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/RegistrationPersistenceManagerImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationPersistenceManagerImpl.java 2006-11-21 17:38:29 UTC (rev 5703) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationPersistenceManagerImpl.java 2006-11-21 18:05:04 UTC (rev 5704) @@ -55,7 +55,7 @@ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(identity, = "Consumer identity", null); ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Con= sumer name", null); = - ConsumerImpl consumer =3D new ConsumerImpl(identity, name, this); + ConsumerImpl consumer =3D new ConsumerImpl(identity, name); consumer.setStatus(RegistrationStatus.PENDING); consumers.put(identity, consumer); = @@ -78,7 +78,7 @@ } else { - group =3D new ConsumerGroupImpl(name, this); + group =3D new ConsumerGroupImpl(name); groups.put(name, group); return group; } --===============2692725544216475555==-- From portal-commits at lists.jboss.org Tue Nov 21 16:30:37 2006 Content-Type: multipart/mixed; boundary="===============2817061293879682337==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5705 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF resources/portal-core-war/WEB-INF/jsp/dashboard Date: Tue, 21 Nov 2006 16:30:37 -0500 Message-ID: --===============2817061293879682337== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: roy.russo(a)jboss.com Date: 2006-11-21 16:30:34 -0500 (Tue, 21 Nov 2006) New Revision: 5705 Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator= .java trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.= jsp Log: JBPORTAL-993 - added instance listing Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-21 18:05:04 UTC (rev 5704) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-21 21:30:34 UTC (rev 5705) @@ -21,6 +21,11 @@ */ package org.jboss.portal.core.portlet.dashboard; = +import org.jboss.logging.Logger; +import org.jboss.portal.core.model.instance.Instance; +import org.jboss.portal.core.model.instance.InstanceContainer; +import org.jboss.portal.portlet.Portlet; +import org.jboss.portal.portlet.PortletInvokerException; import org.jboss.portlet.JBossActionRequest; import org.jboss.portlet.JBossPortlet; import org.jboss.portlet.JBossRenderRequest; @@ -30,6 +35,10 @@ import javax.portlet.PortletRequestDispatcher; import javax.portlet.PortletSecurityException; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; = /** * @author Roy Russo @@ -37,10 +46,30 @@ */ public class Configurator extends JBossPortlet { + private Logger log =3D Logger.getLogger(Configurator.class); + + private InstanceContainer instanceContainer; + + public void init() + throws PortletException + { + super.init(); + + instanceContainer =3D (InstanceContainer)getPortletContext().getAttr= ibute("InstanceContainer"); + + if (instanceContainer =3D=3D null) + { + throw new PortletException("No InstanceContainer found"); + } + } + protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws PortletException, PortletSecurityException, IOException { + List instances =3D (List)instanceContainer.getInstances(); + resp.setContentType("text/html"); + req.setAttribute("instances", instances); PortletRequestDispatcher rd =3D getPortletContext().getRequestDispat= cher("/WEB-INF/jsp/dashboard/editpage.jsp"); rd.include(req, resp); } Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2006= -11-21 18:05:04 UTC (rev 5704) +++ trunk/core/src/resources/portal-core-war/WEB-INF/jboss-portlet.xml 2006= -11-21 21:30:34 UTC (rev 5705) @@ -92,6 +92,12 @@ Required + + ConfiguratorPortlet + + Required + + PortalObjectContainer Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/ed= itpage.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-21 18:05:04 UTC (rev 5704) +++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-21 21:30:34 UTC (rev 5705) @@ -1,3 +1,6 @@ +<%@ page import=3D"org.jboss.portal.core.model.instance.Instance" %> +<%@ page import=3D"java.util.List" %> +<%@ page import=3D"org.jboss.portal.portlet.Portlet" %> <%@ page language=3D"java" extends=3D"org.jboss.portal.core.servlet.jsp.Po= rtalJsp" %> <%@ taglib uri=3D"http://java.sun.com/portlet" prefix=3D"portlet" %> <%@ taglib uri=3D"/WEB-INF/portal-lib.tld" prefix=3D"n" %> @@ -4,6 +7,11 @@ <%@ page isELIgnored=3D"false" %> = + +<% + List instances =3D (List)request.getAttribute("instances"); +%> + @@ -132,15 +132,15 @@ + onclick=3D"unassignPortlet('remove','center');"/> +


Middle Column
Right Column
--===============8716698876435101607==-- From portal-commits at lists.jboss.org Mon Nov 27 13:29:19 2006 Content-Type: multipart/mixed; boundary="===============5365038304308225040==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5723 - trunk/common/src/main/org/jboss/portal/common/util Date: Mon, 27 Nov 2006 13:29:18 -0500 Message-ID: --===============5365038304308225040== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2006-11-27 13:29:16 -0500 (Mon, 27 Nov 2006) New Revision: 5723 Modified: trunk/common/src/main/org/jboss/portal/common/util/ParameterValidation.j= ava Log: Added isNullOrEmpty method. Modified: trunk/common/src/main/org/jboss/portal/common/util/ParameterValid= ation.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/common/src/main/org/jboss/portal/common/util/ParameterValidation.= java 2006-11-27 17:06:21 UTC (rev 5722) +++ trunk/common/src/main/org/jboss/portal/common/util/ParameterValidation.= java 2006-11-27 18:29:16 UTC (rev 5723) @@ -31,12 +31,18 @@ { public static void throwIllegalArgExceptionIfNullOrEmpty(String valueTo= Check, String valueName, String contextName) { - if (valueToCheck =3D=3D null || valueToCheck.length() =3D=3D 0) + if (isNullOrEmpty(valueToCheck)) { throw new IllegalArgumentException(contextName !=3D null ? contex= tName + " r" : "R" + "equires a non-null, non-empty " + valueName); } } = + /** @since 2.6 */ + public static boolean isNullOrEmpty(String valueToCheck) + { + return valueToCheck =3D=3D null || valueToCheck.length() =3D=3D 0; + } + public static void throwIllegalArgExceptionIfNull(Object objectToTest, = String name) { if (objectToTest =3D=3D null) --===============5365038304308225040==-- From portal-commits at lists.jboss.org Mon Nov 27 13:31:00 2006 Content-Type: multipart/mixed; boundary="===============7698390242192644926==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5724 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/v1/producer wsrp/producer wsrp/producer/registration/api wsrp/producer/registration/impl Date: Mon, 27 Nov 2006 13:30:59 -0500 Message-ID: --===============7698390242192644926== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2006-11-27 13:30:43 -0500 (Mon, 27 Nov 2006) New Revision: 5724 Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationT= estCase.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.j= ava trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Regi= stration.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Reg= istrationImpl.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Reg= istrationManagerImpl.java Log: - Implemented deregister. - Added hook on Registration to clear associated state (to be implemented). Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/Regist= rationTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/Registration= TestCase.java 2006-11-27 18:29:16 UTC (rev 5723) +++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/Registration= TestCase.java 2006-11-27 18:30:43 UTC (rev 5724) @@ -25,7 +25,10 @@ = import org.jboss.portal.common.junit.ExtendedAssert; import org.jboss.portal.wsrp.WSRPConstants; +import org.jboss.portal.wsrp.WSRPTypeFactory; +import org.jboss.portal.wsrp.core.GetMarkup; import org.jboss.portal.wsrp.core.GetServiceDescription; +import org.jboss.portal.wsrp.core.InvalidRegistrationFault; import org.jboss.portal.wsrp.core.OperationFailedFault; import org.jboss.portal.wsrp.core.RegistrationContext; import org.jboss.portal.wsrp.core.RegistrationData; @@ -83,34 +86,40 @@ registrationService.register(regData); } = - /*public void testDeregister() throws Exception + public void testDeregister() throws Exception { // initiate registration - initRegistrationInfo(); + configureRegistrationSettings(false); RegistrationContext rc =3D registerConsumer(); = // deregister registrationService.deregister(rc); = - // Try to get service description with the deregistered context - GetServiceDescription gs =3D getNoRegistrationServiceDescriptionRequ= est(); - gs.setRegistrationContext(rc); + // try to get markup, portlet handle doesn't matter since it should = fail before trying to retrieve the portlet + GetMarkup getMarkup =3D WSRPTypeFactory.createDefaultMarkupRequest("= foo"); + getMarkup.getMarkupParams().setMarkupCharacterSets(new String[]{WSRP= Constants.DEFAULT_CHARACTER_SET}); = try { - serviceDescriptionService.getServiceDescription(gs); + markupService.getMarkup(getMarkup); ExtendedAssert.fail("Consumer tried to access info with a de-regi= stered context. Operations should fail."); } catch (InvalidRegistrationFault invalidRegistrationFault) { // expected } - }*/ = + // Get description should still work? + GetServiceDescription gs =3D getNoRegistrationServiceDescriptionRequ= est(); + gs.setRegistrationContext(rc); + + ExtendedAssert.assertNotNull(serviceDescriptionService.getServiceDes= cription(gs)); + } + /*public void testModifyRegistration() throws Exception { // initiate registration - initRegistrationInfo(); + configureRegistrationSettings(false); RegistrationContext rc =3D registerConsumer(); = // now modify Producer's set of required registration info Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHa= ndler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.= java 2006-11-27 18:29:16 UTC (rev 5723) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.= java 2006-11-27 18:30:43 UTC (rev 5724) @@ -24,6 +24,7 @@ package org.jboss.portal.wsrp.producer; = import org.jboss.logging.Logger; +import org.jboss.portal.common.util.ParameterValidation; import org.jboss.portal.wsrp.WSRPTypeFactory; import org.jboss.portal.wsrp.WSRPUtils; import org.jboss.portal.wsrp.core.InvalidRegistrationFault; @@ -38,6 +39,7 @@ import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType; import org.jboss.portal.wsrp.producer.registration.api.Consumer; import org.jboss.portal.wsrp.producer.registration.api.ConsumerCapabilitie= s; +import org.jboss.portal.wsrp.producer.registration.api.NoSuchRegistrationE= xception; import org.jboss.portal.wsrp.producer.registration.api.Registration; import org.jboss.portal.wsrp.producer.registration.api.RegistrationExcepti= on; import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus; @@ -110,7 +112,30 @@ { WSRPUtils.throwOperationFailedFaultIfValueIsMissing(deregister, "Reg= istrationContext"); = - return null; // todo: implement + String registrationHandle =3D deregister.getRegistrationHandle(); + if (ParameterValidation.isNullOrEmpty(registrationHandle)) + { + throwInvalidRegistrationFault("Null or empty registration handle"= ); + } + + log.debug("Attempting to deregister registration with handle '" + re= gistrationHandle + "'"); + + try + { + producer.getRegistrationManager().removeRegistration(registration= Handle); + } + catch (NoSuchRegistrationException e) + { + log.debug(e); + throwInvalidRegistrationFault(e.getLocalizedMessage()); + } + catch (RegistrationException e) + { + log.debug(e); + throw WSRPUtils.createOperationFailedFault(e); + } + + return new ReturnAny(); } = public RegistrationState modifyRegistration(ModifyRegistration modifyRe= gistration) throws MissingParametersFault, @@ -139,7 +164,7 @@ try { Registration reg =3D producer.getRegistrationManager().getRegi= stration(regHandle); - return RegistrationStatus.VALID.equals(reg.getStatus()); + return reg !=3D null && RegistrationStatus.VALID.equals(reg.ge= tStatus()); } catch (RegistrationException e) { Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/a= pi/Registration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Reg= istration.java 2006-11-27 18:29:16 UTC (rev 5723) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Reg= istration.java 2006-11-27 18:30:43 UTC (rev 5724) @@ -93,4 +93,7 @@ * @param status the new status */ void setStatus(RegistrationStatus status); + + /** Clears any state (cloned portlet information, session, etc) associa= ted with this Registration */ + void clearAssociatedState(); } Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/RegistrationImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationImpl.java 2006-11-27 18:29:16 UTC (rev 5723) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationImpl.java 2006-11-27 18:30:43 UTC (rev 5724) @@ -148,4 +148,9 @@ this.status =3D status; } = + public void clearAssociatedState() + { + //todo: implement + } + } Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/RegistrationManagerImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationManagerImpl.java 2006-11-27 18:29:16 UTC (rev 5723) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationManagerImpl.java 2006-11-27 18:30:43 UTC (rev 5724) @@ -35,6 +35,7 @@ import org.jboss.portal.wsrp.producer.registration.api.RegistrationManager; import org.jboss.portal.wsrp.producer.registration.api.RegistrationPersist= enceManager; import org.jboss.portal.wsrp.producer.registration.api.RegistrationPolicy; +import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus; = import java.util.ArrayList; import java.util.Collection; @@ -243,17 +244,12 @@ removeRegistration(registration); } = - public void removeRegistration(Registration registration) throws Regist= rationException, NoSuchRegistrationException + public void removeRegistration(Registration registration) throws Regist= rationException { ParameterValidation.throwIllegalArgExceptionIfNull(registration, "Re= gistration"); - String handle =3D registration.getRegistrationHandle(); - Consumer consumer =3D getConsumerFor(handle); = - if (consumer =3D=3D null) - { - throw new NoSuchRegistrationException("Could not locate a Consume= r for Registration with handle '" + handle - + "' (id: '" + registration.getId() + "')"); - } + registration.setStatus(RegistrationStatus.INVALID); // just in case.= .. + registration.clearAssociatedState(); = persistenceManager.removeRegistration(registration.getId()); registrations.remove(registration.getRegistrationHandle()); --===============7698390242192644926==-- From portal-commits at lists.jboss.org Mon Nov 27 14:16:45 2006 Content-Type: multipart/mixed; boundary="===============3566868636811443075==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5725 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard Date: Mon, 27 Nov 2006 14:16:44 -0500 Message-ID: --===============3566868636811443075== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: roy.russo(a)jboss.com Date: 2006-11-27 14:16:41 -0500 (Mon, 27 Nov 2006) New Revision: 5725 Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator= .java trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.= jsp Log: JBPORTAL-993 - move window functionality added. Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-27 18:30:43 UTC (rev 5724) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-27 19:16:41 UTC (rev 5725) @@ -27,6 +27,8 @@ import org.jboss.portal.core.model.portal.PortalObject; import org.jboss.portal.core.model.portal.PortalObjectContainer; import org.jboss.portal.core.model.portal.Window; +import org.jboss.portal.theme.LayoutService; +import org.jboss.portal.theme.PortalLayout; import org.jboss.portal.theme.ThemeConstants; import org.jboss.portlet.JBossActionRequest; import org.jboss.portlet.JBossActionResponse; @@ -39,8 +41,14 @@ import javax.portlet.PortletSecurityException; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; +import java.util.SortedSet; +import java.util.TreeSet; = /** * @author Roy Russo @@ -54,6 +62,8 @@ = private PortalObjectContainer portalObjectContainer; = + private LayoutService layoutService; + private static final int MOVE_UP =3D 0; private static final int MOVE_DOWN =3D 1; = @@ -66,6 +76,8 @@ = portalObjectContainer =3D (PortalObjectContainer)getPortletContext()= .getAttribute("PortalObjectContainer"); = + layoutService =3D (LayoutService)getPortletContext().getAttribute("L= ayoutService"); + if (instanceContainer =3D=3D null) { throw new PortletException("No InstanceContainer found"); @@ -74,6 +86,10 @@ { throw new PortletException("No PortalObjectContainer found"); } + if (layoutService =3D=3D null) + { + throw new PortletException("No LayoutService found"); + } } = protected void doView(JBossRenderRequest req, JBossRenderResponse resp) @@ -84,28 +100,42 @@ List left_instances =3D new ArrayList(); List center_instances =3D new ArrayList(); List right_instances =3D new ArrayList(); + Page page =3D portalObjectContainer.getContext().getPortal("dashboar= d").getPage(req.getUser().getUserName()); - for (Iterator i =3D page.getChildren().iterator(); i.hasNext();) + try { - PortalObject object =3D (PortalObject)i.next(); - if (object.getType() =3D=3D PortalObject.TYPE_WINDOW) + Map windowMap =3D getWindows(page); + List regions =3D new ArrayList(windowMap.keySet()); + Collections.sort(regions); + + for (Iterator i =3D regions.iterator(); i.hasNext();) { - Window window =3D (Window)object; - String region =3D object.getProperty(ThemeConstants.PORTAL_PRO= P_REGION); - if (region.equals("left")) + String region =3D (String)i.next(); + + TreeSet windows =3D (TreeSet)windowMap.get(region); + for (Iterator j =3D windows.iterator(); j.hasNext();) { - left_instances.add(window.getInstanceRef()); + Window window =3D (Window)j.next(); + if (region.equals("left")) + { + left_instances.add(window); + System.out.println(window.getInstanceRef() + ":" + windo= w.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER)); + } + else if (region.equals("center")) + { + center_instances.add(window); + } + else if (region.equals("right")) + { + right_instances.add(window); + } } - else if (region.equals("center")) - { - center_instances.add(window.getInstanceRef()); - } - else if (region.equals("right")) - { - right_instances.add(window.getInstanceRef()); - } } } + catch (Exception e) + { + e.printStackTrace(); + } = resp.setContentType("text/html"); req.setAttribute("available_instances", available_instances); @@ -149,44 +179,26 @@ else if ("remove".equals(op)) { String fromRegion =3D actionRequest.getParameter("fromRegion"); - String[] removeInstances =3D null; + String[] removeWindows =3D null; if ("left".equals(fromRegion)) { - removeInstances =3D actionRequest.getParameterValues("left_ins= tances"); + removeWindows =3D actionRequest.getParameterValues("left_insta= nces"); } else if ("center".equals(fromRegion)) { - removeInstances =3D actionRequest.getParameterValues("center_i= nstances"); + removeWindows =3D actionRequest.getParameterValues("center_ins= tances"); } else if ("right".equals(fromRegion)) { - removeInstances =3D actionRequest.getParameterValues("right_in= stances"); + removeWindows =3D actionRequest.getParameterValues("right_inst= ances"); } = Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); - List removeWindows =3D new ArrayList(); - for (Iterator i =3D page.getChildren().iterator(); i.hasNext();) - { - PortalObject object =3D (PortalObject)i.next(); - if (object.getType() =3D=3D PortalObject.TYPE_WINDOW) - { - Window window =3D (Window)object; - String region =3D object.getProperty(ThemeConstants.PORTAL_= PROP_REGION); - String instance =3D window.getInstanceRef(); - for (int j =3D 0; j < removeInstances.length; j++) - { - if (instance.equalsIgnoreCase(removeInstances[j]) && fro= mRegion.equalsIgnoreCase(region)) - { - removeWindows.add(window.getName()); - } - } - } - } try { - for (int i =3D 0; i < removeWindows.size(); i++) + for (int i =3D 0; i < removeWindows.length; i++) { - page.destroyChild((String)removeWindows.get(i)); + page.destroyChild((String)removeWindows[i]); } } catch (Exception e) @@ -194,23 +206,36 @@ // todo } } - else if ("up".equals(op)) + else if ("up".equals(op) || "down".equals(op)) { String sortRegion =3D actionRequest.getParameter("sortRegion"); - String[] moveRegion =3D null; + String[] moveWindows =3D null; if ("left".equals(sortRegion)) { - moveRegion =3D actionRequest.getParameterValues("left_instance= s"); + moveWindows =3D actionRequest.getParameterValues("left_instanc= es"); } else if ("center".equals(sortRegion)) { - moveRegion =3D actionRequest.getParameterValues("center_instan= ces"); + moveWindows =3D actionRequest.getParameterValues("center_insta= nces"); } else if ("right".equals(sortRegion)) { - moveRegion =3D actionRequest.getParameterValues("right_instanc= es"); + moveWindows =3D actionRequest.getParameterValues("right_instan= ces"); } = + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); + for (int i =3D 0; i < moveWindows.length; i++) + { + Window window =3D 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)); + } + } } } = @@ -218,4 +243,64 @@ { return (int)(100 * Math.random()); } + + /** Returns a SortedSet>Map. */ + private Map getWindows(Page page) throws Exception + { + // Get the layout + String layoutId =3D page.getProperty(ThemeConstants.PORTAL_PROP_LAYO= UT); + PortalLayout layout =3D layoutService.getLayout(layoutId, false); + + LinkedHashMap windows =3D new LinkedHashMap(); + for (Iterator i =3D layout.getLayoutInfo().getRegionNames().iterator= (); i.hasNext();) + { + String region =3D (String)i.next(); + windows.put(region, new TreeSet(comparator)); + } + windows.put("unknown", new TreeSet(comparator)); + + for (Iterator j =3D page.getChildren().iterator(); j.hasNext();) + { + PortalObject object =3D (PortalObject)j.next(); + if (object.getType() =3D=3D PortalObject.TYPE_WINDOW) + { + String region =3D object.getProperty(ThemeConstants.PORTAL_PRO= P_REGION); + if (!windows.containsKey(region)) + { + region =3D "unknown"; + } + SortedSet set =3D (SortedSet)windows.get(region); + set.add(object); + } + } + return windows; + } + + /** Compares two windows according to their order. */ + private static final Comparator comparator =3D new Comparator() + { + public int compare(Object o1, Object o2) + { + Window w1 =3D (Window)o1; + Window w2 =3D (Window)o2; + int sign =3D getOrder(w1) - getOrder(w2); + if (sign =3D=3D 0) + { + sign =3D w1.getId().compareTo(w2.getId()); + } + return sign; + } + }; + + private static int getOrder(Window w) + { + try + { + return Integer.parseInt(w.getDeclaredProperty(ThemeConstants.PORT= AL_PROP_ORDER)); + } + catch (NumberFormatException e) + { + return Integer.MAX_VALUE; + } + } } Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/ed= itpage.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-27 18:30:43 UTC (rev 5724) +++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-27 19:16:41 UTC (rev 5725) @@ -1,5 +1,6 @@ <%@ page import=3D"org.jboss.portal.core.model.instance.Instance" %> <%@ page import=3D"java.util.List" %> +<%@ page import=3D"org.jboss.portal.core.model.portal.Window" %> <%@ page language=3D"java" extends=3D"org.jboss.portal.core.servlet.jsp.Po= rtalJsp" %> <%@ taglib uri=3D"http://java.sun.com/portlet" prefix=3D"portlet" %> <%@ taglib uri=3D"/WEB-INF/portal-lib.tld" prefix=3D"n" %> @@ -113,9 +114,10 @@ <% for (int i =3D 0; i < left_instances.size(); i++) { - String instance =3D (String)left_instances.get(i); + Window window =3D (Window)left_instances.get(i); + //String instance =3D (String)left_instances.get(i); %> - <% } @@ -140,9 +142,10 @@ <% for (int i =3D 0; i < center_instances.size(); i++) { - String instance =3D (String)center_instances.get(i); + Window window =3D (Window)center_instances.get(i); + //String instance =3D (String)center_instances.get(i); %> - <% } @@ -165,9 +168,10 @@ <% for (int i =3D 0; i < right_instances.size(); i++) { - String instance =3D (String)right_instances.get(i); + Window window =3D (Window)right_instances.get(i); + //String instance =3D (String)right_instances.get(i); %> - <% } --===============3566868636811443075==-- From portal-commits at lists.jboss.org Mon Nov 27 15:35:11 2006 Content-Type: multipart/mixed; boundary="===============0437572552134123429==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5726 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard Date: Mon, 27 Nov 2006 15:33:32 -0500 Message-ID: --===============0437572552134123429== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: roy.russo(a)jboss.com Date: 2006-11-27 15:33:29 -0500 (Mon, 27 Nov 2006) New Revision: 5726 Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator= .java trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.= jsp Log: JBPORTAL-993 = - Add page functionality added. - Can now perform operations on newly added pages. Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-27 19:16:41 UTC (rev 5725) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-27 20:33:29 UTC (rev 5726) @@ -24,6 +24,7 @@ import org.jboss.logging.Logger; import org.jboss.portal.core.model.instance.InstanceContainer; import org.jboss.portal.core.model.portal.Page; +import org.jboss.portal.core.model.portal.PageContainer; import org.jboss.portal.core.model.portal.PortalObject; import org.jboss.portal.core.model.portal.PortalObjectContainer; import org.jboss.portal.core.model.portal.Window; @@ -95,13 +96,29 @@ protected void doView(JBossRenderRequest req, JBossRenderResponse resp) throws PortletException, PortletSecurityException, IOException { + // Generic page loader. + String op =3D req.getParameter("op"); + if (op =3D=3D null) + { + op =3D "editPage"; + } + + Page page =3D null; + if (req.getParameter("editPageSelect") !=3D null) + { + String editPageSelect =3D req.getParameter("editPageSelect"); + page =3D portalObjectContainer.getContext().getPortal("dashboard"= ).getPage(editPageSelect); + } + else + { + page =3D portalObjectContainer.getContext().getPortal("dashboard"= ).getPage(req.getUser().getUserName()); + } + List available_instances =3D (List)instanceContainer.getInstances(); - List left_instances =3D new ArrayList(); List center_instances =3D new ArrayList(); List right_instances =3D new ArrayList(); = - Page page =3D portalObjectContainer.getContext().getPortal("dashboar= d").getPage(req.getUser().getUserName()); try { Map windowMap =3D getWindows(page); @@ -119,7 +136,7 @@ if (region.equals("left")) { left_instances.add(window); - System.out.println(window.getInstanceRef() + ":" + windo= w.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER)); + //System.out.println(window.getInstanceRef() + ":" + win= dow.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER)); } else if (region.equals("center")) { @@ -137,11 +154,23 @@ e.printStackTrace(); } = + List pages =3D new ArrayList(); + for (Iterator j =3D page.getPortal().getChildren().iterator(); j.has= Next();) + { + PortalObject object =3D (PortalObject)j.next(); + if (object.getType() =3D=3D PortalObject.TYPE_PAGE) + { + pages.add(object); + } + } + 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 =3D getPortletContext().getRequestDispat= cher("/WEB-INF/jsp/dashboard/editpage.jsp"); rd.include(req, resp); } @@ -149,12 +178,17 @@ protected void processAction(JBossActionRequest actionRequest, JBossAct= ionResponse actionResponse) { String op =3D actionRequest.getParameter("op"); + String editPage =3D actionRequest.getParameter("editPageSelect"); //= the current page we're editting + if (editPage =3D=3D null) + { + editPage =3D actionRequest.getUser().getUserName(); + } if ("copy".equals(op)) { String toRegion =3D actionRequest.getParameter("toRegion"); String[] copyInstance =3D actionRequest.getParameterValues("avail= able_instances"); = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); try { for (int i =3D 0; i < copyInstance.length; i++) @@ -175,6 +209,7 @@ { // todo } + actionResponse.setRenderParameter("editPageSelect", editPage); } else if ("remove".equals(op)) { @@ -193,7 +228,7 @@ removeWindows =3D actionRequest.getParameterValues("right_inst= ances"); } = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); try { for (int i =3D 0; i < removeWindows.length; i++) @@ -205,6 +240,7 @@ { // todo } + actionResponse.setRenderParameter("editPageSelect", editPage); } else if ("up".equals(op) || "down".equals(op)) { @@ -223,7 +259,7 @@ moveWindows =3D actionRequest.getParameterValues("right_instan= ces"); } = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); for (int i =3D 0; i < moveWindows.length; i++) { Window window =3D page.getWindow(moveWindows[i]); @@ -236,7 +272,32 @@ window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER= , Integer.toString(getOrder(window) + 1)); } } + actionResponse.setRenderParameter("editPageSelect", editPage); } + else if ("newpage".equals(op)) + { + String pageName =3D actionRequest.getParameter("pagename"); + + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); + PageContainer pageContainer =3D (PageContainer)page.getPortal(); + + try + { + pageContainer.createPage(pageName); + } + catch (Exception e) + { + // todo - name taken + } + + actionResponse.setRenderParameter("editPageSelect", pageName); + actionResponse.setRenderParameter("op", "editPage"); + } + else if ("editPage".equals(op)) + { + actionResponse.setRenderParameter("editPageSelect", editPage); + actionResponse.setRenderParameter("op", op); + } } = private int doWindowNaming() Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/ed= itpage.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-27 19:16:41 UTC (rev 5725) +++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-27 20:33:29 UTC (rev 5726) @@ -1,6 +1,7 @@ <%@ page import=3D"org.jboss.portal.core.model.instance.Instance" %> +<%@ page import=3D"org.jboss.portal.core.model.portal.Page" %> +<%@ page import=3D"org.jboss.portal.core.model.portal.Window" %> <%@ page import=3D"java.util.List" %> -<%@ page import=3D"org.jboss.portal.core.model.portal.Window" %> <%@ page language=3D"java" extends=3D"org.jboss.portal.core.servlet.jsp.Po= rtalJsp" %> <%@ taglib uri=3D"http://java.sun.com/portlet" prefix=3D"portlet" %> <%@ taglib uri=3D"/WEB-INF/portal-lib.tld" prefix=3D"n" %> @@ -13,6 +14,8 @@ List left_instances =3D (List)request.getAttribute("left_instances"); List center_instances =3D (List)request.getAttribute("center_instances"= ); List right_instances =3D (List)request.getAttribute("right_instances"); + List pages =3D (List)request.getAttribute("pages"); + String currentPage =3D (String)request.getAttribute("currentPage"); %> = - + --===============0437572552134123429==-- From portal-commits at lists.jboss.org Mon Nov 27 16:33:17 2006 Content-Type: multipart/mixed; boundary="===============7170675533893317578==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5727 - in trunk/wsrp: . src/main/org/jboss/portal/test/wsrp/registration src/main/org/jboss/portal/wsrp/producer/registration/impl Date: Mon, 27 Nov 2006 16:33:17 -0500 Message-ID: --===============7170675533893317578== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2006-11-27 16:33:14 -0500 (Mon, 27 Nov 2006) New Revision: 5727 Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registration= TestCase.java Modified: trunk/wsrp/build.xml trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Reg= istrationImpl.java Log: - Fixed a problem with Registration where the given registration properties= where "live" (i.e. it was possible to modify outside of the registration). - Added RegistrationTestCase to cover Registration. - Added ConsumerGroupTestCase and RegistrationTestCase to test suite. Modified: trunk/wsrp/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/build.xml 2006-11-27 20:33:29 UTC (rev 5726) +++ trunk/wsrp/build.xml 2006-11-27 21:33:14 UTC (rev 5727) @@ -700,7 +700,9 @@ + + - conf/config.xml --===============6952392129570627161==-- From portal-commits at lists.jboss.org Tue Nov 28 01:44:37 2006 Content-Type: multipart/mixed; boundary="===============2128307032872494988==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5731 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/registration test/wsrp/v1/producer wsrp wsrp/producer wsrp/producer/registration/api wsrp/producer/registration/impl Date: Tue, 28 Nov 2006 01:44:37 -0500 Message-ID: --===============2128307032872494988== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: chris.laprun(a)jboss.com Date: 2006-11-28 01:43:48 -0500 (Tue, 28 Nov 2006) New Revision: 5731 Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registration= TestCase.java trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/RegistrationT= estCase.java trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.j= ava trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Regi= stration.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Con= sumerImpl.java trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Reg= istrationImpl.java Log: - Can now modify consumer agent on Consumer. Dunno why I didn't allow it in= the first place... - Added remove/get property and updateProperties(Map) on Registration and a= ssociated test cases. - Implemented modifyRegistration and activated test case. With this first i= mplementation of Registration is finished! ^_^ Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Regis= trationTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registratio= nTestCase.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/Registratio= nTestCase.java 2006-11-28 06:43:48 UTC (rev 5731) @@ -114,6 +114,34 @@ } } = + public void testProperties() + { + QName name =3D new QName("prop1"); + assertEquals("value1", registration.getProperties().get(name)); + assertEquals("value2", registration.getProperties().get(new QName("p= rop2"))); + + String newValue =3D "new value"; + registration.setPropertyValueFor("prop1", newValue); + assertEquals(newValue, registration.getProperties().get(name)); + + registration.removeProperty(name); + assertNull(registration.getPropertyValueFor(name)); + } + + public void testUpdateProperties() + { + registrationProperties.remove(new QName("prop1")); + + registration.updateProperties(registrationProperties); + assertNull(registration.getPropertyValueFor("prop1")); + + QName name =3D new QName("prop3"); + String value =3D "value3"; + registrationProperties.put(name, value); + registration.updateProperties(registrationProperties); + assertEquals(value, registration.getPropertyValueFor(name)); + } + public void testHasEqualProperties() { assertTrue(registration.hasEqualProperties(registration)); Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/Regist= rationTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/Registration= TestCase.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/Registration= TestCase.java 2006-11-28 06:43:48 UTC (rev 5731) @@ -26,13 +26,19 @@ import org.jboss.portal.common.junit.ExtendedAssert; import org.jboss.portal.wsrp.WSRPConstants; import org.jboss.portal.wsrp.WSRPTypeFactory; +import org.jboss.portal.wsrp.WSRPUtils; import org.jboss.portal.wsrp.core.GetMarkup; import org.jboss.portal.wsrp.core.GetServiceDescription; import org.jboss.portal.wsrp.core.InvalidRegistrationFault; +import org.jboss.portal.wsrp.core.ModifyRegistration; import org.jboss.portal.wsrp.core.OperationFailedFault; +import org.jboss.portal.wsrp.core.PropertyDescription; import org.jboss.portal.wsrp.core.RegistrationContext; import org.jboss.portal.wsrp.core.RegistrationData; +import org.jboss.portal.wsrp.producer.registration.api.RegistrationPropert= yDescription; = +import javax.xml.namespace.QName; + /** * @author Chris Laprun * @version $Revision$ @@ -109,25 +115,57 @@ // expected } = - // Get description should still work? + // Get description with old registration context should fail GetServiceDescription gs =3D getNoRegistrationServiceDescriptionRequ= est(); gs.setRegistrationContext(rc); = + try + { + serviceDescriptionService.getServiceDescription(gs); + ExtendedAssert.fail("Required registration info has been modified= : operations should fail until registration is modified."); + } + catch (InvalidRegistrationFault invalidRegistrationFault) + { + // expected + } + + // Get description should still work without registration context + gs =3D getNoRegistrationServiceDescriptionRequest(); + ExtendedAssert.assertNotNull(serviceDescriptionService.getServiceDes= cription(gs)); } = - /*public void testModifyRegistration() throws Exception + public void testModifyRegistration() throws Exception { // initiate registration configureRegistrationSettings(false); RegistrationContext rc =3D registerConsumer(); = // now modify Producer's set of required registration info - RegistrationPropertyDescription regProp =3D new RegistrationProperty= Description("new prop", new QName("xsd:string")); + String newPropName =3D "New Prop"; + RegistrationPropertyDescription regProp =3D new RegistrationProperty= Description(newPropName, + new QName("urn:oasis:names:tc:wsrp:v1:types", "LocalizedString", = "ns1")); regProp.setDefaultLabel("New Registration Property"); producer.getProducerRegistrationRequirements().addRegistrationProper= ty(regProp); = - // Try to get service description + // try to get markup, portlet handle doesn't matter since it should = fail before trying to retrieve the portlet + GetMarkup getMarkup =3D WSRPTypeFactory.createDefaultMarkupRequest("= foo"); + getMarkup.getMarkupParams().setMarkupCharacterSets(new String[]{WSRP= Constants.DEFAULT_CHARACTER_SET}); + getMarkup.setRegistrationContext(rc); + + try + { + markupService.getMarkup(getMarkup); + ExtendedAssert.fail("Required registration info has been modified= : operations should fail until registration is modified."); + } + catch (InvalidRegistrationFault expected) + { + // expected + // WSRP primer recommends returning OperationFailedFault and NOT = InvalidRegistrationFault + // kinda weird... will be replaced by ModifyRegistrationRequiredF= ault in WSRP 2.0 + } + + // Get description should return information just as if consumer was= n't registered GetServiceDescription gs =3D getNoRegistrationServiceDescriptionRequ= est(); gs.setRegistrationContext(rc); = @@ -136,7 +174,7 @@ serviceDescriptionService.getServiceDescription(gs); ExtendedAssert.fail("Required registration info has been modified= : operations should fail until registration is modified."); } - catch (OperationFailedFault operationFailedFault) + catch (InvalidRegistrationFault expected) { // expected // WSRP primer recommends returning OperationFailedFault and NOT = InvalidRegistrationFault @@ -155,13 +193,13 @@ org.jboss.portal.wsrp.core.Property[] props =3D regData.getRegistrat= ionProperties(); org.jboss.portal.wsrp.core.Property[] newProps =3D new org.jboss.por= tal.wsrp.core.Property[props.length + 1]; System.arraycopy(props, 0, newProps, 0, props.length); - newProps[props.length] =3D new org.jboss.portal.wsrp.core.Property("= new prop", "en", "blah", null); + newProps[props.length] =3D new org.jboss.portal.wsrp.core.Property(n= ewPropName, "en", "blah", null); = // Modify registration and get service description registrationService.modifyRegistration(new ModifyRegistration(rc, re= gData)); gs.setRegistrationContext(rc); checkServiceDescriptionWithOnlyBasicPortlet(gs); - }*/ + } = public void testRegister() throws Exception { Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-11-28 05:= 41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java 2006-11-28 06:= 43:48 UTC (rev 5731) @@ -339,6 +339,7 @@ = public static void validateConsumerAgent(String consumerAgent) throws I= llegalArgumentException { + ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAg= ent, "consumer agent", null); char periodChar =3D '.'; int period =3D consumerAgent.indexOf(periodChar); if (period !=3D -1) Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHa= ndler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.= java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.= java 2006-11-28 06:43:48 UTC (rev 5731) @@ -86,15 +86,7 @@ WSRPUtils.validateConsumerAgent(consumerAgent); = registration =3D producer.getRegistrationManager().addRegistratio= nTo(consumerName, createRegistrationProperties(registrationData), true); - registration.setStatus(RegistrationStatus.VALID); - Consumer consumer =3D registration.getConsumer(); - consumer.setConsumerAgent(consumerAgent); - ConsumerCapabilities capabilities =3D consumer.getCapabilities(); - capabilities.setSupportedModes(getListFromArray(registrationData.= getConsumerModes(), false)); - capabilities.setSupportedWindowStates(getListFromArray(registrati= onData.getConsumerWindowStates(), false)); - capabilities.setSupportedUserProfileData(getListFromArray(registr= ationData.getCustomUserProfileData(), false)); - capabilities.setSupportedUserScopes(getListFromArray(registration= Data.getConsumerUserScopes(), false)); - capabilities.setSupportsGetMethod(registrationData.isMethodGetSup= ported()); + updateRegistrationInformation(registration, registrationData); } catch (Exception e) { @@ -107,6 +99,19 @@ return registrationContext; } = + private void updateRegistrationInformation(Registration registration, R= egistrationData registrationData) + { + registration.setStatus(RegistrationStatus.VALID); + Consumer consumer =3D registration.getConsumer(); + consumer.setConsumerAgent(registrationData.getConsumerAgent()); + ConsumerCapabilities capabilities =3D consumer.getCapabilities(); + capabilities.setSupportedModes(getListFromArray(registrationData.get= ConsumerModes(), false)); + capabilities.setSupportedWindowStates(getListFromArray(registrationD= ata.getConsumerWindowStates(), false)); + capabilities.setSupportedUserProfileData(getListFromArray(registrati= onData.getCustomUserProfileData(), false)); + capabilities.setSupportedUserScopes(getListFromArray(registrationDat= a.getConsumerUserScopes(), false)); + capabilities.setSupportsGetMethod(registrationData.isMethodGetSuppor= ted()); + } + public ReturnAny deregister(RegistrationContext deregister) throws Oper= ationFailedFault, InvalidRegistrationFault, RemoteException { @@ -141,7 +146,45 @@ public RegistrationState modifyRegistration(ModifyRegistration modifyRe= gistration) throws MissingParametersFault, OperationFailedFault, InvalidRegistrationFault, RemoteException { - return null; // todo: implement + WSRPUtils.throwOperationFailedFaultIfValueIsMissing(modifyRegistrati= on, "ModifyRegistration"); + + RegistrationContext registrationContext =3D modifyRegistration.getRe= gistrationContext(); + WSRPUtils.throwMissingParametersFaultIfValueIsMissing(registrationCo= ntext, "RegistrationContext", "ModifyRegistration"); + String registrationHandle =3D registrationContext.getRegistrationHan= dle(); + if (ParameterValidation.isNullOrEmpty(registrationHandle)) + { + throwInvalidRegistrationFault("Null or empty registration handle"= ); + } + + RegistrationData registrationData =3D modifyRegistration.getRegistra= tionData(); + WSRPUtils.throwMissingParametersFaultIfValueIsMissing(registrationDa= ta, "RegistrationData", "ModifyRegistration"); + + String consumerName =3D registrationData.getConsumerName(); + WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerName, = "consumer name", "RegistrationData"); + + String consumerAgent =3D registrationData.getConsumerAgent(); + WSRPUtils.throwMissingParametersFaultIfValueIsMissing(consumerAgent,= "consumer agent", "RegistrationData"); + + log.debug("Attempting to modify registration with handle '" + regist= rationHandle + "'"); + try + { + Registration registration =3D producer.getRegistrationManager().g= etRegistration(registrationHandle); + registration.updateProperties(createRegistrationProperties(regist= rationData)); + updateRegistrationInformation(registration, registrationData); + } + catch (NoSuchRegistrationException e) + { + log.debug(e); + throwInvalidRegistrationFault(e.getLocalizedMessage()); + } + catch (RegistrationException e) + { + log.debug(e); + throw WSRPUtils.createOperationFailedFault(e); + } + + + return null; } = public boolean isRegistrationValid(RegistrationContext registrationCont= ext) throws InvalidRegistrationFault, OperationFailedFault Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/a= pi/Registration.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Reg= istration.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Reg= istration.java 2006-11-28 06:43:48 UTC (rev 5731) @@ -96,4 +96,14 @@ = /** Clears any state (cloned portlet information, session, etc) associa= ted with this Registration */ void clearAssociatedState(); + + void updateProperties(Map registrationProperties); + + void removeProperty(QName propertyName); + + void removeProperty(String propertyName); + + Object getPropertyValueFor(QName propertyName); + + Object getPropertyValueFor(String propertyName); } Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/ConsumerImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Co= nsumerImpl.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Co= nsumerImpl.java 2006-11-28 06:43:48 UTC (rev 5731) @@ -52,7 +52,6 @@ private RegistrationStatus status; private ConsumerGroup group; private ConsumerCapabilities capabilities; - private boolean agentSet =3D false; = = private ConsumerImpl() @@ -117,14 +116,11 @@ = public void setConsumerAgent(String consumerAgent) throws IllegalArgume= ntException, IllegalStateException { - if (agentSet) + if (consumerAgent !=3D null && !consumerAgent.equals(this.consumerAg= ent)) { - throw new IllegalStateException("Cannot modify the agent of a Con= sumer!"); + WSRPUtils.validateConsumerAgent(consumerAgent); + this.consumerAgent =3D consumerAgent; } - - WSRPUtils.validateConsumerAgent(consumerAgent); - this.consumerAgent =3D consumerAgent; - agentSet =3D true; } = public ConsumerCapabilities getCapabilities() Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/i= mpl/RegistrationImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationImpl.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/Re= gistrationImpl.java 2006-11-28 06:43:48 UTC (rev 5731) @@ -86,14 +86,46 @@ { ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Pr= operty name"); ParameterValidation.throwIllegalArgExceptionIfNull(value, "Property = value"); - properties.put(propertyName, value); + + // avoid modifying the properties if new value is the same as old one + Object oldValue =3D properties.get(propertyName); + if (!value.equals(oldValue)) + { + properties.put(propertyName, value); + } } = public void setPropertyValueFor(String propertyName, Object value) { + ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Pr= operty name"); setPropertyValueFor(new QName(propertyName), value); } = + public Object getPropertyValueFor(QName propertyName) + { + ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Pr= operty name"); + return properties.get(propertyName); + } + + public Object getPropertyValueFor(String propertyName) + { + ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Pr= operty name"); + return getPropertyValueFor(new QName(propertyName)); + } + + + public void removeProperty(QName propertyName) + { + ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Pr= operty name"); + properties.remove(propertyName); + } + + public void removeProperty(String propertyName) + { + ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Pr= operty name"); + removeProperty(new QName(propertyName)); + } + public boolean hasEqualProperties(Registration registration) { if (registration =3D=3D null) @@ -154,4 +186,9 @@ //todo: implement } = + public void updateProperties(Map registrationProperties) + { + properties =3D new HashMap(registrationProperties); + } + } --===============2128307032872494988==-- From portal-commits at lists.jboss.org Tue Nov 28 02:51:45 2006 Content-Type: multipart/mixed; boundary="===============2278424305859011215==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5732 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller core/src/main/org/jboss/portal/core/controller/ajax core/src/main/org/jboss/portal/core/model/instance/command theme/src/main/org/jboss/portal/theme theme/src/main/org/jboss/portal/theme/impl/render/dynamic Date: Tue, 28 Nov 2006 02:51:43 -0500 Message-ID: --===============2278424305859011215== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2006-11-28 02:51:34 -0500 (Tue, 28 Nov 2006) New Revision: 5732 Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomi= zerInterceptor.java trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercepto= r.java trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokeP= ortletInstanceRenderCommand.java trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegi= onRenderer.java Log: - disabled ajax by default - enable ajax only on dashboard Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/Page= CustomizerInterceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustom= izerInterceptor.java 2006-11-28 06:43:48 UTC (rev 5731) +++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustom= izerInterceptor.java 2006-11-28 07:51:34 UTC (rev 5732) @@ -96,6 +96,8 @@ if (cmd instanceof RenderPageCommand) { RenderPageCommand rpc =3D (RenderPageCommand)cmd; + + // StringBuffer tabbedNav =3D injectTabbedNav(rpc); if (tabbedNav !=3D null) { @@ -110,7 +112,7 @@ = // Region region =3D rendition.getPageResult().getRegion("navi= gation"); - region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABL= ED, "true"); + region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLE= D, "false"); } } = @@ -129,7 +131,7 @@ = // Region region =3D rendition.getPageResult().getRegion("dashboa= rdnav"); - region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED,= "true"); + region.setProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, = "false"); } } = Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInt= erceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercept= or.java 2006-11-28 06:43:48 UTC (rev 5731) +++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercept= or.java 2006-11-28 07:51:34 UTC (rev 5732) @@ -26,6 +26,7 @@ import org.jboss.portal.core.controller.ControllerCommand; import org.jboss.portal.core.controller.ControllerInterceptor; import org.jboss.portal.core.model.portal.command.RenderPageCommand; +import org.jboss.portal.core.model.portal.command.ViewDashboardCommand; import org.jboss.portal.theme.PageRendition; import org.jboss.portal.theme.ThemeConstants; = @@ -43,42 +44,38 @@ { Object response =3D cmd.invokeNext(); = - // - if (cmd instanceof RenderPageCommand) + // Configure ajax if needed + if (response !=3D null && cmd instanceof RenderPageCommand) { RenderPageCommand rpc =3D (RenderPageCommand)cmd; PageRendition rendition =3D (PageRendition)response; = - // Configure ajax - if (rendition !=3D null) - { - Map pageProps =3D rendition.getPageResult().getPageProperties(= ); + Map pageProps =3D rendition.getPageResult().getPageProperties(); = - // - pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/po= rtal-ajax"); + // + pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/porta= l-ajax"); = - // If user is logged in and is not on dashboard we disable ajax - if (cmd.getControllerContext().getServerInvocation().getServer= Context().getClientRequest().getRemoteUser() !=3D null) + // If user is logged in and is on dashboard we enable ajax + if (cmd.getControllerContext().getServerInvocation().getServerCon= text().getClientRequest().getRemoteUser() !=3D null) + { + if (rpc.isDashboard()) { - if (rpc.isDashboard() =3D=3D false) - { - pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED= , "true"); - } + pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "t= rue"); } + } = - // Compute the url for the ajax servlet - HttpServletRequest req =3D cmd.getControllerContext().getServe= rInvocation().getServerContext().getClientRequest(); - StringBuffer url =3D new StringBuffer(); - url.append(req.getScheme()).append("://"); - url.append(req.getServerName()); - if (("http".equals(req.getScheme()) && req.getServerPort() != =3D 80) || ("https".equals(req.getScheme()) && req.getServerPort() !=3D 443= )) - { - url.append(':').append(req.getServerPort()); - } - url.append(req.getContextPath()).append("/ajax"); - - pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toStr= ing()); + // Compute the url for the ajax servlet + HttpServletRequest req =3D cmd.getControllerContext().getServerIn= vocation().getServerContext().getClientRequest(); + StringBuffer url =3D new StringBuffer(); + url.append(req.getScheme()).append("://"); + url.append(req.getServerName()); + if (("http".equals(req.getScheme()) && req.getServerPort() !=3D 8= 0) || ("https".equals(req.getScheme()) && req.getServerPort() !=3D 443)) + { + url.append(':').append(req.getServerPort()); } + url.append(req.getContextPath()).append("/ajax"); + + pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toString= ()); } = // Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/= InvokePortletInstanceRenderCommand.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/instance/command/Invoke= PortletInstanceRenderCommand.java 2006-11-28 06:43:48 UTC (rev 5731) +++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/Invoke= PortletInstanceRenderCommand.java 2006-11-28 07:51:34 UTC (rev 5732) @@ -96,7 +96,6 @@ LayoutService ls =3D ps.getLayoutService(); PortalLayout layout =3D ls.getLayout("generic", true); Map pageProperties =3D new HashMap(); - pageProperties.put(ThemeConstants.PORTAL_AJAX_OBJECT_DISABLED, "t= rue"); Map portalProperties =3D new HashMap(); portalProperties.put("theme.renderSetId", "divRenderer"); portalProperties.put("theme.id", "renaissance"); Modified: trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java 2006-11= -28 06:43:48 UTC (rev 5731) +++ trunk/theme/src/main/org/jboss/portal/theme/ThemeConstants.java 2006-11= -28 07:51:34 UTC (rev 5732) @@ -99,5 +99,5 @@ /** * */ - public static final String PORTAL_AJAX_OBJECT_DISABLED =3D "theme.ajax.= object_disabled"; + public static final String PORTAL_AJAX_OBJECT_ENABLED =3D "theme.ajax.o= bject_enabled"; } Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/D= ynaRegionRenderer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaReg= ionRenderer.java 2006-11-28 06:43:48 UTC (rev 5731) +++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaReg= ionRenderer.java 2006-11-28 07:51:34 UTC (rev 5732) @@ -50,11 +50,11 @@ = private RegionRenderer delegate; = - private static final ThreadLocal disabledLocal =3D new ThreadLocal(); + private static final ThreadLocal enabledLocal =3D new ThreadLocal(); = public static boolean isEnabled() { - return Boolean.TRUE.equals(disabledLocal.get()) =3D=3D false; + return Boolean.TRUE =3D=3D enabledLocal.get(); } = public DynaRegionRenderer(RegionRenderer regionRenderer) throws Instant= iationException, @@ -76,163 +76,167 @@ String remoteURL =3D (String)pageProps.get(ThemeConstants.PORTAL_AJA= X_REMOTE_URL); = // - Boolean disabled =3D null; - if ("true".equals(region.getProperty(ThemeConstants.PORTAL_AJAX_OBJE= CT_DISABLED))) - { - disabled =3D Boolean.TRUE; - } - else if ("true".equals(renderContext.getPageProperties().get(ThemeCo= nstants.PORTAL_AJAX_OBJECT_DISABLED))) - { - disabled =3D Boolean.TRUE; - } + Object onPage =3D renderContext.getPageProperties().get(ThemeConstan= ts.PORTAL_AJAX_OBJECT_ENABLED); + boolean pageEnabled =3D onPage !=3D null && "true".equals(onPage); = - // Handle special ajax region here - if ("AJAXFooter".equals(region.getId())) + // + boolean regionEnabled =3D false; + if (pageEnabled) { - disabled =3D Boolean.TRUE; + // Handle special ajax region here + if ("AJAXFooter".equals(region.getId())) + { + markup.append("\n"); + } + else if ("AJAXScripts".equals(region.getId())) + { + markup.append("\n\n\n"); + markup.append("\n"); + markup.append("\n"); + markup.append("\n"); + markup.append("\n"); + markup.append("\n"); - } - else if ("AJAXScripts".equals(region.getId())) - { - disabled =3D Boolean.TRUE; + markup.append("regions_on_page =3D new Object();\n"); = - markup.append("\n\n\n"); - markup.append("\n"); - markup.append("\n"); - markup.append("\n"); - markup.append("\n"); - markup.append("\n"); - markup.append("\n\n\n"); + markup.append("\n"); + markup.append("\n\n\n"); + } + else + { + String onRegion =3D region.getProperty(ThemeConstants.PORTAL_A= JAX_OBJECT_ENABLED); + regionEnabled =3D onRegion =3D=3D null || "true".equals(onRegi= on); + } } = - if (Boolean.TRUE.equals(disabled) =3D=3D false) + // + if (regionEnabled) { - markup.append( - ""); + markup.append(""); } = // try { - disabledLocal.set(disabled); + enabledLocal.set(Boolean.valueOf(regionEnabled)); = // delegate.render(renderContext, region, portletContexts, windowRes= ults); } finally { - disabledLocal.set(null); + enabledLocal.set(null); } = // --===============2278424305859011215==-- From portal-commits at lists.jboss.org Tue Nov 28 02:53:42 2006 Content-Type: multipart/mixed; boundary="===============2092215915392589637==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5733 - trunk/core/src/main/org/jboss/portal/core/controller/ajax Date: Tue, 28 Nov 2006 02:53:42 -0500 Message-ID: --===============2092215915392589637== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2006-11-28 02:53:40 -0500 (Tue, 28 Nov 2006) New Revision: 5733 Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercepto= r.java Log: - fixed CCE when the response from a render page command was not a PageRend= ition object Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInt= erceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercept= or.java 2006-11-28 07:51:34 UTC (rev 5732) +++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercept= or.java 2006-11-28 07:53:40 UTC (rev 5733) @@ -45,7 +45,7 @@ Object response =3D cmd.invokeNext(); = // Configure ajax if needed - if (response !=3D null && cmd instanceof RenderPageCommand) + if (response instanceof PageRendition && cmd instanceof RenderPageCo= mmand) { RenderPageCommand rpc =3D (RenderPageCommand)cmd; PageRendition rendition =3D (PageRendition)response; --===============2092215915392589637==-- From portal-commits at lists.jboss.org Tue Nov 28 06:54:57 2006 Content-Type: multipart/mixed; boundary="===============4907583858051470040==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5734 - trunk/core/src/resources/portal-core-sar/META-INF Date: Tue, 28 Nov 2006 06:54:57 -0500 Message-ID: --===============4907583858051470040== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: thomas.heute(a)jboss.com Date: 2006-11-28 06:54:55 -0500 (Tue, 28 Nov 2006) New Revision: 5734 Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml Log: Schedule portlet discovery every 30 seconds Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.x= ml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 200= 6-11-28 07:53:40 UTC (rev 5733) +++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 200= 6-11-28 11:54:55 UTC (rev 5734) @@ -23,7 +23,18 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~--> = - + + = + + + portal:service=3DManagement,type=3DPor= tletDiscoveryManagement,name=3DDefault + processPortletDiscovery() + NOW + 30000 + -1 + + --===============0916825683152738878== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2006-11-28 09:10:12 -0500 (Tue, 28 Nov 2006) New Revision: 5735 Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercepto= r.java trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicCont= roller.java trunk/core/src/main/org/jboss/portal/core/controller/command/info/Comman= dInfo.java trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPag= eCommand.java Log: - fixed redirect on https when a portlet declares transport garantees that = mandates it Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxInt= erceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercept= or.java 2006-11-28 11:54:55 UTC (rev 5734) +++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxIntercept= or.java 2006-11-28 14:10:12 UTC (rev 5735) @@ -48,34 +48,29 @@ if (response instanceof PageRendition && cmd instanceof RenderPageCo= mmand) { RenderPageCommand rpc =3D (RenderPageCommand)cmd; - PageRendition rendition =3D (PageRendition)response; = - Map pageProps =3D rendition.getPageResult().getPageProperties(); - - // - pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/porta= l-ajax"); - // If user is logged in and is on dashboard we enable ajax - if (cmd.getControllerContext().getServerInvocation().getServerCon= text().getClientRequest().getRemoteUser() !=3D null) + if (rpc.getControllerContext().getServerInvocation().getServerCon= text().getClientRequest().getRemoteUser() !=3D null && + rpc.isDashboard()) { - if (rpc.isDashboard()) + // Compute the url for the ajax servlet + HttpServletRequest req =3D cmd.getControllerContext().getServe= rInvocation().getServerContext().getClientRequest(); + StringBuffer url =3D new StringBuffer(); + url.append(req.getScheme()).append("://"); + url.append(req.getServerName()); + if (("http".equals(req.getScheme()) && req.getServerPort() != =3D 80) || ("https".equals(req.getScheme()) && req.getServerPort() !=3D 443= )) { - pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "t= rue"); + url.append(':').append(req.getServerPort()); } - } + url.append(req.getContextPath()).append("/ajax"); = - // Compute the url for the ajax servlet - HttpServletRequest req =3D cmd.getControllerContext().getServerIn= vocation().getServerContext().getClientRequest(); - StringBuffer url =3D new StringBuffer(); - url.append(req.getScheme()).append("://"); - url.append(req.getServerName()); - if (("http".equals(req.getScheme()) && req.getServerPort() !=3D 8= 0) || ("https".equals(req.getScheme()) && req.getServerPort() !=3D 443)) - { - url.append(':').append(req.getServerPort()); + // + PageRendition rendition =3D (PageRendition)response; + Map pageProps =3D rendition.getPageResult().getPageProperties(= ); + pageProps.put(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE, "/po= rtal-ajax"); + pageProps.put(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED, "true= "); + pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toStr= ing()); } - url.append(req.getContextPath()).append("/ajax"); - - pageProps.put(ThemeConstants.PORTAL_AJAX_REMOTE_URL, url.toString= ()); } = // Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/Clas= sicController.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicCon= troller.java 2006-11-28 11:54:55 UTC (rev 5734) +++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicCon= troller.java 2006-11-28 14:10:12 UTC (rev 5735) @@ -103,7 +103,7 @@ } = // Find out if we can execute in the same server invocation - if (requiresRedirect(urlContext, cmd, invocation)) + if (requiresRedirect(urlContext, forward)) { String url =3D ctx.renderURL(forward.getCommand(), forward.= getURLContext(), null); if (url =3D=3D null) @@ -172,24 +172,25 @@ return null; } = - public boolean requiresRedirect(URLContext urlCtx, ControllerCommand cm= d, ServerInvocation invocation) + public boolean requiresRedirect(URLContext currentURLCtx, CommandForwar= d forward) { - CommandInfo cmdInfo =3D cmd.getInfo(); + CommandInfo cmdInfo =3D forward.getCommand().getInfo(); + URLContext nextURLCtx =3D forward.getURLContext(); if (cmdInfo instanceof ActionCommandInfo && !((ActionCommandInfo)cmd= Info).isIdempotent()) { return true; } else { - boolean currentAuthenticated =3D invocation.getServerContext().ge= tURLContext().isAuthenticated(); - if (urlCtx !=3D null && currentAuthenticated !=3D urlCtx.isAuthen= ticated()) + boolean currentAuthenticated =3D currentURLCtx.isAuthenticated(); + if (nextURLCtx !=3D null && currentAuthenticated !=3D nextURLCtx.= isAuthenticated()) { return true; } else { - boolean currentSecure =3D invocation.getServerContext().getURL= Context().getSecure(); - if (urlCtx !=3D null && urlCtx.getSecure() && !currentSecure) + boolean currentSecure =3D currentURLCtx.getSecure(); + if (nextURLCtx !=3D null && nextURLCtx.getSecure() && !current= Secure) { return true; } Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/info= /CommandInfo.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/command/info/Comma= ndInfo.java 2006-11-28 11:54:55 UTC (rev 5734) +++ trunk/core/src/main/org/jboss/portal/core/controller/command/info/Comma= ndInfo.java 2006-11-28 14:10:12 UTC (rev 5735) @@ -55,7 +55,7 @@ return secured; } = - /** @return the associated action of this command for security checks (= is the user allowed to call this action...) */ + /** @return the associated action of this command for security checks (= is the user allowed to call this action...). */ public String getAction() { return action; Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/Re= nderPageCommand.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPa= geCommand.java 2006-11-28 11:54:55 UTC (rev 5734) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/RenderPa= geCommand.java 2006-11-28 14:10:12 UTC (rev 5735) @@ -424,7 +424,6 @@ String contentChars =3D ""; String headerChars =3D null; Map actionMap =3D new HashMap(); - Properties responseProps; Map windowProps =3D window.getDeclaredProperties(); = String navStateKey =3D window.getId() + "_window"; @@ -438,18 +437,10 @@ try { RenderPortletWindowCommand renderCmd =3D new RenderPortletWindowC= ommand(windowRef); - - // PortletResponse portletResponse =3D (PortletResponse)context.exec= ute(renderCmd); PortletInvocationResponse response =3D portletResponse.getResult(= ); = // - if (response instanceof InsufficientTransportGuaranteeResponse) - { - return response; - } - - // if (response instanceof FragmentResponse) { FragmentResponse fragment =3D (FragmentResponse)response; @@ -459,8 +450,6 @@ windowTitle =3D window.getName(); } headerChars =3D fragment.getHeader(); -// responseProps =3D fragment.getProperties(); - responseProps =3D new Properties(); // remove me = // Instance instance =3D renderCmd.getInstance(); @@ -505,7 +494,15 @@ contentChars =3D fragment.getContent(); = // - return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, responseProps, headerChars, windowNavState.getWindowState(), w= indowNavState.getMode()); + return new WindowResult( + windowTitle, + contentChars, + actionMap, + windowProps, + new Properties(), + headerChars, + windowNavState.getWindowState(), + windowNavState.getMode()); } else if (response instanceof ErrorResponse) { @@ -516,14 +513,13 @@ if (!HIDE.equals(property)) { windowTitle =3D "An error occured while rendering window '"= + windowRef + "'"; - responseProps =3D new Properties(); contentChars =3D errorResult.getMessage(); Throwable t =3D errorResult.getThrowable(); if (t !=3D null && SHOW.equals(property)) { contentChars =3D Exceptions.toHTML(t, true); } - return new WindowResult(windowTitle, contentChars, actionMa= p, windowProps, responseProps, headerChars, windowNavState.getWindowState()= , windowNavState.getMode()); + return new WindowResult(windowTitle, contentChars, actionMa= p, windowProps, new Properties(), headerChars, windowNavState.getWindowStat= e(), windowNavState.getMode()); } } else if (response instanceof UnavailableResponse) @@ -535,8 +531,7 @@ actionMap =3D new HashMap(); actionMap.put(WindowResult.MODES_KEY, Collections.EMPTY_LIS= T); actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EM= PTY_LIST); - responseProps =3D new Properties(); - return new WindowResult(windowTitle, contentChars, actionMa= p, windowProps, responseProps, headerChars, windowNavState.getWindowState()= , windowNavState.getMode()); + return new WindowResult(windowTitle, contentChars, actionMa= p, windowProps, new Properties(), headerChars, windowNavState.getWindowStat= e(), windowNavState.getMode()); } } else if (response instanceof InsufficientPrivilegesResponse) @@ -546,7 +541,7 @@ } else { - throw new NotYetImplemented("Unexpected result from a portlet = invocation " + response); + return portletResponse; } } catch (ResourceAccessDeniedException e) @@ -561,8 +556,7 @@ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY= _LIST); windowTitle =3D "Access denied"; contentChars =3D "Access denied"; - responseProps =3D new Properties(); - return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, responseProps, headerChars, windowNavState.getWindowState(), w= indowNavState.getMode()); + return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, new Properties(), headerChars, windowNavState.getWindowState()= , windowNavState.getMode()); } } catch (ResourceNotFoundException e) @@ -577,8 +571,7 @@ actionMap.put(WindowResult.WINDOWSTATES_KEY, Collections.EMPTY= _LIST); windowTitle =3D "Cannot render"; contentChars =3D "Object not found " + e.getRef(); - responseProps =3D new Properties(); - return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, responseProps, headerChars, windowNavState.getWindowState(), w= indowNavState.getMode()); + return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, new Properties(), headerChars, windowNavState.getWindowState()= , windowNavState.getMode()); } } catch (ControllerException e) @@ -593,12 +586,12 @@ if (SHOW.equals(property)) { windowTitle =3D "An internal error occured while rendering win= dow '" + window + "'"; - responseProps =3D new Properties(); contentChars =3D Exceptions.toHTML(e, true); - return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, responseProps, headerChars, windowNavState.getWindowState(), w= indowNavState.getMode()); + return new WindowResult(windowTitle, contentChars, actionMap, = windowProps, new Properties(), headerChars, windowNavState.getWindowState()= , windowNavState.getMode()); } } = + // return null; } = --===============0916825683152738878==-- From portal-commits at lists.jboss.org Tue Nov 28 12:21:14 2006 Content-Type: multipart/mixed; boundary="===============8047048484415430774==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5736 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard Date: Tue, 28 Nov 2006 12:21:14 -0500 Message-ID: --===============8047048484415430774== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: roy.russo(a)jboss.com Date: 2006-11-28 12:21:10 -0500 (Tue, 28 Nov 2006) New Revision: 5736 Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator= .java trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.= jsp Log: JBPORTAL-1143 - Added dynamic region handling for window assignment Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-28 14:10:12 UTC (rev 5735) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-28 17:21:10 UTC (rev 5736) @@ -115,45 +115,24 @@ } = List available_instances =3D (List)instanceContainer.getInstances(); - List left_instances =3D new ArrayList(); - List center_instances =3D new ArrayList(); - List right_instances =3D new ArrayList(); = + resp.setContentType("text/html"); try { Map windowMap =3D getWindows(page); + List regions =3D new ArrayList(windowMap.keySet()); Collections.sort(regions); = - for (Iterator i =3D regions.iterator(); i.hasNext();) - { - String region =3D (String)i.next(); - - TreeSet windows =3D (TreeSet)windowMap.get(region); - for (Iterator j =3D windows.iterator(); j.hasNext();) - { - Window window =3D (Window)j.next(); - if (region.equals("left")) - { - left_instances.add(window); - //System.out.println(window.getInstanceRef() + ":" + win= dow.getDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER)); - } - else if (region.equals("center")) - { - center_instances.add(window); - } - else if (region.equals("right")) - { - right_instances.add(window); - } - } - } + req.setAttribute("windowMap", windowMap); + req.setAttribute("regions", regions); } catch (Exception e) { e.printStackTrace(); } = + // page select box List pages =3D new ArrayList(); for (Iterator j =3D page.getPortal().getChildren().iterator(); j.has= Next();) { @@ -164,13 +143,10 @@ } } = - 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 =3D getPortletContext().getRequestDispat= cher("/WEB-INF/jsp/dashboard/editpage.jsp"); rd.include(req, resp); } @@ -215,20 +191,26 @@ { String fromRegion =3D actionRequest.getParameter("fromRegion"); String[] removeWindows =3D null; - if ("left".equals(fromRegion)) + + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); + try { - removeWindows =3D actionRequest.getParameterValues("left_insta= nces"); + Map windowMap =3D getWindows(page); + List regions =3D new ArrayList(windowMap.keySet()); + for (int i =3D 0; i < regions.size(); i++) + { + String region =3D (String)regions.get(i); + if (region.equalsIgnoreCase(fromRegion)) + { + removeWindows =3D actionRequest.getParameterValues(regio= n + "_instances"); + } + } } - else if ("center".equals(fromRegion)) + catch (Exception e) { - removeWindows =3D actionRequest.getParameterValues("center_ins= tances"); + // todo } - else if ("right".equals(fromRegion)) - { - removeWindows =3D actionRequest.getParameterValues("right_inst= ances"); - } = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); try { for (int i =3D 0; i < removeWindows.length; i++) @@ -246,20 +228,26 @@ { String sortRegion =3D actionRequest.getParameter("sortRegion"); String[] moveWindows =3D null; - if ("left".equals(sortRegion)) + + Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); + try { - moveWindows =3D actionRequest.getParameterValues("left_instanc= es"); + Map windowMap =3D getWindows(page); + List regions =3D new ArrayList(windowMap.keySet()); + for (int i =3D 0; i < regions.size(); i++) + { + String region =3D (String)regions.get(i); + if (region.equalsIgnoreCase(sortRegion)) + { + moveWindows =3D actionRequest.getParameterValues(region = + "_instances"); + } + } } - else if ("center".equals(sortRegion)) + catch (Exception e) { - moveWindows =3D actionRequest.getParameterValues("center_insta= nces"); + // todo } - else if ("right".equals(sortRegion)) - { - moveWindows =3D actionRequest.getParameterValues("right_instan= ces"); - } = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); for (int i =3D 0; i < moveWindows.length; i++) { Window window =3D page.getWindow(moveWindows[i]); Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/ed= itpage.jsp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-28 14:10:12 UTC (rev 5735) +++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage= .jsp 2006-11-28 17:21:10 UTC (rev 5736) @@ -1,7 +1,12 @@ <%@ page import=3D"org.jboss.portal.core.model.instance.Instance" %> <%@ page import=3D"org.jboss.portal.core.model.portal.Page" %> <%@ page import=3D"org.jboss.portal.core.model.portal.Window" %> +<%@ page import=3D"java.util.ArrayList" %> +<%@ page import=3D"java.util.Collections" %> +<%@ page import=3D"java.util.Iterator" %> <%@ page import=3D"java.util.List" %> +<%@ page import=3D"java.util.Map" %> +<%@ page import=3D"java.util.TreeSet" %> <%@ page language=3D"java" extends=3D"org.jboss.portal.core.servlet.jsp.Po= rtalJsp" %> <%@ taglib uri=3D"http://java.sun.com/portlet" prefix=3D"portlet" %> <%@ taglib uri=3D"/WEB-INF/portal-lib.tld" prefix=3D"n" %> @@ -15,6 +20,10 @@ List center_instances =3D (List)request.getAttribute("center_instances"= ); List right_instances =3D (List)request.getAttribute("right_instances"); List pages =3D (List)request.getAttribute("pages"); + + //List regions =3D (List)request.getAttribute("regions"); + Map windowMap =3D (Map)request.getAttribute("windowMap"); + String currentPage =3D (String)request.getAttribute("currentPage"); %> = @@ -87,133 +96,95 @@ - -
Edit P= ageEdit P= age '<%=3D currentPage %>'
Use this to manage the content on your page. You can control the pag= e title, select number of columns, and add, @@ -55,10 +63,19 @@
Select a page to e= dit:
= -
- + <% + for (int i =3D 0; i < pages.size(); i++) + { + Page onePage =3D (Page)pages.get(i); + %> + + <% + } + %>
@@ -77,16 +94,26 @@ +"/> - - -
+ - +
title/layout table + Title and Layout +
+ Title the page and select the number of columns for the layout +
+ Page Title:
+ +
+ +
Available Content=
+
Avail= able Content
-
+
+ " name=3D"instancesForm" method=3D"POST" onsubmit= =3D"debug();"> - - - - -"/> - - - - -
- - - - -
- Title and Layout -
- Title the page and select the number of columns for the layout -
- Page Title:
- -
- -
-
Avail= able Content
- -
- - - - - - - - - - - - - - - - -
-
- Left Column
- -
-
-
-
Middle Column
-
-
-
Right Column
-
-
+ + + + + "/> + + + + + +
+ + + + +
+ Title and Layout +
+ Title the page and select the number of columns= for the layout +
+ Page Title:
+ +
+ +
+
Available Content
+ +
+ + <% + List regions =3D new ArrayList(windowMap.keySet()); + Collections.sort(regions); + for (Iterator i =3D regions.iterator(); i.hasNext();) + { + String region =3D (String)i.next(); + TreeSet windows =3D (TreeSet)windowMap.get(region); + %> + + + + + + <% + } + %> +
+ ');"/>
');"/>
+ <%=3D region %> Column
+ +
+ ');"/>
');"= /> +
+
+ +
-
- - \ No newline at end of file --===============8047048484415430774==-- From portal-commits at lists.jboss.org Tue Nov 28 13:18:14 2006 Content-Type: multipart/mixed; boundary="===============2062989894792024067==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5737 - trunk/core/src/main/org/jboss/portal/core/portlet/dashboard Date: Tue, 28 Nov 2006 13:18:12 -0500 Message-ID: --===============2062989894792024067== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-28 17:21:10 UTC (rev 5736) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-28 18:18:11 UTC (rev 5737) @@ -242,24 +242,29 @@ moveWindows =3D actionRequest.getParameterValues(region = + "_instances"); } } + + SortedSet windows =3D (SortedSet)windowMap.get(sortRegion); + + for (int i =3D 0; i < moveWindows.length; i++) + { + Window window =3D page.getWindow(moveWindows[i]); + if ("up".equals(op)) + { + int order =3D getMoveUpOrder(window, windows); + window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_OR= DER, Integer.toString(order)); + } + else if ("down".equals(op)) + { + int order =3D getMoveDownOrder(window, windows); + window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_OR= DER, Integer.toString(order)); + } + } } catch (Exception e) { // todo } = - for (int i =3D 0; i < moveWindows.length; i++) - { - Window window =3D 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 =3D null; + for (Iterator i =3D set.iterator(); i.hasNext();) + { + Window current =3D (Window)i.next(); + + if (current.getName().equalsIgnoreCase(window.getName())) + { + if (previous =3D=3D null) + { + return getOrder(current); + } + else + { + return (getOrder(previous) - 1); + } + } + previous =3D current; + } + return 0; + } + + private int getMoveDownOrder(Window window, SortedSet set) + { + for (Iterator i =3D set.iterator(); i.hasNext();) + { + Window current =3D (Window)i.next(); + + if (current.getName().equalsIgnoreCase(window.getName())) + { + Window next =3D (Window)i.next(); + + if (next =3D=3D null) + { + return getOrder(current); + } + else + { + return (getOrder(next) + 1); + } + } + } + return 0; + } } --===============2062989894792024067==-- From portal-commits at lists.jboss.org Tue Nov 28 13:48:43 2006 Content-Type: multipart/mixed; boundary="===============2435811887928907679==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5738 - docs/trunk/referenceGuide/en Date: Tue, 28 Nov 2006 13:48:43 -0500 Message-ID: --===============2435811887928907679== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- docs/trunk/referenceGuide/en/master.xml 2006-11-28 18:18:11 UTC (rev 57= 37) +++ docs/trunk/referenceGuide/en/master.xml 2006-11-28 18:48:42 UTC (rev 57= 38) @@ -43,8 +43,6 @@ boleslaw.dawidowicz(a)jboss.com - Release 2.6DR "Ninja" - October 2006 &overview; &featurelist; --===============2435811887928907679==-- From portal-commits at lists.jboss.org Tue Nov 28 17:03:48 2006 Content-Type: multipart/mixed; boundary="===============3971957380379631900==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5739 - docs/branches/JBoss_Portal_Branch_2_4/referenceGuide/en Date: Tue, 28 Nov 2006 17:03:47 -0500 Message-ID: --===============3971957380379631900== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ boleslaw.dawidowicz(a)jboss.com - Release 2.4 "Devil" - July 2006 &overview; &featurelist; --===============3971957380379631900==-- From portal-commits at lists.jboss.org Tue Nov 28 18:04:51 2006 Content-Type: multipart/mixed; boundary="===============2052537738945266842==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5740 - docs/tags Date: Tue, 28 Nov 2006 18:04:51 -0500 Message-ID: --===============2052537738945266842== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/JBos= s_Portal_Branch_2_4) --===============2052537738945266842==-- From portal-commits at lists.jboss.org Tue Nov 28 19:44:13 2006 Content-Type: multipart/mixed; boundary="===============4678065915957215719==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] 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 Date: Tue, 28 Nov 2006 19:44:13 -0500 Message-ID: --===============4678065915957215719== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/ModifyExistingAttributeWithoutExplicitSetDoesNotReplicat= eTestCase.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/fra= mework/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/fra= mework/container/client/TestCase.java Log: - separate the session clustering tests as they conflict when they are exec= uted in the same test case (xfiles, needs to be figured out) Modified: branches/JBoss_Portal_Branch_2_4/portlet/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ - + + + @@ -606,10 +608,13 @@ + + Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/porta= l/test/framework/portlet/components/AbstractUniversalTestPortlet.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D ((PortletActionTestAction)action).execute(th= is, req, resp); @@ -209,7 +209,7 @@ // if (action !=3D 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 =3D ((PortletRenderTestAction)action).execute(this, req= , resp); Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/t= est/portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotRepl= icateTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test= /portlet/ha/session/ModifyExistingAttributeWithoutExplicitSetDoesNotReplica= teTestCase.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/ModifyExistingAttributeWithoutExplicitSetDoesNotReplica= teTestCase.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 Julien Viet + * @version $Revision: 1.1 $ + */ +public class ModifyExistingAttributeWithoutExplicitSetDoesNotReplicateTest= Case +{ + public static Test suite() + { + TestSuite suite =3D new TestSuite("test-ha-session.war", new NodeId[= ]{NodeId.PORTS_01, NodeId.PORTS_02}); + suite.addTest(new TestCase(NodeId.PORTS_01, "TestModifyExistingAttri= buteWithoutExplicitSetDoesNotReplicate")); + return suite; + } +} Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/porta= l/test/portlet/ha/session/MutableValue.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Julien Viet @@ -61,4 +62,16 @@ } return false; } + + private void writeObject(java.io.ObjectOutputStream out) throws IOExcep= tion + { + out.writeUTF(string); + System.out.print("Serializing " + string); + } + + private void readObject(java.io.ObjectInputStream in) throws IOExceptio= n, ClassNotFoundException + { + string =3D in.readUTF(); + System.out.print("Unserializing " + string); + } } Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/t= est/portlet/ha/session/ReplicateImmutableValueTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/test= /portlet/ha/session/ReplicateImmutableValueTestCase.java 2006-11-28 23:04:4= 9 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:0= 2 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 Julien Viet + * @version $Revision: 1.1 $ + */ +public class ReplicateImmutableValueTestCase +{ + public static Test suite() + { + TestSuite suite =3D new TestSuite("test-ha-session.war", new NodeId[= ]{NodeId.PORTS_01, NodeId.PORTS_02}); + suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateImmutableV= alue")); + return suite; + } +} Added: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/t= est/portlet/ha/session/ReplicateMutableValueTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Julien Viet + * @version $Revision: 1.1 $ + */ +public class ReplicateMutableValueTestCase +{ + public static Test suite() + { + TestSuite suite =3D new TestSuite("test-ha-session.war", new NodeId[= ]{NodeId.PORTS_01, NodeId.PORTS_02}); + suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateMutableVal= ue")); + return suite; + } +} Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/porta= l/test/portlet/ha/session/SessionSequenceBuilder.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 (re= v 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 (re= v 5741) @@ -32,6 +32,7 @@ import org.jboss.portal.test.framework.portlet.actions.PortletRenderTestAc= tion; 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 Julien Viet @@ -51,7 +53,7 @@ public void createTestReplicateImmutableValue(SequenceRegistry registry) { Sequence seq =3D new Sequence(); - registry.addSequence("ABC", seq); + registry.addSequence("TestReplicateImmutableValue", seq); seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new Portlet= RenderTestAction() { protected Result run(Portlet portlet, RenderRequest request, Rend= erResponse response) throws PortletException, PortletSecurityException, IOE= xception @@ -80,7 +82,7 @@ public void createTestReplicateMutableValue(SequenceRegistry registry) { Sequence seq =3D new Sequence(); - registry.addSequence("ABC", seq); + registry.addSequence("TestReplicateMutableValue", seq); seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new Portlet= RenderTestAction() { protected Result run(Portlet portlet, RenderRequest request, Rend= erResponse response) throws IOException @@ -111,7 +113,7 @@ public void createTestModifyExistingAttributeWithoutExplicitSetDoesNotR= eplicate(SequenceRegistry registry) { Sequence seq =3D new Sequence(); - registry.addSequence("ABC", seq); + registry.addSequence("TestModifyExistingAttributeWithoutExplicitSetD= oesNotReplicate", seq); seq.addAction(0, NodeId.PORTS_01, UTP1.RENDER_JOINPOINT, new Portlet= RenderTestAction() { protected Result run(Portlet portlet, RenderRequest request, Rend= erResponse response) throws IOException @@ -119,6 +121,7 @@ assertNull(request.getPortletSession(false)); PortletSession session =3D request.getPortletSession(); assertNotNull(session); + assertEquals(Collections.EMPTY_LIST, Tools.toList(session.getA= ttributeNames())); MutableValue value =3D new MutableValue("abcdef"); session.setAttribute("mutable", value); PortletURL portletURL =3D response.createRenderURL(); @@ -131,6 +134,7 @@ protected Result run(Portlet portlet, RenderRequest request, Rend= erResponse response) throws IOException { PortletSession session =3D request.getPortletSession(); + assertEquals(Collections.singletonList("mutable"), Tools.toLis= t(session.getAttributeNames())); Object o =3D session.getAttribute("mutable"); assertNotNull(o); assertEquals(MutableValue.class, o.getClass()); @@ -147,6 +151,7 @@ { PortletSession session =3D request.getPortletSession(); assertNotNull(session); + assertEquals(Collections.singletonList("mutable"), Tools.toLis= t(session.getAttributeNames())); assertEquals(new MutableValue("abcdef"), session.getAttribute(= "mutable")); return new EndTestResult(); } Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/porta= l/test/portlet/ha/session/SessionTestSuite.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D 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, "TestReplicateMutableVal= ue")); + suite.addTest(new TestCase(NodeId.PORTS_01, "TestReplicateImmutableV= alue")); + suite.addTest(new TestCase(NodeId.PORTS_01, "TestModifyExistingAttri= buteWithoutExplicitSetDoesNotReplicate")); return suite; } } Added: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test= /framework/container/client/ExtendedSimpleHttpConnectionManager.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/fr= amework/container/client/ExtendedSimpleHttpConnectionManager.java 2006-11-2= 8 23:04:49 UTC (rev 5740) +++ branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/fr= amework/container/client/ExtendedSimpleHttpConnectionManager.java 2006-11-2= 9 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 Julien Viet + * @version $Revision: 1.1 $ + */ +public class ExtendedSimpleHttpConnectionManager extends SimpleHttpConnect= ionManager +{ + public void closeConnection() + { + httpConnection.close(); + } +} Modified: branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/t= est/framework/container/client/TestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/JBoss_Portal_Branch_2_4/test/src/main/org/jboss/portal/test/fr= amework/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/fr= amework/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 =3D uri; this.testCaseId =3D testCaseId; this.requestCount =3D 0; - this.client =3D new HttpClient(new SimpleHttpConnectionManager()); + this.connManager =3D new ExtendedSimpleHttpConnectionManager(); + this.client =3D new HttpClient(connManager); = // Configure client client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, null= ); @@ -216,6 +219,9 @@ if (post !=3D null) { post.releaseConnection(); + + // + connManager.closeConnection(); } } } @@ -243,6 +249,9 @@ if (get !=3D null) { get.releaseConnection(); + + // + connManager.closeConnection(); } } } @@ -334,6 +343,7 @@ // log.info("# Invoking test case over http " + cfg + " " + method.getU= RI()); = + // return client.executeMethod(cfg, method); } = --===============4678065915957215719==-- From portal-commits at lists.jboss.org Tue Nov 28 19:55:37 2006 Content-Type: multipart/mixed; boundary="===============5331336860331959411==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5742 - branches/JBoss_Portal_Branch_2_4/portlet Date: Tue, 28 Nov 2006 19:55:37 -0500 Message-ID: --===============5331336860331959411== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ = + + + + + + + + + + + + + + + + + + + + + + + + + + + + --===============5331336860331959411==-- From portal-commits at lists.jboss.org Wed Nov 29 08:30:12 2006 Content-Type: multipart/mixed; boundary="===============0211128151570642623==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] 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 Date: Wed, 29 Nov 2006 08:30:12 -0500 Message-ID: --===============0211128151570642623== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/Confi= gMetaData.java trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Confi= gOptionMetaData.java trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Datas= ourceMetaData.java trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Datas= ourcesMetaData.java trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTest= Case.java Removed: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modul= eConfigMetaData.java trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modul= eConfigOptionMetaData.java Modified: trunk/build/ide/intellij/idea50/modules/identity/identity.iml trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigat= ionInterceptor.java trunk/identity/build.xml trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceContro= llerImpl.java trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfig= urationMetaDataFactory.java trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Ident= ityConfigurationMetaData.java trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modul= eMetaData.java trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionCo= ntext.java trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipMo= dule.java trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.j= ava trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.j= ava trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileM= odule.java trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModul= eService.java trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileMo= duleService.java trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRo= leMembershipModuleTestCase.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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-11-2= 9 00:55:35 UTC (rev 5742) +++ trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-11-2= 9 13:29:37 UTC (rev 5743) @@ -103,6 +103,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/Page= NavigationInterceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Modified: trunk/identity/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Modified: trunk/identity/src/main/org/jboss/portal/identity2/IdentityContex= t.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D "UserModule"; + public static final String TYPE_USER_MODULE =3D "User"; = - public static final String TYPE_ROLE_MODULE =3D "RoleModule"; + public static final String TYPE_ROLE_MODULE =3D "Role"; = - public static final String TYPE_MEMBERSHIP_MODULE =3D "MembershipModule= "; + public static final String TYPE_MEMBERSHIP_MODULE =3D "Membership"; = - public static final String TYPE_USER_PROFILE_MODULE =3D "UserProfileMod= ule"; + public static final String TYPE_USER_PROFILE_MODULE =3D "UserProfile"; = public static final String TYPE_CONNECTION_CONTEXT =3D "ConnectionConte= xt"; = Modified: trunk/identity/src/main/org/jboss/portal/identity2/IdentityServic= eControllerImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceContr= ollerImpl.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceContr= ollerImpl.java 2006-11-29 13:29:37 UTC (rev 5743) @@ -27,15 +27,22 @@ import org.jboss.portal.identity2.config.IdentityConfigurationMetaDataFact= ory; import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMet= aData; import org.jboss.portal.identity2.config.metadata.ModuleMetaData; -import org.jboss.portal.identity2.config.metadata.ModuleConfigOptionMetaDa= ta; +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.OptionsGroupOptionMetaDa= ta; +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 Bolesla= w Dawidowicz @@ -67,6 +73,16 @@ = private String defaultConfigFile; = + /** + * . + */ + protected Kernel kernel; + + /** + * . + */ + protected List beans; + protected void startService() throws Exception { if (jndiName !=3D null) @@ -75,6 +91,19 @@ jndiBinding.bind(); } = + //initialize microcontainer stuff + try + { + BasicBootstrap bootstrap =3D new BasicBootstrap(); + bootstrap.run(); + kernel =3D bootstrap.getKernel(); + beans =3D new ArrayList(); + } + catch (Exception e) + { + throw new IdentityException(e); + } + ClassLoader tcl =3D Thread.currentThread().getContextClassLoader(); = //TODO: make a dtd for config files. @@ -83,10 +112,22 @@ IdentityConfigurationMetaData meta =3D parseConfiguration(configFile= ); IdentityConfigurationMetaData defaultMeta =3D parseConfiguration(def= aultConfigFile); = - IdentityContextImpl context =3D new IdentityContextImpl(); - identityContext =3D context; - context.start(); + KernelControllerContext identityKernelContext; + try + { + AbstractBeanMetaData contextBMD =3D new AbstractBeanMetaData( + "portal:identity=3DIdentityContext", + IdentityContextImpl.class.getName()); + beans.add(contextBMD); + identityKernelContext =3D kernel.getController().install(contextB= MD); + identityContext =3D (IdentityContext)identityKernelContext.getTar= get(); = + } + 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 =3D new HashMap(); = - + //update modules data with defaults try { List defaultModules =3D defaultMeta.getModules().getModules(); @@ -104,10 +145,10 @@ = //check if defaults contains all information if (module.getType() =3D=3D null || - module.getImplementation() =3D=3D null || - module.getJndiName() =3D=3D null || - module.getServiceName() =3D=3D null || - module.getConfig() =3D=3D null) + module.getImplementation() =3D=3D null || + //module.getJndiName() =3D=3D null || + module.getServiceName() =3D=3D null || + module.getConfig() =3D=3D null) { throw new IdentityException("Default module configuration m= ust be complete"); } @@ -124,6 +165,7 @@ implementation =3D 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 conf= iguration file", e); } = + //map default datasources by name + Map defaultDatasources =3D new HashMap(); + for (Iterator iterator =3D defaultMeta.getDatasources().getDatasourc= es().iterator(); iterator.hasNext();) + { + DatasourceMetaData ds =3D (DatasourceMetaData)iterator.next(); + defaultDatasources.put(ds.getName(), ds); = + } + //process the list of modules, instantiate them, configure them, tid= e them try { + List datasources =3D meta.getDatasources().getDatasources(); List modules =3D meta.getModules().getModules(); = - //TODO: update configuration options from defaultMeta - //OptionsMetaData options =3D meta.getOptions(); - //inject configuration service IdentityConfigurationService configuration =3D new IdentityConfig= urationService(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 =3D modules.iterator(); iterator.hasNext()= ;) + //process datasources + for (Iterator iterator =3D datasources.iterator(); iterator.hasNe= xt();) { + DatasourceMetaData ds =3D (DatasourceMetaData)iterator.next(); + if (log.isDebugEnabled()) log.debug("processing datasource: " = + ds.getName() + "/" + ds.getClassName()); + updateDatasourceWithDefaults(ds, defaultDatasources); = - ModuleMetaData module =3D (ModuleMetaData)iterator.next(); - log.debug("Processing module: " + module.getType() + "/" + mod= ule.getImplementation()); - updateModuleWithDefaults(module, defaultImplementations); + //generate initial options + //TODO:presence of config tag should be forced in dtd + Map configOptions =3D ds.getConfig().getOptions(); + Map optionMap =3D new HashMap(); + for (Iterator iterator1 =3D configOptions.keySet().iterator();= iterator1.hasNext();) + { + String optionName =3D (String)iterator1.next(); + ConfigOptionMetaData option =3D (ConfigOptionMetaData)confi= gOptions.get(optionName); + optionMap.put(optionName, option.getValue()); + } = //instantiate the module + //IdentityModuleService moduleService =3D null; = - IdentityModuleService moduleService =3D null; = - if (module.getClassName() =3D=3D null) + if (ds.getClassName() =3D=3D null) { - throw new IdentityException("Class name not found for modul= e type: " + module.getType() + " wrong configuration"); + throw new IdentityException("Class name not found for datas= ource type: " + ds.getName() + " wrong configuration"); } = - try + /*try { moduleService =3D (IdentityModuleService)tcl.loadClass(modu= le.getClassName()).newInstance(); } - catch (InstantiationException e) + catch (Exception e) { throw new IdentityException("Unable to instantiate the clas= s: " + module.getClassName() ); + }*/ + + //instantiate datasource using MC + String entryName =3D "portal:identity=3DDatasource,type=3D" + = ds.getName(); + AbstractBeanMetaData dsBMD =3D new AbstractBeanMetaData(entryN= ame, + ds.getClassName()); + //AbstractPropertyMetaData propertyBMD =3D new AbstractPropert= yMetaData("identityContext", identityContext); + //moduleBMD.addProperty(propertyBMD); + + //initiate parameters from + for (Iterator iterator1 =3D optionMap.keySet().iterator(); ite= rator1.hasNext();) + { + String propertyKey =3D (String)iterator1.next(); + String propertyValue =3D (String)optionMap.get(propertyKey); + AbstractPropertyMetaData propertyBMD =3D new AbstractProper= tyMetaData(propertyKey, propertyValue); + dsBMD.addProperty(propertyBMD); } - catch (IllegalAccessException e) + + // Installation + beans.add(dsBMD); + KernelControllerContext controllerContext =3D kernel.getContro= ller().install(dsBMD); + Object datasource =3D controllerContext.getTarget(); + + //make a part of identityContext + //moduleService.setIdentityContext(identityContext); + + //register as an mbean + if (isRegisterMBeans()) { - e.printStackTrace(); //To change body of catch statement u= se File | Settings | File Templates. + getServer().registerMBean(datasource, new ObjectName(ds.get= ServiceName())); } - catch (ClassNotFoundException e) + + + } + + + + //process modules for instantiation + for (Iterator iterator =3D modules.iterator(); iterator.hasNext()= ;) + { + + ModuleMetaData module =3D (ModuleMetaData)iterator.next(); + if (log.isDebugEnabled()) { - e.printStackTrace(); //To change body of catch statement u= se 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 =3D module.getConfig().getOptions(); Map optionMap =3D new HashMap(); for (Iterator iterator1 =3D configOptions.keySet().iterator();= iterator1.hasNext();) { String optionName =3D (String)iterator1.next(); - ModuleConfigOptionMetaData option =3D (ModuleConfigOptionMe= taData)configOptions.get(optionName); - optionMap.put(optionName,option.getValue()); + ConfigOptionMetaData option =3D (ConfigOptionMetaData)confi= gOptions.get(optionName); + optionMap.put(optionName, option.getValue()); } = - //set options - moduleService.setInitOptions(optionMap); + //instantiate the module + //IdentityModuleService moduleService =3D null; = - moduleService.setJndiName(module.getJndiName()); = - //start - moduleService.start(); + if (module.getClassName() =3D=3D null) + { + throw new IdentityException("Class name not found for modul= e type: " + module.getType() + " wrong configuration"); + } = + /*try + { + moduleService =3D (IdentityModuleService)tcl.loadClass(modu= le.getClassName()).newInstance(); + } + catch (Exception e) + { + throw new IdentityException("Unable to instantiate the clas= s: " + module.getClassName() ); + }*/ + + //instantiate module using MC + String entryName =3D "portal:identity=3DModule,type=3D" + modu= le.getType(); + AbstractBeanMetaData moduleBMD =3D new AbstractBeanMetaData(en= tryName, + module.getClassName()); + AbstractPropertyMetaData propertyBMD =3D new AbstractPropertyM= etaData("identityContext", identityContext); + moduleBMD.addProperty(propertyBMD); + + //initiate parameters from + for (Iterator iterator1 =3D optionMap.keySet().iterator(); ite= rator1.hasNext();) + { + String propertyKey =3D (String)iterator1.next(); + String propertyValue =3D (String)optionMap.get(propertyKey); + propertyBMD =3D new AbstractPropertyMetaData(propertyKey, p= ropertyValue); + moduleBMD.addProperty(propertyBMD); + } + + // Installation + beans.add(moduleBMD); + KernelControllerContext controllerContext =3D kernel.getContro= ller().install(moduleBMD); + Object moduleService =3D (IdentityModuleService)controllerCont= ext.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() =3D=3D null) - { - module.setJndiName(def.getJndiName()); - } if (module.getServiceName() =3D=3D null) { module.setServiceName(def.getServiceName()); @@ -316,7 +441,7 @@ String key =3D (String)iterator.next(); if (!moduleOptions.containsKey(key)) { - ModuleConfigOptionMetaData o =3D (ModuleConfigOptionMetaDat= a)defOptions.get(key); + ConfigOptionMetaData o =3D (ConfigOptionMetaData)defOptions= .get(key); module.getConfig().addOption(o); } } @@ -324,7 +449,57 @@ } = /** + * updates module with proper defaults + */ + private void updateDatasourceWithDefaults(DatasourceMetaData ds, Map de= faultDS) + { + if (ds.getName() =3D=3D null) + { + return; + } + if (!defaultDS.containsKey(ds.getName())) + { + return; + } + DatasourceMetaData def =3D (DatasourceMetaData)defaultDS.get(ds.getN= ame()); + if (ds.getClassName() =3D=3D null) + { + ds.setClassName(def.getClassName()); + } + if (ds.getServiceName() =3D=3D null) + { + ds.setServiceName(def.getServiceName()); + } + + //now check if config options are overwritten + if (ds.getConfig() =3D=3D null) + { + ds.setConfig(def.getConfig()); + } + else + { + Map dsOptions =3D ds.getConfig().getOptions(); + if (dsOptions =3D=3D null) + { + return; + } + Map defOptions =3D def.getConfig().getOptions(); + + for (Iterator iterator =3D defOptions.keySet().iterator(); iterat= or.hasNext();) + { + String key =3D (String)iterator.next(); + if (!dsOptions.containsKey(key)) + { + ConfigOptionMetaData o =3D (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) =3D=3D 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/Identit= yConfigurationMetaDataFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfi= gurationMetaDataFactory.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfi= gurationMetaDataFactory.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.ModuleConfigOptionMetaDa= ta; +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.OptionsGroupOptionMetaDa= ta; +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 =3D (DatasourcesMetaData)parent; + if (child instanceof DatasourceMetaData) + { + datasources.addDatasource((DatasourceMetaData)child); + } + } + else if (parent instanceof DatasourceMetaData) + { + DatasourceMetaData datasource =3D (DatasourceMetaData)parent; + if (child instanceof ConfigMetaData) + { + datasource.setConfig((ConfigMetaData)child); + } + } + = else if (parent instanceof ModulesMetaData) { ModulesMetaData modules =3D (ModulesMetaData)parent; @@ -128,17 +168,17 @@ else if (parent instanceof ModuleMetaData) { ModuleMetaData module =3D (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 =3D (ModuleConfigMetaData)parent; - if (child instanceof ModuleConfigOptionMetaData) + ConfigMetaData config =3D (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 =3D (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 =3D (ModuleConfigOptionMetaData= )object; + ConfigOptionMetaData option =3D (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/porta= l/identity2/config/metadata/ModuleConfigMetaData.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leConfigMetaData.java 2006-11-26 02:55:41 UTC (rev 5721) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Conf= igMetaData.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 Bolesla= w Dawidowicz + * @version $Revision: 1.1 $ + */ +public class ConfigMetaData +{ + private Map options; + + + public ConfigMetaData() + { + options =3D new HashMap(); + } + + + public Map getOptions() + { + return options; + } + + public void setOptions(Map options) + { + this.options =3D 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) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leConfigOptionMetaData.java 2006-11-28 07:53:40 UTC (rev 5733) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Conf= igOptionMetaData.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 Bolesla= w Dawidowicz + * @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 =3D name; + } + + public String getValue() + { + return value; + } + + public void setValue(String value) + { + this.value =3D value; + } +} Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/D= atasourceMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Data= sourceMetaData.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Data= sourceMetaData.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 Bolesla= w Dawidowicz + * @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 =3D name; + } + + public String getServiceName() + { + return serviceName; + } + + public void setServiceName(String serviceName) + { + this.serviceName =3D serviceName; + } + + public String getClassName() + { + return className; + } + + public void setClassName(String className) + { + this.className =3D className; + } + + /*public String getJndiName() + { + return jndiName; + } + + public void setJndiName(String jndiName) + { + this.jndiName =3D jndiName; + }*/ + + public ConfigMetaData getConfig() + { + return config; + } + + public void setConfig(ConfigMetaData config) + { + this.config =3D config; + } + +} Added: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/D= atasourcesMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Data= sourcesMetaData.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Data= sourcesMetaData.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 Bolesla= w Dawidowicz + * @version $Revision: 1.1 $ + */ +public class DatasourcesMetaData +{ + private List datasources; + + + public DatasourcesMetaData() + { + datasources =3D new LinkedList(); + } + + + public List getDatasources() + { + return datasources; + } + + public void setDatasources(List datasources) + { + this.datasources =3D datasources; + } + + public void addDatasource(DatasourceMetaData datasource) + { + datasources.add(datasource); + } +} Modified: trunk/identity/src/main/org/jboss/portal/identity2/config/metadat= a/IdentityConfigurationMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Iden= tityConfigurationMetaData.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Iden= tityConfigurationMetaData.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 =3D options; } + + + public DatasourcesMetaData getDatasources() + { + return datasources; + } + + public void setDatasources(DatasourcesMetaData datasources) + { + this.datasources =3D datasources; + } } Deleted: trunk/identity/src/main/org/jboss/portal/identity2/config/metadata= /ModuleConfigMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leConfigMetaData.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leConfigMetaData.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 Bolesla= w Dawidowicz - * @version $Revision: 1.1 $ - */ -public class ModuleConfigMetaData -{ - private Map options; - - - public ModuleConfigMetaData() - { - options =3D new HashMap(); - } - - - public Map getOptions() - { - return options; - } - - public void setOptions(Map options) - { - this.options =3D 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leConfigOptionMetaData.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leConfigOptionMetaData.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 Bolesla= w Dawidowicz - * @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 =3D name; - } - - public String getValue() - { - return value; - } - - public void setValue(String value) - { - this.value =3D value; - } -} Modified: trunk/identity/src/main/org/jboss/portal/identity2/config/metadat= a/ModuleMetaData.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leMetaData.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/Modu= leMetaData.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 =3D className; } = - public String getJndiName() + /*public String getJndiName() { return jndiName; } @@ -88,14 +88,14 @@ public void setJndiName(String jndiName) { this.jndiName =3D jndiName; - } + }*/ = - public ModuleConfigMetaData getConfig() + public ConfigMetaData getConfig() { return config; } = - public void setConfig(ModuleConfigMetaData config) + public void setConfig(ConfigMetaData config) { this.config =3D config; } Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConne= ctionContext.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionC= ontext.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionC= ontext.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 Boleslaw Daw= idowicz * @version $Revision: 1.1 $ */ -public class LDAPConnectionContext extends IdentityModuleService +public class LDAPConnectionContext extends AbstractJBossService { private static final org.jboss.logging.Logger log =3D 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 =3D "simple";*/ + private String authentication =3D "simple"; = + private String host; + + private String port; + /*public LDAPConnectionContext(String name, String url, String context, @@ -77,12 +82,14 @@ this.authentication =3D authentication; }*/ = - public LDAPConnectionContext() + /*public LDAPConnectionContext() { super(IdentityContext.TYPE_CONNECTION_CONTEXT); - } + }*/ = = + + public InitialLdapContext createInitialContext() throws IdentityExcepti= on { try @@ -106,14 +113,28 @@ = protected void startService() throws Exception { - /*if (getInitOptions() =3D=3D null) + + // + if (jndiName !=3D null) { - throw new IdentityException("Cannot initialize ConnectionContext = - lack of module init options"); - }*/ + log.debug("Binding identity module to JNDI with name: " + jndiNam= e); + jndiBinding =3D 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 !=3D null) + { + jndiBinding.unbind(); + jndiBinding =3D null; + } + + } + public String toString() { StringBuffer str =3D new StringBuffer(); @@ -130,69 +151,82 @@ //************************************ //******* Getters and Setters ******** //************************************ + public String getAuthentication() + { + if (authentication =3D=3D null) + { + return "simple"; + } + return authentication; + } = - public String getName() + public void setAuthentication(String authentication) { - return getIdentityConfiguration().getValue(IdentityConfiguration.GRO= UP_CONNECTION, IdentityConfiguration.CONNECTION_NAME); - //return (String)getInitOptions().get(IdentityConfiguration.CONNECTI= ON_NAME); + this.authentication =3D authentication; } = - /*public void setName(String name) + + public String getJndiName() { - this.name =3D name; - }*/ + return jndiName; + } = - public String getHost() + public void setJndiName(String jndiName) { - return getIdentityConfiguration().getValue(IdentityConfiguration.GRO= UP_CONNECTION, IdentityConfiguration.CONNECTION_HOST); - //return (String)getInitOptions().get(IdentityConfiguration.CONNECTI= ON_HOST); + this.jndiName =3D jndiName; } = - /*public void setProviderUrl(String providerUrl) + public JNDI.Binding getJndiBinding() { - this.providerUrl =3D providerUrl; - }*/ + return jndiBinding; + } = - public String getPort() + public void setJndiBinding(JNDI.Binding jndiBinding) { - return getIdentityConfiguration().getValue(IdentityConfiguration.GRO= UP_CONNECTION, IdentityConfiguration.CONNECTION_PORT); - //return (String)getInitOptions().get(IdentityConfiguration.CONNECTI= ON_PORT); + this.jndiBinding =3D jndiBinding; } = + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name =3D name; + } + public String getContextFactory() { - return getIdentityConfiguration().getValue(IdentityConfiguration.GRO= UP_CONNECTION, IdentityConfiguration.CONNECTION_CONTEXT_FACTORY); - //return (String)getInitOptions().get(IdentityConfiguration.CONNECTI= ON_CONTEXT_FACTORY); + return contextFactory; } = - /*public void setContextFactory(String contextFactory) + public void setContextFactory(String contextFactory) { this.contextFactory =3D contextFactory; - }*/ + } = public String getAdminDN() { - return getIdentityConfiguration().getValue(IdentityConfiguration.GRO= UP_CONNECTION, IdentityConfiguration.CONNECTION_ADMIN_DN); - //return (String)getInitOptions().get(IdentityConfiguration.CONNECTI= ON_ADMIN_DN); + return adminDN; } = - /*public void setAdminDN(String adminDN) + public void setAdminDN(String adminDN) { this.adminDN =3D adminDN; - }*/ + } = public String getAdminPassword() { - return getIdentityConfiguration().getValue(IdentityConfiguration.GRO= UP_CONNECTION, IdentityConfiguration.CONNECTION_ADMIN_PASSWORD); - //return (String)getInitOptions().get(IdentityConfiguration.CONNECTI= ON_ADMIN_PASSWORD); + return adminPassword; } = - /*public void setAdminPassword(String adminPassword) + public void setAdminPassword(String adminPassword) { this.adminPassword =3D adminPassword; - }*/ + } = - /*public String getProtocol() + public String getProtocol() { return protocol; } @@ -200,27 +234,26 @@ public void setProtocol(String protocol) { this.protocol =3D protocol; - }*/ + } = - public String getAuthentication() + public String getHost() { - String auth =3D getIdentityConfiguration().getValue(IdentityConfigu= ration.GROUP_CONNECTION, IdentityConfiguration.CONNECTION_AUTHENTICATION); - //String auth =3D (String)getInitOptions().get(IdentityConfiguration= .CONNECTION_AUTHENTICATION); - if (auth =3D=3D null) - { - return "simple"; - } - return auth; + return host; } = - /*public void setAuthentication(String authentication) + public void setHost(String host) { - this.authentication =3D authentication; - }*/ + this.host =3D host; + } = - = = + public String getPort() + { + return port; + } = - - + public void setPort(String port) + { + this.port =3D port; + } } Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembe= rshipModule.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipM= odule.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipM= odule.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 Bolesla= w Dawidowicz * @version $Revision: 1.1 $ @@ -40,7 +42,12 @@ = private LDAPRoleModule roleModule; = + protected void startService() throws Exception + { + connectionContext =3D (LDAPConnectionContext)new InitialContext().lo= okup(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 IdentityE= xception { - if (connectionContext =3D=3D null) { - try - { - this.connectionContext =3D (LDAPConnectionContext)getIdentityC= ontext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); - } - catch (ClassCastException e) - { - throw new IdentityException("Not supported object as part of t= he context", e); - } + //this.connectionContext =3D (LDAPConnectionContext)getIdentityCo= ntext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); + throw new IdentityException("No LDAPConnectionContext available"); } return connectionContext; } Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleM= odule.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D (LDAPConnectionContext)new InitialContext().lo= okup(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 =3D null; @@ -143,7 +153,8 @@ { if (connectionContext =3D=3D null) { - this.connectionContext =3D (LDAPConnectionContext)getIdentityCont= ext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); + //this.connectionContext =3D (LDAPConnectionContext)getIdentityCo= ntext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); + throw new IdentityException("No LDAPConnectionContext available"); } return connectionContext; } Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserM= odule.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D (LDAPConnectionContext)new InitialContext().lo= okup(getConnectionJNDIName()); + + super.startService(); //To change body of overridden methods use = File | Settings | File Templates. + } + //TODO: add enabled public LDAPUserImpl createUserInstance(Attributes attrs, String dn) thr= ows IdentityException { @@ -184,7 +192,8 @@ { if (connectionContext =3D=3D null) { - this.connectionContext =3D (LDAPConnectionContext)getIdentityCont= ext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); + //this.connectionContext =3D (LDAPConnectionContext)getIdentityCo= ntext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); + throw new IdentityException("No LDAPConnectionContext available"); } return connectionContext; } Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserP= rofileModule.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfile= Module.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfile= Module.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 Boleslaw Daw= idowicz * @version $Revision: 1.1 $ @@ -32,8 +35,20 @@ { private LDAPConnectionContext connectionContext; = - public LDAPConnectionContext getConnectionContext() + protected void startService() throws Exception { + connectionContext =3D (LDAPConnectionContext)new InitialContext().lo= okup(getConnectionJNDIName()); + + super.startService(); //To change body of overridden methods use = File | Settings | File Templates. + } + + protected LDAPConnectionContext getConnectionContext() throws IdentityE= xception + { + if (connectionContext =3D=3D null) + { + //this.connectionContext =3D (LDAPConnectionContext)getIdentityCo= ntext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT); + throw new IdentityException("No LDAPConnectionContext available"); + } return connectionContext; } = Modified: trunk/identity/src/main/org/jboss/portal/identity2/service/Identi= tyModuleService.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModu= leService.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModu= leService.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 =3D connectionJNDIName; + } } Modified: trunk/identity/src/main/org/jboss/portal/identity2/service/UserPr= ofileModuleService.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileM= oduleService.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileM= oduleService.java 2006-11-29 13:29:37 UTC (rev 5743) @@ -45,3 +45,4 @@ = = } + Added: trunk/identity/src/main/org/jboss/portal/test/identity/Configuration= TestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTes= tCase.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTes= tCase.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 Julien Viet + * @author Bol= eslaw Dawidowicz + * @version $Revision: 5247 $ + */ +public class ConfigurationTestCase extends junit.framework.TestCase +{ + + private static final org.jboss.logging.Logger log =3D org.jboss.logging= .Logger.getLogger(ConfigurationTestCase.class); + + static + { + Appender appender =3D 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 =3D Thread.currentThread().getContextClassLoader().ge= tResource("directories.xml"); + Map parameterMap =3D new HashMap(); + parameterMap.put("DirectoryServerConfig", DSConfig.fromXML2(configsU= RL)); + POJOJUnitTest abc =3D new POJOJUnitTest(clazz); + JUnitAdapter adapter =3D new JUnitAdapter(abc); + TestSuite suite =3D new TestSuite(); + suite.addTest(adapter); + return suite; + }*/ + + public ConfigurationTestCase() + { + + } + + /*public ConfigurationTestCase(DSConfig dsConfig) + { + this.directoryServerConfigParameter =3D dsConfig; + } + + private DSConfig directoryServerConfigParameter; + + public String getName() + { + return super.getName();// + "," + directoryServerConfigParameter.get= Name() + "," + directoryServerConfigParameter.getDescription(); + } + + public DSConfig getDirectoryServerConfigParameter() + { + return directoryServerConfigParameter; + } + + public void setDirectoryServerConfigParameter(DSConfig directoryServerC= onfigParameter) + { + this.directoryServerConfigParameter =3D directoryServerConfigParamet= er; + }*/ + + IdentityContextImpl context; + + = + public void setUp() throws Exception + { + TestRuntimeContext runtimeContext =3D new TestRuntimeContext("org/jb= oss/portal/test/identity/ldap-beans.xml"); + runtimeContext.addBean("LDAPTestBean", this); + runtimeContext.start(); + this.context =3D new IdentityContextImpl(); + context.start(); + + + } + + /*public void testSimpleConfigurationFactory() throws Exception + { + SimpleConfigurationImpl configuration =3D new SimpleConfigurationImp= l(); + configuration.setIdentityContext(context); + configuration.setConfigFile("identityconfig/test-config.xml"); + configuration.start(); + Set keys =3D configuration.getOptionGroups().keySet(); + log.info("Option Groups:"); + for (Iterator iterator =3D keys.iterator(); iterator.hasNext();) + { + String group =3D (String)iterator.next(); + log.info("option-group: " + group); + + log.info("Options:"); + Set names =3D configuration.getOptions(group).keySet(); + for (Iterator iterator1 =3D names.iterator(); iterator1.hasNext()= ;) + { + String optionName =3D (String)iterator1.next(); + log.info("Name: " + optionName); + + } + + } + + + assertEquals("uid",configuration.getValue("user.uidAttributeId")); + }*/ + + + public void testIdentityServiceController() throws Exception + { + IdentityServiceControllerImpl controller =3D new IdentityServiceCont= rollerImpl(); + controller.setRegisterMBeans(false); + controller.setConfigFile("config/minimal-ldap-identity-config.xml"); + controller.setDefaultConfigFile("config/standardidentity-config.xml"= ); + controller.start(); + + IdentityModuleService service =3D (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/LDAPS= taticRoleMembershipModuleTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticR= oleMembershipModuleTestCase.java 2006-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticR= oleMembershipModuleTestCase.java 2006-11-29 13:29:37 UTC (rev 5743) @@ -86,6 +86,7 @@ ((MembershipModuleService)identityContext.getObject(IdentityContext.= TYPE_MEMBERSHIP_MODULE)).stop(); MembershipModuleService membership =3D new LDAPStaticRoleMembershipM= oduleImpl(); membership.setIdentityContext(identityContext); + membership.setConnectionJNDIName("java:/portal/LDAPConnectionContext= "); membership.start(); = userModule =3D (UserModule)identityContext.getObject(IdentityContext= .TYPE_USER_MODULE); Modified: trunk/identity/src/resources/draft/standardidentity-config.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 + + blah.IdentitySessionFactoryBinder + portal:service=3DHibernate,type=3DIdentity + + + + + + + + + + + + Dynamic + + org.jboss.portal.jems.hibernate.SessionFactoryBinder + portal:service=3DHibernate,type=3DUserDynProfile + + + + + + + + + + Modified: trunk/identity/src/resources/test/config/standardidentity-config.= xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/resources/test/config/standardidentity-config.xml 20= 06-11-29 00:55:35 UTC (rev 5742) +++ trunk/identity/src/resources/test/config/standardidentity-config.xml 20= 06-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 + + blah.IdentitySessionFactoryBinder + portal:service=3DHibernate,type=3DIdentity + + + + + + + + + + + + Dynamic + + org.jboss.portal.jems.hibernate.SessionFactoryBinder + portal:service=3DHibernate,type=3DUserDynProfile + + + + + + + + + + Modified: trunk/test/src/etc/identityconfig/opends-config.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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. = ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~--> + + + LDAP + + + + + + + + - UserModule + User LDAP + - RoleModule + Role LDAP + - MembershipModule + Membership LDAP + - UserProfileModule + UserProfile LDAP + - - - - ConnectionContext - LDAP - = - connection - - - - - - common - - connection - - - - - - common + = - RoleModule + Role DB = @@ -58,12 +96,16 @@ SessionFactoryJNDIName java:/portal/UserSessionFactory + = - MembershipModule + Membership DB = @@ -77,12 +119,16 @@ SessionFactoryJNDIName java:/portal/UserSessionFactory + = - UserProfileModule + UserProfile DB = @@ -96,13 +142,17 @@ SessionFactoryJNDIName java:/portal/UserSessionFactory + = - UserModule + User LDAP = @@ -111,12 +161,21 @@ java:/portal/UserModule = - + + + + = - RoleModule + Role LDAP = @@ -125,12 +184,21 @@ java:/portal/RoleModule = - + + + + = - MembershipModule + Membership LDAP = @@ -139,12 +207,21 @@ java:/portal/MembershipModule = - + + + + = - UserProfileModule + UserProfile LDAP = @@ -159,58 +236,28 @@ java:/portal/UserSessionFactory --> - + = - - - - ConnectionContext - LDAP - - - portal:service=3DModule,type=3DLDAPConnectionContex= t - org.jboss.portal.identity2.ldap.LDAPConnectionContext - java:/portal/LDAPConnectionContext - - - - = - - connection - - - - - - - common @@ -293,5 +340,101 @@ uid=3Ddummynonexistinguser,ou=3DPeople,dc=3Djboss,dc=3D= org + + userProfileMappings + + + + + + + + + + + \ No newline at end of file --===============0211128151570642623==-- From portal-commits at lists.jboss.org Wed Nov 29 11:36:01 2006 Content-Type: multipart/mixed; boundary="===============7512424494515602893==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] 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/ Date: Wed, 29 Nov 2006 11:36:01 -0500 Message-ID: --===============7512424494515602893== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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.j= ava 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/InstanceCo= ntainerTestCase.java trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObject= ContainerTestCase.java trunk/core/src/main/org/jboss/portal/test/core/state/ProducerTestCase.ja= va 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/t= est/identity/db-beans.xml trunk/portlet/build.xml trunk/test/src/etc/datasources.xml trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceS= upport.java trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateSu= pport.java Log: JBPORTAL-1134 : explicitly set up hibernate dialect for portal testsuite Modified: trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.= java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2= 006-11-29 13:29:37 UTC (rev 5743) +++ trunk/cms/src/main/org/jboss/portal/test/cms/AbstractCMSTestCase.java 2= 006-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 =3D new TestRuntimeContext("org/jboss/portal/cms/jbos= s-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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ = + + + + HibernateConfig + + + = @@ -48,13 +55,11 @@ - - - - + = + java:/SessionFactory Modified: trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUni= tTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D new StringReader(text); InputSource source =3D new InputSource(); source.setCharacterStream(reader); - Document doc =3D 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 ParserConfigu= rationException, SAXException, IOException + { + if (element =3D=3D null) + { + throw new IllegalArgumentException(); + } + + // + Document doc =3D buildFactory.newDocumentBuilder().newDocument(); + element =3D (Element)doc.importNode(element, true); + doc.appendChild(element); + return doc; + } + /** * Perform trimming by default * Modified: trunk/core/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ + + Julien Viet @@ -76,20 +81,23 @@ Logger.getLogger("org.hibernate").setLevel(Level.ERROR); } = -// public static TestSuite suite() throws Exception -// { -// URL configsURL =3D Thread.currentThread().getContextClassLoader().= getResource("datasources.xml"); -// DataSourceSupport.Config[] configs =3D DataSourceSupport.Config.fr= omXML(configsURL); -// DatabaseTestSuite suite =3D new DatabaseTestSuite(configs); -// suite.addTestCase(ProducerTestCase.class); -// return suite; -// } + public static TestSuite suite() throws Exception + { + TestParametrization parametrization =3D JUnitAdapter.getParametrizat= ion(); + URL configsURL =3D Thread.currentThread().getContextClassLoader().ge= tResource("datasources.xml"); + parametrization.setParameterValue("DataSourceConfig", DataSourceSupp= ort.Config.fromXML2(configsURL)); + POJOJUnitTest abc =3D new POJOJUnitTest(ProducerTestCase.class); + JUnitAdapter adapter =3D new JUnitAdapter(abc, parametrization); + TestSuite suite =3D 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 =3D config; + return super.getName() + ",ds=3D" + dataSourceConfigParameter.getDis= playName(); } = public HibernateSupport getHibernateSupport() @@ -148,11 +156,22 @@ this.portletContainer =3D portletContainer; } = - protected void setUp() throws Exception + public DataSourceSupport.Config getDataSourceConfigParameter() { + return dataSourceConfigParameter; + } + + public void setDataSourceConfigParameter(DataSourceSupport.Config dataS= ourceConfigParameter) + { + this.dataSourceConfigParameter =3D dataSourceConfigParameter; + } + + public void setUp() throws Exception + { runtimeContext =3D new TestRuntimeContext("org/jboss/portal/test/cor= e/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/te= st/core/model/instance/jboss-beans.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/cor= e/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/cor= e/model/instance/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744) @@ -40,6 +40,13 @@ = + + + + HibernateConfig + + + = @@ -52,15 +59,12 @@ = - - - - - + + = + conf/hibernate/instance/domain.hbm.xml @@ -70,6 +74,7 @@ = + conf/hibernate/portlet/domain.hbm.xml Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/te= st/core/model/portal/jboss-beans.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/cor= e/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/cor= e/model/portal/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744) @@ -34,6 +34,13 @@ = + + + + HibernateConfig + + + = @@ -46,15 +53,12 @@ = - - - - - + + = + conf/hibernate/portal/domain.hbm.xml Modified: trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/te= st/core/state/jboss-beans.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-test-jar/org/jboss/portal/test/cor= e/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/cor= e/state/jboss-beans.xml 2006-11-29 16:35:29 UTC (rev 5744) @@ -34,6 +34,13 @@ = + + + + HibernateConfig + + + = @@ -46,15 +53,12 @@ = - - - - - + + = + conf/hibernate/portlet/domain.hbm.xml Modified: trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserT= estCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCas= e.java 2006-11-29 13:29:37 UTC (rev 5743) +++ trunk/identity/src/main/org/jboss/portal/test/identity/db/DBUserTestCas= e.java 2006-11-29 16:35:29 UTC (rev 5744) @@ -121,6 +121,7 @@ runtimeContext =3D new TestRuntimeContext("org/jboss/portal/test/ide= ntity/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/p= ortal/test/identity/db-beans.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ = + + + + HibernateConfig + + + = @@ -46,15 +53,12 @@ = - - - - - + + = + java:/SessionFactory @@ -71,5 +75,4 @@ = - Modified: trunk/portlet/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ = - + Modified: trunk/test/src/etc/datasources.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~--> = + hsqldb jdbc:hsqldb:file:test Added: trunk/test/src/etc/hibernates.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ + + + + default + + + hibernate.show_sql + true + + + hibernate.auto_close_session + true + + + hibernate.transaction.flush_before_completion + true + + + hibernate.transaction.factory_class + org.hibernate.transaction.JTATransactionFactory + + + hibernate.transaction.manager_lookup_class + org.hibernate.transaction.JBossTransactionManagerLookup= + + + hibernate.cache.provider_class + org.hibernate.cache.HashtableCacheProvider + + + hibernate.cache.use_second_level_cache + false + + + hibernate.cache.use_query_cache + false + + + + + + hsqldb + + + hibernate.dialect + org.hibernate.dialect.HSQLDialect + + + + \ No newline at end of file Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/Data= SourceSupport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSource= Support.java 2006-11-29 13:29:37 UTC (rev 5743) +++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSource= Support.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 =3D "java:/DefaultDS"; = @@ -68,7 +68,7 @@ = public DataSourceSupport(Config cfg) { - this.cfg =3D cfg; + this.config =3D cfg; } = public DataSourceSupport() @@ -85,10 +85,10 @@ = // ds =3D 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 =3D connectionURL; + this.config =3D config; } = - public String getDriverClass() - { - return cfg.driverClass; - } - - public void setDriverClass(String driverClass) - { - this.cfg.driverClass =3D driverClass; - } - - public String getUserName() - { - return cfg.userName; - } - - public void setUserName(String userName) - { - this.cfg.userName =3D userName; - } - - public String getPassword() - { - return cfg.password; - } - - public void setPassword(String password) - { - this.cfg.password =3D password; - } - - public String getJndiName() - { - return jndiName; - } - - public void setJndiName(String jndiName) - { - this.jndiName =3D 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 drive= rClass, String userName, String password) Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/Hibe= rnateSupport.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateS= upport.java 2006-11-29 13:29:37 UTC (rev 5743) +++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/HibernateS= upport.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 Julien Viet @@ -44,8 +53,6 @@ public class HibernateSupport { = - public static final String DS_JNDI_NAME =3D "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 =3D mappings; } = - public Configuration getConfig() + public Config getConfig() { - return cfg; + return config; } = + public void setConfig(Config config) + { + this.config =3D config; + } + public SessionFactory getSessionFactory() { return factory; @@ -96,10 +111,8 @@ = protected void createConfiguration() { - // - cfg =3D new Configuration(); + Configuration cfg =3D new Configuration(); = - // for (Iterator i =3D mappings.iterator(); i.hasNext();) { String mapping =3D (String)i.next(); @@ -108,25 +121,21 @@ = // Properties props =3D 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.hibern= ate.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.c= ache.HashtableCacheProvider"); + props.putAll(config.properties); + cfg.addProperties(props); = // + cfg.setProperty("hibernate.connection.datasource", "java:/DefaultDS"= ); + + // if (jndiName !=3D null) { - props.setProperty("hibernate.session_factory_name", jndiName); + cfg.setProperty("hibernate.session_factory_name", jndiName); } = // - cfg.setProperties(props); - - // - settings =3D cfg.buildSettings(); + this.settings =3D cfg.buildSettings(); + this.cfg =3D cfg; } = protected void createSessionFactory() @@ -153,7 +162,7 @@ = protected void destroyConfiguration() { - cfg =3D null; + config =3D 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 =3D name; + this.properties =3D 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 =3D new LinkedHashMap(); + InputStream in =3D null; + try + { + in =3D Tools.safeBufferedWrapper(url.openStream()); + Document doc =3D XML.getDocumentBuilderFactory().newDocumentBuild= er().parse(in); + for (Iterator i =3D XML.getChildrenIterator(doc.getDocumentElemen= t(), "configuration"); i.hasNext();) + { + Element childElt =3D (Element)i.next(); + + // + Element configurationNameElt =3D XML.getUniqueChild(childElt, = "configuration-name", true); + String configurationName =3D XML.asString(configurationNameElt= ); + + // + Map properties =3D new HashMap(); + Element propertiesElt =3D XML.getUniqueChild(childElt, "proper= ties", false); + if (propertiesElt !=3D null) + { + for (Iterator j =3D XML.getChildrenIterator(propertiesElt, = "property");j.hasNext();) + { + Element propertyElt =3D (Element)j.next(); + Element nameElt =3D XML.getUniqueChild(propertyElt, "nam= e", true); + Element valueElt =3D XML.getUniqueChild(propertyElt, "va= lue", true); + String name =3D XML.asString(nameElt); + String value =3D XML.asString(valueElt); + properties.put(name, value); + } + } + + // + Config config =3D new Config(configurationName, properties); + configs.put(configurationName, config); + } + return configs; + } + finally + { + Tools.safeClose(in); + } + } + + public synchronized static Config getConfig(String name) throws Excepti= on + { + if (configs =3D=3D null) + { + URL url =3D Thread.currentThread().getContextClassLoader().getRes= ource("hibernates.xml"); + configs =3D fromXML(url); + + // Remove and merge default with all + Config defaultCfg =3D (Config)configs.remove("default"); + + // + for (Iterator i =3D configs.values().iterator();i.hasNext();) + { + Config cfg =3D (Config)i.next(); + if ("default".equals(cfg.getName()) =3D=3D false) + { + Map tmp =3D new HashMap(defaultCfg.properties); + tmp.putAll(cfg.properties); + cfg.properties =3D tmp; + } + } + + } + + // + return (Config)configs.get(name); + } } --===============7512424494515602893==-- From portal-commits at lists.jboss.org Thu Nov 30 02:43:45 2006 Content-Type: multipart/mixed; boundary="===============5770249047959248426==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r5745 - in trunk/core/src/main/org/jboss/portal/core: impl/model/portal model/portal Date: Thu, 30 Nov 2006 02:43:45 -0500 Message-ID: --===============5770249047959248426== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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/PersistentPo= rtalObjectContainer.java trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPor= talObjectContainer.java trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectConta= iner.java Log: minor javadoc improvement Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/Persi= stentPortalObjectContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentP= ortalObjectContainer.java 2006-11-29 16:35:29 UTC (rev 5744) +++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentP= ortalObjectContainer.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 =3D 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/Trans= ientPortalObjectContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPo= rtalObjectContainer.java 2006-11-29 16:35:29 UTC (rev 5744) +++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPo= rtalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745) @@ -65,12 +65,19 @@ }; } = - public void createContext() + public boolean createContext() { + if (root !=3D null) + { + return false; + } + + // root =3D new ObjectNode(ctx, "", ""); ContextImpl ctx =3D new ContextImpl(); root.setObject(ctx); ctx.setObjectNode(root); + return true; } = /** @see PortalObjectContainer#getAuthorizationDomain() */ Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObje= ctContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCont= ainer.java 2006-11-29 16:35:29 UTC (rev 5744) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCont= ainer.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(); } --===============5770249047959248426==-- From portal-commits at lists.jboss.org Thu Nov 30 17:54:00 2006 Content-Type: multipart/mixed; boundary="===============3178497988606428131==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] 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 Date: Thu, 30 Nov 2006 17:54:00 -0500 Message-ID: --===============3178497988606428131== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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.j= ava trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/ trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalCon= textImpl.java trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowCon= textImpl.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/PageCustomi= zerInterceptor.java trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResp= onseHandler.java trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCont= extFactory.java trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploym= entFactory.java trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPort= alObjectContainer.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/PersistentPo= rtalObjectContainer.java trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObject= Impl.java trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPor= talObjectContainer.java trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData.java trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalComm= andFactory.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/PortalObjectComma= ndFactory.java trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectConta= iner.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/LazyPortalO= bjectTreeNode.java trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObjec= tManagerBean.java trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/Por= talAction.java trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObject= ContainerTestCase.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 obje= cts Modified: trunk/core/build.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 @@ = - = + Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/Page= CustomizerInterceptor.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustom= izerInterceptor.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustom= izerInterceptor.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/Clas= sicResponseHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicRes= ponseHandler.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicRes= ponseHandler.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.StreamContentResp= onse; -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 =3D "default"; + public CommandForward handleResponse(ControllerContext ctx, ControllerC= ommand cmd, Object response) throws IOException, ServletException, ServerEx= ception { ServerInvocation invocation =3D ctx.getServerInvocation(); @@ -70,7 +71,7 @@ if (location =3D=3D null) { PortalObjectContainer portalObjectContainer =3D ctx.getControl= ler().getPortalObjectContainer(); - Portal portal =3D portalObjectContainer.getContext().getDefaul= tPortal(); + Portal portal =3D (Portal)portalObjectContainer.getObject(defa= ultPortalPath); RenderPageCommand renderCmd =3D new RenderPageCommand(portal.g= etId()); boolean secure =3D invocation.getServerContext().getURLContext= ().getSecure(); URLContext urlContext =3D URLContext.newInstance(secure, false= ); Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/Port= letContextFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCon= textFactory.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletCon= textFactory.java 2006-11-30 22:53:29 UTC (rev 5746) @@ -67,8 +67,8 @@ this.requestContext =3D new AbstractRequestContext(controllerContext= .getServerInvocation().getServerContext().getClientRequest(), controllerCon= text.getServerInvocation().getServerContext().getClientResponse()); this.securityContext =3D new AbstractSecurityContext(controllerConte= xt.getServerInvocation().getServerContext().getClientRequest()); this.userContext =3D new ControllerUserContext(controllerContext.get= ServerInvocation()); - this.portalContext =3D new org.jboss.portal.core.model.portal.Portal= ContextImpl(portal); - this.windowContext =3D new org.jboss.portal.core.model.portal.Window= ContextImpl(window); + this.portalContext =3D new org.jboss.portal.core.model.portal.portle= t.PortalContextImpl(portal); + this.windowContext =3D new org.jboss.portal.core.model.portal.portle= t.WindowContextImpl(window); } = public PortletContextFactory(ControllerContext controllerContext) Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/Object= DeploymentFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploy= mentFactory.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/ObjectDeploy= mentFactory.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 =3D portalObjectContainer; } - - public void registerFactory() - { - createContextIfNotExist(); - - // - super.registerFactory(); - } - - public void createContextIfNotExist() - { - // Create context if not exist - Context ctx =3D portalObjectContainer.getContext(); - - // - if (ctx =3D=3D null) - { - portalObjectContainer.createContext(); - } - } } Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/Abstr= actPortalObjectContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPor= talObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/AbstractPor= talObjectContainer.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/Conte= xtImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Julien Viet * @version $Revision$ */ -public class ContextImpl extends PortalObjectImpl implements Context +public class ContextImpl extends PortalObjectImpl implements PortalContain= er { = public ContextImpl() Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/Persi= stentPortalObjectContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentP= ortalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PersistentP= ortalObjectContainer.java 2006-11-30 22:53:29 UTC (rev 5746) @@ -45,9 +45,6 @@ public class PersistentPortalObjectContainer extends AbstractPortalObjectC= ontainer { = - /** The query for lookup. */ - private static final String LOOKUP_QUERY =3D "from ObjectNode where pat= h=3D:path"; - /** The query for lookup when the path is null. */ private static final String LOOKUP_QUERY_FOR_NULL_PATH =3D "from Object= Node where path=3D:path or path is null"; = @@ -78,6 +75,9 @@ /** . */ protected boolean cacheNaturalId; = + /** . */ + protected String rootName; + public PersistentPortalObjectContainer() { ctx =3D new ContainerContext() @@ -116,6 +116,16 @@ cache =3D new ConcurrentReaderHashMap(); } = + public String getRootName() + { + return rootName; + } + + public void setRootName(String rootName) + { + this.rootName =3D 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 !=3D null) { @@ -197,28 +210,13 @@ sessionFactory =3D 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 =3D 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/Porta= lObjectImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjec= tImpl.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjec= tImpl.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/Trans= ientPortalObjectContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPo= rtalObjectContainer.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/TransientPo= rtalObjectContainer.java 2006-11-30 22:53:29 UTC (rev 5746) @@ -30,7 +30,6 @@ * @version $Revision$ */ public class TransientPortalObjectContainer extends AbstractPortalObjectCo= ntainer -// implements AuthorizationDomain, DomainConfigurator, PermissionReposit= ory, PermissionFactory { = /** . */ @@ -65,7 +64,7 @@ }; } = - public boolean createContext() + public boolean createRootObject() { if (root !=3D null) { Modified: trunk/core/src/main/org/jboss/portal/core/metadata/PortalMetaData= .java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 buildConte= xt) throws Exception { - if (!(parent instanceof Context)) + if (!(parent instanceof PortalContainer)) { throw new IllegalArgumentException("Not a context"); } = // - Portal portal =3D ((Context)parent).createPortal(getName()); + Portal portal =3D ((PortalContainer)parent).createPortal(getName()); = // configure(portal, buildContext); Deleted: trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 200= 6-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 200= 6-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 Julien Viet - * @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 in= stance a shared context get the portal with - * the "default" name, for a private portal it gets the only portal own= ed by the user. - */ - Portal getDefaultPortal(); -} Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPor= talCommandFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCom= mandFactory.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCom= mandFactory.java 2006-11-30 22:53:29 UTC (rev 5746) @@ -36,6 +36,9 @@ */ public class DefaultPortalCommandFactory extends AbstractCommandFactory { + + private String defaultPortalPath =3D "default"; + private CommandFactory nextFactory; = private PortalObjectContainer container; @@ -65,12 +68,7 @@ ControllerCommand cmd =3D nextFactory.doMapping(invocation, portalCo= ntextPath, portalRequestPath); if (cmd =3D=3D null) { - Context ctx =3D container.getContext(); - if (ctx =3D=3D null) - { - throw new IllegalStateException("Default context does not exis= t"); - } - Portal portal =3D ctx.getDefaultPortal(); + Portal portal =3D (Portal)container.getObject(defaultPortalPath); if (portal =3D=3D null) { throw new IllegalStateException("Default portal does not exist= "); Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java 2006-1= 1-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/Page.java 2006-1= 1-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 n= ested pages. + * * @author Martin Holzner * @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 s= pecified 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/PageContai= ner.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.ja= va 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/PageContainer.ja= va 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 Julien Viet * @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 specifi= ed name already exist + * @throws IllegalArgumentException if the name argument is null + */ + Page createPage(String name) throws DuplicatePortalObjectException, Ill= egalArgumentException; } Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/Portal.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 Julien Viet * @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, Ill= egalArgumentException; - - /** Return the default page. */ Page getDefaultPage(); } Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContai= ner.java (from rev 5730, trunk/core/src/main/org/jboss/portal/core/model/po= rtal/Context.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/Context.java 200= 6-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 Julien Viet + * @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/PortalConte= xtImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImp= l.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImp= l.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 Julien Viet - * @version $Revision$ - */ -public class PortalContextImpl implements PortalContext -{ - - /** . */ - protected Portal portal; - - public PortalContextImpl(Portal portal) - { - if (portal =3D=3D null) - { - throw new IllegalStateException(); - } - this.portal =3D 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/PortalObje= ct.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.jav= a 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.jav= a 2006-11-30 22:53:29 UTC (rev 5746) @@ -40,39 +40,51 @@ /** The default portal name. */ String DEFAULT_OBJECT_NAME =3D "default"; = + /** . */ int TYPE_CONTEXT =3D 0; + + /** . */ int TYPE_PORTAL =3D 1; + + /** . */ int TYPE_PAGE =3D 2; + + /** . */ int TYPE_WINDOW =3D 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 t= he 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, Ille= galArgumentException; = - /** 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 IllegalArgum= entException; = - /** 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/PortalObje= ctCommandFactory.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectComm= andFactory.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectComm= andFactory.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 =3D null; if (portalRequestPath.length() =3D=3D 0) { - target =3D container.getContext(); + target =3D container.getRootObject(); } else { @@ -150,9 +150,9 @@ } else { - if (target instanceof Context) + if (target instanceof PortalContainer) { - Context ctx =3D (Context)target; + PortalContainer ctx =3D (PortalContainer)target; target =3D ctx.getDefaultPortal(); } if (target instanceof Portal) Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObje= ctContainer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCont= ainer.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCont= ainer.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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 h= as with instances. + * Represents a window, i.e the state of the ternary relationship a page h= as with portlet instances. * * @author Julien Viet * @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/WindowConte= xtImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImp= l.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImp= l.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 Julien Viet - * @version $Revision$ - */ -public class WindowContextImpl implements WindowContext -{ - - private final Window window; - - public WindowContextImpl(Window window) - { - if (window =3D=3D null) - { - throw new IllegalArgumentException(); - } - this.window =3D window; - } - - public String getId() - { - return window.getId(); - } -} Copied: trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/Port= alContextImpl.java (from rev 5730, trunk/core/src/main/org/jboss/portal/cor= e/model/portal/PortalContextImpl.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalContextImp= l.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/PortalCo= ntextImpl.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 Julien Viet + * @version $Revision$ + */ +public class PortalContextImpl implements PortalContext +{ + + /** . */ + protected Portal portal; + + public PortalContextImpl(Portal portal) + { + if (portal =3D=3D null) + { + throw new IllegalStateException(); + } + this.portal =3D 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/Wind= owContextImpl.java (from rev 5730, trunk/core/src/main/org/jboss/portal/cor= e/model/portal/WindowContextImpl.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/model/portal/WindowContextImp= l.java 2006-11-28 05:41:09 UTC (rev 5730) +++ trunk/core/src/main/org/jboss/portal/core/model/portal/portlet/WindowCo= ntextImpl.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 Julien Viet + * @version $Revision$ + */ +public class WindowContextImpl implements WindowContext +{ + + private final Window window; + + public WindowContextImpl(Window window) + { + if (window =3D=3D null) + { + throw new IllegalArgumentException(); + } + this.window =3D 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/Confi= gurator.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurato= r.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 =3D 0; + + private static final int MOVE_DOWN =3D 1; + private Logger log =3D Logger.getLogger(Configurator.class); = private InstanceContainer instanceContainer; @@ -65,9 +70,6 @@ = private LayoutService layoutService; = - private static final int MOVE_UP =3D 0; - private static final int MOVE_DOWN =3D 1; - public void init() throws PortletException { @@ -107,32 +109,53 @@ if (req.getParameter("editPageSelect") !=3D null) { String editPageSelect =3D req.getParameter("editPageSelect"); - page =3D portalObjectContainer.getContext().getPortal("dashboard"= ).getPage(editPageSelect); + page =3D (Page)portalObjectContainer.getObject("dashboard").getCh= ild(editPageSelect); } else { - page =3D portalObjectContainer.getContext().getPortal("dashboard"= ).getPage(req.getUser().getUserName()); + page =3D (Page)portalObjectContainer.getObject("dashboard").getCh= ild(req.getUser().getUserName()); } = List available_instances =3D (List)instanceContainer.getInstances(); + List left_instances =3D new ArrayList(); + List center_instances =3D new ArrayList(); + List right_instances =3D new ArrayList(); = - resp.setContentType("text/html"); try { Map windowMap =3D getWindows(page); - List regions =3D new ArrayList(windowMap.keySet()); Collections.sort(regions); = - req.setAttribute("windowMap", windowMap); - req.setAttribute("regions", regions); + for (Iterator i =3D regions.iterator(); i.hasNext();) + { + String region =3D (String)i.next(); + + TreeSet windows =3D (TreeSet)windowMap.get(region); + for (Iterator j =3D windows.iterator(); j.hasNext();) + { + Window window =3D (Window)j.next(); + if (region.equals("left")) + { + left_instances.add(window); + //System.out.println(window.getInstanceRef() + ":" + win= dow.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 =3D new ArrayList(); for (Iterator j =3D page.getPortal().getChildren().iterator(); j.has= Next();) { @@ -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 =3D getPortletContext().getRequestDispat= cher("/WEB-INF/jsp/dashboard/editpage.jsp"); rd.include(req, resp); } @@ -164,7 +190,7 @@ String toRegion =3D actionRequest.getParameter("toRegion"); String[] copyInstance =3D actionRequest.getParameterValues("avail= able_instances"); = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); + Page page =3D (Page)portalObjectContainer.getObject("dashboard").= getChild(editPage); try { for (int i =3D 0; i < copyInstance.length; i++) @@ -191,26 +217,20 @@ { String fromRegion =3D actionRequest.getParameter("fromRegion"); String[] removeWindows =3D null; - - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); - try + if ("left".equals(fromRegion)) { - Map windowMap =3D getWindows(page); - List regions =3D new ArrayList(windowMap.keySet()); - for (int i =3D 0; i < regions.size(); i++) - { - String region =3D (String)regions.get(i); - if (region.equalsIgnoreCase(fromRegion)) - { - removeWindows =3D actionRequest.getParameterValues(regio= n + "_instances"); - } - } + removeWindows =3D actionRequest.getParameterValues("left_insta= nces"); } - catch (Exception e) + else if ("center".equals(fromRegion)) { - // todo + removeWindows =3D actionRequest.getParameterValues("center_ins= tances"); } + else if ("right".equals(fromRegion)) + { + removeWindows =3D actionRequest.getParameterValues("right_inst= ances"); + } = + Page page =3D (Page)portalObjectContainer.getObject("dashboard").= getChild(editPage); try { for (int i =3D 0; i < removeWindows.length; i++) @@ -228,51 +248,40 @@ { String sortRegion =3D actionRequest.getParameter("sortRegion"); String[] moveWindows =3D null; + if ("left".equals(sortRegion)) + { + moveWindows =3D actionRequest.getParameterValues("left_instanc= es"); + } + else if ("center".equals(sortRegion)) + { + moveWindows =3D actionRequest.getParameterValues("center_insta= nces"); + } + else if ("right".equals(sortRegion)) + { + moveWindows =3D actionRequest.getParameterValues("right_instan= ces"); + } = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(editPage); - try + Page page =3D (Page)portalObjectContainer.getObject("dashboard").= getChild(editPage); + for (int i =3D 0; i < moveWindows.length; i++) { - Map windowMap =3D getWindows(page); - List regions =3D new ArrayList(windowMap.keySet()); - for (int i =3D 0; i < regions.size(); i++) + Window window =3D page.getWindow(moveWindows[i]); + if ("up".equals(op)) { - String region =3D (String)regions.get(i); - if (region.equalsIgnoreCase(sortRegion)) - { - moveWindows =3D actionRequest.getParameterValues(region = + "_instances"); - } + window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER= , Integer.toString(getOrder(window) - 1)); } - - SortedSet windows =3D (SortedSet)windowMap.get(sortRegion); - - for (int i =3D 0; i < moveWindows.length; i++) + else if ("down".equals(op)) { - Window window =3D page.getWindow(moveWindows[i]); - if ("up".equals(op)) - { - int order =3D getMoveUpOrder(window, windows); - window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_OR= DER, Integer.toString(order)); - } - else if ("down".equals(op)) - { - int order =3D getMoveDownOrder(window, windows); - window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_OR= DER, 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 =3D actionRequest.getParameter("pagename"); = - Page page =3D portalObjectContainer.getContext().getPortal("dashb= oard").getPage(actionRequest.getUser().getUserName()); - PageContainer pageContainer =3D (PageContainer)page.getPortal(); + Page page =3D (Page)portalObjectContainer.getObject("dashboard").= getChild(actionRequest.getUser().getUserName()); + PageContainer pageContainer =3D page.getPortal(); = try { @@ -357,50 +366,4 @@ return Integer.MAX_VALUE; } } - - private static int getMoveUpOrder(Window window, SortedSet set) - { - Window previous =3D null; - for (Iterator i =3D set.iterator(); i.hasNext();) - { - Window current =3D (Window)i.next(); - - if (current.getName().equalsIgnoreCase(window.getName())) - { - if (previous =3D=3D null) - { - return getOrder(current); - } - else - { - return (getOrder(previous) - 1); - } - } - previous =3D current; - } - return 0; - } - - private int getMoveDownOrder(Window window, SortedSet set) - { - for (Iterator i =3D set.iterator(); i.hasNext();) - { - Window current =3D (Window)i.next(); - - if (current.getName().equalsIgnoreCase(window.getName())) - { - Window next =3D (Window)i.next(); - - if (next =3D=3D null) - { - return getOrder(current); - } - else - { - return (getOrder(next) + 1); - } - } - } - return 0; - } } Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/Lazy= PortalObjectTreeNode.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortal= ObjectTreeNode.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/portlet/management/LazyPortal= ObjectTreeNode.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/Port= alObjectManagerBean.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObje= ctManagerBean.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/portlet/management/PortalObje= ctManagerBean.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 =3D portalObjectContainer.getContext(); - return new LazyPortalObjectTreeNode(context); + PortalObject root =3D portalObjectContainer.getRootObject(); + return new LazyPortalObjectTreeNode(root); } = public SelectItem[] getInstanceItems() Modified: trunk/core/src/main/org/jboss/portal/core/portlet/management/acti= ons/PortalAction.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/Po= rtalAction.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/core/portlet/management/actions/Po= rtalAction.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 =3D (Context)pomgr.getSelectedObject(); - Portal portal =3D context.createPortal(portalName); + PortalContainer portalContainer =3D (PortalContainer)pomgr.getSel= ectedObject(); + Portal portal =3D portalContainer.createPortal(portalName); DomainConfigurator configurator =3D pomgr.getDomainConfigurator(); = // Initial portal permissions Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/Porta= lObjectContainerTestCase.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjec= tContainerTestCase.java 2006-11-30 07:43:40 UTC (rev 5745) +++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjec= tContainerTestCase.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.PersistentPortalObjectConta= iner; -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 =3D container.getContext(); + PortalContainer ctx =3D (PortalContainer)container.getRootObject(); Portal portal =3D ctx.createPortal("default"); String portalId =3D portal.getId(); assertNotNull(portalId); @@ -190,7 +186,7 @@ = // hibernate.openSession(); - ctx =3D container.getContext(); + ctx =3D (PortalContainer)container.getRootObject(); assertNotNull(ctx); portal =3D ctx.getPortal("default"); assertNotNull(portal); @@ -205,7 +201,7 @@ = // hibernate.openSession(); - ctx =3D container.getContext(); + ctx =3D (PortalContainer)container.getRootObject(); assertNotNull(ctx); ctx.destroyChild("default"); portal =3D ctx.getPortal("default"); @@ -214,7 +210,7 @@ = // hibernate.openSession(); - ctx =3D container.getContext(); + ctx =3D (PortalContainer)container.getRootObject(); portal =3D ctx.getPortal("default"); assertNull(portal); assertTrue(hibernate.commitTransaction()); @@ -229,12 +225,11 @@ = // hibernate.openSession(); - container.createContext(); assertTrue(hibernate.commitTransaction()); = // hibernate.openSession(); - Context ctx =3D container.getContext(); + PortalContainer ctx =3D (PortalContainer)container.getRootObject(); Portal portal =3D ctx.createPortal("default"); assertNotNull(portal); = Modified: trunk/core/src/resources/portal-core-sar/portal-aop.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/core/src/resources/portal-core-sar/portal-aop.xml 2006-11-30 07:4= 3:40 UTC (rev 5745) +++ trunk/core/src/resources/portal-core-sar/portal-aop.xml 2006-11-30 22:5= 3:29 UTC (rev 5746) @@ -43,7 +43,6 @@ supports - Required @@ -81,8 +80,8 @@ - + class=3D"org.jboss.portal.core.impl.model.portal.PersistentPortalObj= ectContainer"> + Required --===============3178497988606428131==--