gatein SVN: r1424 - in portal/trunk: webui/core/src/main/java/org/exoplatform/webui/application/replication and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-22 17:39:11 -0500 (Fri, 22 Jan 2010)
New Revision: 1424
Added:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ApplicationState.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/SerializationContextSingleton.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java
Removed:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/SerializationContext.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
Log:
more replication work
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22 22:25:49 UTC (rev 1423)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -31,8 +31,8 @@
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.login.LoginException;
-import javax.security.jacc.PolicyContext;
import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
/**
* A login module implementation that relies on the token store to check the
@@ -50,11 +50,37 @@
public class PortalLoginModule extends AbstractLoginModule
{
- /**
- * Logger.
- */
- protected Log log = ExoLogger.getLogger(PortalLoginModule.class);
+ /** Logger. */
+ private static final Log log = ExoLogger.getLogger(PortalLoginModule.class);
+ /** JACC get context method. */
+ private static final Method getContextMethod;
+
+ static
+ {
+ Method getContext = null;
+ if (isClusteredSSO())
+ {
+ log.debug("About to configure clustered SSO");
+ try
+ {
+ Class<?> policyContextClass = Thread.currentThread().getContextClassLoader().loadClass("javax.security.jacc.PolicyContext");
+ getContext = policyContextClass.getDeclaredMethod("getContext", String.class);
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ log.debug("JACC not found ignoring it", ignore);
+ }
+ catch (Exception e)
+ {
+ log.error("Could not obtain JACC get context method", e);
+ }
+ }
+
+ //
+ getContextMethod = getContext;
+ }
+
public static final String AUTHENTICATED_CREDENTIALS = "authenticatedCredentials";
/**
@@ -85,15 +111,13 @@
// For clustered config check credentials stored and propagated in session. This won't work in tomcat because
// of lack of JACC PolicyContext so the code must be a bit defensive
- if (o == null && isClusteredSSO() && password.startsWith(InitiateLoginServlet.COOKIE_NAME))
+ if (o == null && getContextMethod != null && password.startsWith(InitiateLoginServlet.COOKIE_NAME))
{
- HttpServletRequest request = null;
+ HttpServletRequest request;
try
{
- request = (HttpServletRequest)PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
-
+ request = (HttpServletRequest)getContextMethod.invoke(null, "javax.servlet.http.HttpServletRequest");
o = request.getSession().getAttribute(AUTHENTICATED_CREDENTIALS);
-
}
catch(Throwable e)
{
@@ -128,7 +152,7 @@
public boolean commit() throws LoginException
{
- if (isClusteredSSO() &&
+ if (getContextMethod != null &&
sharedState.containsKey("javax.security.auth.login.name") &&
sharedState.containsKey("javax.security.auth.login.password"))
{
@@ -140,10 +164,8 @@
HttpServletRequest request = null;
try
{
- request = (HttpServletRequest)PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
-
+ request = (HttpServletRequest)getContextMethod.invoke(null, "javax.servlet.http.HttpServletRequest");
request.getSession().setAttribute(AUTHENTICATED_CREDENTIALS, wc);
-
}
catch(Exception e)
{
@@ -177,7 +199,7 @@
return log;
}
- protected boolean isClusteredSSO()
+ protected static boolean isClusteredSSO()
{
return ExoContainer.getProfiles().contains("cluster");
}
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/SerializationContext.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/SerializationContext.java 2010-01-22 22:25:49 UTC (rev 1423)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/replication/SerializationContext.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -25,9 +25,7 @@
import org.exoplatform.webui.application.replication.serial.ObjectReader;
import org.exoplatform.webui.application.replication.serial.ObjectWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import java.io.*;
import java.lang.reflect.ParameterizedType;
import java.util.HashMap;
import java.util.Map;
@@ -101,6 +99,13 @@
return (O)in.readObject();
}
+ public void write(Object o, OutputStream out) throws IOException
+ {
+ ObjectWriter writer = new ObjectWriter(this, out);
+ writer.writeObject(o);
+ writer.flush();
+ }
+
public byte[] write(Object o) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -116,4 +121,10 @@
ObjectReader in = new ObjectReader(this, bais);
return in.readObject();
}
+
+ public Object read(InputStream in ) throws IOException, ClassNotFoundException
+ {
+ ObjectReader or = new ObjectReader(this, in);
+ return or.readObject();
+ }
}
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2010-01-22 22:25:49 UTC (rev 1423)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -20,6 +20,7 @@
package org.exoplatform.portal.application;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.portal.application.replication.ReplicatingStateManager;
import org.exoplatform.webui.application.StateManager;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
Deleted: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java 2010-01-22 22:25:49 UTC (rev 1423)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.exoplatform.portal.application;
-
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.services.organization.Query;
-import org.exoplatform.webui.Util;
-import org.exoplatform.webui.application.ConfigurationManager;
-import org.exoplatform.webui.application.StateManager;
-import org.exoplatform.webui.application.WebuiApplication;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.application.portlet.PortletRequestContext;
-import org.exoplatform.webui.application.replication.SerializationContext;
-import org.exoplatform.webui.application.replication.api.annotations.Serialized;
-import org.exoplatform.webui.application.replication.api.factory.CreateException;
-import org.exoplatform.webui.application.replication.api.factory.ObjectFactory;
-import org.exoplatform.webui.application.replication.model.FieldModel;
-import org.exoplatform.webui.application.replication.model.TypeDomain;
-import org.exoplatform.webui.application.replication.model.metadata.DomainMetaData;
-import org.exoplatform.webui.application.replication.serial.ObjectWriter;
-import org.exoplatform.webui.config.Component;
-import org.exoplatform.webui.core.UIApplication;
-import org.exoplatform.webui.core.UIComponent;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.util.Map;
-
-/**
- * The basis is either {@link org.exoplatform.webui.core.UIPortletApplication} or
- * {@link org.exoplatform.portal.webui.workspace.UIPortalApplication}.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ReplicatingStateManager extends StateManager
-{
-
- @Override
- public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws Exception
- {
- context.setStateManager(this);
-
- //
- WebuiApplication app = (WebuiApplication)context.getApplication();
-
- //
- HttpSession session = getSession(context);
- String key = getKey(context);
-
- //
- UIApplication uiapp = (UIApplication)session.getAttribute("bilto_" + key);
-
- // Looks like some necessary hacking
- if (context instanceof PortalRequestContext)
- {
- PortalRequestContext portalRC = (PortalRequestContext)context;
- UserPortalConfig config = getUserPortalConfig(portalRC);
- if (config == null)
- {
- HttpServletResponse response = portalRC.getResponse();
- response.sendRedirect(portalRC.getRequest().getContextPath() + "/portal-unavailable.jsp");
- portalRC.setResponseComplete(true);
- return null;
- }
- portalRC.setAttribute(UserPortalConfig.class, config);
-// SessionManagerContainer pcontainer = (SessionManagerContainer)app.getApplicationServiceContainer();
-// pcontainer.createSessionContainer(context.getSessionId(), uiapp.getOwner());
- }
-
- //
- if (uiapp == null)
- {
- ConfigurationManager cmanager = app.getConfigurationManager();
- String uirootClass = cmanager.getApplication().getUIRootComponent();
- Class<? extends UIApplication> type = (Class<UIApplication>) Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
- uiapp = app.createUIComponent(type, null, null, context);
- }
-
- //
- return uiapp;
- }
-
- @Override
- public void storeUIRootComponent(final WebuiRequestContext context) throws Exception
- {
- UIApplication uiapp = context.getUIApplication();
-
- //
- HttpSession session = getSession(context);
-
- //
- Class<? extends UIApplication> appClass = uiapp.getClass();
- if (appClass.getAnnotation(Serialized.class) != null)
- {
- try
- {
- DomainMetaData domainMetaData = new DomainMetaData();
- domainMetaData.addClassType(Query.class, true);
-
- //
- SerializationContext serializationContext = (SerializationContext)session.getAttribute("SerializationContext");
- if (serializationContext == null)
- {
- TypeDomain domain = new TypeDomain(domainMetaData, true);
- serializationContext = new SerializationContext(domain);
- session.setAttribute("SerializationContext", serializationContext);
- ObjectFactory<UIComponent> factory = new ObjectFactory<UIComponent>()
- {
-
- private <S extends UIComponent> Object getFieldValue(String fieldName, Map<FieldModel<? super S, ?>, ?> state)
- {
- for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet())
- {
- FieldModel<? super S, ?> fieldModel = entry.getKey();
- if (fieldModel.getOwner().getJavaType() == UIComponent.class && fieldModel.getName().equals(fieldName))
- {
- return entry.getValue();
- }
- }
- return null;
- }
-
- @Override
- public <S extends UIComponent> S create(Class<S> type, Map<FieldModel<? super S, ?>, ?> state) throws CreateException
- {
- // Get config id
- String configId = (String)getFieldValue("configId", state);
- String id = (String)getFieldValue("id", state);
-
- //
- try
- {
- WebuiApplication webuiApp = (WebuiApplication) context.getApplication();
- ConfigurationManager configMgr = webuiApp.getConfigurationManager();
- Component config = configMgr.getComponentConfig(type, configId);
-
- //
- S instance;
- if (config != null)
- {
- instance = Util.createObject(type, config.getInitParams());
- instance.setComponentConfig(id, config);
- }
- else
- {
- instance = Util.createObject(type, null);
- instance.setId(id);
- }
-
- // Now set state
- for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet())
- {
- FieldModel<? super S, ?> fieldModel = entry.getKey();
- Object value = entry.getValue();
- fieldModel.castAndSet(instance, value);
- }
-
- //
- return instance;
- }
- catch (Exception e)
- {
- throw new CreateException(e);
- }
- }
- };
- serializationContext.addFactory(factory);
- }
-
- //
-
- //
- uiapp = serializationContext.clone(uiapp);
- System.out.println("Cloned application");
- }
- catch (Exception e)
- {
- System.out.println("Could not clone application");
- e.printStackTrace();
- }
- }
-
-
- //
- String key = getKey(context);
- session.setAttribute("bilto_" + key, uiapp);
- }
-
- @Override
- public void expire(String sessionId, WebuiApplication app) throws Exception
- {
- // For now do nothing....
- }
-
- private UserPortalConfig getUserPortalConfig(PortalRequestContext context) throws Exception
- {
- ExoContainer appContainer = context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService service_ = (UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
- String remoteUser = context.getRemoteUser();
- String ownerUser = context.getPortalOwner();
- return service_.getUserPortalConfig(ownerUser, remoteUser);
- }
-
- private String getKey(WebuiRequestContext webuiRC)
- {
- if (webuiRC instanceof PortletRequestContext)
- {
- PortletRequestContext portletRC = (PortletRequestContext)webuiRC;
- return portletRC.getApplication().getApplicationId() + "/" + portletRC.getWindowId();
- }
- else
- {
- PortalRequestContext portalRC = (PortalRequestContext)webuiRC;
- return "portal";
- }
- }
-
- private HttpSession getSession(WebuiRequestContext webuiRC)
- {
- if (webuiRC instanceof PortletRequestContext)
- {
- PortletRequestContext portletRC = (PortletRequestContext)webuiRC;
- PortalRequestContext portalRC = (PortalRequestContext) portletRC.getParentAppRequestContext();
- HttpServletRequest req = portalRC.getRequest();
- return req.getSession();
- }
- else
- {
- PortalRequestContext portalRC = (PortalRequestContext)webuiRC;
- HttpServletRequest req = portalRC.getRequest();
- return req.getSession();
- }
- }
-}
Added: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ApplicationState.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ApplicationState.java (rev 0)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ApplicationState.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.application.replication;
+
+import org.exoplatform.webui.application.replication.SerializationContext;
+import org.exoplatform.webui.application.replication.api.annotations.Serialized;
+import org.exoplatform.webui.core.UIApplication;
+
+import java.io.*;
+
+/**
+ * The state of an application.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ApplicationState implements Serializable
+{
+
+ /** . */
+ private UIApplication application;
+
+ /** . */
+ private byte[] serialization;
+
+ /** . */
+ private String userName;
+
+ public ApplicationState(UIApplication application, String userName)
+ {
+ if (application == null)
+ {
+ throw new NullPointerException();
+ }
+ this.application = application;
+ this.userName = userName;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public UIApplication getApplication() throws IOException, ClassNotFoundException
+ {
+ if (serialization != null)
+ {
+ SerializationContext serializationContext = SerializationContextSingleton.getInstance();
+ byte[] bytes = serialization;
+ serialization = null;
+ application = (UIApplication)serializationContext.read(bytes);
+ }
+ return application;
+ }
+
+ private void writeObject(ObjectOutputStream oos) throws IOException
+ {
+ if (userName != null)
+ {
+ oos.writeBoolean(true);
+ oos.writeUTF(userName);
+ }
+ else
+ {
+ oos.writeBoolean(false);
+ }
+
+ //
+ if (application != null && application.getClass().getAnnotation(Serialized.class) != null)
+ {
+ oos.writeBoolean(true);
+
+ //
+ SerializationContext serializationContext = SerializationContextSingleton.getInstance();
+
+ //
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ serializationContext.write(application, baos);
+ baos.close();
+
+ //
+ byte[] bytes = baos.toByteArray();
+ oos.writeInt(bytes.length);
+ oos.write(bytes);
+ }
+ else
+ {
+ oos.writeBoolean(false);
+ }
+ }
+
+ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
+ {
+ if (ois.readBoolean())
+ {
+ userName = ois.readUTF();
+ }
+
+ //
+ if (ois.readBoolean())
+ {
+ int size = ois.readInt();
+ byte[] bytes = new byte[size];
+ ois.readFully(bytes);
+ serialization = bytes;
+ }
+ else
+ {
+ serialization = null;
+ }
+
+ //
+ application = null;
+ }
+}
Copied: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java (from rev 1418, portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/ReplicatingStateManager.java)
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java (rev 0)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/ReplicatingStateManager.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.application.replication;
+
+import org.exoplatform.commons.utils.Safe;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.portal.application.LegacyPortalStateManager;
+import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.config.UserPortalConfig;
+import org.exoplatform.portal.config.UserPortalConfigService;
+import org.exoplatform.webui.application.ConfigurationManager;
+import org.exoplatform.webui.application.StateManager;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.portlet.PortletRequestContext;
+import org.exoplatform.webui.core.UIApplication;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+/**
+ * The basis is either {@link org.exoplatform.webui.core.UIPortletApplication} or
+ * {@link org.exoplatform.portal.webui.workspace.UIPortalApplication}.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ReplicatingStateManager extends StateManager
+{
+
+ @Override
+ public UIApplication restoreUIRootComponent(WebuiRequestContext context) throws Exception
+ {
+ context.setStateManager(this);
+
+ //
+ WebuiApplication app = (WebuiApplication)context.getApplication();
+
+ //
+ HttpSession session = getSession(context);
+ String key = getKey(context);
+
+ //
+ ApplicationState appState = (ApplicationState)session.getAttribute("bilto_" + key);
+
+ //
+ UIApplication uiapp = null;
+ if (appState != null)
+ {
+ if (Safe.equals(context.getRemoteUser(), appState.getUserName()))
+ {
+ uiapp = appState.getApplication();
+ }
+ }
+
+ //
+ if (appState != null)
+ {
+ System.out.println("Found application " + key + " :" + appState.getApplication());
+ }
+ else
+ {
+ System.out.println("Application " + key + " not found");
+ }
+
+ // Looks like some necessary hacking
+ if (context instanceof PortalRequestContext)
+ {
+ PortalRequestContext portalRC = (PortalRequestContext)context;
+ UserPortalConfig config = getUserPortalConfig(portalRC);
+ if (config == null)
+ {
+ HttpServletResponse response = portalRC.getResponse();
+ response.sendRedirect(portalRC.getRequest().getContextPath() + "/portal-unavailable.jsp");
+ portalRC.setResponseComplete(true);
+ return null;
+ }
+ portalRC.setAttribute(UserPortalConfig.class, config);
+// SessionManagerContainer pcontainer = (SessionManagerContainer)app.getApplicationServiceContainer();
+// pcontainer.createSessionContainer(context.getSessionId(), uiapp.getOwner());
+ }
+
+ //
+ if (uiapp == null)
+ {
+ ConfigurationManager cmanager = app.getConfigurationManager();
+ String uirootClass = cmanager.getApplication().getUIRootComponent();
+ Class<? extends UIApplication> type = (Class<UIApplication>) Thread.currentThread().getContextClassLoader().loadClass(uirootClass);
+ uiapp = app.createUIComponent(type, null, null, context);
+ }
+
+ //
+ return uiapp;
+ }
+
+ @Override
+ public void storeUIRootComponent(final WebuiRequestContext context) throws Exception
+ {
+ UIApplication uiapp = context.getUIApplication();
+
+ //
+ HttpSession session = getSession(context);
+
+ //
+ String key = getKey(context);
+
+ //
+ System.out.println("Storing application " + key);
+ session.setAttribute("bilto_" + key, new ApplicationState(uiapp, context.getRemoteUser()));
+ }
+
+ @Override
+ public void expire(String sessionId, WebuiApplication app) throws Exception
+ {
+ // For now do nothing....
+ }
+
+ private UserPortalConfig getUserPortalConfig(PortalRequestContext context) throws Exception
+ {
+ ExoContainer appContainer = context.getApplication().getApplicationServiceContainer();
+ UserPortalConfigService service_ = (UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
+ String remoteUser = context.getRemoteUser();
+ String ownerUser = context.getPortalOwner();
+ return service_.getUserPortalConfig(ownerUser, remoteUser);
+ }
+
+ private String getKey(WebuiRequestContext webuiRC)
+ {
+ if (webuiRC instanceof PortletRequestContext)
+ {
+ PortletRequestContext portletRC = (PortletRequestContext)webuiRC;
+
+ // We are temporarily not using the window id as it changes when the back end is not the same
+ return portletRC.getApplication().getApplicationId()/* + "/" + portletRC.getWindowId()*/;
+ }
+ else
+ {
+ PortalRequestContext portalRC = (PortalRequestContext)webuiRC;
+ return "portal";
+ }
+ }
+
+ private HttpSession getSession(WebuiRequestContext webuiRC)
+ {
+ if (webuiRC instanceof PortletRequestContext)
+ {
+ PortletRequestContext portletRC = (PortletRequestContext)webuiRC;
+ PortalRequestContext portalRC = (PortalRequestContext) portletRC.getParentAppRequestContext();
+ HttpServletRequest req = portalRC.getRequest();
+ return req.getSession();
+ }
+ else
+ {
+ PortalRequestContext portalRC = (PortalRequestContext)webuiRC;
+ HttpServletRequest req = portalRC.getRequest();
+ return req.getSession();
+ }
+ }
+}
Added: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/SerializationContextSingleton.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/SerializationContextSingleton.java (rev 0)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/SerializationContextSingleton.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.application.replication;
+
+import org.exoplatform.services.organization.Query;
+import org.exoplatform.webui.application.replication.SerializationContext;
+import org.exoplatform.webui.application.replication.model.TypeDomain;
+import org.exoplatform.webui.application.replication.model.metadata.DomainMetaData;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+class SerializationContextSingleton
+{
+
+ /** . */
+ private static SerializationContext instance = createInstance();
+
+ public static SerializationContext getInstance()
+ {
+ return instance;
+ }
+
+ private static SerializationContext createInstance()
+ {
+ DomainMetaData domainMetaData = new DomainMetaData();
+
+ // For now we need to mark the Query class as serialized
+ domainMetaData.addClassType(Query.class, true);
+
+ // Build domain
+ TypeDomain domain = new TypeDomain(domainMetaData, true);
+
+ // Build serialization context
+ SerializationContext serializationContext = new SerializationContext(domain);
+ serializationContext.addFactory(new UIComponentFactory());
+
+ //
+ return serializationContext;
+ }
+}
Added: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java (rev 0)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/replication/UIComponentFactory.java 2010-01-22 22:39:11 UTC (rev 1424)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.application.replication;
+
+import org.exoplatform.webui.Util;
+import org.exoplatform.webui.application.ConfigurationManager;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.replication.api.factory.CreateException;
+import org.exoplatform.webui.application.replication.api.factory.ObjectFactory;
+import org.exoplatform.webui.application.replication.model.FieldModel;
+import org.exoplatform.webui.config.Component;
+import org.exoplatform.webui.core.UIComponent;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class UIComponentFactory extends ObjectFactory<UIComponent>
+{
+
+
+
+ private <S extends UIComponent> Object getFieldValue(String fieldName, Map<FieldModel<? super S, ?>, ?> state)
+ {
+ for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet())
+ {
+ FieldModel<? super S, ?> fieldModel = entry.getKey();
+ if (fieldModel.getOwner().getJavaType() == UIComponent.class && fieldModel.getName().equals(fieldName))
+ {
+ return entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <S extends UIComponent> S create(Class<S> type, Map<FieldModel<? super S, ?>, ?> state) throws CreateException
+ {
+ // Get config id
+ String configId = (String)getFieldValue("configId", state);
+ String id = (String)getFieldValue("id", state);
+
+ //
+ try
+ {
+ WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
+ WebuiApplication webuiApp = (WebuiApplication) context.getApplication();
+ ConfigurationManager configMgr = webuiApp.getConfigurationManager();
+ Component config = configMgr.getComponentConfig(type, configId);
+
+ //
+ S instance;
+ if (config != null)
+ {
+ instance = Util.createObject(type, config.getInitParams());
+ instance.setComponentConfig(id, config);
+ }
+ else
+ {
+ instance = Util.createObject(type, null);
+ instance.setId(id);
+ }
+
+ // Now set state
+ for (Map.Entry<FieldModel<? super S, ?>, ?> entry : state.entrySet())
+ {
+ FieldModel<? super S, ?> fieldModel = entry.getKey();
+ Object value = entry.getValue();
+ fieldModel.castAndSet(instance, value);
+ }
+
+ //
+ return instance;
+ }
+ catch (Exception e)
+ {
+ throw new CreateException(e);
+ }
+ }
+}
14 years, 11 months
gatein SVN: r1423 - portal/trunk/component/wsrp/src/main/java/conf.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-22 17:25:49 -0500 (Fri, 22 Jan 2010)
New Revision: 1423
Modified:
portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml
Log:
- Revert change that wasn't meant to be committed.
Modified: portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml
===================================================================
--- portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml 2010-01-22 21:49:31 UTC (rev 1422)
+++ portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml 2010-01-22 22:25:49 UTC (rev 1423)
@@ -26,13 +26,6 @@
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-property-validator>org.gatein.registration.policies.DefaultRegistrationPropertyValidator
</registration-property-validator>
- <registration-property-description>
- <name>prop</name>
- <type>xsd:string</type>
- <description xml:lang="en">desc</description>
- <hint xml:lang="en">hint</hint>
- <label xml:lang="en">label</label>
- </registration-property-description>
</registration-configuration>
</producer-configuration>
14 years, 11 months
gatein SVN: r1422 - in portal/trunk: portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component and 7 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-22 16:49:31 -0500 (Fri, 22 Jan 2010)
New Revision: 1422
Added:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UISetPropertyValueForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/RegistrationPropertyStatusValueRenderer.java
Removed:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerOverview.java
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
Modified:
portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpPortlet.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/LocalizedStringValueRenderer.java
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_fr.properties
portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/renderers/ValueRenderer.java
Log:
- UIRegistrationPropertiesGrid now records associated registration properties.
- Overriden getName in UIRegistrationPropertiesGrid to return id so that label can be properly displayed in UIForm.gtmpl.
- Started adding support for setting registration properties value but can't figure out a way to make it work with
the event system as events don't recall what element they originated from.
- Removed more UIWsrpProducerOverview as it wasn't needed.
- More localization.
- Added ValueRenderer.render(V, WebuiBindingContext) so that values can be resolved from a resource bundle if needed.
- Added ValueRenderer for RegistrationProperty.Status.
- Added Cancel actions on popups.
Modified: portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml
===================================================================
--- portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/component/wsrp/src/main/java/conf/wsrp-producer-config.xml 2010-01-22 21:49:31 UTC (rev 1422)
@@ -26,6 +26,13 @@
<registration-configuration fullServiceDescriptionRequiresRegistration="true">
<registration-property-validator>org.gatein.registration.policies.DefaultRegistrationPropertyValidator
</registration-property-validator>
+ <registration-property-description>
+ <name>prop</name>
+ <type>xsd:string</type>
+ <description xml:lang="en">desc</description>
+ <hint xml:lang="en">hint</hint>
+ <label xml:lang="en">label</label>
+ </registration-property-description>
</registration-configuration>
</producer-configuration>
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIRegistrationPropertiesGrid.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -26,24 +26,33 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccessImpl;
import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIPageIterator;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIFormGrid;
import org.gatein.common.util.ParameterValidation;
import org.gatein.wsrp.consumer.RegistrationProperty;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.List;
+import java.util.Map;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
-@ComponentConfig(template = "system:/groovy/webui/core/UIGrid.gtmpl")
+@ComponentConfig(
+ template = "system:/groovy/webui/core/UIGrid.gtmpl",
+ events = {
+ @EventConfig(listeners = UIRegistrationPropertiesGrid.EditPropertyActionListener.class)
+ })
public class UIRegistrationPropertiesGrid extends UIFormGrid
{
private static final String NAME = "name";
static String[] FIELDS = {NAME, "description", "status", "value"};
static String[] PROPERTIES_ACTIONS = {"EditProperty", "DeleteProperty"};
+ private Map<String, RegistrationProperty> props;
public UIRegistrationPropertiesGrid() throws Exception
{
@@ -55,8 +64,15 @@
pageIterator.setRendered(false);
}
- public void resetProps(List<RegistrationProperty> props)
+ @Override
+ public String getName()
{
+ return getId();
+ }
+
+ public void resetProps(Map<String, RegistrationProperty> props)
+ {
+
ListAccessImpl<RegistrationProperty> listAccess;
if (ParameterValidation.existsAndIsNotEmpty(props))
{
@@ -64,10 +80,29 @@
}
else
{
- props = Collections.emptyList();
+ props = Collections.emptyMap();
setRendered(false);
}
- listAccess = new ListAccessImpl<RegistrationProperty>(RegistrationProperty.class, props);
+
+ this.props = props;
+
+ ArrayList<RegistrationProperty> propsList = new ArrayList<RegistrationProperty>(props.values());
+ listAccess = new ListAccessImpl<RegistrationProperty>(RegistrationProperty.class, propsList);
getUIPageIterator().setPageList(new LazyPageList<RegistrationProperty>(listAccess, 10));
}
+
+ public RegistrationProperty getProperty(String name)
+ {
+ return props.get(name);
+ }
+
+ static public class EditPropertyActionListener extends EventListener<UIRegistrationPropertiesGrid>
+ {
+ @Override
+ public void execute(Event<UIRegistrationPropertiesGrid> event) throws Exception
+ {
+ String name = event.getRequestContext().getRequestParameter(OBJECTID);
+ UIRegistrationPropertiesGrid registrationPropertiesGrid = event.getSource();
+ }
+ }
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpPortlet.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpPortlet.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpPortlet.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -28,9 +28,11 @@
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
import org.exoplatform.webui.core.renderers.ValueRendererRegistry;
import org.exoplatform.wsrp.webui.component.consumer.UIWsrpConsumerOverview;
-import org.exoplatform.wsrp.webui.component.producer.UIWsrpProducerOverview;
+import org.exoplatform.wsrp.webui.component.producer.UIWsrpProducerEditor;
import org.exoplatform.wsrp.webui.component.renderers.LocalizedStringValueRenderer;
import org.exoplatform.wsrp.webui.component.renderers.RegistrationDescriptionValueRenderer;
+import org.exoplatform.wsrp.webui.component.renderers.RegistrationPropertyStatusValueRenderer;
+import org.gatein.wsrp.consumer.RegistrationProperty;
import org.gatein.wsrp.registration.LocalizedString;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
@@ -45,13 +47,14 @@
// register value renderers
ValueRendererRegistry.registerDefaultRendererFor(new RegistrationDescriptionValueRenderer(), RegistrationPropertyDescription.class);
ValueRendererRegistry.registerDefaultRendererFor(new LocalizedStringValueRenderer(), LocalizedString.class);
+ ValueRendererRegistry.registerDefaultRendererFor(new RegistrationPropertyStatusValueRenderer(), RegistrationProperty.Status.class);
}
public UIWsrpPortlet() throws Exception
{
UITabPane uiTabPane = addChild(UITabPane.class, null, null);
- uiTabPane.addChild(UIWsrpConsumerOverview.class, null, "Manage Consumers");
- uiTabPane.addChild(UIWsrpProducerOverview.class, null, "Producer Configuration");
+ uiTabPane.addChild(UIWsrpConsumerOverview.class, null, "Consumers");
+ uiTabPane.addChild(UIWsrpProducerEditor.class, null, "Producer");
if (uiTabPane.getSelectedTabId().equals(""))
{
Added: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UISetPropertyValueForm.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UISetPropertyValueForm.java (rev 0)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UISetPropertyValueForm.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.exoplatform.wsrp.webui.component.consumer;
+
+import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIPopupWindow;
+import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.form.UIForm;
+import org.exoplatform.webui.form.UIFormStringInput;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+@ComponentConfig(
+ lifecycle = UIFormLifecycle.class,
+ template = "system:/groovy/webui/form/UIForm.gtmpl",
+ events = {
+ @EventConfig(listeners = UISetPropertyValueForm.SaveActionListener.class),
+ @EventConfig(listeners = UISetPropertyValueForm.CancelActionListener.class)
+ })
+public class UISetPropertyValueForm extends UIForm
+{
+ private UIFormStringInput value;
+ private static final String[] ACTIONS = new String[]{"Save", "Cancel"};
+
+ public UISetPropertyValueForm()
+ {
+ value = new UIFormStringInput("value", null);
+ setActions(ACTIONS);
+ }
+
+ static public class CancelActionListener extends EventListener<UISetPropertyValueForm>
+ {
+ @Override
+ public void execute(Event<UISetPropertyValueForm> event) throws Exception
+ {
+ // simply close the popup
+ UIPopupWindow popup = event.getSource().getParent();
+ popup.setRendered(false);
+ popup.setShow(false);
+ }
+ }
+
+ static public class SaveActionListener extends EventListener<UISetPropertyValueForm>
+ {
+ @Override
+ public void execute(Event<UISetPropertyValueForm> event) throws Exception
+ {
+
+ }
+ }
+}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -37,7 +37,6 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
-import org.exoplatform.webui.form.UIFormInputBase;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.validator.MandatoryValidator;
import org.exoplatform.wsrp.webui.component.UIRegistrationPropertiesGrid;
@@ -46,33 +45,34 @@
import org.gatein.wsrp.consumer.ConsumerException;
import org.gatein.wsrp.consumer.ProducerInfo;
import org.gatein.wsrp.consumer.RegistrationInfo;
-import org.gatein.wsrp.consumer.RegistrationProperty;
import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
import org.gatein.wsrp.services.ManageableServiceFactory;
-import java.util.ArrayList;
-import java.util.Collection;
-
/** @author Wesley Hales */
@ComponentConfig(
lifecycle = UIFormLifecycle.class,
template = "system:/groovy/webui/form/UIForm.gtmpl",
events = {
- @EventConfig(listeners = UIWsrpConsumerEditor.SaveActionListener.class)
+ @EventConfig(listeners = UIWsrpConsumerEditor.SaveActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerEditor.CancelActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerEditor.EditPropertyActionListener.class)
})
public class UIWsrpConsumerEditor extends UIForm
{
- private UIFormInputBase<String> consumerName;
+ private UIFormStringInput consumerName;
private UIFormStringInput cache;
private UIFormStringInput timeoutWS;
private UIFormStringInput wsdl;
private UIRegistrationPropertiesGrid localRegistration;
private UIRegistrationPropertiesGrid expectedRegistration;
- private static final String[] ACTIONS = new String[]{"Save"};
+ private static final String[] ACTIONS = new String[]{"Save", "Cancel"};
+ private UIPopupWindow setValuePopup;
+ private UISetPropertyValueForm setPropertyForm;
public UIWsrpConsumerEditor() throws Exception
{
- consumerName = new UIFormStringInput("name", null).addValidator(MandatoryValidator.class);
+ consumerName = new UIFormStringInput("name", null);
+ consumerName.addValidator(MandatoryValidator.class);
addUIFormInput(consumerName);
cache = new UIFormStringInput("cache", null);
addUIFormInput(cache);
@@ -90,6 +90,13 @@
// actions
setActions(ACTIONS);
+
+ // set property value popup
+ setValuePopup = addChild(UIPopupWindow.class, null, null);
+ setValuePopup.setWindowSize(200, 0);
+ setPropertyForm = createUIComponent(UISetPropertyValueForm.class, null, "SetProperty");
+ setValuePopup.setUIComponent(setPropertyForm);
+ setValuePopup.setRendered(false);
}
private String getConsumerName()
@@ -154,16 +161,12 @@
wsdl.setValue(producerInfo.getEndpointConfigurationInfo().getWsdlDefinitionURL());
RegistrationInfo local = producerInfo.getRegistrationInfo();
- Collection<RegistrationProperty> regProps = local.getRegistrationProperties().values();
- ArrayList<RegistrationProperty> regPropsList = new ArrayList<RegistrationProperty>(regProps);
- localRegistration.resetProps(regPropsList);
+ localRegistration.resetProps(local.getRegistrationProperties());
RegistrationInfo expected = producerInfo.getExpectedRegistrationInfo();
if (local != expected && expected != null)
{
- regProps = expected.getRegistrationProperties().values();
- regPropsList = new ArrayList<RegistrationProperty>(regProps);
- expectedRegistration.resetProps(regPropsList);
+ expectedRegistration.resetProps(expected.getRegistrationProperties());
}
else
{
@@ -173,6 +176,51 @@
setNewConsumer(false);
}
+ public boolean save(WebuiRequestContext context) throws Exception
+ {
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ ConsumerRegistry consumerRegistry = (ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
+
+ UIApplication uiApp = context.getUIApplication();
+
+ try
+ {
+ consumerRegistry.createConsumer(getConsumerName(), getCacheExpiration(), getWSDLURL());
+ uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.add.success", null));
+ }
+ catch (ConsumerException ce)
+ {
+ //todo - add to resource bundle
+ uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.add.exists", null, ApplicationMessage.ERROR));
+ }
+ return true;
+ }
+
+ public boolean edit(WebuiRequestContext context) throws Exception
+ {
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ ConsumerRegistry consumerRegistry = (ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
+ ProducerInfo producerInfo = consumerRegistry.getConsumer(getConsumerName()).getProducerInfo();
+
+ producerInfo.setId(getConsumerName());
+ producerInfo.setExpirationCacheSeconds(getCacheExpiration());
+ producerInfo.getEndpointConfigurationInfo().setWsdlDefinitionURL(getWSDLURL());
+ producerInfo.getEndpointConfigurationInfo().setWSOperationTimeOut(getTimeout());
+
+ UIApplication uiApp = context.getUIApplication();
+
+ try
+ {
+ consumerRegistry.updateProducerInfo(producerInfo);
+ uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.edit.success", null));
+ }
+ catch (ConsumerException ce)
+ {
+ uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.edit.fail", null, ApplicationMessage.ERROR));
+ }
+ return true;
+ }
+
static public class SaveActionListener extends EventListener<UIWsrpConsumerEditor>
{
public void execute(Event<UIWsrpConsumerEditor> event) throws Exception
@@ -211,49 +259,26 @@
}
}
- public boolean save(WebuiRequestContext context) throws Exception
+ static public class CancelActionListener extends EventListener<UIWsrpConsumerEditor>
{
- ExoContainer manager = ExoContainerContext.getCurrentContainer();
- ConsumerRegistry consumerRegistry = (ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
-
- UIApplication uiApp = context.getUIApplication();
-
- try
+ @Override
+ public void execute(Event<UIWsrpConsumerEditor> event) throws Exception
{
- consumerRegistry.createConsumer(getConsumerName(), getCacheExpiration(), getWSDLURL());
- uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.add.success", null));
+ // simply close the popup
+ UIPopupWindow popup = event.getSource().getParent();
+ popup.setRendered(false);
+ popup.setShow(false);
}
- catch (ConsumerException ce)
- {
- //todo - add to resource bundle
- uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.add.exists", null, ApplicationMessage.ERROR));
- }
- return true;
}
- public boolean edit(WebuiRequestContext context) throws Exception
+ static public class EditPropertyActionListener extends EventListener<UIWsrpConsumerEditor>
{
- ExoContainer manager = ExoContainerContext.getCurrentContainer();
- ConsumerRegistry consumerRegistry = (ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
- ProducerInfo producerInfo = consumerRegistry.getConsumer(getConsumerName()).getProducerInfo();
+ @Override
+ public void execute(Event<UIWsrpConsumerEditor> event) throws Exception
+ {
+ String name = event.getRequestContext().getRequestParameter(OBJECTID);
+ UIWsrpConsumerEditor editor = event.getSource();
- producerInfo.setId(getConsumerName());
- producerInfo.setExpirationCacheSeconds(getCacheExpiration());
- producerInfo.getEndpointConfigurationInfo().setWsdlDefinitionURL(getWSDLURL());
- producerInfo.getEndpointConfigurationInfo().setWSOperationTimeOut(getTimeout());
-
- UIApplication uiApp = context.getUIApplication();
-
- try
- {
- consumerRegistry.updateProducerInfo(producerInfo);
- uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.edit.success", null));
}
- catch (ConsumerException ce)
- {
- uiApp.addMessage(new ApplicationMessage("UIWsrp.consumer.action.edit.fail", null, ApplicationMessage.ERROR));
- }
- return true;
}
-
}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -81,7 +81,6 @@
ConsumerRegistry registry = (ConsumerRegistry)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(ConsumerRegistry.class);
controller = new ConsumerController(registry);
- //setSelectedTab(1);
consumerEditorPopup = addChild(UIPopupWindow.class, null, null);
consumerEditorPopup.setWindowSize(800, 0);
UIWsrpConsumerEditor consumerForm = createUIComponent(UIWsrpConsumerEditor.class, null, "ConsumerEditor");
@@ -141,7 +140,6 @@
editor.setConsumer(consumer);
consumerEditorPopup.setRendered(true);
consumerEditorPopup.setShow(true);
- consumerEditorPopup.setShowCloseButton(true);
}
static public class EditActionListener extends EventListener<UIWsrpConsumerOverview>
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerEditor.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerEditor.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -42,7 +42,7 @@
*/
@ComponentConfig(
lifecycle = UIFormLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
+ template = "system:/groovy/webui/form/UIForm.gtmpl",
events = {
@EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class),
@EventConfig(listeners = UIWsrpProducerEditor.RegistrationOnChangeActionListener.class)
@@ -60,6 +60,7 @@
private UIFormCheckBoxInput regReqForDesc;
private UIFormCheckBoxInput strictMode;
private UIFormCheckBoxInput<Boolean> regRequired;
+ private static final String[] ACTIONS = new String[]{"Save"};
public UIWsrpProducerEditor() throws Exception
{
@@ -76,7 +77,7 @@
addUIFormInput(regRequired);
// because when we use setOnChange method, new eventListener will add to this form, we must re-set the actions of this form.
// thif form has no action, so i'll put empty string array
- setActions(new String[]{});
+ setActions(ACTIONS);
// registration details
// form set to gather registration information
Deleted: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerOverview.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerOverview.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpProducerOverview.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -1,46 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.exoplatform.wsrp.webui.component.producer;
-
-import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.core.UIContainer;
-import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-
-/**
- * @author Wesley Hales
- * @author Chris Laprun
- */
-@ComponentConfig(
- lifecycle = UIApplicationLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl"
-)
-public class UIWsrpProducerOverview extends UIContainer
-{
- private UIWsrpProducerEditor producerForm;
-
- public UIWsrpProducerOverview() throws Exception
- {
- producerForm = createUIComponent(UIWsrpProducerEditor.class, null, "Producer Editor");
- addChild(producerForm);
- }
-}
Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/LocalizedStringValueRenderer.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/LocalizedStringValueRenderer.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/LocalizedStringValueRenderer.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -36,6 +36,7 @@
@Override
public String render(LocalizedString value)
{
+ // todo: maybe implement a localized version?
return value.getValue();
}
}
Added: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/RegistrationPropertyStatusValueRenderer.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/RegistrationPropertyStatusValueRenderer.java (rev 0)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/renderers/RegistrationPropertyStatusValueRenderer.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.exoplatform.wsrp.webui.component.renderers;
+
+import org.exoplatform.webui.core.lifecycle.WebuiBindingContext;
+import org.exoplatform.webui.core.renderers.ValueRenderer;
+import org.gatein.wsrp.consumer.RegistrationProperty;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class RegistrationPropertyStatusValueRenderer extends ValueRenderer<RegistrationProperty.Status>
+{
+ @Override
+ public String render(RegistrationProperty.Status value, WebuiBindingContext context) throws Exception
+ {
+ return context.appRes(value.getLocalizationKey());
+ }
+
+ @Override
+ public String getCSSClassFor(RegistrationProperty.Status value)
+ {
+ return value.name();
+ }
+}
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties 2010-01-22 21:49:31 UTC (rev 1422)
@@ -26,4 +26,18 @@
ConsumerEditor.label.wsdl=WSDL URL:
ConsumerEditor.label.local=Local registration properties:
ConsumerEditor.label.expected=Expected registration properties:
+registration_property_status_inexistent=Inexistent
+registration_property_status_missing=Missing
+registration_property_status_missing_value=Value missing
+registration_property_status_unchecked_value=Unchecked
+registration_property_status_invalid_value=Invalid
+registration_property_status_valid=Valid
+Producer.label.policyClassName=Policy class name:
+Producer.label.validatorClassName=Validator class name:
+Producer.label.registrationproperties=Registration properties:
+Producer.label.registrationrequiredforfulldescription=Registration required for full service description.
+Producer.label.strictmode=Strict mode.
+Producer.label.requiresregistration=Requires registration?
+UITabPane.title.Producer=Producer configuration
+UITabPane.title.Consumers=Consumers configuration
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_fr.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_fr.properties 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_fr.properties 2010-01-22 21:49:31 UTC (rev 1422)
@@ -26,4 +26,18 @@
ConsumerEditor.label.local=Propri�t�s locales d'enregistrement:
ConsumerEditor.label.name=Nom du consommateur:
ConsumerEditor.label.timeout=Millisecondes avant timeout:
-ConsumerEditor.label.wsdl=URL du WSDL:
\ No newline at end of file
+ConsumerEditor.label.wsdl=URL du WSDL:
+registration_property_status_inexistent=Inexistante
+registration_property_status_invalid_value=Invalide
+registration_property_status_missing=Manquante
+registration_property_status_missing_value=Valeur manquante
+registration_property_status_unchecked_value=Non-v�rifi�e
+registration_property_status_valid=Valide
+Producer.label.policyClassName=Nom de la classe de politique de validation:
+Producer.label.registrationproperties=Propri�t�s d'enregistrement:
+Producer.label.registrationrequiredforfulldescription=Enregistrement n�cessaire pour la description compl�te.
+Producer.label.requiresregistration=Requiert l'enregistrement?
+Producer.label.strictmode=Mode strict.
+Producer.label.validatorClassName=Nom de la classe du validateur:
+UITabPane.title.Consumers=Configuration des consommateurs
+UITabPane.title.Producer=Configuration du producteur
\ No newline at end of file
Deleted: portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpProducerOverview.gtmpl 2010-01-22 21:49:31 UTC (rev 1422)
@@ -1,30 +0,0 @@
-<%
- import org.exoplatform.wsrp.webui.component.producer.UIWsrpProducerEditor;
- import org.exoplatform.wsrp.webui.component.producer.UIWsrpRegistrationDetails;
-%>
-
-<div class="<%=uicomponent.getId()%>" id="<%=uicomponent.getId()%>">
-
- <% uicomponent.renderChildren(); %>
-
- <div class="FloatRight">
-
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div onclick="<%=uicomponent.getChild(UIWsrpProducerEditor.class).event("Save")%>" class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getChild(UIWsrpProducerEditor.class).getId() + ".action.Save")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </div>
-</div>
\ No newline at end of file
Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl 2010-01-22 21:49:31 UTC (rev 1422)
@@ -61,7 +61,7 @@
{
def fieldValue = uicomponent.getFieldValue(bean, field);
def renderer = uicomponent.getRendererFor(fieldValue);
- println "<td><div class=\"" + renderer.getCSSClassFor(fieldValue) + "\" title='$fieldValue'>" + renderer.render(fieldValue) + "</div></td>";
+ println "<td><div class=\"" + renderer.getCSSClassFor(fieldValue) + "\" title='$fieldValue'>" + renderer.render(fieldValue, _ctx) + "</div></td>";
}
if (beanActions != null && beanActions.length > 0)
{
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/renderers/ValueRenderer.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/renderers/ValueRenderer.java 2010-01-22 15:27:58 UTC (rev 1421)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/renderers/ValueRenderer.java 2010-01-22 21:49:31 UTC (rev 1422)
@@ -23,6 +23,7 @@
package org.exoplatform.webui.core.renderers;
+import org.exoplatform.webui.core.lifecycle.WebuiBindingContext;
import org.gatein.common.util.ParameterValidation;
/**
@@ -56,6 +57,11 @@
return value.toString();
}
+ public String render(V value, WebuiBindingContext context) throws Exception
+ {
+ return render(value);
+ }
+
public String getCSSClassFor(V value)
{
return DEFAULT_CSS_CLASS;
14 years, 11 months
gatein SVN: r1421 - portal/trunk/packaging/pkg.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-22 10:27:58 -0500 (Fri, 22 Jan 2010)
New Revision: 1421
Modified:
portal/trunk/packaging/pkg/pom.xml
Log:
fixing something that seems a partial copy/paste
Modified: portal/trunk/packaging/pkg/pom.xml
===================================================================
--- portal/trunk/packaging/pkg/pom.xml 2010-01-22 13:19:17 UTC (rev 1420)
+++ portal/trunk/packaging/pkg/pom.xml 2010-01-22 15:27:58 UTC (rev 1421)
@@ -264,7 +264,7 @@
<files>
<file>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}/</file>
</files>
- <message>"The following JBossAS directory doesn't exist : ${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}"</message>
+ <message>"The following JBossAS directory doesn't exist : ${exo.projects.directory.dependencies}/${{exo.projects.app.jboss.version}"</message>
</requireFilesExist>
</rules>
<fail>true</fail>
14 years, 11 months
gatein SVN: r1420 - in portal/trunk: component/web/src/main/java/org/exoplatform/web/security and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-22 08:19:17 -0500 (Fri, 22 Jan 2010)
New Revision: 1420
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml
Log:
activate most part of cluster config based on the cluster profile in order to simplify configuration
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2010-01-22 13:01:05 UTC (rev 1419)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/login/ClusteredSSOFilter.java 2010-01-22 13:19:17 UTC (rev 1420)
@@ -23,6 +23,7 @@
package org.exoplatform.web.login;
+import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.web.AbstractFilter;
import org.exoplatform.services.security.IdentityRegistry;
import org.exoplatform.web.security.Credentials;
@@ -43,31 +44,36 @@
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
+ if (ExoContainer.getProfiles().contains("cluster"))
+ {
+ HttpServletRequest httpRequest = (HttpServletRequest)request;
- HttpServletRequest httpRequest = (HttpServletRequest)request;
+ Credentials credentials = (Credentials)httpRequest.getSession().getAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS);
- Credentials credentials = (Credentials)httpRequest.getSession().getAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS);
+ // Make programatic login if authenticated credentials are present in session - they were set in another cluster node
+ if (credentials != null && httpRequest.getRemoteUser() == null)
+ {
+ WebAuthentication pwl = new WebAuthentication();
+ pwl.login(credentials.getUsername(), credentials.getPassword());
- // Make programatic login if authenticated credentials are present in session - they were set in another cluster node
- if (credentials != null && httpRequest.getRemoteUser() == null)
- {
- WebAuthentication pwl = new WebAuthentication();
- pwl.login(credentials.getUsername(), credentials.getPassword());
+ }
+ chain.doFilter(request, response);
+
+ // TODO:
+ // This is a workaround... without this code this attr will vanish from session after first request - don't ask...
+ if (credentials != null && httpRequest.getSession(false) != null)
+ {
+ httpRequest.getSession(false).setAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS, credentials);
+ }
}
-
- chain.doFilter(request, response);
-
- // TODO:
- // This is a workaround... without this code this attr will vanish from session after first request - don't ask...
- if (credentials != null && httpRequest.getSession(false) != null)
+ else
{
- httpRequest.getSession(false).setAttribute(PortalLoginModule.AUTHENTICATED_CREDENTIALS, credentials);
+ chain.doFilter(request, response);
}
}
public void destroy()
{
- //To change body of implemented methods use File | Settings | File Templates.
}
}
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22 13:01:05 UTC (rev 1419)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22 13:19:17 UTC (rev 1420)
@@ -55,8 +55,6 @@
*/
protected Log log = ExoLogger.getLogger(PortalLoginModule.class);
- public static final String CLUSTERED_SSO = "clusteredSSO";
-
public static final String AUTHENTICATED_CREDENTIALS = "authenticatedCredentials";
/**
@@ -101,7 +99,7 @@
{
log.error(this,e);
log.error("LoginModule error. Turn off session credentials checking with proper configuration option of " +
- "LoginModule set to false: " + CLUSTERED_SSO);
+ "LoginModule set to false");
}
}
@@ -151,7 +149,7 @@
{
log.error(this,e);
log.error("LoginModule error. Turn off session credentials checking with proper configuration option of " +
- "LoginModule set to false: " + CLUSTERED_SSO);
+ "LoginModule set to false");
}
}
return true;
@@ -181,15 +179,6 @@
protected boolean isClusteredSSO()
{
- if (options != null)
- {
- String optionValue = (String)options.get(CLUSTERED_SSO);
- if (optionValue != null && optionValue.length() > 0 && optionValue.equalsIgnoreCase("true"))
- {
- return true;
- }
- }
- return false;
+ return ExoContainer.getProfiles().contains("cluster");
}
-
}
Modified: portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml
===================================================================
--- portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml 2010-01-22 13:01:05 UTC (rev 1419)
+++ portal/trunk/server/jboss/patch-ear/src/main/jboss/server/default/deploy/gatein.ear/META-INF/gatein-jboss-beans.xml 2010-01-22 13:19:17 UTC (rev 1420)
@@ -5,10 +5,6 @@
<login-module code="org.exoplatform.web.security.PortalLoginModule" flag="required">
<module-option name="portalContainerName">portal</module-option>
<module-option name="realmName">gatein-domain</module-option>
- <!--Uncomment in clustered setup-->
- <!--
- <module-option name="clusteredSSO">true</module-option>
- -->
</login-module>
<login-module code="org.exoplatform.services.security.jaas.SharedStateLoginModule" flag="required">
<module-option name="portalContainerName">portal</module-option>
Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml 2010-01-22 13:01:05 UTC (rev 1419)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/web.xml 2010-01-22 13:19:17 UTC (rev 1420)
@@ -81,19 +81,16 @@
<filter-class>org.exoplatform.web.CacheUserProfileFilter</filter-class>
</filter>
- <!--Uncomment for clustered setup-->
- <!--
<filter>
<filter-name>ClusteredSSOFilter</filter-name>
<filter-class>org.exoplatform.web.login.ClusteredSSOFilter</filter-class>
</filter>
- <filter-mapping>
+ <filter-mapping>
<filter-name>ClusteredSSOFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
- -->
-
+
<filter-mapping>
<filter-name>GenericFilter</filter-name>
<url-pattern>/*</url-pattern>
14 years, 11 months
gatein SVN: r1419 - portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-22 08:01:05 -0500 (Fri, 22 Jan 2010)
New Revision: 1419
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
Log:
my tribute to the ArrayList / JiBX bug fix
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-01-22 12:34:51 UTC (rev 1418)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/application/ConfigurationManager.java 2010-01-22 13:01:05 UTC (rev 1419)
@@ -241,7 +241,7 @@
config.setInitParams(toInitParams(annotation.initParams()));
EventConfig[] eventAnnotations = annotation.events();
- List<Event> events;
+ ArrayList<Event> events;
if (eventAnnotations.length != 0)
{
events = new ArrayList<Event>();
@@ -252,12 +252,12 @@
}
else
{
- events = Collections.emptyList();
+ events = new ArrayList<Event>();
}
config.setEvents(events);
EventInterceptorConfig[] eventInterceptorAnnotations = annotation.eventInterceptors();
- List<EventInterceptor> eventInterceptors;
+ ArrayList<EventInterceptor> eventInterceptors;
if (eventInterceptorAnnotations.length != 0)
{
eventInterceptors = new ArrayList<EventInterceptor>();
@@ -268,12 +268,12 @@
}
else
{
- eventInterceptors = Collections.emptyList();
+ eventInterceptors = new ArrayList<EventInterceptor>();
}
config.setEventInterceptors(eventInterceptors);
ValidatorConfig[] validatorAnnotations = annotation.validators();
- List<Validator> validators;
+ ArrayList<Validator> validators;
if (validatorAnnotations.length != 0)
{
validators = new ArrayList<Validator>();
@@ -284,7 +284,7 @@
}
else
{
- validators = Collections.emptyList();
+ validators = new ArrayList<Validator>();
}
config.setValidators(validators);
14 years, 11 months
gatein SVN: r1418 - portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-22 07:34:51 -0500 (Fri, 22 Jan 2010)
New Revision: 1418
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java
Log:
- Reverted changes so that JiBX can work properly.
Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java 2010-01-22 12:10:23 UTC (rev 1417)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/config/Component.java 2010-01-22 12:34:51 UTC (rev 1418)
@@ -44,12 +44,14 @@
private InitParams initParams;
- private List<Validator> validators;
+ // Note: Specific List implementations are required by JiBX :/
- private List<Event> events;
+ private ArrayList<Validator> validators;
- private List<EventInterceptor> eventInterceptors;
+ private ArrayList<Event> events;
+ private ArrayList<EventInterceptor> eventInterceptors;
+
transient private Map<String, Event> eventMap;
transient private Lifecycle componentLifecycle;
@@ -114,32 +116,32 @@
this.initParams = initParams;
}
- public List<Validator> getValidators()
+ public ArrayList<Validator> getValidators()
{
return validators;
}
- public void setValidators(List<Validator> validators)
+ public void setValidators(ArrayList<Validator> validators)
{
this.validators = validators;
}
- public List<Event> getEvents()
+ public ArrayList<Event> getEvents()
{
return events;
}
- public void setEvents(List<Event> events)
+ public void setEvents(ArrayList<Event> events)
{
this.events = events;
}
- public List<EventInterceptor> getEventInterceptors()
+ public ArrayList<EventInterceptor> getEventInterceptors()
{
return eventInterceptors;
}
- public void setEventInterceptors(List<EventInterceptor> events)
+ public void setEventInterceptors(ArrayList<EventInterceptor> events)
{
eventInterceptors = events;
}
14 years, 11 months
gatein SVN: r1417 - portal/trunk/component/web/src/main/java/org/exoplatform/web/security.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-01-22 07:10:23 -0500 (Fri, 22 Jan 2010)
New Revision: 1417
Modified:
portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
Log:
typo
Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22 11:36:33 UTC (rev 1416)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/security/PortalLoginModule.java 2010-01-22 12:10:23 UTC (rev 1417)
@@ -85,7 +85,7 @@
password, false);
//
- // For clastered config check credentials stored and propagated in session. This won't work in tomcat because
+ // For clustered config check credentials stored and propagated in session. This won't work in tomcat because
// of lack of JACC PolicyContext so the code must be a bit defensive
if (o == null && isClusteredSSO() && password.startsWith(InitiateLoginServlet.COOKIE_NAME))
{
14 years, 11 months
gatein SVN: r1416 - in portal/trunk/component/portal/src: test/java/org/exoplatform/portal/config and 1 other directory.
by do-not-reply@jboss.org
Author: trong.tran
Date: 2010-01-22 06:36:33 -0500 (Fri, 22 Jan 2010)
New Revision: 1416
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
Log:
GTNPORTAL-544 Raise up appropriate events when Add/Update/Remove a Portal Config
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2010-01-22 10:45:43 UTC (rev 1415)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorage.java 2010-01-22 11:36:33 UTC (rev 1416)
@@ -43,7 +43,24 @@
*/
public interface DataStorage
{
+ public final static String PAGE_CREATED = "org.exoplatform.portal.config.DataStorage.pageCreated".intern();
+
+ public final static String PAGE_REMOVED = "org.exoplatform.portal.config.DataStorage.pageRemoved".intern();
+ public final static String PAGE_UPDATED = "org.exoplatform.portal.config.DataStorage.pageUpdated".intern();
+
+ public final static String NAVIGATION_CREATED = "org.exoplatform.portal.config.DataStorage.navigationCreated".intern();
+
+ public final static String NAVIGATION_REMOVED = "org.exoplatform.portal.config.DataStorage.navigationRemoved".intern();
+
+ public final static String NAVIGATION_UPDATED = "org.exoplatform.portal.config.DataStorage.navigationUpdated".intern();
+
+ public final static String PORTAL_CONFIG_CREATED = "org.exoplatform.portal.config.DataStorage.portalConfigCreated".intern();
+
+ public final static String PORTAL_CONFIG_REMOVED = "org.exoplatform.portal.config.DataStorage.portalConfigRemoved".intern();
+
+ public final static String PORTAL_CONFIG_UPDATED = "org.exoplatform.portal.config.DataStorage.portalConfigUpdated".intern();
+
public void create(PortalConfig config) throws Exception;
public void save(PortalConfig config) throws Exception;
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2010-01-22 10:45:43 UTC (rev 1415)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2010-01-22 11:36:33 UTC (rev 1416)
@@ -25,12 +25,12 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.pom.data.DashboardData;
+import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.data.ModelData;
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.NavigationData;
@@ -39,6 +39,7 @@
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
+import org.exoplatform.services.listener.ListenerService;
import java.lang.reflect.Array;
import java.util.Comparator;
@@ -50,13 +51,15 @@
*/
public class DataStorageImpl implements DataStorage
{
-
/** . */
private ModelDataStorage delegate;
+
+ private ListenerService listenerServ_ ;
- public DataStorageImpl(ModelDataStorage delegate)
+ public DataStorageImpl(ModelDataStorage delegate, ListenerService listenerServ)
{
this.delegate = delegate;
+ this.listenerServ_ = listenerServ;
}
public Page clonePage(String pageId, String clonedOwnerType, String clonedOwnerId, String clonedName) throws Exception
@@ -72,61 +75,86 @@
return data != null ? new PageNavigation(data) : null;
}
- public void remove(Page page) throws Exception
+ public void create(PortalConfig config) throws Exception
{
- delegate.remove(page.build());
+ delegate.create(config.build());
+ listenerServ_.broadcast(PORTAL_CONFIG_CREATED, this, config);
}
- public <S> S load(ApplicationState<S> state, ApplicationType<S> type) throws Exception
+ public void save(PortalConfig config) throws Exception
{
- return delegate.load(state, type);
+ delegate.save(config.build());
+ listenerServ_.broadcast(PORTAL_CONFIG_UPDATED, this, config);
}
+
+ public void remove(PortalConfig config) throws Exception
+ {
+ delegate.remove(config.build());
+ listenerServ_.broadcast(PORTAL_CONFIG_REMOVED, this, config);
+ }
public void create(Page page) throws Exception
{
delegate.create(page.build());
+ listenerServ_.broadcast(PAGE_CREATED, this, page);
}
- public PortletPreferences getPortletPreferences(String windowID) throws Exception
+ public List<ModelChange> save(Page page) throws Exception
{
- return delegate.getPortletPreferences(windowID);
+ List<ModelChange> changes = delegate.save(page.build());
+ listenerServ_.broadcast(PAGE_UPDATED, this, page);
+ return changes;
}
+
+ public void remove(Page page) throws Exception
+ {
+ delegate.remove(page.build());
+ listenerServ_.broadcast(PAGE_REMOVED, this, page);
+ }
- public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception
+ public void create(PageNavigation navigation) throws Exception
{
- return delegate.save(state, preferences);
+ delegate.create(navigation.build());
+ listenerServ_.broadcast(NAVIGATION_CREATED, this, navigation);
}
- public Container getSharedLayout() throws Exception
+ public void save(PageNavigation navigation) throws Exception
{
- return delegate.getSharedLayout();
+ delegate.save(navigation.build());
+ listenerServ_.broadcast(NAVIGATION_UPDATED, this, navigation);
}
- public void save(PortalConfig config) throws Exception
+ public void remove(PageNavigation navigation) throws Exception
{
- delegate.save(config.build());
+ delegate.remove(navigation.build());
+ listenerServ_.broadcast(NAVIGATION_REMOVED, this, navigation);
}
- public void create(PortalConfig config) throws Exception
+ public <S> S load(ApplicationState<S> state, ApplicationType<S> type) throws Exception
{
- delegate.create(config.build());
+ return delegate.load(state, type);
}
- public PortalConfig getPortalConfig(String portalName) throws Exception
+ public PortletPreferences getPortletPreferences(String windowID) throws Exception
{
- return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
+ return delegate.getPortletPreferences(windowID);
}
- public void save(PageNavigation navigation) throws Exception
+ public <S> ApplicationState<S> save(ApplicationState<S> state, S preferences) throws Exception
{
- delegate.save(navigation.build());
+ return delegate.save(state, preferences);
}
- public void remove(PortalConfig config) throws Exception
+ public Container getSharedLayout() throws Exception
{
- delegate.remove(config.build());
+ return delegate.getSharedLayout();
}
+ public PortalConfig getPortalConfig(String portalName) throws Exception
+ {
+ return getPortalConfig(PortalConfig.PORTAL_TYPE, portalName);
+ }
+
public PageNavigation getPageNavigation(String fullId) throws Exception
{
NavigationKey key = NavigationKey.create(fullId);
@@ -141,16 +169,6 @@
return data != null ? new Page(data) : null;
}
- public List<ModelChange> save(Page page) throws Exception
- {
- return delegate.save(page.build());
- }
-
- public void create(PageNavigation navigation) throws Exception
- {
- delegate.create(navigation.build());
- }
-
private abstract class Bilto<O extends ModelObject, D extends ModelData>
{
@@ -269,11 +287,6 @@
return data != null ? new PortalConfig(data) : null;
}
- public void remove(PageNavigation navigation) throws Exception
- {
- delegate.remove(navigation.build());
- }
-
public Dashboard loadDashboard(String dashboardId) throws Exception
{
DashboardData data = delegate.loadDashboard(dashboardId);
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2010-01-22 10:45:43 UTC (rev 1415)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2010-01-22 11:36:33 UTC (rev 1416)
@@ -59,7 +59,7 @@
private ConfigurationManager cmanager_;
- private DataStorage pdcService_;
+ private DataStorage dataStorage_;
private volatile List<?> configs;
@@ -71,11 +71,11 @@
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
- public NewPortalConfigListener(DataStorage pdcService, ConfigurationManager cmanager, InitParams params)
+ public NewPortalConfigListener(DataStorage dataStorage, ConfigurationManager cmanager, InitParams params)
throws Exception
{
cmanager_ = cmanager;
- pdcService_ = pdcService;
+ dataStorage_ = dataStorage;
ObjectParameter objectParam = params.getObjectParam("page.templates");
if (objectParam != null)
@@ -246,7 +246,7 @@
private boolean isInitedDB(String portalName) throws Exception
{
- PortalConfig pconfig = pdcService_.getPortalConfig(portalName);
+ PortalConfig pconfig = dataStorage_.getPortalConfig(portalName);
return pconfig != null;
}
@@ -304,13 +304,13 @@
// Ensure that the PortalConfig has been defined
// The PortalConfig could be empty if the related PortalConfigListener
// has been launched after starting this service
- PortalConfig cfg = pdcService_.getPortalConfig(type, owner);
+ PortalConfig cfg = dataStorage_.getPortalConfig(type, owner);
if (cfg == null)
{
cfg = new PortalConfig(type);
cfg.setPortalLayout(new Container());
cfg.setName(owner);
- pdcService_.create(cfg);
+ dataStorage_.create(cfg);
}
return;
}
@@ -325,14 +325,14 @@
owner = pconfig.getName();
//
- PortalConfig currentPortalConfig = pdcService_.getPortalConfig(type, owner);
+ PortalConfig currentPortalConfig = dataStorage_.getPortalConfig(type, owner);
if (currentPortalConfig == null)
{
- pdcService_.create(pconfig);
+ dataStorage_.create(pconfig);
}
else
{
- pdcService_.save(pconfig);
+ dataStorage_.save(pconfig);
}
}
catch (JiBXException e)
@@ -372,7 +372,7 @@
ArrayList<Page> list = pageSet.getPages();
for (Page page : list)
{
- pdcService_.create(page);
+ dataStorage_.create(page);
}
}
catch (JiBXException e)
@@ -403,15 +403,15 @@
xml = StringUtils.replace(xml, "@owner@", owner);
}
PageNavigation navigation = fromXML(config.getOwnerType(), owner, xml, PageNavigation.class);
- PageNavigation currentNavigation = pdcService_.getPageNavigation(navigation.getOwner());
+ PageNavigation currentNavigation = dataStorage_.getPageNavigation(navigation.getOwner());
if (currentNavigation == null)
{
- pdcService_.create(navigation);
+ dataStorage_.create(navigation);
}
else
{
navigation.merge(currentNavigation);
- pdcService_.save(navigation);
+ dataStorage_.save(navigation);
}
}
catch (JiBXException e)
@@ -446,7 +446,7 @@
ArrayList<PortletPreferences> list = portletSet.getPortlets();
for (PortletPreferences portlet : list)
{
- pdcService_.save(portlet);
+ dataStorage_.save(portlet);
}
}
catch (JiBXException e)
Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2010-01-22 10:45:43 UTC (rev 1415)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2010-01-22 11:36:33 UTC (rev 1416)
@@ -19,7 +19,6 @@
package org.exoplatform.portal.config;
-import org.exoplatform.commons.chromattic.ChromatticManager;
import org.exoplatform.commons.utils.PageList;
import org.exoplatform.container.PortalContainer;
import org.exoplatform.container.component.ComponentPlugin;
@@ -33,7 +32,6 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.data.ModelChange;
-import org.exoplatform.services.listener.ListenerService;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.organization.Group;
@@ -54,42 +52,23 @@
*/
public class UserPortalConfigService implements Startable
{
-
- public final static String CREATE_PAGE_EVENT = "UserPortalConfigService.page.onCreate".intern();
-
- public final static String REMOVE_PAGE_EVENT = "UserPortalConfigService.page.onRemove".intern();
-
- public final static String UPDATE_PAGE_EVENT = "UserPortalConfigService.page.onUpdate".intern();
-
- public final static String CREATE_NAVIGATION_EVENT = "UserPortalConfigService.navigation.onCreate".intern();
-
- public final static String REMOVE_NAVIGATION_EVENT = "UserPortalConfigService.navigation.onRemove".intern();
-
- public final static String UPDATE_NAVIGATION_EVENT = "UserPortalConfigService.navigation.onUpdate".intern();
-
private DataStorage storage_;
private UserACL userACL_;
private OrganizationService orgService_;
- private ListenerService listenerService;
-
private NewPortalConfigListener newPortalConfigListener_;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
- private ChromatticManager manager;
-
public UserPortalConfigService(
UserACL userACL, DataStorage storage,
- OrganizationService orgService, ListenerService listenerService, ChromatticManager manager) throws Exception
+ OrganizationService orgService) throws Exception
{
this.storage_ = storage;
this.orgService_ = orgService;
- this.listenerService = listenerService;
this.userACL_ = userACL;
- this.manager = manager;
}
/**
@@ -317,7 +296,7 @@
}
/**
- * Removes a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#REMOVE_PAGE_EVENT}
+ * Removes a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#PAGE_REMOVED}
* when the removal is successful.
*
* @param page the page to remove
@@ -326,7 +305,6 @@
public void remove(Page page) throws Exception
{
storage_.remove(page);
- listenerService.broadcast(REMOVE_PAGE_EVENT, this, page);
}
/**
@@ -339,13 +317,10 @@
public void create(Page page) throws Exception
{
storage_.create(page);
-
- //
- listenerService.broadcast(CREATE_PAGE_EVENT, this, page);
}
/**
- * Updates a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#UPDATE_PAGE_EVENT}
+ * Updates a page and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#PAGE_UPDATED}
* when the creation is successful.
*
* @param page the page to update
@@ -355,9 +330,6 @@
public List<ModelChange> update(Page page) throws Exception
{
List<ModelChange> changes = storage_.save(page);
-
- //
- listenerService.broadcast(UPDATE_PAGE_EVENT, this, page);
return changes;
}
@@ -371,11 +343,10 @@
public void create(PageNavigation navigation) throws Exception
{
storage_.create(navigation);
- listenerService.broadcast(CREATE_NAVIGATION_EVENT, this, navigation);
}
/**
- * Updates a page navigation broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#UPDATE_NAVIGATION_EVENT}
+ * Updates a page navigation broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_UPDATED}
* when the creation is successful.
*
* @param navigation the navigation to update
@@ -384,11 +355,10 @@
public void update(PageNavigation navigation) throws Exception
{
storage_.save(navigation);
- listenerService.broadcast(UPDATE_NAVIGATION_EVENT, this, navigation);
}
/**
- * Removes a navigation and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#REMOVE_NAVIGATION_EVENT}
+ * Removes a navigation and broadcast an event labelled as {@link org.exoplatform.portal.config.UserPortalConfigService#NAVIGATION_REMOVED}
* when the removal is successful.
*
* @param navigation the navigation to remove
@@ -397,7 +367,6 @@
public void remove(PageNavigation navigation) throws Exception
{
storage_.remove(navigation);
- listenerService.broadcast(REMOVE_NAVIGATION_EVENT, this, navigation);
}
public PageNavigation getPageNavigation(String ownerType, String id) throws Exception
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-01-22 10:45:43 UTC (rev 1415)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java 2010-01-22 11:36:33 UTC (rev 1416)
@@ -29,20 +29,24 @@
import org.exoplatform.portal.config.model.ApplicationType;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.portal.pom.spi.gadget.Gadget;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
+import org.exoplatform.services.listener.Event;
+import org.exoplatform.services.listener.Listener;
+import org.exoplatform.services.listener.ListenerService;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -67,6 +71,10 @@
/** . */
private POMSession session;
+ private LinkedList<Event> events;
+
+ private ListenerService listenerService;
+
public TestDataStorage(String name)
{
super(name);
@@ -74,12 +82,34 @@
public void setUp() throws Exception
{
+ Listener listener = new Listener()
+ {
+ @Override
+ public void onEvent(Event event) throws Exception
+ {
+ events.add(event);
+ }
+ };
+
super.setUp();
begin();
PortalContainer container = PortalContainer.getInstance();
storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
session = mgr.openSession();
+
+ events = new LinkedList<Event>();
+ listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
+
+ listenerService.addListener(DataStorage.PAGE_CREATED, listener);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_CREATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_REMOVED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_UPDATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener);
+ listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener);
}
protected void tearDown() throws Exception
@@ -99,6 +129,7 @@
//
storage_.create(portal);
+ assertEquals(1, events.size());
portal = storage_.getPortalConfig(portal.getName());
assertNotNull(portal);
assertEquals("portal", portal.getType());
@@ -113,7 +144,7 @@
//
portal.setLocale("vietnam");
storage_.save(portal);
-
+ assertEquals(1, events.size());
//
portal = storage_.getPortalConfig("portal", "test");
assertNotNull(portal);
@@ -126,6 +157,7 @@
assertNotNull(portal);
storage_.remove(portal);
+ assertEquals(1, events.size());
assertNull(storage_.getPortalConfig("portal", "test"));
try
@@ -150,6 +182,7 @@
//
storage_.create(page);
+ assertEquals(1, events.size());
//
Page page2 = storage_.getPage(page.getPageId());
@@ -175,12 +208,14 @@
//
storage_.create(page);
+ assertEquals(1, events.size());
//
Page page2 = storage_.getPage(page.getPageId());
page2.setTitle("MyTitle2");
page2.setShowMaxWindow(true);
storage_.save(page2);
+ assertEquals(2, events.size());
page2 = storage_.getPage(page.getPageId());
assertNotNull(page2);
@@ -200,7 +235,8 @@
//
storage_.remove(page);
-
+ assertEquals(1, events.size());
+
//
page = storage_.getPage(testPage);
assertNull(page);
@@ -278,12 +314,14 @@
portal.setLocale("en");
portal.setAccessPermissions(new String[]{UserACL.EVERYONE});
storage_.create(portal);
+ assertEquals(1, events.size());
//
PageNavigation navigation = new PageNavigation();
navigation.setOwnerId("foo");
navigation.setOwnerType("portal");
storage_.create(navigation);
+ assertEquals(2, events.size());
}
public void testSaveNavigation() throws Exception
@@ -294,6 +332,7 @@
//
pageNavi.setModifier("trong.tran");
storage_.save(pageNavi);
+ assertEquals(1, events.size());
//
PageNavigation newPageNavi = storage_.getPageNavigation(pageNavi.getOwnerType(), pageNavi.getOwnerId());
@@ -307,6 +346,7 @@
//
storage_.remove(navigation);
+ assertEquals(1, events.size());
//
navigation = storage_.getPageNavigation("portal", "test");
Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2010-01-22 10:45:43 UTC (rev 1415)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2010-01-22 11:36:33 UTC (rev 1416)
@@ -100,8 +100,6 @@
@Override
protected void setUp() throws Exception
{
-
- //
Listener listener = new Listener()
{
@Override
@@ -126,12 +124,12 @@
{
// I'm using this due to crappy design of
// org.exoplatform.services.listener.ListenerService
- listenerService.addListener(UserPortalConfigService.CREATE_PAGE_EVENT, listener);
- listenerService.addListener(UserPortalConfigService.REMOVE_PAGE_EVENT, listener);
- listenerService.addListener(UserPortalConfigService.UPDATE_PAGE_EVENT, listener);
- listenerService.addListener(UserPortalConfigService.CREATE_NAVIGATION_EVENT, listener);
- listenerService.addListener(UserPortalConfigService.REMOVE_NAVIGATION_EVENT, listener);
- listenerService.addListener(UserPortalConfigService.UPDATE_NAVIGATION_EVENT, listener);
+ listenerService.addListener(DataStorage.PAGE_CREATED, listener);
+ listenerService.addListener(DataStorage.PAGE_REMOVED, listener);
+ listenerService.addListener(DataStorage.PAGE_UPDATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_CREATED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_REMOVED, listener);
+ listenerService.addListener(DataStorage.NAVIGATION_UPDATED, listener);
}
}
@@ -451,7 +449,7 @@
userPortalConfigSer_.remove(page);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.REMOVE_PAGE_EVENT, event.getEventName());
+ assertEquals(DataStorage.PAGE_REMOVED, event.getEventName());
Page p = ((Page)event.getData());
assertEquals("group", p.getOwnerType());
assertEquals("/platform/administrators", p.getOwnerId());
@@ -475,7 +473,7 @@
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_PAGE_EVENT, event.getEventName());
+ assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
Page p = ((Page)event.getData());
assertEquals("group", p.getOwnerType());
assertEquals("/platform/administrators", p.getOwnerId());
@@ -526,7 +524,7 @@
userPortalConfigSer_.create(page);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_PAGE_EVENT, event.getEventName());
+ assertEquals(DataStorage.PAGE_CREATED, event.getEventName());
Page p = ((Page)event.getData());
assertEquals("group", p.getOwnerType());
assertEquals("/platform/administrators", p.getOwnerId());
@@ -584,7 +582,7 @@
userPortalConfigSer_.remove(navigation);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.REMOVE_NAVIGATION_EVENT, event.getEventName());
+ assertEquals(DataStorage.NAVIGATION_REMOVED, event.getEventName());
PageNavigation n = ((PageNavigation)event.getData());
assertEquals("group", n.getOwnerType());
assertEquals("/platform/administrators", n.getOwnerId());
@@ -608,7 +606,7 @@
userPortalConfigSer_.create(navigation);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_NAVIGATION_EVENT, event.getEventName());
+ assertEquals(DataStorage.NAVIGATION_CREATED, event.getEventName());
PageNavigation n = ((PageNavigation)event.getData());
assertEquals("group", n.getOwnerType());
assertEquals("/platform/administrators", n.getOwnerId());
@@ -649,7 +647,7 @@
{
userPortalConfigSer_.create(navigation);
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.CREATE_NAVIGATION_EVENT, event.getEventName());
+ assertEquals(DataStorage.CREATE_NAVIGATION_EVENT, event.getEventName());
PageNavigation n1 = (PageNavigation)event.getSource();
assertEquals(ownerType, n1.getOwnerType());
assertEquals(ownerId, n1.getOwnerId());
@@ -693,7 +691,7 @@
userPortalConfigSer_.update(navigation);
assertEquals(1, events.size());
Event event = events.removeFirst();
- assertEquals(UserPortalConfigService.UPDATE_NAVIGATION_EVENT, event.getEventName());
+ assertEquals(DataStorage.NAVIGATION_UPDATED, event.getEventName());
PageNavigation n = ((PageNavigation)event.getData());
assertEquals("group", n.getOwnerType());
assertEquals("/platform/administrators", n.getOwnerId());
14 years, 11 months
gatein SVN: r1415 - portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-01-22 05:45:43 -0500 (Fri, 22 Jan 2010)
New Revision: 1415
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties
Log:
- Removed extra space in properties so that they could properly be used in GateIn. :/
Modified: portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties 2010-01-22 06:57:52 UTC (rev 1414)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/WSRPAdminPortlet_en.properties 2010-01-22 10:45:43 UTC (rev 1415)
@@ -20,10 +20,10 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
#
-ConsumerEditor.label.name = Consumer name:
-ConsumerEditor.label.cache = Seconds before cache expiration:
-ConsumerEditor.label.timeout = Milliseconds before timeout:
-ConsumerEditor.label.wsdl = WSDL URL:
-ConsumerEditor.label.local = Local registration properties:
-ConsumerEditor.label.expected = Expected registration properties:
+ConsumerEditor.label.name=Consumer name:
+ConsumerEditor.label.cache=Seconds before cache expiration:
+ConsumerEditor.label.timeout=Milliseconds before timeout:
+ConsumerEditor.label.wsdl=WSDL URL:
+ConsumerEditor.label.local=Local registration properties:
+ConsumerEditor.label.expected=Expected registration properties:
14 years, 11 months