gatein SVN: r7394 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2011-09-13 21:50:18 -0400 (Tue, 13 Sep 2011)
New Revision: 7394
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
Log:
GTNPORTAL-2096: NPE as user drag/drop application right after saving UIPageForm
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-09-13 21:39:17 UTC (rev 7393)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-09-14 01:50:18 UTC (rev 7394)
@@ -19,31 +19,22 @@
package org.exoplatform.portal.webui.page;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.NoSuchDataException;
import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.model.ModelObject;
+import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.portal.UIPortalComposer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.config.InitParams;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
@@ -69,7 +60,6 @@
import org.exoplatform.webui.organization.UIListPermissionSelector;
import org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIteratorValidator;
import org.exoplatform.webui.organization.UIPermissionSelector;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -283,59 +273,23 @@
{
UIPageForm uiPageForm = event.getSource();
UIPortalApplication uiPortalApp = uiPageForm.getAncestorOfType(UIPortalApplication.class);
- PortalRequestContext pcontext = Util.getPortalRequestContext();
+ PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
- uiMaskWS.setUIComponent(null);
- uiMaskWS.setShow(false);
- pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
-
UIPage uiPage = uiPageForm.getUIPage();
if (uiPage == null)
return;
- String storageId = uiPage.getStorageId();
+
Page page = new Page();
- page.setPageId(uiPage.getPageId());
uiPageForm.invokeSetBindingBean(page);
- page.setOwnerType(uiPage.getSiteKey().getTypeName());
- List<UIPortlet> uiPortlets = new ArrayList<UIPortlet>();
- findAllPortlet(uiPortlets, uiPage);
- ArrayList<ModelObject> applications = new ArrayList<ModelObject>();
- for (UIPortlet uiPortlet : uiPortlets)
- {
- applications.add(PortalDataMapper.buildModelObject(uiPortlet));
- }
+ uiPage.setAccessPermissions(page.getAccessPermissions());
+ uiPage.setEditPermission(page.getEditPermission());
+ uiPage.setTitle(page.getTitle());
+ uiPage.setShowMaxWindow(page.isShowMaxWindow());
- List<UIComponent> uiChildren = uiPage.getChildren();
- if (uiChildren == null)
- {
- PortalDataMapper.toUIPage(uiPage, page);
- return;
- }
- ArrayList<ModelObject> children = new ArrayList<ModelObject>();
- for (UIComponent child : uiChildren)
- {
- ModelObject component = PortalDataMapper.buildModelObject(child);
- if (component != null)
- children.add(component);
- }
- page.setChildren(children);
- uiPage.getChildren().clear();
-
- try{
- PortalDataMapper.toUIPage(uiPage, page);
- pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
- } catch(NoSuchDataException de){
- uiPortalApp.addMessage(new ApplicationMessage("UIPageForm.msg.notExistOrDeleted", null, ApplicationMessage.ERROR));
- UIPortalComposer uiPortalComposer = (UIPortalComposer)uiPortalApp.findComponentById(UIPortalComposer.UIPAGE_EDITOR);
- if(uiPortalComposer != null){
- Event aboutEvent = new Event<UIPortalComposer>(uiPortalComposer, "Abort", event.getRequestContext());
- uiPortalComposer.broadcast(aboutEvent, event.getExecutionPhase());
- }
- }
-
- uiPage.setStorageId(storageId);
- if (page.getChildren() == null)
- page.setChildren(new ArrayList<ModelObject>());
+ uiMaskWS.setUIComponent(null);
+ uiMaskWS.setShow(false);
+ pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
+ pcontext.getJavascriptManager().addJavascript("eXo.portal.UIPortal.changeComposerSaveButton();");
}
protected void findAllPortlet(List<UIPortlet> list, UIContainer uiContainer)
13 years, 4 months
gatein SVN: r7393 - in components/wsrp/trunk: admin-gui/src/main/java/org/gatein/wsrp/admin/ui and 24 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-09-13 17:39:17 -0400 (Tue, 13 Sep 2011)
New Revision: 7393
Added:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/ConsumerRegistrySPI.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java
Removed:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java
Modified:
components/wsrp/trunk/
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml
components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/web.xml
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ActivatingNullInvokerHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/InMemoryConsumerRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLConsumerRegistry.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/WSRPConsumerSPI.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockConsumerRegistry.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java
components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/JCRMigrationService.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/mapping/ExportInfoMapping.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/ProducerInfoMapping.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/BaseChromatticPersister.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/StoresByPathManager.java
components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/BaseMapping.java
components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml
components/wsrp/trunk/jcr-impl/src/test/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistryTestCase.java
components/wsrp/trunk/pom.xml
Log:
- Merged clustering branch changes (-r7283:7390)
Property changes on: components/wsrp/trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /components/wsrp/branches/clustering:7284-7390
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -27,6 +27,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Serializable;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.Map;
@@ -38,7 +39,7 @@
* @version $Revision: 13374 $
* @since 2.6
*/
-public abstract class BeanContext
+public abstract class BeanContext implements Serializable
{
protected final static Logger log = LoggerFactory.getLogger(BeanContext.class);
@@ -192,7 +193,8 @@
/**
* Removes the object identified by the specified name(s) from the session. For a JSF backed implementation, this
- * will allow for the object/bean (defined as session-scoped in <code>faces-config.xml</code>) to be recreated by JSF
+ * will allow for the object/bean (defined as session-scoped in <code>faces-config.xml</code>) to be recreated by
+ * JSF
* when needed.
*
* @param name name of the object to be removed
@@ -257,7 +259,8 @@
* @param expectedClass expected class of the object
* @param <T> type of the object to be retrieved
* @return the session object associated with the specified name
- * @throws IllegalArgumentException if the value associated with the specified name is not <code>null</code> and does
+ * @throws IllegalArgumentException if the value associated with the specified name is not <code>null</code> and
+ * does
* not match the specified expected class
*/
public <T> T getFromSession(String name, Class<T> expectedClass)
@@ -275,12 +278,18 @@
* at runtime
* @param <T> the type of the object to be retrieved
* @return the value associated with the specified name
- * @throws IllegalArgumentException if the value associated with the specified name is not <code>null</code> and does
+ * @throws IllegalArgumentException if the value associated with the specified name is not <code>null</code> and
+ * does
* not match the specified expected class
*/
private <T> T getFromSession(String name, Class<T> expectedClass, Map<String, Object> sessionMap, String errorMessage)
{
Object result = sessionMap.get(name);
+ return checkObject(result, expectedClass, errorMessage);
+ }
+
+ protected <T> T checkObject(Object result, Class<T> expectedClass, String errorMessage)
+ {
if (result != null && !expectedClass.isAssignableFrom(result.getClass()))
{
throw new IllegalArgumentException(errorMessage.replace(CURRENT_PLACEHOLDER, result.toString()));
@@ -288,4 +297,6 @@
return expectedClass.cast(result);
}
+
+ public abstract <T> T findBean(String name, Class<T> type);
}
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerBean.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -47,6 +47,7 @@
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
import javax.xml.namespace.QName;
+import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -63,15 +64,16 @@
* @version $Revision: 12865 $
* @since 2.6
*/
-public class ConsumerBean extends ManagedBean
+public class ConsumerBean extends ManagedBean implements Serializable
{
public static final SelectablePortletToHandleFunction SELECTABLE_TO_HANDLE = new SelectablePortletToHandleFunction();
- private WSRPConsumer consumer;
- private ConsumerRegistry registry;
- private ConsumerManagerBean manager;
+ private transient WSRPConsumer consumer;
+ private transient ConsumerManagerBean manager;
private boolean modified;
private String wsdl;
+ private String id;
+ private static final String NULL_ID_CONSUMER = "bean_consumer_null_id";
private static final String CANNOT_FIND_CONSUMER = "bean_consumer_cannot_find_consumer";
private static final String CANNOT_UPDATE_CONSUMER = "bean_consumer_cannot_update_consumer";
private static final String CANNOT_REFRESH_CONSUMER = "bean_consumer_cannot_refresh_consumer";
@@ -90,11 +92,6 @@
private DataModel existingExports;
private ExportInfoDisplay currentExport;
- public void setRegistry(ConsumerRegistry registry)
- {
- this.registry = registry;
- }
-
public void setManager(ConsumerManagerBean manager)
{
this.manager = manager;
@@ -107,12 +104,12 @@
public boolean isRefreshNeeded()
{
- return consumer.isRefreshNeeded();
+ return getConsumer().isRefreshNeeded();
}
public String getId()
{
- return consumer.getProducerId();
+ return getConsumer().getProducerId();
}
public void setId(String id)
@@ -136,23 +133,46 @@
// we're not using modifyIfNeeded here to avoid double equality check, so we need to set modified manually
modified = true;
+
+ this.id = id;
}
}
}
else
{
// initialization scenario
+ resolveConsumer(id);
+ }
+ }
+
+ private void resolveConsumer(String id)
+ {
+ // if we don't have an id, try to get it from the ConsumerManagerBean
+ if (id == null)
+ {
+ id = getManager().getSelectedId();
+ }
+
+ // if it's still null, output an error
+ if (id == null)
+ {
+ beanContext.createErrorMessage(NULL_ID_CONSUMER);
+ }
+ else
+ {
consumer = getRegistry().getConsumer(id);
if (consumer != null)
{
EndpointConfigurationInfo endpoint = getProducerInfo().getEndpointConfigurationInfo();
wsdl = endpoint.getWsdlDefinitionURL();
+ this.id = id;
}
else
{
beanContext.createErrorMessage(CANNOT_FIND_CONSUMER, id);
}
}
+
}
public Integer getCache()
@@ -200,7 +220,7 @@
public boolean isActive()
{
- return consumer.isActive();
+ return getConsumer().isActive();
}
public boolean isRegistered()
@@ -264,7 +284,7 @@
public ProducerInfo getProducerInfo()
{
- return consumer.getProducerInfo();
+ return getConsumer().getProducerInfo();
}
public boolean isLocalInfoPresent()
@@ -327,7 +347,7 @@
private String internalUpdate(boolean showMessage)
{
- if (consumer != null)
+ if (getConsumer() != null)
{
if (isModified())
{
@@ -366,6 +386,7 @@
public String refreshConsumer()
{
+ final WSRPConsumer consumer = getConsumer();
if (consumer != null)
{
if (isModified())
@@ -380,7 +401,7 @@
// if the registration is locally modified, bypass the refresh as it will not yield a proper result
if (!isRegistrationLocallyModified())
{
- manager.refresh(consumer);
+ getManager().refresh(consumer);
}
else
{
@@ -396,7 +417,7 @@
public String modifyRegistration()
{
- if (consumer != null)
+ if (getConsumer() != null)
{
ProducerInfo info = getProducerInfo();
if (isModified())
@@ -461,7 +482,7 @@
public String eraseLocalRegistration()
{
- if (consumer != null)
+ if (getConsumer() != null)
{
getProducerInfo().eraseRegistrationInfo();
return ConsumerManagerBean.CONFIGURE_CONSUMER;
@@ -507,7 +528,7 @@
public ConsumerRegistry getRegistry()
{
- return registry;
+ return getManager().getRegistry();
}
public DataModel getPortlets()
@@ -516,6 +537,7 @@
{
if (portletHandles == null)
{
+ final WSRPConsumer consumer = getConsumer();
Collection<Portlet> portlets = consumer.getProducerInfo().getPortletMap().values();
List<SelectablePortletHandle> selectableHandles = Collections.emptyList();
if (ParameterValidation.existsAndIsNotEmpty(portlets))
@@ -555,6 +577,7 @@
public String exportPortlets()
{
+ final WSRPConsumer consumer = getConsumer();
if (consumer != null)
{
List<SelectablePortletHandle> handles = (List<SelectablePortletHandle>)portletHandles.getWrappedData();
@@ -593,7 +616,7 @@
if (existingExports == null)
{
Locale locale = beanContext.getLocale();
- MigrationService migrationService = consumer.getMigrationService();
+ MigrationService migrationService = getConsumer().getMigrationService();
List<ExportInfo> availableExportInfos = migrationService.getAvailableExportInfos();
List<ExportInfoDisplay> exportDisplays = new ArrayList<ExportInfoDisplay>(availableExportInfos.size());
for (ExportInfo exportInfo : availableExportInfos)
@@ -627,6 +650,8 @@
portletsToImport.add(exportedPortlet);
}
}
+
+ final WSRPConsumer consumer = getConsumer();
ImportInfo info = consumer.importPortlets(currentExport.getExport(), WSRPUtils.transform(portletsToImport, SELECTABLE_TO_HANDLE));
ConsumerStructureProvider structureProvider = consumer.getMigrationService().getStructureProvider();
@@ -673,6 +698,7 @@
public String deleteExport()
{
ExportInfo export = currentExport.getExport();
+ final WSRPConsumer consumer = getConsumer();
if (consumer.getMigrationService().remove(export) == export)
{
// release the export on the producer
@@ -708,29 +734,54 @@
public boolean isSupportsExport()
{
- return isActive() && consumer.isSupportsExport();
+ return isActive() && getConsumer().isSupportsExport();
}
public boolean isAvailableExportInfosEmpty()
{
- return consumer.getMigrationService().isAvailableExportInfosEmpty();
+ return getConsumer().getMigrationService().isAvailableExportInfosEmpty();
}
public boolean isWssEnabled()
{
- return consumer.getProducerInfo().getEndpointConfigurationInfo().getWSSEnabled();
+ return getProducerInfo().getEndpointConfigurationInfo().getWSSEnabled();
}
-
+
public boolean isWssAvailable()
{
- return consumer.getProducerInfo().getEndpointConfigurationInfo().isWSSAvailable();
+ return getProducerInfo().getEndpointConfigurationInfo().isWSSAvailable();
}
public void setWssEnabled(boolean enable)
{
- consumer.getProducerInfo().getEndpointConfigurationInfo().setWSSEnabled(enable);
+ getProducerInfo().getEndpointConfigurationInfo().setWSSEnabled(enable);
}
+ public WSRPConsumer getConsumer()
+ {
+ if (consumer == null)
+ {
+ // try to resolve it
+ resolveConsumer(id);
+ }
+
+ return consumer;
+ }
+
+ public void setConsumer(WSRPConsumer consumer)
+ {
+ this.consumer = consumer;
+ }
+
+ public ConsumerManagerBean getManager()
+ {
+ if (manager == null)
+ {
+ manager = beanContext.getFromSession("consumersMgr", ConsumerManagerBean.class);
+ }
+ return manager;
+ }
+
public static class SelectablePortletHandle implements Comparable<SelectablePortletHandle>
{
private String handle;
@@ -932,12 +983,12 @@
public static class FailedPortletsDisplay
{
private QName errorCode;
- private List<String> faiedPortlets;
+ private List<String> faliedPortlets;
public FailedPortletsDisplay(QName errorCode, List<String> failedPortlets)
{
this.errorCode = errorCode;
- this.faiedPortlets = failedPortlets;
+ this.faliedPortlets = failedPortlets;
}
public QName getErrorCode()
@@ -947,7 +998,7 @@
public List<String> getFailedPortlets()
{
- return faiedPortlets;
+ return faliedPortlets;
}
}
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ConsumerManagerBean.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -32,6 +32,7 @@
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
+import java.io.Serializable;
import java.util.List;
import java.util.Map;
@@ -40,9 +41,9 @@
* @version $Revision: 12865 $
* @since 2.6
*/
-public class ConsumerManagerBean extends ManagedBean
+public class ConsumerManagerBean extends ManagedBean implements Serializable
{
- private ConsumerRegistry registry;
+ private transient ConsumerRegistry registry;
private String selectedId;
private static final String NO_CONSUMER = "bean_consumermanager_no_consumer";
@@ -67,6 +68,12 @@
public ConsumerRegistry getRegistry()
{
+ // if the registry is not set, get it from the application scope
+ if (registry == null)
+ {
+ registry = beanContext.findBean("ConsumerRegistry", ConsumerRegistry.class);
+ }
+
return registry;
}
@@ -93,7 +100,7 @@
public boolean isConsumersEmpty()
{
- return getRegistry().getConfiguredConsumers().isEmpty();
+ return getRegistry().getConfiguredConsumerNumber() == 0;
}
public List<WSRPConsumer> getConsumers()
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -32,6 +32,7 @@
import javax.faces.context.FacesContext;
import javax.portlet.PortletRequest;
import javax.servlet.http.HttpServletRequest;
+import java.io.Serializable;
import java.util.Locale;
import java.util.Map;
@@ -40,7 +41,7 @@
* @version $Revision: 13413 $
* @since 2.6
*/
-public class JSFBeanContext extends BeanContext
+public class JSFBeanContext extends BeanContext implements Serializable
{
public String getParameter(String key)
{
@@ -58,6 +59,31 @@
return JSFBeanContext.getSessionMap(FacesContext.getCurrentInstance());
}
+ @Override
+ public <T> T findBean(String name, Class<T> type)
+ {
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ // try to get the bean from the application map first
+ final Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
+ Object candidate = applicationMap.get(name);
+
+ if (candidate == null)
+ {
+ // try to get the bean from an EL expression
+ candidate = facesContext.getApplication().evaluateExpressionGet(facesContext, "#{" + name + "}", type);
+ }
+
+ if (candidate != null)
+ {
+ return checkObject(candidate, type, "Bean named '" + name + "' is not of type '" + type.getSimpleName() + "'");
+ }
+ else
+ {
+ return null;
+ }
+ }
+
public static Map<String, Object> getSessionMap(FacesContext facesContext)
{
return facesContext.getExternalContext().getSessionMap();
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ManagedBean.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -27,6 +27,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.Serializable;
import java.util.regex.Pattern;
@@ -35,9 +36,9 @@
* @version $Revision: 13413 $
* @since 2.6
*/
-public abstract class ManagedBean
+public abstract class ManagedBean implements Serializable
{
- protected Logger log = LoggerFactory.getLogger(getClass());
+ protected transient Logger log = LoggerFactory.getLogger(getClass());
protected BeanContext beanContext;
@@ -47,7 +48,7 @@
public static final String INVALID_PATH = "INVALID_PATH_ERROR";
public static final String DUPLICATE = "DUPLICATE_ERROR";
- public static interface PropertyValidator
+ public static interface PropertyValidator extends Serializable
{
boolean checkForDuplicates();
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -36,6 +36,7 @@
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
+import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -46,18 +47,22 @@
* @version $Revision: 12854 $
* @since 2.6.3
*/
-public class ProducerBean extends ManagedBean
+public class ProducerBean extends ManagedBean implements Serializable
{
- private ProducerConfigurationService configurationService;
+ private transient ProducerConfigurationService configurationService;
private String policyClassName;
private String validatorClassName;
private static final String PROPERTY = "property";
private static final String PRODUCER = "producer";
private String selectedProp;
- private LocalProducerConfiguration localProducerConfiguration;
+ private transient LocalProducerConfiguration localProducerConfiguration;
public ProducerConfigurationService getConfigurationService()
{
+ if (configurationService == null)
+ {
+ configurationService = beanContext.findBean("ProducerConfigurationService", ProducerConfigurationService.class);
+ }
return configurationService;
}
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource.properties 2011-09-13 21:39:17 UTC (rev 7393)
@@ -179,6 +179,7 @@
CONSUMER_TYPE = Consumer
# ConsumerBean
+bean_consumer_null_id = No identifier was specified to resolve a consumer from. Please refresh the app and try again.
bean_consumer_cannot_find_consumer = Couldn''t find consumer ''{0}''!
bean_consumer_cannot_update_consumer = Couldn't update consumer!
bean_consumer_cannot_refresh_consumer = Couldn't refresh consumer!
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/classes/Resource_fr.properties 2011-09-13 21:39:17 UTC (rev 7393)
@@ -183,4 +183,5 @@
bean_consumermanager_refresh_failure_wsdl=Le rafra\u00eechissement a \u00e9chou\u00e9 (probablement \u00e0 cause d'URL WSDL non valide)
producer_config_wsdl_v1=Adresse WSDL pour le Producteur WSRP v1:
producer_config_wsdl_v2=Adresse WSDL pour le Producteur WSRP v2:
-unavailable_service=Le service WSRP n''est pas disponible. Veuillez l''activer avant d'utiliser cette portlet.
\ No newline at end of file
+unavailable_service=Le service WSRP n''est pas disponible. Veuillez l''activer avant d'utiliser cette portlet.
+bean_consumer_null_id=Aucun identifiant disponible pour r�cup�rer un consommateur. Veuillez rafra�chir l'application et r�essayer.
\ No newline at end of file
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/faces-config.xml 2011-09-13 21:39:17 UTC (rev 7393)
@@ -93,11 +93,6 @@
<value>#{beanContext}</value>
</managed-property>
<managed-property>
- <property-name>registry</property-name>
- <property-class>org.gatein.wsrp.consumer.registry.ConsumerRegistry</property-class>
- <value>#{applicationScope.ConsumerRegistry}</value>
- </managed-property>
- <managed-property>
<property-name>id</property-name>
<value>#{sessionScope.consumerId}</value>
</managed-property>
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/web.xml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/web.xml 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/WEB-INF/web.xml 2011-09-13 21:39:17 UTC (rev 7393)
@@ -83,6 +83,8 @@
<exception-type>java.lang.Exception</exception-type>
<location>/faces/jsf/error.xhtml</location>
</error-page>
+
+ <distributable/>
</web-app>
Modified: components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/BeanContextTestCase.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,24 +1,25 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.admin.ui;
@@ -115,5 +116,11 @@
{
throw new UnsupportedOperationException();
}
+
+ @Override
+ public <T> T findBean(String name, Class<T> type)
+ {
+ throw new UnsupportedOperationException();
+ }
}
}
Modified: components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -52,9 +52,13 @@
protected void setUp() throws Exception
{
bean = new ConsumerBean();
+
ConsumerRegistry registry = new TestInMemoryConsumerRegistry();
registry.createConsumer(CONSUMER_ID, null, WSDL);
- bean.setRegistry(registry);
+ ConsumerManagerBean managerBean = new ConsumerManagerBean();
+ managerBean.setRegistry(registry);
+ bean.setManager(managerBean);
+
bean.setBeanContext(new TestBeanContext());
// consumer associated with bean is null at this point so it should be loaded from the registry
@@ -158,6 +162,12 @@
{
throw new NotYetImplemented();
}
+
+ @Override
+ public <T> T findBean(String name, Class<T> type)
+ {
+ throw new NotYetImplemented();
+ }
}
private static class TestInMemoryConsumerRegistry extends InMemoryConsumerRegistry
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -38,7 +38,7 @@
import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
import org.gatein.wsrp.consumer.portlet.info.WSRPEventInfo;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
-import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
+import org.gatein.wsrp.consumer.spi.ConsumerRegistrySPI;
import org.gatein.wsrp.servlet.UserAccess;
import org.oasis.wsrp.v2.CookieProtocol;
import org.oasis.wsrp.v2.EventDescription;
@@ -105,6 +105,16 @@
/** The activated status of the associated Consumer */
private boolean persistentActive;
+ // GTNWSRP-239: information that's currently transient but should probably be persistent
+ /**
+ * GTNWSRP-239: whether or not this ProducerInfo requires ModifyRegistration to be called, currently persisted via
+ * mixin
+ */
+ private boolean isModifyRegistrationRequired;
+
+ /** GTNWSRP-239: last modification epoch: currently persistent via mixin */
+ private long lastModified;
+
// Transient information
/** The Cookie handling policy required by the Producer */
@@ -122,9 +132,7 @@
/** Time at which the cache expires */
private long expirationTimeMillis;
- private boolean isModifyRegistrationRequired;
-
- private ConsumerRegistry registry;
+ private final ConsumerRegistrySPI registry;
private static final String ERASED_LOCAL_REGISTRATION_INFORMATION = "Erased local registration information!";
private transient RegistrationInfo expectedRegistrationInfo;
@@ -142,10 +150,11 @@
protected org.oasis.wsrp.v1.ResourceList resourceList;*/
- public ProducerInfo()
+ public ProducerInfo(ConsumerRegistrySPI consumerRegistry)
{
persistentEndpointInfo = new EndpointConfigurationInfo();
persistentRegistrationInfo = RegistrationInfo.createUndeterminedRegistration(this);
+ this.registry = consumerRegistry;
}
@Override
@@ -193,16 +202,11 @@
return sb.toString();
}
- public ConsumerRegistry getRegistry()
+ public ConsumerRegistrySPI getRegistry()
{
return registry;
}
- public void setRegistry(ConsumerRegistry registry)
- {
- this.registry = registry;
- }
-
public String getKey()
{
return key;
@@ -1281,4 +1285,14 @@
return eventDescriptions.get(name);
}
}
+
+ public long getLastModified()
+ {
+ return lastModified;
+ }
+
+ public void setLastModified(long lastModified)
+ {
+ this.lastModified = lastModified;
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -51,12 +51,13 @@
import org.gatein.wsrp.consumer.handlers.InvocationDispatcher;
import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
import org.gatein.wsrp.consumer.handlers.SessionHandler;
+import org.gatein.wsrp.consumer.handlers.session.SessionRegistry;
import org.gatein.wsrp.consumer.migration.ExportInfo;
import org.gatein.wsrp.consumer.migration.ImportInfo;
-import org.gatein.wsrp.consumer.migration.InMemoryMigrationService;
import org.gatein.wsrp.consumer.migration.MigrationService;
import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
+import org.gatein.wsrp.consumer.spi.ConsumerRegistrySPI;
import org.gatein.wsrp.consumer.spi.WSRPConsumerSPI;
import org.gatein.wsrp.services.MarkupService;
import org.gatein.wsrp.services.PortletManagementService;
@@ -95,7 +96,6 @@
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
@@ -115,8 +115,6 @@
private ProducerInfo producerInfo;
- private transient MigrationService migrationService;
-
/** A registration data element used to indicate when no registration was required by the producer */
private final static RegistrationData REGISTRATION_NOT_NEEDED = WSRPTypeFactory.createDefaultRegistrationData();
@@ -143,20 +141,13 @@
private Set supportedUserScopes = WSRP_DEFAULT_USER_SCOPE; // todo: make it possible to support different user scopes
private transient boolean started;
- public WSRPConsumerImpl()
+ public WSRPConsumerImpl(ProducerInfo info)
{
- this(new ProducerInfo(), new InMemoryMigrationService());
- }
-
- public WSRPConsumerImpl(ProducerInfo info, MigrationService migrationService)
- {
ParameterValidation.throwIllegalArgExceptionIfNull(info, "ProducerInfo");
producerInfo = info;
sessionHandler = new SessionHandler(this);
dispatcher = new InvocationDispatcher(this);
-
- this.migrationService = migrationService;
}
public ProducerInfo getProducerInfo()
@@ -836,7 +827,7 @@
}
ExportInfo exportInfo = new ExportInfo(System.currentTimeMillis(), errorCodeToHandle, handleToState, exportContextHolder.value);
- migrationService.add(exportInfo);
+ getConsumerRegistry().getMigrationService().add(exportInfo);
return exportInfo;
}
catch (OperationNotSupported operationNotSupported)
@@ -896,6 +887,11 @@
}
}
+ private ConsumerRegistrySPI getConsumerRegistry()
+ {
+ return producerInfo.getRegistry();
+ }
+
public void releaseExport(ExportInfo exportInfo) throws PortletInvokerException
{
ParameterValidation.throwIllegalArgExceptionIfNull(exportInfo, "ExportInfo to release");
@@ -1023,11 +1019,16 @@
public MigrationService getMigrationService()
{
- return migrationService;
+ return getConsumerRegistry().getMigrationService();
}
public Version getWSRPVersion()
{
return producerInfo.getEndpointConfigurationInfo().getWSRPVersion();
}
+
+ public SessionRegistry getSessionRegistry()
+ {
+ return getConsumerRegistry().getSessionRegistry();
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/SessionHandler.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -45,11 +45,9 @@
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Manages session informations on behalf of a consumer.
@@ -66,9 +64,6 @@
/** The prefix used to isolate WSRP-related session information in the actual session object. */
private static final String SESSION_ID_PREFIX = "org.gatein.wsrp.session.";
- /** session id -> ProducerSessionInformation */
- private Map<String, ProducerSessionInformation> sessionInfos = new ConcurrentHashMap<String, ProducerSessionInformation>(); // todo: thread-safe?
-
/**
* Constructs a new SessionHandler.
*
@@ -316,7 +311,7 @@
{
List<String> idsToRelease = new ArrayList<String>();
- Set<ProducerSessionInformation> uniqueInfos = new HashSet<ProducerSessionInformation>(sessionInfos.values());
+ Set<ProducerSessionInformation> uniqueInfos = consumer.getSessionRegistry().getAll();
for (ProducerSessionInformation info : uniqueInfos)
{
@@ -339,7 +334,7 @@
for (String sessionId : sessionIds)
{
- ProducerSessionInformation info = sessionInfos.get(sessionId);
+ ProducerSessionInformation info = consumer.getSessionRegistry().get(sessionId);
sessionId = info.removeSession(sessionId);
if (sessionId != null)
{
@@ -383,7 +378,7 @@
*/
void removeSessionId(String id)
{
- sessionInfos.remove(id);
+ consumer.getSessionRegistry().remove(id);
}
/**
@@ -395,7 +390,7 @@
*/
void addSessionMapping(String sessionID, ProducerSessionInformation producerSessionInformation)
{
- sessionInfos.put(sessionID, producerSessionInformation);
+ consumer.getSessionRegistry().put(sessionID, producerSessionInformation);
}
// End ProducerSessionInformation callbacks
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java
===================================================================
--- components/wsrp/branches/clustering/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java 2011-09-13 17:53:13 UTC (rev 7390)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,57 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, 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.gatein.wsrp.consumer.handlers.session;
-
-import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
-public class InMemorySessionRegistry implements SessionRegistry
-{
- private Map<String, ProducerSessionInformation> sessionInfos = new ConcurrentHashMap<String, ProducerSessionInformation>(); // todo: thread-safe?
-
- public Set<ProducerSessionInformation> getAll()
- {
- return new HashSet<ProducerSessionInformation>(sessionInfos.values());
- }
-
- public ProducerSessionInformation get(String sessionId)
- {
- return sessionInfos.get(sessionId);
- }
-
- public ProducerSessionInformation remove(String sessionId)
- {
- return sessionInfos.remove(sessionId);
- }
-
- public void put(String sessionId, ProducerSessionInformation sessionInformation)
- {
- sessionInfos.put(sessionId, sessionInformation);
- }
-}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java (from rev 7390, components/wsrp/branches/clustering/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/InMemorySessionRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.consumer.handlers.session;
+
+import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public class InMemorySessionRegistry implements SessionRegistry
+{
+ private Map<String, ProducerSessionInformation> sessionInfos = new ConcurrentHashMap<String, ProducerSessionInformation>(); // todo: thread-safe?
+
+ public Set<ProducerSessionInformation> getAll()
+ {
+ return new HashSet<ProducerSessionInformation>(sessionInfos.values());
+ }
+
+ public ProducerSessionInformation get(String sessionId)
+ {
+ return sessionInfos.get(sessionId);
+ }
+
+ public ProducerSessionInformation remove(String sessionId)
+ {
+ return sessionInfos.remove(sessionId);
+ }
+
+ public void put(String sessionId, ProducerSessionInformation sessionInformation)
+ {
+ sessionInfos.put(sessionId, sessionInformation);
+ }
+}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java
===================================================================
--- components/wsrp/branches/clustering/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java 2011-09-13 17:53:13 UTC (rev 7390)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,40 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, 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.gatein.wsrp.consumer.handlers.session;
-
-import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
-
-import java.util.Set;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
-public interface SessionRegistry
-{
- Set<ProducerSessionInformation> getAll();
-
- ProducerSessionInformation get(String sessionId);
-
- ProducerSessionInformation remove(String sessionId);
-
- void put(String sessionId, ProducerSessionInformation sessionInformation);
-}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java (from rev 7390, components/wsrp/branches/clustering/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/session/SessionRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.consumer.handlers.session;
+
+import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
+
+import java.util.Set;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public interface SessionRegistry
+{
+ Set<ProducerSessionInformation> getAll();
+
+ ProducerSessionInformation get(String sessionId);
+
+ ProducerSessionInformation remove(String sessionId);
+
+ void put(String sessionId, ProducerSessionInformation sessionInformation);
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/AbstractConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -33,46 +33,66 @@
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.consumer.handlers.session.InMemorySessionRegistry;
+import org.gatein.wsrp.consumer.handlers.session.SessionRegistry;
+import org.gatein.wsrp.consumer.migration.InMemoryMigrationService;
import org.gatein.wsrp.consumer.migration.MigrationService;
+import org.gatein.wsrp.consumer.spi.ConsumerRegistrySPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 12693 $
* @since 2.6
*/
-public abstract class AbstractConsumerRegistry implements ConsumerRegistry
+public abstract class AbstractConsumerRegistry implements ConsumerRegistrySPI
{
/** Gives access to the Portal's portlet invokers */
private FederatingPortletInvoker federatingPortletInvoker;
- private SortedMap<String, WSRPConsumer> consumers;
- private Map<String, String> keysToIds;
-
private SessionEventBroadcaster sessionEventBroadcaster = SessionEventBroadcaster.NO_OP_BROADCASTER;
- private MigrationService migrationService;
+ private MigrationService migrationService = new InMemoryMigrationService();
+ private SessionRegistry sessionRegistry = new InMemorySessionRegistry();
private static final String CONSUMER_WITH_ID = "Consumer with id '";
private static final String RELEASE_SESSIONS_LISTENER = "release_sessions_listener_";
private static final Logger log = LoggerFactory.getLogger(AbstractConsumerRegistry.class);
- protected AbstractConsumerRegistry()
+ protected ConsumerCache consumers = new InMemoryConsumerCache();
+
+ public void setConsumerCache(ConsumerCache consumers)
{
- initConsumers(null);
+ if (consumers == null)
+ {
+ consumers = new InMemoryConsumerCache();
+ }
+ this.consumers = consumers;
}
+ public void setSessionRegistry(SessionRegistry sessionRegistry)
+ {
+ if (sessionRegistry == null)
+ {
+ sessionRegistry = new InMemorySessionRegistry();
+ }
+ this.sessionRegistry = sessionRegistry;
+ }
+
+ public SessionRegistry getSessionRegistry()
+ {
+ return sessionRegistry;
+ }
+
public FederatingPortletInvoker getFederatingPortletInvoker()
{
return federatingPortletInvoker;
@@ -80,6 +100,10 @@
public void setSessionEventBroadcaster(SessionEventBroadcaster sessionEventBroadcaster)
{
+ if (sessionEventBroadcaster == null)
+ {
+ sessionEventBroadcaster = SessionEventBroadcaster.NO_OP_BROADCASTER;
+ }
this.sessionEventBroadcaster = sessionEventBroadcaster;
}
@@ -90,6 +114,10 @@
public void setMigrationService(MigrationService migrationService)
{
+ if (migrationService == null)
+ {
+ migrationService = new InMemoryMigrationService();
+ }
this.migrationService = migrationService;
}
@@ -103,9 +131,8 @@
}
- ProducerInfo info = new ProducerInfo();
+ ProducerInfo info = new ProducerInfo(this);
info.setId(id);
- info.setRegistry(this);
info.setExpirationCacheSeconds(expirationCacheSeconds);
info.getEndpointConfigurationInfo().setWsdlDefinitionURL(wsdlURL);
@@ -140,9 +167,11 @@
}
deactivateConsumer(consumer);
- remove(consumer);
delete(info);
+
+ // remove from cache
+ consumers.removeConsumer(id);
}
else
{
@@ -168,38 +197,19 @@
this.federatingPortletInvoker = federatingPortletInvoker;
}
- public ProducerInfo getProducerInfoByKey(String key)
+ public WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
{
- String id = keysToIds.get(key);
- if (id != null)
- {
- return getConsumer(id).getProducerInfo();
- }
- else
- {
- return null;
- }
- }
+ // make sure we set the registry after loading from DB since registry is not persisted.
+// producerInfo.setRegistry(this);
- private WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
- {
- WSRPConsumer consumer = newConsumer(producerInfo);
- add(consumer);
+ final WSRPConsumerImpl consumer = new WSRPConsumerImpl(producerInfo);
+ // cache consumer
+ consumers.putConsumer(producerInfo.getId(), consumer);
+
return consumer;
}
- /**
- * Extracted for testing purposes...
- *
- * @param producerInfo
- * @return
- */
- protected WSRPConsumer newConsumer(ProducerInfo producerInfo)
- {
- return new WSRPConsumerImpl(producerInfo, migrationService);
- }
-
public void activateConsumerWith(String id) throws ConsumerException
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Activating a Consumer");
@@ -211,19 +221,10 @@
ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "WSRPConsumer");
String id = consumer.getProducerId();
- if (federatingPortletInvoker.getFederatedInvoker(id) == null)
+ if (!federatingPortletInvoker.isResolved(id))
{
startOrStopConsumer(consumer, true);
}
- else
- {
- // todo: fix-me federated portlet invoker gets desynchronized...
- if (!consumer.isActive())
- {
- federatingPortletInvoker.unregisterInvoker(id);
- startOrStopConsumer(consumer, true);
- }
- }
}
public void deactivateConsumerWith(String id) throws ConsumerException
@@ -238,22 +239,13 @@
String id = consumer.getProducerId();
// only process if there is a registered Consumer with the specified id
- if (federatingPortletInvoker.getFederatedInvoker(id) != null)
+ if (federatingPortletInvoker.isResolved(id))
{
startOrStopConsumer(consumer, false);
}
- else
- {
- // todo: fix-me federated portlet invoker gets desynchronized...
- if (consumer.isActive())
- {
- federatingPortletInvoker.registerInvoker(id, consumer);
- startOrStopConsumer(consumer, false);
- }
- }
}
- public void updateProducerInfo(ProducerInfo producerInfo)
+ public String updateProducerInfo(ProducerInfo producerInfo)
{
ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo, "ProducerInfo");
@@ -262,17 +254,21 @@
// if we updated and oldId is not null, we need to update the local information
if (oldId != null)
{
- remove(getConsumer(oldId));
WSRPConsumer consumer = createConsumerFrom(producerInfo);
- // update the federating portlet invoker:
- FederatedPortletInvoker invoker = federatingPortletInvoker.getFederatedInvoker(oldId);
- if (invoker != null)
+ // update the federating portlet invoker if needed
+ if (federatingPortletInvoker.isResolved(oldId))
{
federatingPortletInvoker.unregisterInvoker(oldId);
federatingPortletInvoker.registerInvoker(producerInfo.getId(), consumer);
}
+
+ // update cache
+ consumers.removeConsumer(oldId);
+ consumers.putConsumer(producerInfo.getId(), consumer);
}
+
+ return oldId;
}
public void start() throws Exception
@@ -282,8 +278,7 @@
public void reloadConsumers()
{
- // load the configured consumers
- initConsumers(null);
+ consumers.clear();
Iterator<ProducerInfo> producerInfos = getProducerInfosFromStorage();
@@ -293,9 +288,6 @@
{
producerInfo = producerInfos.next();
- // need to set the registry after loading from DB since registry is not persisted.
- producerInfo.setRegistry(this);
-
createConsumerFrom(producerInfo);
}
}
@@ -308,7 +300,7 @@
// unregister it. We have changed how consumers are registered (active consumers are not automatically
// registered anymore), we also need to check if the consumer is known by the federating portlet invoker...
String producerId = consumer.getProducerId();
- if (consumer.getProducerInfo().isActive() && federatingPortletInvoker.getFederatedInvoker(producerId) != null)
+ if (consumer.getProducerInfo().isActive() && federatingPortletInvoker.isResolved(producerId))
{
federatingPortletInvoker.unregisterInvoker(producerId);
}
@@ -322,21 +314,68 @@
// ignore and continue
}
}
-
- clearConsumers();
}
public List<WSRPConsumer> getConfiguredConsumers()
{
- return new ArrayList<WSRPConsumer>(getConsumers());
+ return getConsumers(true);
}
public WSRPConsumer getConsumer(String id)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer id", null);
- return consumers.get(id);
+
+ return consumers.getConsumer(id);
}
+ public boolean containsConsumer(String id)
+ {
+ return getConsumer(id) != null;
+ }
+
+ public Collection<String> getConfiguredConsumersIds()
+ {
+ return new AbstractCollection<String>()
+ {
+ final private List<WSRPConsumer> consumers = getConsumers(false);
+
+ @Override
+ public Iterator<String> iterator()
+ {
+ return new Iterator<String>()
+ {
+ private Iterator<WSRPConsumer> consumerIterator = consumers.iterator();
+
+ public boolean hasNext()
+ {
+ return consumerIterator.hasNext();
+ }
+
+ public String next()
+ {
+ return consumerIterator.next().getProducerId();
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+
+ @Override
+ public int size()
+ {
+ return consumers.size();
+ }
+ };
+ }
+
+ public int getConfiguredConsumerNumber()
+ {
+ return getConfiguredConsumersIds().size();
+ }
+
public void registerOrDeregisterConsumerWith(String id, boolean register)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Registering or deregistering a Consumer");
@@ -418,50 +457,15 @@
return RELEASE_SESSIONS_LISTENER + id;
}
- protected abstract void save(ProducerInfo info, String messageOnError) throws ConsumerException;
-
- protected abstract void delete(ProducerInfo info) throws ConsumerException;
-
- /**
- * Persists the changes made to ProducerInfo.
- *
- * @param producerInfo
- * @return the previous value of the ProducerInfo's id if it has changed, <code>null</code> otherwise
- */
- protected abstract String update(ProducerInfo producerInfo);
-
- protected abstract Iterator<ProducerInfo> getProducerInfosFromStorage();
-
- // internal management methods
-
- protected void add(WSRPConsumer consumer)
+ protected List<WSRPConsumer> getConsumers(boolean startConsumers)
{
- String id = consumer.getProducerId();
- consumers.put(id, consumer);
- ProducerInfo info = consumer.getProducerInfo();
- keysToIds.put(info.getKey(), id);
- }
-
- protected WSRPConsumer remove(WSRPConsumer consumer)
- {
- String id = keysToIds.remove(consumer.getProducerInfo().getKey());
- return consumers.remove(id);
- }
-
- protected Collection<WSRPConsumer> getConsumers()
- {
- return getConsumers(true);
- }
-
- protected Collection<WSRPConsumer> getConsumers(boolean startConsumers)
- {
- Collection<WSRPConsumer> consumerz = consumers.values();
-
- if (startConsumers)
+ final Collection<WSRPConsumer> consumerz = consumers.getConsumers();
+ for (WSRPConsumer consumer : consumerz)
{
- for (WSRPConsumer consumer : consumerz)
+ if (startConsumers)
{
- if (consumer.getProducerInfo().isActive() && !consumer.isActive())
+ final ProducerInfo info = consumer.getProducerInfo();
+ if (info.isActive() && !consumer.isActive())
{
try
{
@@ -470,38 +474,15 @@
catch (Exception e)
{
log.info("Couldn't activate consumer " + consumer.getProducerId());
- consumer.getProducerInfo().setActiveAndSave(false);
+ info.setActiveAndSave(false);
}
}
}
}
- return consumerz;
- }
- protected Map<String, String> getKeyMappings()
- {
- return Collections.unmodifiableMap(keysToIds);
+ return new ArrayList<WSRPConsumer>(consumerz);
}
- protected void initConsumers(SortedMap<String, WSRPConsumer> consumers)
- {
- if (!ParameterValidation.existsAndIsNotEmpty(consumers))
- {
- consumers = new TreeMap<String, WSRPConsumer>();
- }
- this.consumers = consumers;
- int size = consumers.size();
- keysToIds = size == 0 ? new HashMap<String, String>() : new HashMap<String, String>(size);
- }
-
- private void clearConsumers()
- {
- consumers.clear();
- keysToIds.clear();
- consumers = null;
- keysToIds = null;
- }
-
protected class ProducerInfoIterator implements Iterator<ProducerInfo>
{
private Iterator<WSRPConsumer> consumers;
@@ -526,4 +507,34 @@
throw new UnsupportedOperationException("remove not supported on this iterator implementation");
}
}
+
+ protected class InMemoryConsumerCache implements ConsumerCache
+ {
+ private Map<String, WSRPConsumer> consumers = new HashMap<String, WSRPConsumer>(11);
+
+ public Collection<WSRPConsumer> getConsumers()
+ {
+ return consumers.values();
+ }
+
+ public WSRPConsumer getConsumer(String id)
+ {
+ return consumers.get(id);
+ }
+
+ public WSRPConsumer removeConsumer(String id)
+ {
+ return consumers.remove(id);
+ }
+
+ public void putConsumer(String id, WSRPConsumer consumer)
+ {
+ consumers.put(id, consumer);
+ }
+
+ public void clear()
+ {
+ consumers.clear();
+ }
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ActivatingNullInvokerHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ActivatingNullInvokerHandler.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ActivatingNullInvokerHandler.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -27,8 +27,11 @@
import org.gatein.pc.federation.FederatedPortletInvoker;
import org.gatein.pc.federation.FederatingPortletInvoker;
import org.gatein.pc.federation.NullInvokerHandler;
+import org.gatein.pc.federation.impl.FederatedPortletInvokerService;
import org.gatein.wsrp.WSRPConsumer;
+import java.util.Collection;
+
/**
* Attempts to activate a WSRP consumer named like the missing invoker that trigger the invocation of this
* NullInvokerHandler. This is in particularly helpful to activate configured consumers that haven't been started yet
@@ -41,7 +44,7 @@
{
private transient ConsumerRegistry consumerRegistry;
- public FederatedPortletInvoker resolvePortletInvokerFor(String compoundPortletId, String invokerId, FederatingPortletInvoker callingInvoker) throws NoSuchPortletException
+ public FederatedPortletInvoker resolvePortletInvokerFor(String invokerId, FederatingPortletInvoker callingInvoker, String compoundPortletId) throws NoSuchPortletException
{
FederatingPortletInvoker registryInvoker = consumerRegistry.getFederatingPortletInvoker();
if (registryInvoker != callingInvoker)
@@ -50,14 +53,19 @@
+ registryInvoker + ") than the specified one (" + callingInvoker + ")");
}
- FederatedPortletInvoker federated;
-
WSRPConsumer consumer = consumerRegistry.getConsumer(invokerId);
// if there's no consumer with that invoker id, then there's nothing much we can do
if (consumer == null)
{
- throw new NoSuchPortletException(compoundPortletId);
+ if (compoundPortletId != null)
+ {
+ throw new NoSuchPortletException(compoundPortletId);
+ }
+ else
+ {
+ return null;
+ }
}
else
{
@@ -66,14 +74,21 @@
{
consumerRegistry.activateConsumerWith(invokerId);
- federated = callingInvoker.getFederatedInvoker(invokerId);
+ return new FederatedPortletInvokerService(callingInvoker, invokerId, consumer);
}
}
+ }
- //
- return federated;
+ public boolean knows(String invoker)
+ {
+ return consumerRegistry.containsConsumer(invoker);
}
+ public Collection<String> getKnownInvokerIds()
+ {
+ return consumerRegistry.getConfiguredConsumersIds();
+ }
+
public void setConsumerRegistry(ConsumerRegistry consumerRegistry)
{
this.consumerRegistry = consumerRegistry;
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java (from rev 7390, components/wsrp/branches/clustering/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerCache.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.consumer.registry;
+
+import org.gatein.wsrp.WSRPConsumer;
+
+import java.util.Collection;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public interface ConsumerCache
+{
+ Collection<WSRPConsumer> getConsumers();
+
+ WSRPConsumer getConsumer(String id);
+
+ WSRPConsumer removeConsumer(String id);
+
+ void putConsumer(String id, WSRPConsumer consumer);
+
+ void clear();
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/ConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -25,11 +25,10 @@
import org.gatein.pc.federation.FederatingPortletInvoker;
import org.gatein.wsrp.WSRPConsumer;
-import org.gatein.wsrp.api.session.SessionEventBroadcaster;
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.ProducerInfo;
-import org.gatein.wsrp.consumer.migration.MigrationService;
+import java.util.Collection;
import java.util.List;
/**
@@ -58,7 +57,13 @@
*/
void activateConsumerWith(String id) throws ConsumerException;
- void updateProducerInfo(ProducerInfo producerInfo) throws ConsumerException;
+ /**
+ * Persists the changes made to ProducerInfo.
+ *
+ * @param producerInfo the ProducerInfo to persist
+ * @return the previous value of the ProducerInfo's id if it has changed, <code>null</code> otherwise
+ */
+ String updateProducerInfo(ProducerInfo producerInfo) throws ConsumerException;
void deactivateConsumerWith(String id) throws ConsumerException;
@@ -68,17 +73,9 @@
void reloadConsumers();
- void start() throws Exception;
+ boolean containsConsumer(String id);
- void stop() throws Exception;
+ Collection<String> getConfiguredConsumersIds();
- void setSessionEventBroadcaster(SessionEventBroadcaster sessionEventBroadcaster);
-
- void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker);
-
- ProducerInfo getProducerInfoByKey(String key);
-
- MigrationService getMigrationService();
-
- void setMigrationService(MigrationService migrationService);
-}
\ No newline at end of file
+ int getConfiguredConsumerNumber();
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/InMemoryConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/InMemoryConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/InMemoryConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -23,11 +23,17 @@
package org.gatein.wsrp.consumer.registry;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.federation.impl.FederatingPortletInvokerService;
+import org.gatein.wsrp.WSRPConsumer;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.migration.InMemoryMigrationService;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
import java.util.UUID;
/**
@@ -36,35 +42,112 @@
*/
public class InMemoryConsumerRegistry extends AbstractConsumerRegistry
{
+ private SortedMap<String, WSRPConsumer> consumers;
+ private Map<String, String> keysToIds;
+
public InMemoryConsumerRegistry()
{
+ initConsumers(null);
setFederatingPortletInvoker(new FederatingPortletInvokerService());
setMigrationService(new InMemoryMigrationService());
}
@Override
- protected void save(ProducerInfo info, String messageOnError)
+ public WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
{
+ WSRPConsumer consumer = super.createConsumerFrom(producerInfo);
+
+ String id = consumer.getProducerId();
+ consumers.put(id, consumer);
+ ProducerInfo info = consumer.getProducerInfo();
+ keysToIds.put(info.getKey(), id);
+
+ return consumer;
+ }
+
+ @Override
+ public String updateProducerInfo(ProducerInfo producerInfo)
+ {
+ String oldId = super.updateProducerInfo(producerInfo);
+ if (oldId != null)
+ {
+ keysToIds.put(producerInfo.getKey(), producerInfo.getId());
+ consumers.remove(oldId);
+ }
+ return oldId;
+ }
+
+ public void save(ProducerInfo info, String messageOnError)
+ {
// generate a UUID for ProducerInfo
info.setKey(UUID.randomUUID().toString());
}
- @Override
- protected void delete(ProducerInfo info)
+ public void delete(ProducerInfo info)
{
- // nothing to do here
+ String key = info.getKey();
+ String removed = keysToIds.remove(key);
+ if (removed != null)
+ {
+ consumers.remove(removed);
+ }
}
- @Override
- protected String update(ProducerInfo producerInfo)
+ public String update(ProducerInfo producerInfo)
{
String key = producerInfo.getKey();
- return getKeyMappings().get(key);
+ String oldId = keysToIds.get(key);
+ if (oldId.equals(producerInfo.getId()))
+ {
+ return null;
+ }
+ else
+ {
+ return oldId;
+ }
}
@Override
- protected Iterator<ProducerInfo> getProducerInfosFromStorage()
+ public void reloadConsumers()
{
- return new ProducerInfoIterator(getConsumers().iterator());
+ // do nothing
}
+
+ public Iterator<ProducerInfo> getProducerInfosFromStorage()
+ {
+ return new ProducerInfoIterator(consumers.values().iterator());
+ }
+
+ public ProducerInfo loadProducerInfo(String id)
+ {
+ if (keysToIds.containsValue(id))
+ {
+ return consumers.get(id).getProducerInfo();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ super.stop();
+ consumers.clear();
+ keysToIds.clear();
+ consumers = null;
+ keysToIds = null;
+ }
+
+ protected void initConsumers(SortedMap<String, WSRPConsumer> consumers)
+ {
+ if (!ParameterValidation.existsAndIsNotEmpty(consumers))
+ {
+ consumers = new TreeMap<String, WSRPConsumer>();
+ }
+ this.consumers = consumers;
+ int size = consumers.size();
+ keysToIds = size == 0 ? new HashMap<String, String>() : new HashMap<String, String>(size);
+ }
}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/registry/xml/XMLConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,31 +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. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.consumer.registry.xml;
import org.gatein.common.xml.NullEntityResolver;
import org.gatein.wsrp.WSRPConsumer;
import org.gatein.wsrp.consumer.ProducerInfo;
-import org.gatein.wsrp.consumer.registry.AbstractConsumerRegistry;
+import org.gatein.wsrp.consumer.registry.InMemoryConsumerRegistry;
import org.jboss.xb.binding.JBossXBException;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
@@ -37,14 +37,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Iterator;
import java.util.SortedMap;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision: 9360 $
*/
-public class XMLConsumerRegistry extends AbstractConsumerRegistry
+public class XMLConsumerRegistry extends InMemoryConsumerRegistry
{
private final static Logger log = LoggerFactory.getLogger(XMLConsumerRegistry.class);
@@ -99,56 +98,22 @@
}
catch (JBossXBException e)
{
- throw new RuntimeException("Couldn't set unmarshall WSRP Consumers configuration", e);
+ throw new RuntimeException("Couldn't unmarshall WSRP Consumers configuration", e);
}
-
- for (WSRPConsumer consumer : getConsumers())
- {
-
- ProducerInfo producerInfo = consumer.getProducerInfo();
- try
- {
- // try to activate the consumer
- activateConsumer(consumer);
- }
- catch (Exception e)
- {
- producerInfo.setActive(false);
- updateProducerInfo(producerInfo);
- }
- }
}
- @Override
- public void stop() throws Exception
+ public void save(ProducerInfo info, String messageOnError)
{
- for (WSRPConsumer consumer : getConsumers())
- {
- consumer.stop();
- }
- }
-
- @Override
- protected void save(ProducerInfo info, String messageOnError)
- {
// do nothing
}
- @Override
- protected void delete(ProducerInfo info)
+ public void delete(ProducerInfo info)
{
// do nothing
}
- @Override
- protected String update(ProducerInfo producerInfo)
+ public String update(ProducerInfo producerInfo)
{
return null;
}
-
- @Override
- protected Iterator<ProducerInfo> getProducerInfosFromStorage()
- {
- return new ProducerInfoIterator(getConsumers().iterator());
- }
}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/ConsumerRegistrySPI.java (from rev 7390, components/wsrp/branches/clustering/consumer/src/main/java/org/gatein/wsrp/consumer/spi/ConsumerRegistrySPI.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/ConsumerRegistrySPI.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/ConsumerRegistrySPI.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.consumer.spi;
+
+import org.gatein.pc.federation.FederatingPortletInvoker;
+import org.gatein.wsrp.WSRPConsumer;
+import org.gatein.wsrp.api.session.SessionEventBroadcaster;
+import org.gatein.wsrp.consumer.ConsumerException;
+import org.gatein.wsrp.consumer.ProducerInfo;
+import org.gatein.wsrp.consumer.handlers.session.SessionRegistry;
+import org.gatein.wsrp.consumer.migration.MigrationService;
+import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
+
+import java.util.Iterator;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public interface ConsumerRegistrySPI extends ConsumerRegistry
+{
+ void setSessionEventBroadcaster(SessionEventBroadcaster sessionEventBroadcaster);
+
+ void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker);
+
+ MigrationService getMigrationService();
+
+ void setMigrationService(MigrationService migrationService);
+
+ SessionRegistry getSessionRegistry();
+
+ void setSessionRegistry(SessionRegistry sessionRegistry);
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+
+ void save(ProducerInfo info, String messageOnError) throws ConsumerException;
+
+ void delete(ProducerInfo info) throws ConsumerException;
+
+ /**
+ * Persists the changes made to ProducerInfo.
+ *
+ * @param producerInfo
+ * @return the previous value of the ProducerInfo's id if it has changed, <code>null</code> otherwise
+ */
+ String update(ProducerInfo producerInfo);
+
+ Iterator<ProducerInfo> getProducerInfosFromStorage();
+
+ ProducerInfo loadProducerInfo(String id);
+
+ WSRPConsumer createConsumerFrom(ProducerInfo producerInfo);
+}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/WSRPConsumerSPI.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/WSRPConsumerSPI.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/spi/WSRPConsumerSPI.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -28,6 +28,7 @@
import org.gatein.wsrp.WSRPConsumer;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.handlers.SessionHandler;
+import org.gatein.wsrp.consumer.handlers.session.SessionRegistry;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
import org.gatein.wsrp.services.MarkupService;
import org.oasis.wsrp.v2.RegistrationContext;
@@ -65,4 +66,6 @@
boolean supportsUserScope(String userScope);
WSRPPortletInfo getPortletInfo(PortletInvocation invocation) throws PortletInvokerException;
+
+ SessionRegistry getSessionRegistry();
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/ProducerInfoTestCase.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -72,15 +72,13 @@
protected void setUp() throws Exception
{
- info = new ProducerInfo();
+ info = new ProducerInfo(new MockConsumerRegistry());
info.setId("test");
info.setKey("key");
serviceFactory = new BehaviorBackedServiceFactory();
EndpointConfigurationInfo eci = new EndpointConfigurationInfo(serviceFactory);
info.setEndpointConfigurationInfo(eci);
-
- info.setRegistry(new MockConsumerRegistry());
}
public void testSetRegistrationInfo()
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RegistrationInfoTestCase.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -50,7 +50,7 @@
protected void setUp() throws Exception
{
- ProducerInfo pi = new ProducerInfo();
+ ProducerInfo pi = new ProducerInfo(null);
info = pi.getRegistrationInfo();
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/registry/ConsumerRegistryTestCase.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -41,7 +41,7 @@
*/
public class ConsumerRegistryTestCase extends TestCase
{
- protected ConsumerRegistry registry;
+ protected AbstractConsumerRegistry registry;
@Override
protected void setUp() throws Exception
@@ -57,11 +57,14 @@
assertEquals(id, consumer.getProducerId());
ProducerInfo info = consumer.getProducerInfo();
assertNotNull(info);
+ assertNotNull(info.getKey());
assertEquals(consumer.getProducerId(), info.getId());
EndpointConfigurationInfo endpoint = info.getEndpointConfigurationInfo();
assertNotNull(endpoint);
RegistrationInfo regInfo = info.getRegistrationInfo();
assertTrue(regInfo.isUndetermined());
+ assertEquals(registry, info.getRegistry());
+ assertTrue(registry.containsConsumer(id));
WSRPConsumer fromRegistry = registry.getConsumer(id);
assertNotNull(fromRegistry);
@@ -71,6 +74,7 @@
assertEquals(fromRegistry.getProducerId(), fromRegistryInfo.getId());
assertNotNull(fromRegistryInfo.getEndpointConfigurationInfo());
assertTrue(fromRegistryInfo.getRegistrationInfo().isUndetermined());
+ assertEquals(registry, fromRegistryInfo.getRegistry());
assertEquals(info.getId(), fromRegistryInfo.getId());
assertEquals(info.getEndpointConfigurationInfo(), fromRegistryInfo.getEndpointConfigurationInfo());
@@ -80,6 +84,13 @@
assertNotNull(consumers);
assertEquals(1, consumers.size());
assertTrue(consumers.contains(consumer));
+
+ final Collection<String> ids = registry.getConfiguredConsumersIds();
+ assertNotNull(ids);
+ assertEquals(1, ids.size());
+ assertTrue(ids.contains(id));
+
+ assertEquals(1, registry.getConfiguredConsumerNumber());
}
public void testGetConsumer()
@@ -87,17 +98,6 @@
assertNull(registry.getConsumer("inexistent"));
}
- public void testGetProducerInfoByKey()
- {
- WSRPConsumer consumer = registry.createConsumer("id", null, null);
- ProducerInfo info = consumer.getProducerInfo();
-
- String key = info.getKey();
- assertNotNull(key);
-
- assertEquals(info, registry.getProducerInfoByKey(key));
- }
-
public void testDoubleRegistrationOfConsumerWithSameId()
{
String id = "foo";
@@ -120,13 +120,14 @@
WSRPConsumer consumer = registry.createConsumer(id, null, null);
assertEquals(consumer, registry.getConsumer(id));
+ assertTrue(registry.containsConsumer(id));
+ assertEquals(1, registry.getConfiguredConsumerNumber());
- String key = consumer.getProducerInfo().getKey();
-
registry.destroyConsumer(id);
+ assertFalse(registry.containsConsumer(id));
assertNull(registry.getConsumer(id));
- assertNull(registry.getProducerInfoByKey(key));
+ assertEquals(0, registry.getConfiguredConsumerNumber());
}
public void testUpdateProducerInfo()
@@ -135,16 +136,18 @@
String id = "foo";
WSRPConsumer consumer = registry.createConsumer(id, null, null);
ProducerInfo info = consumer.getProducerInfo();
- String key = info.getKey();
// change the id on the consumer's producer info and save it
info.setId("bar");
registry.updateProducerInfo(info);
assertNull(registry.getConsumer(id));
+ assertFalse(registry.containsConsumer(id));
+
assertEquals(info, consumer.getProducerInfo());
- assertEquals(info, registry.getProducerInfoByKey(key));
assertEquals(consumer, registry.getConsumer("bar"));
+ assertTrue(registry.containsConsumer("bar"));
+ assertEquals(1, registry.getConfiguredConsumerNumber());
}
public void testStoppingShouldntStartConsumers() throws Exception
@@ -158,21 +161,20 @@
Mockito.stub(info.getEndpointConfigurationInfo()).toReturn(endpoint);
// create a consumer to spy from
- WSRPConsumer original = ((AbstractConsumerRegistry)registry).newConsumer(info);
+ WSRPConsumer original = registry.createConsumerFrom(info);
WSRPConsumer consumer = Mockito.spy(original);
// force re-init of registry from "persistence" to ensure that the spy registry actually uses our spy consumer
- ConsumerRegistry registrySpy = Mockito.spy(registry);
- Mockito.doReturn(Collections.singletonList(info).iterator()).when((AbstractConsumerRegistry)registrySpy).getProducerInfosFromStorage();
- Mockito.doReturn(consumer).when((AbstractConsumerRegistry)registrySpy).newConsumer(info);
- registrySpy.reloadConsumers();
+ AbstractConsumerRegistry registrySpy = Mockito.spy(registry);
+ Mockito.doReturn(consumer).when(registrySpy).getConsumer("foo");
+ Mockito.doReturn(Collections.singletonList(consumer)).when(registrySpy).getConsumers(false);
WSRPConsumer foo = registrySpy.getConsumer("foo");
assertTrue(foo.getProducerInfo().isActive());
assertEquals(consumer, foo);
// start consumer and check that it's properly added to the FederatingPortletInvoker
- ((AbstractConsumerRegistry)registrySpy).activateConsumer(foo);
+ registrySpy.activateConsumer(foo);
assertEquals(consumer, registrySpy.getFederatingPortletInvoker().getFederatedInvoker("foo").getPortletInvoker());
// stop the consumer and then the registry and check that consumer.start has only been called once
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v1/WSRP1ConsumerBaseTest.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -68,7 +68,7 @@
protected TestWSRPProducer producer = new TestWSRPProducerImpl();
/** . */
- protected WSRPConsumerImpl consumer = new WSRPConsumerImpl();
+ protected WSRPConsumerImpl consumer = new WSRPConsumerImpl(new ProducerInfo(new MockConsumerRegistry()));
private boolean strict = true;
@@ -88,9 +88,6 @@
setRegistrationBehavior(null);
registerAdditionalMarkupBehaviors(registry);
- // use a fresh ConsumerRegistry
- producerInfo.setRegistry(new MockConsumerRegistry());
-
// use a fresh endpoint using a behavior-backed service factory
producerInfo.setEndpointConfigurationInfo(new EndpointConfigurationInfo(new BehaviorBackedServiceFactory(registry)));
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/protocol/v2/WSRP2ConsumerBaseTest.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -68,7 +68,7 @@
protected TestWSRPProducer producer = new TestWSRPProducerImpl();
/** . */
- protected WSRPConsumerImpl consumer = new WSRPConsumerImpl();
+ protected WSRPConsumerImpl consumer = new WSRPConsumerImpl(new ProducerInfo(new MockConsumerRegistry()));
private boolean strict = true;
@@ -88,9 +88,6 @@
setRegistrationBehavior(null);
registerAdditionalMarkupBehaviors(registry);
- // use a fresh ConsumerRegistry
- producerInfo.setRegistry(new MockConsumerRegistry());
-
// use a fresh endpoint using a behavior-backed service factory
producerInfo.setEndpointConfigurationInfo(new EndpointConfigurationInfo(new BehaviorBackedServiceFactory(registry)));
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -30,11 +30,16 @@
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.EndpointConfigurationInfo;
import org.gatein.wsrp.consumer.ProducerInfo;
+import org.gatein.wsrp.consumer.handlers.session.InMemorySessionRegistry;
+import org.gatein.wsrp.consumer.handlers.session.SessionRegistry;
+import org.gatein.wsrp.consumer.migration.InMemoryMigrationService;
import org.gatein.wsrp.consumer.migration.MigrationService;
-import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
+import org.gatein.wsrp.consumer.spi.ConsumerRegistrySPI;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -43,17 +48,20 @@
* @version $Revision: 12693 $
* @since 2.6
*/
-public class MockConsumerRegistry implements ConsumerRegistry
+public class MockConsumerRegistry implements ConsumerRegistrySPI
{
- private Map consumers = new HashMap(3);
+ private Map<String, WSRPConsumer> consumers = new HashMap(3);
public static final String MOCK_SERVICE_DESCRIPTION = "mock-service-description";
public static final String MOCK_MARKUP = "mock-markup";
public static final String CONSUMER1 = "inDB";
public static final String CONSUMER2 = "inDB2";
+ private InMemorySessionRegistry sessionRegistry = new InMemorySessionRegistry();
+ private InMemoryMigrationService migrationService = new InMemoryMigrationService();
/**
* Creates a ConsumerRegistry containing 2 consumers with id '{@link #CONSUMER1}' and '{@link #CONSUMER2}'
- * respectively. CONSUMER2 is active and has a service description URL set to {@link #MOCK_SERVICE_DESCRIPTION} and a
+ * respectively. CONSUMER2 is active and has a service description URL set to {@link #MOCK_SERVICE_DESCRIPTION} and
+ * a
* markup URL set to {@link #MOCK_MARKUP}
*/
public MockConsumerRegistry()
@@ -68,7 +76,7 @@
public WSRPConsumer getConsumer(String id)
{
- return (WSRPConsumer)consumers.get(id);
+ return consumers.get(id);
}
public FederatingPortletInvoker getFederatingPortletInvoker()
@@ -97,9 +105,9 @@
// do nothing
}
- public void updateProducerInfo(ProducerInfo producerInfo)
+ public String updateProducerInfo(ProducerInfo producerInfo)
{
- // do nothing
+ return null;
}
public void deactivateConsumerWith(String id) throws ConsumerException
@@ -137,6 +145,31 @@
//To change body of implemented methods use File | Settings | File Templates.
}
+ public void save(ProducerInfo info, String messageOnError) throws ConsumerException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void delete(ProducerInfo info) throws ConsumerException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public String update(ProducerInfo producerInfo)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator<ProducerInfo> getProducerInfosFromStorage()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public ProducerInfo loadProducerInfo(String id)
+ {
+ throw new UnsupportedOperationException();
+ }
+
public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
{
//To change body of implemented methods use File | Settings | File Templates.
@@ -154,11 +187,41 @@
public MigrationService getMigrationService()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return migrationService;
}
public void setMigrationService(MigrationService migrationService)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ throw new UnsupportedOperationException();
}
+
+ public SessionRegistry getSessionRegistry()
+ {
+ return sessionRegistry;
+ }
+
+ public void setSessionRegistry(SessionRegistry sessionRegistry)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean containsConsumer(String id)
+ {
+ return consumers.containsKey(id);
+ }
+
+ public Collection<String> getConfiguredConsumersIds()
+ {
+ return consumers.keySet();
+ }
+
+ public int getConfiguredConsumerNumber()
+ {
+ return consumers.size();
+ }
+
+ public WSRPConsumer createConsumerFrom(ProducerInfo producerInfo)
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/test/support/MockWSRPConsumer.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -39,6 +39,7 @@
import org.gatein.wsrp.consumer.RefreshResult;
import org.gatein.wsrp.consumer.handlers.ProducerSessionInformation;
import org.gatein.wsrp.consumer.handlers.SessionHandler;
+import org.gatein.wsrp.consumer.handlers.session.SessionRegistry;
import org.gatein.wsrp.consumer.migration.ExportInfo;
import org.gatein.wsrp.consumer.migration.ImportInfo;
import org.gatein.wsrp.consumer.migration.MigrationService;
@@ -65,7 +66,7 @@
public MockWSRPConsumer(String id)
{
- producerInfo = new ProducerInfo();
+ producerInfo = new ProducerInfo(null);
producerInfo.setId(id);
producerInfo.setEndpointConfigurationInfo(new MockEndpointConfigurationInfo());
}
@@ -105,6 +106,16 @@
throw new NotYetImplemented();
}
+ public SessionRegistry getSessionRegistry()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void setSessionRegistry(SessionRegistry sessionInfos)
+ {
+ throw new NotYetImplemented();
+ }
+
public RegistrationContext getRegistrationContext() throws PortletInvokerException
{
throw new NotYetImplemented();
Modified: components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/hibernate-impl/src/main/java/org/gatein/wsrp/consumer/registry/hibernate/HibernateConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * Copyright 2011, 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.
@@ -42,7 +42,7 @@
private SessionFactory sessionFactory;
private String sessionFactoryJNDIName;
- protected void save(ProducerInfo info, String messageOnError)
+ public void save(ProducerInfo info, String messageOnError)
{
try
{
@@ -55,7 +55,7 @@
}
}
- protected void delete(ProducerInfo info)
+ public void delete(ProducerInfo info)
{
Session session = sessionFactory.getCurrentSession();
@@ -79,7 +79,7 @@
* @return the id that was previously assigned to the specified ProducerInfo or <code>null</code> if the id hasn't
* been modified
*/
- protected String update(ProducerInfo producerInfo)
+ public String update(ProducerInfo producerInfo)
{
String oldId;
Session session = sessionFactory.getCurrentSession();
@@ -105,13 +105,20 @@
return oldId;
}
- protected Iterator<ProducerInfo> getProducerInfosFromStorage()
+ public Iterator<ProducerInfo> getProducerInfosFromStorage()
{
Session session = sessionFactory.getCurrentSession();
return session.createQuery("from ProducerInfo pi order by pi.persistentId").iterate();
}
+ public ProducerInfo loadProducerInfo(String id)
+ {
+ Session session = sessionFactory.getCurrentSession();
+ return (ProducerInfo)session.createQuery("from ProducerInfo pi where pi.persistentId = :id")
+ .setParameter("id", id).uniqueResult();
+ }
+
@Override
public void start() throws Exception
{
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/JCRMigrationService.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/JCRMigrationService.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/JCRMigrationService.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -32,6 +32,7 @@
import org.gatein.wsrp.consumer.migration.mapping.ExportedStateMapping;
import org.gatein.wsrp.jcr.ChromatticPersister;
import org.gatein.wsrp.jcr.StoresByPathManager;
+import org.gatein.wsrp.jcr.mapping.mixins.LastModified;
import java.util.ArrayList;
import java.util.Collections;
@@ -83,7 +84,7 @@
List<ExportInfo> exportInfos = new ArrayList<ExportInfo>(exportInfoMappings.size());
for (ExportInfoMapping eim : exportInfoMappings)
{
- exportInfos.add(eim.toModel(null));
+ exportInfos.add(eim.toModel(null, null));
}
persister.closeSession(false);
@@ -115,7 +116,7 @@
{
if (eim != null)
{
- return eim.toModel(null);
+ return eim.toModel(null, null);
}
else
{
@@ -189,6 +190,11 @@
return getPathFor(exportInfo.getExportTime());
}
+ public LastModified lastModifiedToUpdateOnDelete(ChromatticSession session)
+ {
+ return null;
+ }
+
private String getPathFor(final long exportTime)
{
return getParentPath() + "/" + exportTime;
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/mapping/ExportInfoMapping.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/mapping/ExportInfoMapping.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/migration/mapping/ExportInfoMapping.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -45,7 +45,7 @@
* @version $Revision$
*/
@PrimaryType(name = ExportInfoMapping.NODE_NAME)
-public abstract class ExportInfoMapping implements BaseMapping<ExportInfo>
+public abstract class ExportInfoMapping implements BaseMapping<ExportInfo, Object>
{
public static final String NODE_NAME = "wsrp:exportinfo";
@@ -122,7 +122,7 @@
}
}
- public ExportInfo toModel(ExportInfo initial)
+ public ExportInfo toModel(ExportInfo initial, Object registry)
{
List<ExportedStateMapping> exportedStates = getExportedStates();
SortedMap<String, byte[]> states = new TreeMap<String, byte[]>();
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistry.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -35,10 +35,21 @@
import org.gatein.wsrp.consumer.registry.xml.XMLConsumerRegistry;
import org.gatein.wsrp.jcr.ChromatticPersister;
import org.gatein.wsrp.jcr.StoresByPathManager;
+import org.gatein.wsrp.jcr.mapping.mixins.BaseMixin;
+import org.gatein.wsrp.jcr.mapping.mixins.LastModified;
+import org.gatein.wsrp.jcr.mapping.mixins.ModifyRegistrationRequired;
import org.gatein.wsrp.registration.mapping.RegistrationPropertyDescriptionMapping;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.Row;
+import javax.jcr.query.RowIterator;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -52,16 +63,19 @@
{
private ChromatticPersister persister;
private boolean loadFromXMLIfNeeded;
- private static final String PRODUCER_INFOS_PATH = ProducerInfosMapping.NODE_NAME;
+ private final String rootNodePath;
+ static final String PRODUCER_INFOS_PATH = ProducerInfosMapping.NODE_NAME;
public static final List<Class> mappingClasses = new ArrayList<Class>(6);
private InputStream configurationIS;
+ private long lastModified;
+// private Map<String, ProducerInfo> infoCache;
static
{
Collections.addAll(mappingClasses, ProducerInfosMapping.class, ProducerInfoMapping.class,
EndpointInfoMapping.class, RegistrationInfoMapping.class, RegistrationPropertyMapping.class,
- RegistrationPropertyDescriptionMapping.class);
+ RegistrationPropertyDescriptionMapping.class, LastModified.class, ModifyRegistrationRequired.class);
}
public JCRConsumerRegistry(ChromatticPersister persister) throws Exception
@@ -69,10 +83,29 @@
this(persister, true);
}
+ /**
+ * for tests
+ *
+ * @param persister
+ * @param loadFromXMLIfNeeded
+ */
protected JCRConsumerRegistry(ChromatticPersister persister, boolean loadFromXMLIfNeeded)
{
+ this(persister, loadFromXMLIfNeeded, "/");
+ }
+
+ /**
+ * for tests
+ *
+ * @param persister
+ * @param loadFromXMLIfNeeded
+ * @param rootNodePath
+ */
+ protected JCRConsumerRegistry(ChromatticPersister persister, boolean loadFromXMLIfNeeded, String rootNodePath)
+ {
this.persister = persister;
this.loadFromXMLIfNeeded = loadFromXMLIfNeeded;
+ this.rootNodePath = rootNodePath.endsWith("/") ? rootNodePath : rootNodePath + "/";
}
/** @param is */
@@ -81,8 +114,7 @@
this.configurationIS = is;
}
- @Override
- protected void save(ProducerInfo info, String messageOnError)
+ public void save(ProducerInfo info, String messageOnError)
{
try
@@ -95,6 +127,17 @@
info.setKey(key);
pim.initFrom(info);
+ // update cache
+ final long now = System.currentTimeMillis();
+ lastModified = now;
+// getRefreshedInfoCache(session).put(info.getId(), info);
+
+ // GTNWSRP-239
+ getMixin(pims, session, LastModified.class).setLastModified(now);
+ getMixin(pim, session, LastModified.class).setLastModified(now);
+ getMixin(pim, session, ModifyRegistrationRequired.class).setModifyRegistrationRequired(info.isModifyRegistrationRequired());
+ info.setLastModified(now);
+
persister.closeSession(true);
}
catch (Exception e)
@@ -104,8 +147,7 @@
}
}
- @Override
- protected void delete(ProducerInfo info)
+ public void delete(ProducerInfo info)
{
if (!persister.delete(info, this))
{
@@ -113,8 +155,7 @@
}
}
- @Override
- protected String update(ProducerInfo producerInfo)
+ public String update(ProducerInfo producerInfo)
{
String key = producerInfo.getKey();
if (key == null)
@@ -142,13 +183,27 @@
idUnchanged = oldId.equals(newId);
+ final long now = System.currentTimeMillis();
if (!idUnchanged)
{
ProducerInfosMapping pims = getProducerInfosMapping(session);
Map<String, ProducerInfoMapping> nameToProducerInfoMap = pims.getNameToProducerInfoMap();
nameToProducerInfoMap.put(pim.getId(), pim);
+
+ // update cache
+ /*getRefreshedInfoCache(session).remove(oldId);
+ getRefreshedInfoCache(session).put(newId, producerInfo);*/
+
+ // GTNWSRP-239
+ getMixin(pims, session, LastModified.class).setLastModified(now);
+ lastModified = now;
}
+ // GTNWSRP-239
+ getMixin(pim, session, ModifyRegistrationRequired.class).setModifyRegistrationRequired(producerInfo.isModifyRegistrationRequired());
+ getMixin(pim, session, LastModified.class).setLastModified(now);
+ producerInfo.setLastModified(now);
+
persister.closeSession(true);
}
@@ -156,19 +211,197 @@
return idUnchanged ? null : oldId;
}
- @Override
- protected Iterator<ProducerInfo> getProducerInfosFromStorage()
+ public Iterator<ProducerInfo> getProducerInfosFromStorage()
{
ChromatticSession session = persister.getSession();
+ final Iterator<ProducerInfo> iterator = new ProducerInfoIterator(getRefreshedInfoCache(session).getConsumers().iterator());
+ persister.closeSession(false);
+ return iterator;
+ }
+
+ /*private Map<String, ProducerInfo> getRefreshedInfoCache(ChromatticSession session)
+ {
ProducerInfosMapping producerInfosMapping = getProducerInfosMapping(session);
- List<ProducerInfoMapping> mappings = producerInfosMapping.getProducerInfos();
+ // check if we need to refresh the local cache
+ if (lastModified < getMixin(producerInfosMapping, session, LastModified.class).getLastModified())
+ {
+ List<ProducerInfoMapping> mappings = producerInfosMapping.getProducerInfos();
- persister.closeSession(true);
- return new MappingToProducerInfoIterator(mappings.iterator());
+ for (ProducerInfoMapping mapping : mappings)
+ {
+ infoCache.put(mapping.getId(), mapping.toModel(null, this));
+ }
+
+ lastModified = System.currentTimeMillis();
+ }
+
+ return infoCache;
+ }*/
+
+ private ConsumerCache getRefreshedInfoCache(ChromatticSession session)
+ {
+ ProducerInfosMapping producerInfosMapping = getProducerInfosMapping(session);
+
+ // check if we need to refresh the local cache
+ if (lastModified < getMixin(producerInfosMapping, session, LastModified.class).getLastModified())
+ {
+ List<ProducerInfoMapping> mappings = producerInfosMapping.getProducerInfos();
+
+ for (ProducerInfoMapping pim : mappings)
+ {
+ if (lastModified < getMixin(pim, session, LastModified.class).getLastModified())
+ {
+ consumers.putConsumer(pim.getId(), createConsumerFrom(pim.toModel(null, this)));
+ }
+ }
+
+ lastModified = System.currentTimeMillis();
+ }
+
+ return consumers;
}
+ public ProducerInfo loadProducerInfo(String id)
+ {
+ ChromatticSession session = persister.getSession();
+ try
+ {
+ ProducerInfoMapping pim = session.findByPath(ProducerInfoMapping.class, getPathFor(id));
+
+ if (pim != null)
+ {
+ WSRPConsumer consumer = getRefreshedInfoCache(session).getConsumer(id);
+
+ if (consumer == null)
+ {
+ return null;
+ }
+ else
+ {
+ return consumer.getProducerInfo();
+ /*ProducerInfo producerInfo = consumer.getProducerInfo();
+ if(producerInfo == null || producerInfo.getLastModified() < getMixin(pim, session, LastModified.class).getLastModified())
+ {
+ producerInfo = pim.toModel(producerInfo, this);
+ getRefreshedInfoCache(session).put(id, producerInfo);
+ return producerInfo;
+ }
+ else
+ {
+ return producerInfo;
+ }*/
+ }
+
+ }
+ else
+ {
+ return null;
+ }
+ }
+ finally
+ {
+ persister.closeSession(false);
+ }
+ }
+
+ private <M extends BaseMixin> M getMixin(Object objectToCheck, ChromatticSession session, Class<M> type)
+ {
+ M mixin = session.getEmbedded(objectToCheck, type);
+ if (mixin == null)
+ {
+ mixin = session.create(type);
+ session.setEmbedded(objectToCheck, type, mixin);
+ mixin.initializeValue();
+ }
+ return mixin;
+ }
+
+ @Override
+ public boolean containsConsumer(String id)
+ {
+ ChromatticSession session = persister.getSession();
+ try
+ {
+ return session.getJCRSession().itemExists(rootNodePath + getPathFor(id));
+ }
+ catch (RepositoryException e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ persister.closeSession(false);
+ }
+ }
+
+ @Override
+ public Collection<String> getConfiguredConsumersIds()
+ {
+ ChromatticSession session = persister.getSession();
+ try
+ {
+ final RowIterator rows = getProducerInfoIds(session);
+
+ final long size = rows.getSize();
+ if (size == 0)
+ {
+ return Collections.emptyList();
+ }
+ else
+ {
+ List<String> ids = new ArrayList<String>(size != -1 ? (int)size : 7);
+
+ while (rows.hasNext())
+ {
+ final Row row = rows.nextRow();
+ final Value rowValue = row.getValue("producerid");
+ ids.add(rowValue.getString());
+ }
+
+ return ids;
+ }
+ }
+ catch (RepositoryException e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ persister.closeSession(false);
+ }
+ }
+
+ private RowIterator getProducerInfoIds(ChromatticSession session) throws RepositoryException
+ {
+ final Session jcrSession = session.getJCRSession();
+
+ final Query query = jcrSession.getWorkspace().getQueryManager().createQuery("select producerid from wsrp:producerinfo", Query.SQL);
+ final QueryResult queryResult = query.execute();
+ return queryResult.getRows();
+ }
+
+ @Override
+ public int getConfiguredConsumerNumber()
+ {
+ ChromatticSession session = persister.getSession();
+ try
+ {
+ final RowIterator ids = getProducerInfoIds(session);
+
+ return (int)ids.getSize();
+ }
+ catch (RepositoryException e)
+ {
+ throw new RuntimeException(e);
+ }
+ finally
+ {
+ persister.closeSession(false);
+ }
+ }
+
private ProducerInfosMapping getProducerInfosMapping(ChromatticSession session)
{
ProducerInfosMapping producerInfosMapping = session.findByPath(ProducerInfosMapping.class, PRODUCER_INFOS_PATH);
@@ -186,8 +419,8 @@
// Save to JCR
List<ProducerInfoMapping> infos = producerInfosMapping.getProducerInfos();
- List<WSRPConsumer> consumers = fromXML.getConfiguredConsumers();
- for (WSRPConsumer consumer : consumers)
+ List<WSRPConsumer> xmlConsumers = fromXML.getConfiguredConsumers();
+ for (WSRPConsumer consumer : xmlConsumers)
{
ProducerInfo info = consumer.getProducerInfo();
@@ -198,7 +431,16 @@
// init it from ProducerInfo
pim.initFrom(info);
+
+ // update ProducerInfo with the persistence key
+ info.setKey(pim.getKey());
+
+ consumers.putConsumer(info.getId(), consumer);
}
+
+ lastModified = System.currentTimeMillis();
+ getMixin(producerInfosMapping, session, LastModified.class).setLastModified(lastModified);
+ session.save();
}
}
@@ -210,11 +452,30 @@
return getPathFor(needsComputedPath);
}
+ public LastModified lastModifiedToUpdateOnDelete(ChromatticSession session)
+ {
+ final ProducerInfosMapping pims = session.findByPath(ProducerInfosMapping.class, PRODUCER_INFOS_PATH);
+ if (pims != null)
+ {
+ // GTNWSRP-239
+ return getMixin(pims, session, LastModified.class);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
private static String getPathFor(ProducerInfo info)
{
- return PRODUCER_INFOS_PATH + "/" + info.getId();
+ return getPathFor(info.getId());
}
+ private static String getPathFor(final String producerInfoId)
+ {
+ return PRODUCER_INFOS_PATH + "/" + producerInfoId;
+ }
+
private static ProducerInfoMapping toProducerInfoMapping(ProducerInfo producerInfo, ChromatticSession session)
{
ProducerInfoMapping pim = session.findById(ProducerInfoMapping.class, producerInfo.getKey());
@@ -228,13 +489,25 @@
return pim;
}
+ /**
+ * For tests
+ *
+ * @return
+ */
+ ChromatticPersister getPersister()
+ {
+ return persister;
+ }
+
private static class MappingToProducerInfoIterator implements Iterator<ProducerInfo>
{
private Iterator<ProducerInfoMapping> mappings;
+ private final JCRConsumerRegistry registry;
- public MappingToProducerInfoIterator(Iterator<ProducerInfoMapping> infoMappingIterator)
+ public MappingToProducerInfoIterator(Iterator<ProducerInfoMapping> infoMappingIterator, JCRConsumerRegistry jcrConsumerRegistry)
{
this.mappings = infoMappingIterator;
+ this.registry = jcrConsumerRegistry;
}
public boolean hasNext()
@@ -244,7 +517,7 @@
public ProducerInfo next()
{
- return mappings.next().toModel(null);
+ return mappings.next().toModel(null, registry);
}
public void remove()
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/ProducerInfoMapping.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/ProducerInfoMapping.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/consumer/registry/mapping/ProducerInfoMapping.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -33,6 +33,7 @@
import org.gatein.wsrp.consumer.EndpointConfigurationInfo;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.RegistrationInfo;
+import org.gatein.wsrp.consumer.spi.ConsumerRegistrySPI;
import org.gatein.wsrp.jcr.mapping.BaseMapping;
/**
@@ -40,7 +41,7 @@
* @version $Revision$
*/
@PrimaryType(name = ProducerInfoMapping.NODE_NAME)
-public abstract class ProducerInfoMapping implements BaseMapping<ProducerInfo>
+public abstract class ProducerInfoMapping implements BaseMapping<ProducerInfo, ConsumerRegistrySPI>
{
public static final String NODE_NAME = "wsrp:producerinfo";
@@ -92,10 +93,14 @@
rim.initFrom(regInfo);
}
- public ProducerInfo toModel(ProducerInfo initial)
+ public ProducerInfo toModel(ProducerInfo initial, ConsumerRegistrySPI registry)
{
// todo: should probably use a ProducerInfo implementation backed by mapping at some point
- ProducerInfo info = new ProducerInfo();
+ ProducerInfo info = initial;
+ if (initial == null)
+ {
+ info = new ProducerInfo(registry);
+ }
// basic properties
info.setKey(getKey());
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/BaseChromatticPersister.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/BaseChromatticPersister.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/BaseChromatticPersister.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,24 +1,25 @@
/*
-* JBoss, a division of Red Hat
-* Copyright 2008, 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.
-*/
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.jcr;
@@ -27,6 +28,7 @@
import org.chromattic.api.ChromatticSession;
import org.gatein.common.util.ParameterValidation;
import org.gatein.wsrp.jcr.mapping.BaseMapping;
+import org.gatein.wsrp.jcr.mapping.mixins.LastModified;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -125,7 +127,7 @@
getOpenedSessionOrFail().save();
}
- public <T> boolean delete(T toDelete, org.gatein.wsrp.jcr.StoresByPathManager<T> manager)
+ public <T> boolean delete(T toDelete, StoresByPathManager<T> manager)
{
Class<? extends Object> modelClass = toDelete.getClass();
Class<? extends BaseMapping> baseMappingClass = modelToMapping.get(modelClass);
@@ -141,6 +143,13 @@
if (old != null)
{
session.remove(old);
+
+ // update last modified of element linked to toDelete if needed
+ final LastModified lastModified = manager.lastModifiedToUpdateOnDelete(session);
+ if (lastModified != null)
+ {
+ lastModified.setLastModified(System.currentTimeMillis());
+ }
closeSession(true);
return true;
}
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/StoresByPathManager.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/StoresByPathManager.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/StoresByPathManager.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -23,6 +23,9 @@
package org.gatein.wsrp.jcr;
+import org.chromattic.api.ChromatticSession;
+import org.gatein.wsrp.jcr.mapping.mixins.LastModified;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -30,4 +33,12 @@
public interface StoresByPathManager<C>
{
String getChildPath(C needsComputedPath);
+
+ /**
+ * // GTNWSRP-239
+ *
+ * @param session
+ * @return
+ */
+ LastModified lastModifiedToUpdateOnDelete(ChromatticSession session);
}
Modified: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/BaseMapping.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/BaseMapping.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/BaseMapping.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -27,9 +27,9 @@
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-public interface BaseMapping<T>
+public interface BaseMapping<T, R>
{
void initFrom(T model);
- T toModel(T initial);
+ T toModel(T initial, R registry);
}
Deleted: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java
===================================================================
--- components/wsrp/branches/clustering/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java 2011-09-13 17:53:13 UTC (rev 7390)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,30 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, 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.gatein.wsrp.jcr.mapping.mixins;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
-public interface BaseMixin
-{
- void initializeValue();
-}
Copied: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java (from rev 7390, components/wsrp/branches/clustering/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java)
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java (rev 0)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/BaseMixin.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.jcr.mapping.mixins;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+public interface BaseMixin
+{
+ void initializeValue();
+}
Deleted: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java
===================================================================
--- components/wsrp/branches/clustering/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java 2011-09-13 17:53:13 UTC (rev 7390)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,42 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, 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.gatein.wsrp.jcr.mapping.mixins;
-
-import org.chromattic.api.annotations.MixinType;
-import org.chromattic.api.annotations.Property;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
-@MixinType(name = "wsrp:lastmodified")
-public abstract class LastModified implements BaseMixin
-{
- @Property(name = "wsrp:time")
- public abstract long getLastModified();
-
- public abstract void setLastModified(long lastModified);
-
- public void initializeValue()
- {
- setLastModified(System.currentTimeMillis());
- }
-}
Copied: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java (from rev 7390, components/wsrp/branches/clustering/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java)
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java (rev 0)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/LastModified.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.jcr.mapping.mixins;
+
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+@MixinType(name = "wsrp:lastmodified")
+public abstract class LastModified implements BaseMixin
+{
+ @Property(name = "wsrp:time")
+ public abstract long getLastModified();
+
+ public abstract void setLastModified(long lastModified);
+
+ public void initializeValue()
+ {
+ setLastModified(System.currentTimeMillis());
+ }
+}
Deleted: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java
===================================================================
--- components/wsrp/branches/clustering/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java 2011-09-13 17:53:13 UTC (rev 7390)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -1,42 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2011, 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.gatein.wsrp.jcr.mapping.mixins;
-
-import org.chromattic.api.annotations.MixinType;
-import org.chromattic.api.annotations.Property;
-
-/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
-@MixinType(name = "wsrp:modifyregistrationrequired")
-public abstract class ModifyRegistrationRequired implements BaseMixin
-{
- @Property(name = "wsrp:ismodifyregistrationrequired")
- public abstract boolean isModifyRegistrationRequired();
-
- public abstract void setModifyRegistrationRequired(boolean modifyRegistrationRequired);
-
- public void initializeValue()
- {
- setModifyRegistrationRequired(false);
- }
-}
Copied: components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java (from rev 7390, components/wsrp/branches/clustering/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java)
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java (rev 0)
+++ components/wsrp/trunk/jcr-impl/src/main/java/org/gatein/wsrp/jcr/mapping/mixins/ModifyRegistrationRequired.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2011, 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.gatein.wsrp.jcr.mapping.mixins;
+
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/** @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a> */
+@MixinType(name = "wsrp:modifyregistrationrequired")
+public abstract class ModifyRegistrationRequired implements BaseMixin
+{
+ @Property(name = "wsrp:ismodifyregistrationrequired")
+ public abstract boolean isModifyRegistrationRequired();
+
+ public abstract void setModifyRegistrationRequired(boolean modifyRegistrationRequired);
+
+ public void initializeValue()
+ {
+ setModifyRegistrationRequired(false);
+ }
+}
Modified: components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml
===================================================================
--- components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/main/resources/conf/nodetypes/consumers-configuration-nodetypes.xml 2011-09-13 21:39:17 UTC (rev 7393)
@@ -26,6 +26,24 @@
<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0">
+ <nodeType name="wsrp:lastmodified" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="wsrp:time" requiredType="long" autoCreated="false" mandatory="false"
+ onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
+ <nodeType name="wsrp:modifyregistrationrequired" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+ <propertyDefinitions>
+ <propertyDefinition name="wsrp:ismodifyregistrationrequired" requiredType="boolean" autoCreated="false"
+ mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+ <valueConstraints/>
+ </propertyDefinition>
+ </propertyDefinitions>
+ </nodeType>
+
<nodeType name="wsrp:producerinfos" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
<supertypes>
<supertype>nt:base</supertype>
Modified: components/wsrp/trunk/jcr-impl/src/test/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistryTestCase.java
===================================================================
--- components/wsrp/trunk/jcr-impl/src/test/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistryTestCase.java 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/jcr-impl/src/test/java/org/gatein/wsrp/consumer/registry/JCRConsumerRegistryTestCase.java 2011-09-13 21:39:17 UTC (rev 7393)
@@ -26,7 +26,12 @@
import org.chromattic.api.ChromatticBuilder;
import org.gatein.pc.federation.impl.FederatingPortletInvokerService;
import org.gatein.wsrp.jcr.BaseChromatticPersister;
+import org.gatein.wsrp.jcr.ChromatticPersister;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+
/**
* This is essentially the same class as org.gatein.wsrp.state.consumer.ConsumerRegistryTestCase in WSRP consumer
* module
@@ -37,6 +42,9 @@
*/
public class JCRConsumerRegistryTestCase extends ConsumerRegistryTestCase
{
+
+ private String workspaceName;
+
/**
* Incremented for each test so that we can append it to the workspace name and work with a "clean" DB for each
* test.
@@ -45,7 +53,8 @@
@Override
protected void setUp() throws Exception
{
- String workspaceName = "/wsrp-jcr-test" + Math.round(Math.abs(100000 * Math.random()));
+ final long random = Math.round(Math.abs(100000 * Math.random()));
+ workspaceName = "/wsrp-jcr-test" + random;
BaseChromatticPersister persister = new BaseChromatticPersister(workspaceName)
{
@Override
@@ -57,11 +66,28 @@
}
};
persister.initializeBuilderFor(JCRConsumerRegistry.mappingClasses);
- registry = new JCRConsumerRegistry(persister, false);
+ registry = new JCRConsumerRegistry(persister, false, workspaceName);
registry.setFederatingPortletInvoker(new FederatingPortletInvokerService());
}
@Override
+ protected void tearDown() throws Exception
+ {
+ // remove node containing consumer informations so that we can start with a clean state
+ final ChromatticPersister persister = ((JCRConsumerRegistry)registry).getPersister();
+ final Session session = persister.getSession().getJCRSession();
+ final Node rootNode = session.getRootNode();
+ final NodeIterator nodes = rootNode.getNodes();
+ while (nodes.hasNext())
+ {
+ nodes.nextNode().remove();
+ }
+
+ // then save
+ persister.closeSession(true);
+ }
+
+ @Override
public void testStoppingShouldntStartConsumers() throws Exception
{
// override to bypass this test as I couldn't find a way to make it work properly (i.e. how to inject a Mock
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2011-09-13 21:20:35 UTC (rev 7392)
+++ components/wsrp/trunk/pom.xml 2011-09-13 21:39:17 UTC (rev 7393)
@@ -47,7 +47,7 @@
</scm>
<properties>
- <org.gatein.pc.version>2.3.0-Beta05</org.gatein.pc.version>
+ <org.gatein.pc.version>2.3.0-Beta06-SNAPSHOT</org.gatein.pc.version>
<org.gatein.common.version>2.0.4-Beta02</org.gatein.common.version>
<org.gatein.wci.version>2.1.0-Beta01</org.gatein.wci.version>
13 years, 4 months
gatein SVN: r7392 - epp/portal/branches/EPP_5_2_Branch.
by do-not-reply@jboss.org
Author: hfnukal
Date: 2011-09-13 17:20:35 -0400 (Tue, 13 Sep 2011)
New Revision: 7392
Modified:
epp/portal/branches/EPP_5_2_Branch/settings-all.xml
Log:
JBEPP-1091 added exo repository
Modified: epp/portal/branches/EPP_5_2_Branch/settings-all.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/settings-all.xml 2011-09-13 19:34:51 UTC (rev 7391)
+++ epp/portal/branches/EPP_5_2_Branch/settings-all.xml 2011-09-13 21:20:35 UTC (rev 7392)
@@ -50,6 +50,19 @@
</snapshots>
</repository>
<repository>
+ <id>exo-maven</id>
+ <name>Exo Maven 2 Repository</name>
+ <url>http://maven2.exoplatform.org/content/repositories/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
<id>jboss-maven2-deprecated</id>
<name>JBoss Maven 2 deprecated Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
13 years, 4 months
gatein SVN: r7391 - in epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools: gatein-management and 1 other directory.
by do-not-reply@jboss.org
Author: hfnukal
Date: 2011-09-13 15:34:51 -0400 (Tue, 13 Sep 2011)
New Revision: 7391
Added:
epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/gatein-management/
epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/gatein-management/pom.xml
Modified:
epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/pom.xml
Log:
JBEPP-1091 mead build import for gatein-management, not yet git support
Added: epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/gatein-management/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/gatein-management/pom.xml (rev 0)
+++ epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/gatein-management/pom.xml 2011-09-13 19:34:51 UTC (rev 7391)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.exoplatform.portal.mead</groupId>
+ <artifactId>mead.parent</artifactId>
+ <version>5.2.0-epp-DEV04-SNAPSHOT</version>
+ <relativePath>../mead.parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>mead-gatein-management</artifactId>
+ <packaging>pom</packaging>
+
+ <properties>
+
+ <mead.svn.base>${svn.base}</mead.svn.base>
+ <mead.svn.repo>${svn.gatein.repo}</mead.svn.repo>
+ <mead.svn.path>${gatein-common.svnpath}</mead.svn.path>
+
+ <mead.build.profiles></mead.build.profiles>
+ <mead.build.properties></mead.build.properties>
+ <mead.patch.path></mead.patch.path>
+
+ </properties>
+</project>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/pom.xml 2011-09-13 17:53:13 UTC (rev 7390)
+++ epp/portal/branches/EPP_5_2_Branch/distribution/mead-tools/pom.xml 2011-09-13 19:34:51 UTC (rev 7391)
@@ -101,6 +101,7 @@
<module>gatein-mop </module>
<module>gatein-simplecaptcha </module>
<module>gatein-shindig </module>
+ <module>gatein-management </module>
<module>gatein-packager </module>
<module>jboss-picketlink-idm </module>
<module>gatein-portal </module>
@@ -206,6 +207,14 @@
</modules>
</profile>
+<!--gatein-management-->
+ <profile>
+ <id>gatein-management</id>
+ <modules>
+ <module>gatein-management</module>
+ </modules>
+ </profile>
+
<!--jboss-picketlink-idm-->
<profile>
<id>jboss-picketlink-idm</id>
13 years, 4 months
gatein SVN: r7390 - epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear.
by do-not-reply@jboss.org
Author: nscavell
Date: 2011-09-13 13:53:13 -0400 (Tue, 13 Sep 2011)
New Revision: 7390
Modified:
epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml
Log:
Fix gwtGadgets web module for application.xml
Modified: epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml 2011-09-13 17:09:53 UTC (rev 7389)
+++ epp/portal/branches/EPP_5_2_Branch/distribution/jboss-epp/serverAddon/gatein.ear/pom.xml 2011-09-13 17:53:13 UTC (rev 7390)
@@ -1379,6 +1379,12 @@
</webModule>
<webModule>
<groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.gwtGadgets</artifactId>
+ <contextRoot>gwtGadgets</contextRoot>
+ <bundleFileName>gwtGadgets.war</bundleFileName>
+ </webModule>
+ <webModule>
+ <groupId>org.exoplatform.portal</groupId>
<artifactId>exo.portal.portlet.web</artifactId>
<contextRoot>web</contextRoot>
<bundleFileName>web.war</bundleFileName>
13 years, 4 months
gatein SVN: r7389 - components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-09-13 13:09:53 -0400 (Tue, 13 Sep 2011)
New Revision: 7389
Modified:
components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
Log:
- ProducerBean should now be available on clusters, though more testing needs to be done.
Modified: components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java
===================================================================
--- components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-09-13 17:03:26 UTC (rev 7388)
+++ components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/ProducerBean.java 2011-09-13 17:09:53 UTC (rev 7389)
@@ -36,6 +36,7 @@
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
+import java.io.Serializable;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -46,7 +47,7 @@
* @version $Revision: 12854 $
* @since 2.6.3
*/
-public class ProducerBean extends ManagedBean
+public class ProducerBean extends ManagedBean implements Serializable
{
private transient ProducerConfigurationService configurationService;
private String policyClassName;
@@ -58,6 +59,10 @@
public ProducerConfigurationService getConfigurationService()
{
+ if (configurationService == null)
+ {
+ configurationService = beanContext.findBean("ProducerConfigurationService", ProducerConfigurationService.class);
+ }
return configurationService;
}
13 years, 4 months
gatein SVN: r7388 - components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-09-13 13:03:26 -0400 (Tue, 13 Sep 2011)
New Revision: 7388
Modified:
components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
Log:
- Improved findBean slightly.
Modified: components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
===================================================================
--- components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2011-09-13 15:25:10 UTC (rev 7387)
+++ components/wsrp/branches/clustering/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2011-09-13 17:03:26 UTC (rev 7388)
@@ -63,8 +63,25 @@
public <T> T findBean(String name, Class<T> type)
{
final FacesContext facesContext = FacesContext.getCurrentInstance();
- final Object candidate = facesContext.getApplication().evaluateExpressionGet(facesContext, "#{" + name + "}", type);
- return checkObject(candidate, type, "Bean named '" + name + "' is not of type '" + type.getSimpleName() + "'");
+
+ // try to get the bean from the application map first
+ final Map<String, Object> applicationMap = facesContext.getExternalContext().getApplicationMap();
+ Object candidate = applicationMap.get(name);
+
+ if (candidate == null)
+ {
+ // try to get the bean from an EL expression
+ candidate = facesContext.getApplication().evaluateExpressionGet(facesContext, "#{" + name + "}", type);
+ }
+
+ if (candidate != null)
+ {
+ return checkObject(candidate, type, "Bean named '" + name + "' is not of type '" + type.getSimpleName() + "'");
+ }
+ else
+ {
+ return null;
+ }
}
public static Map<String, Object> getSessionMap(FacesContext facesContext)
13 years, 4 months
gatein SVN: r7387 - in epp/portal/branches/EPP_5_2_Branch/wsrp-integration: extension-config and 1 other directories.
by do-not-reply@jboss.org
Author: theute
Date: 2011-09-13 11:25:10 -0400 (Tue, 13 Sep 2011)
New Revision: 7387
Modified:
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml
epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml
Log:
pom dependencies tuning
Modified: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml 2011-09-13 15:23:55 UTC (rev 7386)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-component/pom.xml 2011-09-13 15:25:10 UTC (rev 7387)
@@ -45,6 +45,12 @@
<groupId>org.gatein.wsrp</groupId>
<artifactId>wsrp-consumer</artifactId>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>apache-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.gatein.wsrp</groupId>
@@ -54,6 +60,7 @@
<dependency>
<groupId>org.gatein.mop</groupId>
<artifactId>mop-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gatein.wsrp</groupId>
@@ -66,6 +73,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-wss</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.gatein.pc</groupId>
<artifactId>pc-api</artifactId>
<scope>provided</scope>
@@ -99,12 +111,19 @@
<dependency>
<groupId>org.gatein.wci</groupId>
<artifactId>wci-wci</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.ws.native</groupId>
<artifactId>jbossws-native-core</artifactId>
<version>3.1.2.GA</version>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>wscommons-policy</groupId>
+ <artifactId>policy</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<!-- tests -->
Modified: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml 2011-09-13 15:23:55 UTC (rev 7386)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-config/pom.xml 2011-09-13 15:25:10 UTC (rev 7387)
@@ -37,4 +37,4 @@
<finalName>extension-config</finalName>
</build>
-</project>
+</project>
\ No newline at end of file
Modified: epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml 2011-09-13 15:23:55 UTC (rev 7386)
+++ epp/portal/branches/EPP_5_2_Branch/wsrp-integration/extension-ear/pom.xml 2011-09-13 15:25:10 UTC (rev 7387)
@@ -22,7 +22,8 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>gatein-wsrp-integration-parent</artifactId>
13 years, 4 months
gatein SVN: r7386 - components/wsrp/branches/clustering/admin-gui/src/test/java/org/gatein/wsrp/admin/ui.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2011-09-13 11:23:55 -0400 (Tue, 13 Sep 2011)
New Revision: 7386
Modified:
components/wsrp/branches/clustering/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java
Log:
- Fixed tests.
Modified: components/wsrp/branches/clustering/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java
===================================================================
--- components/wsrp/branches/clustering/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java 2011-09-13 15:21:06 UTC (rev 7385)
+++ components/wsrp/branches/clustering/admin-gui/src/test/java/org/gatein/wsrp/admin/ui/ConsumerBeanTestCase.java 2011-09-13 15:23:55 UTC (rev 7386)
@@ -52,8 +52,13 @@
protected void setUp() throws Exception
{
bean = new ConsumerBean();
+
ConsumerRegistry registry = new TestInMemoryConsumerRegistry();
registry.createConsumer(CONSUMER_ID, null, WSDL);
+ ConsumerManagerBean managerBean = new ConsumerManagerBean();
+ managerBean.setRegistry(registry);
+ bean.setManager(managerBean);
+
bean.setBeanContext(new TestBeanContext());
// consumer associated with bean is null at this point so it should be loaded from the registry
13 years, 4 months