Author: julien(a)jboss.com
Date: 2007-03-20 20:52:41 -0400 (Tue, 20 Mar 2007)
New Revision: 6785
Removed:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/spi/
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java
Log:
portlet federation simplification based on Chris suggestion
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/FederatingPortletInvoker.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.federation;
import org.jboss.portal.portlet.PortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import java.util.Collection;
@@ -37,29 +36,22 @@
public interface FederatingPortletInvoker extends PortletInvoker
{
/**
- * Register an invoker.
+ * Registers an invoker.
*
- * @param registration the invoker to register
+ * @param federatedId the invoker id to register
+ * @param registeredInvoker the invoker to register
* @throws IllegalArgumentException if the invoker is null or already registered
*/
- FederatedPortletInvoker registerInvoker(PortletInvokerRegistration registration)
throws IllegalArgumentException;
+ FederatedPortletInvoker registerInvoker(String federatedId, PortletInvoker
registeredInvoker) throws IllegalArgumentException;
/**
- * Unregister an invoker.
- *
- * @param registration the invoker to unregister
- * @throws IllegalArgumentException if invoker is null or not registered
- */
- void unregisterInvoker(PortletInvokerRegistration registration) throws
IllegalArgumentException;
-
- /**
* Return a portlet invoker registered or null if not found
*
- * @param id the id
+ * @param federatedId the id
* @return the invoker
* @throws IllegalArgumentException if the id is null
*/
- FederatedPortletInvoker getFederatedInvoker(String id) throws
IllegalArgumentException;
+ FederatedPortletInvoker getFederatedInvoker(String federatedId) throws
IllegalArgumentException;
/**
* Return the registered portlet invokers.
@@ -71,9 +63,9 @@
/**
* Unregisters the invoker associated with the specified identifier.
*
- * @param id the identifier of the invoker to unregister
+ * @param federatedId the identifier of the invoker to unregister
* @throws IllegalArgumentException if the identifier is null or no invoker is
registered with this identifier
* @since 2.6
*/
- void unregisterInvoker(String id);
+ void unregisterInvoker(String federatedId);
}
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatedPortletInvokerService.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
@@ -63,10 +62,10 @@
/** . */
private FederatingPortletInvoker federatingPortletInvoker;
- public FederatedPortletInvokerService(FederatingPortletInvoker
federatingPortletInvoker, PortletInvokerRegistration registration)
+ public FederatedPortletInvokerService(FederatingPortletInvoker
federatingPortletInvoker, String id, PortletInvoker portletInvoker)
{
- this.id = registration.getId();
- this.portletInvoker = registration.getPortletInvoker();
+ this.id = id;
+ this.portletInvoker = portletInvoker;
this.federatingPortletInvoker = federatingPortletInvoker;
}
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/FederatingPortletInvokerService.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -28,9 +28,9 @@
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.state.PropertyChange;
@@ -58,57 +58,51 @@
static final String SEPARATOR = ".";
/** The registred FederatedPortletInvokers. */
- private Map registry = new HashMap();
+ private volatile Map registry = new HashMap();
- public synchronized FederatedPortletInvoker registerInvoker(PortletInvokerRegistration
registration)
+ public synchronized FederatedPortletInvoker registerInvoker(String federatedId,
PortletInvoker federatedInvoker)
{
- if (registration == null)
+ if (federatedId == null)
{
+ throw new IllegalArgumentException("No null id");
+ }
+ if (federatedInvoker == null)
+ {
throw new IllegalArgumentException("No null invoker");
}
- String id = registration.getId();
- if (registry.containsKey(id))
+ if (registry.containsKey(federatedId))
{
- throw new IllegalArgumentException("Attempting dual registration of "
+ id);
+ throw new IllegalArgumentException("Attempting dual registration of "
+ federatedId);
}
Map copy = new HashMap(registry);
- FederatedPortletInvokerService invoker = new FederatedPortletInvokerService(this,
registration);
- copy.put(id, invoker);
+ FederatedPortletInvokerService invoker = new FederatedPortletInvokerService(this,
federatedId, federatedInvoker);
+ copy.put(federatedId, invoker);
registry = copy;
return invoker;
}
- public synchronized void unregisterInvoker(PortletInvokerRegistration registration)
+ public synchronized void unregisterInvoker(String federatedId)
{
- if (registration == null)
+ if (federatedId == null)
{
- throw new IllegalArgumentException("No null invoker");
- }
- unregisterInvoker(registration.getId());
- }
-
- public synchronized void unregisterInvoker(String id)
- {
- if (id == null)
- {
throw new IllegalArgumentException("No null id accepted");
}
- if (!registry.containsKey(id))
+ if (!registry.containsKey(federatedId))
{
- throw new IllegalArgumentException("Attempting to unregister unknown
invoker " + id);
+ throw new IllegalArgumentException("Attempting to unregister unknown
invoker " + federatedId);
}
Map copy = new HashMap(registry);
- copy.remove(id);
+ copy.remove(federatedId);
registry = copy;
}
- public FederatedPortletInvoker getFederatedInvoker(String id) throws
IllegalArgumentException
+ public FederatedPortletInvoker getFederatedInvoker(String federatedId) throws
IllegalArgumentException
{
- if (id == null)
+ if (federatedId == null)
{
throw new IllegalArgumentException("No null id provided");
}
- return (FederatedPortletInvoker)registry.get(id);
+ return (FederatedPortletInvoker)registry.get(federatedId);
}
public Collection getFederatedInvokers()
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/portlet/federation/impl/PortletInvokerRegistrationService.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.federation.impl;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.PortletInvoker;
@@ -34,7 +33,7 @@
* @version $Revision: 5448 $
* @since 2.4
*/
-public class PortletInvokerRegistrationService extends AbstractJBossService implements
PortletInvokerRegistration
+public class PortletInvokerRegistrationService extends AbstractJBossService
{
/** The registration id. */
@@ -78,11 +77,11 @@
protected void startService() throws Exception
{
- federatingPortletInvoker.registerInvoker(this);
+ federatingPortletInvoker.registerInvoker(id, portletInvoker);
}
protected void stopService() throws Exception
{
- federatingPortletInvoker.unregisterInvoker(this);
+ federatingPortletInvoker.unregisterInvoker(id);
}
}
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -74,7 +74,7 @@
// Wire
federatedInvoker.addInternalPortlet("MyPortlet", federatedPortlet);
- federatingInvoker.registerInvoker(new
PortletInvokerRegistrationImpl("foo", federatedInvoker));
+ federatingInvoker.registerInvoker("foo", federatedInvoker);
// Basic setup
Set portlets = federatingInvoker.getPortlets();
Modified:
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/OneInvokerNoPortletsTestCase.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -43,7 +43,7 @@
{
FederatingPortletInvoker federating = new FederatingPortletInvokerService();
PortletInvokerSupport support = new PortletInvokerSupport();
- federating.registerInvoker(new PortletInvokerRegistrationImpl("foo",
support));
+ federating.registerInvoker("foo", support);
//
assertEquals(new HashSet(), federating.getPortlets());
Deleted:
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java
===================================================================
---
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/portlet-federation/src/main/org/jboss/portal/test/portlet/federation/PortletInvokerRegistrationImpl.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -1,56 +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.test.portlet.federation;
-
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
-import org.jboss.portal.portlet.PortletInvoker;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PortletInvokerRegistrationImpl implements PortletInvokerRegistration
-{
-
- /** . */
- private final String id;
-
- /** . */
- private final PortletInvoker portletInvoker;
-
- public PortletInvokerRegistrationImpl(String id, PortletInvoker portletInvoker)
- {
- this.id = id;
- this.portletInvoker = portletInvoker;
- }
-
- public String getId()
- {
- return id;
- }
-
- public PortletInvoker getPortletInvoker()
- {
- return portletInvoker;
- }
-}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java
===================================================================
---
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java 2007-03-20
20:12:06 UTC (rev 6784)
+++
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPConsumerService.java 2007-03-21
00:52:41 UTC (rev 6785)
@@ -25,14 +25,13 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.portlet.federation.spi.PortletInvokerRegistration;
import org.jboss.portal.wsrp.WSRPConsumer;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class WSRPConsumerService extends AbstractJBossService implements
PortletInvokerRegistration
+public class WSRPConsumerService extends AbstractJBossService
{
/** . */
@@ -74,14 +73,14 @@
protected void startService() throws Exception
{
super.startService();
- federatingPortletInvoker.registerInvoker(this);
+ federatingPortletInvoker.registerInvoker(getId(), consumer);
consumer.start();
}
protected void stopService() throws Exception
{
consumer.stop();
- federatingPortletInvoker.unregisterInvoker(this);
+ federatingPortletInvoker.unregisterInvoker(getId());
super.stopService();
}
}