[jboss-svn-commits] JBoss Portal SVN: r5463 - in trunk/management: . src src/etc src/main src/main/org src/main/org/jboss src/main/org/jboss/portal src/main/org/jboss/portal/management src/resources src/resources/portal-management-sar src/resources/portal-management-sar/META-INF

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 16 05:28:53 EDT 2006


Author: thomas.heute at jboss.com
Date: 2006-10-16 05:28:46 -0400 (Mon, 16 Oct 2006)
New Revision: 5463

Added:
   trunk/management/.classpath
   trunk/management/.cvsignore
   trunk/management/.project
   trunk/management/build.bat
   trunk/management/build.sh
   trunk/management/build.xml
   trunk/management/src/
   trunk/management/src/etc/
   trunk/management/src/etc/portal-management-lib-jar.mf
   trunk/management/src/etc/portal-management-lib-sar.mf
   trunk/management/src/main/
   trunk/management/src/main/org/
   trunk/management/src/main/org/jboss/
   trunk/management/src/main/org/jboss/portal/
   trunk/management/src/main/org/jboss/portal/management/
   trunk/management/src/main/org/jboss/portal/management/Portal.java
   trunk/management/src/main/org/jboss/portal/management/PortalImpl.java
   trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistry.java
   trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistryImpl.java
   trunk/management/src/resources/
   trunk/management/src/resources/portal-management-sar/
   trunk/management/src/resources/portal-management-sar/META-INF/
   trunk/management/src/resources/portal-management-sar/META-INF/jboss-service.xml
Log:
Initial import.

Added: trunk/management/.classpath
===================================================================
--- trunk/management/.classpath	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/.classpath	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
+	<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/cms"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jems"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/portlet"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/common"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: trunk/management/.cvsignore
===================================================================
--- trunk/management/.cvsignore	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/.cvsignore	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,2 @@
+bin
+output


Property changes on: trunk/management/.cvsignore
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/management/.project
===================================================================
--- trunk/management/.project	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/.project	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>management</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: trunk/management/build.bat
===================================================================
--- trunk/management/build.bat	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/build.bat	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,54 @@
+ at echo off
+rem
+rem  Invokes a script of the same name in the 'tools' module.
+rem  
+rem  The 'tools' module is expected to be a peer directory of the directory
+rem  in which this script lives.
+rem
+rem  @author Jason Dillon <jason at planet57.com>
+rem
+
+rem $Id: build.bat 3151 2006-07-19 12:03:43 +0000 (Wed, 19 Jul 2006) julien $
+
+setlocal
+
+set PROGNAME=%~nx0
+set DIRNAME=%~dp0
+
+rem Legacy shell support
+if x%PROGNAME%==x set PROGNAME=build.bat
+if x%DIRNAME%==x set DIRNAME=.\
+
+set MODULE_ROOT=%DIRNAME%
+if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
+set TARGET=%TOOLS_ROOT%\bin\build.bat
+set ARGS=%*
+
+rem Start'er up yo
+goto main
+
+:debug
+if not x%DEBUG%==x echo %PROGNAME%: %*
+goto :EOF
+
+:main
+call :debug PROGNAME=%PROGNAME%
+call :debug DIRNAME=%DIRNAME%
+call :debug TOOLS_ROOT=%TOOLS_ROOT%
+call :debug TARGET=%TARGET%
+
+if exist %TARGET% call :call-script & goto :EOF
+rem else fail, we can not go on
+
+echo %PROGNAME%: *ERROR* The target executable does not exist:
+echo %PROGNAME%:
+echo %PROGNAME%:    %TARGET%
+echo %PROGNAME%:
+echo %PROGNAME%: Please make sure you have checked out the 'tools' module
+echo %PROGNAME%: and make sure it is up to date.
+goto :EOF
+
+:call-script
+call :debug Executing %TARGET% %ARGS%
+call %TARGET% %ARGS%
+goto :EOF


Property changes on: trunk/management/build.bat
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/management/build.sh
===================================================================
--- trunk/management/build.sh	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/build.sh	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,49 @@
+#!/bin/sh
+##
+##  Invokes a script of the same name in the 'tools' module.
+##  
+##  The 'tools' module is expected to be a peer directory of the directory
+##  in which this script lives.
+##
+##  @author Jason Dillon <jason at planet57.com>
+##
+
+# $Id: build.sh 3151 2006-07-19 12:03:43 +0000 (Wed, 19 Jul 2006) julien $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+
+# Buss it yo
+main() {
+    if [ "x$TOOLS_ROOT" = "x" ]; then
+	TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
+    fi
+
+    MODULE_ROOT=`cd $DIRNAME; pwd`
+    export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
+
+    # Where is the target script?
+    target="$TOOLS_ROOT/bin/$PROGNAME"
+    if [ ! -f "$target" ]; then
+	echo "${PROGNAME}: *ERROR* The target executable does not exist:"
+        echo "${PROGNAME}:"
+        echo "${PROGNAME}:    $target"
+        echo "${PROGNAME}:"
+	echo "${PROGNAME}: Please make sure you have checked out the 'tools' module"
+	echo "${PROGNAME}: and make sure it is up to date."
+        exit 2
+    fi
+
+    # Get busy yo!
+    if [ "x$DEBUG" != "x" ]; then
+	echo "${PROGNAME}: Executing: /bin/sh $target $@"
+    fi
+    if [ "x$TRACE" = "x" ]; then
+	exec /bin/sh $target "$@"
+    else
+	exec /bin/sh -x $target "$@"
+    fi
+}
+
+# Lets get ready to rumble!
+main "$@"


Property changes on: trunk/management/build.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/management/build.xml
===================================================================
--- trunk/management/build.xml	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/build.xml	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+   <!ENTITY libraries  SYSTEM "../thirdparty/libraries.ent">
+   <!ENTITY buildmagic SYSTEM "../tools/etc/buildfragments/buildmagic.ent">
+   <!ENTITY tools      SYSTEM "../tools/etc/buildfragments/tools.ent">  
+   <!ENTITY modules    SYSTEM "../tools/etc/buildfragments/modules.ent">
+   <!ENTITY defaults   SYSTEM "../tools/etc/buildfragments/defaults.ent">
+   <!ENTITY targets    SYSTEM "../tools/etc/buildfragments/targets.ent">
+   ]>
+
+<!-- $Id: build.xml 5299 2006-09-30 01:45:48 +0200 (Sat, 30 Sep 2006) sohil.shah at jboss.com $ -->
+
+<!--+======================================================================+-->
+<!--| JBoss Portal (The OpenSource Portal) Build File                      |-->
+<!--|                                                                      |-->
+<!--| Distributable under LGPL license.                                    |-->
+<!--| See terms of license at http://www.gnu.org.                          |-->
+<!--|                                                                      |-->
+<!--| This file has been designed to work with the 'tools' module and      |-->
+<!--| Buildmagic extentions.                                               |-->
+<!--+======================================================================+-->
+
+<project default="main" name="JBoss Portal">
+
+   <!--+====================================================================+-->
+   <!--| Setup                                                              |-->
+   <!--|                                                                    |-->
+   <!--| Include the common build elements.                                 |-->
+   <!--|                                                                    |-->
+   <!--| This defines several different targets, properties and paths.      |-->
+   <!--| It also sets up the basic extention tasks amoung other things.     |-->
+   <!--+====================================================================+-->
+
+   &buildmagic;
+   &modules;
+   &defaults;
+   &tools;
+   &targets;
+
+   <!-- ================================================================== -->
+   <!-- Initialization                                                     -->
+   <!-- ================================================================== -->
+
+   <!--
+      | Initialize the build system.  Must depend on '_buildmagic:init'.
+      | Other targets should depend on 'init' or things will mysteriously fail.
+    -->
+
+   <target name="init" unless="init.disable" depends="_buildmagic:init">
+   </target>
+
+   <!--+====================================================================+-->
+   <!--| Configuration                                                      |-->
+   <!--|                                                                    |-->
+   <!--| This target is invoked by the Buildmagic initialization logic      |-->
+   <!--| and should contain module specific configuration elements.         |-->
+   <!--+====================================================================+-->
+
+   <target name="configure" unless="configure.disable">
+
+      <!-- Configure some properties -->
+      <property name="jboss-junit-configuration" value=""/>
+      <property name="junit.formatter.usefile" value="true"/>
+
+      <!-- Configure thirdparty libraries -->
+      &libraries;
+      <path id="library.classpath">
+        <path refid="jbossas/core.libs.classpath"/>         
+
+      	<!--path refid="apache.logging.classpath"/>
+	     <path refid="apache.xerces.classpath"/>
+	     <path refid="apache.log4j.classpath"/>
+	     <path refid="apache.collections.classpath"/>
+	     <path refid="apache.lucene.classpath"/>
+         <path refid="jboss.jbossxb.classpath"/>
+         <path refid="jboss.cache.classpath"/>         
+         <path refid="oswego.concurrent.classpath"/>
+         <path refid="jboss.microcontainer.classpath"/>
+         <path refid="hibernate.hibernate.classpath"/>
+         <path refid="ehcache.ehcache.classpath"/>
+         <path refid="jakarta.io.classpath"/>         
+         <path refid="junit.junit.classpath"/>
+         <path refid="jackrabbit.jackrabbit.classpath"/>
+         <path refid="slf4j.slf4j.classpath"/>
+         <path refid="sun.jaf.classpath"/>
+         <path refid="xdoclet.xdoclet.classpath"/>
+         <path refid="jcr.jcr.classpath"/>
+
+   	     <path refid="jgroups.jgroups.classpath"/>
+		 <path refid="sun.servlet.classpath"/-->
+      </path>
+      
+      
+
+      <path id="javac.classpath">
+         <pathelement location="${build.classes}"/>
+      </path>
+
+      <property name="javac.excludes" value="**/jdbc/**"/>
+
+      <!-- Configure modules -->
+      <call target="configure-modules"/>
+      <path id="dependentmodule.classpath">
+        <path refid="jboss.portal-jems.classpath"/>
+        <path refid="jboss.portal-core.classpath"/>
+        <path refid="jboss.portal-cms.classpath"/>
+        <path refid="jboss.portal-portlet.classpath"/>
+      	<path refid="jboss.portal-server.classpath"/>
+        <path refid="jboss.portal-common.classpath"/>		 
+        <!--path refid="jboss.portal-test.classpath"/>	
+
+		 <path refid="jboss.portlet-api.classpath"/ -->
+      </path>
+
+
+      <!--+=======================================+-->
+      <!--| Override any default properties here. |-->
+      <!--+=======================================+-->
+
+      <!-- Configure defaults & build tools -->
+      <call target="configure-defaults"/>
+      <call target="configure-tools"/>
+
+      <!--+=======================================+-->
+      <!--| Define module specific elements here. |-->
+      <!--+=======================================+-->
+      <property name="javadoc.private" value="true"/>
+      <property name="javadoc.protected" value="false"/>
+
+   </target>
+
+   <!--+====================================================================+-->
+   <!--| Compile                                                            |-->
+   <!--|                                                                    |-->
+   <!--| This target should depend on other compile-* targets for each      |-->
+   <!--| different type of compile that needs to be performed, short of     |-->
+   <!--| documentation compiles.                                            |-->
+   <!--+====================================================================+-->
+
+   <target name="compile"
+           description="Compile all source files."
+           depends="_default:compile-classes,
+                   _default:compile-etc,
+                   _default:compile-resources">
+      <!-- Add module specific elements here. -->
+   </target>
+
+   <!--+====================================================================+-->
+   <!--| Generate Output                                                    |-->
+   <!--|                                                                    |-->
+   <!--| Generates the target output for this module. Target output is      |-->
+   <!--| the output which is ment to be released or used by external        |-->
+   <!--| modules.                                                           |-->
+   <!--+====================================================================+-->
+
+   <target name="output"
+           description="Generate all target output."
+           depends="compile">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/portal-management-lib.jar" manifest="${build.etc}/portal-management-lib-jar.mf">
+         <fileset dir="${build.classes}"/>
+         <!--fileset dir="${build.resources}/portal-management-jar"/-->
+      </jar>
+
+      <jar jarfile="${build.lib}/portal-management.sar" manifest="${build.etc}/portal-management-lib-sar.mf">
+         <fileset dir="${build.resources}/portal-management-sar"/>
+         <fileset dir="${build.lib}" includes="portal-management-lib.jar"/>
+      </jar>
+		
+   </target>
+	
+   <!-- ================================================================== -->
+   <!-- Cleaning                                                           -->
+   <!-- ================================================================== -->
+
+   <!-- Clean up all build output -->
+   <target name="clean" depends="_default:clean">
+      <!-- Add module specific elements here. -->
+   </target>
+
+   <!--+====================================================================+-->
+   <!--| Documents                                                          |-->
+   <!--|                                                                    |-->
+   <!--| Generate all documentation for this module.                        |-->
+   <!--+====================================================================+-->
+
+   <target name="docs" depends="_default:docs">
+      <!-- Add module specific elements here. -->
+   </target>
+
+   <!-- ================================================================== -->
+   <!-- Misc.                                                              -->
+   <!-- ================================================================== -->
+
+   <target name="main" depends="most"/>
+   <target name="all" depends="_default:all"/>
+   <target name="most" depends="_default:most"/>
+   <target name="help" depends="_default:help"/>
+
+</project>


Property changes on: trunk/management/build.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/management/src/etc/portal-management-lib-jar.mf
===================================================================
--- trunk/management/src/etc/portal-management-lib-jar.mf	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/etc/portal-management-lib-jar.mf	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@


Property changes on: trunk/management/src/etc/portal-management-lib-jar.mf
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/management/src/etc/portal-management-lib-sar.mf
===================================================================
--- trunk/management/src/etc/portal-management-lib-sar.mf	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/etc/portal-management-lib-sar.mf	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Created-By: @java.vm.version@ (@java.vm.vendor@)
+Specification-Title: @specification.title@
+Specification-Version: @specification.version@
+Specification-Vendor: @specification.vendor@
+Implementation-Title: @implementation.title@
+Implementation-URL: @implementation.url@
+Implementation-Version: @implementation.version@
+Implementation-Vendor: @implementation.vendor@
+Implementation-Vendor-Id: @implementation.vendor.id@


Property changes on: trunk/management/src/etc/portal-management-lib-sar.mf
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/management/src/main/org/jboss/portal/management/Portal.java
===================================================================
--- trunk/management/src/main/org/jboss/portal/management/Portal.java	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/main/org/jboss/portal/management/Portal.java	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.management;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface Portal {
+	
+	public int getNbInstances();
+}

Added: trunk/management/src/main/org/jboss/portal/management/PortalImpl.java
===================================================================
--- trunk/management/src/main/org/jboss/portal/management/PortalImpl.java	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/main/org/jboss/portal/management/PortalImpl.java	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.management;
+
+import org.jboss.portal.core.model.instance.InstanceContainer;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortalImpl extends AbstractJBossService implements Portal {
+
+	private InstanceContainer instanceContainer;
+	
+	public int getNbInstances()
+	{
+		return instanceContainer.getInstances().size();
+	}
+	
+	public void setInstanceContainer(InstanceContainer instanceContainer)
+	{
+		this.instanceContainer = instanceContainer;
+	}
+
+}

Added: trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistry.java
===================================================================
--- trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistry.java	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistry.java	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,31 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.management;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface PortletContainerRegistry
+{
+
+}

Added: trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistryImpl.java
===================================================================
--- trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistryImpl.java	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/main/org/jboss/portal/management/PortletContainerRegistryImpl.java	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,147 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.management;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.invocation.Interceptor;
+import org.jboss.portal.portlet.container.PortletApplicationRegistry;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
+import org.jboss.portal.portlet.management.PortletContainerManagementInterceptorImpl;
+import org.jboss.portal.portlet.management.PortletContainerManager;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletContainerRegistryImpl extends ServiceMBeanSupport implements PortletContainerRegistry, org.jboss.portal.portlet.container.PortletContainerRegistryListener
+{
+   private final static Logger log = Logger.getLogger(PortletContainerRegistryImpl.class);
+
+   public static final String JMX_PREFIX = "portal:service=Management,type=PortletContainer,name=";
+   
+   private PortletApplicationRegistry registry;
+   
+   private PortletContainerManagementInterceptor interceptor;
+   
+   private List portletContainers = new ArrayList(); 
+   
+   public void create()
+   {
+      registry.addListener(this);
+   }
+   
+   public void destroy()
+   {
+      registry.removeListener(this);
+   }
+   
+   public void start()
+   {
+      Collection startedPortletContainers = registry.getPortletContainers();
+      Iterator it = startedPortletContainers.iterator();
+      while (it.hasNext())
+      {
+         PortletContainer portlet = (PortletContainer)it.next();
+         registerPortletContainer(portlet);
+      }
+   }
+
+   public void stop()
+   {
+      Iterator it = portletContainers.iterator();
+      while (it.hasNext())
+      {
+         PortletContainer portlet = (PortletContainer)it.next();
+         unregisterPortletContainer(portlet);
+      }
+      if (portletContainers.size() != 0)
+      {
+         log.error("Unable to remove all the PortletContainer manager MBeans");
+      }
+   }
+   
+   public void registerPortletContainer(PortletContainer portlet)
+   {
+      log.debug("Registering Management MBean: " + portlet.getContext().getId());
+      try
+      {
+         createPortletContainerManagemenentMBean(portlet);
+         portletContainers.add(portlet);
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   public void unregisterPortletContainer(PortletContainer portlet)
+   {
+      log.debug("Unregistering Management MBean: " + portlet.getContext().getId());
+      try
+      {
+         destroyPortletContainerManagemenentMBean(portlet);
+         portletContainers.remove(portlet);
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+   
+   public void setRegistry(PortletApplicationRegistry registry)
+   {
+      this.registry = registry;
+   }
+
+   public void setInterceptor(PortletContainerManagementInterceptor interceptor)
+   {
+      this.interceptor = interceptor;
+   }
+
+   private void createPortletContainerManagemenentMBean(PortletContainer portlet) throws Exception
+   {
+      PortletContainerManager manager = new PortletContainerManager(portlet, interceptor);
+      ObjectName objectName = new ObjectName(getMBeanName(portlet));
+      getServer().registerMBean(manager, objectName);
+   }
+   
+   private void destroyPortletContainerManagemenentMBean(PortletContainer portlet) throws Exception
+   {
+      ObjectName objectName = new ObjectName(getMBeanName(portlet));
+      getServer().unregisterMBean(objectName);
+   }
+   
+   private String getMBeanName(PortletContainer portlet)
+   {
+      return JMX_PREFIX + portlet.getContext().getId();
+   }
+   
+}

Added: trunk/management/src/resources/portal-management-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/management/src/resources/portal-management-sar/META-INF/jboss-service.xml	2006-10-16 09:27:52 UTC (rev 5462)
+++ trunk/management/src/resources/portal-management-sar/META-INF/jboss-service.xml	2006-10-16 09:28:46 UTC (rev 5463)
@@ -0,0 +1,28 @@
+<server> 
+	<mbean
+      code="org.jboss.portal.management.PortalImpl"
+      name="portal:service=Management,type=Portal,name=Default"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <depends
+         optional-attribute-name="InstanceContainer"
+         proxy-type="attribute">portal:container=Instance</depends>
+      <xmbean/>
+   </mbean>  
+
+	<mbean
+      code="org.jboss.portal.management.PortletContainerRegistryImpl"
+      name="portal:service=Management,type=PortletContainerRegistry,name=Default"
+      xmbean-dd=""
+      xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+      <depends
+         optional-attribute-name="Registry"
+         proxy-type="attribute">portal:service=WebAppRegistry</depends>
+      <xmbean/>
+      <depends
+         optional-attribute-name="Interceptor"
+         proxy-type="attribute">portal:service=ManagementInterceptor,type=Portlet,name=PortletContainer</depends>
+      <xmbean/>
+   </mbean>  
+   
+</server>


Property changes on: trunk/management/src/resources/portal-management-sar/META-INF/jboss-service.xml
___________________________________________________________________
Name: svn:executable
   + *




More information about the jboss-svn-commits mailing list