JBoss Portal SVN: r13313 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp: services and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-05-06 13:28:29 -0400 (Wed, 06 May 2009)
New Revision: 13313
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
Log:
- Added timeout on WS operations so that we don't deadlock anymore when trying to access a service that's not answering.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java 2009-05-06 17:25:19 UTC (rev 13312)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/endpoints/WSRPBaseEndpoint.java 2009-05-06 17:28:29 UTC (rev 13313)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * 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. *
@@ -52,7 +52,7 @@
public WSRPBaseEndpoint()
{
- producer = (WSRPProducer)JMX.getMBeanProxy(WSRPProducer.class, WSRPConstants.WSRP_PRODUCER_OBJECT_NAME);
+ producer = JMX.getMBeanProxy(WSRPProducer.class, WSRPConstants.WSRP_PRODUCER_OBJECT_NAME);
}
protected void forceSessionAccess()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java 2009-05-06 17:25:19 UTC (rev 13312)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/services/ServiceWrapper.java 2009-05-06 17:28:29 UTC (rev 13313)
@@ -28,6 +28,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+import javax.xml.rpc.Stub;
import javax.xml.rpc.soap.SOAPFaultException;
import java.lang.reflect.ParameterizedType;
import java.rmi.Remote;
@@ -44,6 +45,7 @@
{
protected T service;
protected ManageableServiceFactory parentFactory;
+ private static final String TIMEOUT_MS = "3000"; //todo: expose timeout so that it can be changed from the GUI
protected ServiceWrapper(Object service, ManageableServiceFactory parentFactory)
{
@@ -53,6 +55,9 @@
}
Class serviceClass = service.getClass();
+
+ // org.jboss.ws.timeout corresponds to StubExt.PROPERTY_CLIENT_TIMEOUT, not using it here to not be tied to implementation
+ ((Stub)service)._setProperty("org.jboss.ws.timeout", TIMEOUT_MS);
Class tClass = (Class)((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];
if (tClass.isAssignableFrom(serviceClass))
{
15 years
JBoss Portal SVN: r13312 - in modules/jopr-plugin/trunk: plugin/src/main/resources/META-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-05-06 13:25:19 -0400 (Wed, 06 May 2009)
New Revision: 13312
Removed:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java
Modified:
modules/jopr-plugin/trunk/build/pom.xml
modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
Log:
- Use 1.1.2.GA version of RHQ for now...
- Improved naming of plugin and server.
- Improved error handling if a portlet couldn't be registered.
- Removed WSRPPortletManagement as it wasn't useful (and was causing issues, actually).
Modified: modules/jopr-plugin/trunk/build/pom.xml
===================================================================
--- modules/jopr-plugin/trunk/build/pom.xml 2009-05-06 16:34:43 UTC (rev 13311)
+++ modules/jopr-plugin/trunk/build/pom.xml 2009-05-06 17:25:19 UTC (rev 13312)
@@ -1,4 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
<!--
This pom functions as a default configuration. The subproject
poms each inherit configuration from this one.
@@ -26,7 +49,7 @@
<!--All artifacts versions should be defined here-->
<properties>
<version.commons.logging>1.1</version.commons.logging>
- <version.rhq>1.2.0.Beta1</version.rhq>
+ <version.rhq>1.1.2.GA</version.rhq>
<version.portal>2.7.1.GA</version.portal>
<version.portlet>trunk-SNAPSHOT</version.portlet>
<version.jboss>4.2.3.GA</version.jboss>
Modified: modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-05-06 16:34:43 UTC (rev 13311)
+++ modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-05-06 17:25:19 UTC (rev 13312)
@@ -22,15 +22,15 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<plugin name="portal-jopr-plugin"
- displayName="JBossPortalPlugin"
+<plugin name="JBossPortal"
+ displayName="JBoss Portal Plugin"
package="org.jboss.portal.jopr"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
xmlns:c="urn:xmlns:rhq-configuration">
- <server name="portal-jopr-plugin"
+ <server name="JBoss Portal"
discovery="PortalDiscovery"
class="PortalComponent"
singleton="true">
Modified: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-05-06 16:34:43 UTC (rev 13311)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-05-06 17:25:19 UTC (rev 13312)
@@ -130,7 +130,8 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.info("Couldn't register " + (wsrp ? "WSRP " : "") + portletId + " portlet. Cause: " + e.getLocalizedMessage());
+ log.debug(e);
}
}
}
@@ -139,14 +140,7 @@
private ObjectName registerPortlet(Portlet portlet, boolean wsrp) throws Exception
{
LocalPortletManagementMBean management;
- if (wsrp)
- {
- management = new WSRPPortletManagement(portlet, interceptor);
- }
- else
- {
- management = new LocalPortletManagement(portlet, interceptor);
- }
+ management = new LocalPortletManagement(portlet, interceptor);
String id = portlet.getContext().getId();
ObjectName objectName = new ObjectName(getMBeanName(id, wsrp));
getServer().registerMBean(management, objectName);
Deleted: modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java
===================================================================
--- modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java 2009-05-06 16:34:43 UTC (rev 13311)
+++ modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java 2009-05-06 17:25:19 UTC (rev 13312)
@@ -1,88 +0,0 @@
-/******************************************************************************
- * 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. *
- ******************************************************************************/
-package org.jboss.portal.management;
-
-import org.jboss.portal.portlet.Portlet;
-import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision: 8784 $
- */
-public class WSRPPortletManagement implements org.jboss.portal.portlet.management.LocalPortletManagementMBean
-{
- private Portlet portlet;
-
- private PortletContainerManagementInterceptor interceptor;
-
- public WSRPPortletManagement(Portlet portlet, PortletContainerManagementInterceptor interceptor)
- {
- this.portlet = portlet;
- this.interceptor = interceptor;
- }
-
- public String getId()
- {
- return portlet.getContext().getId();
- }
-
- public float getAverageRenderTime()
- {
- return interceptor.getPortletInfo(getId()).getAverageRenderTime();
- }
-
- public float getAverageActionTime()
- {
- return interceptor.getPortletInfo(getId()).getAverageActionTime();
- }
-
- public long getMaxRenderTime()
- {
- return interceptor.getPortletInfo(getId()).getMaxRenderTime();
- }
-
- public long getMaxActionTime()
- {
- return interceptor.getPortletInfo(getId()).getMaxActionTime();
- }
-
- public long getRenderRequestCount()
- {
- return interceptor.getPortletInfo(getId()).getRenderRequestCount();
- }
-
- public long getActionRequestCount()
- {
- return interceptor.getPortletInfo(getId()).getActionRequestCount();
- }
-
- public long getActionErrorCount()
- {
- return interceptor.getPortletInfo(getId()).getActionErrorCount();
- }
-
- public long getRenderErrorCount()
- {
- return interceptor.getPortletInfo(getId()).getRenderErrorCount();
- }
-}
15 years
JBoss Portal SVN: r13311 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-05-06 12:34:43 -0400 (Wed, 06 May 2009)
New Revision: 13311
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
Log:
[selenium] - dashboard testcase imports fix
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-05-06 14:46:25 UTC (rev 13310)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-05-06 16:34:43 UTC (rev 13311)
@@ -5,8 +5,6 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import sun.security.action.GetBooleanAction;
-
/**
* DashboardTestCase is responsible for testing configure dashboard functions.
* Each test is running with user "admin" logged in.
15 years
JBoss Portal SVN: r13307 - branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-05-06 10:06:14 -0400 (Wed, 06 May 2009)
New Revision: 13307
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
Log:
[JBPORTAL-2380] - drag and drop test added, class slightly refactored
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-05-06 13:44:35 UTC (rev 13306)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/DashboardTestCase.java 2009-05-06 14:06:14 UTC (rev 13307)
@@ -5,6 +5,8 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import sun.security.action.GetBooleanAction;
+
/**
* DashboardTestCase is responsible for testing configure dashboard functions.
* Each test is running with user "admin" logged in.
@@ -14,11 +16,19 @@
@Test(groups = { "cms_dashboard" }, enabled = true, description = "Dashboard issues test case.")
public class DashboardTestCase extends JBossPortalSeleniumTestCase {
- private static final String MSG_POWER = "Powered by JBoss";
-
/** prefix for locator properties = dash. */
public String casePfx = "dash.";
+ private final String HAND_R1 = getLoc(casePfx + "hand.r1", "//html/body/div[2]/div/div/div[2]/div[2]/div/div/div[2]/div/div");
+ private final String HAND_L1 = getLoc(casePfx + "hand.l1", "//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div");
+ private final String SPAN_R1 = getLoc(casePfx + "span.r1", "//html/body/div[2]/div/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String DIV_REG_A = getLoc(casePfx + "div.reg.a", "//div[@id='regionA']");
+ private final String DIV_REG_B = getLoc(casePfx + "div.reg.b", "//div[@id='regionB']");
+ private final String SPAN_L2 = getLoc(casePfx + "span.l2", "//html/body/div[2]/div/div/div[2]/div/div/div/div[2]/div/div/table/tbody/tr/td[2]/div/div/span");
+ private final String SPAN_L1 = getLoc(casePfx + "span.l1", "//html/body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/span");
+
+ private final String MSG_POWER = getMess(casePfx + "msg.power", "Powered by JBoss");
+
private final String LNK_POR_WEA_EDIT = getLoc(casePfx + "lnk.por.wea.edit",
"//body/div[2]/div/div/div[2]/div/div/div/div/div/div/table/tbody/tr/td[2]/div/div/div[2]/span/a");
private final String SUB_LAYOUT_UPDATE = getLoc(casePfx + "sub.layout.update", "//input[contains(@name,'dashboardLayoutForm:j_id12')]");
@@ -65,6 +75,32 @@
}
/**
+ * Simple drag and drop test processed on "user" dashboard. The greetings
+ * portlet is moved from left to right column and the cms portlet is moved
+ * from the right to left corner. The names of Greetings and User profile
+ * portlets are then used for final assertion. The Greetings portlet message
+ * must be at the top right corner and the "user profile" message should be
+ * in the top left corner.
+ */
+ @Test(enabled = true)
+ public void testDragAndDrop() {
+ logout();
+ login("user", "user");
+ selenium.click(LNK_DASHBOARD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertEquals(selenium.getText(SPAN_L1), "Greetings !");
+ Assert.assertEquals(selenium.getText(SPAN_L2), "User profile");
+
+ selenium.dragAndDropToObject(HAND_L1, DIV_REG_B);
+ selenium.dragAndDropToObject(HAND_R1, DIV_REG_A);
+
+ Assert.assertEquals(selenium.getText(SPAN_L1), "User profile");
+ Assert.assertEquals(selenium.getText(SPAN_R1), "Greetings !");
+
+ }
+
+ /**
* Creates a page. In Dashboard configuration a new page named
* "DashTestPage" is created. The existence of the link (page) is then
* asserted on dashboard.s
@@ -72,8 +108,8 @@
@Test(enabled = true)
public void testCreatePage() {
selenium.click(LNK_DASHBOARD);
- selenium.setSpeed("5000");
- // selenium.waitForPageToLoad(PAGE_LOAD);
+ // selenium.setSpeed("5000");
+ selenium.waitForPageToLoad(PAGE_LOAD);
waitFor(AJAX_LOAD);
selenium.click(LNK_CONFIGURE_DASHBOARD);
@@ -230,6 +266,8 @@
selenium.click("link=DashTestPage");
selenium.waitForPageToLoad(PAGE_LOAD);
+ waitFor(AJAX_LOAD);
+
Assert.assertTrue(selenium.isTextPresent("Current users"));
Assert.assertTrue(selenium.isTextPresent("Among them: * logged-in"));
Assert.assertTrue(selenium.isTextPresent("[admin]"));
@@ -381,9 +419,14 @@
// http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023
// https://jira.jboss.org/jira/browse/JBPORTAL-2177
/**
- * Dashboard rename page loses portlet state settings bug testing.
- * From forum reference <a href="http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023">http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023</a>.
- * Jira for this issue already created in <a href="https://jira.jboss.org/jira/browse/JBPORTAL-2177">https://jira.jboss.org/jira/browse/JBPORTAL-2177</a>.
+ * Dashboard rename page loses portlet state settings bug testing. From
+ * forum reference <a
+ * href="http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023"
+ * >http://www.jboss.com/index.html?module=bb&op=viewtopic&t=143023</a>.
+ * Jira for this issue already created in <a
+ * href="https://jira.jboss.org/jira/browse/JBPORTAL-2177"
+ * >https://jira.jboss.org/jira/browse/JBPORTAL-2177</a>.
+ *
* <pre>
* - in Configure Dashboard, create a new dashboard page; I called mine test1
* - in the left region, add the Weather portlet
15 years
JBoss Portal SVN: r13310 - branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/as.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-05-06 10:46:25 -0400 (Wed, 06 May 2009)
New Revision: 13310
Modified:
branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/as/JMX.java
Log:
- Improved getMBeanProxy methods so that they return a cast object.
- Added isRegistered method to check if an MBean is known by the server without having to retrieve a proxy to it.
Modified: branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/as/JMX.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/as/JMX.java 2009-05-06 14:37:18 UTC (rev 13309)
+++ branches/JBoss_Portal_Branch_2_7/jems/src/main/org/jboss/portal/jems/as/JMX.java 2009-05-06 14:46:25 UTC (rev 13310)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * 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. *
@@ -24,7 +24,6 @@
import org.apache.log4j.Logger;
import org.jboss.mx.util.MBeanProxy;
-import org.jboss.mx.util.MBeanProxyCreationException;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.mx.util.ObjectNameConverter;
@@ -108,21 +107,21 @@
/**
* Retrieves the MBeanProxy associated with the given class and name from the specified MBeanServer.
*
- * @param clazz the interface implemented by the MBean which is to be retrieved
- * @param name the MBean's ObjectName
- * @param server the MBeanServer from which to retrieve the MBeanProxy
+ * @param expectedClass the expected class of the MBean's proxy
+ * @param name the MBean's ObjectName
+ * @param server the MBeanServer from which to retrieve the MBeanProxy
* @return a MBeanProxy for the specified MBean if it exists
* @throws RuntimeException if the MBean couldn't be retrieved
*/
- public static Object getMBeanProxy(Class clazz, ObjectName name, MBeanServer server)
+ public static <T> T getMBeanProxy(Class<T> expectedClass, ObjectName name, MBeanServer server)
{
try
{
- return MBeanProxy.get(clazz, name, server);
+ return expectedClass.cast(MBeanProxy.get(expectedClass, name, server));
}
- catch (MBeanProxyCreationException e)
+ catch (Exception e)
{
- String message = "Couldn't retrieve '" + name.getCanonicalName() + "' MBean with class " + clazz.getName();
+ String message = "Couldn't retrieve '" + name.getCanonicalName() + "' MBean with class " + expectedClass.getName();
log.error(message, e);
throw new RuntimeException(message, e);
}
@@ -132,16 +131,23 @@
* Retrieves the MBeanProxy associated with the given class and name from the JBoss microkernel as returned by
* <code>MBeanServerLocator.locateJBoss()</code>.
*
- * @param clazz the interface implemented by the MBean which is to be retrieved
- * @param name a String representation of the MBean's ObjectName
+ * @param expectedClass the expected class of the MBean's proxy
+ * @param name a String representation of the MBean's ObjectName
* @return a MBeanProxy for the specified MBean if it exists
* @throws IllegalArgumentException if the given name is not a valid ObjectName
* @throws RuntimeException if the MBean couldn't be retrieved
* @see #getMBeanProxy(Class, javax.management.ObjectName, javax.management.MBeanServer)
* @since 2.4
*/
- public static Object getMBeanProxy(Class clazz, String name)
+ public static <T> T getMBeanProxy(Class<T> expectedClass, String name)
{
+ ObjectName objecName = createObjectName(name);
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ return getMBeanProxy(expectedClass, objecName, server);
+ }
+
+ private static ObjectName createObjectName(String name)
+ {
ObjectName objecName;
try
{
@@ -151,8 +157,20 @@
{
throw new IllegalArgumentException("'" + name + "' is not a valid ObjectName");
}
+ return objecName;
+ }
+
+ /**
+ * Checks whether the JBoss MBeanServer knows about an MBean with the specified name without having to retrieve a
+ * proxy to it.
+ *
+ * @param name a String representation of the MBean object name which registration status we're interested in
+ * @return <code>true</code> if the server knows of an MBean with the specified name, <code>false</code> otherwise.
+ */
+ public static boolean isRegistered(String name)
+ {
MBeanServer server = MBeanServerLocator.locateJBoss();
- return getMBeanProxy(clazz, objecName, server);
+ return server.isRegistered(createObjectName(name));
}
public static boolean addNotificationListener(
15 years
JBoss Portal SVN: r13309 - in branches/JBoss_Portal_Branch_2_7: core-admin/src/main/org/jboss/portal/core/admin/ui and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-05-06 10:37:18 -0400 (Wed, 06 May 2009)
New Revision: 13309
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectUtil.java
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
Log:
- Extracted checking for default status to PortalObjectUtil so that it can be reused elsewhere.
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectUtil.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectUtil.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectUtil.java 2009-05-06 14:37:18 UTC (rev 13309)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.jboss.portal.core.model.portal;
+
+import org.jboss.portal.common.util.ParameterValidation;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class PortalObjectUtil
+{
+ /**
+ * Checks whether the given PortalObject is the default child for its parent.
+ *
+ * @param object the object which default status we want to check
+ * @return <code>true</code> if the specified object is the default child for its parent, <code>false</code>
+ * otherwise
+ */
+ public static boolean isDefault(PortalObject object)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(object, "PortalObject");
+
+ // get the parent, if parent doesn't exist, consider the object as its own parent
+ PortalObject parent = object.getParent();
+ if (parent == null)
+ {
+ parent = object;
+ }
+
+ return object.getName().equals(parent.getDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME));
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2009-05-06 14:18:00 UTC (rev 13308)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2009-05-06 14:37:18 UTC (rev 13309)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * 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. *
@@ -33,6 +33,7 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.model.portal.PortalObjectUtil;
import org.jboss.portal.core.portlet.info.PortletIconInfo;
import org.jboss.portal.core.portlet.info.PortletInfoInfo;
import org.jboss.portal.core.portlet.info.WSRPInfo;
@@ -67,7 +68,6 @@
import javax.faces.el.PropertyResolver;
import javax.faces.model.SelectItem;
import javax.xml.namespace.QName;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -196,7 +196,7 @@
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
- Set<WindowStateInfo> set = portlet.getInfo().getCapabilities().getWindowStates(MediaType.TEXT_HTML);
+ Set<WindowStateInfo> set = portlet.getInfo().getCapabilities().getWindowStates(MediaType.TEXT_HTML);
return Tools.toList(set.iterator());
}
});
@@ -205,7 +205,7 @@
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
- Set<MediaType> set = portlet.getInfo().getCapabilities().getMediaTypes();
+ Set<MediaType> set = portlet.getInfo().getCapabilities().getMediaTypes();
return Tools.toList(set.iterator());
}
});
@@ -262,7 +262,7 @@
public Object getValue(Object bean) throws IllegalArgumentException
{
Portlet portlet = (Portlet)bean;
-
+
NavigationInfo navigationInfo = portlet.getInfo().getNavigation();
if (navigationInfo == null)
{
@@ -412,16 +412,7 @@
{
public Object getValue(Object bean)
{
- PortalObject object = (PortalObject)bean;
-
- // get the parent, if parent doesn't exist, consider the object as its own parent
- PortalObject portalObject = object.getParent();
- if (portalObject == null)
- {
- portalObject = object;
- }
-
- return Boolean.valueOf(object.getName().equals(portalObject.getDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME)));
+ return PortalObjectUtil.isDefault((PortalObject)bean);
}
});
portalObjectDecorator.setProperty("typeName", new AbstractPropertyDecorator(String.class)
15 years
JBoss Portal SVN: r13305 - in branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73: core/src/main/org/jboss/portal/core/aspects/portlet and 1 other directory.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-05-06 09:28:43 -0400 (Wed, 06 May 2009)
New Revision: 13305
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/build/build-thirdparty.xml
branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/core/src/main/org/jboss/portal/core/aspects/portlet/HttpHeaderInterceptor.java
Log:
[JBEPP-73] - Fix for duplicate HTTP headers
Modified: branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/build/build-thirdparty.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/build/build-thirdparty.xml 2009-05-06 13:21:57 UTC (rev 13304)
+++ branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/build/build-thirdparty.xml 2009-05-06 13:28:43 UTC (rev 13305)
@@ -44,7 +44,7 @@
<componentref name="jboss-portal/modules/common" version="1.2.3"/>
<componentref name="jboss-portal/modules/web" version="1.2.3"/>
<componentref name="jboss-portal/modules/test" version="1.0.4"/>
- <componentref name="jboss-portal/modules/portlet" version="2.0.5_JBEPP-60"/>
+ <componentref name="jboss-portal/modules/portlet" version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/identity" version="1.0.7"/>
<componentref name="jboss-portal/modules/cms" version="1.2.4"/>
<componentref name="antlr" version="2.7.6-brew"/>
Modified: branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/core/src/main/org/jboss/portal/core/aspects/portlet/HttpHeaderInterceptor.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/core/src/main/org/jboss/portal/core/aspects/portlet/HttpHeaderInterceptor.java 2009-05-06 13:21:57 UTC (rev 13304)
+++ branches/Enterprise_Portal_Platform_4_3_GA_JBEPP-73/core/src/main/org/jboss/portal/core/aspects/portlet/HttpHeaderInterceptor.java 2009-05-06 13:28:43 UTC (rev 13305)
@@ -82,7 +82,7 @@
for (String key: unsr.getProperties().getTransportHeaders().keySet())
{
String value = unsr.getProperties().getTransportHeaders().getValue(key);
- ((AbstractServerContext) invocation.getServerContext()).getResponse().addHeader(key, value);
+ ((AbstractServerContext) invocation.getServerContext()).getResponse().setHeader(key, value);
}
}
}
@@ -98,7 +98,7 @@
for (String key: fr.getProperties().getTransportHeaders().keySet())
{
String value = fr.getProperties().getTransportHeaders().getValue(key);
- ((AbstractServerContext) invocation.getServerContext()).getResponse().addHeader(key, value);
+ ((AbstractServerContext) invocation.getServerContext()).getResponse().setHeader(key, value);
}
}
}
15 years
JBoss Portal SVN: r13303 - branches.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-05-06 08:11:17 -0400 (Wed, 06 May 2009)
New Revision: 13303
Removed:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-73/
Log:
[JBEPP-73] - Undo Branch for patch, needed only without CP01
15 years