JBoss Portal SVN: r6715 - trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-16 11:08:08 -0400 (Fri, 16 Mar 2007)
New Revision: 6715
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java
Log:
Make sure we have the same id number for instance and window
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java 2007-03-16 14:51:27 UTC (rev 6714)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/wizard/NewWindowWizard.java 2007-03-16 15:08:08 UTC (rev 6715)
@@ -211,8 +211,9 @@
{
Portlet portlet = getSelectedPortlet();
InstanceContainer container = instanceContainer;
- String instanceId = "wizardInstance_" + container.getDefinitions().size();
- String windowId = "wizardWindow_" + container.getDefinitions().size();
+ int id = container.getDefinitions().size();
+ String instanceId = "wizardInstance_" + id;
+ String windowId = "wizardWindow_" + id;
try
{
if ((container.getDefinition(instanceId) == null) && (getSelectedPage().getWindow(windowId) == null))
17 years, 5 months
JBoss Portal SVN: r6714 - trunk/core-cms/src/resources/portal-cms-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-16 10:51:27 -0400 (Fri, 16 Mar 2007)
New Revision: 6714
Modified:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
Log:
Typo
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2007-03-16 14:48:40 UTC (rev 6713)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/portlet.xml 2007-03-16 14:51:27 UTC (rev 6714)
@@ -72,7 +72,7 @@
<portlet>
<description>CMS Content Editor</description>
<portlet-name>CMSContentEditorPortlet</portlet-name>
- <display-name>CMS Content Editort</display-name>
+ <display-name>CMS Content Editor</display-name>
<portlet-class>org.jboss.portal.core.cms.ui.admin.CMSContentEditorPortlet</portlet-class>
<supports>
17 years, 5 months
JBoss Portal SVN: r6713 - in trunk: common and 12 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-16 10:48:40 -0400 (Fri, 16 Mar 2007)
New Revision: 6713
Added:
trunk/common/src/main/org/jboss/portal/common/invocation/resolver/
trunk/common/src/main/org/jboss/portal/common/invocation/resolver/AbstractSessionAttributeResolver.java
trunk/common/src/main/org/jboss/portal/common/invocation/resolver/MapAttributeResolver.java
trunk/common/src/main/org/jboss/portal/common/invocation/resolver/PrincipalAttributeResolver.java
trunk/common/src/main/org/jboss/portal/common/invocation/resolver/RequestAttributeResolver.java
trunk/common/src/main/org/jboss/portal/common/invocation/resolver/SessionAttributeResolver.java
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/ValueTrimmingFilter.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/ValueTrimmingFilter.java
trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java
trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java
trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java
trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java
trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java
trunk/common/build.xml
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
Log:
more decoupling from portlet to server
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandContext.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -24,7 +24,7 @@
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
-import org.jboss.portal.server.impl.MapAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.common.invocation.Scope;
import javax.jcr.Session;
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/common/build.xml 2007-03-16 14:48:40 UTC (rev 6713)
@@ -66,6 +66,7 @@
&libraries;
<path id="library.classpath">
<path refid="sun.jaf.classpath"/>
+ <path refid="sun.servlet.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="apache.ant.classpath"/>
Copied: trunk/common/src/main/org/jboss/portal/common/invocation/resolver/AbstractSessionAttributeResolver.java (from rev 6712, trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/resolver/AbstractSessionAttributeResolver.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/resolver/AbstractSessionAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -0,0 +1,142 @@
+/******************************************************************************
+ * 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.common.invocation.resolver;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractSessionAttributeResolver implements AttributeResolver
+{
+
+ /** . */
+ protected final HttpServletRequest req;
+
+ public AbstractSessionAttributeResolver(HttpServletRequest req)
+ {
+ if (req == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.req = req;
+ }
+
+
+ public Set getKeys()
+ {
+ Map map = getMap(false);
+
+ //
+ if (map != null)
+ {
+ return map.keySet();
+ }
+ else
+ {
+ return Collections.EMPTY_SET;
+ }
+ }
+
+ public Object getAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Object value = null;
+ Map map = getMap(false);
+ if (map != null)
+ {
+ value = map.get(attrKey);
+ }
+ return value;
+ }
+
+ public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Map map = getMap(false);
+ if (map != null)
+ {
+ if (attrValue != null)
+ {
+ map.put(attrKey, attrValue);
+ }
+ else
+ {
+ map.remove(attrKey);
+ }
+ }
+ else
+ {
+ if (attrValue != null)
+ {
+ map = getMap(true);
+ map.put(attrKey, attrValue);
+ }
+ }
+ }
+
+ protected abstract String getMapKey();
+
+ protected Map createMap(String mapKey)
+ {
+ return new HashMap();
+ }
+
+ private Map getMap(boolean create)
+ {
+ HttpSession session = req.getSession(create);
+ if (session != null)
+ {
+ String mapKey = getMapKey();
+ Map map = (Map)session.getAttribute(mapKey);
+ if (map == null)
+ {
+ map = createMap(mapKey);
+ session.setAttribute(mapKey, map);
+ }
+ return map;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
Copied: trunk/common/src/main/org/jboss/portal/common/invocation/resolver/MapAttributeResolver.java (from rev 6712, trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/resolver/MapAttributeResolver.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/resolver/MapAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * 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.common.invocation.resolver;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MapAttributeResolver implements AttributeResolver
+{
+
+ /** . */
+ private final Map attributes;
+
+ public MapAttributeResolver(Map attributes)
+ {
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.attributes = attributes;
+ }
+
+ public MapAttributeResolver()
+ {
+ this(new HashMap());
+ }
+
+
+ public Set getKeys()
+ {
+ return attributes.keySet();
+ }
+
+ public Object getAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return attributes.get(attrKey);
+ }
+
+ public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (attrValue != null)
+ {
+ attributes.put(attrKey, attrValue);
+ }
+ else
+ {
+ attributes.remove(attrKey);
+ }
+ }
+}
Copied: trunk/common/src/main/org/jboss/portal/common/invocation/resolver/PrincipalAttributeResolver.java (from rev 6712, trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/resolver/PrincipalAttributeResolver.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/resolver/PrincipalAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * 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.common.invocation.resolver;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PrincipalAttributeResolver extends AbstractSessionAttributeResolver
+{
+
+ /** . */
+ private String cachedPrincipalName;
+
+ /** . */
+ private String cachedMapKey;
+
+ public PrincipalAttributeResolver(HttpServletRequest req)
+ {
+ super(req);
+ }
+
+ protected String getMapKey()
+ {
+ Principal principal = req.getUserPrincipal();
+
+ //
+ if (cachedMapKey != null)
+ {
+ if (cachedPrincipalName == null)
+ {
+ if (principal != null)
+ {
+ cachedMapKey = null;
+ }
+ }
+ else
+ {
+ if (principal == null || (cachedPrincipalName.equals(principal.getName()) == false))
+ {
+ cachedMapKey = null;
+ }
+ }
+ }
+
+ //
+ if (cachedMapKey == null)
+ {
+ if (principal == null)
+ {
+ cachedMapKey = "portal.principal";
+ cachedPrincipalName = null;
+ }
+ else
+ {
+ cachedMapKey = "portal.principal." + principal.getName();
+ cachedPrincipalName = principal.getName();
+ }
+ }
+
+ //
+ return cachedMapKey;
+ }
+}
Copied: trunk/common/src/main/org/jboss/portal/common/invocation/resolver/RequestAttributeResolver.java (from rev 6712, trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/resolver/RequestAttributeResolver.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/resolver/RequestAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * 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.common.invocation.resolver;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.util.Tools;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RequestAttributeResolver implements AttributeResolver
+{
+
+ /** . */
+ private final HttpServletRequest req;
+
+ public RequestAttributeResolver(HttpServletRequest req)
+ {
+ if (req == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.req = req;
+ }
+
+
+ public Set getKeys()
+ {
+ return Tools.toSet(req.getAttributeNames());
+ }
+
+ public Object getAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException("No null attribute key accepted");
+ }
+ if (attrKey instanceof String == false)
+ {
+ throw new IllegalArgumentException("Attribute key must be a string");
+ }
+
+ //
+ return req.getAttribute((String)attrKey);
+ }
+
+ public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException("No null attribute key accepted");
+ }
+ if (attrKey instanceof String == false)
+ {
+ throw new IllegalArgumentException("Attribute key must be a string");
+ }
+
+ //
+ if (attrValue != null)
+ {
+ req.setAttribute((String)attrKey, attrValue);
+ }
+ else
+ {
+ req.removeAttribute((String)attrKey);
+ }
+ }
+}
Copied: trunk/common/src/main/org/jboss/portal/common/invocation/resolver/SessionAttributeResolver.java (from rev 6712, trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java)
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/invocation/resolver/SessionAttributeResolver.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/common/invocation/resolver/SessionAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.common.invocation.resolver;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SessionAttributeResolver extends AbstractSessionAttributeResolver
+{
+
+ /** . */
+ private final String mapKey;
+
+ public SessionAttributeResolver(HttpServletRequest req, String mapKey)
+ {
+ super(req);
+
+ //
+ if (mapKey == null)
+ {
+ throw new IllegalArgumentException("No null map key allowed");
+ }
+
+ //
+ this.mapKey = mapKey;
+ }
+
+ protected String getMapKey()
+ {
+ return mapKey;
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -43,8 +43,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFActionContext.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -29,11 +29,10 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
-import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.server.impl.RequestAttributeResolver;
-import org.jboss.portal.server.impl.PrincipalAttributeResolver;
-import org.jboss.portal.server.impl.MapAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Modified: trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/faces/src/main/org/jboss/portal/faces/component/portlet/JSFRenderContext.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -30,10 +30,10 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.server.impl.MapAttributeResolver;
-import org.jboss.portal.server.impl.PrincipalAttributeResolver;
-import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -27,7 +27,6 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.session.SubSession;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
-import org.jboss.portal.server.ServerInvocation;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
@@ -85,7 +84,7 @@
// Set the sub session for the portlet synchronization
if (ss != null && ss.isActivated())
{
- invocation.setAttribute(ServerInvocation.REQUEST_SCOPE, "subsession", ss);
+ invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, "subsession", ss);
}
//
@@ -93,13 +92,13 @@
}
finally
{
- List modifications = (List)invocation.getAttribute(ServerInvocation.REQUEST_SCOPE, "subsession");
+ List modifications = (List)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, "subsession");
// If we have any modifications propagate them
if (modifications != null)
{
//
- invocation.removeAttribute(ServerInvocation.REQUEST_SCOPE, "subsession");
+ invocation.removeAttribute(PortletInvocation.REQUEST_SCOPE, "subsession");
//
if (ss == null)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortletSessionSynchronizationInterceptor.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -29,7 +29,6 @@
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.session.SessionListener;
import org.jboss.portal.portlet.session.SubSession;
-import org.jboss.portal.server.ServerInvocation;
import java.util.List;
@@ -46,7 +45,7 @@
if (sessionInfo != null && Boolean.TRUE.equals(sessionInfo.getDistributed()))
{
- SubSession ss = (SubSession)invocation.getAttribute(ServerInvocation.REQUEST_SCOPE, "subsession");
+ SubSession ss = (SubSession)invocation.getAttribute(PortletInvocation.REQUEST_SCOPE, "subsession");
// If we detect an activation then we copy the content in the dispatched session
if (ss != null)
@@ -70,7 +69,7 @@
List modifications = SessionListener.desactivate();
// Set modifications for portal session synchronization
- invocation.setAttribute(ServerInvocation.REQUEST_SCOPE, "subsession", modifications);
+ invocation.setAttribute(PortletInvocation.REQUEST_SCOPE, "subsession", modifications);
}
}
else
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/ValueTrimmingFilter.java (from rev 6712, trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/ValueTrimmingFilter.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/ValueTrimmingFilter.java (rev 0)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/ValueTrimmingFilter.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -0,0 +1,75 @@
+/******************************************************************************
+ * 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.portlet.deployment;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * Filter <code>setValue</code> method by doing a trimming before calling the next model.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ValueTrimmingFilter implements GenericObjectModelFactory
+{
+
+ private final GenericObjectModelFactory next;
+
+ public ValueTrimmingFilter(GenericObjectModelFactory next) throws IllegalArgumentException
+ {
+ if (next == null)
+ {
+ throw new IllegalArgumentException("Cannot be null");
+ }
+ this.next = next;
+ }
+
+ public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ return next.newChild(object, nav, nsURI, localName, attrs);
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
+ {
+ next.addChild(parent, child, nav, nsURI, localName);
+ }
+
+ public void setValue(Object object, UnmarshallingContext nav, String nsURI, String localName, String value)
+ {
+ value = value.trim();
+ next.setValue(object, nav, nsURI, localName, value);
+ }
+
+ public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
+ {
+ return next.newRoot(root, nav, nsURI, localName, attrs);
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext nav, String nsURI, String localName)
+ {
+ return next.completeRoot(root, nav, nsURI, localName);
+ }
+
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/ValueTrimmingFilter.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -37,6 +37,7 @@
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
import org.jboss.portal.portlet.deployment.PortletApplicationMetaDataFactory;
+import org.jboss.portal.portlet.deployment.ValueTrimmingFilter;
import org.jboss.portal.portlet.impl.jsr168.APIFactory;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletApplicationMetaData;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -26,6 +26,7 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.container.PortletApplicationRegistry;
import org.jboss.portal.portlet.deployment.JBossApplicationMetaDataFactory;
+import org.jboss.portal.portlet.deployment.ValueTrimmingFilter;
import org.jboss.portal.portlet.impl.jsr168.APIFactory;
import org.jboss.portal.portlet.impl.jsr168.APIFactoryImpl;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/ValueTrimmingFilter.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/ValueTrimmingFilter.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/ValueTrimmingFilter.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -1,75 +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.portlet.deployment.jboss;
-
-import org.jboss.xb.binding.GenericObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * Filter <code>setValue</code> method by doing a trimming before calling the next model.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ValueTrimmingFilter implements GenericObjectModelFactory
-{
-
- private final GenericObjectModelFactory next;
-
- public ValueTrimmingFilter(GenericObjectModelFactory next) throws IllegalArgumentException
- {
- if (next == null)
- {
- throw new IllegalArgumentException("Cannot be null");
- }
- this.next = next;
- }
-
- public Object newChild(Object object, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
- {
- return next.newChild(object, nav, nsURI, localName, attrs);
- }
-
- public void addChild(Object parent, Object child, UnmarshallingContext nav, String nsURI, String localName)
- {
- next.addChild(parent, child, nav, nsURI, localName);
- }
-
- public void setValue(Object object, UnmarshallingContext nav, String nsURI, String localName, String value)
- {
- value = value.trim();
- next.setValue(object, nav, nsURI, localName, value);
- }
-
- public Object newRoot(Object root, UnmarshallingContext nav, String nsURI, String localName, Attributes attrs)
- {
- return next.newRoot(root, nav, nsURI, localName, attrs);
- }
-
- public Object completeRoot(Object root, UnmarshallingContext nav, String nsURI, String localName)
- {
- return next.completeRoot(root, nav, nsURI, localName);
- }
-
-}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.server.PortalConstants;
-
import javax.portlet.PortletContext;
import javax.portlet.PortletRequestDispatcher;
import javax.servlet.RequestDispatcher;
@@ -50,7 +48,7 @@
public String getServerInfo()
{
- return "JBossPortal/" + PortalConstants.VERSION.getMajor() + "." + PortalConstants.VERSION.getMinor();
+ return "JBossPortal/" + 1 + "." + 0;
}
public PortletRequestDispatcher getRequestDispatcher(String path)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/ActionContextImpl.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -23,9 +23,9 @@
package org.jboss.portal.portlet.test;
import org.jboss.portal.Mode;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.support.spi.ActionContextSupport;
-import org.jboss.portal.server.impl.MapAttributeResolver;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -26,6 +26,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.common.util.MarkupInfo;
@@ -67,7 +68,6 @@
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.server.ServerInvocation;
-import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.logging.Logger;
Deleted: trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/server/src/main/org/jboss/portal/server/impl/AbstractSessionAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -1,142 +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.server.impl;
-
-import org.jboss.portal.common.invocation.AttributeResolver;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractSessionAttributeResolver implements AttributeResolver
-{
-
- /** . */
- protected final HttpServletRequest req;
-
- public AbstractSessionAttributeResolver(HttpServletRequest req)
- {
- if (req == null)
- {
- throw new IllegalArgumentException();
- }
- this.req = req;
- }
-
-
- public Set getKeys()
- {
- Map map = getMap(false);
-
- //
- if (map != null)
- {
- return map.keySet();
- }
- else
- {
- return Collections.EMPTY_SET;
- }
- }
-
- public Object getAttribute(Object attrKey) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- Object value = null;
- Map map = getMap(false);
- if (map != null)
- {
- value = map.get(attrKey);
- }
- return value;
- }
-
- public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- Map map = getMap(false);
- if (map != null)
- {
- if (attrValue != null)
- {
- map.put(attrKey, attrValue);
- }
- else
- {
- map.remove(attrKey);
- }
- }
- else
- {
- if (attrValue != null)
- {
- map = getMap(true);
- map.put(attrKey, attrValue);
- }
- }
- }
-
- protected abstract String getMapKey();
-
- protected Map createMap(String mapKey)
- {
- return new HashMap();
- }
-
- private Map getMap(boolean create)
- {
- HttpSession session = req.getSession(create);
- if (session != null)
- {
- String mapKey = getMapKey();
- Map map = (Map)session.getAttribute(mapKey);
- if (map == null)
- {
- map = createMap(mapKey);
- session.setAttribute(mapKey, map);
- }
- return map;
- }
- else
- {
- return null;
- }
- }
-}
Deleted: trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/server/src/main/org/jboss/portal/server/impl/MapAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -1,85 +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.server.impl;
-
-import org.jboss.portal.common.invocation.AttributeResolver;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class MapAttributeResolver implements AttributeResolver
-{
-
- /** . */
- private final Map attributes;
-
- public MapAttributeResolver(Map attributes)
- {
- if (attributes == null)
- {
- throw new IllegalArgumentException();
- }
- this.attributes = attributes;
- }
-
- public MapAttributeResolver()
- {
- this(new HashMap());
- }
-
-
- public Set getKeys()
- {
- return attributes.keySet();
- }
-
- public Object getAttribute(Object attrKey) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException();
- }
- return attributes.get(attrKey);
- }
-
- public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException();
- }
- if (attrValue != null)
- {
- attributes.put(attrKey, attrValue);
- }
- else
- {
- attributes.remove(attrKey);
- }
- }
-}
Deleted: trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/server/src/main/org/jboss/portal/server/impl/PrincipalAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -1,87 +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.server.impl;
-
-import javax.servlet.http.HttpServletRequest;
-import java.security.Principal;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class PrincipalAttributeResolver extends AbstractSessionAttributeResolver
-{
-
- /** . */
- private String cachedPrincipalName;
-
- /** . */
- private String cachedMapKey;
-
- public PrincipalAttributeResolver(HttpServletRequest req)
- {
- super(req);
- }
-
- protected String getMapKey()
- {
- Principal principal = req.getUserPrincipal();
-
- //
- if (cachedMapKey != null)
- {
- if (cachedPrincipalName == null)
- {
- if (principal != null)
- {
- cachedMapKey = null;
- }
- }
- else
- {
- if (principal == null || (cachedPrincipalName.equals(principal.getName()) == false))
- {
- cachedMapKey = null;
- }
- }
- }
-
- //
- if (cachedMapKey == null)
- {
- if (principal == null)
- {
- cachedMapKey = "portal.principal";
- cachedPrincipalName = null;
- }
- else
- {
- cachedMapKey = "portal.principal." + principal.getName();
- cachedPrincipalName = principal.getName();
- }
- }
-
- //
- return cachedMapKey;
- }
-}
Deleted: trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/server/src/main/org/jboss/portal/server/impl/RequestAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -1,92 +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.server.impl;
-
-import org.jboss.portal.common.invocation.AttributeResolver;
-import org.jboss.portal.common.util.Tools;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class RequestAttributeResolver implements AttributeResolver
-{
-
- /** . */
- private final HttpServletRequest req;
-
- public RequestAttributeResolver(HttpServletRequest req)
- {
- if (req == null)
- {
- throw new IllegalArgumentException();
- }
- this.req = req;
- }
-
-
- public Set getKeys()
- {
- return Tools.toSet(req.getAttributeNames());
- }
-
- public Object getAttribute(Object attrKey) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException("No null attribute key accepted");
- }
- if (attrKey instanceof String == false)
- {
- throw new IllegalArgumentException("Attribute key must be a string");
- }
-
- //
- return req.getAttribute((String)attrKey);
- }
-
- public void setAttribute(Object attrKey, Object attrValue) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException("No null attribute key accepted");
- }
- if (attrKey instanceof String == false)
- {
- throw new IllegalArgumentException("Attribute key must be a string");
- }
-
- //
- if (attrValue != null)
- {
- req.setAttribute((String)attrKey, attrValue);
- }
- else
- {
- req.removeAttribute((String)attrKey);
- }
- }
-}
Modified: trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -23,6 +23,9 @@
package org.jboss.portal.server.impl;
import org.jboss.portal.common.invocation.AbstractInvocationContext;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.SessionAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
import org.jboss.portal.common.text.CharBuffer;
import org.jboss.portal.common.text.FastURLEncoder;
import org.jboss.portal.common.util.ParameterMap;
Deleted: trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/server/src/main/org/jboss/portal/server/impl/SessionAttributeResolver.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -1,55 +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.server.impl;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class SessionAttributeResolver extends AbstractSessionAttributeResolver
-{
-
- /** . */
- private final String mapKey;
-
- public SessionAttributeResolver(HttpServletRequest req, String mapKey)
- {
- super(req);
-
- //
- if (mapKey == null)
- {
- throw new IllegalArgumentException("No null map key allowed");
- }
-
- //
- this.mapKey = mapKey;
- }
-
- protected String getMapKey()
- {
- return mapKey;
- }
-}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -34,7 +34,7 @@
import org.jboss.portal.portlet.spi.ActionContext;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.portlet.spi.RenderContext;
-import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.wsrp.WSRPConstants;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java 2007-03-16 13:20:08 UTC (rev 6712)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPPortletInvocationContext.java 2007-03-16 14:48:40 UTC (rev 6713)
@@ -26,7 +26,6 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.invocation.EmptyAttributeResolver;
import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.common.util.ContentInfo;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
@@ -39,8 +38,8 @@
import org.jboss.portal.portlet.spi.SecurityContext;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.portlet.spi.WindowContext;
-import org.jboss.portal.server.impl.MapAttributeResolver;
-import org.jboss.portal.server.impl.RequestAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.MapAttributeResolver;
+import org.jboss.portal.common.invocation.resolver.RequestAttributeResolver;
import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPRewritingConstants;
import org.jboss.portal.wsrp.servlet.ServletAccess;
17 years, 5 months
JBoss Portal SVN: r6712 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller and 16 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-16 09:20:08 -0400 (Fri, 16 Mar 2007)
New Revision: 6712
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/security/JBossPortletSecurityService.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateManagementPolicyService.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
trunk/server/src/main/org/jboss/portal/server/ServerInterceptor.java
trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java
trunk/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java
trunk/server/src/main/org/jboss/portal/server/impl/ServerImpl.java
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptor.java
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java
Log:
started to pojoize the services in server and portlet modules
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -23,6 +23,7 @@
package org.jboss.portal.cms.impl.interceptors;
import org.w3c.dom.*;
+
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.InputStream;
@@ -59,451 +60,445 @@
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.RoleModule;
+import org.apache.log4j.Logger;
/**
* ACLInterceptor is plugged into the CMS system to enforce fine grained security access control
- * on resources stored in the CMS system.
- *
- * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 27, 2006
+ * on resources stored in the CMS system.
*
+ * @author Sohil Shah - sohil.shah(a)jboss.com - Nov 27, 2006
*/
public class ACLInterceptor extends CMSInterceptor
-{
- /**
- * default security policy that the cms service should be booted with
- */
- private String defaultPolicy = null;
-
- /**
- *
- */
- private RoleModule roleModule = null;
-
- /**
- *
- */
- private String jndiName = null;
-
- /**
- *
- */
- private AuthorizationManager authorizationManager = null;
-
-
-
- /**
- *
- * @return
- */
- public AuthorizationManager getAuthorizationManager()
- {
- return this.authorizationManager;
- }
-
- /**
- *
- * @param authorizationManager
- */
- public void setAuthorizationManager(AuthorizationManager authorizationManager)
- {
- this.authorizationManager = authorizationManager;
- }
-
- /**
- *
- * @return
- */
- public String getDefaultPolicy()
- {
- return this.defaultPolicy;
- }
-
- /**
- *
- * @param defaultPolicy
- */
- public void setDefaultPolicy(String defaultPolicy)
- {
- this.defaultPolicy = defaultPolicy;
- }
-
- /**
- *
- * @return
- */
- public RoleModule getRoleModule()
- {
- return this.roleModule;
- }
-
- /**
- *
- * @param roleModule
- */
- public void setRoleModule(RoleModule roleModule)
- {
- this.roleModule = roleModule;
- }
-
- /**
- *
- * @return
- */
- public String getJNDIName()
- {
- return this.jndiName;
- }
-
- /**
- *
- * @param jndiName
- */
- public void setJNDIName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
- /**
- *
- */
- protected Object invoke(JCRCommand invocation) throws Exception, InvocationException
- {
- if(ACLInterceptor.turnOff.get()==null )
- {
- //make the acl check before this command is executed
-
- // Get the user executing the command
- User user = (User)JCRCMS.getUserInfo().get();
-
- //setup the security context with enough information for the authorization provider
- //to be able to make an enforcement decision
- PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
- securityContext.setAttribute("command",invocation);
-
- //perform access check
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- Session session = Tools.getOpenSession();
- Transaction tx = session.beginTransaction();
- boolean allowAccess = this.authorizationManager.checkPermission(cmsPermission);
- tx.commit();
- Tools.closeSession(session);
-
- if(allowAccess)
- {
- Object response = invocation.invokeNext();
-
- //also filter lists of files and folders based on access allowed on these resources
- response = this.applyFilter(response,securityContext);
-
- return response;
- }
- else
- {
- throw new CMSException("Access to this resource is denied");
- }
- }
- else
- {
- //this is turned off for this thread that is trying to integrate with the CMS
- return invocation.invokeNext();
- }
- }
-
- /**
- * Filters any files/folders based on the user's access. The filter is applied to folders/files
- * returned by invoking a CMS command
- *
- * @param response
- * @return
- */
- private Object applyFilter(Object response,PortalCMSSecurityContext securityContext)
- {
- Session session = Tools.getOpenSession();
- Transaction tx = session.beginTransaction();
- Object filteredResponse = response;
-
- JCRCommand command = (JCRCommand)securityContext.getAttribute("command");
-
- try
- {
-
-
- if(filteredResponse instanceof Folder)
- {
+{
+
+ private static Logger log = Logger.getLogger(ACLInterceptor.class);
+
+ /**
+ * default security policy that the cms service should be booted with
+ */
+ private String defaultPolicy = null;
+
+ /**
+ *
+ */
+ private RoleModule roleModule = null;
+
+ /**
+ *
+ */
+ private String jndiName = null;
+
+ /**
+ *
+ */
+ private AuthorizationManager authorizationManager = null;
+
+
+ /**
+ * @return
+ */
+ public AuthorizationManager getAuthorizationManager()
+ {
+ return this.authorizationManager;
+ }
+
+ /**
+ * @param authorizationManager
+ */
+ public void setAuthorizationManager(AuthorizationManager authorizationManager)
+ {
+ this.authorizationManager = authorizationManager;
+ }
+
+ /**
+ * @return
+ */
+ public String getDefaultPolicy()
+ {
+ return this.defaultPolicy;
+ }
+
+ /**
+ * @param defaultPolicy
+ */
+ public void setDefaultPolicy(String defaultPolicy)
+ {
+ this.defaultPolicy = defaultPolicy;
+ }
+
+ /**
+ * @return
+ */
+ public RoleModule getRoleModule()
+ {
+ return this.roleModule;
+ }
+
+ /**
+ * @param roleModule
+ */
+ public void setRoleModule(RoleModule roleModule)
+ {
+ this.roleModule = roleModule;
+ }
+
+ /**
+ * @return
+ */
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ /**
+ * @param jndiName
+ */
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ /**
+ *
+ */
+ protected Object invoke(JCRCommand invocation) throws Exception, InvocationException
+ {
+ if (ACLInterceptor.turnOff.get() == null)
+ {
+ //make the acl check before this command is executed
+
+ // Get the user executing the command
+ User user = (User)JCRCMS.getUserInfo().get();
+
+ //setup the security context with enough information for the authorization provider
+ //to be able to make an enforcement decision
+ PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
+ securityContext.setAttribute("command", invocation);
+
+ //perform access check
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ Session session = Tools.getOpenSession();
+ Transaction tx = session.beginTransaction();
+ boolean allowAccess = this.authorizationManager.checkPermission(cmsPermission);
+ tx.commit();
+ Tools.closeSession(session);
+
+ if (allowAccess)
+ {
+ Object response = invocation.invokeNext();
+
+ //also filter lists of files and folders based on access allowed on these resources
+ response = this.applyFilter(response, securityContext);
+
+ return response;
+ }
+ else
+ {
+ throw new CMSException("Access to this resource is denied");
+ }
+ }
+ else
+ {
+ //this is turned off for this thread that is trying to integrate with the CMS
+ return invocation.invokeNext();
+ }
+ }
+
+ /**
+ * Filters any files/folders based on the user's access. The filter is applied to folders/files
+ * returned by invoking a CMS command
+ *
+ * @param response
+ * @return
+ */
+ private Object applyFilter(Object response, PortalCMSSecurityContext securityContext)
+ {
+ Session session = Tools.getOpenSession();
+ Transaction tx = session.beginTransaction();
+ Object filteredResponse = response;
+
+ JCRCommand command = (JCRCommand)securityContext.getAttribute("command");
+
+ try
+ {
+
+
+ if (filteredResponse instanceof Folder)
+ {
Folder folder = (Folder)filteredResponse;
List filteredFolders = new ArrayList();
- List filteredFiles = new ArrayList();
+ List filteredFiles = new ArrayList();
securityContext.removeAttribute("command");
- for(Iterator itr=folder.getFolders().iterator();itr.hasNext();)
+ for (Iterator itr = folder.getFolders().iterator(); itr.hasNext();)
{
- Folder cour = (Folder)itr.next();
- securityContext.setAttribute("applyFilter",cour.getBasePath());
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if(allow)
- {
- filteredFolders.add(cour);
- }
+ Folder cour = (Folder)itr.next();
+ securityContext.setAttribute("applyFilter", cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow = this.authorizationManager.checkPermission(cmsPermission);
+ if (allow)
+ {
+ filteredFolders.add(cour);
+ }
}
- for(Iterator itr=folder.getFiles().iterator();itr.hasNext();)
+ for (Iterator itr = folder.getFiles().iterator(); itr.hasNext();)
{
- File cour = (File)itr.next();
- securityContext.setAttribute("applyFilter",cour.getBasePath());
- PortalPermission cmsPermission = new CMSPermission(securityContext);
- boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if(allow)
- {
- filteredFiles.add(cour);
- }
+ File cour = (File)itr.next();
+ securityContext.setAttribute("applyFilter", cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow = this.authorizationManager.checkPermission(cmsPermission);
+ if (allow)
+ {
+ filteredFiles.add(cour);
+ }
}
folder.setFolders(filteredFolders);
folder.setFiles(filteredFiles);
- }
- else if ((filteredResponse instanceof List) && (command instanceof SearchCommand))
- {
- List list = (List)filteredResponse;
- List filteredFiles = new ArrayList();
- for(Iterator itr=list.iterator();itr.hasNext();)
- {
+ }
+ else if ((filteredResponse instanceof List) && (command instanceof SearchCommand))
+ {
+ List list = (List)filteredResponse;
+ List filteredFiles = new ArrayList();
+ for (Iterator itr = list.iterator(); itr.hasNext();)
+ {
File cour = (File)itr.next();
- securityContext.setAttribute("path",cour.getBasePath());
+ securityContext.setAttribute("path", cour.getBasePath());
PortalPermission cmsPermission = new CMSPermission(securityContext);
boolean allow = this.authorizationManager.checkPermission(cmsPermission);
- if(allow)
+ if (allow)
{
- filteredFiles.add(cour);
+ filteredFiles.add(cour);
}
- }
- filteredResponse = filteredFiles;
- }
- }
- catch(Exception e)
- {
- tx.rollback();
- }
- finally
- {
- tx.commit();
- Tools.closeSession(session);
- }
-
- return filteredResponse;
- }
-
- /**
- *
- */
- public void startService() throws Exception
- {
- super.startService();
-
- log.info("AuthorizationManager initialized="+this.authorizationManager);
-
- Tools.init(this.jndiName);
+ }
+ filteredResponse = filteredFiles;
+ }
+ }
+ catch (Exception e)
+ {
+ tx.rollback();
+ }
+ finally
+ {
+ tx.commit();
+ Tools.closeSession(session);
+ }
- try
- {
- roleModule = (RoleModule)new InitialContext().lookup("java:portal/RoleModule");
- }
- catch (NamingException e)
- {
- log.error("Cannot obtain RoleModule from JNDI: ", e);
- throw e;
- }
-
- //check and see if cms permissions exist...if not, boot it with the default policy
- //specified in the configuration
- if(!this.isBootRequired())
- {
- return;
- }
-
- //go ahead and boot the cms access policy with default policy specified in the configuration
- InputStream is = null;
- try
- {
- //process the specified defaultPolicy
- is = new ByteArrayInputStream(this.defaultPolicy.getBytes());
- Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);
-
- NodeList criteria = document.getElementsByTagName("criteria");
- if(criteria!=null)
+ return filteredResponse;
+ }
+
+ /**
+ *
+ */
+ public void start() throws Exception
+ {
+ log.info("AuthorizationManager initialized=" + this.authorizationManager);
+
+ Tools.init(this.jndiName);
+
+ try
+ {
+ roleModule = (RoleModule)new InitialContext().lookup("java:portal/RoleModule");
+ }
+ catch (NamingException e)
+ {
+ log.error("Cannot obtain RoleModule from JNDI: ", e);
+ throw e;
+ }
+
+ //check and see if cms permissions exist...if not, boot it with the default policy
+ //specified in the configuration
+ if (!this.isBootRequired())
+ {
+ return;
+ }
+
+ //go ahead and boot the cms access policy with default policy specified in the configuration
+ InputStream is = null;
+ try
+ {
+ //process the specified defaultPolicy
+ is = new ByteArrayInputStream(this.defaultPolicy.getBytes());
+ Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);
+
+ NodeList criteria = document.getElementsByTagName("criteria");
+ if (criteria != null)
+ {
+ for (int i = 0; i < criteria.getLength(); i++)
{
- for(int i=0;i<criteria.getLength();i++)
- {
- Element criteriaElem = (Element)criteria.item(i);
- String name = criteriaElem.getAttribute("name");
- String value = criteriaElem.getAttribute("value");
-
- //permission setup
- NodeList permissions = criteriaElem.getElementsByTagName("permission");
- if(permissions!=null)
- {
- Session session = null;
- Transaction tx = null;
- Collection parsedPermissions = this.parseDefaultPermissions(permissions);
- try
- {
- session = Tools.getOpenSession();
- tx = session.beginTransaction();
- for(Iterator itr=parsedPermissions.iterator();itr.hasNext();)
- {
- Permission permission = (Permission)itr.next();
- permission.addCriteria(new Criteria(name,value));
- Set securityBinding = new HashSet();
- securityBinding.add(permission);
- this.authorizationManager.getProvider().setSecurityBindings(null,securityBinding);
- }
- tx.commit();
- }
- catch(Exception e)
- {
- tx.rollback();
- }
- finally
- {
- Tools.closeSession(session);
- }
- }
- }
+ Element criteriaElem = (Element)criteria.item(i);
+ String name = criteriaElem.getAttribute("name");
+ String value = criteriaElem.getAttribute("value");
+
+ //permission setup
+ NodeList permissions = criteriaElem.getElementsByTagName("permission");
+ if (permissions != null)
+ {
+ Session session = null;
+ Transaction tx = null;
+ Collection parsedPermissions = this.parseDefaultPermissions(permissions);
+ try
+ {
+ session = Tools.getOpenSession();
+ tx = session.beginTransaction();
+ for (Iterator itr = parsedPermissions.iterator(); itr.hasNext();)
+ {
+ Permission permission = (Permission)itr.next();
+ permission.addCriteria(new Criteria(name, value));
+ Set securityBinding = new HashSet();
+ securityBinding.add(permission);
+ this.authorizationManager.getProvider().setSecurityBindings(null, securityBinding);
+ }
+ tx.commit();
+ }
+ catch (Exception e)
+ {
+ tx.rollback();
+ }
+ finally
+ {
+ Tools.closeSession(session);
+ }
+ }
}
- }
- finally
- {
- if(is!=null)
+ }
+ }
+ finally
+ {
+ if (is != null)
+ {
+ is.close();
+ }
+ }
+ }
+
+ /**
+ * Parses and produces Permission objects for the default policy
+ *
+ * @param permissions
+ * @return
+ */
+ private Collection parseDefaultPermissions(NodeList permissions) throws Exception
+ {
+ Collection parsedPermissions = new ArrayList();
+ for (int i = 0; i < permissions.getLength(); i++)
+ {
+ Element permissionElement = (Element)permissions.item(i);
+ String name = permissionElement.getAttribute("name");
+ String action = permissionElement.getAttribute("action");
+ Permission permission = new Permission(name, action);
+
+ //parse the roles listed under this permission element
+ NodeList roles = permissionElement.getElementsByTagName("role");
+ for (int j = 0; j < roles.getLength(); j++)
+ {
+ Element roleElement = (Element)roles.item(j);
+ String roleName = roleElement.getAttribute("name");
+ Role role = this.getRole(roleName);
+ PermRoleAssoc roleAssoc = new PermRoleAssoc();
+ if (role != null)
{
- is.close();
+ //makes sure this is not Anonymous
+ roleAssoc.setRoleId(roleName);
}
- }
- }
-
- /**
- * Parses and produces Permission objects for the default policy
- *
- * @param permissions
- * @return
- */
- private Collection parseDefaultPermissions(NodeList permissions) throws Exception
- {
- Collection parsedPermissions = new ArrayList();
- for(int i=0;i<permissions.getLength();i++)
- {
- Element permissionElement = (Element)permissions.item(i);
- String name = permissionElement.getAttribute("name");
- String action = permissionElement.getAttribute("action");
- Permission permission = new Permission(name,action);
-
- //parse the roles listed under this permission element
- NodeList roles = permissionElement.getElementsByTagName("role");
- for(int j=0;j<roles.getLength();j++)
+ else
{
- Element roleElement = (Element)roles.item(j);
- String roleName = roleElement.getAttribute("name");
- Role role = this.getRole(roleName);
- PermRoleAssoc roleAssoc = new PermRoleAssoc();
- if(role != null)
- {
- //makes sure this is not Anonymous
- roleAssoc.setRoleId(roleName);
- }
- else
- {
- roleAssoc.setRoleId(AuthorizationManager.Anonymous);
- }
- permission.addRoleAssoc(roleAssoc);
+ roleAssoc.setRoleId(AuthorizationManager.Anonymous);
}
-
- parsedPermissions.add(permission);
- }
- return parsedPermissions;
- }
-
- /**
- * Returns the Role object specified in the default policy
- *
- * @param name
- * @return
- */
- private Role getRole(String name) throws Exception
- {
- Role role = null;
-
- //since this is at app start up and not on user thread...need to create a transaction context.
- InitialContext context = new InitialContext();
- SessionFactory sessionFactory = (SessionFactory)context.lookup("java:/portal/IdentitySessionFactory");
- Session session = sessionFactory.openSession();
- Transaction tx = session.beginTransaction();
- try
- {
- role = this.roleModule.findRoleByName(name);
- }
- catch(Exception e)
- {
- role = null;
- }
- finally
- {
- if(tx!=null)
- {
- tx.rollback();
- }
- if(session!=null)
- {
- session.close();
- }
- }
-
- return role;
- }
-
- /**
- * Returns if cms permissions need to be booted with the default policy from configuration
- *
- * @return
- */
- private boolean isBootRequired()
- {
- boolean bootRequired = false;
-
- String hsqlQuery = "select count(permission) from org.jboss.portal.cms.security.Permission as permission";
- Session session = Tools.getOpenSession();
- Transaction tx = session.beginTransaction();
- try
- {
- Query query = session.createQuery(hsqlQuery);
- long count = ((Long)query.list().get(0)).longValue();
- if(count<=0)
- {
- bootRequired = true;
- }
- }
- finally
- {
- if(tx!=null)
- {
- tx.rollback();
- }
- Tools.closeSession(session);
- }
-
- return bootRequired;
- }
+ permission.addRoleAssoc(roleAssoc);
+ }
- /**
- * This turns off acl security only for a particular thread.
- * This is used by system level operations that need to integrate with the CMS
- *
- * Example is: the workflow daemon that publishes a content as live when a manager
- * approves it. Without turning this off, the daemon thread is running in Anonymous mode
- * which obviously does not have the rights to publish the content
- */
- private static ThreadLocal turnOff = new ThreadLocal();
- public static void turnOff()
- {
- ACLInterceptor.turnOff.set(new Boolean(true));
- }
- public static void turnOn()
- {
- ACLInterceptor.turnOff.set(null);
- }
+ parsedPermissions.add(permission);
+ }
+ return parsedPermissions;
+ }
+
+ /**
+ * Returns the Role object specified in the default policy
+ *
+ * @param name
+ * @return
+ */
+ private Role getRole(String name) throws Exception
+ {
+ Role role = null;
+
+ //since this is at app start up and not on user thread...need to create a transaction context.
+ InitialContext context = new InitialContext();
+ SessionFactory sessionFactory = (SessionFactory)context.lookup("java:/portal/IdentitySessionFactory");
+ Session session = sessionFactory.openSession();
+ Transaction tx = session.beginTransaction();
+ try
+ {
+ role = this.roleModule.findRoleByName(name);
+ }
+ catch (Exception e)
+ {
+ role = null;
+ }
+ finally
+ {
+ if (tx != null)
+ {
+ tx.rollback();
+ }
+ if (session != null)
+ {
+ session.close();
+ }
+ }
+
+ return role;
+ }
+
+ /**
+ * Returns if cms permissions need to be booted with the default policy from configuration
+ *
+ * @return
+ */
+ private boolean isBootRequired()
+ {
+ boolean bootRequired = false;
+
+ String hsqlQuery = "select count(permission) from org.jboss.portal.cms.security.Permission as permission";
+ Session session = Tools.getOpenSession();
+ Transaction tx = session.beginTransaction();
+ try
+ {
+ Query query = session.createQuery(hsqlQuery);
+ long count = ((Long)query.list().get(0)).longValue();
+ if (count <= 0)
+ {
+ bootRequired = true;
+ }
+ }
+ finally
+ {
+ if (tx != null)
+ {
+ tx.rollback();
+ }
+ Tools.closeSession(session);
+ }
+
+ return bootRequired;
+ }
+
+ /**
+ * This turns off acl security only for a particular thread.
+ * This is used by system level operations that need to integrate with the CMS
+ * <p/>
+ * Example is: the workflow daemon that publishes a content as live when a manager
+ * approves it. Without turning this off, the daemon thread is running in Anonymous mode
+ * which obviously does not have the rights to publish the content
+ */
+ private static ThreadLocal turnOff = new ThreadLocal();
+
+ public static void turnOff()
+ {
+ ACLInterceptor.turnOff.set(new Boolean(true));
+ }
+
+ public static void turnOn()
+ {
+ ACLInterceptor.turnOff.set(null);
+ }
}
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -53,6 +53,7 @@
import org.jboss.portal.theme.page.Region;
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
+import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.Collection;
@@ -74,6 +75,9 @@
{
/** . */
+ private static Logger log = Logger.getLogger(PageCustomizerInterceptor.class);
+
+ /** . */
private static final String RESOURCE_PREFIX = "PAGENAME_";
/** . */
Modified: trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/jboss/PortletAppDeployment.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -129,7 +129,7 @@
{
Class proxyClass = pwa.getClassLoader().loadClass(serviceClass);
ObjectName objectName = ObjectName.getInstance(serviceRef);
- Object proxy = MBeanProxyExt.create(proxyClass, objectName, factory.getServer(), true);
+ Object proxy = MBeanProxyExt.create(proxyClass, objectName, mbeanServer, true);
pwa.getServletContext().setAttribute(serviceName, proxy);
}
catch (Exception e)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/PortalSessionSynchronizationInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -28,6 +28,7 @@
import org.jboss.portal.portlet.session.SubSession;
import org.jboss.portal.portlet.spi.PortletInvocationContext;
import org.jboss.portal.server.ServerInvocation;
+import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@@ -40,6 +41,10 @@
*/
public class PortalSessionSynchronizationInterceptor extends PortletInterceptor
{
+
+ /** . */
+ private final Logger log = Logger.getLogger(PortalSessionSynchronizationInterceptor.class);
+
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
HttpServletRequest req = null;
@@ -55,9 +60,9 @@
}
catch (Exception ignore)
{
- if (log.isTraceEnabled())
+ if (log.isDebugEnabled())
{
- log.trace("Was no able to access the client request from request context");
+ log.debug("Was no able to access the client request from request context");
}
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ProducerCacheInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -31,6 +31,7 @@
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.apache.log4j.Logger;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -38,6 +39,10 @@
*/
public class ProducerCacheInterceptor extends PortletInterceptor
{
+
+ /** . */
+ private final Logger log = Logger.getLogger(ProducerCacheInterceptor.class);
+
protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
{
if (invocation instanceof ActionInvocation)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletApplicationRegistryImpl.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -37,7 +37,7 @@
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision$
*/
-public class PortletApplicationRegistryImpl extends AbstractJBossService implements PortletApplicationRegistry
+public class PortletApplicationRegistryImpl implements PortletApplicationRegistry
{
/** . */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeploymentFactory.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -152,7 +152,7 @@
return new PortletAppDeployment(url, pwa, mbeanServer, this);
}
- public void startService() throws Exception
+ public void start() throws Exception
{
//
try
@@ -175,7 +175,7 @@
loadStandardJBossApplicationMetaData();
//
- super.startService();
+ super.start();
}
public void loadStandardJBossApplicationMetaData()
@@ -204,9 +204,9 @@
}
}
- public void stopService()
+ public void stop()
{
- super.stopService();
+ super.stop();
//
apiFactory = null;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/security/JBossPortletSecurityService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/security/JBossPortletSecurityService.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/security/JBossPortletSecurityService.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -20,17 +20,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
******************************************************************************/
-
-/*
- * JBoss, the OpenSource J2EE webOS
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
package org.jboss.portal.portlet.impl.security;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.security.PortletPermission;
import org.jboss.portal.portlet.security.PortletSecurityService;
import org.jboss.portal.security.PortalPermission;
@@ -51,14 +43,13 @@
import java.util.Set;
/**
- * Service that configures security for portlets
+ * Service that configures security for portlets.
*
* @author <a href="mailto:Anil.Saldhana@jboss.org">Anil Saldhana</a>
* @version $Revision$
* @since Mar 17, 2006
*/
-public class JBossPortletSecurityService extends AbstractJBossService
- implements PortletSecurityService,
+public class JBossPortletSecurityService implements PortletSecurityService,
AuthorizationDomain, DomainConfigurator, PermissionRepository, PermissionFactory
{
@@ -148,31 +139,25 @@
return new PortletPermission(uri, actions);
}
- protected void createService() throws Exception
+ public void create() throws Exception
{
- super.createService();
this.securityConstraintsMap = new ConcurrentReaderHashMap();
}
- protected void destroyService() throws Exception
+ public void start() throws Exception
{
- super.destroyService();
- }
-
- protected void startService() throws Exception
- {
- super.startService();
-
// Add ourself as the authorization domain
authorizationDomainRegistry.addDomain(this);
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
authorizationDomainRegistry.removeDomain(this);
+ }
- //
- super.stopService();
+ public void destroy()
+ {
+ securityConstraintsMap = null;
}
public JBossAuthorizationDomainRegistry getAuthorizationDomainRegistry()
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateConverterV0.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -23,7 +23,6 @@
package org.jboss.portal.portlet.impl.state;
import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.state.PropertyMap;
import org.jboss.portal.portlet.state.SimplePropertyMap;
import org.jboss.portal.portlet.state.StateConversionException;
@@ -49,7 +48,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class StateConverterV0 extends AbstractJBossService implements StateConverter
+public class StateConverterV0 implements StateConverter
{
/** . */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateManagementPolicyService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateManagementPolicyService.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/StateManagementPolicyService.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -22,14 +22,13 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.state;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.state.StateManagementPolicy;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class StateManagementPolicyService extends AbstractJBossService implements StateManagementPolicy
+public class StateManagementPolicyService implements StateManagementPolicy
{
/** . */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/state/producer/PortletStatePersistenceManagerService.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.state.producer;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.state.InvalidStateIdException;
import org.jboss.portal.portlet.state.NoSuchStateException;
import org.jboss.portal.portlet.state.PropertyMap;
@@ -38,7 +37,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortletStatePersistenceManagerService extends AbstractJBossService implements PortletStatePersistenceManager
+public class PortletStatePersistenceManagerService implements PortletStatePersistenceManager
{
/** . */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/invocation/PortletInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -24,13 +24,13 @@
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.server.impl.invocation.JBossInterceptor;
+import org.jboss.portal.common.invocation.Interceptor;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public abstract class PortletInterceptor extends JBossInterceptor
+public abstract class PortletInterceptor implements Interceptor
{
public Object invoke(Invocation invocation) throws Exception, InvocationException
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/state/producer/ProducerPortletInvoker.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -52,6 +52,7 @@
import org.jboss.portal.portlet.state.StateConverter;
import org.jboss.portal.portlet.state.StateManagementPolicy;
import org.jboss.portal.portlet.state.PropertyContext;
+import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.Iterator;
@@ -64,7 +65,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ProducerPortletInvoker extends AbstractJBossService implements PortletInvoker
+public class ProducerPortletInvoker implements PortletInvoker
{
/** . */
@@ -85,6 +86,9 @@
/** . */
private StateConverter stateConverter;
+ /** . */
+ private Logger log = Logger.getLogger(ProducerPortletInvoker.class);
+
public PortletInvoker getPortletInvoker()
{
return portletInvoker;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -29,7 +29,6 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.common.util.MarkupInfo;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletParametersStateString;
@@ -70,6 +69,7 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.impl.MapAttributeResolver;
import org.jboss.portal.server.request.URLFormat;
+import org.jboss.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -89,7 +89,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortletController extends AbstractJBossService implements RequestController
+public class PortletController implements RequestController
{
/** . */
@@ -98,6 +98,9 @@
/** . */
protected PortletInvoker portletInvoker;
+ /** . */
+ protected Logger log = Logger.getLogger(getClass());
+
public PortletInvoker getPortletInvoker()
{
return portletInvoker;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/TestPortletInvoker.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -26,7 +26,6 @@
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.InvocationHandler;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
@@ -45,7 +44,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class TestPortletInvoker extends AbstractJBossService implements PortletInvoker
+public class TestPortletInvoker implements PortletInvoker
{
/** . */
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/support/PortletInvokerSupport.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.test.support;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.InvalidPortletIdException;
import org.jboss.portal.portlet.NoSuchPortletException;
import org.jboss.portal.portlet.Portlet;
@@ -49,7 +48,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class PortletInvokerSupport extends AbstractJBossService implements PortletInvoker
+public class PortletInvokerSupport implements PortletInvoker
{
/** . */
Modified: trunk/server/src/main/org/jboss/portal/server/ServerInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/server/src/main/org/jboss/portal/server/ServerInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -24,13 +24,13 @@
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.server.impl.invocation.JBossInterceptor;
+import org.jboss.portal.common.invocation.Interceptor;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public abstract class ServerInterceptor extends JBossInterceptor
+public abstract class ServerInterceptor implements Interceptor
{
public Object invoke(Invocation invocation) throws Exception, InvocationException
Modified: trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/server/src/main/org/jboss/portal/server/config/ServerConfigService.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -24,7 +24,6 @@
import org.jboss.portal.common.util.CLResourceLoader;
import org.jboss.portal.common.util.LoaderResource;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import java.util.HashMap;
import java.util.Iterator;
@@ -35,12 +34,19 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ServerConfigService extends AbstractJBossService implements ServerConfig
+public class ServerConfigService implements ServerConfig
{
- private String domain;
+ /** . */
+ private final String domain = "portal";
+
+ /** . */
private String configLocation;
+
+ /** . */
private LoaderResource configResource;
+
+ /** . */
private Map properties;
public String getDomain()
@@ -124,8 +130,7 @@
entry.setValue(value);
}
- // Add the domain
- domain = serviceName.getDomain();
+ // Add the domain for now portal value
properties.put(DOMAIN_KEY, domain);
}
Modified: trunk/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/server/src/main/org/jboss/portal/server/deployment/jboss/AbstractDeploymentFactory.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -24,7 +24,7 @@
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.net.URLFilter;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.apache.log4j.Logger;
import java.net.URL;
@@ -32,7 +32,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public abstract class AbstractDeploymentFactory extends AbstractJBossService implements DeploymentFactory, URLFilter
+public abstract class AbstractDeploymentFactory implements DeploymentFactory, URLFilter
{
/** The server deployer. */
@@ -50,6 +50,9 @@
/** The short name. */
protected final String name;
+ /** The logger. */
+ protected final Logger log = Logger.getLogger(getClass());
+
/** The default constructor initialize the service with the registration controlled by the service. */
protected AbstractDeploymentFactory()
{
@@ -133,7 +136,7 @@
* Set the setup url with the resource obtained from the thread context class loader using the value of setup
* location if this one is not null.
*/
- protected void createService() throws Exception
+ public void create() throws Exception
{
if (setupLocation != null)
{
@@ -142,7 +145,7 @@
}
/** Register the factory only if it is controlled by the service lifecycle. */
- public void startService() throws Exception
+ public void start() throws Exception
{
if (registrationControlledByService)
{
@@ -151,7 +154,7 @@
}
/** Unregister the factory only if it is controlled by the service lifecycle. */
- public void stopService()
+ public void stop()
{
if (registrationControlledByService)
{
@@ -160,7 +163,7 @@
}
/** Set to null the setup url. */
- protected void destroyService() throws Exception
+ public void destroy() throws Exception
{
setupURL = null;
}
Modified: trunk/server/src/main/org/jboss/portal/server/impl/ServerImpl.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/ServerImpl.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/server/src/main/org/jboss/portal/server/impl/ServerImpl.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -23,7 +23,6 @@
package org.jboss.portal.server.impl;
import org.jboss.portal.common.util.Version;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.server.PortalConstants;
import org.jboss.portal.server.Server;
import org.jboss.portal.server.config.ServerConfig;
@@ -34,7 +33,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public class ServerImpl extends AbstractJBossService implements Server
+public class ServerImpl implements Server
{
/** The global server config. */
private ServerConfig config;
Modified: trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptor.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptor.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -25,19 +25,12 @@
import org.jboss.portal.common.invocation.Interceptor;
import org.jboss.portal.common.invocation.Invocation;
import org.jboss.portal.common.invocation.InvocationException;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public abstract class JBossInterceptor extends AbstractJBossService implements Interceptor
+public abstract class JBossInterceptor implements Interceptor
{
- /** Return the implemented interceptor. */
- public Interceptor getInterceptor()
- {
- return this;
- }
-
public abstract Object invoke(Invocation invocation) throws Exception, InvocationException;
}
Modified: trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java 2007-03-16 12:14:24 UTC (rev 6711)
+++ trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java 2007-03-16 13:20:08 UTC (rev 6712)
@@ -124,7 +124,7 @@
{
ObjectName name = (ObjectName)names.get(i);
log.debug("Adding interceptor " + name + " to the stack");
- interceptors[i] = (Interceptor)server.getAttribute(name, "Interceptor");
+ interceptors[i] = (Interceptor)server.getAttribute(name, "ManagedResource");
}
//
17 years, 5 months
JBoss Portal SVN: r6711 - trunk/jems/src/main/org/jboss/portal/jems/as/system.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-16 08:14:24 -0400 (Fri, 16 Mar 2007)
New Revision: 6711
Modified:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
Log:
added getManagedResource which helps to retrieve the underlying pojo
Modified: trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-03-16 11:06:40 UTC (rev 6710)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-03-16 12:14:24 UTC (rev 6711)
@@ -56,72 +56,50 @@
// Attributes ----------------------------------------------------
- private static final Logger log = Logger.getLogger(JBossServiceModelMBean.class);
-
- // Constructors --------------------------------------------------
-
- private final boolean pojo;
-
- private final ServiceMBeanSupport support = new ServiceMBeanSupport()
+ static
{
- protected void createService() throws Exception
+ try
{
- execute("create");
+ serviceMixinInfo = JavaBeanModelMBeanBuilder.build(ServiceMixin.class, Object.class);
}
- protected void startService() throws Exception
+ catch (Exception e)
{
- execute("start");
+ throw new Error(e);
}
- protected void stopService() throws Exception
- {
- execute("stop");
- }
- protected void destroyService() throws Exception
- {
- execute("destroy");
- }
- private void execute(String lifecycle) throws Exception
- {
- Method m = null;
- try
- {
- m = getResource().getClass().getMethod(lifecycle, new Class[0]);
- }
- catch (NoSuchMethodException ignore)
- {
- }
+ }
- //
- if (m != null)
- {
- try
- {
- m.invoke(getResource(), new Object[0]);
- }
- catch (IllegalAccessException e)
- {
- throw new Error(e);
- }
- catch (InvocationTargetException e)
- {
- Throwable t = e.getTargetException();
- if (t instanceof Exception)
- {
- throw (Exception)t;
- }
- else if (t instanceof Error)
- {
- throw (Error)t;
- }
- else
- {
- throw new Error(t);
- }
- }
- }
- }
- };
+ /** . */
+ private static final ModelMBeanInfo serviceMixinInfo;
+ /** . */
+ private static final Logger log = Logger.getLogger(JBossServiceModelMBean.class);
+
+ // Constructors --------------------------------------------------
+
+ /** . */
+ private final ServiceMixin serviceMixin;
+
+ /** . */
+ private final boolean createExists;
+
+ /** . */
+ private final boolean startExists;
+
+ /** . */
+ private final boolean stopExists;
+
+ /** . */
+ private final boolean destroyExists;
+
+ /** . */
+ private final boolean getStateExists;
+
+ /** . */
+ private final boolean getStateStringExists;
+
+ /** . */
+ private final boolean getManagedResourceExists;
+
public JBossServiceModelMBean(Object resource) throws MBeanException
{
this(resource, null, null);
@@ -134,96 +112,116 @@
setManagedResource(resource, "ObjectReference");
//
- pojo = !(resource instanceof ServiceMBeanSupport);
+ boolean pojo = !(resource instanceof ServiceMBeanSupport);
// Build
ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), pojo ? Object.class : ServiceMBeanSupport.class);
//
- if (pojo)
+ serviceMixin = new ServiceMixin(resource);
+
+ //
+ List mmois = Tools.toList(info.getOperations());
+ List mmais = Tools.toList(info.getAttributes());
+
+ //
+ boolean createExists = false;
+ boolean startExists = false;
+ boolean stopExists = false;
+ boolean destroyExists = false;
+ boolean getStateExists = false;
+ boolean getStateStringExists = false;
+ boolean getManagedResourceExists = false;
+
+ //
+ for (int i = 0;i < mmois.size();i++)
{
- //
- List mmois = Tools.toList(info.getOperations());
- List mmais = Tools.toList(info.getAttributes());
-
- //
- boolean createExists = false;
- boolean startExists = false;
- boolean stopExists = false;
- boolean destroyExists = false;
- boolean getStateExists = false;
- boolean getStateStringExists = false;
- for (int i = 0;i < mmois.size();i++)
+ ModelMBeanOperationInfo mmoi = (ModelMBeanOperationInfo)mmois.get(i);
+ if (mmoi.getSignature().length == 0)
{
- ModelMBeanOperationInfo mmoi = (ModelMBeanOperationInfo)mmois.get(i);
- if (mmoi.getSignature().length == 0)
+ if (mmoi.getName().equals("create"))
{
- if (mmoi.getName().equals("create"))
- {
- createExists = true;
- }
- else if (mmoi.getName().equals("start"))
- {
- startExists = true;
- }
- else if (mmoi.getName().equals("stop"))
- {
- stopExists = true;
- }
- else if (mmoi.getName().equals("destroy"))
- {
- destroyExists = true;
- }
- else if (mmoi.getName().equals("getState"))
- {
- getStateExists = true;
- }
- else if (mmoi.getName().equals("getStateString"))
- {
- getStateStringExists = true;
- }
+ createExists = true;
}
+ else if (mmoi.getName().equals("start"))
+ {
+ startExists = true;
+ }
+ else if (mmoi.getName().equals("stop"))
+ {
+ stopExists = true;
+ }
+ else if (mmoi.getName().equals("destroy"))
+ {
+ destroyExists = true;
+ }
+ else if (mmoi.getName().equals("getState"))
+ {
+ getStateExists = true;
+ }
+ else if (mmoi.getName().equals("getStateString"))
+ {
+ getStateStringExists = true;
+ }
+ else if (mmoi.getName().equals("getManagedResource"))
+ {
+ getManagedResourceExists = true;
+ }
}
+ }
- //
- if (!createExists)
- {
- mmois.add(templateInfo.getOperation("create"));
- }
- if (!startExists)
- {
- mmois.add(templateInfo.getOperation("start"));
- }
- if (!stopExists)
- {
- mmois.add(templateInfo.getOperation("stop"));
- }
- if (!destroyExists)
- {
- mmois.add(templateInfo.getOperation("destroy"));
- }
- if (!getStateExists)
- {
- mmois.add(templateInfo.getOperation("getState"));
- mmais.add(templateInfo.getAttribute("State"));
- }
- if (!getStateStringExists)
- {
- mmois.add(templateInfo.getOperation("getStateString"));
- mmais.add(templateInfo.getAttribute("StateString"));
- }
+ //
+ this.createExists = createExists;
+ this.startExists = startExists;
+ this.stopExists = stopExists;
+ this.destroyExists = destroyExists;
+ this.getStateExists = getStateExists;
+ this.getStateStringExists = getStateStringExists;
+ this.getManagedResourceExists = getManagedResourceExists;
- //
- info = new ModelMBeanInfoSupport(
- info.getClassName(),
- info.getDescription(),
- (ModelMBeanAttributeInfo[])mmais.toArray(new ModelMBeanAttributeInfo[mmais.size()]),
- (ModelMBeanConstructorInfo[])info.getConstructors(),
- (ModelMBeanOperationInfo[])mmois.toArray(new ModelMBeanOperationInfo[mmois.size()]),
- (ModelMBeanNotificationInfo[])info.getNotifications());
+ //
+ if (!createExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("create"));
}
+ if (!startExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("start"));
+ }
+ if (!stopExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("stop"));
+ }
+ if (!destroyExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("destroy"));
+ }
+ if (!getStateExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("getState"));
+ mmais.add(serviceMixinInfo.getAttribute("State"));
+ }
+ if (!getStateStringExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("getStateString"));
+ mmais.add(serviceMixinInfo.getAttribute("StateString"));
+ }
+ if (!getManagedResourceExists)
+ {
+ mmois.add(serviceMixinInfo.getOperation("getManagedResource"));
+ mmais.add(serviceMixinInfo.getAttribute("ManagedResource"));
+ }
//
+ info = new ModelMBeanInfoSupport(
+ info.getClassName(),
+ info.getDescription(),
+ (ModelMBeanAttributeInfo[])mmais.toArray(new ModelMBeanAttributeInfo[mmais.size()]),
+ (ModelMBeanConstructorInfo[])info.getConstructors(),
+ (ModelMBeanOperationInfo[])mmois.toArray(new ModelMBeanOperationInfo[mmois.size()]),
+ (ModelMBeanNotificationInfo[])info.getNotifications());
+
+ //
setModelMBeanInfo(info);
}
catch (InstanceNotFoundException e)
@@ -254,152 +252,202 @@
//
-
protected void initDispatchers()
{
super.initDispatchers();
//
- if (pojo)
+ for (Iterator i = attributeContextMap.values().iterator();i.hasNext();)
{
- //
- for (Iterator i = attributeContextMap.values().iterator();i.hasNext();)
+ InvocationContext ctx = (InvocationContext)i.next();
+ if ("State".equals(ctx.getName()) && !getStateExists)
{
- InvocationContext ctx = (InvocationContext)i.next();
- if ("State".equals(ctx.getName()))
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- return new Integer(support.getState());
- }
- });
- }
- else if ("StateString".equals(ctx.getName()))
+ return new Integer(serviceMixin.getState());
+ }
+ });
+ }
+ else if ("StateString".equals(ctx.getName()) && !getStateStringExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- return support.getStateString();
- }
- });
- }
+ return serviceMixin.getStateString();
+ }
+ });
}
+ else if ("ManagedResource".equals(ctx.getName()) && !getManagedResourceExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return serviceMixin.getManagedResource();
+ }
+ });
+ }
+ }
- //
- for (Iterator i = operationContextMap.values().iterator();i.hasNext();)
+ //
+ for (Iterator i = operationContextMap.values().iterator();i.hasNext();)
+ {
+ InvocationContext ctx = (InvocationContext)i.next();
+ if ("create".equals(ctx.getName()) && !createExists)
{
- InvocationContext ctx = (InvocationContext)i.next();
- if ("create".equals(ctx.getName()))
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.create();
- return null;
- }
- });
- }
- else if ("start".equals(ctx.getName()))
+ serviceMixin.create();
+ return null;
+ }
+ });
+ }
+ else if ("start".equals(ctx.getName()) && !startExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.start();
- return null;
- }
- });
- }
- else if ("stop".equals(ctx.getName()))
+ serviceMixin.start();
+ return null;
+ }
+ });
+ }
+ else if ("stop".equals(ctx.getName()) && !stopExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.stop();
- return null;
- }
- });
- }
- else if ("destroy".equals(ctx.getName()))
+ serviceMixin.stop();
+ return null;
+ }
+ });
+ }
+ else if ("destroy".equals(ctx.getName()) && !destroyExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.destroy();
- return null;
- }
- });
- }
- else if ("getState".equals(ctx.getName()))
+ serviceMixin.destroy();
+ return null;
+ }
+ });
+ }
+ else if ("getState".equals(ctx.getName()) && !getStateExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- return new Integer(support.getState());
- }
- });
- }
- else if ("getStateString".equals(ctx.getName()))
+ return new Integer(serviceMixin.getState());
+ }
+ });
+ }
+ else if ("getStateString".equals(ctx.getName()) && !getStateExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
{
- ctx.setDispatcher(new AbstractInterceptor()
+ public Object invoke(Invocation invocation) throws Throwable
{
- public Object invoke(Invocation invocation) throws Throwable
- {
- return support.getStateString();
- }
- });
- }
+ return serviceMixin.getStateString();
+ }
+ });
}
+ else if ("getManagedResource".equals(ctx.getName()) && !getManagedResourceExists)
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return serviceMixin.getManagedResource();
+ }
+ });
+ }
}
}
- static
+ private static class ServiceMixin extends ServiceMBeanSupport
{
- try
+
+ /** . */
+ private final Object resource;
+
+ public ServiceMixin(Object resource)
{
- templateInfo = JavaBeanModelMBeanBuilder.build(Template.class, Object.class);
+ this.resource = resource;
}
- catch (Exception e)
+
+ protected void createService() throws Exception
{
- throw new Error(e);
+ execute("create");
}
- }
- /** . */
- private static final ModelMBeanInfo templateInfo;
-
- private static class Template
- {
- public int getState()
+ protected void startService() throws Exception
{
- throw new UnsupportedOperationException();
+ execute("start");
}
- public String getStateString()
+
+ protected void stopService() throws Exception
{
- throw new UnsupportedOperationException();
+ execute("stop");
}
- public void create()
+
+ protected void destroyService() throws Exception
{
- throw new UnsupportedOperationException();
+ execute("destroy");
}
- public void start()
+
+ public Object getManagedResource()
{
- throw new UnsupportedOperationException();
+ return resource;
}
- public void stop()
+
+ private void execute(String lifecycle) throws Exception
{
- throw new UnsupportedOperationException();
+ Method m = null;
+ try
+ {
+ m = resource.getClass().getMethod(lifecycle, new Class[0]);
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
+
+ //
+ if (m != null)
+ {
+ try
+ {
+ m.invoke(resource, new Object[0]);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new Error(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if (t instanceof Exception)
+ {
+ throw (Exception)t;
+ }
+ else if (t instanceof Error)
+ {
+ throw (Error)t;
+ }
+ else
+ {
+ throw new Error(t);
+ }
+ }
+ }
}
- public void destroy()
- {
- throw new UnsupportedOperationException();
- }
}
}
17 years, 5 months
JBoss Portal SVN: r6710 - trunk/core-admin.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-16 07:06:40 -0400 (Fri, 16 Mar 2007)
New Revision: 6710
Modified:
trunk/core-admin/.classpath
Log:
Updated Eclipse classpath
Modified: trunk/core-admin/.classpath
===================================================================
--- trunk/core-admin/.classpath 2007-03-16 10:53:54 UTC (rev 6709)
+++ trunk/core-admin/.classpath 2007-03-16 11:06:40 UTC (rev 6710)
@@ -20,5 +20,6 @@
<classpathentry kind="lib" path="/thirdparty/el/lib/el-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/jsp-api.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>
17 years, 5 months
JBoss Portal SVN: r6709 - trunk/jems/src/main/org/jboss/portal/jems/as/system.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-16 06:53:54 -0400 (Fri, 16 Mar 2007)
New Revision: 6709
Modified:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
Log:
fixed what I broke
Modified: trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-03-16 10:43:24 UTC (rev 6708)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-03-16 10:53:54 UTC (rev 6709)
@@ -122,6 +122,11 @@
}
};
+ public JBossServiceModelMBean(Object resource) throws MBeanException
+ {
+ this(resource, null, null);
+ }
+
public JBossServiceModelMBean(Object resource, Element config, String version) throws MBeanException
{
try
17 years, 5 months
JBoss Portal SVN: r6708 - in trunk/core-admin/src/resources/portal-admin-war/WEB-INF: jsf and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-03-16 06:43:24 -0400 (Fri, 16 Mar 2007)
New Revision: 6708
Added:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml
Modified:
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
Log:
Added a confirmation step on delete
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-16 02:27:26 UTC (rev 6707)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-03-16 10:43:24 UTC (rev 6708)
@@ -333,6 +333,10 @@
<from-outcome>dashboard</from-outcome>
<to-view-id>/WEB-INF/jsf/dashboard/dashboard.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>confirm</from-outcome>
+ <to-view-id>/WEB-INF/jsf/common/confirm.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
<lifecycle>
Added: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml (rev 0)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml 2007-03-16 10:43:24 UTC (rev 6708)
@@ -0,0 +1,47 @@
+<div
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:jbp="http://www.jboss.org/portal"
+ xmlns:c="http://java.sun.com/jstl/core"
+ class="admin-ui">
+
+ <p class="portlet-class">WARNING ! You are about to delete the following element of the portal:</p>
+ <ul class="objectpath">
+ <c:forEach items="#{portalobjectmgr.selectedObjectPath}" var="node">
+ <li>
+ >
+ </li>
+ <c:choose>
+ <c:when test="#{node.id == portalobjectmgr.selectedObject.id}">
+ <li class="selected">
+ <c:if test="#{node.name == ''}">root</c:if>
+ <c:if test="#{node.name != ''}">#{node.name}</c:if>
+ </li>
+ </c:when>
+ <c:otherwise>
+ <li>
+ <c:if test="#{node.name == ''}">root</c:if>
+ <c:if test="#{node.name != ''}">#{node.name}</c:if>
+ </li>
+ </c:otherwise>
+ </c:choose>
+ </c:forEach>
+ </ul>
+
+ <p class="portlet-class">Are you sure ?</p>
+
+ <h:form>
+ <h:commandLink action="objects" actionListener="#{portalobjectmgr.destroyObject}">
+ <h:outputText value="Yes"/>
+ <f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
+ </h:commandLink>
+ <h:outputText value=" | "/>
+ <h:commandLink action="objects" actionListener="#{portalobjectmgr.selectObject}">
+ <h:outputText value="No"/>
+ <f:param name="id" value="#{portalobjectmgr.selectedObject.parent.id}"/>
+ </h:commandLink>
+
+ </h:form>
+</div>
\ No newline at end of file
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-03-16 02:27:26 UTC (rev 6707)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-03-16 10:43:24 UTC (rev 6708)
@@ -34,10 +34,10 @@
actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Theme"/>
<f:param name="id" value="#{object.id}"/>
- </h:commandLink> | <h:commandLink action="objects" actionListener="#{portalobjectmgr.destroyObject}">
- <h:outputText value="Destroy"/>
- <f:param name="id" value="#{object.id}"/>
- </h:commandLink>
+ </h:commandLink> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectObject}">
+ <h:outputText value="Destroy"/>
+ <f:param name="id" value="#{object.id}"/>
+ </h:commandLink>
</td>
</tr>
</c:forEach>
@@ -71,7 +71,7 @@
</h:commandLink> | <h:commandLink action="editPageTheme" actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Theme"/>
<f:param name="id" value="#{object.id}"/>
- </h:commandLink> | <h:commandLink action="objects" actionListener="#{portalobjectmgr.destroyObject}">
+ </h:commandLink> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Destroy"/>
<f:param name="id" value="#{object.id}"/>
</h:commandLink>
@@ -101,10 +101,10 @@
<h:commandLink action="editWindowTheme" actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Theme"/>
<f:param name="id" value="#{object.id}"/>
- </h:commandLink> | <h:commandLink action="portals" actionListener="#{portalobjectmgr.destroyObject}">
- <h:outputText value="Destroy"/>
- <f:param name="id" value="#{object.id}"/>
- </h:commandLink>
+ </h:commandLink> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectObject}">
+ <h:outputText value="Destroy"/>
+ <f:param name="id" value="#{object.id}"/>
+ </h:commandLink>
</td>
</tr>
</c:forEach>
17 years, 5 months
JBoss Portal SVN: r6707 - in trunk/jems/src: main/org/jboss/portal/test/jems and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 22:27:26 -0400 (Thu, 15 Mar 2007)
New Revision: 6707
Added:
trunk/jems/src/main/org/jboss/portal/test/jems/ClassicService.java
Removed:
trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java
Modified:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java
trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml
Log:
actually merge the pojo service adapter with the jboss service adapter and make the decision at metadata build time wether to have the resource manage the state or manage it externally
Modified: trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-03-16 01:53:48 UTC (rev 6706)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossServiceModelMBean.java 2007-03-16 02:27:26 UTC (rev 6707)
@@ -24,7 +24,11 @@
import org.apache.log4j.Logger;
import org.jboss.mx.modelmbean.ModelMBeanInvoker;
+import org.jboss.mx.server.InvocationContext;
+import org.jboss.mx.server.Invocation;
+import org.jboss.mx.interceptor.AbstractInterceptor;
import org.jboss.portal.common.mx.JavaBeanModelMBeanBuilder;
+import org.jboss.portal.common.util.Tools;
import org.jboss.system.ServiceMBeanSupport;
import org.w3c.dom.Element;
@@ -33,6 +37,15 @@
import javax.management.MBeanInfo;
import javax.management.modelmbean.InvalidTargetObjectTypeException;
import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
+import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
+import javax.management.modelmbean.ModelMBeanConstructorInfo;
+import javax.management.modelmbean.ModelMBeanNotificationInfo;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -41,40 +54,171 @@
public class JBossServiceModelMBean extends ModelMBeanInvoker
{
-// Attributes ----------------------------------------------------
+ // Attributes ----------------------------------------------------
private static final Logger log = Logger.getLogger(JBossServiceModelMBean.class);
// Constructors --------------------------------------------------
- public JBossServiceModelMBean(Object resource, ModelMBeanInfo info) throws MBeanException
+ private final boolean pojo;
+
+ private final ServiceMBeanSupport support = new ServiceMBeanSupport()
{
- try
+ protected void createService() throws Exception
{
- setManagedResource(resource, "ObjectReference");
- setModelMBeanInfo(info);
+ execute("create");
}
- catch (InstanceNotFoundException e)
+ protected void startService() throws Exception
{
- throw new MBeanException(e);
+ execute("start");
}
- catch (InvalidTargetObjectTypeException e)
+ protected void stopService() throws Exception
{
- throw new MBeanException(e, "Unsupported resource type: " + resourceType);
+ execute("stop");
}
- }
+ protected void destroyService() throws Exception
+ {
+ execute("destroy");
+ }
+ private void execute(String lifecycle) throws Exception
+ {
+ Method m = null;
+ try
+ {
+ m = getResource().getClass().getMethod(lifecycle, new Class[0]);
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
- public JBossServiceModelMBean(Object resource) throws MBeanException
- {
- this(resource, null, null);
- }
+ //
+ if (m != null)
+ {
+ try
+ {
+ m.invoke(getResource(), new Object[0]);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new Error(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if (t instanceof Exception)
+ {
+ throw (Exception)t;
+ }
+ else if (t instanceof Error)
+ {
+ throw (Error)t;
+ }
+ else
+ {
+ throw new Error(t);
+ }
+ }
+ }
+ }
+ };
public JBossServiceModelMBean(Object resource, Element config, String version) throws MBeanException
{
try
{
setManagedResource(resource, "ObjectReference");
- ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), ServiceMBeanSupport.class);
+
+ //
+ pojo = !(resource instanceof ServiceMBeanSupport);
+
+ // Build
+ ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), pojo ? Object.class : ServiceMBeanSupport.class);
+
+ //
+ if (pojo)
+ {
+ //
+ List mmois = Tools.toList(info.getOperations());
+ List mmais = Tools.toList(info.getAttributes());
+
+ //
+ boolean createExists = false;
+ boolean startExists = false;
+ boolean stopExists = false;
+ boolean destroyExists = false;
+ boolean getStateExists = false;
+ boolean getStateStringExists = false;
+ for (int i = 0;i < mmois.size();i++)
+ {
+ ModelMBeanOperationInfo mmoi = (ModelMBeanOperationInfo)mmois.get(i);
+ if (mmoi.getSignature().length == 0)
+ {
+ if (mmoi.getName().equals("create"))
+ {
+ createExists = true;
+ }
+ else if (mmoi.getName().equals("start"))
+ {
+ startExists = true;
+ }
+ else if (mmoi.getName().equals("stop"))
+ {
+ stopExists = true;
+ }
+ else if (mmoi.getName().equals("destroy"))
+ {
+ destroyExists = true;
+ }
+ else if (mmoi.getName().equals("getState"))
+ {
+ getStateExists = true;
+ }
+ else if (mmoi.getName().equals("getStateString"))
+ {
+ getStateStringExists = true;
+ }
+ }
+ }
+
+ //
+ if (!createExists)
+ {
+ mmois.add(templateInfo.getOperation("create"));
+ }
+ if (!startExists)
+ {
+ mmois.add(templateInfo.getOperation("start"));
+ }
+ if (!stopExists)
+ {
+ mmois.add(templateInfo.getOperation("stop"));
+ }
+ if (!destroyExists)
+ {
+ mmois.add(templateInfo.getOperation("destroy"));
+ }
+ if (!getStateExists)
+ {
+ mmois.add(templateInfo.getOperation("getState"));
+ mmais.add(templateInfo.getAttribute("State"));
+ }
+ if (!getStateStringExists)
+ {
+ mmois.add(templateInfo.getOperation("getStateString"));
+ mmais.add(templateInfo.getAttribute("StateString"));
+ }
+
+ //
+ info = new ModelMBeanInfoSupport(
+ info.getClassName(),
+ info.getDescription(),
+ (ModelMBeanAttributeInfo[])mmais.toArray(new ModelMBeanAttributeInfo[mmais.size()]),
+ (ModelMBeanConstructorInfo[])info.getConstructors(),
+ (ModelMBeanOperationInfo[])mmois.toArray(new ModelMBeanOperationInfo[mmois.size()]),
+ (ModelMBeanNotificationInfo[])info.getNotifications());
+ }
+
+ //
setModelMBeanInfo(info);
}
catch (InstanceNotFoundException e)
@@ -102,4 +246,155 @@
{
return info;
}
+
+ //
+
+
+ protected void initDispatchers()
+ {
+ super.initDispatchers();
+
+ //
+ if (pojo)
+ {
+ //
+ for (Iterator i = attributeContextMap.values().iterator();i.hasNext();)
+ {
+ InvocationContext ctx = (InvocationContext)i.next();
+ if ("State".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return new Integer(support.getState());
+ }
+ });
+ }
+ else if ("StateString".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return support.getStateString();
+ }
+ });
+ }
+ }
+
+ //
+ for (Iterator i = operationContextMap.values().iterator();i.hasNext();)
+ {
+ InvocationContext ctx = (InvocationContext)i.next();
+ if ("create".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.create();
+ return null;
+ }
+ });
+ }
+ else if ("start".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.start();
+ return null;
+ }
+ });
+ }
+ else if ("stop".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.stop();
+ return null;
+ }
+ });
+ }
+ else if ("destroy".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.destroy();
+ return null;
+ }
+ });
+ }
+ else if ("getState".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return new Integer(support.getState());
+ }
+ });
+ }
+ else if ("getStateString".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return support.getStateString();
+ }
+ });
+ }
+ }
+ }
+ }
+
+ static
+ {
+ try
+ {
+ templateInfo = JavaBeanModelMBeanBuilder.build(Template.class, Object.class);
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ /** . */
+ private static final ModelMBeanInfo templateInfo;
+
+ private static class Template
+ {
+ public int getState()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public String getStateString()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void create()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void start()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void stop()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void destroy()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
}
Deleted: trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java 2007-03-16 01:53:48 UTC (rev 6706)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java 2007-03-16 02:27:26 UTC (rev 6707)
@@ -1,395 +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.jems.as.system;
-
-import org.jboss.mx.modelmbean.ModelMBeanInvoker;
-import org.jboss.mx.server.InvocationContext;
-import org.jboss.mx.server.Invocation;
-import org.jboss.mx.interceptor.AbstractInterceptor;
-import org.jboss.portal.common.mx.JavaBeanModelMBeanBuilder;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.system.ServiceMBeanSupport;
-import org.apache.log4j.Logger;
-import org.w3c.dom.Element;
-
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.InvalidTargetObjectTypeException;
-import javax.management.modelmbean.ModelMBeanInfoSupport;
-import javax.management.modelmbean.ModelMBeanOperationInfo;
-import javax.management.modelmbean.ModelMBeanAttributeInfo;
-import javax.management.modelmbean.ModelMBeanConstructorInfo;
-import javax.management.modelmbean.ModelMBeanNotificationInfo;
-import javax.management.MBeanException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanParameterInfo;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Iterator;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class POJOServiceModelMBean extends ModelMBeanInvoker
-{
-
-// Attributes ----------------------------------------------------
-
- private static final Logger log = Logger.getLogger(POJOServiceModelMBean.class);
-
- // Constructors --------------------------------------------------
-
- private boolean createExists;
- private boolean startExists;
- private boolean stopExists;
- private boolean destroyExists;
- private boolean getStateExists;
- private boolean getStateStringExists;
-
- private final ServiceMBeanSupport support = new ServiceMBeanSupport()
- {
- protected void createService() throws Exception
- {
- execute("create");
- }
- protected void startService() throws Exception
- {
- execute("start");
- }
- protected void stopService() throws Exception
- {
- execute("stop");
- }
- protected void destroyService() throws Exception
- {
- execute("destroy");
- }
- private void execute(String lifecycle) throws Exception
- {
- Method m = null;
- try
- {
- m = getResource().getClass().getMethod(lifecycle, new Class[0]);
- }
- catch (NoSuchMethodException ignore)
- {
- }
-
- //
- if (m != null)
- {
- try
- {
- m.invoke(getResource(), new Object[0]);
- }
- catch (IllegalAccessException e)
- {
- throw new Error(e);
- }
- catch (InvocationTargetException e)
- {
- Throwable t = e.getTargetException();
- if (t instanceof Exception)
- {
- throw (Exception)t;
- }
- else if (t instanceof Error)
- {
- throw (Error)t;
- }
- else
- {
- throw new Error(t);
- }
- }
- }
- }
- };
-
- public POJOServiceModelMBean(Object resource, Element config, String version) throws MBeanException
- {
- try
- {
- setManagedResource(resource, "ObjectReference");
-
- // Build
- ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), Object.class);
-
- //
- List mmois = Tools.toList(info.getOperations());
- List mmais = Tools.toList(info.getAttributes());
-
- //
- for (int i = 0;i < mmois.size();i++)
- {
- ModelMBeanOperationInfo mmoi = (ModelMBeanOperationInfo)mmois.get(i);
- if (mmoi.getSignature().length == 0)
- {
- if (mmoi.getName().equals("create"))
- {
- createExists = true;
- }
- else if (mmoi.getName().equals("start"))
- {
- startExists = true;
- }
- else if (mmoi.getName().equals("stop"))
- {
- stopExists = true;
- }
- else if (mmoi.getName().equals("destroy"))
- {
- destroyExists = true;
- }
- else if (mmoi.getName().equals("getState"))
- {
- getStateExists = true;
- }
- else if (mmoi.getName().equals("getStateString"))
- {
- getStateStringExists = true;
- }
- }
- }
-
- //
- if (!createExists)
- {
- mmois.add(templateInfo.getOperation("create"));
- }
- if (!startExists)
- {
- mmois.add(templateInfo.getOperation("start"));
- }
- if (!stopExists)
- {
- mmois.add(templateInfo.getOperation("stop"));
- }
- if (!destroyExists)
- {
- mmois.add(templateInfo.getOperation("destroy"));
- }
- if (!getStateExists)
- {
- mmois.add(templateInfo.getOperation("getState"));
- mmais.add(templateInfo.getAttribute("State"));
- }
- if (!getStateStringExists)
- {
- mmois.add(templateInfo.getOperation("getStateString"));
- mmais.add(templateInfo.getAttribute("StateString"));
- }
-
- //
- info = new ModelMBeanInfoSupport(
- info.getClassName(),
- info.getDescription(),
- (ModelMBeanAttributeInfo[])mmais.toArray(new ModelMBeanAttributeInfo[mmais.size()]),
- (ModelMBeanConstructorInfo[])info.getConstructors(),
- (ModelMBeanOperationInfo[])mmois.toArray(new ModelMBeanOperationInfo[mmois.size()]),
- (ModelMBeanNotificationInfo[])info.getNotifications());
-
- //
- setModelMBeanInfo(info);
- }
- catch (InstanceNotFoundException e)
- {
- throw new MBeanException(e);
- }
- catch (InvalidTargetObjectTypeException e)
- {
- throw new MBeanException(e, "Unsupported resource type: " + resourceType);
- }
- catch (Exception e)
- {
- throw new MBeanException(e);
- }
- }
-
- // ModelMBean implementation -------------------------------------
-
- public boolean isSupportedResourceType(Object resource, String resourceType)
- {
- return "ObjectReference".equals(resourceType);
- }
-
- public MBeanInfo getMBeanInfo()
- {
- return info;
- }
-
- //
-
-
- protected void initDispatchers()
- {
- super.initDispatchers();
-
- //
- for (Iterator i = attributeContextMap.values().iterator();i.hasNext();)
- {
- InvocationContext ctx = (InvocationContext)i.next();
- if ("State".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- return new Integer(support.getState());
- }
- });
- }
- else if ("StateString".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- return support.getStateString();
- }
- });
- }
- }
-
- //
- for (Iterator i = operationContextMap.values().iterator();i.hasNext();)
- {
- InvocationContext ctx = (InvocationContext)i.next();
- if ("create".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.create();
- return null;
- }
- });
- }
- else if ("start".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.start();
- return null;
- }
- });
- }
- else if ("stop".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.stop();
- return null;
- }
- });
- }
- else if ("destroy".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- support.destroy();
- return null;
- }
- });
- }
- else if ("getState".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- return new Integer(support.getState());
- }
- });
- }
- else if ("getStateString".equals(ctx.getName()))
- {
- ctx.setDispatcher(new AbstractInterceptor()
- {
- public Object invoke(Invocation invocation) throws Throwable
- {
- return support.getStateString();
- }
- });
- }
- }
- }
-
- static
- {
- try
- {
- templateInfo = JavaBeanModelMBeanBuilder.build(Template.class, Object.class);
- }
- catch (Exception e)
- {
- throw new Error(e);
- }
- }
-
- /** . */
- private static ModelMBeanInfo templateInfo;
-
- private static class Template
- {
- public int getState()
- {
- throw new UnsupportedOperationException();
- }
- public String getStateString()
- {
- throw new UnsupportedOperationException();
- }
- public void create()
- {
- throw new UnsupportedOperationException();
- }
- public void start()
- {
- throw new UnsupportedOperationException();
- }
- public void stop()
- {
- throw new UnsupportedOperationException();
- }
- public void destroy()
- {
- throw new UnsupportedOperationException();
- }
- }
-
-}
Added: trunk/jems/src/main/org/jboss/portal/test/jems/ClassicService.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/test/jems/ClassicService.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/test/jems/ClassicService.java 2007-03-16 02:27:26 UTC (rev 6707)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.test.jems;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassicService extends AbstractJBossService
+{
+
+ /** . */
+ private String string;
+
+ protected void createService()
+ {
+ System.out.println("create callback");
+ }
+
+ protected void startService()
+ {
+ System.out.println("start callback");
+ }
+
+ protected void stopService()
+ {
+ System.out.println("stop callback");
+ }
+
+ protected void destroyService()
+ {
+ System.out.println("destroy callback");
+ }
+
+ public void operation()
+ {
+ System.out.println("operation called");
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+}
Modified: trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java 2007-03-16 01:53:48 UTC (rev 6706)
+++ trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java 2007-03-16 02:27:26 UTC (rev 6707)
@@ -28,6 +28,10 @@
*/
public class POJOService
{
+
+ /** . */
+ private String string;
+
public void create()
{
System.out.println("create callback");
@@ -47,4 +51,19 @@
{
System.out.println("destroy callback");
}
+
+ public void operation()
+ {
+ System.out.println("operation called");
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
}
Modified: trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml 2007-03-16 01:53:48 UTC (rev 6706)
+++ trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml 2007-03-16 02:27:26 UTC (rev 6707)
@@ -29,7 +29,16 @@
code="org.jboss.portal.test.jems.POJOService"
name="portal.test:service=POJO"
xmbean-dd=""
- xmbean-code="org.jboss.portal.jems.as.system.POJOServiceModelMBean">
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
</mbean>
+
+ <!-- -->
+ <mbean
+ code="org.jboss.portal.test.jems.ClassicService"
+ name="portal.test:service=Classic"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
</server>
17 years, 5 months
JBoss Portal SVN: r6706 - in trunk: jems and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-03-15 21:53:48 -0400 (Thu, 15 Mar 2007)
New Revision: 6706
Added:
trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java
trunk/jems/src/main/org/jboss/portal/test/
trunk/jems/src/main/org/jboss/portal/test/jems/
trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java
trunk/jems/src/resources/
trunk/jems/src/resources/pojo-service-sar/
trunk/jems/src/resources/pojo-service-sar/META-INF/
trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml
Removed:
trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossService.java
Modified:
trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java
trunk/jems/build.xml
Log:
- added an alternative model mbean implementation which takes care of managing the JBoss service state and behavior in order to make services POJO instead of having to extends the AbstractJBossService class
Modified: trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java 2007-03-16 00:12:26 UTC (rev 6705)
+++ trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java 2007-03-16 01:53:48 UTC (rev 6706)
@@ -232,11 +232,11 @@
// Finally add the metadata
mmais.add(mmai);
-
- //
- className = from.getName();
}
+ //
+ className = from.getName();
+
// Methods->Operations
mmois = new ArrayList();
for (Iterator i = beanMethods.iterator(); i.hasNext();)
Modified: trunk/jems/build.xml
===================================================================
--- trunk/jems/build.xml 2007-03-16 00:12:26 UTC (rev 6705)
+++ trunk/jems/build.xml 2007-03-16 01:53:48 UTC (rev 6706)
@@ -168,6 +168,12 @@
</fileset>
</jar>
+ <jar jarfile="${build.lib}/pojo-service.sar">
+ <fileset dir="${build.classes}"/>
+ <fileset dir="${build.resources}/pojo-service-sar"/>
+ <fileset dir="${jboss.portal-common.root}/lib" includes="portal-common-lib.jar"/>
+ </jar>
+
</target>
<!-- ================================================================== -->
Deleted: trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossService.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossService.java 2007-03-16 00:12:26 UTC (rev 6705)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/JBossService.java 2007-03-16 01:53:48 UTC (rev 6706)
@@ -1,35 +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.jems.as.system;
-
-public interface JBossService
-{
-
- public void create() throws Exception;
-
- public void start() throws Exception;
-
- public void stop();
-
- public void destroy();
-}
Added: trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/jems/as/system/POJOServiceModelMBean.java 2007-03-16 01:53:48 UTC (rev 6706)
@@ -0,0 +1,395 @@
+/******************************************************************************
+ * 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.jems.as.system;
+
+import org.jboss.mx.modelmbean.ModelMBeanInvoker;
+import org.jboss.mx.server.InvocationContext;
+import org.jboss.mx.server.Invocation;
+import org.jboss.mx.interceptor.AbstractInterceptor;
+import org.jboss.portal.common.mx.JavaBeanModelMBeanBuilder;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.system.ServiceMBeanSupport;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+
+import javax.management.modelmbean.ModelMBeanInfo;
+import javax.management.modelmbean.InvalidTargetObjectTypeException;
+import javax.management.modelmbean.ModelMBeanInfoSupport;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
+import javax.management.modelmbean.ModelMBeanAttributeInfo;
+import javax.management.modelmbean.ModelMBeanConstructorInfo;
+import javax.management.modelmbean.ModelMBeanNotificationInfo;
+import javax.management.MBeanException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class POJOServiceModelMBean extends ModelMBeanInvoker
+{
+
+// Attributes ----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(POJOServiceModelMBean.class);
+
+ // Constructors --------------------------------------------------
+
+ private boolean createExists;
+ private boolean startExists;
+ private boolean stopExists;
+ private boolean destroyExists;
+ private boolean getStateExists;
+ private boolean getStateStringExists;
+
+ private final ServiceMBeanSupport support = new ServiceMBeanSupport()
+ {
+ protected void createService() throws Exception
+ {
+ execute("create");
+ }
+ protected void startService() throws Exception
+ {
+ execute("start");
+ }
+ protected void stopService() throws Exception
+ {
+ execute("stop");
+ }
+ protected void destroyService() throws Exception
+ {
+ execute("destroy");
+ }
+ private void execute(String lifecycle) throws Exception
+ {
+ Method m = null;
+ try
+ {
+ m = getResource().getClass().getMethod(lifecycle, new Class[0]);
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
+
+ //
+ if (m != null)
+ {
+ try
+ {
+ m.invoke(getResource(), new Object[0]);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new Error(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if (t instanceof Exception)
+ {
+ throw (Exception)t;
+ }
+ else if (t instanceof Error)
+ {
+ throw (Error)t;
+ }
+ else
+ {
+ throw new Error(t);
+ }
+ }
+ }
+ }
+ };
+
+ public POJOServiceModelMBean(Object resource, Element config, String version) throws MBeanException
+ {
+ try
+ {
+ setManagedResource(resource, "ObjectReference");
+
+ // Build
+ ModelMBeanInfo info = JavaBeanModelMBeanBuilder.build(resource.getClass(), Object.class);
+
+ //
+ List mmois = Tools.toList(info.getOperations());
+ List mmais = Tools.toList(info.getAttributes());
+
+ //
+ for (int i = 0;i < mmois.size();i++)
+ {
+ ModelMBeanOperationInfo mmoi = (ModelMBeanOperationInfo)mmois.get(i);
+ if (mmoi.getSignature().length == 0)
+ {
+ if (mmoi.getName().equals("create"))
+ {
+ createExists = true;
+ }
+ else if (mmoi.getName().equals("start"))
+ {
+ startExists = true;
+ }
+ else if (mmoi.getName().equals("stop"))
+ {
+ stopExists = true;
+ }
+ else if (mmoi.getName().equals("destroy"))
+ {
+ destroyExists = true;
+ }
+ else if (mmoi.getName().equals("getState"))
+ {
+ getStateExists = true;
+ }
+ else if (mmoi.getName().equals("getStateString"))
+ {
+ getStateStringExists = true;
+ }
+ }
+ }
+
+ //
+ if (!createExists)
+ {
+ mmois.add(templateInfo.getOperation("create"));
+ }
+ if (!startExists)
+ {
+ mmois.add(templateInfo.getOperation("start"));
+ }
+ if (!stopExists)
+ {
+ mmois.add(templateInfo.getOperation("stop"));
+ }
+ if (!destroyExists)
+ {
+ mmois.add(templateInfo.getOperation("destroy"));
+ }
+ if (!getStateExists)
+ {
+ mmois.add(templateInfo.getOperation("getState"));
+ mmais.add(templateInfo.getAttribute("State"));
+ }
+ if (!getStateStringExists)
+ {
+ mmois.add(templateInfo.getOperation("getStateString"));
+ mmais.add(templateInfo.getAttribute("StateString"));
+ }
+
+ //
+ info = new ModelMBeanInfoSupport(
+ info.getClassName(),
+ info.getDescription(),
+ (ModelMBeanAttributeInfo[])mmais.toArray(new ModelMBeanAttributeInfo[mmais.size()]),
+ (ModelMBeanConstructorInfo[])info.getConstructors(),
+ (ModelMBeanOperationInfo[])mmois.toArray(new ModelMBeanOperationInfo[mmois.size()]),
+ (ModelMBeanNotificationInfo[])info.getNotifications());
+
+ //
+ setModelMBeanInfo(info);
+ }
+ catch (InstanceNotFoundException e)
+ {
+ throw new MBeanException(e);
+ }
+ catch (InvalidTargetObjectTypeException e)
+ {
+ throw new MBeanException(e, "Unsupported resource type: " + resourceType);
+ }
+ catch (Exception e)
+ {
+ throw new MBeanException(e);
+ }
+ }
+
+ // ModelMBean implementation -------------------------------------
+
+ public boolean isSupportedResourceType(Object resource, String resourceType)
+ {
+ return "ObjectReference".equals(resourceType);
+ }
+
+ public MBeanInfo getMBeanInfo()
+ {
+ return info;
+ }
+
+ //
+
+
+ protected void initDispatchers()
+ {
+ super.initDispatchers();
+
+ //
+ for (Iterator i = attributeContextMap.values().iterator();i.hasNext();)
+ {
+ InvocationContext ctx = (InvocationContext)i.next();
+ if ("State".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return new Integer(support.getState());
+ }
+ });
+ }
+ else if ("StateString".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return support.getStateString();
+ }
+ });
+ }
+ }
+
+ //
+ for (Iterator i = operationContextMap.values().iterator();i.hasNext();)
+ {
+ InvocationContext ctx = (InvocationContext)i.next();
+ if ("create".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.create();
+ return null;
+ }
+ });
+ }
+ else if ("start".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.start();
+ return null;
+ }
+ });
+ }
+ else if ("stop".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.stop();
+ return null;
+ }
+ });
+ }
+ else if ("destroy".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ support.destroy();
+ return null;
+ }
+ });
+ }
+ else if ("getState".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return new Integer(support.getState());
+ }
+ });
+ }
+ else if ("getStateString".equals(ctx.getName()))
+ {
+ ctx.setDispatcher(new AbstractInterceptor()
+ {
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return support.getStateString();
+ }
+ });
+ }
+ }
+ }
+
+ static
+ {
+ try
+ {
+ templateInfo = JavaBeanModelMBeanBuilder.build(Template.class, Object.class);
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ /** . */
+ private static ModelMBeanInfo templateInfo;
+
+ private static class Template
+ {
+ public int getState()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public String getStateString()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void create()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void start()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void stop()
+ {
+ throw new UnsupportedOperationException();
+ }
+ public void destroy()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+}
Added: trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java (rev 0)
+++ trunk/jems/src/main/org/jboss/portal/test/jems/POJOService.java 2007-03-16 01:53:48 UTC (rev 6706)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * 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.test.jems;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class POJOService
+{
+ public void create()
+ {
+ System.out.println("create callback");
+ }
+
+ public void start()
+ {
+ System.out.println("start callback");
+ }
+
+ public void stop()
+ {
+ System.out.println("stop callback");
+ }
+
+ public void destroy()
+ {
+ System.out.println("destroy callback");
+ }
+}
Added: trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml (rev 0)
+++ trunk/jems/src/resources/pojo-service-sar/META-INF/jboss-service.xml 2007-03-16 01:53:48 UTC (rev 6706)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<server>
+
+ <!-- -->
+ <mbean
+ code="org.jboss.portal.test.jems.POJOService"
+ name="portal.test:service=POJO"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.POJOServiceModelMBean">
+ <xmbean/>
+ </mbean>
+</server>
17 years, 5 months