Author: julien(a)jboss.com
Date: 2007-09-06 09:12:47 -0400 (Thu, 06 Sep 2007)
New Revision: 8188
Added:
modules/common/trunk/mc/
modules/common/trunk/mc/.classpath
modules/common/trunk/mc/.cvsignore
modules/common/trunk/mc/.project
modules/common/trunk/mc/build.bat
modules/common/trunk/mc/build.sh
modules/common/trunk/mc/build.xml
modules/common/trunk/mc/src/
modules/common/trunk/mc/src/main/
modules/common/trunk/mc/src/main/org/
modules/common/trunk/mc/src/main/org/jboss/
modules/common/trunk/mc/src/main/org/jboss/portal/
modules/common/trunk/mc/src/main/org/jboss/portal/common/
modules/common/trunk/mc/src/main/org/jboss/portal/common/mc/
modules/common/trunk/mc/src/main/org/jboss/portal/common/mc/bootstrap/
modules/common/trunk/mc/src/main/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
Removed:
modules/common/trunk/common/src/main/org/jboss/portal/common/concurrent/loader/
modules/common/trunk/common/src/main/org/jboss/portal/common/mx/ProxyUnwrapperInterceptor.java
modules/common/trunk/common/src/main/org/jboss/portal/test/common/ObjectLoaderTestCase.java
Modified:
modules/common/trunk/build/build-thirdparty.xml
modules/common/trunk/build/build.xml
modules/common/trunk/common/build.xml
modules/common/trunk/common/src/main/org/jboss/portal/common/net/URLTools.java
Log:
added mc module to common which contains mc common code
Modified: modules/common/trunk/build/build-thirdparty.xml
===================================================================
--- modules/common/trunk/build/build-thirdparty.xml 2007-09-06 12:48:33 UTC (rev 8187)
+++ modules/common/trunk/build/build-thirdparty.xml 2007-09-06 13:12:47 UTC (rev 8188)
@@ -51,14 +51,30 @@
<componentref name="apache-httpclient" version="3.0.1"/>
<componentref name="apache-log4j" version="1.2.8"/>
<componentref name="jbossas/core-libs"
version="4.0.4.GA"/>
- <componentref name="jboss/backport-concurrent"
version="2.1.0.GA"/>
- <componentref name="jboss/jbossretro-rt"
version="1.0.3.GA"/>
<componentref name="jboss/test" version="1.0.0.CR1"/>
<componentref name="junit" version="3.8.1"/>
<componentref name="oswego-concurrent" version="1.3.4"/>
<componentref name="sun-jaf" version="1.0.2"/>
<componentref name="sun-javamail" version="1.3.1"/>
<componentref name="sun-servlet" version="2.4"/>
+
+ <!-- Based on
http://anonsvn.jboss.org/repos/jbossas/tags/EMBEDDED_JBOSS_BETA_2/build/b...
-->
+ <componentref name="jboss/microcontainer"
version="2.0.0.Beta3"/>
+ <componentref name="jboss/aop" version="2.0.0.alpha4"/>
+ <componentref name="jboss/jbossxb" version="2.0.0.CR2"/>
+ <componentref name="jboss/jboss-vfs"
version="2.0.0.Beta4"/>
+ <componentref name="jboss/common-core"
version="2.0.4.Alpha"/>
+ <componentref name="jboss/common-logging-log4j"
version="2.0.2.GA"/>
+ <componentref name="jboss/common-logging-jdk"
version="2.0.2.GA"/>
+ <componentref name="jboss/common-logging-spi"
version="2.0.2.GA"/>
+ <componentref name="javassist" version="3.5.0.CR1"/>
+ <componentref name="apache-log4j" version="1.2.14"/>
+ <componentref name="apache-xerces" version="2.7.1"/>
+ <componentref name="sun-jaf" version="1.1"/>
+ <componentref name="junit" version="3.8.1"/>
+ <componentref name="wutka-dtdparser" version="1.2.1"/>
+ <componentref name="trove" version="1.0.2"/>
+
</build>
<synchronizeinfo/>
Modified: modules/common/trunk/build/build.xml
===================================================================
--- modules/common/trunk/build/build.xml 2007-09-06 12:48:33 UTC (rev 8187)
+++ modules/common/trunk/build/build.xml 2007-09-06 13:12:47 UTC (rev 8188)
@@ -113,12 +113,13 @@
<module name="common"/>
<module name="portal"/>
+ <module name="mc"/>
<!-- Module groups -->
<group name="common">
<include
- modules="common,portal"/>
+ modules="common,portal,mc"/>
</group>
<group name="default">
Modified: modules/common/trunk/common/build.xml
===================================================================
--- modules/common/trunk/common/build.xml 2007-09-06 12:48:33 UTC (rev 8187)
+++ modules/common/trunk/common/build.xml 2007-09-06 13:12:47 UTC (rev 8188)
@@ -65,22 +65,14 @@
<!-- Configure thirdparty libraries -->
&libraries;
- <path id="jbossas_restriction">
- <pathelement
location="${jbossas/core.libs.lib}/jboss-jmx.jar"/>
- <pathelement
location="${jbossas/core.libs.lib}/jboss-j2ee.jar"/>
- <pathelement
location="${jbossas/core.libs.lib}/jboss-common.jar"/>
- </path>
-
<path id="library.classpath">
<path refid="sun.jaf.classpath"/>
<path refid="sun.servlet.classpath"/>
<path refid="oswego.concurrent.classpath"/>
- <path refid="jbossas_restriction"/>
<path refid="apache.ant.classpath"/>
<path refid="apache.log4j.classpath"/>
<pathelement
location="${jbossas/core.libs.lib}jboss-j2ee.jar"/>
<path refid="junit.junit.classpath"/>
- <path refid="jboss/backport.concurrent.classpath"/>
<path refid="apache.httpclient.classpath"/>
<pathelement
location="../tools/lib/cargo-core-uberjar-0.8.jar"/>
<pathelement location="../tools/lib/cargo-ant-0.8.jar"/>
@@ -224,7 +216,6 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameIteratorTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.BundleNameParserTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.ComplexResourceBundleFactoryTestCase"/>
- <test todir="${test.reports}"
name="org.jboss.portal.test.common.ObjectLoaderTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.MarkupTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.TypedMapTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.common.AbstractInvocationContextTestCase"/>
Deleted:
modules/common/trunk/common/src/main/org/jboss/portal/common/mx/ProxyUnwrapperInterceptor.java
===================================================================
---
modules/common/trunk/common/src/main/org/jboss/portal/common/mx/ProxyUnwrapperInterceptor.java 2007-09-06
12:48:33 UTC (rev 8187)
+++
modules/common/trunk/common/src/main/org/jboss/portal/common/mx/ProxyUnwrapperInterceptor.java 2007-09-06
13:12:47 UTC (rev 8188)
@@ -1,78 +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.common.mx;
-
-import org.jboss.mx.interceptor.AbstractInterceptor;
-import org.jboss.mx.server.Invocation;
-import org.jboss.mx.server.registry.MBeanEntry;
-import org.jboss.mx.util.MBeanProxyExt;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-import java.lang.reflect.Proxy;
-
-/**
- * An XMBean interceptor that unwraps the proxy injected by the microkernel when it is
possible.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5451 $
- */
-public class ProxyUnwrapperInterceptor extends AbstractInterceptor
-{
- public Object invoke(Invocation invocation) throws Throwable
- {
- // Intercept set attribute only
- if (Invocation.OP_SETATTRIBUTE.equals(invocation.getType()))
- {
- Object value = invocation.getArgs()[0];
-
- // If the value is a proxy
- if (Proxy.isProxyClass(value.getClass()))
- {
- // Get the proxy
- Object handler = Proxy.getInvocationHandler(value);
-
- // If it is a JBoss service proxy
- if (handler instanceof MBeanProxyExt)
- {
- // Unwrap the server and the object name
- MBeanProxyExt abc = (MBeanProxyExt)handler;
- MBeanServer server = abc.getMBeanProxyMBeanServer();
- ObjectName name = abc.getMBeanProxyObjectName();
- if (server.isRegistered(name))
- {
- // Get the mbean entry
- MBeanEntry entry = (MBeanEntry)server.invoke(new
ObjectName("JMImplementation:type=MBeanRegistry"), "get", new
Object[]{name}, new String[]{ObjectName.class.getName()});
-
- // Get the managed resource (aka the service)
- Object target = entry.getInvoker().getResource();
-
- // Replace the proxy by the service
- invocation.getArgs()[0] = target;
- }
- }
- }
- }
- return super.invoke(invocation);
- }
-}
Modified: modules/common/trunk/common/src/main/org/jboss/portal/common/net/URLTools.java
===================================================================
---
modules/common/trunk/common/src/main/org/jboss/portal/common/net/URLTools.java 2007-09-06
12:48:33 UTC (rev 8187)
+++
modules/common/trunk/common/src/main/org/jboss/portal/common/net/URLTools.java 2007-09-06
13:12:47 UTC (rev 8188)
@@ -25,7 +25,7 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
-import org.jboss.logging.Logger;
+import org.apache.log4j.Logger;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.util.ParameterValidation;
Deleted:
modules/common/trunk/common/src/main/org/jboss/portal/test/common/ObjectLoaderTestCase.java
===================================================================
---
modules/common/trunk/common/src/main/org/jboss/portal/test/common/ObjectLoaderTestCase.java 2007-09-06
12:48:33 UTC (rev 8187)
+++
modules/common/trunk/common/src/main/org/jboss/portal/test/common/ObjectLoaderTestCase.java 2007-09-06
13:12:47 UTC (rev 8188)
@@ -1,264 +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.test.common;
-
-import junit.framework.TestCase;
-import org.jboss.portal.common.concurrent.loader.ObjectLoader;
-import org.jboss.portal.common.concurrent.loader.ObjectBatch;
-import org.jboss.portal.common.concurrent.loader.LoadingPolicy;
-import org.jboss.portal.common.concurrent.loader.LoaderContext;
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutorCompletionService;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ObjectLoaderTestCase extends TestCase
-{
-
- private static volatile int counter;
-
- private abstract static class AbstractObjectLoader implements ObjectLoader
- {
- int loadCount;
- }
-
- private static class SimpleObjectLoader extends AbstractObjectLoader
- {
-
- /** . */
- final Object o;
-
- public SimpleObjectLoader()
- {
- this.o = null;
- }
-
- public SimpleObjectLoader(Object o)
- {
- if (o == null)
- {
- throw new IllegalArgumentException();
- }
- this.o = o;
- }
-
- public synchronized Object load()
- {
- loadCount++;
- return o;
- }
- }
-
- private static class RuntimeExceptionObjectLoader extends AbstractObjectLoader
- {
- public synchronized Object load()
- {
- loadCount++;
- throw new RuntimeException();
- }
- }
-
- private static class ErrorObjectLoader extends AbstractObjectLoader
- {
- public synchronized Object load()
- {
- loadCount++;
- throw new Error();
- }
- }
-
- private Executor executor;
-
-
- protected void setUp() throws Exception
- {
- executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new
LinkedBlockingQueue());
- }
-
- protected void tearDown() throws Exception
- {
- executor = null;
- }
-
- public void testLoadAsync() throws Exception
- {
- LoaderContext ctx = new LoaderContext(new ExecutorCompletionService(executor));
- SimpleObjectLoader l0 = new SimpleObjectLoader(new Object());
- RuntimeExceptionObjectLoader l1 = new RuntimeExceptionObjectLoader();
- SimpleObjectLoader l2 = new SimpleObjectLoader();
- AbstractObjectLoader[] loaders = new AbstractObjectLoader[]{l0,l1,l2};
- ObjectBatch o_l = new ObjectBatch(loaders, LoadingPolicy.LOAD_ALL_SYNC);
-
- //
- Object o0 = o_l.getObject(ctx, 0);
- assertEquals(o0, l0.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- Object o2 = o_l.getObject(ctx, 2);
- assertEquals(o2, l2.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- Object o1 = o_l.getObject(ctx, 1);
- assertEquals(o1, null);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- o0 = o_l.getObject(ctx, 0);
- assertEquals(o0, l0.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- o2 = o_l.getObject(ctx, 2);
- assertEquals(o2, l2.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- o1 = o_l.getObject(ctx, 1);
- assertEquals(o1, null);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
- }
-
- public void testLoadSync() throws Exception
- {
- LoaderContext ctx = new LoaderContext(new ExecutorCompletionService(executor));
- SimpleObjectLoader l0 = new SimpleObjectLoader(new Object());
- RuntimeExceptionObjectLoader l1 = new RuntimeExceptionObjectLoader();
- SimpleObjectLoader l2 = new SimpleObjectLoader();
- AbstractObjectLoader[] loaders = new AbstractObjectLoader[]{l0,l1,l2};
- ObjectBatch o_l = new ObjectBatch(loaders, LoadingPolicy.LOAD_ALL_SYNC);
-
- //
- Object o0 = o_l.getObject(ctx, 0);
- assertEquals(o0, l0.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- Object o2 = o_l.getObject(ctx, 2);
- assertEquals(o2, l2.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- Object o1 = o_l.getObject(ctx, 1);
- assertEquals(o1, null);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
-
- //
- o0 = o_l.getObject(ctx, 0);
- assertEquals(o0, l0.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- o2 = o_l.getObject(ctx, 2);
- assertEquals(o2, l2.o);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
-
- //
- o1 = o_l.getObject(ctx, 1);
- assertEquals(o1, null);
- assertEquals(1, l0.loadCount);
- assertEquals(1, l1.loadCount);
- assertEquals(1, l2.loadCount);
- }
-
- public void testLoadOne() throws Exception
- {
- LoaderContext ctx = new LoaderContext(new ExecutorCompletionService(executor));
- SimpleObjectLoader l0 = new SimpleObjectLoader(new Object());
- RuntimeExceptionObjectLoader l1 = new RuntimeExceptionObjectLoader();
- SimpleObjectLoader l2 = new SimpleObjectLoader();
- AbstractObjectLoader[] loaders = new AbstractObjectLoader[]{l0,l1,l2};
- ObjectBatch o_l = new ObjectBatch(loaders, LoadingPolicy.LOAD_ONE);
-
- //
- Object o0 = o_l.getObject(ctx, 0);
- assertEquals(o0, l0.o);
- assertEquals(1, loaders[0].loadCount);
- assertEquals(0, loaders[1].loadCount);
- assertEquals(0, loaders[2].loadCount);
-
- //
- Object o2 = o_l.getObject(ctx, 2);
- assertEquals(o2, l2.o);
- assertEquals(1, loaders[0].loadCount);
- assertEquals(0, loaders[1].loadCount);
- assertEquals(1, loaders[2].loadCount);
-
- //
- Object o1 = o_l.getObject(ctx, 1);
- assertEquals(o1, null);
- assertEquals(1, loaders[0].loadCount);
- assertEquals(1, loaders[1].loadCount);
- assertEquals(1, loaders[2].loadCount);
-
- //
- o0 = o_l.getObject(ctx, 0);
- assertEquals(o0, l0.o);
- assertEquals(1, loaders[0].loadCount);
- assertEquals(1, loaders[1].loadCount);
- assertEquals(1, loaders[2].loadCount);
-
- //
- o2 = o_l.getObject(ctx, 2);
- assertEquals(o2, l2.o);
- assertEquals(1, loaders[0].loadCount);
- assertEquals(1, loaders[1].loadCount);
- assertEquals(1, loaders[2].loadCount);
-
- //
- o1 = o_l.getObject(ctx, 1);
- assertEquals(o1, null);
- assertEquals(1, loaders[0].loadCount);
- assertEquals(1, loaders[1].loadCount);
- assertEquals(1, loaders[2].loadCount);
- }
-}
Added: modules/common/trunk/mc/.classpath
===================================================================
--- modules/common/trunk/mc/.classpath (rev 0)
+++ modules/common/trunk/mc/.classpath 2007-09-06 13:12:47 UTC (rev 8188)
@@ -0,0 +1,6 @@
+<?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="output" path="bin"/>
+</classpath>
Property changes on: modules/common/trunk/mc/.classpath
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/common/trunk/mc/.cvsignore
===================================================================
--- modules/common/trunk/mc/.cvsignore (rev 0)
+++ modules/common/trunk/mc/.cvsignore 2007-09-06 13:12:47 UTC (rev 8188)
@@ -0,0 +1,2 @@
+bin
+output
Property changes on: modules/common/trunk/mc/.cvsignore
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/common/trunk/mc/.project
===================================================================
--- modules/common/trunk/mc/.project (rev 0)
+++ modules/common/trunk/mc/.project 2007-09-06 13:12:47 UTC (rev 8188)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>api</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>
Property changes on: modules/common/trunk/mc/.project
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/common/trunk/mc/build.bat
===================================================================
--- modules/common/trunk/mc/build.bat (rev 0)
+++ modules/common/trunk/mc/build.bat 2007-09-06 13:12:47 UTC (rev 8188)
@@ -0,0 +1,54 @@
+@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(a)planet57.com>
+rem
+
+rem $Id: build.bat 2 2005-01-14 23:01:32Z vietj $
+
+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: modules/common/trunk/mc/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/common/trunk/mc/build.sh
===================================================================
--- modules/common/trunk/mc/build.sh (rev 0)
+++ modules/common/trunk/mc/build.sh 2007-09-06 13:12:47 UTC (rev 8188)
@@ -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(a)planet57.com>
+##
+
+# $Id: build.sh 2 2005-01-14 23:01:32Z vietj $
+
+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: modules/common/trunk/mc/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/common/trunk/mc/build.xml
===================================================================
--- modules/common/trunk/mc/build.xml (rev 0)
+++ modules/common/trunk/mc/build.xml 2007-09-06 13:12:47 UTC (rev 8188)
@@ -0,0 +1,185 @@
+<?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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!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 7910 2007-08-14 09:46:27Z julien(a)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">
+
+ <!-- Override the javadoc packages to javax.portlet.* -->
+ <property name="javadoc.packages"
value="org.jboss.portal.*"/>
+
+ <!-- Configure thirdparty libraries -->
+ &libraries;
+ <path id="library.classpath">
+ <path refid="junit.junit.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="jboss/common.core.classpath"/>
+ <path refid="apache.log4j.classpath"/>
+ <path refid="sun.servlet.classpath"/>
+ </path>
+
+ <!-- Configure modules -->
+ <call target="configure-modules"/>
+ <path id="dependentmodule.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-common-mc-lib.jar">
+ <fileset dir="${build.classes}"/>
+ </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"/>
+
+ <target name="package-tests"></target>
+
+</project>
Property changes on: modules/common/trunk/mc/build.xml
___________________________________________________________________
Name: svn:executable
+ *
Added:
modules/common/trunk/mc/src/main/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
===================================================================
---
modules/common/trunk/mc/src/main/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
(rev 0)
+++
modules/common/trunk/mc/src/main/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java 2007-09-06
13:12:47 UTC (rev 8188)
@@ -0,0 +1,150 @@
+/******************************************************************************
+ * 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.mc.bootstrap;
+
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.kernel.spi.event.KernelEventListener;
+import org.jboss.kernel.spi.event.KernelEvent;
+import org.jboss.kernel.spi.registry.KernelRegistry;
+import org.jboss.kernel.spi.registry.KernelRegistryEntry;
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import java.net.URL;
+
+/**
+ * A kernel bootstrap with a life cycle triggered by the
<code>ServletContextListener</code> interface.
+ * All beans will be injected as servlet context attributes. The bean xml file must be
available as
+ * a servlet context resource under the path
<i>/WEB-INF/jboss-beans.xml</i>.
+ *
+ * @todo specify an alternative logger name
+ * @todo implement the specification of an alternative xml file path
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WebBootstrap extends BasicBootstrap implements ServletContextListener,
KernelEventListener
+{
+
+ /** . */
+ private final static Logger log = Logger.getLogger(WebBootstrap.class);
+
+ /** . */
+ private ServletContext servletContext;
+
+ /** . */
+ private BeanXMLDeployer deployer;
+
+ /** . */
+ private KernelDeployment deployment;
+
+ /** . */
+ private boolean registered;
+
+ protected void bootstrap() throws Throwable
+ {
+ log.info("Web kernel bootstrap");
+
+ //
+ super.bootstrap();
+
+ //
+ getKernel().getRegistry().registerListener(this, null, "ABC");
+ registered = true;
+
+ //
+ deployer = new BeanXMLDeployer(getKernel());
+
+ //
+ URL url = servletContext.getResource("/WEB-INF/jboss-beans.xml");
+ deployment = deployer.deploy(url);
+ }
+
+ public void contextInitialized(ServletContextEvent event)
+ {
+ servletContext = event.getServletContext();
+
+ // For now we do it here
+ System.setProperty("org.jboss.logging.Logger.pluginClass",
"org.jboss.logging.log4j.Log4jLoggerPlugin");
+
+ //
+ run();
+ log.info("Web kernel started");
+ }
+
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ log.info("Web kernel shutdown");
+
+ //
+ if (deployment != null)
+ {
+ deployer.undeploy(deployment);
+ }
+
+ //
+ if (registered)
+ {
+ registered = false;
+ try
+ {
+ KernelRegistry registry = getKernel().getRegistry();
+ registry.unregisterListener(this, null, "ABC");
+ }
+ catch (Throwable throwable)
+ {
+ log.error("Cannot unregister kernel registry listener",
throwable);
+ }
+ }
+
+ //
+ servletContext = null;
+
+ //
+ log.info("Web kernel stopped");
+ }
+
+ public void onEvent(KernelEvent event, Object object)
+ {
+ Object context = event.getContext();
+ if (context instanceof String)
+ {
+ String key = (String)context;
+ String type = event.getType();
+ if ("KERNEL_REGISTRY_REGISTERED".equals(type))
+ {
+ KernelRegistryEntry entry = getKernel().getRegistry().getEntry(context);
+ Object target = entry.getTarget();
+ servletContext.setAttribute(key, target);
+ }
+ else if ("KERNEL_REGISTRY_UNREGISTERED".equals(type))
+ {
+ servletContext.removeAttribute(key);
+ }
+ }
+ }
+}