Author: wesleyhales
Date: 2009-12-11 17:11:28 -0500 (Fri, 11 Dec 2009)
New Revision: 997
Added:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerSelector.gtmpl
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/pom.xml
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl
Log:
add consumer - first integration with wsrp
Modified: portal/branches/wsrp-integration/portlet/exoadmin/pom.xml
===================================================================
--- portal/branches/wsrp-integration/portlet/exoadmin/pom.xml 2009-12-11 17:51:45 UTC (rev
996)
+++ portal/branches/wsrp-integration/portlet/exoadmin/pom.xml 2009-12-11 22:11:28 UTC (rev
997)
@@ -44,7 +44,26 @@
<artifactId>exo.portal.webui.eXo</artifactId>
<version>3.0.0-Beta03-SNAPSHOT</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-producer-lib</artifactId>
+ <version>${org.gatein.wsrp.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-consumer</artifactId>
+ <version>${org.gatein.wsrp.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.gatein.wsrp</groupId>
+ <artifactId>wsrp-integration-api</artifactId>
+ <version>${org.gatein.wsrp.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java 2009-12-11
17:51:45 UTC (rev 996)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsole.java 2009-12-11
22:11:28 UTC (rev 997)
@@ -45,6 +45,7 @@
@ComponentConfig(
id = "UIWsrpConsoleTab",
type = UITabPane.class,
+ //template = "system:/groovy/webui/core/UITabPane_New.gtmpl",
template = "app:/groovy/wsrp/webui/component/UIWsrpConsoleContent.gtmpl",
events = {@EventConfig(listeners = UIWsrpConsole.SelectTabActionListener.class)})})
public class UIWsrpConsole extends UIContainer
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java 2009-12-11
17:51:45 UTC (rev 996)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java 2009-12-11
22:11:28 UTC (rev 997)
@@ -25,22 +25,28 @@
import org.exoplatform.applicationregistry.webui.component.UIAddApplicationForm;
import org.exoplatform.applicationregistry.webui.component.UIApplicationForm;
import org.exoplatform.applicationregistry.webui.component.UIApplicationOrganizer;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIApplication;
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;
import org.exoplatform.webui.form.validator.MandatoryValidator;
+import org.gatein.wsrp.WSRPConsumer;
+import org.gatein.wsrp.consumer.ConsumerException;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
/** @author Wesley Hales */
@ComponentConfig(template =
"app:/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl", lifecycle =
UIFormLifecycle.class, events = {
- @EventConfig(listeners = UIAddApplicationForm.AddActionListener.class),
- @EventConfig(listeners = UIApplicationForm.SaveActionListener.class),
- @EventConfig(listeners = UIAddApplicationForm.CancelActionListener.class, phase =
Event.Phase.DECODE)})
-public class UIWsrpConsumerEditor extends UIApplicationForm
+ @EventConfig(listeners = UIWsrpConsumerEditor.SaveActionListener.class)})
+public class UIWsrpConsumerEditor extends UIForm
{
protected static final String CONSUMER_NAME = "Consumer Name:";
@@ -65,6 +71,24 @@
public boolean save(WebuiRequestContext context) throws Exception
{
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ ConsumerRegistry consumerRegistry =
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
+ //WSRPConsumer consumer;
+
+ UIApplication uiApp = context.getUIApplication();
+
+ try{
+ consumerRegistry.createConsumer(getConsumerName(),100);
+ }catch(ConsumerException ce){
+ //todo - add to resource bundle
+ uiApp.addMessage(new ApplicationMessage("Consumer already exists!",
null));
+ }
+
+ //consumer = new WSRPConsumerImpl();
+
+
+
+
System.out.println("----------getConsumerName: " + getConsumerName());
return true;
}
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2009-12-11
17:51:45 UTC (rev 996)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2009-12-11
22:11:28 UTC (rev 997)
@@ -22,30 +22,102 @@
******************************************************************************/
package org.exoplatform.wsrp.webui.component;
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.pom.data.PortalData;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
+import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.core.UIGrid;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.gatein.wsrp.WSRPConsumer;
+import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
/** @author Wesley Hales */
-@ComponentConfig(
- lifecycle = UIApplicationLifecycle.class,
- template = "app:/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl",
- events = {
+@ComponentConfigs({
+ @ComponentConfig(id = "ConsumerSelector", type = UIGrid.class, template =
"system:/groovy/webui/core/UIGrid.gtmpl"),
+ @ComponentConfig(
+ lifecycle = UIApplicationLifecycle.class,
+ template =
"app:/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl",
+ events = {
@EventConfig(listeners = UIWsrpConsumerOverview.OpenPopupActionListener.class)
- })
+ })
+})
+
public class UIWsrpConsumerOverview extends UIContainer
{
+ public static String[] FIELDS = {"producerId", "active",
"refreshNeeded"};
+
+ public static String[] SELECT_ACTIONS = {"SelectConsumer"};
+
public UIWsrpConsumerOverview() throws Exception
{
UIPopupWindow popup = addChild(UIPopupWindow.class, null, null);
popup.setWindowSize(400, 300);
- UIWsrpConsumerEditor consumerForm =
createUIComponent(UIWsrpConsumerEditor.class,null,null);
+ UIWsrpConsumerEditor consumerForm = createUIComponent(UIWsrpConsumerEditor.class,
null, null);
popup.setUIComponent(consumerForm);
popup.setRendered(false);
+
+ ExoContainer manager = ExoContainerContext.getCurrentContainer();
+ ConsumerRegistry consumerRegistry =
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
+
+ UIGrid uiGrid = addChild(UIGrid.class, "ConsumerSelector", null);
+ uiGrid.configure("producerId", FIELDS, SELECT_ACTIONS);
+ uiGrid.getUIPageIterator().setId("ChangeConsumerPageIterator");
+ addChild(uiGrid.getUIPageIterator());
+ uiGrid.getUIPageIterator().setRendered(false);
+ final List tempArrayList = consumerRegistry.getConfiguredConsumers();
+
+ LazyPageList pageList = new LazyPageList(new ListAccess<WSRPConsumer>()
+ {
+
+ public int getSize() throws Exception
+ {
+ return tempArrayList.size();
+ }
+
+ public WSRPConsumer[] load(int index, int length) throws Exception,
IllegalArgumentException
+ {
+ WSRPConsumer[] pcs = new WSRPConsumer[tempArrayList.size()];
+
+ if (index < 0)
+ {
+ throw new IllegalArgumentException("Illegal index: index must be a
positive number");
+ }
+
+ if (length < 0)
+ {
+ throw new IllegalArgumentException("Illegal length: length must be a
positive number");
+ }
+
+ if (index + length > tempArrayList.size())
+ {
+ throw new IllegalArgumentException(
+ "Illegal index or length: sum of the index and the length cannot
be greater than the list size");
+ }
+
+ for (int i = 0; i < length; i++)
+ {
+ pcs[i] = (WSRPConsumer)tempArrayList.get(i + index);
+ }
+
+ return pcs;
+ }
+
+ }, 10);
+ uiGrid.getUIPageIterator().setPageList(pageList);
}
static public class OpenPopupActionListener extends
EventListener<UIWsrpConsumerOverview>
@@ -58,4 +130,9 @@
popup.setShow(true);
}
}
+
+// public void processRender(WebuiRequestContext context) throws Exception
+// {
+// super.processRender(context);
+// }
}
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl 2009-12-11
17:51:45 UTC (rev 996)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerEditor.gtmpl 2009-12-11
22:11:28 UTC (rev 997)
@@ -1,44 +1,66 @@
<%
-
- import org.exoplatform.webui.form.UIFormStringInput;
-
+ import org.exoplatform.webui.form.UIFormStringInput;
%>
<div class="UILoginForm" id="ChildTest">
-
- <%uiform.begin()%>
-
+ <% uiform.begin() %>
<%
- UIFormStringInput name = uicomponent.getChild(UIFormStringInput.class);
- %>
- <div class="SignIn">Add new Consumer</div>
- <div class="FloatRight">
- <div class="FloatLeft">
- <div class="UserName" >
- <label>Consumer Name</label>
- <% uiform.renderField(name); %>
- </div>
+ UIFormStringInput name = uicomponent.getChild(UIFormStringInput.class);
+ %>
+ <div class="SignIn">Add new Consumer</div>
+ <div class="FloatRight">
+ <div class="FloatLeft">
+ <div class="UserName">
+ <label>Consumer Name</label>
+ <% //uiform.renderChild(0); %>
+ <%
+ for (field in uiform.getChildren())
+ {
+ if (field.isRendered())
+ {
+ %>
+ <div>
+ <% fieldName = uicomponent.getLabel(field.getName()); %>
+ <% if (!fieldName.equals(uicomponent.getId()))
+ { %>
+ <div class="FieldLabel">
+ <% if (fieldName != null && fieldName.length() > 0)
+ { %>
+ <%=uicomponent.getLabel(field.getName())%>
+ <% } %>
+ </div>
+ <div class="FieldComponent"><% uiform.renderField(field)
%></div>
+ <% }
+ else
+ { %>
+ <div class="FieldComponent"><% uiform.renderField(field)
%></div>
+ <% } %>
+ </div>
+ <%
+ }
+ } %>
+ </div>
- </div>
- <div class="UIAction">
- <table class="ActionContainer">
- <tr>
- <td>
- <div
onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
- <div class="ButtonLeft">
- <div class="ButtonRight">
- <div class="ButtonMiddle">
- <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <div class="ClearLeft"><span></span></div>
- </div>
- <div class="ClearRight"><span></span></div>
- <%uiform.end()%>
+ </div>
+ <div class="UIAction">
+ <table class="ActionContainer">
+ <tr>
+ <td>
+ <div onclick="<%=uicomponent.event("Save")%>"
class="ActionButton LightBlueStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".action.Save")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ <div class="ClearLeft"><span></span></div>
+ </div>
+ <div class="ClearRight"><span></span></div>
+ <% uiform.end() %>
</div>
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl 2009-12-11
17:51:45 UTC (rev 996)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerOverview.gtmpl 2009-12-11
22:11:28 UTC (rev 997)
@@ -1,6 +1,15 @@
<% uicomponent.renderChildren(); %>
+<%
+ import org.exoplatform.webui.core.UIComponent ;
+ import org.exoplatform.webui.form.UIFormPageIterator ;
+ import org.exoplatform.webui.form.UIFormCheckBoxInput ;
+
+%>
+
+
<div class="<%=uicomponent.getId()%>">
<a href="<%=uicomponent.event("OpenPopup",
"")%>">Add Consumer</a>
+
</div>
\ No newline at end of file
Added:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/groovy/wsrp/webui/component/UIWsrpConsumerSelector.gtmpl
===================================================================