Author: chris.laprun(a)jboss.com
Date: 2009-12-21 08:59:10 -0500 (Mon, 21 Dec 2009)
New Revision: 1101
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/UIWsrpConsumerOverview.java
Log:
- Fixed consumer creation where given values weren't used.
- Started adding display of error messages.
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-21
11:51:08 UTC (rev 1100)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java 2009-12-21
13:59:10 UTC (rev 1101)
@@ -22,34 +22,25 @@
******************************************************************************/
package org.exoplatform.wsrp.webui.component;
-import org.exoplatform.applicationregistry.webui.component.UIAddApplicationForm;
-import org.exoplatform.applicationregistry.webui.component.UIApplicationForm;
-import org.exoplatform.applicationregistry.webui.component.UIApplicationOrganizer;
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.services.organization.User;
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.UIComponent;
import org.exoplatform.webui.core.UIGrid;
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.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.validator.MandatoryValidator;
-import org.exoplatform.webui.organization.UIAccountInputSet;
import org.gatein.wsrp.WSRPConsumer;
import org.gatein.wsrp.consumer.ConsumerException;
-import org.gatein.wsrp.consumer.EndpointConfigurationInfo;
import org.gatein.wsrp.consumer.ProducerInfo;
-import org.gatein.wsrp.consumer.WSRPConsumerImpl;
import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
/** @author Wesley Hales */
@@ -71,22 +62,29 @@
//addChild(UIWsrpEndpointConfigForm.class,null,null);
}
- private String getConsumerName(){
+ private String getConsumerName()
+ {
return getUIStringInput(CONSUMER_NAME).getValue();
}
- private Integer getCacheExpiration(){
+ private Integer getCacheExpiration()
+ {
Integer cacheExp = 0;
String cacheExpString = getUIStringInput(CACHE_EXPIRATION).getValue();
- if(cacheExpString != null){
+ if (cacheExpString != null)
+ {
cacheExp = Integer.parseInt(cacheExpString);
}
return cacheExp;
}
+ private String getWSDLURL()
+ {
+ return getUIStringInput(WSDL_URL).getValue();
+ }
-
- public void setConsumer(WSRPConsumer consumer) throws Exception{
+ public void setConsumer(WSRPConsumer consumer) throws Exception
+ {
//UIWsrpEndpointConfigForm uiWsrpEndpointConfigForm =
getChild(UIWsrpEndpointConfigForm.class);
if (consumer == null)
{
@@ -98,14 +96,15 @@
getUIStringInput(CONSUMER_NAME).setValue(consumer.getProducerId());
getUIStringInput(CACHE_EXPIRATION).setValue(consumer.getProducerInfo().getExpirationCacheSeconds().toString());
getUIStringInput(WSDL_URL).setValue(consumer.getProducerInfo().getEndpointConfigurationInfo().getWsdlDefinitionURL());
- //invokeGetBindingBean(consumer.getProducerInfo());
+ //invokeGetBindingBean(consumer.getProducerInfo());
//uiWsrpEndpointConfigForm.setProducerInfo(consumer.getProducerInfo());
//uiWsrpEndpointConfigForm.invokeGetBindingBean(consumer.getProducerInfo().getEndpointConfigurationInfo());
//bindingFields(consumer);
}
- private void bindingFields(WSRPConsumer consumer){
+ private void bindingFields(WSRPConsumer consumer)
+ {
//ExoContainer manager = ExoContainerContext.getCurrentContainer();
//ConsumerRegistry consumerRegistry =
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
ProducerInfo producerInfo = consumer.getProducerInfo();
@@ -141,7 +140,7 @@
LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getTempArrayList());
UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
uiGrid.getUIPageIterator().setPageList(pageList);
-
+
ctx.addUIComponentToUpdateByAjax(consumerOverview);
//consumerOverview.renderUIComponent(consumerEditor.getParent().getParent().findComponentById("ConsumerSelector"));
@@ -183,10 +182,16 @@
UIApplication uiApp = context.getUIApplication();
- try{
- consumerRegistry.createConsumer(getConsumerName(),300);
+ try
+ {
+ WSRPConsumer consumer = consumerRegistry.createConsumer(getConsumerName(),
getCacheExpiration());
+ ProducerInfo producerInfo = consumer.getProducerInfo();
+ producerInfo.getEndpointConfigurationInfo().setWsdlDefinitionURL(getWSDLURL());
+ consumerRegistry.updateProducerInfo(producerInfo);
uiApp.addMessage(new ApplicationMessage("Consumer Successfully Added",
null));
- }catch(ConsumerException ce){
+ }
+ catch (ConsumerException ce)
+ {
//todo - add to resource bundle
uiApp.addMessage(new ApplicationMessage("Consumer already exists!",
null));
}
@@ -203,16 +208,19 @@
//UIWsrpEndpointConfigForm uiWsrpEndpointConfigForm =
getChild(UIWsrpEndpointConfigForm.class);
//uiWsrpEndpointConfigForm.invokeSetBindingBean(consumer.getProducerInfo().getEndpointConfigurationInfo());
- producerInfo.setId(getUIStringInput(CONSUMER_NAME).getValue());
-
producerInfo.setExpirationCacheSeconds(Integer.parseInt(getUIStringInput(CACHE_EXPIRATION).getValue()));
-
producerInfo.getEndpointConfigurationInfo().setWsdlDefinitionURL(getUIStringInput(WSDL_URL).getValue());
+ producerInfo.setId(getConsumerName());
+ producerInfo.setExpirationCacheSeconds(getCacheExpiration());
+ producerInfo.getEndpointConfigurationInfo().setWsdlDefinitionURL(getWSDLURL());
UIApplication uiApp = context.getUIApplication();
- try{
+ try
+ {
consumerRegistry.updateProducerInfo(producerInfo);
uiApp.addMessage(new ApplicationMessage("Edit Consumer Successful!",
null));
- }catch(ConsumerException ce){
+ }
+ catch (ConsumerException ce)
+ {
//todo - add to resource bundle
uiApp.addMessage(new ApplicationMessage("Edit Consumer Problem!",
null));
}
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-21
11:51:08 UTC (rev 1100)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2009-12-21
13:59:10 UTC (rev 1101)
@@ -26,12 +26,6 @@
import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.organization.webui.component.UIMembershipManagement;
-import org.exoplatform.organization.webui.component.UIMembershipTypeForm;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.services.organization.MembershipType;
-import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -47,8 +41,6 @@
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 */
@@ -91,7 +83,7 @@
public LazyPageList createPageList(final List pageList)
{
- return new LazyPageList(new ListAccess<WSRPConsumer>()
+ return new LazyPageList<WSRPConsumer>(new ListAccess<WSRPConsumer>()
{
public int getSize() throws Exception
@@ -160,16 +152,17 @@
}
}
- public void refreshGrid(Event<UIWsrpConsumerOverview> event) throws Exception {
- UIWsrpConsumerOverview consumerOverview = event.getSource();
- WebuiRequestContext ctx = event.getRequestContext();
+ public void refreshGrid(Event<UIWsrpConsumerOverview> event) throws Exception
+ {
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WebuiRequestContext ctx = event.getRequestContext();
- UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
- //refresh the list
- LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getTempArrayList());
- uiGrid.getUIPageIterator().setPageList(pageList);
+ UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
+ //refresh the list
+ LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getTempArrayList());
+ uiGrid.getUIPageIterator().setPageList(pageList);
- ctx.addUIComponentToUpdateByAjax(consumerOverview);
+ ctx.addUIComponentToUpdateByAjax(consumerOverview);
}
static public class OpenPopupActionListener extends
EventListener<UIWsrpConsumerOverview>
@@ -221,19 +214,26 @@
static public class DeleteActionListener extends
EventListener<UIWsrpConsumerOverview>
{
- public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
+ public void execute(Event<UIWsrpConsumerOverview> event)
{
- UIWsrpConsumerOverview consumerOverview = event.getSource();
- WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
- ConsumerRegistry consumerRegistry = consumerOverview.getConsumerRegistry();
UIApplication uiApp = event.getRequestContext().getUIApplication();
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- if (consumer != null)
+ try
{
- consumerRegistry.destroyConsumer(id);
- uiApp.addMessage(new ApplicationMessage("Consumer has been
deleted.", null));
- consumerOverview.refreshGrid(event);
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
+ ConsumerRegistry consumerRegistry = consumerOverview.getConsumerRegistry();
+ String id = event.getRequestContext().getRequestParameter(OBJECTID);
+ if (consumer != null)
+ {
+ consumerRegistry.destroyConsumer(id);
+ uiApp.addMessage(new ApplicationMessage("Consumer has been
deleted.", null));
+ consumerOverview.refreshGrid(event);
+ }
}
+ catch (Exception e)
+ {
+ uiApp.addMessage(new ApplicationMessage("Failed to delete Consumer.
Cause: " + e.getCause(), null, ApplicationMessage.ERROR));
+ }
}
}
@@ -292,17 +292,24 @@
static public class RefreshActionListener extends
EventListener<UIWsrpConsumerOverview>
{
- public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
+ public void execute(Event<UIWsrpConsumerOverview> event)
{
- UIWsrpConsumerOverview consumerOverview = event.getSource();
- WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
UIApplication uiApp = event.getRequestContext().getUIApplication();
+ try
+ {
+ UIWsrpConsumerOverview consumerOverview = event.getSource();
+ WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
- if (consumer != null)
+ if (consumer != null)
+ {
+ consumer.refresh(true);
+ uiApp.addMessage(new ApplicationMessage("Consumer Refreshed
Successfully", null));
+ consumerOverview.refreshGrid(event);
+ }
+ }
+ catch (Exception e)
{
- consumer.refresh(true);
- uiApp.addMessage(new ApplicationMessage("Consumer Refreshed
Successfully", null));
- consumerOverview.refreshGrid(event);
+ uiApp.addMessage(new ApplicationMessage("Failed to refresh Consumer.
Cause: " + e.getCause(), null, ApplicationMessage.ERROR));
}
}
}
Show replies by date