Author: chris.laprun(a)jboss.com
Date: 2009-12-21 13:17:29 -0500 (Mon, 21 Dec 2009)
New Revision: 1108
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
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
Log:
- Added activate action.
- Removed start and stop actions.
- Now activate or deactivate consumer based on refresh result.
- Renamed UIWsrpConsumerOverview.getTempArray to getConfiguredConsumers to be more
explicit.
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
18:03:49 UTC (rev 1107)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerEditor.java 2009-12-21
18:17:29 UTC (rev 1108)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, 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;
import org.exoplatform.commons.utils.LazyPageList;
@@ -137,7 +137,7 @@
//create a new form, clears out the old, probably a better way
//popup.setUIComponent(consumerOverview.createUIComponent(UIWsrpConsumerEditor.class,
null, null));
- LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getTempArrayList());
+ LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getConfiguredConsumers());
UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
uiGrid.getUIPageIterator().setPageList(pageList);
@@ -164,7 +164,7 @@
popup.setRendered(false);
popup.setShow(false);
- LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getTempArrayList());
+ LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getConfiguredConsumers());
UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
uiGrid.getUIPageIterator().setPageList(pageList);
@@ -184,10 +184,7 @@
try
{
- WSRPConsumer consumer = consumerRegistry.createConsumer(getConsumerName(),
getCacheExpiration());
- ProducerInfo producerInfo = consumer.getProducerInfo();
- producerInfo.getEndpointConfigurationInfo().setWsdlDefinitionURL(getWSDLURL());
- consumerRegistry.updateProducerInfo(producerInfo);
+ consumerRegistry.createConsumer(getConsumerName(), getCacheExpiration(),
getWSDLURL());
uiApp.addMessage(new ApplicationMessage("Consumer Successfully Added",
null));
}
catch (ConsumerException ce)
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
18:03:49 UTC (rev 1107)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpConsumerOverview.java 2009-12-21
18:17:29 UTC (rev 1108)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2009, 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;
import org.exoplatform.commons.utils.LazyPageList;
@@ -39,6 +39,7 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.gatein.wsrp.WSRPConsumer;
+import org.gatein.wsrp.consumer.RefreshResult;
import org.gatein.wsrp.consumer.registry.ConsumerRegistry;
import java.util.List;
@@ -55,10 +56,9 @@
@EventConfig(listeners = UIWsrpConsumerOverview.OpenPopupActionListener.class),
@EventConfig(listeners = UIWsrpConsumerOverview.EditActionListener.class),
@EventConfig(listeners = UIWsrpConsumerOverview.DeleteActionListener.class),
- @EventConfig(listeners = UIWsrpConsumerOverview.StartActionListener.class),
- @EventConfig(listeners = UIWsrpConsumerOverview.StopActionListener.class),
@EventConfig(listeners = UIWsrpConsumerOverview.RefreshActionListener.class),
@EventConfig(listeners =
UIWsrpConsumerOverview.DeactivateActionListener.class),
+ @EventConfig(listeners = UIWsrpConsumerOverview.ActivateActionListener.class),
@EventConfig(listeners =
UIWsrpConsumerOverview.RefreshGridActionListener.class)
})
})
@@ -71,11 +71,9 @@
//edit
//delete
//
- public static String[] SELECT_ACTIONS = {"Edit", "Delete",
"Refresh", "Deactivate", "Start", "Stop"};
+ public static String[] SELECT_ACTIONS = {"Edit", "Delete",
"Refresh", "Activate", "Deactivate"};
- private List tempArrayList;
-
- public List getTempArrayList() throws Exception
+ public List getConfiguredConsumers() throws Exception
{
ConsumerRegistry consumerRegistry = getConsumerRegistry();
return consumerRegistry.getConfiguredConsumers();
@@ -137,9 +135,8 @@
uiGrid.getUIPageIterator().setId("ChangeConsumerPageIterator");
addChild(uiGrid.getUIPageIterator());
uiGrid.getUIPageIterator().setRendered(false);
- tempArrayList = getTempArrayList();
- LazyPageList pageList = createPageList(getTempArrayList());
+ LazyPageList pageList = createPageList(getConfiguredConsumers());
uiGrid.getUIPageIterator().setPageList(pageList);
}
@@ -159,7 +156,7 @@
UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
//refresh the list
- LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getTempArrayList());
+ LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getConfiguredConsumers());
uiGrid.getUIPageIterator().setPageList(pageList);
ctx.addUIComponentToUpdateByAjax(consumerOverview);
@@ -238,7 +235,7 @@
}
}
- static public class StartActionListener extends
EventListener<UIWsrpConsumerOverview>
+ static public class DeactivateActionListener extends
EventListener<UIWsrpConsumerOverview>
{
public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
{
@@ -246,17 +243,17 @@
WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
UIApplication uiApp = event.getRequestContext().getUIApplication();
- if (consumer != null)
+ if (consumer != null && consumer.isActive())
{
- consumer.start();
- uiApp.addMessage(new ApplicationMessage("Consumer Started
Successfully", null));
+ ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
+ registry.deactivateConsumerWith(consumer.getProducerId());
+ uiApp.addMessage(new ApplicationMessage("Consumer successfully
deactivated", null));
consumerOverview.refreshGrid(event);
}
-
}
}
- static public class StopActionListener extends
EventListener<UIWsrpConsumerOverview>
+ static public class ActivateActionListener extends
EventListener<UIWsrpConsumerOverview>
{
public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
{
@@ -264,32 +261,16 @@
WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
UIApplication uiApp = event.getRequestContext().getUIApplication();
- if (consumer != null)
+ if (consumer != null && !consumer.isActive())
{
- consumer.stop();
- uiApp.addMessage(new ApplicationMessage("Consumer Stopped
Successfully", null));
+ ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
+ registry.activateConsumerWith(consumer.getProducerId());
+ uiApp.addMessage(new ApplicationMessage("Consumer successfully
activated", null));
consumerOverview.refreshGrid(event);
}
}
}
- static public class DeactivateActionListener extends
EventListener<UIWsrpConsumerOverview>
- {
- public void execute(Event<UIWsrpConsumerOverview> event) throws Exception
- {
- UIWsrpConsumerOverview consumerOverview = event.getSource();
- WSRPConsumer consumer = consumerOverview.getConsumerFromEvent(event);
- UIApplication uiApp = event.getRequestContext().getUIApplication();
-
- if (consumer != null)
- {
- consumer.deactivate();
- uiApp.addMessage(new ApplicationMessage("Consumer Deactivated
Successfully", null));
- consumerOverview.refreshGrid(event);
- }
- }
- }
-
static public class RefreshActionListener extends
EventListener<UIWsrpConsumerOverview>
{
public void execute(Event<UIWsrpConsumerOverview> event)
@@ -302,14 +283,40 @@
if (consumer != null)
{
- consumer.refresh(true);
+ ConsumerRegistry registry = consumerOverview.getConsumerRegistry();
+ RefreshResult result = consumer.refresh(true);
+
+ if (result.hasIssues())
+ {
+ // create the expected registration info and make it available
+ /*RegistrationInfo expected = new
RegistrationInfo(consumer.getProducerInfo().getRegistrationInfo());
+ expected.refresh(result.getServiceDescription(),
consumer.getProducerId(), true, true, true);
+ setExpectedRegistrationInfo(expected);*/
+
+ // refresh had issues, we should deactivate this consumer
+ registry.deactivateConsumerWith(consumer.getProducerId());
+ }
+ else
+ {
+ // activate the consumer if it's supposed to be active
+ if (consumer.isActive())
+ {
+ registry.activateConsumerWith(consumer.getProducerId());
+ }
+ else
+ {
+ registry.deactivateConsumerWith(consumer.getProducerId());
+ }
+
+ }
uiApp.addMessage(new ApplicationMessage("Consumer Refreshed
Successfully", null));
consumerOverview.refreshGrid(event);
}
}
catch (Exception e)
{
- uiApp.addMessage(new ApplicationMessage("Failed to refresh Consumer.
Cause: " + e.getCause(), null, ApplicationMessage.ERROR));
+ uiApp.addMessage(new ApplicationMessage("Failed to refresh
Consumer", null, ApplicationMessage.ERROR));
+ e.printStackTrace();
}
}
}
@@ -324,12 +331,8 @@
public ConsumerRegistry getConsumerRegistry() throws Exception
{
+ // todo: this lookup shouldn't be done on each invocation, store it if
possible
ExoContainer manager = ExoContainerContext.getCurrentContainer();
return
(ConsumerRegistry)manager.getComponentInstanceOfType(ConsumerRegistry.class);
}
-
-// public void processRender(WebuiRequestContext context) throws Exception
-// {
-// super.processRender(context);
-// }
}
Modified:
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
===================================================================
---
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css 2009-12-21
18:03:49 UTC (rev 1107)
+++
portal/branches/wsrp-integration/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css 2009-12-21
18:17:29 UTC (rev 1108)
@@ -36,7 +36,7 @@
background:
url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DustBinClickButton.gif')
no-repeat;
}
-img.StartIcon {
+img.ActivateIcon {
width: 16px; height: 16px;
background:
url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/SelectIcon.gif')
no-repeat;
}
\ No newline at end of file