JBoss Portal SVN: r6535 - in trunk/wsrp/src: main/org/jboss/portal/wsrp/consumer and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-05 00:42:47 -0500 (Mon, 05 Mar 2007)
New Revision: 6535
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
Log:
- Added getDefaultRegistrationInfo and related initialization on ConsumerRegistry.
- Replaced REGISTRATION_NOT_NEEDED to calls to getDefaultRegistrationInfo.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-03-05 00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-03-05 05:42:47 UTC (rev 6535)
@@ -30,6 +30,7 @@
import org.jboss.portal.wsrp.consumer.ConsumerException;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
+import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import java.util.Collection;
import java.util.HashMap;
@@ -88,4 +89,9 @@
{
// do nothing
}
+
+ public RegistrationInfo getDefaultRegistrationInfo()
+ {
+ return new RegistrationInfo();
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-05 00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-03-05 05:42:47 UTC (rev 6535)
@@ -47,4 +47,6 @@
void activateConsumerWith(String id) throws ConsumerException;
void updateProducerInfo(ProducerInfo producerInfo);
+
+ RegistrationInfo getDefaultRegistrationInfo();
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-05 00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-03-05 05:42:47 UTC (rev 6535)
@@ -55,6 +55,8 @@
private String sessionFactoryJNDIName;
+ private RegistrationInfo nullRegistration;
+
public FederatingPortletInvoker getFederatingPortletInvoker()
{
return federatingPortletInvoker;
@@ -73,10 +75,12 @@
ProducerInfo info = new ProducerInfo();
info.setId(id);
info.setRegistry(this);
+ info.setRegistrationInfo(nullRegistration);
try
{
Session session = sessionFactory.getCurrentSession();
+ session.refresh(nullRegistration);
session.persist(info);
}
catch (HibernateException e)
@@ -129,6 +133,13 @@
createConsumerFrom(producerInfo);
activateConsumerWith(producerInfo.getId());
}
+
+ nullRegistration = (RegistrationInfo)session.createQuery("from RegistrationInfo where key = (select min(key) from RegistrationInfo)").uniqueResult();
+ if (nullRegistration == null)
+ {
+ nullRegistration = new RegistrationInfo();
+ session.persist(nullRegistration);
+ }
}
private WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
@@ -209,4 +220,9 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer id", null);
return (WSRPConsumer)consumers.get(id);
}
+
+ public RegistrationInfo getDefaultRegistrationInfo()
+ {
+ return nullRegistration;
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-05 00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-03-05 05:42:47 UTC (rev 6535)
@@ -118,7 +118,6 @@
{
unregisteredServiceDescriptionRequest = initUnregisteredServiceDescriptionRequest();
persistentEndpointInfo = new EndpointConfigurationInfo(this);
- persistentRegistrationInfo = RegistrationInfo.REGISTRATION_NOT_NEEDED;
}
public ConsumerRegistry getRegistry()
@@ -232,7 +231,7 @@
if (!persistentRegistrationInfo.isRegistrationValid())
{
// if this producer info was set up without any registration information, create one
- if (RegistrationInfo.REGISTRATION_NOT_NEEDED == persistentRegistrationInfo)
+ if (registry.getDefaultRegistrationInfo().equals(persistentRegistrationInfo))
{
persistentRegistrationInfo = new RegistrationInfo(this);
}
@@ -251,8 +250,6 @@
throw new PortletInvokerException("Received null response after registration from producer '" + persistentId + "'");
}
- //todo: hook to registration subsystem correctly Registration should deal with state and
- // it should be possible to create a RegistrationContext from a Registration
persistentRegistrationInfo.setRegistrationContext(registrationContext);
log.info("Successfully registered with handle: '" + registrationContext.getRegistrationHandle() + "'");
}
@@ -282,7 +279,7 @@
else
{
log.debug("Registration not required");
- setRegistrationInfo(RegistrationInfo.REGISTRATION_NOT_NEEDED);
+ setRegistrationInfo(registry.getDefaultRegistrationInfo());
setServiceDescriptionRequest(getUnregisteredServiceDescriptionRequest());
extractOfferedPortlets(serviceDescription);
return true;
@@ -566,7 +563,7 @@
WSRP_v1_PortletManagement_PortType service = getEndpointConfigurationInfo().getPortletManagementService();
GetPortletPropertyDescription request = WSRPTypeFactory.createSimpleGetPortletPropertyDescription(portletHandle);
- request.setRegistrationContext(persistentRegistrationInfo.getRegistrationContext());
+ request.setRegistrationContext(getRegistrationContext());
request.setUserContext(null); // todo: fix me!
return service.getPortletPropertyDescription(request);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-03-05 00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-03-05 05:42:47 UTC (rev 6535)
@@ -52,7 +52,6 @@
*/
public class RegistrationInfo
{
- public final static RegistrationInfo REGISTRATION_NOT_NEEDED = new RegistrationInfo();
private final Logger log = Logger.getLogger(getClass());
private Long key;
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-05 00:07:16 UTC (rev 6534)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-03-05 05:42:47 UTC (rev 6535)
@@ -33,14 +33,13 @@
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <many-to-one
- name="endpointConfigurationInfo"
- column="ENDPOINT_ID"
- class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
- unique="true"
- not-null="true"
- cascade="all"
- lazy="false"/>
+ <many-to-one name="endpointConfigurationInfo"
+ column="ENDPOINT_ID"
+ class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
+ unique="true"
+ not-null="true"
+ cascade="all"
+ lazy="false"/>
<many-to-one name="registrationInfo"
column="REGISTRATION_ID"
class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
17 years, 4 months
JBoss Portal SVN: r6534 - in trunk/wsrp: src/main/org/jboss/portal/test/wsrp/portlet and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-04 19:07:16 -0500 (Sun, 04 Mar 2007)
New Revision: 6534
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourcePortlet.java
trunk/wsrp/src/resources/tests/test-resource-portlet-war/gif/
trunk/wsrp/src/resources/tests/test-resource-portlet-war/gif/logo.gif
Modified:
trunk/wsrp/build.xml
Log:
- Added ResourcePortlet and associated resources.
- Added ResourcePortlet to test portlets packaging.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-03-05 00:05:03 UTC (rev 6533)
+++ trunk/wsrp/build.xml 2007-03-05 00:07:16 UTC (rev 6534)
@@ -579,6 +579,9 @@
<!-- ImplicitCloning test portlet -->
<package-test-portlet archiveName="implicitcloning" portletName="ImplicitCloning"/>
+
+ <!-- Resourceportlet test portlet -->
+ <package-test-portlet archiveName="resource" portletName="Resource"/>
</target>
<!-- Packages all the test related artifacts. Note that compilation should have been already executed -->
Copied: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourcePortlet.java (from rev 6530, trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/EncodeURLPortlet.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourcePortlet.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/ResourcePortlet.java 2007-03-05 00:07:16 UTC (rev 6534)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * 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.portlet;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.4 (May 6, 2006)
+ */
+public class ResourcePortlet extends GenericPortlet
+{
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ response.setContentType("text/html");
+ Writer writer = response.getWriter();
+ writer.write("<img src=\"" + response.encodeURL(request.getContextPath() + "/gif/logo.gif") + "\"/>");
+ }
+}
\ No newline at end of file
Added: trunk/wsrp/src/resources/tests/test-resource-portlet-war/gif/logo.gif
===================================================================
(Binary files differ)
Property changes on: trunk/wsrp/src/resources/tests/test-resource-portlet-war/gif/logo.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 4 months
JBoss Portal SVN: r6533 - in trunk: registration/src/main/org/jboss/portal/registration and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-04 19:05:03 -0500 (Sun, 04 Mar 2007)
New Revision: 6533
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java
Log:
- Added RegistrationPersistenceManager.getRegistrations method and implementations.
- Properly retrieve Registration from DB in RegistrationManagerImpl and remove incorrect registrations map.
Modified: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java 2007-03-05 00:03:04 UTC (rev 6532)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentPortletStatePersistenceManager.java 2007-03-05 00:05:03 UTC (rev 6533)
@@ -32,17 +32,17 @@
import org.jboss.portal.portlet.state.NoSuchStateException;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.SimplePropertyMap;
+import org.jboss.portal.portlet.state.producer.PortletStateContext;
import org.jboss.portal.portlet.state.producer.PortletStatePersistenceManager;
-import org.jboss.portal.portlet.state.producer.PortletStateContext;
import org.jboss.portal.registration.Consumer;
import org.jboss.portal.registration.ConsumerGroup;
import org.jboss.portal.registration.DuplicateRegistrationException;
import org.jboss.portal.registration.NoSuchRegistrationException;
import org.jboss.portal.registration.Registration;
import org.jboss.portal.registration.RegistrationException;
+import org.jboss.portal.registration.RegistrationLocal;
import org.jboss.portal.registration.RegistrationPersistenceManager;
import org.jboss.portal.registration.RegistrationStatus;
-import org.jboss.portal.registration.RegistrationLocal;
import javax.naming.InitialContext;
import java.util.Collection;
@@ -457,6 +457,13 @@
return query.list();
}
+ public Collection getRegistrations()
+ {
+ Session session = getCurrentSession();
+ Query query = session.createQuery("from PersistentRegistration");
+ return query.list();
+ }
+
private PersistentRegistration getRegistrationById(Session session, String registrationId) throws IllegalArgumentException, NoSuchRegistrationException
{
PersistentRegistration registration = findRegistrationById(session, registrationId);
Modified: trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java 2007-03-05 00:03:04 UTC (rev 6532)
+++ trunk/registration/src/main/org/jboss/portal/registration/RegistrationPersistenceManager.java 2007-03-05 00:05:03 UTC (rev 6533)
@@ -84,4 +84,6 @@
Consumer addConsumerToGroupNamed(String consumerId, String groupName) throws RegistrationException;
Collection getConsumers();
+
+ Collection getRegistrations();
}
Modified: trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2007-03-05 00:03:04 UTC (rev 6532)
+++ trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2007-03-05 00:05:03 UTC (rev 6533)
@@ -23,7 +23,6 @@
package org.jboss.portal.registration.impl;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.jems.as.system.AbstractJBossService;
@@ -55,12 +54,9 @@
private RegistrationPolicy policy;
private RegistrationPersistenceManager persistenceManager;
- private Map registrations;
-
public RegistrationManagerImpl()
{
- registrations = new ConcurrentHashMap();
}
public RegistrationPolicy getPolicy()
@@ -102,9 +98,6 @@
String handle = policy.createRegistrationHandleFor(registration.getId());
registration.setRegistrationHandle(handle);
- // associate the handle to the consumer for easy retrieval
- registrations.put(handle, registration);
-
return registration;
}
@@ -242,7 +235,6 @@
registration.clearAssociatedState();
persistenceManager.removeRegistration(registration.getId());
- registrations.remove(registration.getRegistrationHandle());
}
public ConsumerGroup getConsumerGroup(String groupName) throws RegistrationException
@@ -272,9 +264,8 @@
private Object getConsumerOrRegistration(String registrationHandle, boolean getConsumer)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationHandle, "registration handle", null);
- // this particular implementations uses a map though it could delegate to the registry and make a DB query to retrieve the info
- Registration registration = (Registration)registrations.get(registrationHandle);
+ Registration registration = persistenceManager.getRegistration(registrationHandle);
if (registration == null)
{
return null;
@@ -335,7 +326,7 @@
public void propertiesHaveChanged()
{
log.debug("Registration properties have changed, existing registrations will be invalidated...");
- for (Iterator regs = registrations.values().iterator(); regs.hasNext();)
+ for (Iterator regs = persistenceManager.getRegistrations().iterator(); regs.hasNext();)
{
Registration reg = (Registration)regs.next();
reg.setStatus(RegistrationStatus.INVALID);
Modified: trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java 2007-03-05 00:03:04 UTC (rev 6532)
+++ trunk/registration/src/main/org/jboss/portal/registration/impl/RegistrationPersistenceManagerImpl.java 2007-03-05 00:05:03 UTC (rev 6533)
@@ -175,6 +175,11 @@
return Collections.unmodifiableCollection(consumers.values());
}
+ public Collection getRegistrations()
+ {
+ return Collections.unmodifiableCollection(registrations.values());
+ }
+
public Collection getConsumerGroups()
{
return Collections.unmodifiableCollection(groups.values());
17 years, 4 months
JBoss Portal SVN: r6532 - in trunk: core/src/resources/test/deployment and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-04 19:03:04 -0500 (Sun, 04 Mar 2007)
New Revision: 6532
Added:
trunk/wsrp/src/resources/tests/test-resource-portlet-war/
trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/
trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/jboss-portlet.xml
trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/portlet.xml
trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/web.xml
Modified:
trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
trunk/core/src/resources/test/deployment/jboss-portlet.xml
Log:
- Added tests for isRemotable.
Modified: trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-03-04 21:55:27 UTC (rev 6531)
+++ trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-03-05 00:03:04 UTC (rev 6532)
@@ -30,8 +30,8 @@
import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
import org.jboss.portal.core.metadata.portlet.LinkElementMetaData;
+import org.jboss.portal.core.metadata.portlet.NamedMetaElementMetaData;
import org.jboss.portal.core.metadata.portlet.ScriptElementMetaData;
-import org.jboss.portal.core.metadata.portlet.NamedMetaElementMetaData;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -65,13 +65,14 @@
//
assertNotNull(app.getPortlets());
- assertEquals(1, app.getPortlets().size());
+ assertEquals(2, app.getPortlets().size());
//
- JBossPortletMetaData portlet1 = (JBossPortletMetaData)app.getPortlets().get("Portlet1");
- assertNotNull(portlet1);
- assertEquals("Portlet1", portlet1.getName());
- HeaderContentMetaData headerContent = portlet1.getHeaderContent();
+ JBossPortletMetaData portlet = (JBossPortletMetaData)app.getPortlets().get("Portlet1");
+ assertNotNull(portlet);
+ assertEquals("Portlet1", portlet.getName());
+ assertEquals(Boolean.TRUE, portlet.getRemotable());
+ HeaderContentMetaData headerContent = portlet.getHeaderContent();
assertNotNull(headerContent);
List elements = headerContent.getElements();
@@ -91,5 +92,10 @@
NamedMetaElementMetaData meta = (NamedMetaElementMetaData)elements.get(2);
assertEquals("description", meta.getNameAttribute());
assertEquals("test content", meta.getContentAttribute());
+
+ portlet = (JBossPortletMetaData)app.getPortlets().get("Portlet2");
+ assertNotNull(portlet);
+ assertEquals("Portlet2", portlet.getName());
+ assertNull(portlet.getRemotable());
}
}
Modified: trunk/core/src/resources/test/deployment/jboss-portlet.xml
===================================================================
--- trunk/core/src/resources/test/deployment/jboss-portlet.xml 2007-03-04 21:55:27 UTC (rev 6531)
+++ trunk/core/src/resources/test/deployment/jboss-portlet.xml 2007-03-05 00:03:04 UTC (rev 6532)
@@ -20,14 +20,18 @@
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-
+<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN" "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
<portlet>
<portlet-name>Portlet1</portlet-name>
+ <remotable>true</remotable>
<header-content>
<link rel="stylesheet" type="text/css" href="test.css" title="stylesheet title" media="screen"/>
<script type="text/javascript" src="test.js"/>
<meta name="description" content="test content"/>
</header-content>
</portlet>
+ <portlet>
+ <portlet-name>Portlet2</portlet-name>
+ </portlet>
</portlet-app>
\ No newline at end of file
Added: trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/jboss-portlet.xml (rev 0)
+++ trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/jboss-portlet.xml 2007-03-05 00:03:04 UTC (rev 6532)
@@ -0,0 +1,30 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2007, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<!DOCTYPE portlet-app PUBLIC "-//JBoss Portal//DTD JBoss Portlet 2.6//EN" "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+ <portlet>
+ <portlet-name>Resource Test Portlet</portlet-name>
+ <remotable>true</remotable>
+ </portlet>
+</portlet-app>
\ No newline at end of file
Added: trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/portlet.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/portlet.xml (rev 0)
+++ trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/portlet.xml 2007-03-05 00:03:04 UTC (rev 6532)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0">
+ <portlet>
+ <portlet-name>Resource Test Portlet</portlet-name>
+ <portlet-class>org.jboss.portal.test.wsrp.portlet.ResourcePortlet</portlet-class>
+
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>view</portlet-mode>
+ </supports>
+
+ <portlet-info>
+ <title>Resource Test</title>
+ </portlet-info>
+ </portlet>
+
+</portlet-app>
\ No newline at end of file
Added: trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/web.xml
===================================================================
--- trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/web.xml (rev 0)
+++ trunk/wsrp/src/resources/tests/test-resource-portlet-war/WEB-INF/web.xml 2007-03-05 00:03:04 UTC (rev 6532)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+</web-app>
\ No newline at end of file
17 years, 4 months
JBoss Portal SVN: r6531 - trunk/faces/src/main/org/jboss/portal/test/faces/el.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-04 16:55:27 -0500 (Sun, 04 Mar 2007)
New Revision: 6531
Added:
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterface.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java
Modified:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java
Log:
added test cases for DelegatingPropertyResolver acting on one of the implemented interface of a bean
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-03-04 14:38:16 UTC (rev 6530)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -32,13 +32,16 @@
public class AbstractBeanDecoratorTestCase extends TestCase
{
+ /** . */
private TestBean testBean;
+
+ /** . */
private TestBeanDecorator testBeanDecorator;
protected void setUp() throws Exception
{
testBean = new TestBean();
- testBeanDecorator = new TestBeanDecorator();
+ testBeanDecorator = new TestBeanDecorator(testBean.property);
}
@@ -52,7 +55,7 @@
{
try
{
- testBeanDecorator.getType(null, testBeanDecorator.propertyName);
+ testBeanDecorator.getType(null, testBeanDecorator.property.name);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -69,7 +72,7 @@
}
//
- assertEquals(Value.class, testBeanDecorator.getType(testBean, testBeanDecorator.propertyName));
+ assertEquals(Value.class, testBeanDecorator.getType(testBean, testBeanDecorator.property.name));
}
public void testGetValue()
@@ -85,7 +88,7 @@
try
{
- testBeanDecorator.getValue(null, testBeanDecorator.propertyName);
+ testBeanDecorator.getValue(null, testBeanDecorator.property.name);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -94,14 +97,14 @@
//
assertEquals(null, testBeanDecorator.getValue(testBean, new Object()));
- assertEquals(new PropertyValue(testBean.propertyValue), testBeanDecorator.getValue(testBean, testBeanDecorator.propertyName));
+ assertEquals(new PropertyValue(testBean.property.value), testBeanDecorator.getValue(testBean, testBeanDecorator.property.name));
}
public void testSetValue()
{
try
{
- testBeanDecorator.setValue(null, testBeanDecorator.propertyName, new Object());
+ testBeanDecorator.setValue(null, testBeanDecorator.property.name, new Object());
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -119,11 +122,11 @@
//
Value expectedValue = new Value();
- assertEquals(true, testBeanDecorator.setValue(testBean, testBeanDecorator.propertyName, expectedValue));
- assertEquals(expectedValue, testBean.propertyValue);
+ assertEquals(true, testBeanDecorator.setValue(testBean, testBeanDecorator.property.name, expectedValue));
+ assertEquals(expectedValue, testBean.property.value);
//
- assertEquals(true, testBeanDecorator.setValue(testBean, testBeanDecorator.propertyName, null));
- assertEquals(null, testBean.propertyValue);
+ assertEquals(true, testBeanDecorator.setValue(testBean, testBeanDecorator.property.name, null));
+ assertEquals(null, testBean.property.value);
}
}
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2007-03-04 14:38:16 UTC (rev 6530)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -32,9 +32,9 @@
public class AbstractDynamicBeanTestCase extends TestCase
{
+ /** . */
private TestDynamicBean testDynamicBean;
-
protected void setUp() throws Exception
{
testDynamicBean = new TestDynamicBean();
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java 2007-03-04 14:38:16 UTC (rev 6530)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -34,11 +34,28 @@
public class DelegatingPropertyResolverTestCase extends TestCase
{
+ /** . */
private Object propertyName;
+
+ /** . */
private Object bean;
+
+ /** . */
private TestBean testBean;
+
+ /** . */
private TestBeanDecorator testBeanDecorator;
+
+ /** . */
+ private TestBeanDecorator testBeanInterfaceDecorator;
+
+ /** . */
+ private TestBeanDecorator testBeanInterfaceSuperInterfaceDecorator;
+
+ /** . */
private TestDynamicBean testDynamicBean;
+
+ /** . */
private DelegatingPropertyResolver resolver;
protected void setUp() throws Exception
@@ -46,8 +63,12 @@
propertyName = new Object();
bean = new Object();
testBean = new TestBean();
- testBeanDecorator = new TestBeanDecorator();
+ testBeanDecorator = new TestBeanDecorator(testBean.property);
+ testBeanInterfaceDecorator = new TestBeanDecorator(testBean.interfaceProperty);
+ testBeanInterfaceSuperInterfaceDecorator = new TestBeanDecorator(testBean.interfaceSuperInterfaceProperty);
DelegatingPropertyResolver.registerDecorator(TestBean.class, testBeanDecorator);
+ DelegatingPropertyResolver.registerDecorator(TestBeanInterface.class, testBeanInterfaceDecorator);
+ DelegatingPropertyResolver.registerDecorator(TestBeanInterfaceSuperInterface.class, testBeanInterfaceSuperInterfaceDecorator);
testDynamicBean = new TestDynamicBean();
resolver = new DelegatingPropertyResolver();
}
@@ -63,7 +84,7 @@
{
}
- //
+ // TestBean
try
{
resolver.getType(testBean, new Object());
@@ -72,7 +93,9 @@
catch (PropertyNotFoundException expected)
{
}
- assertEquals(Value.class, resolver.getType(testBean, testBeanDecorator.propertyName));
+ assertEquals(Value.class, resolver.getType(testBean, testBeanDecorator.property.name));
+ assertEquals(Value.class, resolver.getType(testBean, testBeanInterfaceDecorator.property.name));
+ assertEquals(Value.class, resolver.getType(testBean, testBeanInterfaceSuperInterfaceDecorator.property.name));
//
try
@@ -118,7 +141,9 @@
catch (PropertyNotFoundException expected)
{
}
- assertEquals(testBean.propertyValue, resolver.getValue(testBean, testBeanDecorator.propertyName));
+ assertEquals(testBean.property.value, resolver.getValue(testBean, testBeanDecorator.property.name));
+ assertEquals(testBeanInterfaceDecorator.property.value, resolver.getValue(testBean, testBeanInterfaceDecorator.property.name));
+ assertEquals(testBeanInterfaceSuperInterfaceDecorator.property.value, resolver.getValue(testBean, testBeanInterfaceSuperInterfaceDecorator.property.name));
//
try
@@ -152,9 +177,15 @@
catch (PropertyNotFoundException expected)
{
}
- Value expectedValue = new Value();
- resolver.setValue(testBean, testBeanDecorator.propertyName, expectedValue);
- assertEquals(expectedValue, testBean.propertyValue);
+ Value propertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanDecorator.property.name, propertyExpectedValue);
+ assertEquals(propertyExpectedValue, testBeanDecorator.property.value);
+ Value interfacePropertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanInterfaceDecorator.property.name, interfacePropertyExpectedValue);
+ assertEquals(interfacePropertyExpectedValue, testBeanInterfaceDecorator.property.value);
+ Value interfaceSuperInterfacePropertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanInterfaceSuperInterfaceDecorator.property.name, interfaceSuperInterfacePropertyExpectedValue);
+ assertEquals(interfaceSuperInterfacePropertyExpectedValue, testBeanInterfaceSuperInterfaceDecorator.property.value);
//
try
@@ -165,7 +196,7 @@
catch (PropertyNotFoundException expected)
{
}
- resolver.setValue(testDynamicBean, testDynamicBean.propertyName, expectedValue);
- assertEquals(expectedValue, testDynamicBean.propertyValue);
+ resolver.setValue(testDynamicBean, testDynamicBean.propertyName, propertyExpectedValue);
+ assertEquals(propertyExpectedValue, testDynamicBean.propertyValue);
}
}
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java 2007-03-04 14:38:16 UTC (rev 6530)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -26,14 +26,42 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class TestBean
+public class TestBean implements TestBeanInterface
{
/** . */
- Value propertyValue;
+ Property property;
+ /** . */
+ Property interfaceProperty;
+
+ /** . */
+ Property interfaceSuperInterfaceProperty;
+
public TestBean()
{
- this.propertyValue = new Value();
+ this.property = new Property();
+ this.interfaceProperty = new Property();
+ this.interfaceSuperInterfaceProperty = new Property();
}
+
+ public class Property
+ {
+
+ /** . */
+ final TestBean bean;
+
+ /** . */
+ final Object name;
+
+ /** . */
+ Value value;
+
+ public Property()
+ {
+ this.bean = TestBean.this;
+ this.name = new Object();
+ this.value = new Value();
+ }
+ }
}
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java 2007-03-04 14:38:16 UTC (rev 6530)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -34,27 +34,35 @@
{
/** . */
- final Object propertyName;
+ final TestBean.Property property;
- public TestBeanDecorator()
+ public TestBeanDecorator(TestBean.Property property)
{
- propertyName = new Object();
+ this.property = property;
}
protected PropertyDecorator getProperty(Object propertyName)
{
- if (this.propertyName == propertyName)
+ if (property.name == propertyName)
{
return new AbstractPropertyDecorator(Value.class)
{
public Object getValue(Object bean) throws IllegalArgumentException
{
- return ((TestBean)bean).propertyValue;
+ if (property.bean == bean)
+ {
+ return property.value;
+ }
+ throw new IllegalArgumentException("Not the bean we expected");
}
public boolean setValue(Object bean, Object value) throws IllegalArgumentException
{
- ((TestBean)bean).propertyValue = (Value)value;
- return true;
+ if (property.bean == bean)
+ {
+ property.value = (Value)value;
+ return true;
+ }
+ return false;
}
};
}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterface.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterface.java (rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterface.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestBeanInterface extends TestBeanInterfaceSuperInterface
+{
+}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java (rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java 2007-03-04 21:55:27 UTC (rev 6531)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface TestBeanInterfaceSuperInterface
+{
+}
17 years, 4 months
JBoss Portal SVN: r6530 - in trunk: core-admin/src/main/org/jboss/portal/core/admin/ui and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-04 09:38:16 -0500 (Sun, 04 Mar 2007)
New Revision: 6530
Removed:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectBean.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectTemplate.xhtml
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
Log:
added a decorator class for PortalObject
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-03-04 14:38:16 UTC (rev 6530)
@@ -142,157 +142,172 @@
return getChildren(ALL_TYPES_MASK);
}
- public Collection getChildren(int wantedMask)
+ private class ChildrenCollection implements Collection
{
- /// Correct eventually the mask
- final int mask = wantedMask & ALL_TYPES_MASK;
- // Compute the lookup cache key
- Integer key = new Integer(mask);
+ /** . */
+ private final int mask;
- //
- Collection children = null;
- if (childrenMap == null)
+ public ChildrenCollection(int mask)
{
- childrenMap = new HashMap();
+ this.mask = mask;
}
- else
+
+ public void clear()
{
- children = (Collection)childrenMap.get(key);
+ throw new UnsupportedOperationException();
}
- //
- if (children == null)
+ public boolean add(Object o)
{
- children = new Collection()
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean remove(Object o)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean addAll(Collection c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean removeAll(Collection c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean retainAll(Collection c)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean containsAll(Collection c)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public boolean contains(Object o)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public boolean isEmpty()
+ {
+ return objectNode.getChildren().isEmpty();
+ }
+
+ public int size()
+ {
+ if (mask == ALL_TYPES_MASK)
{
- public void clear()
+ return objectNode.getChildren().size();
+ }
+ else
+ {
+ int count = 0;
+ for (Iterator i = iterator();i.hasNext();)
{
- throw new UnsupportedOperationException();
+ i.next();
+ count++;
}
+ return count;
+ }
+ }
- public boolean add(Object o)
- {
- throw new UnsupportedOperationException();
- }
+ public Object[] toArray()
+ {
+ return toArray(new Object[0]);
+ }
- public boolean remove(Object o)
- {
- throw new UnsupportedOperationException();
- }
+ public Iterator iterator()
+ {
+ return new ChildrenIterator();
+ }
- public boolean addAll(Collection c)
- {
- throw new UnsupportedOperationException();
- }
+ public Object[] toArray(Object a[])
+ {
+ ArrayList tmp = new ArrayList(objectNode.getChildren().size());
+ for (Iterator i = iterator(); i.hasNext();)
+ {
+ PortalObject child = (PortalObject)i.next();
+ tmp.add(child);
+ }
+ return tmp.toArray(a);
+ }
- public boolean removeAll(Collection c)
- {
- throw new UnsupportedOperationException();
- }
+ private class ChildrenIterator implements Iterator
+ {
- public boolean retainAll(Collection c)
- {
- throw new UnsupportedOperationException();
- }
+ /** . */
+ private final Iterator iterator = objectNode.getChildren().values().iterator();
- public boolean containsAll(Collection c)
- {
- throw new NotYetImplemented();
- }
+ /** . */
+ private PortalObject next = null;
- public boolean contains(Object o)
- {
- throw new NotYetImplemented();
- }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
- public boolean isEmpty()
+ public boolean hasNext()
+ {
+ if (next == null)
{
- return objectNode.getChildren().isEmpty();
- }
-
- public int size()
- {
- if (mask == ALL_TYPES_MASK)
+ while (next == null && iterator.hasNext())
{
- return objectNode.getChildren().size();
- }
- else
- {
- int count = 0;
- for (Iterator i = iterator();i.hasNext();)
+ ObjectNode node = (ObjectNode)iterator.next();
+ PortalObjectImpl object = node.getObject();
+ if (mask == ALL_TYPES_MASK || (object.getMask() & mask) != 0)
{
- i.next();
- count++;
+ next = object;
}
- return count;
}
}
+ return next != null;
+ }
- public Object[] toArray()
+ public Object next()
+ {
+ if (next == null)
{
- return toArray(new Object[0]);
+ hasNext();
}
-
- public Iterator iterator()
+ if (next == null)
{
- return iterator(mask);
+ throw new NoSuchElementException();
}
+ PortalObject next = this.next;
+ this.next = null;
+ return next;
+ }
+ }
+ }
- public Object[] toArray(Object a[])
- {
- ArrayList tmp = new ArrayList(objectNode.getChildren().size());
- for (Iterator i = iterator(); i.hasNext();)
- {
- PortalObject child = (PortalObject)i.next();
- tmp.add(child);
- }
- return tmp.toArray(a);
- }
+ public Collection getChildren(int wantedMask)
+ {
+ /// Correct eventually the mask
+ final int mask = wantedMask & ALL_TYPES_MASK;
- public Iterator iterator(final int mask)
- {
- return new Iterator()
- {
- Iterator iterator = objectNode.getChildren().values().iterator();
- PortalObject next = null;
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
- public boolean hasNext()
- {
- if (next == null)
- {
- while (next == null && iterator.hasNext())
- {
- ObjectNode node = (ObjectNode)iterator.next();
- PortalObjectImpl object = node.getObject();
- if (mask == ALL_TYPES_MASK || (object.getMask() & mask) != 0)
- {
- next = object;
- }
- }
- }
- return next != null;
- }
- public Object next()
- {
- if (next == null)
- {
- hasNext();
- }
- if (next == null)
- {
- throw new NoSuchElementException();
- }
- PortalObject next = this.next;
- this.next = null;
- return next;
- }
- };
- }
- };
+ // Compute the lookup cache key
+ Integer key = new Integer(mask);
+
+ //
+ Collection children = null;
+ if (childrenMap == null)
+ {
+ childrenMap = new HashMap();
+ }
+ else
+ {
+ children = (Collection)childrenMap.get(key);
+ }
+
+ //
+ if (children == null)
+ {
+ children = new ChildrenCollection(mask);
childrenMap.put(key, children);
}
return children;
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-04 14:38:16 UTC (rev 6530)
@@ -33,12 +33,14 @@
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.instance.InstanceDefinition;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectId;
import javax.faces.context.FacesContext;
import java.util.Set;
import java.util.Locale;
import java.util.ArrayList;
+import java.util.List;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -151,6 +153,7 @@
});
DelegatingPropertyResolver.registerDecorator(Portlet.class, portletDecorator);
+ //
SimpleBeanDecorator instanceDecorator = new SimpleBeanDecorator();
instanceDecorator.setProperty("portlet", new AbstractPropertyDecorator(Portlet.class)
{
@@ -168,9 +171,52 @@
}
}
});
+ DelegatingPropertyResolver.registerDecorator(Instance.class, instanceDecorator);
//
- DelegatingPropertyResolver.registerDecorator(InstanceDefinition.class, instanceDecorator);
+ SimpleBeanDecorator portalObjectDecorator = new SimpleBeanDecorator()
+ {
+ private List getChildren(PortalObject object, int mask)
+ {
+ return new ArrayList(object.getChildren(mask));
+ }
+ {
+ setProperty("portals", new AbstractPropertyDecorator(PortalObject.class)
+ {
+ public Object getValue(Object bean)
+ {
+ PortalObject object = (PortalObject)bean;
+ return getChildren(object, PortalObject.PORTAL_MASK);
+ }
+ });
+ setProperty("pages", new AbstractPropertyDecorator(PortalObject.class)
+ {
+ public Object getValue(Object bean)
+ {
+ PortalObject object = (PortalObject)bean;
+ return getChildren(object, PortalObject.PAGE_MASK);
+ }
+ });
+ setProperty("windows", new AbstractPropertyDecorator(PortalObject.class)
+ {
+ public Object getValue(Object bean)
+ {
+ PortalObject object = (PortalObject)bean;
+ return getChildren(object, PortalObject.WINDOW_MASK);
+ }
+ });
+ }
+ };
+ portalObjectDecorator.setProperty("id", new AbstractPropertyDecorator(PortalObject.class)
+ {
+ public Object getValue(Object bean)
+ {
+ PortalObject object = (PortalObject)bean;
+ PortalObjectId id = object.getId();
+ return id.toString(PortalObjectId.LEGACY_BASE64_FORMAT);
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(PortalObject.class, portalObjectDecorator);
}
}
Deleted: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectBean.java 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectBean.java 2007-03-04 14:38:16 UTC (rev 6530)
@@ -1,72 +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.admin.ui;
-
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PortalObjectBean
-{
- private PortalObject po;
- private PortalObjectBean parent;
-
-
- public PortalObjectBean(PortalObject po)
- {
- this.po = po;
- }
-
- public String getId()
- {
- return po.getId().toString(PortalObjectId.LEGACY_BASE64_FORMAT);
- }
-
- public String getName()
- {
- return po.getName();
- }
-
- public PortalObjectBean getParent()
- {
- if ((parent == null) || (po.getParent() != parent.getPortalObject()))
- {
- parent = new PortalObjectBean(po.getParent());
- }
- return parent;
- }
-
- public int getType()
- {
- return po.getType();
- }
-
- public PortalObject getPortalObject()
- {
- return po;
- }
-
-}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-04 14:38:16 UTC (rev 6530)
@@ -132,9 +132,6 @@
private PortalObject selectedObject;
/** . */
- private PortalObjectBean selectedObjectBean;
-
- /** . */
private List selectedProperties;
// Wired services
@@ -267,21 +264,6 @@
return portalObjectContainer.getObject(id);
}
- public List getPortalNodes()
- {
- return getNodes(PortalObject.PORTAL_MASK);
- }
-
- public List getPageNodes()
- {
- return getNodes(PortalObject.PAGE_MASK);
- }
-
- public List getWindowNodes()
- {
- return getNodes(PortalObject.WINDOW_MASK);
- }
-
public SelectItem[] getInstanceItems()
{
if (instanceItems == null)
@@ -325,7 +307,7 @@
ArrayList path = new ArrayList();
while (o != null)
{
- path.add(new PortalObjectBean(o));
+ path.add(o);
o = o.getParent();
}
Collections.reverse(path);
@@ -347,15 +329,6 @@
return selectedObject;
}
- public PortalObjectBean getSelectedObjectBean()
- {
- if (selectedObjectBean == null)
- {
- selectedObjectBean = new PortalObjectBean(getSelectedObject());
- }
- return selectedObjectBean;
- }
-
public List getSelectedProperties()
{
if (selectedProperties == null)
@@ -507,19 +480,6 @@
}
}
- private List getNodes(int mask)
- {
- Collection test = getSelectedObject().getChildren(mask);
- ArrayList result = new ArrayList();
- Iterator it = test.iterator();
- while (it.hasNext())
- {
- PortalObject po = (PortalObject)it.next();
- result.add(new PortalObjectBean(po));
- }
- return result;
- }
-
/** Returns a <Region,<Window>SortedSet>Map. */
private Map getWindows(Page page) throws Exception
{
@@ -604,7 +564,6 @@
portalPageItems = null;
selectedObjectPath = null;
selectedObject = null;
- selectedObjectBean = null;
selectedProperties = null;
}
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-03-04 14:38:16 UTC (rev 6530)
@@ -10,7 +10,7 @@
<table width="100%">
- <c:if test="#{not empty portalobjectmgr.portalNodes}">
+ <c:if test="#{not empty portalobjectmgr.selectedObject.portals}">
<tbody class="portlet-section-header">
<tr>
<th>Portal</th>
@@ -18,7 +18,7 @@
</tr>
</tbody>
<tbody>
- <c:forEach items="#{portalobjectmgr.portalNodes}" var="object" varStatus="status">
+ <c:forEach items="#{portalobjectmgr.selectedObject.portals}" var="object" varStatus="status">
<tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
<td>
<h:commandLink action="#{portalobjectmgr.selectObject}">
@@ -43,7 +43,7 @@
</tbody>
</c:if>
- <c:if test="#{not empty portalobjectmgr.pageNodes}">
+ <c:if test="#{not empty portalobjectmgr.selectedObject.pages}">
<tbody class="portlet-section-header">
<tr>
<th>Page</th>
@@ -51,7 +51,7 @@
</tr>
</tbody>
<tbody>
- <c:forEach items="#{portalobjectmgr.pageNodes}" var="object" varStatus="status">
+ <c:forEach items="#{portalobjectmgr.selectedObject.pages}" var="object" varStatus="status">
<tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
<td>
<h:commandLink action="#{portalobjectmgr.selectObject}">
@@ -79,7 +79,7 @@
</tbody>
</c:if>
- <c:if test="#{not empty portalobjectmgr.windowNodes}">
+ <c:if test="#{not empty portalobjectmgr.selectedObject.windows}">
<tbody class="portlet-section-header">
<tr>
<th>Window</th>
@@ -87,7 +87,7 @@
</tr>
</tbody>
<tbody>
- <c:forEach items="#{portalobjectmgr.windowNodes}" var="object" varStatus="status">
+ <c:forEach items="#{portalobjectmgr.selectedObject.windows}" var="object" varStatus="status">
<tr class="#{status.index % 2 == 0 ? 'portlet-section-body' : 'portlet-section-alternate'}">
<td>
<h:commandLink action="#{portalobjectmgr.selectObject}">
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectTemplate.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectTemplate.xhtml 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectTemplate.xhtml 2007-03-04 14:38:16 UTC (rev 6530)
@@ -20,7 +20,7 @@
>
</li>
<c:choose>
- <c:when test="#{node.id == portalobjectmgr.selectedObjectBean.id}">
+ <c:when test="#{node.id == portalobjectmgr.selectedObject.id}">
<li class="selected">
<c:if test="#{node.name == ''}">root</c:if>
<c:if test="#{node.name != ''}">#{node.name}</c:if>
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-03-04 13:39:03 UTC (rev 6529)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-03-04 14:38:16 UTC (rev 6530)
@@ -90,14 +90,10 @@
}
//
- BeanDecorator decorator = resolveTypeDef(base);
- if (decorator != null)
+ GetTypeBeanAction beanAction = new GetTypeBeanAction(base, property);
+ if (resolveAction(base.getClass(), beanAction))
{
- Class type = decorator.getType(base, property);
- if (type != null)
- {
- return type;
- }
+ return beanAction.type;
}
//
@@ -122,7 +118,7 @@
throw createPNFE(base, property);
}
- public Object getValue(Object base, Object property) throws EvaluationException, PropertyNotFoundException
+ public Object getValue(final Object base, final Object property) throws EvaluationException, PropertyNotFoundException
{
// See if the object can handle itself the property
if (base instanceof DynamicBean)
@@ -136,14 +132,10 @@
}
//
- BeanDecorator decorator = resolveTypeDef(base);
- if (decorator != null)
+ GetValueBeanAction beanAction = new GetValueBeanAction(base, property);
+ if (resolveAction(base.getClass(), beanAction))
{
- PropertyValue nav = decorator.getValue(base, property);
- if (nav != null)
- {
- return nav.getObject();
- }
+ return beanAction.value.getObject();
}
//
@@ -169,13 +161,10 @@
}
//
- BeanDecorator decorator = resolveTypeDef(base);
- if (decorator != null)
+ SetValueBeanAction beanAction = new SetValueBeanAction(base, property, value);
+ if (resolveAction(base.getClass(), beanAction))
{
- if (decorator.setValue(base, property, value))
- {
- return;
- }
+ return;
}
//
@@ -236,32 +225,101 @@
throw createPNFE(base, index);
}
- /**
- * Resolve the type def from the provided object. First the class name is used to lookup a type def. If none is found
- * then the implemented interfaces are examined to see if one can provide a type def.
- *
- * @param base the object to resolve the type def
- * @return the type def if found, null otherwise
- * @todo implement merging of type def if more than one is found
- */
- private BeanDecorator resolveTypeDef(Object base)
+ private static interface BeanAction
{
- Class clazz = base.getClass();
- BeanDecorator typeDef = (BeanDecorator)decoratorMap.get(clazz.getName());
- if (typeDef == null)
+ boolean execute(BeanDecorator decorator);
+ }
+
+ private abstract static class AbstractBeanAction implements BeanAction
+ {
+
+ /** . */
+ protected final Object base;
+
+ /** . */
+ protected final Object property;
+
+ public AbstractBeanAction(Object base, Object property)
{
- Class[] itfs = clazz.getInterfaces();
- for (int i = 0; i < itfs.length; i++)
+ this.base = base;
+ this.property = property;
+ }
+ }
+
+ private static class GetTypeBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private Class type;
+
+ public GetTypeBeanAction(Object base, Object property)
+ {
+ super(base, property);
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ type = decorator.getType(base, property);
+ return type != null;
+ }
+ }
+
+ private static class GetValueBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private PropertyValue value;
+
+ public GetValueBeanAction(Object base, Object property)
+ {
+ super(base, property);
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ value = decorator.getValue(base, property);
+ return value != null;
+ }
+ }
+
+ private static class SetValueBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private Object value;
+
+ public SetValueBeanAction(Object base, Object property, Object value)
+ {
+ super(base, property);
+ this.value = value;
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ return decorator.setValue(base, property, value);
+ }
+ }
+
+ private boolean resolveAction(Class clazz, BeanAction action)
+ {
+ BeanDecorator decorator = (BeanDecorator)decoratorMap.get(clazz.getName());
+ if (decorator != null)
+ {
+ if (action.execute(decorator))
{
- Class itf = clazz.getInterfaces()[i];
- typeDef = (BeanDecorator)decoratorMap.get(itf.getName());
- if (typeDef != null)
- {
- break;
- }
+ return true;
}
}
- return typeDef;
+ Class[] itfs = clazz.getInterfaces();
+ for (int i = 0; i < itfs.length; i++)
+ {
+ Class itf = clazz.getInterfaces()[i];
+ if (resolveAction(itf, action))
+ {
+ return true;
+ }
+ }
+ return false;
}
private PropertyNotFoundException createPNFE(Object base, int index)
17 years, 4 months
JBoss Portal SVN: r6529 - trunk/core-admin/src/main/org/jboss/portal/core/admin/ui.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-04 08:39:03 -0500 (Sun, 04 Mar 2007)
New Revision: 6529
Added:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
Log:
move all bean decorators into a single BeanDecorators class
Added: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/BeanDecorators.java 2007-03-04 13:39:03 UTC (rev 6529)
@@ -0,0 +1,176 @@
+/******************************************************************************
+ * 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.admin.ui;
+
+import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
+import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
+import org.jboss.portal.faces.el.DelegatingPropertyResolver;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.common.util.LocalizedString;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.instance.InstanceDefinition;
+
+import javax.faces.context.FacesContext;
+import java.util.Set;
+import java.util.Locale;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class BeanDecorators
+{
+
+ static
+ {
+ SimpleBeanDecorator roleModuleDecorator = new SimpleBeanDecorator();
+ roleModuleDecorator.setProperty("roles", new AbstractPropertyDecorator(Set.class)
+ {
+ public Object getValue(Object bean)
+ {
+ try
+ {
+ RoleModule module = (RoleModule)bean;
+ return module.findRoles();
+ }
+ catch (IdentityException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(RoleModule.class, roleModuleDecorator);
+
+ //
+ SimpleBeanDecorator localizedStringDecorator = new SimpleBeanDecorator();
+ localizedStringDecorator.setProperty("value", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean)
+ {
+ LocalizedString string = (LocalizedString)bean;
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ Locale locale = ctx.getExternalContext().getRequestLocale();
+ return string.getString(locale, true);
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(LocalizedString.class, localizedStringDecorator);
+
+ //
+ SimpleBeanDecorator portletDecorator = new SimpleBeanDecorator();
+ portletDecorator.setProperty("name", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
+ }
+ });
+ portletDecorator.setProperty("description", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
+ }
+ });
+ portletDecorator.setProperty("keywords", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return portlet.getInfo().getMeta().getMetaValue(MetaInfo.KEYWORDS);
+ }
+ });
+ portletDecorator.setProperty("title", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return portlet.getInfo().getMeta().getMetaValue(MetaInfo.TITLE);
+ }
+ });
+ portletDecorator.setProperty("remotable", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ PortletInfo info = portlet.getInfo();
+ return info.isRemotable();
+ }
+ });
+ portletDecorator.setProperty("modes", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return portlet.getInfo().getCapabilities().getModes("text/html");
+ }
+ });
+ portletDecorator.setProperty("windowStates", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return portlet.getInfo().getCapabilities().getWindowStates("text/html");
+ }
+ });
+ portletDecorator.setProperty("locales", new AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ return new ArrayList(portlet.getInfo().getCapabilities().getAllLocales());
+ }
+ });
+ DelegatingPropertyResolver.registerDecorator(Portlet.class, portletDecorator);
+
+ SimpleBeanDecorator instanceDecorator = new SimpleBeanDecorator();
+ instanceDecorator.setProperty("portlet", new AbstractPropertyDecorator(Portlet.class)
+ {
+ public Object getValue(Object bean)
+ {
+ Instance instance = (Instance)bean;
+ try
+ {
+ return instance.getPortlet();
+ }
+ catch (PortletInvokerException e)
+ {
+ // If the portlet is not available we want to avoid the stack trace and rather return null
+ return null;
+ }
+ }
+ });
+
+ //
+ DelegatingPropertyResolver.registerDecorator(InstanceDefinition.class, instanceDecorator);
+ }
+
+}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-03-04 13:23:51 UTC (rev 6528)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/InstanceManagerBean.java 2007-03-04 13:39:03 UTC (rev 6529)
@@ -40,12 +40,7 @@
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.instance.NoSuchInstanceException;
-import org.jboss.portal.core.model.instance.InstanceDefinition;
-import org.jboss.portal.faces.el.DelegatingPropertyResolver;
-import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
-import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.PreferencesInfo;
import org.jboss.portal.portlet.info.PreferenceInfo;
@@ -424,29 +419,4 @@
};
}
}
-
- static
- {
- SimpleBeanDecorator instanceDecorator = new SimpleBeanDecorator();
-
- // If the portlet is not available we want to avoid the stack trace and rather return null
- instanceDecorator.setProperty("portlet", new AbstractPropertyDecorator(Portlet.class)
- {
- public Object getValue(Object bean)
- {
- Instance instance = (Instance)bean;
- try
- {
- return instance.getPortlet();
- }
- catch (PortletInvokerException e)
- {
- return null;
- }
- }
- });
-
- //
- DelegatingPropertyResolver.registerDecorator(InstanceDefinition.class, instanceDecorator);
- }
}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-04 13:23:51 UTC (rev 6528)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-03-04 13:39:03 UTC (rev 6529)
@@ -30,9 +30,7 @@
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
-import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -43,7 +41,6 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.common.util.LocalizedString;
import org.jboss.portal.core.model.instance.Instance;
import org.jboss.portal.core.model.instance.InstanceContainer;
import org.jboss.portal.core.model.portal.Page;
@@ -54,14 +51,7 @@
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.model.content.Content;
import org.jboss.portal.core.admin.ui.actions.WindowComparator;
-import org.jboss.portal.faces.el.DelegatingPropertyResolver;
-import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
-import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
-import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.security.AuthorizationDomainRegistry;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
@@ -81,113 +71,6 @@
/** The serialVersionUID */
private static final long serialVersionUID = -8923517554726982622L;
- static
- {
- SimpleBeanDecorator roleModuleDecorator = new SimpleBeanDecorator();
- roleModuleDecorator.setProperty("roles", new AbstractPropertyDecorator(Set.class)
- {
- public Object getValue(Object bean)
- {
- try
- {
- RoleModule module = (RoleModule)bean;
- return module.findRoles();
- }
- catch (IdentityException e)
- {
- e.printStackTrace();
- return null;
- }
- }
- });
-
- //
- SimpleBeanDecorator localizedStringDecorator = new SimpleBeanDecorator();
- localizedStringDecorator.setProperty("value", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean)
- {
- LocalizedString string = (LocalizedString)bean;
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
- return string.getString(locale, true);
- }
- });
-
- //
- SimpleBeanDecorator portletDecorator = new SimpleBeanDecorator();
- portletDecorator.setProperty("name", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
- }
- });
- portletDecorator.setProperty("description", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
- }
- });
- portletDecorator.setProperty("keywords", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getMeta().getMetaValue(MetaInfo.KEYWORDS);
- }
- });
- portletDecorator.setProperty("title", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getMeta().getMetaValue(MetaInfo.TITLE);
- }
- });
- portletDecorator.setProperty("remotable", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- PortletInfo info = portlet.getInfo();
- return info.isRemotable();
- }
- });
- portletDecorator.setProperty("modes", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getCapabilities().getModes("text/html");
- }
- });
- portletDecorator.setProperty("windowStates", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return portlet.getInfo().getCapabilities().getWindowStates("text/html");
- }
- });
- portletDecorator.setProperty("locales", new AbstractPropertyDecorator(String.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- Portlet portlet = (Portlet)bean;
- return new ArrayList(portlet.getInfo().getCapabilities().getAllLocales());
- }
- });
-
- //
- DelegatingPropertyResolver.registerDecorator(LocalizedString.class, localizedStringDecorator);
- DelegatingPropertyResolver.registerDecorator(RoleModule.class, roleModuleDecorator);
- DelegatingPropertyResolver.registerDecorator(Portlet.class, portletDecorator);
- }
-
/** . */
private Logger log = Logger.getLogger(getClass());
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-04 13:23:51 UTC (rev 6528)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-04 13:39:03 UTC (rev 6529)
@@ -57,8 +57,15 @@
{
/** . */
- private Logger log = Logger.getLogger(getClass());
+ private static final Logger log = Logger.getLogger(PortletManagerBean.class);
+ static
+ {
+ // For the loading of the class that will load the decorators
+ Class clazz = BeanDecorators.class;
+ log.debug("Loaded bean decorator class " + clazz.getName());
+ }
+
// Wired services
/** . */
17 years, 4 months
JBoss Portal SVN: r6528 - trunk/core-admin/src/main/org/jboss/portal/core/admin/ui.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-04 08:23:51 -0500 (Sun, 04 Mar 2007)
New Revision: 6528
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
Log:
set the selected portlet id to null when changing the portlet invoker selection
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-04 13:18:11 UTC (rev 6527)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortletManagerBean.java 2007-03-04 13:23:51 UTC (rev 6528)
@@ -28,7 +28,6 @@
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -188,6 +187,7 @@
public void setSelectedPortletInvokerId(String selectedPortletInvokerId)
{
this.selectedPortletInvokerId = selectedPortletInvokerId;
+ this.selectedPortletId = null;
}
// Runtime state
@@ -221,10 +221,6 @@
public PreferencesBean getSelectedPreferences()
{
- // Get user locale
- FacesContext ctx = FacesContext.getCurrentInstance();
- Locale locale = ctx.getExternalContext().getRequestLocale();
-
// Get portlet
Portlet portlet = getSelectedPortlet();
17 years, 4 months
JBoss Portal SVN: r6527 - trunk/core/src/main/org/jboss/portal/core/impl/model/portal.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-04 08:18:11 -0500 (Sun, 04 Mar 2007)
New Revision: 6527
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java
Log:
remove system.out.println
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java 2007-03-04 06:09:39 UTC (rev 6526)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/ObjectNode.java 2007-03-04 13:18:11 UTC (rev 6527)
@@ -232,7 +232,6 @@
public void setChildren(Map children)
{
- System.out.println("Set on " + path + " " + children);
this.children = children;
}
17 years, 4 months
JBoss Portal SVN: r6526 - trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-03-04 01:09:39 -0500 (Sun, 04 Mar 2007)
New Revision: 6526
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
Log:
- No need to create a new EndpointConfigurationInfo, just reuse the one from ProducerInfo.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-03-04 02:21:15 UTC (rev 6525)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-03-04 06:09:39 UTC (rev 6526)
@@ -147,7 +147,7 @@
if ("endpoint-config".equals(localName) || "endpoint-wsdl-url".equals(localName))
{
- return new EndpointConfigurationInfo(prodInfo);
+ return prodInfo.getEndpointConfigurationInfo();
}
else if ("registration-data".equals(localName))
{
17 years, 4 months