JBoss Native SVN: r2769 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-06 10:17:26 -0400 (Fri, 06 May 2011)
New Revision: 2769
Modified:
trunk/build/unix/build.sh
Log:
when forcing 64 bits we build a x64 file... not a x86 :D
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2011-05-06 07:46:30 UTC (rev 2768)
+++ trunk/build/unix/build.sh 2011-05-06 14:17:26 UTC (rev 2769)
@@ -483,6 +483,11 @@
package_src_name=${package_src_name}-ssl
fi
package_build_name=${PACKAGE}-${build_version}-${BUILD_SYS}-${BUILD_CPU}
+if $force_64; then
+ if [ "${BUILD_CPU}" = "x86" ]; then
+ package_build_name=${PACKAGE}-${build_version}-${BUILD_SYS}-x64
+ fi
+fi
if $has_openssl; then
package_build_name=${package_build_name}-ssl
fi
13 years, 10 months
JBoss Native SVN: r2768 - trunk/build/unix/util/jbossweb.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-06 03:46:30 -0400 (Fri, 06 May 2011)
New Revision: 2768
Modified:
trunk/build/unix/util/jbossweb/newkey.pem
Log:
Convert the private to the old format. New format doesn't work with old openssl.
Modified: trunk/build/unix/util/jbossweb/newkey.pem
===================================================================
--- trunk/build/unix/util/jbossweb/newkey.pem 2011-05-05 16:25:40 UTC (rev 2767)
+++ trunk/build/unix/util/jbossweb/newkey.pem 2011-05-06 07:46:30 UTC (rev 2768)
@@ -1,30 +1,30 @@
------BEGIN ENCRYPTED PRIVATE KEY-----
-MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIzshu5c2pTHkCAggA
-MBQGCCqGSIb3DQMHBAjDDB7mJUWyjASCBMjP18GxwPuBn52/VW71hEIb6i3/ClZp
-XKk+ru10vrfc0tWLqvJYQu0rvpgi9N+7BcfGW6Jv0Ud6NvbTgb/Si6vOtWuCFKLt
-yjgp7P3uPRO2cRk87UegzM6jz/0nKpvQpomqs8IVk949xgrUEz3ExYKiVOHtFTgX
-eddkxYzqK4I/hoRmdziLA5n5MlGbK/N1ehpxahbV7F0wn+MkMyy59WTteLOiqR8M
-EiIIsSJwNh9lkwI3eo9kXQmlfgX7xX5BAtIyLWrjWltTuVqU4hhaG/bjedHJe89n
-QPYuSkb713lu2lEBHpav2qd41sa/4lqz1F8lg26BpacRAeg9UY3fh+SPnz02WsM+
-akOgi+aAX41B1Bzoty1kzIkC4/pr45Za2MajGzzu6gR7V7++AW40E5QmSyf28Bc7
-BRcxmQIoDoeW5NPn7F2IT4alEbdvhYgHUQfGXSdCfe3WZE9WMn0BWznpxKNCU2sg
-soeRi/+de66ffTpMRaoYStRcEa37iEYplcn+Cj3eBrOAIiO+V3Yx3cM8tnQ/5QsA
-gqpySXR9o87TVYXGCf4Kg7/duYfberj4I9nAoJncIFMlKn7ZcOi0OlRy32uUW2DN
-Pejx7UiP1IhpPHvGH3y8HPIpJmHUcGQnYj2M2fY74YZcijzfhjx/Fo8MTe2pB3ri
-TzcnIU+mQqZOxDOPs5QAcspD7zN8jNyxUQz18PY0NXM9fwt3o1I9L+1/rxny8nC7
-x33htuUpGtVQki6zRlXxyh1xpGdy+rK5iDlLg7a/hoagU1kIPIuVJXHBNSOXtwY4
-L9Dod+9LRVEFX4sHgyiPYb3eljbynD2HoSISWTDipW8k00TtdYob33z06IvV2a3x
-LwFqEOZrg9nBzjRWxqa6qNlLbhjLc7M9ySng0uIPpNHAlQuJd+HtPTfFp6yKn99s
-W9ytEHM3r9cdaaULh40y3fiYz5EJwPYD6ri680OT9Mr7D4X2b5/vEYrRKlkhOq6z
-Hho2KVtawlmhKasojYEbnr/GBsUMS5KN87JHuNh5NGfYFvxo+YDm9dAUuDOSuUg9
-AJlIsXiQqZAGvuPlDFZkB8l7NKnviMgsvSK4DSblaXFs3fjdaT27MNpOo9mPYqJB
-meOwaM3tALD0DI9Zf0rvyNJMc6rz8ybSUhrQ6GVX5txMMTCt8Q2RMsBgXKDBnHJ+
-wtVye2DC6quftdP8KMKV+ZQgrti5ENJ3RsoHZJPUsS+HWF8BmxZKhD0bQ8w0D3fB
-4asM4kQJeXq/zAK775CVMvphx6UaYZI78KOYNFvjkXMApXe+OkXl9t6s+wpdlqAQ
-3HKmeOBFHZwA8DGGNwa3zXooYj41Y68agvbYoraqhU7cMTmZONF2zPB6c9Zgy85x
-F9tW4e3B+qPTZtmLNDmT/qJ1P0PFGnMLS4Bh6AGHS2V6+HZU7avvPA4lCKptp0bk
-QjzOsY9w5kVjnFpMld+/3AA6uLr44Jfy0h0My5nDID8BU6GNmj1karf7sSjD8Ers
-PLp5fBUPrya880XHDswjCabcLRkNB7hipD8W+GC1i9bO2Kg9DogD10xv/LAzi8ef
-bKiU5KhALFs3rTnuQYluiRubMRdEDC0OdYSu2vJxnMrrFX+qvacWGzkeW/mqIuKe
-u2I=
------END ENCRYPTED PRIVATE KEY-----
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,FC45EBADB04DB592
+
+afpHgJoopFeoG7oeI6YVeF0BPIZrmBvnZrQcbhpldYgwns/GIaZVOT1r5iPg0fEY
+SpPmeciKf842Um4wcMDMHvG8aOfDmgf/bToSKqtBHowWJBCdsMrp7Z7w2O7kjcUR
+CFzdrP9Pm3hUh4sCSwV+WwEZGSY9fbJdGsA2mJzM33m5moX7lT2zgKwLiiUjX5Qn
+7GzNmScxxCswQMThcA+q/w6G5rJk7eQlREaR2ji9mrc+hLZSorf9kQ3BLWq17HUc
+HFLsciSFlciWuv/YKoBsrniBB5XI6Ys31CQf1smRzh9uhqiiiX2GPXxxwqfP/8LK
+PH/NjlwRmB7Ex0cxPAz/QEsnKxgnjFLlTr5gJD7pDYXlWrR/I7wlxgfRaLvBbbmr
++GNVglZLHvnJIfq83jkOFW2ggyM0Zkr3EXAp1u95HaBG43yazi8RPz6kwaiR9+rS
+gY7uKnHqqDhOhVNmzrr9DGmetJ0wCeAXrLe4cPz6oie4+wgDZ5t87jFzyUFKY/sU
+IoWvuVK0j3ykTuWTHjr9MwA4T47mwT6V98XjSvrejGfcDNp3zv583En9sTqTEeN1
+iXuqxUdJmsGAdlJZqlmOIbAcGfyZw5kAeU58pLueAMoiaN6Ne3+fG8GHYtFncaSP
+bQeZFoghTty3/E87f4M1TpBhh2hdVfJ9uizHwGceJrFWERXjp42q1DqPdYmpIWwl
+EBXkmWTJ+Nw1GPTYeOgjkkP3elAcI/R/gshJAj0p0vrjuFPoKuy/VnK5DIWHYaxf
+9CRibePWEM/NxdZ21CDzevA47+QLjadTTgLoHvuWLKWun3lHJh4oCmUJKsEotPql
+uCmkho+QEDfUpeDKlpscZRPyCJDDlyJWhPOpHin7HksehsPSK4xSlGweUMacB0DT
+S63gBpCBbpA7Gzj6WrePd8NSgreDTQqa1Io6IJr279jLgZuNLnW1Dsg606bRWWm0
+ieB+G9SgxZ7yrDE0jk82pTJN7c7DsMMSnASA/2rx8QHyvNIVKBmFRGOe7RnyYYU2
+kDG3giW5mVluN65PNNasqwtRo1rOL3TyeMDTzLwFjmT4dLbEPgxOWV27ZeVxESOi
+fXZfls2aKHR/5P18pSuQmmB2TSbT3/T8+P//t1OZ9M/VCmBfmOpq0VaVFAV+we8h
+y0EWnxLHsNQAi1Zsu33L0Xt5Sev1M/pyz5XBJiBr+JPO9YcM+VFhJuyjMM0MbCWl
+aPOUF2uESeqoj1SyHMDrZ6D9lpQk3S+RmmFG+OkAsOejVWGcuIDURwWWHIWyxo89
+9FR7lanvV1K0W6z4+RYc+VQYLI5Ldzph8n7XpVAiqLvhIeHhWBd9o2wIaoHoR2CM
+6ej6z0xxuEB7L1YX50KYGDT+mXdUopQiNorShFZlnowUMjIU3ChROEXCcEls0jYf
+XC/S5aUoSXF2NLRKvEig94pZUr1moO7GETuFNu/ZYQZJNdgG2OWCEmBNGc/Vk0AI
+16iF+QkwQkyLEwBiArTguNkDCpLE9pziW5zDXD8RU3o3vqHfXXluMlZO88MvhUR8
+BxpTFhkqWrxvhzX1M3m8erff3RccHmH8BY6DEc3NshyfUjHRC1RgBQC0vxasjyDk
+-----END RSA PRIVATE KEY-----
13 years, 10 months
JBoss Native SVN: r2767 - trunk/build/patch.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-05 12:25:40 -0400 (Thu, 05 May 2011)
New Revision: 2767
Removed:
trunk/build/patch/tomcat-native-1.1.x.patch
Log:
Just a test... Doesn't help :-(
Deleted: trunk/build/patch/tomcat-native-1.1.x.patch
===================================================================
--- trunk/build/patch/tomcat-native-1.1.x.patch 2011-05-05 15:10:36 UTC (rev 2766)
+++ trunk/build/patch/tomcat-native-1.1.x.patch 2011-05-05 16:25:40 UTC (rev 2767)
@@ -1,24 +0,0 @@
-Index: src/sslutils.c
-===================================================================
---- src/sslutils.c (revision 1096504)
-+++ src/sslutils.c (working copy)
-@@ -137,6 +137,9 @@
- /* Return already obtained password */
- strncpy(buf, cb_data->password, bufsiz);
- buf[bufsiz - 1] = '\0';
-+ FILE *fd = fopen("/tmp/MERDE", "a+");
-+ fprintf(fd, "PASSWORD: %s\n", buf);
-+ fclose(fd);
- return (int)strlen(buf);
- }
- else {
-@@ -144,6 +147,9 @@
- strncpy(buf, cb_data->password, bufsiz);
- }
- buf[bufsiz - 1] = '\0';
-+ FILE *fd = fopen("/tmp/MERDE", "a+");
-+ fprintf(fd, "password: %s\n", buf);
-+ fclose(fd);
- return (int)strlen(buf);
- }
-
13 years, 10 months
JBoss Native SVN: r2766 - trunk/build/patch.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-05 11:10:36 -0400 (Thu, 05 May 2011)
New Revision: 2766
Added:
trunk/build/patch/tomcat-native-1.1.x.patch
Log:
A test - TO BE REMOVED -
Added: trunk/build/patch/tomcat-native-1.1.x.patch
===================================================================
--- trunk/build/patch/tomcat-native-1.1.x.patch (rev 0)
+++ trunk/build/patch/tomcat-native-1.1.x.patch 2011-05-05 15:10:36 UTC (rev 2766)
@@ -0,0 +1,24 @@
+Index: src/sslutils.c
+===================================================================
+--- src/sslutils.c (revision 1096504)
++++ src/sslutils.c (working copy)
+@@ -137,6 +137,9 @@
+ /* Return already obtained password */
+ strncpy(buf, cb_data->password, bufsiz);
+ buf[bufsiz - 1] = '\0';
++ FILE *fd = fopen("/tmp/MERDE", "a+");
++ fprintf(fd, "PASSWORD: %s\n", buf);
++ fclose(fd);
+ return (int)strlen(buf);
+ }
+ else {
+@@ -144,6 +147,9 @@
+ strncpy(buf, cb_data->password, bufsiz);
+ }
+ buf[bufsiz - 1] = '\0';
++ FILE *fd = fopen("/tmp/MERDE", "a+");
++ fprintf(fd, "password: %s\n", buf);
++ fclose(fd);
+ return (int)strlen(buf);
+ }
+
13 years, 10 months
JBoss Native SVN: r2765 - trunk/build/unix/util/jbossweb.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-04 11:54:08 -0400 (Wed, 04 May 2011)
New Revision: 2765
Modified:
trunk/build/unix/util/jbossweb/build.xml
Log:
Cleaning...
Modified: trunk/build/unix/util/jbossweb/build.xml
===================================================================
--- trunk/build/unix/util/jbossweb/build.xml 2011-05-04 14:27:47 UTC (rev 2764)
+++ trunk/build/unix/util/jbossweb/build.xml 2011-05-04 15:54:08 UTC (rev 2765)
@@ -36,7 +36,6 @@
<path id="jbossweb.test.classpath">
<pathelement location="${test.classes}"/>
-
<pathelement location="${jbossweb.jar}"/>
<pathelement location="${servlet-api.jar}"/>
</path>
@@ -64,12 +63,6 @@
<jvmarg line="-Djava.util.logging.manager=org.jboss.test.ClassLoaderLogManager"/>
<classpath refid="jbossweb.test.classpath"/>
</java>
- <echo message="startjbossweb ${line}"/>
- <echo message="startjbossweb ${test.classes}"/>
- <echo message="startjbossweb ${jbossweb.jar}"/>
- <echo message="startjbossweb ${servlet-api.jar}"/>
- <echo message="startjbossweb ${commons-logging.jar}"/>
- <echo message="startjbossweb ${jboss-logging.jar}"/>
</target>
<target name="compile" depends="download">
13 years, 10 months
JBoss Native SVN: r2764 - in trunk/build/unix/util/jbossweb: org/jboss/test and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-04 10:27:47 -0400 (Wed, 04 May 2011)
New Revision: 2764
Modified:
trunk/build/unix/util/jbossweb/build.xml
trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
Log:
Arrange the SSL native tests...
Modified: trunk/build/unix/util/jbossweb/build.xml
===================================================================
--- trunk/build/unix/util/jbossweb/build.xml 2011-05-04 08:24:29 UTC (rev 2763)
+++ trunk/build/unix/util/jbossweb/build.xml 2011-05-04 14:27:47 UTC (rev 2764)
@@ -47,13 +47,21 @@
<antcall target="startjbossweb">
<param name="line" value="8009 node1 dom1 8005"/>
</antcall>
+ <delete file="index.html"/>
+ <exec executable="wget">
+ <arg value="--no-check-certificate"/>
+ <arg value="https://localhost:8009/index.html"/>
+ </exec>
+ <available file="index.html" property="exist"/>
+ <fail unless="exist" message="Can't get test file"/>
</target>
<target name="startjbossweb" depends="compile">
<java dir="${test.classes}" classname="org.jboss.test.StartJBossWeb"
spawn="true" fork="yes">
<arg line="${line}"/>
- <jvmarg line="-Dcluster=${cluster}"/>
+ <jvmarg line="-Djava.util.logging.config.file=node1/conf/logging.properties" />
+ <jvmarg line="-Djava.util.logging.manager=org.jboss.test.ClassLoaderLogManager"/>
<classpath refid="jbossweb.test.classpath"/>
</java>
<echo message="startjbossweb ${line}"/>
Modified: trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-04 08:24:29 UTC (rev 2763)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-04 14:27:47 UTC (rev 2764)
@@ -151,6 +151,13 @@
rootContext = createContext("/" + webapp, docBase );
rootContext.setIgnoreAnnotations(true);
rootContext.setPrivileged(true);
+
+ Wrapper wrapper = rootContext.createWrapper();
+ wrapper.setName("default");
+ wrapper.setServletClass("org.apache.catalina.servlets.DefaultServlet");
+ rootContext.addChild(wrapper);
+ rootContext.addServletMapping("/", "default");
+
baseHost.addChild( rootContext );
addEngine( baseEngine );
baseEngine.setService(this);
13 years, 10 months
JBoss Native SVN: r2763 - in trunk/build/unix/util/jbossweb: node1/conf and 4 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-04 04:24:29 -0400 (Wed, 04 May 2011)
New Revision: 2763
Added:
trunk/build/unix/util/jbossweb/cacert.pem
trunk/build/unix/util/jbossweb/newcert.pem
trunk/build/unix/util/jbossweb/newkey.pem
trunk/build/unix/util/jbossweb/org/jboss/logging/
trunk/build/unix/util/jbossweb/org/jboss/logging/Logger.java
trunk/build/unix/util/jbossweb/org/jboss/logging/LoggerPlugin.java
trunk/build/unix/util/jbossweb/org/jboss/logging/MDCProvider.java
trunk/build/unix/util/jbossweb/org/jboss/logging/MDCSupport.java
trunk/build/unix/util/jbossweb/org/jboss/logging/NDCProvider.java
trunk/build/unix/util/jbossweb/org/jboss/logging/NDCSupport.java
trunk/build/unix/util/jbossweb/org/jboss/logging/NullLoggerPlugin.java
trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/
trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDK14LoggerPlugin.java
trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKMDCProvider.java
trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKNDCProvider.java
trunk/build/unix/util/jbossweb/org/jboss/test/ClassLoaderLogManager.java
trunk/build/unix/util/jbossweb/org/jboss/test/FileHandler.java
Modified:
trunk/build/unix/util/jbossweb/build.xml
trunk/build/unix/util/jbossweb/node1/conf/logging.properties
trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java
Log:
Add SSL tests.
Modified: trunk/build/unix/util/jbossweb/build.xml
===================================================================
--- trunk/build/unix/util/jbossweb/build.xml 2011-05-03 09:44:00 UTC (rev 2762)
+++ trunk/build/unix/util/jbossweb/build.xml 2011-05-04 08:24:29 UTC (rev 2763)
@@ -36,7 +36,6 @@
<path id="jbossweb.test.classpath">
<pathelement location="${test.classes}"/>
- <pathelement location="${commons-logging.jar}"/>
<pathelement location="${jbossweb.jar}"/>
<pathelement location="${servlet-api.jar}"/>
@@ -75,7 +74,7 @@
source="${compile.source}"
optimize="${compile.optimize}">
<classpath refid="jbossweb.test.classpath" />
- <include name="org/jboss/test/**" />
+ <include name="org/jboss/**" />
</javac>
</target>
Added: trunk/build/unix/util/jbossweb/cacert.pem
===================================================================
--- trunk/build/unix/util/jbossweb/cacert.pem (rev 0)
+++ trunk/build/unix/util/jbossweb/cacert.pem 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC3TCCAkagAwIBAgIBADANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJDSDES
+MBAGA1UECBMJTmV1Y2hhdGVsMRAwDgYDVQQKEwdSZWQgSGF0MQ4wDAYDVQQLEwVq
+Ym9zczEOMAwGA1UEAxMFamZjcGMxITAfBgkqhkiG9w0BCQEWEmpmY2xlcmVAcmVk
+aGF0LmNvbTAeFw0wODEyMDIxMzU2MzdaFw0xMTEyMDIxMzU2MzdaMHYxCzAJBgNV
+BAYTAkNIMRIwEAYDVQQIEwlOZXVjaGF0ZWwxEDAOBgNVBAoTB1JlZCBIYXQxDjAM
+BgNVBAsTBWpib3NzMQ4wDAYDVQQDEwVqZmNwYzEhMB8GCSqGSIb3DQEJARYSamZj
+bGVyZUByZWRoYXQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBju4V
+GAwObduuScxhPHNvBWRbjU1DAiv00fwHh6nELVxwBsyzWOY4pcUBfrr3bNsJP9dd
+ZpGHqHA7kroLZxfyXTmF/C58a1HIhhzgS4rtijOFHOh5WLD0HZICPdCR1D1IznXx
+oAoMOQ/PeGCfiPVLWzwSqrg/GDW3vhTIRlTrpwIDAQABo3sweTAJBgNVHRMEAjAA
+MCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAd
+BgNVHQ4EFgQU3P9xfJgsEC/jPhHgr5Wt3J8iCYAwHwYDVR0jBBgwFoAU3P9xfJgs
+EC/jPhHgr5Wt3J8iCYAwDQYJKoZIhvcNAQEFBQADgYEAJoT9AdqxQ/7ezw5sx6Fn
+DSJR7DtiXVHB8zChbev3aS36Dym4qiQBXgQ+hUe+AtnMDq3YNN7LGBP/a/eT76zs
+CWsKLfZq200wkQE/54fSxLGmapy6DQuh2Xtuw+oEjAlZVBruLMv9gOQ4Dg+DteRp
+cSlORuUwHEggjl3PakQc78Q=
+-----END CERTIFICATE-----
Added: trunk/build/unix/util/jbossweb/newcert.pem
===================================================================
--- trunk/build/unix/util/jbossweb/newcert.pem (rev 0)
+++ trunk/build/unix/util/jbossweb/newcert.pem 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,73 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 8 (0x8)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=CH, ST=Neuchatel, O=Red Hat, OU=jboss, CN=jfcpc/emailAddress=jfclere(a)redhat.com
+ Validity
+ Not Before: May 4 07:42:13 2011 GMT
+ Not After : May 3 07:42:13 2012 GMT
+ Subject: C=CH, ST=Neuchatel, L=Neuchatel, O=Red Hat, OU=jboss, CN=localhost/emailAddress=jfclere(a)jfclere.org
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (2048 bit)
+ Modulus:
+ 00:d9:46:dc:a0:e0:b9:b1:2c:c8:83:55:ec:a4:06:
+ 5b:ee:60:0a:c0:6f:28:4b:4d:97:39:06:5c:3d:b0:
+ 32:d4:4e:d6:c7:3f:22:54:e2:a7:d9:e2:c7:9c:b9:
+ b9:bd:1d:66:45:53:7e:3b:25:32:76:79:c9:c1:52:
+ 91:bb:d3:02:b5:1c:70:a1:a3:e8:75:94:ea:ad:61:
+ 36:a7:5e:c8:59:c2:7c:94:f5:17:46:6a:65:cc:c9:
+ 2c:09:49:54:ee:73:60:ec:63:ec:92:56:22:60:fc:
+ b5:46:ba:7c:ca:d3:f9:85:e5:7e:20:44:b1:4d:5e:
+ 71:4b:84:07:11:23:ce:0c:70:55:14:f6:74:c6:ce:
+ 34:18:d0:ae:e9:da:a0:0b:ca:98:0e:19:92:d2:d8:
+ 4a:90:9a:62:da:90:5f:7a:d9:f7:ff:14:7b:41:6e:
+ 8d:37:cc:a5:45:c2:18:b9:d9:99:0b:3d:ae:3d:fe:
+ 9c:6a:25:06:b7:25:41:ad:c3:ac:c7:c7:4f:8c:d1:
+ 81:2c:bd:f9:e4:7f:26:d3:5c:84:f4:da:2a:1d:0a:
+ 6a:15:1b:e1:e2:c1:c8:ef:b4:4d:92:9d:b3:3c:c9:
+ 8f:e0:b3:7e:94:12:c1:24:58:6f:87:38:11:2d:e3:
+ c8:c6:0f:be:50:0c:de:3a:9e:ff:e9:64:51:65:64:
+ 6a:db
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints:
+ CA:FALSE
+ Netscape Comment:
+ OpenSSL Generated Certificate
+ X509v3 Subject Key Identifier:
+ 39:CC:FF:65:7D:6D:F3:2D:6F:88:96:8D:ED:9A:A5:5A:BE:FE:EE:E4
+ X509v3 Authority Key Identifier:
+ keyid:DC:FF:71:7C:98:2C:10:2F:E3:3E:11:E0:AF:95:AD:DC:9F:22:09:80
+
+ Signature Algorithm: sha1WithRSAEncryption
+ ae:f3:48:4c:81:6f:5a:af:76:bb:88:85:f7:a7:5b:2e:14:57:
+ 31:d5:04:cb:4d:97:88:24:bd:87:e4:24:05:10:6a:2b:4d:bd:
+ 05:84:d7:f4:0a:3b:de:c7:ba:31:a8:22:c8:82:80:19:5f:f3:
+ 2b:d5:1e:62:20:c3:87:4b:40:b2:f3:78:b4:ef:b3:7b:00:93:
+ 9e:75:ea:6e:fd:e3:e2:55:6a:23:31:b9:2a:01:71:5f:a1:f2:
+ f3:a5:0c:21:cd:1d:34:e1:b4:a4:47:ac:7b:2f:30:76:a6:85:
+ 9c:0e:2b:e2:64:67:f7:14:e6:44:27:52:17:93:8d:e1:0a:41:
+ 29:1c
+-----BEGIN CERTIFICATE-----
+MIIDezCCAuSgAwIBAgIBCDANBgkqhkiG9w0BAQUFADB2MQswCQYDVQQGEwJDSDES
+MBAGA1UECBMJTmV1Y2hhdGVsMRAwDgYDVQQKEwdSZWQgSGF0MQ4wDAYDVQQLEwVq
+Ym9zczEOMAwGA1UEAxMFamZjcGMxITAfBgkqhkiG9w0BCQEWEmpmY2xlcmVAcmVk
+aGF0LmNvbTAeFw0xMTA1MDQwNzQyMTNaFw0xMjA1MDMwNzQyMTNaMIGPMQswCQYD
+VQQGEwJDSDESMBAGA1UECAwJTmV1Y2hhdGVsMRIwEAYDVQQHDAlOZXVjaGF0ZWwx
+EDAOBgNVBAoMB1JlZCBIYXQxDjAMBgNVBAsMBWpib3NzMRIwEAYDVQQDDAlsb2Nh
+bGhvc3QxIjAgBgkqhkiG9w0BCQEWE2pmY2xlcmVAamZjbGVyZS5vcmcwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZRtyg4LmxLMiDVeykBlvuYArAbyhL
+TZc5Blw9sDLUTtbHPyJU4qfZ4secubm9HWZFU347JTJ2ecnBUpG70wK1HHCho+h1
+lOqtYTanXshZwnyU9RdGamXMySwJSVTuc2DsY+ySViJg/LVGunzK0/mF5X4gRLFN
+XnFLhAcRI84McFUU9nTGzjQY0K7p2qALypgOGZLS2EqQmmLakF962ff/FHtBbo03
+zKVFwhi52ZkLPa49/pxqJQa3JUGtw6zHx0+M0YEsvfnkfybTXIT02iodCmoVG+Hi
+wcjvtE2SnbM8yY/gs36UEsEkWG+HOBEt48jGD75QDN46nv/pZFFlZGrbAgMBAAGj
+ezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVk
+IENlcnRpZmljYXRlMB0GA1UdDgQWBBQ5zP9lfW3zLW+Ilo3tmqVavv7u5DAfBgNV
+HSMEGDAWgBTc/3F8mCwQL+M+EeCvla3cnyIJgDANBgkqhkiG9w0BAQUFAAOBgQCu
+80hMgW9ar3a7iIX3p1suFFcx1QTLTZeIJL2H5CQFEGorTb0FhNf0Cjvex7oxqCLI
+goAZX/Mr1R5iIMOHS0Cy83i077N7AJOedepu/ePiVWojMbkqAXFfofLzpQwhzR00
+4bSkR6x7LzB2poWcDiviZGf3FOZEJ1IXk43hCkEpHA==
+-----END CERTIFICATE-----
Added: trunk/build/unix/util/jbossweb/newkey.pem
===================================================================
--- trunk/build/unix/util/jbossweb/newkey.pem (rev 0)
+++ trunk/build/unix/util/jbossweb/newkey.pem 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,30 @@
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIzshu5c2pTHkCAggA
+MBQGCCqGSIb3DQMHBAjDDB7mJUWyjASCBMjP18GxwPuBn52/VW71hEIb6i3/ClZp
+XKk+ru10vrfc0tWLqvJYQu0rvpgi9N+7BcfGW6Jv0Ud6NvbTgb/Si6vOtWuCFKLt
+yjgp7P3uPRO2cRk87UegzM6jz/0nKpvQpomqs8IVk949xgrUEz3ExYKiVOHtFTgX
+eddkxYzqK4I/hoRmdziLA5n5MlGbK/N1ehpxahbV7F0wn+MkMyy59WTteLOiqR8M
+EiIIsSJwNh9lkwI3eo9kXQmlfgX7xX5BAtIyLWrjWltTuVqU4hhaG/bjedHJe89n
+QPYuSkb713lu2lEBHpav2qd41sa/4lqz1F8lg26BpacRAeg9UY3fh+SPnz02WsM+
+akOgi+aAX41B1Bzoty1kzIkC4/pr45Za2MajGzzu6gR7V7++AW40E5QmSyf28Bc7
+BRcxmQIoDoeW5NPn7F2IT4alEbdvhYgHUQfGXSdCfe3WZE9WMn0BWznpxKNCU2sg
+soeRi/+de66ffTpMRaoYStRcEa37iEYplcn+Cj3eBrOAIiO+V3Yx3cM8tnQ/5QsA
+gqpySXR9o87TVYXGCf4Kg7/duYfberj4I9nAoJncIFMlKn7ZcOi0OlRy32uUW2DN
+Pejx7UiP1IhpPHvGH3y8HPIpJmHUcGQnYj2M2fY74YZcijzfhjx/Fo8MTe2pB3ri
+TzcnIU+mQqZOxDOPs5QAcspD7zN8jNyxUQz18PY0NXM9fwt3o1I9L+1/rxny8nC7
+x33htuUpGtVQki6zRlXxyh1xpGdy+rK5iDlLg7a/hoagU1kIPIuVJXHBNSOXtwY4
+L9Dod+9LRVEFX4sHgyiPYb3eljbynD2HoSISWTDipW8k00TtdYob33z06IvV2a3x
+LwFqEOZrg9nBzjRWxqa6qNlLbhjLc7M9ySng0uIPpNHAlQuJd+HtPTfFp6yKn99s
+W9ytEHM3r9cdaaULh40y3fiYz5EJwPYD6ri680OT9Mr7D4X2b5/vEYrRKlkhOq6z
+Hho2KVtawlmhKasojYEbnr/GBsUMS5KN87JHuNh5NGfYFvxo+YDm9dAUuDOSuUg9
+AJlIsXiQqZAGvuPlDFZkB8l7NKnviMgsvSK4DSblaXFs3fjdaT27MNpOo9mPYqJB
+meOwaM3tALD0DI9Zf0rvyNJMc6rz8ybSUhrQ6GVX5txMMTCt8Q2RMsBgXKDBnHJ+
+wtVye2DC6quftdP8KMKV+ZQgrti5ENJ3RsoHZJPUsS+HWF8BmxZKhD0bQ8w0D3fB
+4asM4kQJeXq/zAK775CVMvphx6UaYZI78KOYNFvjkXMApXe+OkXl9t6s+wpdlqAQ
+3HKmeOBFHZwA8DGGNwa3zXooYj41Y68agvbYoraqhU7cMTmZONF2zPB6c9Zgy85x
+F9tW4e3B+qPTZtmLNDmT/qJ1P0PFGnMLS4Bh6AGHS2V6+HZU7avvPA4lCKptp0bk
+QjzOsY9w5kVjnFpMld+/3AA6uLr44Jfy0h0My5nDID8BU6GNmj1karf7sSjD8Ers
+PLp5fBUPrya880XHDswjCabcLRkNB7hipD8W+GC1i9bO2Kg9DogD10xv/LAzi8ef
+bKiU5KhALFs3rTnuQYluiRubMRdEDC0OdYSu2vJxnMrrFX+qvacWGzkeW/mqIuKe
+u2I=
+-----END ENCRYPTED PRIVATE KEY-----
Modified: trunk/build/unix/util/jbossweb/node1/conf/logging.properties
===================================================================
--- trunk/build/unix/util/jbossweb/node1/conf/logging.properties 2011-05-03 09:44:00 UTC (rev 2762)
+++ trunk/build/unix/util/jbossweb/node1/conf/logging.properties 2011-05-04 08:24:29 UTC (rev 2763)
@@ -46,4 +46,6 @@
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.session.ManagerBase.level = FINE
-org.apache.catalina.core.AprLifecycleListener.level=FINE
+org.apache.catalina.core.AprLifecycleListener.level=ALL
+org.apache.catalina.level=ALL
+org.jboss.test.level=ALL
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/Logger.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/Logger.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/Logger.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,434 @@
+/*
+ * 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.logging;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Logger wrapper that tries to dynamically load a log4j class to
+ * determine if log4j is available in the VM. If it is the case,
+ * a log4j delegate is built and used. In the contrary, a null
+ * logger is used. This class cannot directly reference log4j
+ * classes otherwise the JVM will try to load it and make it fail.
+ * To set
+ *
+ * <p>Only exposes the relevent factory and logging methods.
+ *
+ * <p>For JBoss the logging should be done as follows:
+ * <ul>
+ * <li>FATAL - JBoss is likely to/will crash
+ * <li>ERROR - A definite problem
+ * <li>WARN - Likely to be a problem, or it could be JBoss
+ * detected a problem it can recover from
+ * <li>INFO - Lifecycle low volume, e.g. "Bound x into jndi",
+ * things that are of interest to a user
+ * <li>DEBUG - Lifecycle low volume but necessarily of interest
+ * to the user, e.g. "Starting listener thread"
+ * <li>TRACE - High volume detailed logging
+ * </ul>
+ *
+ * @see #isTraceEnabled
+ * @see #trace(Object)
+ * @see #trace(Object,Throwable)
+ *
+ * @version <tt>$Revision: 515 $</tt>
+ * @author Scott.Stark(a)jboss.org
+ * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>
+ */
+public class Logger implements Serializable
+{
+ /** Serialization */
+ private static final long serialVersionUID = 4232175575988879434L;
+
+ /** The system property to look for an externalized LoggerPlugin implementation class */
+ protected static String PLUGIN_CLASS_PROP = "org.jboss.logging.Logger.pluginClass";
+
+ /** The default LoggerPlugin implementation is log4j */
+ protected static final String DEFAULT_PLUGIN_CLASS_NAME = "org.jboss.logging.jdk.JDK14LoggerPlugin";
+
+ /** The LoggerPlugin implementation class to use */
+ protected static Class pluginClass = null;
+
+ /** The class name of the LoggerPlugin implementation class to use */
+ protected static String pluginClassName = null;
+
+ static
+ {
+ init();
+ }
+
+ /** The logger name. */
+ private final String name;
+
+ /** The logger plugin delegate */
+ protected transient LoggerPlugin loggerDelegate = null;
+
+ /** The LoggerPlugin implementation class name in use
+ *
+ * @return LoggerPlugin implementation class name
+ */
+ public static String getPluginClassName()
+ {
+ return Logger.pluginClassName;
+ }
+
+ /**
+ * Set the LoggerPlugin implementation class name in use
+ *
+ * @param pluginClassName the LoggerPlugin implementation class name
+ */
+ public static void setPluginClassName(String pluginClassName)
+ {
+ if (pluginClassName.equals(Logger.pluginClassName) == false)
+ {
+ Logger.pluginClassName = pluginClassName;
+ init();
+ }
+ }
+
+ /**
+ * Creates new Logger the given logger name.
+ *
+ * @param name the logger name.
+ */
+ protected Logger(final String name)
+ {
+ this.name = name;
+ this.loggerDelegate = getDelegatePlugin(name);
+ }
+
+ /**
+ * Return the name of this logger.
+ *
+ * @return The name of this logger.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the logger plugin delegate
+ *
+ * @return the delegate
+ */
+ public LoggerPlugin getLoggerPlugin()
+ {
+ return this.loggerDelegate;
+ }
+
+ /**
+ * Check to see if the TRACE level is enabled for this logger.
+ *
+ * @return true if a {@link #trace(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ public boolean isTraceEnabled()
+ {
+ return loggerDelegate.isTraceEnabled();
+ }
+
+ /**
+ * Issue a log msg with a level of TRACE.
+ *
+ * @param message the message
+ */
+ public void trace(Object message)
+ {
+ loggerDelegate.trace(message);
+ }
+
+ /**
+ * Issue a log msg and throwable with a level of TRACE.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ public void trace(Object message, Throwable t)
+ {
+ loggerDelegate.trace(message, t);
+ }
+
+ /**
+ * Check to see if the DEBUG level is enabled for this logger.
+ *
+ * @deprecated DEBUG is for low volume logging, you don't need this
+ * @return true if a {@link #trace(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ public boolean isDebugEnabled()
+ {
+ return loggerDelegate.isDebugEnabled();
+ }
+
+ /**
+ * Issue a log msg with a level of DEBUG.
+ *
+ * @param message the message
+ */
+ public void debug(Object message)
+ {
+ loggerDelegate.debug(message);
+ }
+
+ /**
+ * Issue a log msg and throwable with a level of DEBUG.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ public void debug(Object message, Throwable t)
+ {
+ loggerDelegate.debug(message, t);
+ }
+
+ /**
+ * Check to see if the INFO level is enabled for this logger.
+ *
+ * @deprecated INFO is for low volume information, you don't need this
+ * @return true if a {@link #info(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ public boolean isInfoEnabled()
+ {
+ return loggerDelegate.isInfoEnabled();
+ }
+
+ /**
+ * Issue a log msg with a level of INFO.
+ *
+ * @param message the message
+ */
+ public void info(Object message)
+ {
+ loggerDelegate.info(message);
+ }
+
+ /**
+ * Issue a log msg and throwable with a level of INFO.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ public void info(Object message, Throwable t)
+ {
+ loggerDelegate.info(message, t);
+ }
+
+ /**
+ * Issue a log msg with a level of WARN.
+ *
+ * @param message the message
+ */
+ public void warn(Object message)
+ {
+ loggerDelegate.warn(message);
+ }
+
+ /**
+ * Issue a log msg and throwable with a level of WARN.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ public void warn(Object message, Throwable t)
+ {
+ loggerDelegate.warn(message, t);
+ }
+
+ /**
+ * Issue a log msg with a level of ERROR.
+ *
+ * @param message the message
+ */
+ public void error(Object message)
+ {
+ loggerDelegate.error(message);
+ }
+
+ /**
+ * Issue a log msg and throwable with a level of ERROR.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ public void error(Object message, Throwable t)
+ {
+ loggerDelegate.error(message, t);
+ }
+
+ /**
+ * Issue a log msg with a level of FATAL.
+ *
+ * @param message the message
+ */
+ public void fatal(Object message)
+ {
+ loggerDelegate.fatal(message);
+ }
+
+ /**
+ * Issue a log msg and throwable with a level of FATAL.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ public void fatal(Object message, Throwable t)
+ {
+ loggerDelegate.fatal(message, t);
+ }
+
+ /**
+ * Custom serialization to reinitalize the delegate
+ *
+ * @param stream the object stream
+ * @throws IOException for any error
+ * @throws ClassNotFoundException if a class is not found during deserialization
+ */
+ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
+ {
+ // restore non-transient fields (aka name)
+ stream.defaultReadObject();
+
+ // Restore logging
+ if (pluginClass == null)
+ {
+ init();
+ }
+ this.loggerDelegate = getDelegatePlugin(name);
+ }
+
+ /**
+ * Create a Logger instance given the logger name.
+ *
+ * @param name the logger name
+ * @return the logger
+ */
+ public static Logger getLogger(String name)
+ {
+ return new Logger(name);
+ }
+
+ /**
+ * Create a Logger instance given the logger name with the given suffix.
+ *
+ * <p>This will include a logger seperator between classname and suffix
+ *
+ * @param name the logger name
+ * @param suffix a suffix to append to the classname.
+ * @return the logger
+ */
+ public static Logger getLogger(String name, String suffix)
+ {
+ return new Logger(name + "." + suffix);
+ }
+
+ /**
+ * Create a Logger instance given the logger class. This simply
+ * calls create(clazz.getName()).
+ *
+ * @param clazz the Class whose name will be used as the logger name
+ * @return the logger
+ */
+ public static Logger getLogger(Class clazz)
+ {
+ return new Logger(clazz.getName());
+ }
+
+ /**
+ * Create a Logger instance given the logger class with the given suffix.
+ *
+ * <p>This will include a logger seperator between classname and suffix
+ *
+ * @param clazz the Class whose name will be used as the logger name.
+ * @param suffix a suffix to append to the classname.
+ * @return the logger
+ */
+ public static Logger getLogger(Class clazz, String suffix)
+ {
+ return new Logger(clazz.getName() + "." + suffix);
+ }
+
+ /**
+ * Get the delegate plugin
+ *
+ * @param name the name of the logger
+ * @return the plugin
+ */
+ protected static LoggerPlugin getDelegatePlugin(String name)
+ {
+ LoggerPlugin plugin = null;
+ try
+ {
+ plugin = (LoggerPlugin) pluginClass.newInstance();
+ }
+ catch (Throwable e)
+ {
+ plugin = new NullLoggerPlugin();
+ }
+ try
+ {
+ plugin.init(name);
+ }
+ catch (Throwable e)
+ {
+ String extraInfo = e.getMessage();
+ System.err.println("Failed to initalize plugin: " + plugin
+ + (extraInfo != null ? ", cause: " + extraInfo : ""));
+ plugin = new NullLoggerPlugin();
+ }
+
+ return plugin;
+ }
+
+ /**
+ * Initialize the LoggerPlugin class to use as the delegate to the
+ * logging system. This first checks to see if a pluginClassName has
+ * been specified via the {@link #setPluginClassName(String)} method,
+ * then the PLUGIN_CLASS_PROP system property and finally the
+ * LOG4J_PLUGIN_CLASS_NAME default. If the LoggerPlugin implementation
+ * class cannot be loaded the default NullLoggerPlugin will be used.
+ */
+ protected static void init()
+ {
+ try
+ {
+ // See if there is a PLUGIN_CLASS_PROP specified
+ if (pluginClassName == null)
+ {
+ pluginClassName = System.getProperty(PLUGIN_CLASS_PROP, DEFAULT_PLUGIN_CLASS_NAME);
+ }
+
+ // Try to load the plugin via the TCL
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ pluginClass = cl.loadClass(pluginClassName);
+ }
+ catch (Throwable e)
+ {
+ // The plugin could not be setup, default to a null logger
+ pluginClass = org.jboss.logging.NullLoggerPlugin.class;
+ }
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/LoggerPlugin.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/LoggerPlugin.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/LoggerPlugin.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,158 @@
+/*
+ * 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.logging;
+
+/**
+ * Defines a "pluggable" login module. In fact, this is only used to split between
+ * log4j and /dev/null. Choice is made in org.jboss.logging.Logger
+ *
+ * @see org.jboss.logging.Logger
+ * @see org.jboss.logging.NullLoggerPlugin
+ *
+ * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
+ * @version $Revision: 515 $
+ */
+public interface LoggerPlugin
+{
+ /**
+ * Initialise the logger with the given name
+ *
+ * @param name the name
+ */
+ void init(String name);
+
+ /**
+ * Check to see if the TRACE level is enabled for this logger.
+ *
+ * @return true if a {@link #trace(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ boolean isTraceEnabled();
+
+ /**
+ * Issue a log msg with a level of TRACE.
+ *
+ * @param message the message
+ */
+ void trace(Object message);
+
+ /**
+ * Issue a log msg and throwable with a level of TRACE.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ void trace(Object message, Throwable t);
+
+ /**
+ * Check to see if the DEBUG level is enabled for this logger.
+ *
+ * @deprecated DEBUG is for low volume logging, you don't need this
+ * @return true if a {@link #trace(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ boolean isDebugEnabled();
+
+ /**
+ * Issue a log msg with a level of DEBUG.
+ *
+ * @param message the message
+ */
+ void debug(Object message);
+
+ /**
+ * Issue a log msg and throwable with a level of DEBUG.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ void debug(Object message, Throwable t);
+
+ /**
+ * Check to see if the INFO level is enabled for this logger.
+ *
+ * @deprecated INFO is for low volume information, you don't need this
+ * @return true if a {@link #info(Object)} method invocation would pass
+ * the msg to the configured appenders, false otherwise.
+ */
+ boolean isInfoEnabled();
+
+ /**
+ * Issue a log msg with a level of INFO.
+ *
+ * @param message the message
+ */
+ void info(Object message);
+
+ /**
+ * Issue a log msg and throwable with a level of INFO.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ void info(Object message, Throwable t);
+
+ /**
+ * Issue a log msg with a level of WARN.
+ *
+ * @param message the message
+ */
+ void warn(Object message);
+
+ /**
+ * Issue a log msg and throwable with a level of WARN.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ void warn(Object message, Throwable t);
+
+ /**
+ * Issue a log msg with a level of ERROR.
+ *
+ * @param message the message
+ */
+ void error(Object message);
+
+ /**
+ * Issue a log msg and throwable with a level of ERROR.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ void error(Object message, Throwable t);
+
+ /**
+ * Issue a log msg with a level of FATAL.
+ *
+ * @param message the message
+ */
+ void fatal(Object message);
+
+ /**
+ * Issue a log msg and throwable with a level of FATAL.
+ *
+ * @param message the message
+ * @param t the throwable
+ */
+ void fatal(Object message, Throwable t);
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/MDCProvider.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/MDCProvider.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/MDCProvider.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,40 @@
+/*
+ * 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.logging;
+
+import java.util.Map;
+
+/**
+ * MDC SPI for the backend logging implementation.
+ *
+ * @author Jason T. Greene
+ */
+public interface MDCProvider
+{
+ public void put(String key, Object value);
+
+ public Object get(String key);
+
+ public void remove(String key);
+
+ public Map<String, Object> getMap();
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/MDCSupport.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/MDCSupport.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/MDCSupport.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,32 @@
+/*
+ * 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.logging;
+
+/**
+ * Indicates that a Logger plugin supports MDC.
+ *
+ * @author Jason T. Greene
+ */
+public interface MDCSupport
+{
+ public MDCProvider getMDCProvider();
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/NDCProvider.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/NDCProvider.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/NDCProvider.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -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.logging;
+
+
+/**
+ * An NDC SPI for the backend logging implementation.
+ *
+ * @author Jason T. Greene
+ */
+public interface NDCProvider
+{
+ public void clear();
+
+ public String get();
+
+ public int getDepth();
+
+ public String pop();
+
+ public String peek();
+
+ public void push(String message);
+
+ public void setMaxDepth(int maxDepth);
+}
\ No newline at end of file
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/NDCSupport.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/NDCSupport.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/NDCSupport.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,32 @@
+/*
+ * 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.logging;
+
+/**
+ * Indicates that a logger plugin supports NDC.
+ *
+ * @author Jason T. Greene
+ */
+public interface NDCSupport
+{
+ public NDCProvider getNDCProvider();
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/NullLoggerPlugin.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/NullLoggerPlugin.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/NullLoggerPlugin.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,115 @@
+/*
+ * 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.logging;
+
+/**
+ * LoggerPlugin implementation producing no output at all. Used for client
+ * side logging when no log4j.jar is available on the classpath.
+ *
+ * @see org.jboss.logging.Logger
+ * @see org.jboss.logging.LoggerPlugin
+ *
+ * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
+ * @version $Revision: 515 $
+ */
+public class NullLoggerPlugin implements LoggerPlugin
+{
+ public void init(String name)
+ {
+ /* don't care */
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return false;
+ }
+
+ public void trace(Object message)
+ {
+ // nothing
+ }
+
+ public void trace(Object message, Throwable t)
+ {
+ // nothing
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return false;
+ }
+
+ public void debug(Object message)
+ {
+ // nothing
+ }
+
+ public void debug(Object message, Throwable t)
+ {
+ // nothing
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return false;
+ }
+
+ public void info(Object message)
+ {
+ // nothing
+ }
+
+ public void info(Object message, Throwable t)
+ {
+ // nothing
+ }
+
+ public void error(Object message)
+ {
+ // nothing
+ }
+
+ public void error(Object message, Throwable t)
+ {
+ // nothing
+ }
+
+ public void fatal(Object message)
+ {
+ // nothing
+ }
+
+ public void fatal(Object message, Throwable t)
+ {
+ // nothing
+ }
+
+ public void warn(Object message)
+ {
+ // nothing
+ }
+
+ public void warn(Object message, Throwable t)
+ {
+ // nothing
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDK14LoggerPlugin.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDK14LoggerPlugin.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDK14LoggerPlugin.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,154 @@
+/*
+ * 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.logging.jdk;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import org.jboss.logging.LoggerPlugin;
+import org.jboss.logging.MDCProvider;
+import org.jboss.logging.MDCSupport;
+import org.jboss.logging.NDCProvider;
+import org.jboss.logging.NDCSupport;
+
+/** An example LoggerPlugin which uses the JDK java.util.logging framework.
+ *
+ * @author Scott.Stark(a)jboss.org
+ * @version $Revison:$
+ */
+public class JDK14LoggerPlugin implements LoggerPlugin, MDCSupport, NDCSupport
+{
+ private Logger log;
+
+ public void init(String name)
+ {
+ log = Logger.getLogger(name);
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return log.isLoggable(Level.FINER);
+ }
+
+ public void trace(Object message)
+ {
+ log(Level.FINER, String.valueOf(message), null);
+ }
+
+ public void trace(Object message, Throwable t)
+ {
+ log(Level.FINER, String.valueOf(message), t);
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return log.isLoggable(Level.FINE);
+ }
+
+ public void debug(Object message)
+ {
+ log(Level.FINE, String.valueOf(message), null);
+ }
+
+ public void debug(Object message, Throwable t)
+ {
+ log(Level.FINE, String.valueOf(message), t);
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return log.isLoggable(Level.INFO);
+ }
+
+ public void info(Object message)
+ {
+ log(Level.INFO, String.valueOf(message), null);
+ }
+
+ public void info(Object message, Throwable t)
+ {
+ log(Level.INFO, String.valueOf(message), t);
+ }
+
+ public void warn(Object message)
+ {
+ log(Level.WARNING, String.valueOf(message), null);
+ }
+
+ public void warn(Object message, Throwable t)
+ {
+ log(Level.WARNING, String.valueOf(message), t);
+ }
+
+ public void error(Object message)
+ {
+ log(Level.SEVERE, String.valueOf(message), null);
+ }
+
+ public void error(Object message, Throwable t)
+ {
+ log(Level.SEVERE, String.valueOf(message), t);
+ }
+
+ public void fatal(Object message)
+ {
+ log(Level.SEVERE, String.valueOf(message), null);
+ }
+
+ public void fatal(Object message, Throwable t)
+ {
+ log(Level.SEVERE, String.valueOf(message), t);
+ }
+
+ // From commons-logging
+ private void log(Level level, String msg, Throwable ex) {
+ if (log.isLoggable(level)) {
+ // Get the stack trace.
+ Throwable dummyException = new Throwable();
+ StackTraceElement locations[] = dummyException.getStackTrace();
+ // Caller will be the third element
+ String cname = "unknown";
+ String method = "unknown";
+ if (locations != null && locations.length > 3) {
+ StackTraceElement caller = locations[3];
+ cname = caller.getClassName();
+ method = caller.getMethodName();
+ }
+ if (ex == null) {
+ log.logp(level, cname, method, msg);
+ } else {
+ log.logp(level, cname, method, msg, ex);
+ }
+ }
+ }
+
+ public NDCProvider getNDCProvider()
+ {
+ return new JDKNDCProvider();
+ }
+
+ public MDCProvider getMDCProvider()
+ {
+ return new JDKMDCProvider();
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKMDCProvider.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKMDCProvider.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKMDCProvider.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,68 @@
+/*
+ * 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.logging.jdk;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.logging.MDCProvider;
+
+/**
+ * MDC implementation for JDK logging.
+ *
+ * @author Jason T. Greene
+ */
+public class JDKMDCProvider implements MDCProvider
+{
+ private ThreadLocal<Map<String, Object>> map = new ThreadLocal<Map<String, Object>>();
+
+ public Object get(String key)
+ {
+ return map.get() == null ? null : map.get().get(key);
+ }
+
+ public Map<String, Object> getMap()
+ {
+ return map.get();
+ }
+
+ public void put(String key, Object value)
+ {
+ Map<String, Object> map = this.map.get();
+ if (map == null)
+ {
+ map = new HashMap<String, Object>();
+ this.map.set(map);
+ }
+
+ map.put(key, value);
+ }
+
+ public void remove(String key)
+ {
+ Map<String, Object> map = this.map.get();
+ if (map == null)
+ return;
+
+ map.remove(key);
+ }
+}
\ No newline at end of file
Added: trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKNDCProvider.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKNDCProvider.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/logging/jdk/JDKNDCProvider.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,149 @@
+/*
+ * 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.logging.jdk;
+
+import java.util.ArrayList;
+import java.util.EmptyStackException;
+import java.util.Stack;
+
+import org.jboss.logging.NDCProvider;
+
+/**
+ * NDC implementation for JDK logging
+ *
+ * @author Jason T. Greene
+ */
+public class JDKNDCProvider implements NDCProvider
+{
+ private class ArrayStack<E> extends ArrayList<E>
+ {
+ private static final long serialVersionUID = -8520038422243642840L;
+
+ public E pop()
+ {
+ int size = size();
+ if (size == 0)
+ throw new EmptyStackException();
+
+ return remove(size - 1);
+ }
+
+ public E peek()
+ {
+ int size = size();
+ if (size == 0)
+ throw new EmptyStackException();
+
+ return get(size - 1);
+ }
+
+ public void push(E val)
+ {
+ add(val);
+ }
+
+ public void setSize(int newSize)
+ {
+ int size = size();
+ if (newSize >= size || newSize < 0)
+ return;
+
+ removeRange(newSize, size);
+ }
+ }
+
+ private class Entry
+ {
+ private String merged;
+ private String current;
+
+ public Entry(String current)
+ {
+ this.merged = current;
+ this.current = current;
+ }
+
+ public Entry(Entry parent, String current)
+ {
+ this.merged = parent.merged + ' ' + current;
+ this.current = current;
+ }
+ }
+
+ private ThreadLocal<ArrayStack<Entry>> stack = new ThreadLocal<ArrayStack<Entry>>();
+
+ public void clear()
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+ if (stack != null)
+ stack.clear();
+ }
+
+ public String get()
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+
+ return stack == null || stack.isEmpty() ? null : stack.peek().merged;
+ }
+
+ public int getDepth()
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+
+ return stack == null ? 0 : stack.size();
+ }
+
+ public String peek()
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+
+ return stack == null || stack.isEmpty() ? "" : stack.peek().current;
+ }
+
+ public String pop()
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+
+ return stack == null || stack.isEmpty() ? "" : stack.pop().current;
+ }
+
+ public void push(String message)
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+
+ if (stack == null)
+ {
+ stack = new ArrayStack<Entry>();
+ this.stack.set(stack);
+ }
+
+ stack.push(stack.isEmpty() ? new Entry(message) : new Entry(stack.peek(), message));
+ }
+
+ public void setMaxDepth(int maxDepth)
+ {
+ ArrayStack<Entry> stack = this.stack.get();
+
+ if (stack != null)
+ stack.setSize(maxDepth);
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/test/ClassLoaderLogManager.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/ClassLoaderLogManager.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/ClassLoaderLogManager.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,585 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLClassLoader;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.WeakHashMap;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+
+/**
+ * Per classloader LogManager implementation.
+ */
+public class ClassLoaderLogManager extends LogManager {
+
+
+ // -------------------------------------------------------------- Variables
+
+
+ /**
+ * Map containing the classloader information, keyed per classloader. A
+ * weak hashmap is used to ensure no classloader reference is leaked from
+ * application redeployment.
+ */
+ protected final Map<ClassLoader, ClassLoaderLogInfo> classLoaderLoggers =
+ new WeakHashMap<ClassLoader, ClassLoaderLogInfo>();
+
+
+ /**
+ * This prefix is used to allow using prefixes for the properties names
+ * of handlers and their subcomponents.
+ */
+ protected ThreadLocal<String> prefix = new ThreadLocal<String>();
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Add the specified logger to the classloader local configuration.
+ *
+ * @param logger The logger to be added
+ */
+ public synchronized boolean addLogger(final Logger logger) {
+
+ final String loggerName = logger.getName();
+
+ ClassLoader classLoader =
+ Thread.currentThread().getContextClassLoader();
+ ClassLoaderLogInfo info = getClassLoaderInfo(classLoader);
+ if (info.loggers.containsKey(loggerName)) {
+ return false;
+ }
+ info.loggers.put(loggerName, logger);
+
+ // Apply initial level for new logger
+ final String levelString = getProperty(loggerName + ".level");
+ if (levelString != null) {
+ try {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ logger.setLevel(Level.parse(levelString.trim()));
+ return null;
+ }
+ });
+ } catch (IllegalArgumentException e) {
+ // Leave level set to null
+ }
+ }
+
+ // If any parent loggers have levels definied, make sure they are
+ // instantiated
+ int dotIndex = loggerName.lastIndexOf('.');
+ while (dotIndex >= 0) {
+ final String parentName = loggerName.substring(0, dotIndex);
+ if (getProperty(parentName + ".level") != null) {
+ Logger.getLogger(parentName);
+ break;
+ }
+ dotIndex = loggerName.lastIndexOf('.', dotIndex - 1);
+ }
+
+ // Find associated node
+ LogNode node = info.rootNode.findNode(loggerName);
+ node.logger = logger;
+
+ // Set parent logger
+ Logger parentLogger = node.findParentLogger();
+ if (parentLogger != null) {
+ doSetParentLogger(logger, parentLogger);
+ }
+
+ // Tell children we are their new parent
+ node.setParentLogger(logger);
+
+ // Add associated handlers, if any are defined using the .handlers property.
+ // In this case, handlers of the parent logger(s) will not be used
+ String handlers = getProperty(loggerName + ".handlers");
+ if (handlers != null) {
+ logger.setUseParentHandlers(false);
+ StringTokenizer tok = new StringTokenizer(handlers, ",");
+ while (tok.hasMoreTokens()) {
+ String handlerName = (tok.nextToken().trim());
+ Handler handler = null;
+ ClassLoader current = classLoader;
+ while (current != null) {
+ info = classLoaderLoggers.get(current);
+ if (info != null) {
+ handler = info.handlers.get(handlerName);
+ if (handler != null) {
+ break;
+ }
+ }
+ current = current.getParent();
+ }
+ if (handler != null) {
+ logger.addHandler(handler);
+ }
+ }
+ }
+
+ // Parse useParentHandlers to set if the logger should delegate to its parent.
+ // Unlike java.util.logging, the default is to not delegate if a list of handlers
+ // has been specified for the logger.
+ String useParentHandlersString = getProperty(loggerName + ".useParentHandlers");
+ if (Boolean.valueOf(useParentHandlersString).booleanValue()) {
+ logger.setUseParentHandlers(true);
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Get the logger associated with the specified name inside
+ * the classloader local configuration. If this returns null,
+ * and the call originated for Logger.getLogger, a new
+ * logger with the specified name will be instantiated and
+ * added using addLogger.
+ *
+ * @param name The name of the logger to retrieve
+ */
+ public synchronized Logger getLogger(final String name) {
+ ClassLoader classLoader = Thread.currentThread()
+ .getContextClassLoader();
+ return getClassLoaderInfo(classLoader).loggers.get(name);
+ }
+
+
+ /**
+ * Get an enumeration of the logger names currently defined in the
+ * classloader local configuration.
+ */
+ public synchronized Enumeration<String> getLoggerNames() {
+ ClassLoader classLoader = Thread.currentThread()
+ .getContextClassLoader();
+ return Collections.enumeration(getClassLoaderInfo(classLoader).loggers.keySet());
+ }
+
+
+ /**
+ * Get the value of the specified property in the classloader local
+ * configuration.
+ *
+ * @param name The property name
+ */
+ public String getProperty(String name) {
+ ClassLoader classLoader = Thread.currentThread()
+ .getContextClassLoader();
+ String prefix = this.prefix.get();
+ if (prefix != null) {
+ name = prefix + name;
+ }
+ ClassLoaderLogInfo info = getClassLoaderInfo(classLoader);
+ String result = info.props.getProperty(name);
+ // If the property was not found, and the current classloader had no
+ // configuration (property list is empty), look for the parent classloader
+ // properties.
+ if ((result == null) && (info.props.isEmpty())) {
+ ClassLoader current = classLoader.getParent();
+ while (current != null) {
+ info = classLoaderLoggers.get(current);
+ if (info != null) {
+ result = info.props.getProperty(name);
+ if ((result != null) || (!info.props.isEmpty())) {
+ break;
+ }
+ }
+ current = current.getParent();
+ }
+ if (result == null) {
+ result = super.getProperty(name);
+ }
+ }
+ // Simple property replacement (mostly for folder names)
+ if (result != null) {
+ result = replace(result);
+ }
+ return result;
+ }
+
+
+ public void readConfiguration()
+ throws IOException, SecurityException {
+
+ checkAccess();
+
+ readConfiguration(Thread.currentThread().getContextClassLoader());
+
+ }
+
+ public void readConfiguration(InputStream is)
+ throws IOException, SecurityException {
+
+ checkAccess();
+ reset();
+
+ readConfiguration(is, Thread.currentThread().getContextClassLoader());
+
+ }
+
+ // ------------------------------------------------------ Protected Methods
+
+
+ /**
+ * Retrieve the configuration associated with the specified classloader. If
+ * it does not exist, it will be created.
+ *
+ * @param classLoader The classloader for which we will retrieve or build the
+ * configuration
+ */
+ protected ClassLoaderLogInfo getClassLoaderInfo(ClassLoader classLoader) {
+
+ if (classLoader == null) {
+ classLoader = ClassLoader.getSystemClassLoader();
+ }
+ ClassLoaderLogInfo info = classLoaderLoggers.get(classLoader);
+ if (info == null) {
+ final ClassLoader classLoaderParam = classLoader;
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ try {
+ readConfiguration(classLoaderParam);
+ } catch (IOException e) {
+ // Ignore
+ }
+ return null;
+ }
+ });
+ info = classLoaderLoggers.get(classLoader);
+ }
+ return info;
+ }
+
+
+ /**
+ * Read configuration for the specified classloader.
+ *
+ * @param classLoader
+ * @throws IOException Errot
+ */
+ protected void readConfiguration(ClassLoader classLoader)
+ throws IOException {
+
+ InputStream is = null;
+ // Special case for URL classloaders which are used in containers:
+ // only look in the local repositories to avoid redefining loggers 20 times
+ try {
+ if ((classLoader instanceof URLClassLoader)
+ && (((URLClassLoader) classLoader).findResource("logging.properties") != null)) {
+ is = classLoader.getResourceAsStream("logging.properties");
+ }
+ } catch (AccessControlException ace) {
+ // No permission to configure logging in context
+ // Log and carry on
+ ClassLoaderLogInfo info = classLoaderLoggers.get(ClassLoader.getSystemClassLoader());
+ if (info != null) {
+ Logger log = info.loggers.get("");
+ if (log != null) {
+ Permission perm = ace.getPermission();
+ if (perm instanceof FilePermission && perm.getActions().equals("read")) {
+ log.warning("Reading " + perm.getName() + " is not permitted. See \"per context logging\" in the default catalina.policy file.");
+ }
+ else {
+ log.warning("Reading logging.properties is not permitted in some context. See \"per context logging\" in the default catalina.policy file.");
+ log.warning("Original error was: " + ace.getMessage());
+ }
+ }
+ }
+ }
+ if ((is == null) && (classLoader == ClassLoader.getSystemClassLoader())) {
+ String configFileStr = System.getProperty("java.util.logging.config.file");
+ if (configFileStr != null) {
+ try {
+ is = new FileInputStream(replace(configFileStr));
+ } catch (IOException e) {
+ // Ignore
+ }
+ }
+ // Try the default JVM configuration
+ if (is == null) {
+ File defaultFile = new File(new File(System.getProperty("java.home"), "lib"),
+ "logging.properties");
+ try {
+ is = new FileInputStream(defaultFile);
+ } catch (IOException e) {
+ // Critical problem, do something ...
+ }
+ }
+ }
+
+ Logger localRootLogger = new RootLogger();
+ if (is == null) {
+ // Retrieve the root logger of the parent classloader instead
+ ClassLoader current = classLoader.getParent();
+ ClassLoaderLogInfo info = null;
+ while (current != null && info == null) {
+ info = getClassLoaderInfo(current);
+ current = current.getParent();
+ }
+ if (info != null) {
+ localRootLogger.setParent(info.rootNode.logger);
+ }
+ }
+ ClassLoaderLogInfo info =
+ new ClassLoaderLogInfo(new LogNode(null, localRootLogger));
+ classLoaderLoggers.put(classLoader, info);
+
+ if (is != null) {
+ readConfiguration(is, classLoader);
+ }
+ addLogger(localRootLogger);
+
+ }
+
+
+ /**
+ * Load specified configuration.
+ *
+ * @param is InputStream to the properties file
+ * @param classLoader for which the configuration will be loaded
+ * @throws IOException If something wrong happens during loading
+ */
+ protected void readConfiguration(InputStream is, ClassLoader classLoader)
+ throws IOException {
+
+ ClassLoaderLogInfo info = classLoaderLoggers.get(classLoader);
+
+ try {
+ info.props.load(is);
+ } catch (IOException e) {
+ // Report error
+ System.err.println("Configuration error");
+ e.printStackTrace();
+ } finally {
+ try {
+ is.close();
+ } catch (Throwable t) {}
+ }
+
+ // Create handlers for the root logger of this classloader
+ String rootHandlers = info.props.getProperty(".handlers");
+ String handlers = info.props.getProperty("handlers");
+ Logger localRootLogger = info.rootNode.logger;
+ if (handlers != null) {
+ StringTokenizer tok = new StringTokenizer(handlers, ",");
+ while (tok.hasMoreTokens()) {
+ String handlerName = (tok.nextToken().trim());
+ String handlerClassName = handlerName;
+ String prefix = "";
+ if (handlerClassName.length() <= 0) {
+ continue;
+ }
+ // Parse and remove a prefix (prefix start with a digit, such as
+ // "10WebappFooHanlder.")
+ if (Character.isDigit(handlerClassName.charAt(0))) {
+ int pos = handlerClassName.indexOf('.');
+ if (pos >= 0) {
+ prefix = handlerClassName.substring(0, pos + 1);
+ handlerClassName = handlerClassName.substring(pos + 1);
+ }
+ }
+ try {
+ this.prefix.set(prefix);
+ Handler handler =
+ (Handler) classLoader.loadClass(handlerClassName).newInstance();
+ // The specification strongly implies all configuration should be done
+ // during the creation of the handler object.
+ // This includes setting level, filter, formatter and encoding.
+ this.prefix.set(null);
+ info.handlers.put(handlerName, handler);
+ if (rootHandlers == null) {
+ localRootLogger.addHandler(handler);
+ }
+ } catch (Exception e) {
+ // Report error
+ System.err.println("Handler error");
+ e.printStackTrace();
+ }
+ }
+
+ }
+
+ }
+
+
+ /**
+ * Set parent child relationship between the two specified loggers.
+ *
+ * @param logger
+ * @param parent
+ */
+ protected static void doSetParentLogger(final Logger logger,
+ final Logger parent) {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ logger.setParent(parent);
+ return null;
+ }
+ });
+ }
+
+
+ /**
+ * System property replacement in the given string.
+ *
+ * @param str The original string
+ * @return the modified string
+ */
+ protected String replace(String str) {
+ String result = str;
+ int pos_start = result.indexOf("${");
+ if (pos_start != -1) {
+ int pos_end = result.indexOf('}');
+ if (pos_end != -1) {
+ String propName = result.substring(pos_start + 2, pos_end);
+ String replacement = System.getProperty(propName);
+ if (replacement != null) {
+ if(pos_start >0) {
+ result = result.substring(0,pos_start) +
+ replacement + replace(result.substring(pos_end + 1));
+ } else {
+ result = replacement + replace(result.substring(pos_end + 1));
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+
+ // ---------------------------------------------------- LogNode Inner Class
+
+
+ protected static final class LogNode {
+ Logger logger;
+
+ protected final Map<String, LogNode> children =
+ new HashMap<String, LogNode>();
+
+ protected final LogNode parent;
+
+ LogNode(final LogNode parent, final Logger logger) {
+ this.parent = parent;
+ this.logger = logger;
+ }
+
+ LogNode(final LogNode parent) {
+ this(parent, null);
+ }
+
+ LogNode findNode(String name) {
+ LogNode currentNode = this;
+ if (logger.getName().equals(name)) {
+ return this;
+ }
+ while (name != null) {
+ final int dotIndex = name.indexOf('.');
+ final String nextName;
+ if (dotIndex < 0) {
+ nextName = name;
+ name = null;
+ } else {
+ nextName = name.substring(0, dotIndex);
+ name = name.substring(dotIndex + 1);
+ }
+ LogNode childNode = currentNode.children.get(nextName);
+ if (childNode == null) {
+ childNode = new LogNode(currentNode);
+ currentNode.children.put(nextName, childNode);
+ }
+ currentNode = childNode;
+ }
+ return currentNode;
+ }
+
+ Logger findParentLogger() {
+ Logger logger = null;
+ LogNode node = parent;
+ while (node != null && logger == null) {
+ logger = node.logger;
+ node = node.parent;
+ }
+ return logger;
+ }
+
+ void setParentLogger(final Logger parent) {
+ for (final Iterator iter = children.values().iterator(); iter
+ .hasNext();) {
+ final LogNode childNode = (LogNode) iter.next();
+ if (childNode.logger == null) {
+ childNode.setParentLogger(parent);
+ } else {
+ doSetParentLogger(childNode.logger, parent);
+ }
+ }
+ }
+
+ }
+
+
+ // -------------------------------------------- ClassLoaderInfo Inner Class
+
+
+ protected static final class ClassLoaderLogInfo {
+ final LogNode rootNode;
+ final Map<String, Logger> loggers = new HashMap<String, Logger>();
+ final Map<String, Handler> handlers = new HashMap<String, Handler>();
+ final Properties props = new Properties();
+
+ ClassLoaderLogInfo(final LogNode rootNode) {
+ this.rootNode = rootNode;
+ }
+
+ }
+
+
+ // ------------------------------------------------- RootLogger Inner Class
+
+
+ /**
+ * This class is needed to instantiate the root of each per classloader
+ * hierarchy.
+ */
+ protected class RootLogger extends Logger {
+ public RootLogger() {
+ super("", null);
+ }
+ }
+
+
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/test/FileHandler.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/FileHandler.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/FileHandler.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.jboss.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.sql.Timestamp;
+import java.util.logging.ErrorManager;
+import java.util.logging.Filter;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+import java.util.logging.SimpleFormatter;
+
+/**
+ * Implementation of <b>Handler</b> that appends log messages to a file
+ * named {prefix}.{date}.{suffix} in a configured directory, with an
+ * optional preceding timestamp.
+ *
+ * @version $Revision: 666 $ $Date: 2008-06-12 16:11:25 +0200 (Thu, 12 Jun 2008) $
+ */
+
+public class FileHandler
+ extends Handler {
+
+
+ // ------------------------------------------------------------ Constructor
+
+
+ public FileHandler() {
+ this(null, null, null);
+ }
+
+
+ public FileHandler(String directory, String prefix, String suffix) {
+ this.directory = directory;
+ this.prefix = prefix;
+ this.suffix = suffix;
+ configure();
+ open();
+ }
+
+
+ // ----------------------------------------------------- Instance Variables
+
+
+ /**
+ * The as-of date for the currently open log file, or a zero-length
+ * string if there is no open log file.
+ */
+ private String date = "";
+
+
+ /**
+ * The directory in which log files are created.
+ */
+ private String directory = null;
+
+
+ /**
+ * The prefix that is added to log file filenames.
+ */
+ private String prefix = null;
+
+
+ /**
+ * The suffix that is added to log file filenames.
+ */
+ private String suffix = null;
+
+
+ /**
+ * The PrintWriter to which we are currently logging, if any.
+ */
+ private PrintWriter writer = null;
+
+
+ // --------------------------------------------------------- Public Methods
+
+
+ /**
+ * Format and publish a <tt>LogRecord</tt>.
+ *
+ * @param record description of the log event
+ */
+ public void publish(LogRecord record) {
+
+ if (!isLoggable(record)) {
+ return;
+ }
+
+ // Construct the timestamp we will use, if requested
+ Timestamp ts = new Timestamp(System.currentTimeMillis());
+ String tsString = ts.toString().substring(0, 19);
+ String tsDate = tsString.substring(0, 10);
+
+ // If the date has changed, switch log files
+ if (!date.equals(tsDate)) {
+ synchronized (this) {
+ if (!date.equals(tsDate)) {
+ close();
+ date = tsDate;
+ open();
+ }
+ }
+ }
+
+ String result = null;
+ try {
+ result = getFormatter().format(record);
+ } catch (Exception e) {
+ reportError(null, e, ErrorManager.FORMAT_FAILURE);
+ return;
+ }
+
+ try {
+ if (writer != null) {
+ writer.write(result);
+ writer.flush();
+ } else {
+ reportError("FileHandler is closed or not yet initialized, unable to log ["+result+"]", null, ErrorManager.WRITE_FAILURE);
+ }
+ } catch (Exception e) {
+ reportError(null, e, ErrorManager.WRITE_FAILURE);
+ return;
+ }
+
+ }
+
+
+ // -------------------------------------------------------- Private Methods
+
+
+ /**
+ * Close the currently open log file (if any).
+ */
+ public void close() {
+
+ try {
+ if (writer == null)
+ return;
+ writer.write(getFormatter().getTail(this));
+ writer.flush();
+ writer.close();
+ writer = null;
+ date = "";
+ } catch (Exception e) {
+ reportError(null, e, ErrorManager.CLOSE_FAILURE);
+ }
+
+ }
+
+
+ /**
+ * Flush the writer.
+ */
+ public void flush() {
+
+ try {
+ writer.flush();
+ } catch (Exception e) {
+ reportError(null, e, ErrorManager.FLUSH_FAILURE);
+ }
+
+ }
+
+
+ /**
+ * Configure from <code>LogManager</code> properties.
+ */
+ private void configure() {
+
+ Timestamp ts = new Timestamp(System.currentTimeMillis());
+ String tsString = ts.toString().substring(0, 19);
+ date = tsString.substring(0, 10);
+
+ String className = FileHandler.class.getName();
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+ // Retrieve configuration of logging file name
+ if (directory == null)
+ directory = getProperty(className + ".directory", "logs");
+ if (prefix == null)
+ prefix = getProperty(className + ".prefix", "juli.");
+ if (suffix == null)
+ suffix = getProperty(className + ".suffix", ".log");
+
+ // Get logging level for the handler
+ setLevel(Level.parse(getProperty(className + ".level", "" + Level.ALL)));
+
+ // Get filter configuration
+ String filterName = getProperty(className + ".filter", null);
+ if (filterName != null) {
+ try {
+ setFilter((Filter) cl.loadClass(filterName).newInstance());
+ } catch (Exception e) {
+ // Ignore
+ }
+ }
+
+ // Set formatter
+ String formatterName = getProperty(className + ".formatter", null);
+ if (formatterName != null) {
+ try {
+ setFormatter((Formatter) cl.loadClass(formatterName).newInstance());
+ } catch (Exception e) {
+ // Ignore
+ }
+ } else {
+ setFormatter(new SimpleFormatter());
+ }
+
+ // Set error manager
+ setErrorManager(new ErrorManager());
+
+ }
+
+
+ private String getProperty(String name, String defaultValue) {
+ String value = LogManager.getLogManager().getProperty(name);
+ if (value == null) {
+ value = defaultValue;
+ } else {
+ value = value.trim();
+ }
+ return value;
+ }
+
+
+ /**
+ * Open the new log file for the date specified by <code>date</code>.
+ */
+ private void open() {
+
+ // Create the directory if necessary
+ File dir = new File(directory);
+ dir.mkdirs();
+
+ // Open the current log file
+ try {
+ String pathname = dir.getAbsolutePath() + File.separator +
+ prefix + date + suffix;
+ writer = new PrintWriter(new FileWriter(pathname, true), true);
+ writer.write(getFormatter().getHead(this));
+ } catch (Exception e) {
+ reportError(null, e, ErrorManager.OPEN_FAILURE);
+ writer = null;
+ }
+
+ }
+
+
+}
Modified: trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-03 09:44:00 UTC (rev 2762)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -42,8 +42,6 @@
import org.apache.catalina.core.*;
import org.apache.catalina.startup.HostConfig;
-import org.apache.catalina.LifecycleListener;
-
public class JBossWeb extends Embedded {
private String route = null;
@@ -222,7 +220,7 @@
}
public Connector addConnector(int port) throws IOException {
- return addConnector(port, "http");
+ return addConnector(port, "https");
}
public Connector addConnector(int port, String scheme) throws IOException {
@@ -234,6 +232,13 @@
Connector connector = createConnector( address,
port, scheme);
+ /* Set the SSL properties */
+ connector.setProperty("SSLCertificateFile", "newcert.pem");
+ connector.setProperty("SSLCertificateKeyFile", "newkey.pem");
+ connector.setProperty("SSLPassword", "changeit");
+ connector.setProperty("SLEnabled", "true");
+ connector.setSecure(true);
+ connector.setScheme(scheme);
// Look in StandardService to see why it works ;-)
addConnector( connector );
Modified: trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java 2011-05-03 09:44:00 UTC (rev 2762)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java 2011-05-04 08:24:29 UTC (rev 2763)
@@ -44,8 +44,12 @@
import org.apache.catalina.LifecycleListener;
+import org.jboss.logging.Logger;
+
public class StartJBossWeb {
+ private static Logger log = Logger.getLogger(StartJBossWeb.class);
+
/* Start a JBossWEB with domain */
public static void main(String[] args) {
@@ -61,22 +65,31 @@
domain = args[2];
serverport = Integer.parseInt(args[3]);
}
- System.out.println("Starting JBossWEB on " + port + " " + node + " " + domain + " " + serverport);
+
+ log.info("Starting JBossWEB on " + port + " " + node + " " + domain + " " + serverport);
try {
server = (StandardServer) ServerFactory.getServer();
server.setPort(serverport);
service = new JBossWeb(node, "localhost");
- service.addConnector(port);
+ AprLifecycleListener apr = new AprLifecycleListener();
+ server.addLifecycleListener(apr);
+
+ service.addConnector(port, "https", null);
server.addService(service);
+
+ // server.addLifecycleListener(apr);
+ server.init();
server.start();
} catch(IOException ex) {
ex.printStackTrace();
} catch (LifecycleException ex) {
ex.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
}
// Wait until we are stopped...
13 years, 10 months
JBoss Native SVN: r2762 - in trunk/build/unix/util/jbossweb: node1 and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-03 05:44:00 -0400 (Tue, 03 May 2011)
New Revision: 2762
Added:
trunk/build/unix/util/jbossweb/node1/
trunk/build/unix/util/jbossweb/node1/conf/
trunk/build/unix/util/jbossweb/node1/conf/logging.properties
Log:
Add log configuration file.
Added: trunk/build/unix/util/jbossweb/node1/conf/logging.properties
===================================================================
--- trunk/build/unix/util/jbossweb/node1/conf/logging.properties (rev 0)
+++ trunk/build/unix/util/jbossweb/node1/conf/logging.properties 2011-05-03 09:44:00 UTC (rev 2762)
@@ -0,0 +1,49 @@
+handlers = 1catalina.org.jboss.test.FileHandler, 2localhost.org.jboss.test.FileHandler, 3manager.org.jboss.test.FileHandler, 4admin.org.jboss.test.FileHandler, 5host-manager.org.jboss.test.FileHandler, java.util.logging.ConsoleHandler
+
+.handlers = 1catalina.org.jboss.test.FileHandler, java.util.logging.ConsoleHandler
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+1catalina.org.jboss.test.FileHandler.level = FINE
+1catalina.org.jboss.test.FileHandler.directory = ${catalina.base}/logs
+1catalina.org.jboss.test.FileHandler.prefix = catalina.
+
+2localhost.org.jboss.test.FileHandler.level = FINE
+2localhost.org.jboss.test.FileHandler.directory = ${catalina.base}/logs
+2localhost.org.jboss.test.FileHandler.prefix = localhost.
+
+3manager.org.jboss.test.FileHandler.level = FINE
+3manager.org.jboss.test.FileHandleorg.jboss.test.FileHandlerse}/logs
+3manager.org.jboss.test.FileHandler.prefix = manager.
+
+5host-manager.org.jboss.test.FileHandler.level = FINE
+5host-manager.org.jboss.test.FileHandler.directory = ${catalina.base}/logs
+5host-manager.org.jboss.test.FileHandler.prefix = host-manager.
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.jboss.test.FileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.jboss.test.FileHandler
+
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
+org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 5host-manager.org.jboss.test.FileHandler
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#org.apache.catalina.startup.ContextConfig.level = FINE
+#org.apache.catalina.startup.HostConfig.level = FINE
+#org.apache.catalina.session.ManagerBase.level = FINE
+org.apache.catalina.core.AprLifecycleListener.level=FINE
13 years, 10 months
JBoss Native SVN: r2761 - trunk/build/unix/util/jbossweb/org/jboss/test.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-02 13:52:46 -0400 (Mon, 02 May 2011)
New Revision: 2761
Modified:
trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
Log:
we don't need the servlet for tests.
Modified: trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-02 17:40:04 UTC (rev 2760)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-02 17:52:46 UTC (rev 2761)
@@ -128,22 +128,6 @@
out.write(route + ":This is a test\n");
out.close();
- // Copy a small servlets for testing.
- fd = new File ( route + "/webapps/" + webapp + "/WEB-INF/classes");
- fd.mkdirs();
- // Session logic tests...
- fd = new File (route + "/webapps/" + webapp + "/WEB-INF/classes" , "MyCount.class");
- File fdin = new File ("MyCount.class");
- if (!fdin.exists())
- fdin = new File ("output/classes/MyCount.class");
- copyFile(fdin, fd);
- // Simple tests...
- fd = new File (route + "/webapps/" + webapp + "/WEB-INF/classes" , "MyTest.class");
- fdin = new File ("MyTest.class");
- if (!fdin.exists())
- fdin = new File ("output/classes/MyTest.class");
- copyFile(fdin, fd);
-
//Create Host
Host baseHost = createHost( host, appBase);
baseHost.setDeployOnStartup(true);
@@ -238,7 +222,7 @@
}
public Connector addConnector(int port) throws IOException {
- return addConnector(port, "ajp");
+ return addConnector(port, "http");
}
public Connector addConnector(int port, String scheme) throws IOException {
13 years, 10 months
JBoss Native SVN: r2760 - in trunk/build/unix/util: jbossweb and 3 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-05-02 13:40:04 -0400 (Mon, 02 May 2011)
New Revision: 2760
Added:
trunk/build/unix/util/jbossweb/
trunk/build/unix/util/jbossweb/build.properties.default
trunk/build/unix/util/jbossweb/build.xml
trunk/build/unix/util/jbossweb/org/
trunk/build/unix/util/jbossweb/org/jboss/
trunk/build/unix/util/jbossweb/org/jboss/test/
trunk/build/unix/util/jbossweb/org/jboss/test/ControlJBossWeb.java
trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
trunk/build/unix/util/jbossweb/org/jboss/test/ProcJBossWeb.java
trunk/build/unix/util/jbossweb/org/jboss/test/ServerThread.java
trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java
Log:
Logoc from mod_cluster to test jbossnative....
Added: trunk/build/unix/util/jbossweb/build.properties.default
===================================================================
--- trunk/build/unix/util/jbossweb/build.properties.default (rev 0)
+++ trunk/build/unix/util/jbossweb/build.properties.default 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,22 @@
+base.path=${user.home}/java
+base-apache.loc=http://archive.apache.org/dist/
+
+commons-logging.loc=${base-apache.loc}/commons/logging/binaries/commons-logging-1.0.4.tar.gz
+commons-logging.jar=${base.path}/commons-logging-1.0.4/commons-logging.jar
+
+# Location of jbossweb jar files.
+base-jbossweb.loc=http://repository.jboss.org/nexus/content/groups/public-jboss/jboss/web/
+jbossweb.version=2.1.11.GA
+
+jbossweb.jar.loc=${base-jbossweb.loc}/jbossweb/${jbossweb.version}/jbossweb-${jbossweb.version}.jar
+jbossweb.jar=${base.path}/${jbossweb.version}/jbossweb-${jbossweb.version}.jar
+
+servlet-api.jar.loc=${base-jbossweb.loc}/servlet-api/${jbossweb.version}/servlet-api-${jbossweb.version}.jar
+servlet-api.jar=${base.path}/${jbossweb.version}/servlet-api-${jbossweb.version}.jar
+
+jboss-logging.version=2.0.3.GA
+base-jboss-logging.home=${base.path}/${jboss-logging.version}/lib
+jboss-logging.jar.loc=${base-jboss.loc}/jboss-logging-spi/${jboss-logging.version}/jboss-logging-spi-${jboss-logging.version}.jar
+jboss-logging.jar=${base.path}/${jboss-logging.version}/jboss-logging-spi-${jboss-logging.version}.jar
+
+base-jbossweb.home=${base.path}/${jbossweb.version}/lib
Added: trunk/build/unix/util/jbossweb/build.xml
===================================================================
--- trunk/build/unix/util/jbossweb/build.xml (rev 0)
+++ trunk/build/unix/util/jbossweb/build.xml 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+ * Copyright(c) 2011 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 library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+-->
+<project name="jbosswebtests" default="all" basedir=".">
+
+ <!-- See "build.properties.sample" in the top level directory for all -->
+ <!-- property values you must customize for successful building!!! -->
+ <property file="${user.home}/build.properties"/>
+ <property file="build.properties"/>
+
+ <property file="build.properties.default"/>
+
+ <property name="test.classes" value="${basedir}/output/classes"/>
+
+ <path id="jbossweb.test.classpath">
+ <pathelement location="${test.classes}"/>
+ <pathelement location="${commons-logging.jar}"/>
+
+ <pathelement location="${jbossweb.jar}"/>
+ <pathelement location="${servlet-api.jar}"/>
+ </path>
+
+ <property name="compile.source" value="1.5"/>
+
+ <target name="all" depends="compile">
+ <antcall target="startjbossweb">
+ <param name="line" value="8009 node1 dom1 8005"/>
+ </antcall>
+ </target>
+
+ <target name="startjbossweb" depends="compile">
+ <java dir="${test.classes}" classname="org.jboss.test.StartJBossWeb"
+ spawn="true" fork="yes">
+ <arg line="${line}"/>
+ <jvmarg line="-Dcluster=${cluster}"/>
+ <classpath refid="jbossweb.test.classpath"/>
+ </java>
+ <echo message="startjbossweb ${line}"/>
+ <echo message="startjbossweb ${test.classes}"/>
+ <echo message="startjbossweb ${jbossweb.jar}"/>
+ <echo message="startjbossweb ${servlet-api.jar}"/>
+ <echo message="startjbossweb ${commons-logging.jar}"/>
+ <echo message="startjbossweb ${jboss-logging.jar}"/>
+ </target>
+
+ <target name="compile" depends="download">
+ <mkdir dir="${test.classes}"/>
+ <mkdir dir="${test.classes}/conf"/>
+
+ <javac srcdir="." destdir="${test.classes}"
+ debug="on" debuglevel="lines,vars,source"
+ deprecation="${compile.deprecation}"
+ source="${compile.source}"
+ optimize="${compile.optimize}">
+ <classpath refid="jbossweb.test.classpath" />
+ <include name="org/jboss/test/**" />
+ </javac>
+ </target>
+
+ <target name="download" description="Builds and download dependent components">
+ <antcall target="downloadfile">
+ <param name="sourcefile" value="${servlet-api.jar.loc}"/>
+ <param name="destfile" value="${servlet-api.jar}"/>
+ <param name="destdir" value="${base-jbossweb.home}"/>
+ </antcall>
+ <antcall target="downloadfile">
+ <param name="sourcefile" value="${jbossweb.jar.loc}"/>
+ <param name="destfile" value="${jbossweb.jar}"/>
+ <param name="destdir" value="${base-jbossweb.home}"/>
+ </antcall>
+ </target>
+
+ <target name="downloadfile" unless="exist" depends="testexist">
+ <mkdir dir="${destdir}" />
+ <get src="${sourcefile}" dest="${destfile}" />
+ </target>
+
+ <target name="testexist">
+ <echo message="Testing for ${destfile}"/>
+ <available file="${destfile}" property="exist"/>
+ </target>
+</project>
Added: trunk/build/unix/util/jbossweb/org/jboss/test/ControlJBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/ControlJBossWeb.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/ControlJBossWeb.java 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,134 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2009 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.test;
+
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+/*
+ * It controls are JBossWeb running via the stdin/stdout.
+ */
+public class ControlJBossWeb {
+
+ private BufferedReader bufferedreader;
+ private PrintStream out;
+
+ public ControlJBossWeb() throws Exception {
+ Runtime runtime = Runtime.getRuntime();
+ String classpath = System.getProperty("java.class.path");
+ Process proc = runtime.exec("java -cp " + classpath + " org.jboss.mod_cluster.ProcJBossWeb");
+ InputStreamReader input = new InputStreamReader(proc.getInputStream());
+ bufferedreader = new BufferedReader(input);
+ out = new PrintStream(proc.getOutputStream());
+ }
+ private boolean isResponseOK() {
+ try {
+ String line;
+ while ((line = bufferedreader.readLine()) != null) {
+ if (line.compareToIgnoreCase("OK") == 0)
+ return true;
+ if (line.startsWith("FAILED")) {
+ System.out.println(line);
+ while ((line = bufferedreader.readLine()) != null) {
+ System.out.println(line);
+ }
+ return false;
+ }
+ System.out.println(line);
+ }
+ } catch (IOException ex) {
+ return false;
+ }
+ return false;
+ }
+ public void stop() throws IOException {
+ out.println("stop");
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public void start() throws IOException {
+ out.println("start");
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public void exit() throws IOException {
+ out.println("exit");
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public void newJBossWeb(String node, String host) throws IOException {
+ out.println("new " + node + " " + host);
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public void addConnector(int port) throws IOException {
+ out.println("addConnector " + port);
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public void addService() throws IOException {
+ out.println("addService");
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public void addLifecycleListener(String ip, int port) throws IOException {
+ out.println("addLifecycleListener " + ip + " " + port);
+ out.flush();
+ if (!isResponseOK())
+ throw new IOException("response is not OK");
+ }
+ public String getProxyInfo() throws IOException {
+ out.println("getProxyInfo");
+ out.flush();
+ String line = bufferedreader.readLine();
+ int l;
+ if (line.startsWith("FAILED")) {
+ l = 1024; /* Enough ? */
+ } else {
+ l = Integer.parseInt(line);
+ }
+ String result = "";
+ while ((line = bufferedreader.readLine()) != null && result.length() < (l-2)) {
+ result = result.concat(line);
+ result = result.concat("\n");
+ }
+ if (l == 0)
+ return null;
+ return result;
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/JBossWeb.java 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,270 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 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 library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import org.apache.catalina.startup.Embedded;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.Context;
+import org.apache.catalina.*;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.*;
+import org.apache.catalina.startup.HostConfig;
+
+import org.apache.catalina.LifecycleListener;
+
+public class JBossWeb extends Embedded {
+
+ private String route = null;
+
+ private void copyFile(File in, File out) throws IOException {
+ FileInputStream fis = new FileInputStream(in);
+ FileOutputStream fos = new FileOutputStream(out);
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while((i=fis.read(buf))!=-1) {
+ fos.write(buf, 0, i);
+ }
+ fis.close();
+ fos.close();
+ }
+
+ private static void copyFiles(File src, File dest) throws IOException {
+ if (src.isDirectory()) {
+ if (!dest.exists())
+ dest.mkdirs();
+
+ String list[] = src.list();
+ for (int i = 0; i < list.length; i++) {
+ File dest1 = new File(dest, list[i]);
+ File src1 = new File(src, list[i]);
+ copyFiles(src1 , dest1);
+ }
+ } else {
+ //This was not a directory, so lets just copy the file
+ FileInputStream fin = null;
+ FileOutputStream fout = null;
+ byte[] buffer = new byte[4096]; //Buffer 4K at a time (you can change this).
+ int bytesRead;
+ //open the files for input and output
+ fin = new FileInputStream(src);
+ fout = new FileOutputStream (dest);
+ //while bytesRead indicates a successful read, lets write...
+ while ((bytesRead = fin.read(buffer)) >= 0) {
+ fout.write(buffer,0,bytesRead);
+ }
+ fout.close();
+ fin.close();
+ }
+ }
+ private void copyNativeDir(String route) throws IOException {
+ File in = new File("bin/");
+ if (!in.exists()) {
+ return;
+ }
+ File ou = new File("node1/bin");
+ if (!ou.exists()) {
+ ou.mkdirs();
+ }
+ copyFiles(in, ou);
+ }
+
+ public JBossWeb(String route, String host, boolean nat, String webapp, String[] Aliases) throws IOException {
+ // Copy native tree...
+ if (nat) {
+ copyNativeDir(route);
+ }
+
+ setCatalinaBase(route);
+ setCatalinaHome(route);
+ this.route = route;
+
+ //Create an Engine
+ Engine baseEngine = createEngine();
+
+ baseEngine.setName(host + "Engine" + route);
+ baseEngine.setDefaultHost(host);
+ baseEngine.setJvmRoute(route);
+ baseEngine.setRealm(null);
+
+ // Create node1/webapps/ROOT and index.html
+ File fd = new File ( route + "/webapps/" + webapp);
+ fd.mkdirs();
+ String docBase = fd.getAbsolutePath();
+ String appBase = fd.getParent();
+ fd = new File (route + "/webapps/" + webapp, "index.html");
+ FileWriter out = new FileWriter(fd);
+ out.write(route + ":This is a test\n");
+ out.close();
+
+ // Copy a small servlets for testing.
+ fd = new File ( route + "/webapps/" + webapp + "/WEB-INF/classes");
+ fd.mkdirs();
+ // Session logic tests...
+ fd = new File (route + "/webapps/" + webapp + "/WEB-INF/classes" , "MyCount.class");
+ File fdin = new File ("MyCount.class");
+ if (!fdin.exists())
+ fdin = new File ("output/classes/MyCount.class");
+ copyFile(fdin, fd);
+ // Simple tests...
+ fd = new File (route + "/webapps/" + webapp + "/WEB-INF/classes" , "MyTest.class");
+ fdin = new File ("MyTest.class");
+ if (!fdin.exists())
+ fdin = new File ("output/classes/MyTest.class");
+ copyFile(fdin, fd);
+
+ //Create Host
+ Host baseHost = createHost( host, appBase);
+ baseHost.setDeployOnStartup(true);
+ baseHost.setBackgroundProcessorDelay(1);
+ StandardHost stdhost = (StandardHost)baseHost;
+ stdhost.setDeployXML(true);
+ stdhost.setConfigClass("org.apache.catalina.startup.ContextConfig");
+ stdhost.setUnpackWARs(true);
+ if (Aliases != null && Aliases.length>0) {
+ for (int j = 0; j < Aliases.length; j++) {
+ stdhost.addAlias(Aliases[j]);
+ }
+ }
+ HostConfig hostConfig = new HostConfig();
+ stdhost.addLifecycleListener(hostConfig);
+ baseEngine.addChild( baseHost );
+
+ //Create default context
+ Context rootContext;
+ if (webapp.equals("ROOT"))
+ rootContext = createContext("/",docBase );
+ else
+ rootContext = createContext("/" + webapp, docBase );
+ rootContext.setIgnoreAnnotations(true);
+ rootContext.setPrivileged(true);
+ baseHost.addChild( rootContext );
+ addEngine( baseEngine );
+ baseEngine.setService(this);
+ this.setName(host + "Engine" + route);
+ setRedirectStreams(false);
+ }
+ void AddContext(String path, String docBase, String servletname, boolean wait) {
+ File fd = new File ( route + "/webapps/" + docBase);
+ fd.mkdirs();
+ docBase = fd.getAbsolutePath();
+
+ Context context = createContext(path, docBase);
+ context.setIgnoreAnnotations(true);
+ context.setPrivileged(true);
+
+ if (servletname != null) {
+ Wrapper wrapper = context.createWrapper();
+ wrapper.setName(servletname);
+ wrapper.setServletClass(servletname);
+ if (wait) {
+ wrapper.addInitParameter("wait", "10000");
+ wrapper.setLoadOnStartup(1);
+ }
+ context.addChild(wrapper);
+ context.addServletMapping("/" + servletname, servletname);
+ }
+
+
+ Engine engine = (Engine) getContainer();
+ Container[] containers = engine.findChildren();
+ for (int j = 0; j < containers.length; j++) {
+ if (containers[j] instanceof Host) {
+ Host host = (Host) containers[j];
+ host.addChild(context);
+ }
+ }
+ }
+ void AddContext(String path, String docBase) {
+ AddContext(path, docBase, null, false);
+ }
+
+ public JBossWeb(String route, String host) throws IOException {
+ this(route, host, false);
+ }
+ public JBossWeb(String route, String host, boolean nat) throws IOException {
+ this(route, host, nat, "ROOT");
+ }
+ public JBossWeb(String route, String host, String webapp) throws IOException {
+ this(route, host, false, webapp);
+ }
+ public JBossWeb(String route, String host, boolean nat, String webapp) throws IOException {
+ this(route, host, nat, webapp, null);
+ }
+
+
+ public void addWAR(String file, String route) throws IOException {
+ File fd = new File ( route + "/" + route + "/webapps");
+ fd.mkdirs();
+
+ String sep = System.getProperty("file.separator");
+ String [] paths = file.split(sep);
+
+ fd = new File (route + "/" + route + "/webapps", paths[paths.length-1]);
+ File fdin = new File (file);
+
+ copyFile(fdin, fd);
+ }
+
+ public Connector addConnector(int port) throws IOException {
+ return addConnector(port, "ajp");
+ }
+
+ public Connector addConnector(int port, String scheme) throws IOException {
+ return addConnector(port, scheme, null);
+ }
+
+ public Connector addConnector(int port, String scheme, String address) throws IOException {
+
+
+ Connector connector = createConnector( address,
+ port, scheme);
+
+ // Look in StandardService to see why it works ;-)
+ addConnector( connector );
+
+ return connector;
+ }
+ public void removeContext(String path) {
+ Engine engine = (Engine) getContainer();
+ Container[] containers = engine.findChildren();
+ for (int j = 0; j < containers.length; j++) {
+ if (containers[j] instanceof StandardHost) {
+ StandardHost host = (StandardHost) containers[j];
+ Context context = host.map(path);
+ containers[j].removeChild(context);
+ }
+ }
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/test/ProcJBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/ProcJBossWeb.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/ProcJBossWeb.java 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,105 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2009 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+import org.apache.catalina.startup.Embedded;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.Context;
+import org.apache.catalina.*;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.*;
+import org.apache.catalina.startup.HostConfig;
+
+import org.apache.catalina.LifecycleListener;
+
+public class ProcJBossWeb {
+
+ StandardServer server = null;
+ JBossWeb service = null;
+ LifecycleListener cluster = null;
+
+ static InputStreamReader input;
+ static BufferedReader bufferedreader;
+
+ public static void main(String[] args) {
+ input = new InputStreamReader(System.in);
+ bufferedreader = new BufferedReader(input);
+
+ ProcJBossWeb proc = new ProcJBossWeb();
+ proc.start();
+ }
+ public void start() {
+
+ server = (StandardServer) ServerFactory.getServer();
+
+ ServerThread wait = null;
+ try {
+ String line;
+ while ((line = bufferedreader.readLine()) != null) {
+ /* Process a command line */
+ String cmd[] = line.split(" ");
+ if (cmd[0].compareToIgnoreCase("exit") == 0) {
+ System.out.println("OK");
+ System.out.flush();
+ System.exit(0);
+ } else if (cmd[0].compareToIgnoreCase("new") == 0) {
+ service = new JBossWeb(cmd[1], cmd[2]);
+ } else if (cmd[0].compareToIgnoreCase("addConnector") == 0) {
+ service.addConnector(Integer.parseInt(cmd[1]));
+ } else if (cmd[0].compareToIgnoreCase("addService")== 0) {
+ server.addService(service);
+ } else if (cmd[0].compareToIgnoreCase("start") == 0) {
+ wait = new ServerThread(3000, server);
+ wait.start();
+ } else if (cmd[0].compareToIgnoreCase("stop") == 0) {
+ wait.stopit();
+ wait.join();
+ server.removeService(service);
+ server.removeLifecycleListener(cluster);
+ }
+ /* Done */
+ System.out.println("OK");
+ System.out.flush();
+ }
+ } catch (Exception ex) {
+ System.out.println("FAILED " + ex);
+ ex.printStackTrace(System.out);
+ System.out.flush();
+ System.exit(1);
+ }
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/test/ServerThread.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/ServerThread.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/ServerThread.java 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,76 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 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 library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.test;
+
+import java.io.IOException;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.Service;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardServer;
+
+public class ServerThread extends Thread {
+ int delay;
+ boolean ok = true;
+ StandardServer server = null;
+ ServerThread thread = null;
+
+ public ServerThread(int delay, StandardServer server) {
+ this.delay = delay;
+ this.server = server;
+ this.thread = this;
+ }
+ public void run() {
+ try {
+ server.init();
+ server.start();
+ while (ok) {
+ Thread.sleep(delay);
+ }
+ // sleep(delay);
+ server.stop();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (LifecycleException ex) {
+ ex.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ public void stopit() {
+ ok = false;
+ try {
+ thread.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java
===================================================================
--- trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java (rev 0)
+++ trunk/build/unix/util/jbossweb/org/jboss/test/StartJBossWeb.java 2011-05-02 17:40:04 UTC (rev 2760)
@@ -0,0 +1,95 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 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 library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import org.apache.catalina.startup.Embedded;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.Context;
+import org.apache.catalina.*;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.*;
+import org.apache.catalina.startup.HostConfig;
+
+import org.apache.catalina.LifecycleListener;
+
+public class StartJBossWeb {
+
+ /* Start a JBossWEB with domain */
+ public static void main(String[] args) {
+
+ StandardServer server = null;
+ JBossWeb service = null;
+ int port = 8009;
+ int serverport = 8005;
+ String node = "node1";
+ String domain = "dom1";
+ if (args.length == 4) {
+ port = Integer.parseInt(args[0]);
+ node = args[1];
+ domain = args[2];
+ serverport = Integer.parseInt(args[3]);
+ }
+ System.out.println("Starting JBossWEB on " + port + " " + node + " " + domain + " " + serverport);
+
+ try {
+ server = (StandardServer) ServerFactory.getServer();
+ server.setPort(serverport);
+
+ service = new JBossWeb(node, "localhost");
+ service.addConnector(port);
+ server.addService(service);
+
+ server.start();
+
+ } catch(IOException ex) {
+ ex.printStackTrace();
+ } catch (LifecycleException ex) {
+ ex.printStackTrace();
+ }
+
+ // Wait until we are stopped...
+ server.await();
+
+ // Stop the server or services.
+ try {
+ server.stop();
+ // service.stop();
+ // service2.stop();
+ } catch (LifecycleException ex) {
+ ex.printStackTrace();
+ }
+
+ }
+}
13 years, 10 months