diff --git a/jonas_doc/.project b/.project similarity index 100% rename from jonas_doc/.project rename to .project diff --git a/jonas_doc/build.properties b/build.properties similarity index 100% rename from jonas_doc/build.properties rename to build.properties diff --git a/jonas_doc/build.xml b/build.xml similarity index 100% rename from jonas_doc/build.xml rename to build.xml diff --git a/jonas/.checkstyle b/jonas/.checkstyle deleted file mode 100644 index f197dee3b2985b4886e60f749981148fca2f5634..0000000000000000000000000000000000000000 --- a/jonas/.checkstyle +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/jonas/.checkstyle_eclipse_config b/jonas/.checkstyle_eclipse_config deleted file mode 100644 index 8bfd33c209e4fa7869217784415138409449c7c8..0000000000000000000000000000000000000000 --- a/jonas/.checkstyle_eclipse_config +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/.classpath b/jonas/.classpath deleted file mode 100644 index da09718cf2a9a7aaf750977343d3ebea025d7dd8..0000000000000000000000000000000000000000 --- a/jonas/.classpath +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/.project b/jonas/.project deleted file mode 100644 index 55002984a295fde2e799555c4267fe8e32a199b6..0000000000000000000000000000000000000000 --- a/jonas/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - jonas - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder - - - - - - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - com.atlassw.tools.eclipse.checkstyle.CheckstyleNature - - diff --git a/jonas/.settings/org.eclipse.jdt.core.prefs b/jonas/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 57d8a6fba76a12be3010fa483feda941e22f029c..0000000000000000000000000000000000000000 --- a/jonas/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Tue Jun 12 16:16:37 CEST 2007 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/jonas/.settings/org.eclipse.jdt.ui.prefs b/jonas/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 4ecc62f0b23feedf576780fe74222c57ff16e792..0000000000000000000000000000000000000000 --- a/jonas/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Tue Jun 12 16:16:38 CEST 2007 -eclipse.preferences.version=1 -internal.default.compliance=default -org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/jonas/build-jb.properties b/jonas/build-jb.properties deleted file mode 100644 index 5c104299b9a923e610d4b805bf274a62b028fef7..0000000000000000000000000000000000000000 --- a/jonas/build-jb.properties +++ /dev/null @@ -1,57 +0,0 @@ -#Drivers directory -drivers.dir=jb.config/lib - -#Services -jonas.services=registry,jmx,jtm,db,security,wm,resource,ejb,ws,web,ear,discovery - -#Jms -jms.port=16010 -jms.topics=sampleTopic,InvoiceTopic -jms.queues=sampleQueue,OrderApprovalQueue,OrdersQueue,MailCompletedOrderQueue,SupPurchaseOrderQueue,MailOrderApprovalQueue,MailQueue - -#Carol -carol.allport=1099 -carol.defaultprotocol=jrmp -carol.jrmpopt=false - -#Web -webcontainer.port=9000 -# Tomcat/Jetty -webcontainer.service.defaultname=tomcat - -#Db -db.port=9001 - -#Discovery -discovery.sourceport=9888 -discovery.greetingport=9899 -discovery.mcastaddr=224.224.224.224 -discovery.mcastport=9080 -discovery.ttl=1 - -#Database -rajdbc.defaultname=hsql - -#DB connections - -rajdbc.hsql.user=jonas -rajdbc.hsql.password=jonas -rajdbc.hsql.url=jdbc:hsqldb:hsql://localhost:9001/db_jonas -rajdbc.hsql.drivername=org.hsqldb.jdbcDriver -rajdbc.hsql.jndiname=jdbc_1 -rajdbc.hsql.jdbcdriverjarfile=none -rajdbc.hsql.mappername=rdb.hsql - - -#Mail -mail.session.name=mailSession_1 -mail.mimepartds.name=mailMimePartDS_1 -mail.to=jean.dupont@objectweb.org -mail.subject=test mail -mail.host=localhost - - -#Wsdl -wsdl.file.name=file1 -wsdl.file.dir=/tmp/ - diff --git a/jonas/build-jb.xml b/jonas/build-jb.xml deleted file mode 100644 index cbde4b1c2c0a71ed0cf74d785aab54208e0a7e33..0000000000000000000000000000000000000000 --- a/jonas/build-jb.xml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/build.properties b/jonas/build.properties deleted file mode 100644 index 1fe05b71e3b13082d4ac5e2a0a4d8b93a2ef3122..0000000000000000000000000000000000000000 --- a/jonas/build.properties +++ /dev/null @@ -1,35 +0,0 @@ -# --------------------------------------------------------------------------- -# JOnAS: Java(TM) Open Application Server -# Copyright (C) 1999-2005 Bull S.A. -# Contact: jonas-team@objectweb.org -# -# 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.1 of the License, or 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; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -# -# -# --------------------------------------------------------------------------- -# $Id$ -# --------------------------------------------------------------------------- - -# Properties defined in this file could be customized - -# options for java compiler -opt.javac.debug on -opt.javac.optimize off -opt.javac.deprecation off - - -# protocols for Carol (jrmp,iiop,cmi) needed by the JOnAS ejbjar task -protocols.names=jrmp,iiop diff --git a/jonas/build.xml b/jonas/build.xml deleted file mode 100644 index d89cb34013ef03cc0e47fdd5b800ed66cedafab5..0000000000000000000000000000000000000000 --- a/jonas/build.xml +++ /dev/null @@ -1,1660 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #Information about the packaging -webcontainer.name Standalone -webcontainer.path - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #Information about the packaging -webcontainer.name Tomcat -webcontainer.path ${tomcat.version} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #Information about the packaging -webcontainer.name Jetty -webcontainer.path ${jetty.version} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/clientbuild.xml b/jonas/clientbuild.xml deleted file mode 100644 index bfecac4aab5805162f34130ffd4a0279b7d17279..0000000000000000000000000000000000000000 --- a/jonas/clientbuild.xml +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JONAS_BASE structure is not initialized properly. - Run ANT create_jonasbase before attempting to create a Win32 Service. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/doc/jonas-doc-en.war b/jonas/doc/jonas-doc-en.war deleted file mode 100644 index 67c34db751d4e61a36f5a4019f185effb776ddca..0000000000000000000000000000000000000000 Binary files a/jonas/doc/jonas-doc-en.war and /dev/null differ diff --git a/jonas/examples/build.properties b/jonas/examples/build.properties deleted file mode 100644 index 2966192baeefea7ef3830d76e6ab50e1b7d92ed9..0000000000000000000000000000000000000000 --- a/jonas/examples/build.properties +++ /dev/null @@ -1,37 +0,0 @@ -# --------------------------------------------------------------------------- -# JOnAS: Java(TM) Open Application Server -# Copyright (C) 2007 Bull S.A. -# Contact: jonas-team@objectweb.org -# -# 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.1 of the License, or 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; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA -# -# -# --------------------------------------------------------------------------- -# $Id$ -# --------------------------------------------------------------------------- - -# Properties defined in this file could be customized - -# options for java compiler -opt.javac.debug on -opt.javac.optimize off - -# genic args -#verbose=true - -# protocols for Carol (jrmp,iiop,cmi) -protocols.names=jrmp,iiop -genicargs=-rmicopts -keep \ No newline at end of file diff --git a/jonas/examples/build.xml b/jonas/examples/build.xml deleted file mode 100644 index 2913af868847775ee6a03e084688d09dca752380..0000000000000000000000000000000000000000 --- a/jonas/examples/build.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/README b/jonas/examples/j2ee1.4/README deleted file mode 100644 index 5e975be49bd3d280b409bdee76ff2a3c6f51990c..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/README +++ /dev/null @@ -1,88 +0,0 @@ - -J2EE 1.4 Example Overview: ------------------ - -This example shows how to access an EJB deployed in a JOnAS EJB container, from - - a servlet deployed in a Tomcat/Jetty container (thin client) - - a client running inside the client container (heavy client) - -It also shows how to use security in Tomcat or Jetty to authentificate the user and in JOnAS -to authorize the user to access the EJB methods. This aspect is described in details -in the "Use Security in JOnAS with TOMCAT" howto of the JOnAS documentation. - -Besides, this example shows the uniform naming resource access supported in JOnAS. -The servlet gets a javax.transaction.UserTransaction object reference from the JNDI -using the "java:comp/UserTransaction" name. Moreover, it gets a reference on the -bean's home using an environment entry: "java:comp/env/ejb/". - -This sample contains an example of using ejb-link which allows to link the EJB to the -servlet. It is used in the web.xml file for both the ejb-ref and -ejb-local-ref tags. It implies that when the servlet performs a lookup on the bean, -the web classloader has got the visibility of the ejb class. -This is due to the classloader hierarchy between the ear classloader, ejb -classloader and the web classloader. - -Finally, this example shows how to add a resource adapter in an ear. - -The "src" directory contains - - An EJB that is a stateful session Bean. - - The servlet source of ServletOp. - - The source of a client which run inside the client container with uniform naming available - - The resource adapter source. - -The "etc" directory contains - - the "xml" directory which contains all the deployment descriptors used for this example : - * application.xml (ear file) - * ejb-jar.xml and jonas-ejb-jar.xml (jar file) - * web.xml, jonas-web.xml (war file) - * ra.xml (rar file) - * application-client.xml, jonas-client1.xml and jonas-client2.xml (two clients jar file) - - the "resources" directory which contains all the resources for this application - * "web" directory contains all resources used by the servlet - - -Compiling this example creates an .ear file that represents an application including : - - a session bean used by the web application - - a web application that will be used by Tomcat or Jetty to run the servlet. - - a resource adapter. - -Prerequisites -------------- -First, you must have installed a web container (ie : Catalina or Jetty) -as the web container service or you will use the heavy client - -Compiling and installing this example: --------------------------------------- - ant install - -Running this example: --------------------- -Commands are given for an Unix system. -(Similar commands can be done on Windows) - -1) Run a jonas server: - jonas start - -2) Load j2ee-1.4.ear (if you have not added it in the ear service descriptors list) using the jonasAadmin -management application (http://:/jonasAdmin) or the 'jonas admin' command. - -3a) Run your web browser (e.g., netscape): - netscape http://:/j2ee-1.4 - where is the name of your machine (localhost by default) - and the port number (9000 by default) - -3b) You can also lookup the Bean by using one of the client of the ear - - Use the default client (first found) - java -jar $JONAS_ROOT/lib/client.jar ($JONAS_ROOT |$JONAS_BASE)/apps/j2ee-1.4.ear -carolFile ($JONAS_ROOT |$JONAS_BASE)/conf/carol.properties - - Use a specific client - java -jar $JONAS_ROOT/lib/client.jar ($JONAS_ROOT |$JONAS_BASE)/apps/j2ee-1.4.ear -jarClient client2.jar -carolFile ($JONAS_ROOT |$JONAS_BASE)/conf/carol.properties - - -Notes : - the argument -carolFile is useless if you have rebuilt this example because in this - case the carol.properties of your environment is inserted in earsample.ear - -4) Stop the jonas server - jonas stop diff --git a/jonas/examples/j2ee1.4/build.xml b/jonas/examples/j2ee1.4/build.xml deleted file mode 100644 index 11963b480a2ac37479b79ab69d7d761f2560b8e4..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/build.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/examples/j2ee1.4/etc/resources/jaas/jaas.config b/jonas/examples/j2ee1.4/etc/resources/jaas/jaas.config deleted file mode 100644 index 86999b42d3bcb05190652c3d4575773e2e32150c..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/resources/jaas/jaas.config +++ /dev/null @@ -1,13 +0,0 @@ -earsample { - // Login Module to use for the example earsample. - - //First, use a LoginModule for the authentication - // Use the resource memrlm_1 - org.objectweb.jonas.security.auth.spi.JResourceLoginModule required - resourceName="memrlm_1" - ; - - // Use the login module to propagate security to the JOnAS server - org.objectweb.jonas.security.auth.spi.ClientLoginModule required - ; -}; \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/etc/resources/web/img/jetty.gif b/jonas/examples/j2ee1.4/etc/resources/web/img/jetty.gif deleted file mode 100644 index 01f44a87f6801b200f142513d0d02b12cea0fb46..0000000000000000000000000000000000000000 Binary files a/jonas/examples/j2ee1.4/etc/resources/web/img/jetty.gif and /dev/null differ diff --git a/jonas/examples/j2ee1.4/etc/resources/web/img/logoOW2.png b/jonas/examples/j2ee1.4/etc/resources/web/img/logoOW2.png deleted file mode 100644 index 71a185b68ed53e228e23c82c4ea0aa47b7556959..0000000000000000000000000000000000000000 Binary files a/jonas/examples/j2ee1.4/etc/resources/web/img/logoOW2.png and /dev/null differ diff --git a/jonas/examples/j2ee1.4/etc/resources/web/img/ow_jonas_logo.gif b/jonas/examples/j2ee1.4/etc/resources/web/img/ow_jonas_logo.gif deleted file mode 100644 index 1b56943a721f82a8cb81776030567772265433f2..0000000000000000000000000000000000000000 Binary files a/jonas/examples/j2ee1.4/etc/resources/web/img/ow_jonas_logo.gif and /dev/null differ diff --git a/jonas/examples/j2ee1.4/etc/resources/web/img/tomcat.gif b/jonas/examples/j2ee1.4/etc/resources/web/img/tomcat.gif deleted file mode 100644 index 61756736b82350f64b5ea1b2bfc31ac57e30a3d3..0000000000000000000000000000000000000000 Binary files a/jonas/examples/j2ee1.4/etc/resources/web/img/tomcat.gif and /dev/null differ diff --git a/jonas/examples/j2ee1.4/etc/resources/web/img/valid-xhtml11.png b/jonas/examples/j2ee1.4/etc/resources/web/img/valid-xhtml11.png deleted file mode 100644 index 2c63d93f8868d574b9e69eda2727b7e7bf7fc8ec..0000000000000000000000000000000000000000 Binary files a/jonas/examples/j2ee1.4/etc/resources/web/img/valid-xhtml11.png and /dev/null differ diff --git a/jonas/examples/j2ee1.4/etc/resources/web/img/vcss.png b/jonas/examples/j2ee1.4/etc/resources/web/img/vcss.png deleted file mode 100644 index 9b2f596e016533327216d98a0a927738fe17384f..0000000000000000000000000000000000000000 Binary files a/jonas/examples/j2ee1.4/etc/resources/web/img/vcss.png and /dev/null differ diff --git a/jonas/examples/j2ee1.4/etc/resources/web/index.html b/jonas/examples/j2ee1.4/etc/resources/web/index.html deleted file mode 100644 index a175464a83f2f1bb2a999014076687f16408c5fc..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/resources/web/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - J2EE 1.4 Example - - - -
logo
-
- Jakarta Tomcat - Mortbay Jetty - JOnAS WebSite -
- -
- J2EE 1.4 Example : Servlet accessing a protected EJB -
- - - - - - \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/etc/resources/web/ow2_jonas.css b/jonas/examples/j2ee1.4/etc/resources/web/ow2_jonas.css deleted file mode 100644 index c1105511cd4e1cbba3a45206826316305ea1e6f3..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/resources/web/ow2_jonas.css +++ /dev/null @@ -1,183 +0,0 @@ -/* - Context Root css. based on css from http://jonas.objectweb.org - XHTML by Florent BENOIT -*/ - - -body -{ - top:10px; - margin-top:10px; - background-color: #FFF; - color: #000000; - } - - -img { - margin: 5px; - border:0; -} - - - -div.logos { - top: 5px; - width: 99%; - text-align: right; -} - - -div.links { - font-size: 14px; - margin-top : 40px; - margin-left : 100px; -} - - -div.titlepage { - margin-left: 200px; - font-family: Arial, Helvetica, sans-serif; - font-size: 1.5em; - line-height: 1.5em; - border-bottom: 1px solid #0099cc; - color : #ff6600; - font-weight : bold; -} - - -div.footer { - margin-top : 50px; - color: #FFFFFF; - font-size: 8pt; - text-align: center; -} - - -/*HTML elements */ - - - -ul, ol, dl -{ - color: black; - font-family: Arial,Helvetica, sans-serif; - font-size: 12px; - line-height: 16px; - font-weight: normal; -} - -li -{ - color: black; - font-family: Arial, Helvetica, sans-serif; - font-size: 14px; - font-weight: normal; - margin: 10px 0px 5px 0px; - -} -a -{ - color: #3F3975; - background-color: transparent; - text-decoration: underline; -} - -a:visited -{ - color: #9898CB; - background-color: transparent; - text-decoration: underline; -} - -a:hover -{ - color: #E06611; - background-color: transparent; - text-decoration: underline; -} - - -a:active -{ - color: #FFFFFF; - background-color: #E06611; - text-decoration: underline; -} - - - - -.h1, .h2, .h3, .h4, .h5 { - color: #000; - background-color: inherit; - padding: 0; -} - -.h1 { - margin-top: 5px; - font-size: 2em; - line-height: 1.5em; - margin: 30px 0 30px 0; - border-bottom: 1px solid #0099cc; - color : #ff6600; - font-weight : bold; -} - -.h2 { - margin: 20px 0 15px 0; - border-bottom: 1px solid #0099cc; - font-weight:normal; - font-style: normal; - font-size: 1.6em; - line-height: 1.4em; - color : #0099cc -} - -.h3 { - font-weight: normal; - font-size: 1.4em; - line-height: 1.4em; - margin: 20px 0 15px 0; -} - -.h4 { - font-weight:normal; - color: #404040; - margin: 20px 0 0 0; - left: 0px; - font-size: 1.4em; - line-height: 1.4em; -} -.h5 { - font-weight:normal; - color: #404040; - font-style: normal; - margin: 0px; - left: 0px; - font-size: 1.2em; - line-height: 1.2em; -} - -td -{ - color: black; - font-family: Arial,Helvetica, sans-serif; - font-size: 12px; - font-weight: normal; -} - -p -{ - color: black; - font-family: Arial,Helvetica, sans-serif; - font-size: 12px; - line-height: 16px; - font-weight: normal; - margin: 10px 10px 5px 0px; -} - -p.error -{ - color: red; -} - diff --git a/jonas/examples/j2ee1.4/etc/xml/application-client.xml b/jonas/examples/j2ee1.4/etc/xml/application-client.xml deleted file mode 100644 index b73837e4e0161e29b8b9e0f86732891d017c6845..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/application-client.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - Client of the earsample - - - envEntryString - java.lang.String - - Test of envEntry of application-client.xml file - - - - - - ejb/Op - Session - org.objectweb.earsample.beans.secusb.OpHome - org.objectweb.earsample.beans.secusb.Op - secusb.jar#EarOp - - - - - ejb/OpLink - Session - org.objectweb.earsample.beans.secusb.OpHome - org.objectweb.earsample.beans.secusb.Op - EarOp - - - - url/jonas - java.net.URL - Container - - - - org.objectweb.jonas.security.auth.callback.LoginCallbackHandler - - - diff --git a/jonas/examples/j2ee1.4/etc/xml/application.xml b/jonas/examples/j2ee1.4/etc/xml/application.xml deleted file mode 100644 index d4311e09f4d287e335873247480938d480ce1320..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/application.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - ear example secusb/servlet - earsample secusb/servlet - - - secusb.jar - - - - - earsample.war - j2ee-1.4 - - - - - client1.jar - - - client2.jar - - - - ra-sample.rar - - - diff --git a/jonas/examples/j2ee1.4/etc/xml/jonas-client1.xml b/jonas/examples/j2ee1.4/etc/xml/jonas-client1.xml deleted file mode 100644 index b7b0d3fdd13c014c9c8c4007d5d15a71cc6e97f8..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/jonas-client1.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - url/jonas - http://jonas.objectweb.org - - - - jaas.config - earsample - jonas - jonas - - - diff --git a/jonas/examples/j2ee1.4/etc/xml/jonas-client2.xml b/jonas/examples/j2ee1.4/etc/xml/jonas-client2.xml deleted file mode 100644 index 1cf3ead28217b38d9d294e14fe42339981790f47..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/jonas-client2.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - url/jonas - http://jonas.objectweb.org - - - - jaas.config - earsample - - - diff --git a/jonas/examples/j2ee1.4/etc/xml/jonas-secusb.xml b/jonas/examples/j2ee1.4/etc/xml/jonas-secusb.xml deleted file mode 100644 index ca04b169dbabb1e2aa96fb0c0cab7e7d16639f07..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/jonas-secusb.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - EarOp - EarOpHome - - diff --git a/jonas/examples/j2ee1.4/etc/xml/jonas-web.xml b/jonas/examples/j2ee1.4/etc/xml/jonas-web.xml deleted file mode 100644 index 069066e888db6286da168edf096d60786379f63e..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/jonas-web.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - url/URL - http://jonas.objectweb.org - - - diff --git a/jonas/examples/j2ee1.4/etc/xml/ra.xml b/jonas/examples/j2ee1.4/etc/xml/ra.xml deleted file mode 100755 index 73edde1b462012273682391d0c085db6c9d60bc5..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/ra.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - rar sample - rar sample - ObjectWeb - - 1.0 - - false - - - - - org.objectweb.earsample.resourceadapters.ResourceAdapterImpl - - - - JNDI name - jndiName - - java.lang.String - - - eisName - - - - URL for EIS instance - EisURL - - java.lang.String - - - EIS_URL - - - - \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/etc/xml/secusb.xml b/jonas/examples/j2ee1.4/etc/xml/secusb.xml deleted file mode 100644 index 531d055c2d0855cc4b401414651493bb6859d2f4..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/secusb.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - secured session bean JOnAS example - - secusb (earsample) - - - - EarOp - org.objectweb.earsample.beans.secusb.OpHome - org.objectweb.earsample.beans.secusb.Op - org.objectweb.earsample.beans.secusb.OpLocalHome - org.objectweb.earsample.beans.secusb.OpLocal - org.objectweb.earsample.beans.secusb.OpBean - Stateful - Container - - - - - - tomcat - - - jetty - - - - tomcat - - EarOp - * - - - - - jetty - - EarOp - * - - - - - - EarOp - * - - Supports - - - - - diff --git a/jonas/examples/j2ee1.4/etc/xml/web.xml b/jonas/examples/j2ee1.4/etc/xml/web.xml deleted file mode 100644 index ad5e085f2c35100ff95a6420381abb24c2d9c86f..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/etc/xml/web.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - Op - - org.objectweb.earsample.servlets.ServletOp - - - - - Op - /secured/Op - - - - url/URL - java.net.URL - Application - - - - - Protected Area - - /secured/* - - DELETE - GET - POST - PUT - - - - tomcat - jetty - - - - - - BASIC - JOnAS Realm - - - - - tomcat - - - - jetty - - - - - envEntryString - java.lang.String - - This is a string from the env-entry - - - - - ejb/Op - Session - org.objectweb.earsample.beans.secusb.OpHome - org.objectweb.earsample.beans.secusb.Op - EarOp - - - - ejb/OpLocal - Session - - org.objectweb.earsample.beans.secusb.OpLocalHome - - org.objectweb.earsample.beans.secusb.OpLocal - secusb.jar#EarOp - - - diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/Op.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/Op.java deleted file mode 100644 index f4c31355da190939db1e8ed0d68a4bcde03aebc2..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/Op.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.beans.secusb; - -import javax.ejb.EJBObject; -import java.rmi.RemoteException; - -/** - * Remote interface for the bean Op - * @author JOnAS team - */ -public interface Op extends EJBObject { - - /** - * Business method implementation. - * @param shares nb of shares to be bought - * @throws RemoteException if RMI failed. - */ - void buy (int shares) throws RemoteException; - - /** - * Business method implementation. - * @return the nb of shares bought - * @throws RemoteException if RMI failed. - */ - int read () throws RemoteException; - -} \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpBean.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpBean.java deleted file mode 100644 index 65afb2722cda36514c984ac4afc906ad7343e3a3..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpBean.java +++ /dev/null @@ -1,247 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.beans.secusb; - -import javax.ejb.EJBException; -import javax.ejb.SessionBean; -import javax.ejb.SessionContext; -import javax.ejb.SessionSynchronization; - -/** - * This is an example of Session Bean, statefull, and synchronized. - * @author JOnAS team - */ -public class OpBean implements SessionBean, SessionSynchronization { - - /** - * Actual state of the bean - */ - private int total = 0; - - /** - * value inside Tx, not yet committed. - */ - private int newtotal = 0; - - /** - * User client - */ - private String clientUser = null; - - /** - * Session context that the container provides for a session enterprise Bean - * instance. - */ - private SessionContext sessionContext = null; - - /* ========================= ejbCreate methods ============================ */ - - /** - * There must be one ejbCreate() method per create() method on the Home - * interface, and with the same signature. - * @param user the user name - */ - public void ejbCreate(String user) { - total = 0; - // in case we are outside transactions - newtotal = total; - clientUser = user; - } - - /* =============== javax.ejb.SessionBean 2.0 implementation ============== */ - - /** - * The activate method is called when the instance is activated from its - * "passive" state. The instance should acquire any resource that it has - * released earlier in the ejbPassivate() method. This method is called with - * no transaction context. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException This exception is defined in the method - * signature to provide backward compatibility for enterprise beans - * written for the EJB 1.0 specification. Enterprise beans written - * for the EJB 1.1 specification should throw the - * javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB2.0 and higher specifications must throw - * the javax.ejb.EJBException instead of this exception. - */ - public void ejbActivate() throws EJBException, java.rmi.RemoteException { - // Nothing to do for this simple example - } - - /** - * The passivate method is called before the instance enters the "passive" - * state. The instance should release any resources that it can re-acquire - * later in the ejbActivate() method. After the passivate method completes, - * the instance must be in a state that allows the container to use the Java - * Serialization protocol to externalize and store away the instance's - * state. This method is called with no transaction context. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException This exception is defined in the method - * signature to provide backward compatibility for enterprise beans - * written for the EJB 1.0 specification. Enterprise beans written - * for the EJB 1.1 specification should throw the - * javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB2.0 and higher specifications must throw - * the javax.ejb.EJBException instead of this exception. - */ - public void ejbPassivate() throws EJBException, java.rmi.RemoteException { - // Nothing to do for this simple example - } - - /** - * A container invokes this method before it ends the life of the session - * object. This happens as a result of a client's invoking a remove - * operation, or when a container decides to terminate the session object - * after a timeout. This method is called with no transaction context. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException This exception is defined in the method - * signature to provide backward compatibility for enterprise beans - * written for the EJB 1.0 specification. Enterprise beans written - * for the EJB 1.1 specification should throw the - * javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB2.0 and higher specifications must throw - * the javax.ejb.EJBException instead of this exception. - */ - public void ejbRemove() throws EJBException, java.rmi.RemoteException { - // Nothing to do for this simple example - } - - /** - * Set the associated session context. The container calls this method after - * the instance creation. The enterprise Bean instance should store the - * reference to the context object in an instance variable. This method is - * called with no transaction context. - * @param sessionContext A SessionContext interface for the instance. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException This exception is defined in the method - * signature to provide backward compatibility for applications - * written for the EJB 1.0 specification. Enterprise beans written - * for the EJB 1.1 specification should throw the - * javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB2.0 and higher specifications must throw - * the javax.ejb.EJBException instead of this exception. - */ - public void setSessionContext(SessionContext sessionContext) throws EJBException, java.rmi.RemoteException { - this.sessionContext = sessionContext; - } - - /* - * ============== javax.ejb.SessionSynchronization implementation - * ============= - */ - - /** - * The afterBegin method notifies a session Bean instance that a new - * transaction has started, and that the subsequent business methods on the - * instance will be invoked in the context of the transaction. The instance - * can use this method, for example, to read data from a database and cache - * the data in the instance fields. This method executes in the proper - * transaction context. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException - This exception is defined in the - * method signature to provide backward compatibility for enterprise - * beans written for the EJB 1.0 specification. Enterprise beans - * written for the EJB 1.1 and higher specifications should throw - * the javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB 2.0 and higher specifications must not - * throw the java.rmi.RemoteException. - */ - public void afterBegin() throws EJBException, java.rmi.RemoteException { - newtotal = total; - } - - /** - * The beforeCompletion method notifies a session Bean instance that a - * transaction is about to be committed. The instance can use this method, - * for example, to write any cached data to a database. This method executes - * in the proper transaction context. Note: The instance may still - * cause the container to rollback the transaction by invoking the - * setRollbackOnly() method on the instance context, or by throwing an - * exception. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException - This exception is defined in the - * method signature to provide backward compatibility for enterprise - * beans written for the EJB 1.0 specification. Enterprise beans - * written for the EJB 1.1 and higher specifications should throw - * the javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB 2.0 and higher specifications must not - * throw the java.rmi.RemoteException. - */ - public void beforeCompletion() throws EJBException, java.rmi.RemoteException { - } - - /** - * The afterCompletion method notifies a session Bean instance that a - * transaction commit protocol has completed, and tells the instance whether - * the transaction has been committed or rolled back. This method executes - * with no transaction context. - * @param committed - True if the transaction has been committed, false if - * is has been rolled back. - * @throws EJBException Thrown by the method to indicate a failure caused by - * a system-level error. - * @throws java.rmi.RemoteException - This exception is defined in the - * method signature to provide backward compatibility for enterprise - * beans written for the EJB 1.0 specification. Enterprise beans - * written for the EJB 1.1 and higher specifications should throw - * the javax.ejb.EJBException instead of this exception. Enterprise - * beans written for the EJB 2.0 and higher specifications must not - * throw the java.rmi.RemoteException. - */ - public void afterCompletion(boolean committed) throws EJBException, java.rmi.RemoteException { - - if (committed) { - total = newtotal; - } else { - newtotal = total; - } - } - - /* ========================= Op implementation ============================ */ - - /** - * Business method implementation. - * @param s nb of shares to be bought - */ - public void buy(int s) { - newtotal = newtotal + s; - return; - } - - /** - * Business method implementation. - * @return the nb of shares bought - */ - public int read() { - return newtotal; - } -} \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpHome.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpHome.java deleted file mode 100644 index c27269138dc8324e83f469aa2c43f14e96c48a67..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpHome.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.beans.secusb; - -import java.rmi.RemoteException; -import javax.ejb.CreateException; -import javax.ejb.EJBHome; - -/** - * Home interface for the bean Op - * @author JOnAS team - */ -public interface OpHome extends EJBHome { - - /** - * Create an instance of the Op bean. - * @param user the user name. - * @return the Remote interface of the bean Op. - * @throws CreateException if the creation failed. - * @throws RemoteException if the RMI call failed. - */ - Op create(String user) throws CreateException, RemoteException; -} diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpLocal.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpLocal.java deleted file mode 100644 index f65b4b5543bae448569205b9d69987da2ffbec01..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpLocal.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.beans.secusb; - -import javax.ejb.EJBLocalObject; - -/** - * Local interface for the bean Op - * @author JOnAS team - */ -public interface OpLocal extends EJBLocalObject { - - /** - * Business method implementation. - * @param shares nb of shares to be bought - */ - void buy(int shares); - - /** - * Business method implementation. - * @return the nb of shares bought - */ - int read(); -} \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpLocalHome.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpLocalHome.java deleted file mode 100644 index 730e9966246da30e8a5241a6098d55fef3521cf9..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/beans/secusb/OpLocalHome.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.beans.secusb; - -import javax.ejb.CreateException; -import javax.ejb.EJBLocalHome; - -/** - * Local home interface for the bean Op - * @author JOnAS team - */ -public interface OpLocalHome extends EJBLocalHome { - - /** - * Create an instance of the Op bean. - * @param user the user name. - * @return the Remote interface of the bean Op. - * @throws CreateException if the creation failed. - */ - OpLocal create(String user) throws CreateException; -} \ No newline at end of file diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/clients/Client.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/clients/Client.java deleted file mode 100644 index 87aa7e493a303d3ff2cfd9686f2db3982feb75ff..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/clients/Client.java +++ /dev/null @@ -1,189 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer: Florent Benoit - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.clients; - -import java.net.URL; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.transaction.UserTransaction; -import javax.rmi.PortableRemoteObject; - -import org.objectweb.earsample.beans.secusb.Op; -import org.objectweb.earsample.beans.secusb.OpHome; - -/** - * Heavy client doing some operations on a bean - * @author jonas team - */ -public class Client { - - /** - * First amount to buy - */ - private static final int FIRST_BUY_AMOUNT = 10; - - /** - * Second amount to buy - */ - private static final int SECOND_BUY_AMOUNT = 20; - - /** - * Third amount to buy (will be rollback) - */ - private static final int THIRD_BUY_AMOUNT = 50; - - /** - * Constructor. Hide constructor as it is an utility class - */ - private Client() { - - } - - /** - * Main method - * @param args arguments of the client - */ - public static void main(String[] args) { - - Context initialContext = null; - System.out.print("Building a new InitialContext..."); - try { - initialContext = new InitialContext(); - } catch (Exception e) { - System.err.println("Cannot get initial context for JNDI: " + e); - System.exit(2); - } - System.out.println("done !"); - - System.out.print("Looking up java:comp/UserTransaction ..."); - // We want to start transactions from client: get UserTransaction - UserTransaction utx = null; - try { - utx = (UserTransaction) initialContext.lookup("java:comp/UserTransaction"); - } catch (Exception e) { - System.err.println("Cannot lookup UserTransaction: " + e); - System.exit(2); - } - System.out.println("done !"); - - String envEntry = null; - System.out.print("Looking up java:comp/env/envEntryString ..."); - try { - envEntry = (String) initialContext.lookup("java:comp/env/envEntryString"); - } catch (Exception e) { - System.err.println("Cannot get env-entry on JNDI " + e); - System.exit(2); - } - System.out.println("done !"); - System.out.println("Env entry is : " + envEntry); - - URL url = null; - System.out.print("Looking up java:comp/env/url/jonas ..."); - try { - url = (URL) initialContext.lookup("java:comp/env/url/jonas"); - } catch (Exception e) { - System.err.println("Cannot get URL on JNDI " + e); - System.exit(2); - } - System.out.println("done !"); - System.out.println("Web site of jonas is at :" + url); - - System.out.print("Looking up java:comp/env/ejb/Op ..."); - // Connecting to OpHome thru JNDI - OpHome home = null; - try { - home = (OpHome) PortableRemoteObject.narrow(initialContext.lookup("java:comp/env/ejb/Op"), OpHome.class); - System.out.println("done !"); - } catch (Exception e) { - e.printStackTrace(); - System.err.println("Cannot lookup OpHome: " + e); - System.exit(2); - } - - // OpBean creation - Op t1 = null; - try { - System.out.println("Create a bean"); - t1 = home.create("User1"); - } catch (Exception e) { - System.err.println("Cannot create OpBean: " + e); - System.exit(2); - } - - // First transaction (committed) - try { - System.out.println("Start a first transaction"); - utx.begin(); - System.out.println("First request on the new bean"); - t1.buy(FIRST_BUY_AMOUNT); - System.out.println("Second request on the bean"); - t1.buy(SECOND_BUY_AMOUNT); - System.out.println("Commit the transaction"); - utx.commit(); - } catch (Exception e) { - System.err.println("exception during 1st Tx: " + e); - System.exit(2); - } - // Start another transaction (rolled back) - try { - System.out.println("Start a second transaction"); - utx.begin(); - t1.buy(THIRD_BUY_AMOUNT); - System.out.println("Rollback the transaction"); - utx.rollback(); - } catch (Exception e) { - System.err.println("exception during 2nd Tx: " + e); - System.exit(2); - } - - // Get the total bought, outside the transaction - int val = 0; - try { - System.out.println("Request outside any transaction"); - val = t1.read(); - } catch (Exception e) { - System.err.println("Cannot read value on t1 : " + e); - System.exit(2); - } - if (val != FIRST_BUY_AMOUNT + SECOND_BUY_AMOUNT) { - System.err.println("Bad value read: " + val); - System.exit(2); - } - - // Remove Session bean - try { - t1.remove(); - } catch (Exception e) { - System.out.println("Exception on buy: " + e); - System.exit(2); - } - System.out.println("ClientOp OK. Exiting."); - } -} - diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/resourceadapters/ResourceAdapterImpl.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/resourceadapters/ResourceAdapterImpl.java deleted file mode 100755 index 001553566814a33cfcc0e3cf1da5d2c26b87ac75..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/resourceadapters/ResourceAdapterImpl.java +++ /dev/null @@ -1,191 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.resourceadapters; - - -import java.net.MalformedURLException; -import java.util.HashMap; - -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.resource.NotSupportedException; -import javax.resource.ResourceException; -import javax.resource.spi.ActivationSpec; -import javax.resource.spi.BootstrapContext; -import javax.resource.spi.ResourceAdapterInternalException; -import javax.resource.spi.endpoint.MessageEndpointFactory; -import javax.transaction.xa.XAResource; - -/** - * A Resource adapter - * @author kemlerp - * - */ -public class ResourceAdapterImpl implements javax.resource.spi.ResourceAdapter, java.io.Serializable { - - - /** - * serialVersionUID - */ - private static final long serialVersionUID = 3834312812943456568L; - - /** - * String should be the RA name when set, ie, EIS - */ - private String eisurl; - - /** - * The JNDI name - */ - private String jndiName; - - /** - * Initial context - */ - private InitialContext ictx; - - /** - * BootstrapContext - */ - private BootstrapContext bootstrapCtx = null; // set in start() - - /** - * EndpointFactories - */ - private transient HashMap endpointFactories = new HashMap(); - - - /** - * Start - * @param bootstrapCtx bootstrapCtx - * @throws ResourceAdapterInternalException if an error occurs - */ - public void start(BootstrapContext bootstrapCtx) throws ResourceAdapterInternalException { - this.bootstrapCtx = bootstrapCtx; - - try { - ictx = new InitialContext(); - ictx.bind(jndiName, eisurl); - } catch (NamingException e) { - e.printStackTrace(); - } - - } - - /** - * Stop - */ - public void stop() { - try { - ictx.unbind(jndiName); - } catch (NamingException e) { - e.printStackTrace(); - } - } - - - /** - * Called by the application server when a message-driven bean - * (MessageEndpoint) is deployed. - * @param factory MessageEndpointFactory - * @param spec activation spec - * @throws NotSupportedException if an error occurs - * @throws ResourceAdapterInternalException if an error occurs - */ - public void endpointActivation(MessageEndpointFactory factory, ActivationSpec spec) throws NotSupportedException, - ResourceAdapterInternalException { - endpointFactories.put(spec, factory); - } - - /** - * Endpoint Deactivation - * @param factory MessageEndpointFactory - * @param spec activation spec - */ - public void endpointDeactivation(MessageEndpointFactory factory, ActivationSpec spec) { - endpointFactories.remove(spec); - } - - /** - * Get XAResources - * @param specs A tab of specs - * @throws ResourceException if an error occurs - * @return Tab of XAResources - */ - public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException { - return null; - } - - /** - * Get Eis URL - * @return Eis URL - */ - public String getEisURL() { - return eisurl.toString(); - } - - /** - * Set Eis URL - * @param eisURL Eis URL - * @throws MalformedURLException if 'eisURL' is not a URL - */ - public void setEisURL(String eisURL) throws MalformedURLException { - // ra.xml deployment supplies value - this.eisurl = eisURL; - } - - /** - * Get BootstrapContext - * @return bootstrapCtx - */ - public BootstrapContext getBootstrapCtx() { - return bootstrapCtx; - } - - /** - * Set BootstrapContext - * @param bootstrapCtx bootstrapContext - */ - public void setBootstrapCtx(BootstrapContext bootstrapCtx) { - this.bootstrapCtx = bootstrapCtx; - } - - /** - * Get used JNDI name - * @return A string - */ - public String getJndiName() { - return jndiName; - } - - /** - * Set JNDI name - * @param jndiName a string - */ - public void setJndiName(String jndiName) { - this.jndiName = jndiName; - } -} diff --git a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/servlets/ServletOp.java b/jonas/examples/j2ee1.4/src/org/objectweb/earsample/servlets/ServletOp.java deleted file mode 100644 index af5ce79149522e8a8eca6326139fde1075de2bb3..0000000000000000000000000000000000000000 --- a/jonas/examples/j2ee1.4/src/org/objectweb/earsample/servlets/ServletOp.java +++ /dev/null @@ -1,304 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.earsample.servlets; - -import java.io.IOException; -import java.io.PrintWriter; -import java.net.URL; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.rmi.PortableRemoteObject; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.transaction.UserTransaction; - -import org.objectweb.earsample.beans.secusb.Op; -import org.objectweb.earsample.beans.secusb.OpHome; -import org.objectweb.earsample.beans.secusb.OpLocal; -import org.objectweb.earsample.beans.secusb.OpLocalHome; - -/** - * This servlet is an example to show how to access a EJB from a servlet - * @author JOnAS team - */ -public class ServletOp extends HttpServlet { - - /** - * First amount to buy - */ - private static final int FIRST_BUY_AMOUNT = 10; - - /** - * Second amount to buy - */ - private static final int SECOND_BUY_AMOUNT = 20; - - /** - * Third amount to buy (will be rollback) - */ - private static final int THIRD_BUY_AMOUNT = 50; - - - /** - * Called by the server (via the service method) to allow a servlet to - * handle a GET request. - * @param request an HttpServletRequest object that contains the request - * the client has made of the servlet - * @param response an HttpServletResponse object that contains the - * response the servlet sends to the client - * @throws IOException if an input or output error is detected when the - * servlet handles the GET request - * @throws ServletException if the request for the GET could not be handled - */ - public void doGet(HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { - - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - out.println(""); - out.println(""); - out.println(""); - out.println(""); - out.println("Ear Sample of Servlet accessing a protected EJB"); - out.println(""); - out.println(""); - out.println("

Ear sample of Servlet accessing a protected EJB"); - out.println("

\"Tomcat"); - out.println("\"Jetty"); - out.println("\"JOnAS"); - out.println("

Initial context / UserTransaction

"); - out.println("
    "); - Context initialContext = null; - try { - initialContext = new InitialContext(); - out.println("
  • Initial context OK
  • "); - } catch (Exception e) { - out.print("
  • Cannot get initial context for JNDI: "); - out.println(e + "
  • "); - return; - } - - // We want to start transactions from client: get UserTransaction - UserTransaction utx = null; - try { - utx = (UserTransaction) initialContext.lookup("java:comp/UserTransaction"); - out.println("
  • Get java:comp/UserTransaction OK
  • "); - } catch (Exception e) { - out.println("
  • Cannot lookup java:comp/UserTransaction: " + e + "
  • "); - return; - } - out.println("

"); - - out.println("

"); - out.println("Lookup on env-entry with java:comp/env/envEntryString"); - out.println("

"); - out.println("
    "); - String envEntry = null; - try { - envEntry = (String) initialContext.lookup("java:comp/env/envEntryString"); - out.println("
  • Env entry is : " + envEntry + "
  • "); - } catch (Exception e) { - out.println("
  • Cannot get env-entry on JNDI " + e + "
  • "); - return; - } - out.println("

"); - - - out.println("
"); - - out.println("

"); - out.println("Lookup on URL with java:comp/env/url/URL"); - out.println("

"); - out.println("
    "); - URL jonasURL = null; - try { - jonasURL = (URL) initialContext.lookup("java:comp/env/url/URL"); - out.println("
  • URL is : " + jonasURL.toString() + "
  • "); - } catch (Exception e) { - out.println("
  • Cannot get url on JNDI " + e + "
  • "); - return; - } - out.println("

"); - - out.println("

Actions realized by the servlet and the EJB

"); - out.println("

With local interface

"); - out.println("
    "); - // Connecting to OpLocalHome thru JNDI - OpLocalHome opLocalHome = null; - try { - opLocalHome = (OpLocalHome) - initialContext.lookup("java:comp/env/ejb/OpLocal"); - } catch (Exception e) { - out.println("
  • Cannot lookup java:comp/env/ejb/OpLocal: " + e + "
  • "); - return; - } - // OpBean creation - OpLocal opLocal = null; - try { - opLocal = opLocalHome.create("User1"); - out.println("
  • Create a bean
  • "); - } catch (Exception e) { - out.println("
  • Cannot create OpBean: " + e + "
  • "); - return; - } - // First transaction (committed) - try { - out.println("
  • Start a first transaction
  • "); - utx.begin(); - opLocal.buy(FIRST_BUY_AMOUNT); - out.println("
  • First request on the new bean
  • "); - opLocal.buy(SECOND_BUY_AMOUNT); - out.println("
  • Second request on the bean
  • "); - utx.commit(); - out.println("
  • Commit the transaction
  • "); - } catch (Exception e) { - out.println("
  • exception during 1st Tx: " + e + "
  • "); - return; - } - // Start another transaction (rolled back) - try { - out.println("
  • Start a second transaction
  • "); - utx.begin(); - opLocal.buy(THIRD_BUY_AMOUNT); - utx.rollback(); - out.println("
  • Rollback the transaction
  • "); - } catch (Exception e) { - out.println("
  • exception during 2nd Tx: " + e + "
  • "); - return; - } - // Get the total bought, outside the transaction - int val = 0; - try { - val = opLocal.read(); - out.println("
  • Request outside any transaction
  • "); - } catch (Exception e) { - out.println("
  • Cannot read value on t1 : " + e + "
  • "); - return; - } - if (val != FIRST_BUY_AMOUNT + SECOND_BUY_AMOUNT) { - out.println("
  • Bad value read: " + val + "
  • "); - return; - } - // Remove Session bean - try { - opLocal.remove(); - } catch (Exception e) { - out.println("
  • Exception on buy: " + e + "
  • "); - return; - } - out.println("

"); - - out.println("

With remote interface

"); - out.println("
    "); - // Connecting to OpHome thru JNDI - OpHome opHome = null; - try { - opHome = (OpHome) PortableRemoteObject.narrow(initialContext.lookup("java:comp/env/ejb/Op"), OpHome.class); - } catch (Exception e) { - out.println("
  • Cannot lookup java:comp/env/ejb/Op: " + e + "
  • "); - return; - } - // OpBean creation - Op op = null; - try { - op = opHome.create("User1"); - out.println("
  • Create a bean
  • "); - } catch (Exception e) { - out.println("
  • Cannot create OpBean: " + e + "
  • "); - return; - } - // First transaction (committed) - try { - out.println("
  • Start a first transaction
  • "); - utx.begin(); - op.buy(FIRST_BUY_AMOUNT); - out.println("
  • First request on the new bean
  • "); - op.buy(SECOND_BUY_AMOUNT); - out.println("
  • Second request on the bean
  • "); - utx.commit(); - out.println("
  • Commit the transaction
  • "); - } catch (Exception e) { - out.println("
  • exception during 1st Tx: " + e + "
  • "); - return; - } - // Start another transaction (rolled back) - try { - out.println("
  • Start a second transaction
  • "); - utx.begin(); - op.buy(THIRD_BUY_AMOUNT); - utx.rollback(); - out.println("
  • Rollback the transaction
  • "); - } catch (Exception e) { - out.println("
  • exception during 2nd Tx: " + e + "
  • "); - return; - } - // Get the total bought, outside the transaction - val = 0; - try { - val = op.read(); - out.println("
  • Request outside any transaction
  • "); - } catch (Exception e) { - out.println("
  • Cannot read value on t1 : " + e + "
  • "); - return; - } - if (val != FIRST_BUY_AMOUNT + SECOND_BUY_AMOUNT) { - out.println("
  • Bad value read: " + val + "
  • "); - return; - } - // Remove Session bean - try { - op.remove(); - } catch (Exception e) { - out.println("
  • Exception on buy: " + e + "
  • "); - return; - } - out.println("

"); - - - - out.println("

"); - out.println("Resource Adapter Properties"); - out.println("

"); - out.println("
    "); - String eisName = null; - try { - eisName = (String) initialContext.lookup("eisName"); - out.println("
  • EIS Name is : " + eisName + "
  • "); - } catch (Exception e) { - out.println("
  • Cannot get eis name on JNDI " + e + "
  • "); - return; - } - out.println("

"); - - - out.println("Sample is OK.
"); - out.println(""); - out.println(""); - } -} diff --git a/jonas/examples/javaee-earsample/README b/jonas/examples/javaee-earsample/README deleted file mode 100644 index 53ab386fe38c46e3733e2e4ddcccee92f06219b6..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/README +++ /dev/null @@ -1,8 +0,0 @@ -- Ant tool must be launched in this directory - --> a file named javaee5-earsample.ear is produced in $JONAS_BASE/deploy - -- Start JOnAS - -- Go on http://localhost:9000/javaee5-earsample/ - -- Example is ready \ No newline at end of file diff --git a/jonas/examples/javaee-earsample/build.xml b/jonas/examples/javaee-earsample/build.xml deleted file mode 100644 index a63bded7bd0ac494fb1f29aafe171fdc3507f777..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/build.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/examples/javaee-earsample/etc/persistence.xml b/jonas/examples/javaee-earsample/etc/persistence.xml deleted file mode 100644 index 11a640d206cdbedd02db380660b6cc6994ae9899..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/etc/persistence.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - jdbc_1 - - - - - - - - - - - - diff --git a/jonas/examples/javaee-earsample/etc/web.xml b/jonas/examples/javaee-earsample/etc/web.xml deleted file mode 100644 index 2ede4128848ea55ade19f229f1ff45bd1c4db282..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/etc/web.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - StatelessClient - - org.ow2.jonas.examples.ear.ExampleServlet - - - - - StatelessClient - / - - - \ No newline at end of file diff --git a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/Author.java b/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/Author.java deleted file mode 100644 index 8edd9d6c152efed679310fe2f2b51829c68339c5..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/Author.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.ow2.jonas.examples.ear; - -import java.util.ArrayList; -import java.util.Collection; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.OneToMany; - -/** - * Author of a book. - * @author Florent Benoit - */ -@Entity -@NamedQuery(name = "allAuthors", query = "select o FROM Author o") -public class Author { - - /** - * Primary key (will be auto generated). - */ - private long id; - - /** - * Name of the author. - */ - private String name = null; - - /** - * List of books written by the author. - */ - private Collection books; - - /** - * Default constructor. - */ - public Author() { - books = new ArrayList(); - } - - /** - * Constructor with a given author name. - * @param name - the name of the author - */ - public Author(final String name) { - this(); - setName(name); - } - - /** - * Relation ship (do not using lazy mode). - * @return books written by this author - */ - @OneToMany(mappedBy = "author", fetch = FetchType.EAGER, cascade = CascadeType.ALL) - public Collection getBooks() { - return books; - } - - /** - * Add a book with a given title. - * @param title - the title of the book - */ - public void addBook(final String title) { - Book livre = new Book(); - livre.setTitle(title); - livre.setAuthor(this); - getBooks().add(livre); - } - - /** - * Sets the collection of books written by this author. - * @param books the list of the books - */ - public void setBooks(final Collection books) { - this.books = books; - } - - /** - * @return name of the author - */ - public String getName() { - return name; - } - - /** - * Sets the name of the author. - * @param name - the name of this author - */ - public void setName(final String name) { - this.name = name; - } - - /** - * @return an id for this object (incremented automatically) - */ - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - public long getId() { - return this.id; - } - - /** - * Sets the id of this author object. - * @param id the given id of this author - */ - public void setId(final long id) { - this.id = id; - } - - - /** - * @return String representation of this entity object. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(this.getClass().getName()); - sb.append("[id="); - sb.append(getId()); - sb.append(", name="); - sb.append(getName()); - sb.append("]"); - return sb.toString(); - } -} diff --git a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/Book.java b/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/Book.java deleted file mode 100644 index 2fe6a7a7f3e27af7c805009340b4b73bcef3eddb..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/Book.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.ow2.jonas.examples.ear; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQuery; - -/** - * Define a book. - * @author Florent Benoit - */ -@Entity -@NamedQuery(name = "allBooks", query = "select o FROM Book o") -public class Book { - - /** - * Primary key. - */ - private long id; - - /** - * Author's book. - */ - private Author author; - - /** - * title of the book. - */ - private String title; - - /** - * Default constructor. - */ - public Book() { - - } - - /** - * Constructor. Build a new Book with the given title and written by the - * given author. - * @param title the given title - * @param author the given author. - */ - public Book(final String title, final Author author) { - setTitle(title); - setAuthor(author); - } - - /** - * @return the Author of this Book. - */ - @ManyToOne - @JoinColumn(name = "Author_id") - public Author getAuthor() { - return author; - } - - /** - * Sets the author of this book. - * @param author the given author. - */ - public void setAuthor(final Author author) { - this.author = author; - } - - /** - * @return the title of this book. - */ - public String getTitle() { - return title; - } - - /** - * Set the title of the book. - * @param title - the title of the book - */ - public void setTitle(final String title) { - this.title = title; - } - - /** - * @return an id for this object (incremented automatically) - */ - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - public long getId() { - return this.id; - } - - /** - * Sets the id of this author object. - * @param id the given id of this author - */ - public void setId(final long id) { - this.id = id; - } - - /** - * @return String representation of this entity object. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(this.getClass().getName()); - sb.append("[id="); - sb.append(getId()); - sb.append(", title="); - sb.append(getTitle()); - sb.append("]"); - return sb.toString(); - } -} diff --git a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/ExampleServlet.java b/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/ExampleServlet.java deleted file mode 100644 index 2a51ad59cbdec325d219cb82d9d6c37a122864c8..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/ExampleServlet.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.ow2.jonas.examples.ear; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Collection; -import java.util.List; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Defines a servlet that is accessing the two entities through a local session - * bean. - * @author Florent Benoit - */ -public class ExampleServlet extends HttpServlet { - - /** - * Serializable class uid. - */ - private static final long serialVersionUID = -3172627111841538912L; - - /** - * Called by the server (via the service method) to allow a servlet to - * handle a GET request. - * @param request an HttpServletRequest object that contains the request the - * client has made of the servlet - * @param response an HttpServletResponse object that contains the response - * the servlet sends to the client - * @throws IOException if an input or output error is detected when the - * servlet handles the GET request - * @throws ServletException if the request for the GET could not be handled - */ - @Override - public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { - - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - out.println(""); - out.println(""); - out.println(""); - out.println("Client of Local session bean - EAR example"); - out.println(""); - out.println(""); - - initAuthorBooks(out); - out.println("

"); - displayAuthors(out); - - out.println(""); - out.println(""); - out.close(); - } - - /** - * Init list of authors/books. - * @param out the given writer - */ - private void initAuthorBooks(final PrintWriter out) { - out.println("Initialize authors and their books...
"); - - List authors; - try { - authors = getBean().listOfAuthors(); - } catch (Exception e) { - displayException(out, "Cannot Access to the bean", e); - return; - } - - if (authors != null && authors.size() > 0) { - out.println("Already initialized !
"); - return; - } - - try { - getBean().init(); - } catch (Exception e) { - displayException(out, "Cannot init list of authors with their books", e); - return; - } - } - - /** - * Display authors. - * @param out the given writer - */ - private void displayAuthors(final PrintWriter out) { - out.println("Get authors"); - out.println("

"); - - // Get list of Authors - List authors = null; - try { - authors = getBean().listOfAuthors(); - } catch (Exception e) { - displayException(out, "Cannot call listeOfAuthors on the bean", e); - return; - } - - // List for each author, the name of books - if (authors != null) { - for (Author author : authors) { - out.println("List of books with author '" + author.getName() + "' :"); - out.println("
    "); - Collection books = author.getBooks(); - if (books == null) { - out.println("
  • No book !
  • "); - } else { - for (Book book : books) { - out.println("
  • Title '" + book.getTitle() + "'.
  • "); - } - } - out.println("
"); - - } - } else { - out.println("No author found !"); - } - - } - - /** - * If there is an exception, print the exception. - * @param out the given writer - * @param errMsg the error message - * @param e the content of the exception - */ - private void displayException(final PrintWriter out, final String errMsg, final Exception e) { - out.println("

Exception : " + errMsg); - out.println("

");
-        e.printStackTrace(out);
-        out.println("

"); - } - - /** - * Lookup the stateless bean and gets a reference on it. - * @return the stateless bean business interface. - * @throws Exception if the bean cannot be retrieved. - */ - private StatelessLocal getBean() throws Exception { - Context initialContext = new InitialContext(); - - // Default name - //Object o = initialContext.lookup("org.ow2.jonas.examples.ear.StatelessBean" + "_" - // + StatelessLocal.class.getName() + "@Local"); - - // But with mappedName attribute - Object o = initialContext.lookup("myStateless"); - - if (o instanceof StatelessLocal) { - StatelessLocal statelessBean = (StatelessLocal) o; - return statelessBean; - } - throw new Exception("Cannot cast object into StatelessLocal"); - - } - -} diff --git a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/StatelessBean.java b/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/StatelessBean.java deleted file mode 100644 index 2333cfd21da314d0e678d190211be8834239c132..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/StatelessBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.ow2.jonas.examples.ear; - -import java.util.List; - -import javax.ejb.Stateless; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -/** - * Defines a stateless bean with a local interface. This beans provides methods - * for accessing the two entities, Book and Author.
- * By default, an interface is considered as a local interface if there is no - * @Remote annotation. - * @author Florent Benoit - */ -@Stateless(mappedName="myStateless") -public class StatelessBean implements StatelessLocal { - - /** - * Entity manager utilise par ce bean. - */ - @PersistenceContext - private EntityManager entityManager = null; - - /** - * Create authors and their books. - */ - public void init() { - // Books of balzac - Author balzac = new Author("Honore de Balzac"); - Book pereGloriot = new Book("Le Pere Goriot", balzac); - balzac.getBooks().add(pereGloriot); - Book lesChouans = new Book("Les Chouans", balzac); - balzac.getBooks().add(lesChouans); - - // Store (only author as cascade attribute is set to all) - entityManager.persist(balzac); - - // Add Hugo books - Author hugo = new Author("Victor Hugo"); - hugo.addBook("Les Miserables"); - hugo.addBook("Notre-Dame de Paris"); - - // Store - entityManager.persist(hugo); - } - - /** - * @return list of authors. - */ - @SuppressWarnings("unchecked") - public List listOfAuthors() { - Query auteurs = entityManager.createNamedQuery("allAuthors"); - return auteurs.getResultList(); - } - - /** - * @return ist of books. - */ - @SuppressWarnings("unchecked") - public List listOfBooks() { - return entityManager.createNamedQuery("allBooks").getResultList(); - } - -} diff --git a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/StatelessLocal.java b/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/StatelessLocal.java deleted file mode 100644 index beb6ac02c235cac08c3912a233f7a021a32697b9..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/StatelessLocal.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 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; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.ow2.jonas.examples.ear; - -import java.util.List; - -/** - * Defines a local interface for accessing two entities, Book and Author. - * @author Florent Benoit - */ -public interface StatelessLocal { - - /** - * Create authors and their books. - */ - void init(); - - /** - * @return list of authors. - */ - List listOfAuthors(); - - /** - * @return ist of books. - */ - List listOfBooks(); - -} diff --git a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/package.html b/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/package.html deleted file mode 100644 index 1211237a99f4bd2dd92ae911c577a8501ea810b6..0000000000000000000000000000000000000000 --- a/jonas/examples/javaee-earsample/src/java/org/ow2/jonas/examples/ear/package.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - EJB 3.0 - - -

Example of EJB 3.0 container

- - diff --git a/jonas/examples/jonas-common.xml b/jonas/examples/jonas-common.xml deleted file mode 100644 index dd698159a2ef1cde2cb81a9e3606cddb496be308..0000000000000000000000000000000000000000 --- a/jonas/examples/jonas-common.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jonas/externals/commons/j2ee/el-api.jar b/jonas/externals/commons/j2ee/el-api.jar deleted file mode 100644 index 50203e53de902ee64c97e6974213a9148f817e15..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/j2ee/el-api.jar and /dev/null differ diff --git a/jonas/externals/commons/j2ee/jsp-2_1.jar b/jonas/externals/commons/j2ee/jsp-2_1.jar deleted file mode 100644 index ffa6e1bf6447825b593769115b5147da00d80189..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/j2ee/jsp-2_1.jar and /dev/null differ diff --git a/jonas/externals/commons/j2ee/ow2-ejb-3.0-spec.jar b/jonas/externals/commons/j2ee/ow2-ejb-3.0-spec.jar deleted file mode 100644 index 9fd70c35a54c6a28cde43ac715fabe4c1601ae52..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/j2ee/ow2-ejb-3.0-spec.jar and /dev/null differ diff --git a/jonas/externals/commons/j2ee/ow2-jpa-1.0-spec.jar b/jonas/externals/commons/j2ee/ow2-jpa-1.0-spec.jar deleted file mode 100644 index 4dac24d66712787f37cb225ed95fbb676d1d7991..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/j2ee/ow2-jpa-1.0-spec.jar and /dev/null differ diff --git a/jonas/externals/commons/j2ee/servlet-2_5.jar b/jonas/externals/commons/j2ee/servlet-2_5.jar deleted file mode 100644 index 38cf06c045044c6b984e6c42289b8f36684bb18a..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/j2ee/servlet-2_5.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/carol/ow_carol.jar b/jonas/externals/commons/jonas/carol/ow_carol.jar deleted file mode 100644 index 363be125bc8b461fb69a8804ccd9714f2a8124f6..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/carol/ow_carol.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/carol/ow_cmi.jar b/jonas/externals/commons/jonas/carol/ow_cmi.jar deleted file mode 100644 index 049d19c54794aaec4af784c8252779dbe8b3c78b..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/carol/ow_cmi.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/joram/joram-client.jar b/jonas/externals/commons/jonas/joram/joram-client.jar deleted file mode 100644 index b22d69edad4e87c5c26b2290a7562b7e4998129f..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/joram/joram-client.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/joram/joram-connector.jar b/jonas/externals/commons/jonas/joram/joram-connector.jar deleted file mode 100644 index 071cf55453dd9023256d8050f665fb3669537f4b..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/joram/joram-connector.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/joram/joram-mom.jar b/jonas/externals/commons/jonas/joram/joram-mom.jar deleted file mode 100644 index 3f4eb5f4f2cc061a006b5bdfc3a99fdfbfff9c80..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/joram/joram-mom.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/joram/joram-raconfig.jar b/jonas/externals/commons/jonas/joram/joram-raconfig.jar deleted file mode 100644 index 333eddf2175f1d5945c05331553a3c35c2d8cd42..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/joram/joram-raconfig.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/joram/joram-shared.jar b/jonas/externals/commons/jonas/joram/joram-shared.jar deleted file mode 100644 index 4031c85b165ed9ff22e80d60b1a5932946408bdf..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/joram/joram-shared.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/joram/joram_for_jonas_ra.rar b/jonas/externals/commons/jonas/joram/joram_for_jonas_ra.rar deleted file mode 100644 index f71e2dbcaacc660060e602ff97f3f44527e67e7d..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/joram/joram_for_jonas_ra.rar and /dev/null differ diff --git a/jonas/externals/commons/jonas/monolog/ow_util_log_api.jar b/jonas/externals/commons/jonas/monolog/ow_util_log_api.jar deleted file mode 100644 index 40349d06e2dbf98a6b6da2978403d125a4475c6e..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/monolog/ow_util_log_api.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/monolog/ow_util_log_core.jar b/jonas/externals/commons/jonas/monolog/ow_util_log_core.jar deleted file mode 100644 index a9d4b16d2fbcb10fcd1c764ebe81c18c64de00b4..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/monolog/ow_util_log_core.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/monolog/ow_util_log_remote.jar b/jonas/externals/commons/jonas/monolog/ow_util_log_remote.jar deleted file mode 100644 index 42d2d8d721781697dc2eed18cb656a050ada0046..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/monolog/ow_util_log_remote.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_javalog.jar b/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_javalog.jar deleted file mode 100644 index 59f36fa3d75e68d8d0b90d4148cbddfc18982e01..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_javalog.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_log4j.jar b/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_log4j.jar deleted file mode 100644 index 0ddd7819b0904de5efcc909915d0185f36a2a687..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_log4j.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_p6spy.jar b/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_p6spy.jar deleted file mode 100644 index 1f15a5e79f46f96f0b129c97a26b28ce4630636b..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/monolog/ow_util_log_wrp_p6spy.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/ow2-util/util-i18n-1.0-M1.jar b/jonas/externals/commons/jonas/ow2-util/util-i18n-1.0-M1.jar deleted file mode 100644 index f73669836a9e7b1aa5f27210c5df3acbc68b17a4..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/ow2-util/util-i18n-1.0-M1.jar and /dev/null differ diff --git a/jonas/externals/commons/jonas/ow2-util/util-log-1.0-M1.jar b/jonas/externals/commons/jonas/ow2-util/util-log-1.0-M1.jar deleted file mode 100644 index 2730e4469cc980a021049448497bf20d7590e394..0000000000000000000000000000000000000000 Binary files a/jonas/externals/commons/jonas/ow2-util/util-log-1.0-M1.jar and /dev/null differ diff --git a/jonas/externals/endorsed/ow_carol_iiop_delegate.jar b/jonas/externals/endorsed/ow_carol_iiop_delegate.jar deleted file mode 100644 index 088fdbd3c98adf51507caae429def891635137f5..0000000000000000000000000000000000000000 Binary files a/jonas/externals/endorsed/ow_carol_iiop_delegate.jar and /dev/null differ diff --git a/jonas/externals/examples/emb/commons-fileupload-1.1.1.jar b/jonas/externals/examples/emb/commons-fileupload-1.1.1.jar deleted file mode 100644 index fc5763d0d33108308493ac19cbc0e4c2eadfca26..0000000000000000000000000000000000000000 Binary files a/jonas/externals/examples/emb/commons-fileupload-1.1.1.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-adl/dtdparser.jar b/jonas/externals/fdf/fractal-adl/dtdparser.jar deleted file mode 100644 index ddb33dc33e512b1394953e10a83d1fdad438dffc..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-adl/dtdparser.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-adl/fractal-adl.jar b/jonas/externals/fdf/fractal-adl/fractal-adl.jar deleted file mode 100644 index 79b956d851e401afc68f3c43b8dd4bb67ace2c3e..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-adl/fractal-adl.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-adl/ow_deployment_scheduling.jar b/jonas/externals/fdf/fractal-adl/ow_deployment_scheduling.jar deleted file mode 100644 index bbbf3837543188c64f41c98f5c9e713156a352ae..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-adl/ow_deployment_scheduling.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/apollon/apollon-runtime.jar b/jonas/externals/fdf/fractal-explorer/apollon/apollon-runtime.jar deleted file mode 100644 index e46d585e84ec0ca39319c42f4d2c71a779997e1d..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/apollon/apollon-runtime.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/beanshell/bsh-2.0b1.jar b/jonas/externals/fdf/fractal-explorer/beanshell/bsh-2.0b1.jar deleted file mode 100644 index c005694c89dd6a61c4c8af41d6c1f27854fa7ca6..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/beanshell/bsh-2.0b1.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/explorer/ow_util_explorer.jar b/jonas/externals/fdf/fractal-explorer/explorer/ow_util_explorer.jar deleted file mode 100644 index 1f962d17f1c2b4ae402d9237c9ab128c7cbc778f..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/explorer/ow_util_explorer.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/explorer/reflect-plugin.jar b/jonas/externals/fdf/fractal-explorer/explorer/reflect-plugin.jar deleted file mode 100644 index f9f405501f12c7bdc9c3c9bf0c72b93999b3516a..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/explorer/reflect-plugin.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/fractal-explorer.jar b/jonas/externals/fdf/fractal-explorer/fractal-explorer.jar deleted file mode 100644 index 2c3b664c627cab4507329580d6eff07aeded0388..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/fractal-explorer.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/jgraph/jgraph-5.9.2.1.jar b/jonas/externals/fdf/fractal-explorer/jgraph/jgraph-5.9.2.1.jar deleted file mode 100644 index d3fe807e62955dfac1769fb680c3e7300ffc7b56..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/jgraph/jgraph-5.9.2.1.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_cmdline.jar b/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_cmdline.jar deleted file mode 100644 index 57cdbc658945c24e3f8cb1ab4489d2805c8b8115..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_cmdline.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_misc.jar b/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_misc.jar deleted file mode 100644 index 3b11a748700632be8b239684d70cf261a87415a0..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_misc.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_trace.jar b/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_trace.jar deleted file mode 100644 index fb6adf531d086b461f47b33d60e741604a648e18..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal-explorer/ow-util/ow_util_trace.jar and /dev/null differ diff --git a/jonas/externals/fdf/fractal/fractal.jar b/jonas/externals/fdf/fractal/fractal.jar deleted file mode 100644 index eeebfb0ccfe33a884de25d70e0e6bde4b4a8d138..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/fractal/fractal.jar and /dev/null differ diff --git a/jonas/externals/fdf/julia/julia-asm-2.0.3.jar b/jonas/externals/fdf/julia/julia-asm-2.0.3.jar deleted file mode 100644 index 013d26c468b98509acf5e29afe7f4b71389e74ef..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/julia/julia-asm-2.0.3.jar and /dev/null differ diff --git a/jonas/externals/fdf/julia/julia-mixins-2.0.3.jar b/jonas/externals/fdf/julia/julia-mixins-2.0.3.jar deleted file mode 100644 index 63c9766796d8a8da4cf9d363a1fd0fe48aa1cde4..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/julia/julia-mixins-2.0.3.jar and /dev/null differ diff --git a/jonas/externals/fdf/julia/julia-runtime-2.0.3.jar b/jonas/externals/fdf/julia/julia-runtime-2.0.3.jar deleted file mode 100644 index 6adaeeac7442b0a0cc9f7a51191d88166a8edbd2..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/julia/julia-runtime-2.0.3.jar and /dev/null differ diff --git a/jonas/externals/fdf/network-protocols/commons-net-1.4.1.jar b/jonas/externals/fdf/network-protocols/commons-net-1.4.1.jar deleted file mode 100644 index 9666a92c800916a680571d7ccba8d4d39a8e7c7c..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/network-protocols/commons-net-1.4.1.jar and /dev/null differ diff --git a/jonas/externals/fdf/network-protocols/jsch-0.1.26.jar b/jonas/externals/fdf/network-protocols/jsch-0.1.26.jar deleted file mode 100644 index fe54efa263229e114579875787702cd593946347..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/network-protocols/jsch-0.1.26.jar and /dev/null differ diff --git a/jonas/externals/fdf/network-protocols/jtelnet.jar b/jonas/externals/fdf/network-protocols/jtelnet.jar deleted file mode 100644 index 2c5678217976f08bad041e93916c8dc7839c146e..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/network-protocols/jtelnet.jar and /dev/null differ diff --git a/jonas/externals/fdf/ow-fdf-2.0.0.jar b/jonas/externals/fdf/ow-fdf-2.0.0.jar deleted file mode 100644 index 9264994af63e3df9eed031e8b306a62080646b4a..0000000000000000000000000000000000000000 Binary files a/jonas/externals/fdf/ow-fdf-2.0.0.jar and /dev/null differ diff --git a/jonas/externals/ishmael.jar b/jonas/externals/ishmael.jar deleted file mode 100644 index 091a0a35a5fb5ced92ec2c8cb541288995688a46..0000000000000000000000000000000000000000 Binary files a/jonas/externals/ishmael.jar and /dev/null differ diff --git a/jonas/externals/tools/ow_util_log_wrp_velo.jar b/jonas/externals/tools/ow_util_log_wrp_velo.jar deleted file mode 100644 index 4cc82edebd7bcf41e76fcdc54c5682885707c2e2..0000000000000000000000000000000000000000 Binary files a/jonas/externals/tools/ow_util_log_wrp_velo.jar and /dev/null differ diff --git a/jonas/lib/build/maven-ant-tasks-2.0.7.jar b/jonas/lib/build/maven-ant-tasks-2.0.7.jar deleted file mode 100644 index 4f0dfdd62150f1c380dbdb6ff31db8280b685e73..0000000000000000000000000000000000000000 Binary files a/jonas/lib/build/maven-ant-tasks-2.0.7.jar and /dev/null differ diff --git a/jonas/modules/apis/jonas-deployment-api/pom.xml b/jonas/modules/apis/jonas-deployment-api/pom.xml deleted file mode 100644 index 7b188ba33efb2b50d84383457958b872a51e169f..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - org.objectweb.jonas - jonas-apis - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-deployment-api - JOnAS :: APIs :: Deployment - \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/DTDs.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/DTDs.java deleted file mode 100644 index f4e226c8667369f049815937c964f5611088fd73..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/DTDs.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer: Florent BENOIT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -import java.util.Map; - - -/** - * This class defines the interface for the Mapping between publicId and DTDs - * @author Florent Benoit - */ -public interface DTDs { - - /** - * Gets the mapping between publicIds and DTDs - * @return the mapping between publicIds and DTDs - */ - Map getMapping(); - - -} diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IDeploymentDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IDeploymentDesc.java deleted file mode 100644 index a08e6663c23250b7a4d2a4ddb76ef8dd24762db6..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IDeploymentDesc.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -/** - * This interface provides a description for deployment descriptor in JOnAS - * @author Ludovic Bert - * @author Florent Benoit - */ -public interface IDeploymentDesc { - - /** - * Get the display name of the deployment descriptor. - * @return the display name of the deployment descriptor. - */ - String getDisplayName(); - - /** - * Return a String representation of the DeploymentDesc. - * @return a String representation of the DeploymentDesc. - */ - String toString(); - -} diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IDescriptionGroupDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IDescriptionGroupDesc.java deleted file mode 100644 index 3ab718d288e9ade9433cda0fd1fddec6ce077458..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IDescriptionGroupDesc.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -/** - * This interface provides a description for J2EE deployment descriptors - * @author Philippe Coq - */ -public interface IDescriptionGroupDesc { - - /** - * Get the display name of the deployment descriptor. - * @return the display name of the deployment descriptor. - */ - String getDisplayName(); - - /** - * Get the description of the deployment descriptor. - * @return the description of the deployment descriptor. - */ - String getDescription(); - - /** - * Get the small-icon of the deployment descriptor. - * @return the small-icon of the deployment descriptor. - */ - String getSmallIcon(); - - /** - * Get the large-icon of the deployment descriptor. - * @return the large-icon of the deployment descriptor. - */ - String getLargeIcon(); - - /** - * Return a String representation of the DescriptionGroup. - * @return a String representation of the DescriptionGroup. - */ - String toString(); - -} diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEJBLocalRefDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEJBLocalRefDesc.java deleted file mode 100644 index f128fedaa75667c4dc61a7cbac3f77470cdd9e02..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEJBLocalRefDesc.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -public interface IEJBLocalRefDesc { - - /* (non-Javadoc) - * @see org.objectweb.jonas_lib.deployment.api.EJBLocalRefDesc#getEjbRefName() - */ - String getEjbRefName(); - - /* (non-Javadoc) - * @see org.objectweb.jonas_lib.deployment.api.EJBLocalRefDesc#getEjbRefType() - */ - String getEjbRefType(); - - /* (non-Javadoc) - * @see org.objectweb.jonas_lib.deployment.api.EJBLocalRefDesc#getLocalHome() - */ - String getLocalHome(); - - /* (non-Javadoc) - * @see org.objectweb.jonas_lib.deployment.api.EJBLocalRefDesc#getLocal() - */ - String getLocal(); - - /* (non-Javadoc) - * @see org.objectweb.jonas_lib.deployment.api.EJBLocalRefDesc#getEjbLink() - */ - String getEjbLink(); - - /* (non-Javadoc) - * @see org.objectweb.jonas_lib.deployment.api.EJBLocalRefDesc#getJndiLocalName() - */ - String getJndiLocalName(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEJBRefDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEJBRefDesc.java deleted file mode 100644 index ace891c2a7fe13466704d13a09bb945231a996ef..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEJBRefDesc.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -public interface IEJBRefDesc { - - /** - * Get the name of the ejb-ref - * @return String representation of the ejb-ref-name. - */ - String getEjbRefName(); - - /** - * Get the ejb-ref-type. - * @return String representation of the ejb-ref-type. - */ - String getEjbRefType(); - - /** - * Get the ejb-link - * @return String representation of the ejb-link - */ - String getEjbLink(); - - /** - * Get the jndi name of the ejb-ref. - * @return String representation of the JNDI name - */ - String getJndiName(); - - /** - * @return the fully qualified name of the enterprise bean's home interface - */ - String getHome(); - - /** - * @return the fully qualified name of the enterprise bean's remote interface - */ - String getRemote(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEnvEntryDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEnvEntryDesc.java deleted file mode 100644 index fed17c051cfe19370fdbaca381c37d3accd1721d..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IEnvEntryDesc.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -/** - * This interface represents the description of an EnvEntry object - * @author Philippe Durieux - */ -public interface IEnvEntryDesc { - - /** - * Get the name of the environemt entry. - * @return Name for environment entry - */ - String getName(); - - /** - * Get the fully-qualified Java type of the environemt entry. - * Type is needed since value is optional - * The possibles values are: - * java.lang.Boolean - * java.lang.Character - * java.lang.String - * java.lang.Integer - * java.lang.Double - * java.lang.Byte - * java.lang.Short - * java.lang.Long - * java.lang.Float - * @return Class the fully-qualified Java type of the environemt entry. - */ - Class getType(); - - /** - * Assessor for existence of value for the descriptor - * @return true if a value is available - */ - boolean hasValue(); - - /** - * Get the value of the environment entry. - * @return value for the environment entry (must be set) - */ - Object getValue(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IJNDIEnvRefsGroupDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IJNDIEnvRefsGroupDesc.java deleted file mode 100644 index 05ee38445b278e6474f2791d1605a2f9bbcb15b9..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IJNDIEnvRefsGroupDesc.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Philippe Coq - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - - -package org.objectweb.jonas_lib.deployment.api; - -import org.objectweb.jonas_ws.deployment.api.IServiceRefDesc; - -/** - * This interface provides JNDI environment reference elements - * for J2EE deployment descriptors - * @author Philippe Coq - */ -public interface IJNDIEnvRefsGroupDesc { - - /** - * Get resource environment references. - * @return array of resource environment reference descriptors - */ - IResourceEnvRefDesc[] getResourceEnvRefDesc(); - - /** - * Get resource manager connection factory references. - * @return array of resource reference descriptors - */ - IResourceRefDesc[] getResourceRefDesc(); - - /** - * Get environment entries. - * @return array of environment entries descriptors - */ - IEnvEntryDesc[] getEnvEntryDesc(); - - /** - * Get EJB references. - * @return array of EJB reference descriptors - */ - IEJBRefDesc[] getEjbRefDesc(); - - /** - * Get ejb local references. - * @return array of ejb local reference descriptors - */ - IEJBLocalRefDesc[] getEjbLocalRefDesc(); - - /** - * Get service references. - * @return array of service references descriptors - */ - IServiceRefDesc[] getServiceRefDesc(); - - /** - * Get message destination references. - * @return array of message destination references descriptors - */ - IMessageDestinationRefDesc[] getMessageDestinationRefDesc(); - -} diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IMessageDestinationRefDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IMessageDestinationRefDesc.java deleted file mode 100644 index 7740ccff30961e480e79aa99c8d9f309646212c4..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IMessageDestinationRefDesc.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -public interface IMessageDestinationRefDesc { - - /** - * Get the name of the message-destination-ref - * @return String representation of the message-destination-ref-name. - */ - String getMessageDestinationRefName(); - - /** - * Get the message-destination-type. - * @return String representation of the message-destination-type. - */ - String getMessageDestinationType(); - - /** - * Get the message-destination-usage. - * @return String representation of the message-destination-usage. - */ - String getMessageDestinationUsage(); - - /** - * Get the message-destination-link - * @return String representation of the message-destination-link - */ - String getMessageDestinationLink(); - - /** - * Get the jndi name of the message-destination-ref. - * @return String representation of the JNDI name - */ - String getJndiName(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IResourceEnvRefDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IResourceEnvRefDesc.java deleted file mode 100644 index 355b0e81f105513ea11c95ff4468c4681a460f2f..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IResourceEnvRefDesc.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -public interface IResourceEnvRefDesc { - - /** - * @return Returns the resource-env-ref/resource-env-ref-name. - */ - String getName(); - - /** - * @return Returns the resource-env-ref/resource-env-ref-type. - */ - Class getType(); - - /** - * @return Returns the jonas-res-env-ref/jndi-name. - */ - String getJndiName(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IResourceRefDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IResourceRefDesc.java deleted file mode 100644 index 267bc7671a0c595d9efc5d5cfe7faf02c11ef60f..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/IResourceRefDesc.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -public interface IResourceRefDesc { - - /** - * To indicate that the application manage the authentication. - */ - public static final int APPLICATION_AUTH = 0; - - /** - * To indicate that the container manage the authentication. - */ - public static final int CONTAINER_AUTH = 1; - - /** - * Get resource ref. name - * @return Name of the resource ref. - */ - String getName(); - - /** - * Get resource ref. type name - * @return Class name of the resource ref. - */ - String getTypeName(); - - /** - * Get the authentication of the resource ref. - * @return Authentication value within APPLICATION_AUTH, CONTAINER_AUTH - */ - int getAuthentication(); - - /** - * Assessor for JDBC resource - * @return true if the resource is Jdbc compliant - */ - boolean isJdbc(); - - /** - * Get the jndi name of the resource ref. - * @return String representation of the JNDI name - */ - String getJndiName(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/Schemas.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/Schemas.java deleted file mode 100644 index b5966a24b7118c11930ae95d0cbf6f3f6474b3fe..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_lib/deployment/api/Schemas.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer: Florent BENOIT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_lib.deployment.api; - -import java.util.List; - -/** - * This class defines the interface for all J2EE 1.4 Schemas - * @author Florent Benoit - */ -public interface Schemas { - - - /** - * Gets the URLs of the local schemas - * @return the URLs of the local schemas - */ - List getlocalSchemas(); - -} diff --git a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_ws/deployment/api/IServiceRefDesc.java b/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_ws/deployment/api/IServiceRefDesc.java deleted file mode 100644 index a872318e78c3e27ecea9e2be743027be6938c48a..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-deployment-api/src/main/java/org/objectweb/jonas_ws/deployment/api/IServiceRefDesc.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_ws.deployment.api; - -import java.net.URL; -import java.util.Hashtable; -import java.util.List; - -import javax.xml.namespace.QName; - -public interface IServiceRefDesc { - - /** - * Return the list of PortComponentRef. - * @return the list of PortComponentRef - */ - List getPortComponentRefs(); - - /** - * Return the list of Handler. - * @return the list of Handler - */ - List getHandlerRefs(); - - /** - * Return the name used for Service interface lookup. - * @return the service-ref-name value - */ - String getServiceRefName(); - - /** - * Return the Class object representing the service-interface. - * @return the Class object representing the service-interface. - */ - Class getServiceInterface(); - - /** - * Return the WSDLFile object describing the WebService. - * @return the WSDLFile object describing the WebService. - */ - //WSDLFile getWSDLFile(); - - /** - * Return the MappingFile object. - * @return the MappingFile object. - */ - //MappingFile getMappingFile(); - - /** - * Return all the params of the ServiceRefDesc as an Hashtable. - * @return all the params of the ServiceRefDesc as an Hashtable. - */ - Hashtable getParams(); - - /** - * Return the value of the specified parameter. - * @param name the parameter to retrieve - * @return the value of the specified parameter - */ - String getParam(final String name); - - /** - * Return the name of WSDL inside of the module. - * @return the name of WSDL inside of the module - */ - String getWsdlFileName(); - - /** - * Return the QName identifying the service in the WSDL. can return null if - * WSDL not defined. - * @return Return the QName identifying the service in the WSDL (can be - * null). - */ - QName getServiceQName(); - - /** - * @return Returns the alternate WSDL URL (may be null). - */ - URL getAlternateWsdlURL(); - - /** - * @return Returns the URL where the uptodate WSDL can be found. - */ - URL getLocalWSDLURL(); - - /** - * @return Returns the URL where the mapping file can be found. - */ - URL getMappingFileURL(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/pom.xml b/jonas/modules/apis/jonas-services-api/pom.xml deleted file mode 100644 index a6abd8791672a8217d28e66cbb06f95ba8584a79..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - org.objectweb.jonas - jonas-apis - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-services-api - JOnAS :: APIs :: Services Interfaces - - - org.objectweb.jonas - jonas-deployment-api - ${jonas.version} - - - org.ow2.spec.ee - ow2-connector-1.5-spec - provided - - - org.ow2.spec.ee - ow2-ejb-3.0-spec - provided - - - geronimo-spec - geronimo-spec-jms - 1.1-rc4 - - - jotm - jotm - - - \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/adm/AdmException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/adm/AdmException.java deleted file mode 100644 index 24bc5e6f60f5dc45c0ecc68cfd2311cb707f39ad..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/adm/AdmException.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id: $ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.adm; - -import org.objectweb.jonas.service.ServiceException; - -/** - * - * Exption throwed by the Adm object when a deployment operation failed - * due to a missing service. - * @author Adriana Danes - */ -public class AdmException extends ServiceException { - /** - * Constructs a new AdmException with the specified message. - * @param message the detail message. - */ - public AdmException(final String message) { - super(message, null); - } -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/adm/AdmInterface.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/adm/AdmInterface.java deleted file mode 100644 index 7f7167a05390ad7cbf727b81751b89d5f3b3461f..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/adm/AdmInterface.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): ______________________________________. - * JOnAS 2.4 Murad Meghani (Murad.Meghani@compuware.com) killServer and stopServer - * JOnAS 2.5 2002.06 Florent Benoit & Ludovic Bert : - * Methods for wars and ear files - * Dean Jennings = add deployFile - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.adm; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.util.Properties; -import java.util.Vector; - -import org.objectweb.jonas.adm.AdmException; - -/* - * JOnAS Administration Remote Interface. - * This is used basically by jonas admin. - * @author Philippe Coq - * Contributor(s): - * Murad Meghani (Murad.Meghani@compuware.com) killServer and stopServer - * Florent Benoit & Ludovic Bert : Methods for wars and ear files - */ -public interface AdmInterface extends Remote { - - public static final int TYPE_EJB = 1; - public static final int TYPE_WAR = 2; - public static final int TYPE_EAR = 3; - public static final int TYPE_RAR = 4; - public static final int TYPE_CAR = 5; - - public static final int STATUS_RUNNING = 1; - public static final int STATUS_STOPPED = 2; - public static final int STATUS_ALL = 0; - - /** - * Adm JNDI name suffix. - */ - public static final String ADMNAME_SUFFIX = "_Adm"; - - /** - * JOnAS instance is NotReady. - */ - public static final int NOT_READY = 0; - - /** - * JOnAS instance is Ready. - */ - public static final int READY = 1; - - /** - * JOnAS instance is Stopped. - */ - public static final int STOPPED = 2; - - - /** - * Deploy a given ear file with the help of the ear service. - * @param fileName the name of the ear file. - * @throws RemoteException if rmi call failed. - * @throws AdmException if the deployment failed. - */ - public void addEar(String fileName) throws RemoteException, AdmException; - - /** - * Deploy a given rar file with the help of the resource service. - * @param fileName the name of the rar file. - * @throws RemoteException if rmi call failed. - * @throws AdmException if the deployment failed. - */ - public void addRar(String fileName) throws RemoteException, AdmException; - - /** - * Deploy a given war file with the help of the web container service. - * @param fileName the name of the war file. - * @throws RemoteException if rmi call failed. - * @throws AdmException if the deployment failed. - */ - public void addWar(String fileName) throws RemoteException, AdmException; - - /** - * UnDeploy a given ear file with the help of the ear service. - * @param fileName the name of the ear file. - * @throws RemoteException if rmi call failed. - * @throws AdmException if the undeployment failed. - */ - public void removeEar(String fileName) throws RemoteException, AdmException; - - /** - * UnDeploy a given rar file with the help of the resource service. - * @param fileName the name of the rar file. - * @throws RemoteException if rmi call failed. - * @throws AdmException if the undeployment failed. - */ - public void removeRar(String fileName) throws RemoteException, AdmException; - - /** - * UnDeploy a given war file with the help of the web container service. - * @param fileName the name of the war file. - * @throws RemoteException if rmi call failed. - * @throws AdmException if the undeployment failed. - */ - public void removeWar(String fileName) throws RemoteException, AdmException; - - /** - * Test if the specified filename is already deployed or not - * @param fileName the name of the ear file. - * @return true if the ear is deployed, else false. - * @throws RemoteException if rmi call failed. - */ - boolean isEarLoaded(String fileName) throws RemoteException, AdmException; - - /** - * Test if the specified filename is already deployed or not - * @param fileName the name of the rar file. - * @return true if the rar is deployed, else false. - * @throws RemoteException if rmi call failed. - */ - boolean isRarLoaded(String fileName) throws RemoteException, AdmException; - - - /** - * Test if the specified filename is already deployed or not - * @param fileName the name of the war file. - * @return true if the war is deployed, else false. - * @throws RemoteException if rmi call failed. - */ - boolean isWarLoaded(String fileName) throws RemoteException, AdmException; - - - void addBeans(String fileName) throws RemoteException; - void removeBeans(String fileName) throws RemoteException; - boolean isLoaded(String fileName) throws RemoteException; - String [] listBeans() throws RemoteException; - String dumpCustom() throws RemoteException; - Vector listContext() throws RemoteException; - Properties listEnv() throws RemoteException; - void stopServer() throws RemoteException; - void killServer() throws RemoteException; - boolean isEJBContainer() throws RemoteException; - int getServerState() throws RemoteException; - void setTransactionTimeout(int timeout) throws RemoteException; - void runGC() throws RemoteException; - void syncAllEntities(boolean passivate) throws RemoteException; - String [] getTopics() throws RemoteException; - String getTopicLevel(String topic) throws RemoteException; - void setTopicLevel(String topic, String l) throws RemoteException; - void deployFileOn(String filename, String [] target) throws RemoteException; - void stopRemoteServers(String [] target) throws RemoteException; - void startRemoteServers(String [] target) throws RemoteException; - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/container/EJBService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/container/EJBService.java deleted file mode 100644 index 2dada84490061c8985fd983bd548344a9970e7cc..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/container/EJBService.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.container; - -import java.net.URL; -import java.util.List; - -import javax.ejb.Timer; -import javax.naming.Context; -import javax.resource.spi.work.WorkManager; - -import org.objectweb.jonas.service.Service; -import org.objectweb.jonas.service.ServiceException; -import org.objectweb.jonas_ejb.container.JTimerHandleInfo; - -/** - * EJB Service interface. - */ -public interface EJBService extends Service { - - /** - * Create a JOnAS Container for all the beans that are described in a .xml file, - * or belong to .jar file. - * @param ctx JNDI context in which is found the container configuration. - * @return The ObjectName of the MBean associated to the container (i.e. to the deployed module) - */ - String createContainer(Context ctx) throws Exception; - - /** - * Create a JOnAS Container for all the beans that are described in a .xml file, - * or belong to .jar file. - * @param fileName EjbJar filename. - * @throws Exception when the EjbJar cannot be deployed. - * @return The ObjectName of the MBean associated to the container (i.e. to the deployed module) - */ - String createContainer(String fileName) throws Exception; - - /** - * Test if the specified file is already deployed (if a container - * is created for this jar). - * @param fileName the name of the jar file - * @return true if the jar was deployed, false otherwise - * TODO redundant with EJBServiceMBean.isJarLoaded() - * Used in J2EEServer, J2EESERMBean (mbeans-descriptors.xml) - */ - Boolean isJarDeployed(String fileName); - - /** - * Test if the specified jar identified with its work name is already deployed - * (if a container is created for this jar). - * @param workFileName the internal name of the jar file (working copy) - * @return true if the jar was deployed, false otherwise - */ - boolean isJarDeployedByWorkName(String workFileName); - - /** - * Removes a JOnAS Container. - * @param fileName JOnAS container to remove. - * @throws Exception when the EjbJar cannot be undeployed. - */ - void removeContainer(String fileName) throws Exception; - - /** - * Synchronized all entity bean containers - * @param passivate passivate instances after synchronization. - */ - void syncAllEntities(boolean passivate); - - /** - * Deploy the given ejb-jars of an ear file with the specified parent - * classloader (ear classloader). (This method is only used for - * the ear applications, not for the ejb-jar applications). - * @param ctx the context containing the configuration - * to deploy the ejbjars.
- * This context contains the following parameters :
- * - earRootUrl the root of the ear application.
- * - earClassLoader the ear classLoader of the ear application.
- * - ejbClassLoader the ejb classLoader for the ejbjars.
- * - jarURLs the list of the urls of the ejb-jars to deploy.
- * - roleNames the role names of the security-role.
- * @throws ServiceException if an error occurs during the deployment. - */ - void deployJars(Context ctx)throws ServiceException; - - /** - * Undeploy the given ejb-jars of an ear file with the specified parent - * classloader (ear classloader). (This method is only used for - * the ear applications, not for the ejb-jar applications). - * @param urls the list of the urls of the ejb-jars to deploy. - */ - void unDeployJars(URL[] urls); - - /** - * Make a cleanup of the cache of deployment descriptor. This method must - * be invoked after the ear deployment by the EAR service. - * the deployment of an ear by . - * @param earClassLoader the ClassLoader of the ear application to - * remove from the cache. - */ - void removeCache(ClassLoader earClassLoader); - - /** - * Check that GenIC have been applied on the given ejb-jar file - * If it was not done, it run GenIC against the file. - * @param fileName given EJB-JAR file. - * @param urls Array of URLs used as CLASSPATH during EJB compilation - */ - void checkGenIC(String fileName, URL[] urls); - - /** - * Returns the ContextID associated to this container filename. - * Used by the {@link EARService} for security purpose. - * @param containerFileName container filename - * @return Returns the ContextID associated to this container filename. - */ - String getContainerContextID(String containerFileName); - - /** - * Get a new {@link Timer}. - * @param info {@link JTimerHandleInfo} instance used for {@link Timer} - * creation. - * @return a newly created {@link Timer} - */ - Timer getTimer(JTimerHandleInfo info); - - /** - * Restart a {@link Timer} given some input infos. - * @param info {@link JTimerHandleInfo} instance used for {@link Timer} - * restart. - * @return a newly restarted {@link Timer}. - */ - Timer restartTimer(JTimerHandleInfo info); -} - diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/db/DBService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/db/DBService.java deleted file mode 100644 index d313ab3b4fde307972db1d7c857586c4e0f698e8..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/db/DBService.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Florent BENOIT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.db; - -import org.objectweb.jonas.service.Service; - -/** - * Interface of the database service - * @author Florent Benoit - */ -public interface DBService extends Service { - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/dbm/DataBaseService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/dbm/DataBaseService.java deleted file mode 100644 index 69118cb385559ee9f9191b73a837e7621a78f02b..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/dbm/DataBaseService.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): ______________________________________. - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.dbm; - -import java.util.Properties; - -import javax.naming.NamingException; - -import org.objectweb.jonas.service.Service; - -/** - * DataBase Service interface.* - * @author Philippe Durieux - * - * Contributor(s): - * - * 03/01/14 Adriana Danes - * Change createDataSource() signature : take additional argument, the datasource name - */ -public interface DataBaseService extends Service { - - /** - * create a new DataSource - */ - public void createDataSource(String dsName, Properties dsd) throws Exception; - - /** - * Unbind dataSource names from the Naming - */ - public void unbindDataSources() throws NamingException; - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryEvent.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryEvent.java deleted file mode 100644 index afb7bcf17f78dd51a090a0988967cb0c10ff4dab..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or any later version. - * - * This library is distributed in the hoper that irt 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.discovery; - -/** - * Discovery Message sent by the discovery service to notify - * new servers in the domain. - * @author Philippe Durieux - */ -public interface DiscoveryEvent { - public String getDomainName(); - public String getServerName(); - public String[] getConnectorURL(); - public String getState(); -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryService.java deleted file mode 100644 index 7844a29799f8b3413ef480dc282baacd90c98ad3..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryService.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.discovery; - -import org.objectweb.jonas.service.Service; - -/** - * JOnAS Discovery Service interface. - * @author Adriana Danes - */ -public interface DiscoveryService extends Service { - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryState.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryState.java deleted file mode 100644 index 3ef5ea765b9a64c345f62d90215e9a1dada76aaf..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/discovery/DiscoveryState.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2006-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.discovery; - -/** - * This is a helper class that define the possible state attribute values in a - * DiscoveryEvent class instance. - * - * @author Adriana Danes - */ -public class DiscoveryState { - - /** - * Used when the DiscovetyEvent is emitted to notify a server start-up. - */ - public static final String RUNNING = "running"; - - /** - * Used when the DiscovetyEvent is emitted to notify a server shut-down. - */ - public static final String STOPPING = "stopping"; - - /** - * Used when the DiscovetyEvent is emitted to notify a server start-up - */ - public static final String STARTUP = "starting up"; - - /** - * Another JOnAS instance started with a name already bound in the domain. - */ - public static final String DUPLICATE_NAME = "duplicate server name found"; -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ear/EarService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ear/EarService.java deleted file mode 100644 index f3af112ef2e9a96f29b4ab7934ebe3df2ac5520c..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ear/EarService.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Florent BENOIT & Ludovic BERT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.ear; - -import java.util.List; - -import javax.naming.Context; - -import org.objectweb.jonas.service.Service; - -/** - * JOnAS EAR Service interface. This interface provides a description of an EAR - * service. - * @author Ludovic Bert - * @author Florent Benoit - */ -public interface EarService extends Service { - - /** - * Deploy an EAR file with sending JAR file to the EJB container and WAR - * file to the WEB container. - * @param ctx the context which contains the configuration in order to - * deploy an EAR. - * @return The ObjectName of the J2EE Application MBean associated to the - * deployed EAR - * @throws EarServiceException if the deployment of the EAR failed. - */ - String deployEar(Context ctx) throws EarServiceException; - - /** - * Undeploy an EAR by sending the request to the EJB container and to the - * WEB container. - * @param ctx the context which contains the configuration in order to - * undeploy an EAR. - * @throws EarServiceException if the undeployment of the EAR failed. - */ - void unDeployEar(Context ctx) throws EarServiceException; - - /** - * Deploy an EAR, used by management applications via J2EEServer managed - * object. - * @param fileName the fileName of the ear which must be be deployed. - * @return The ObjectName of the MBean associated to the deployed J2EE - * Application - * @throws Exception if the deployment of the EAR failed. - */ - String deployEar(String fileName) throws Exception; - - /** - * Test if the specified filename is already deployed or not. - * @param fileName the name of the ear file. - * @return true if the ear is deployed, else false. - */ - Boolean isEarDeployed(String fileName); - - /** - * Test if the specified unpack name is already deployed or not. This - * method is defined in the EarService interface. - * @param unpackName the name of the ear file. - * @return true if the ear is deployed, else false. - */ - boolean isEarDeployedByUnpackName(String unpackName); - - /** - * Undeploy an EAR, used by management applications via J2EEServer managed - * object. - * @param fileName the fileName of the ear which must be be undeployed. - * @throws Exception if the undeployment of the EAR failed. - */ - void unDeployEar(String fileName) throws Exception; - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ear/EarServiceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ear/EarServiceException.java deleted file mode 100644 index 87e1ff6c6ef429c8617d830877f2162f52c01ec4..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ear/EarServiceException.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Florent BENOIT & Ludovic BERT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.ear; - -import org.objectweb.jonas.service.ServiceException; - -/** - * The class EarServiceException that indicates conditions that a reasonable - * application might want to catch. - * @author Ludovic Bert - * @author Florent Benoit - */ -public class EarServiceException extends ServiceException { - - /** - * Constructs a new EarServiceException with the specified message. - * @param message the detail message. - */ - public EarServiceException(String message) { - this(message, null); - } - - /** - * Constructs a new EarServiceException with the specified message. - * @param message the detail message. - * @param throwable the exception - */ - public EarServiceException(String message, Throwable throwable) { - super(message, throwable); - } -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jms/JmsService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jms/JmsService.java deleted file mode 100644 index e238ad9fcd61c97b4dd38cbeef6acf8eaac3b1c2..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jms/JmsService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): ______________________________________. - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.jms; - -import org.objectweb.jonas_jms.api.JmsManager; -import org.objectweb.jonas.service.Service; - -/** - * Jms Service interface. - */ -public interface JmsService extends Service { - public JmsManager getJmsManager(); -} - diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jmx/JmxService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jmx/JmxService.java deleted file mode 100644 index 00d54a31034a93b34d01b0618640f0f33de3ffd7..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jmx/JmxService.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.jmx; - -import javax.management.MBeanServer; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.remote.JMXServiceURL; - -import org.objectweb.jonas.service.Service; - -/** - * JMX Service interface. - * - */ -public interface JmxService extends Service { - - /** - * @return The reference of the MBean server - */ - MBeanServer getJmxServer(); - - /** - * @return The Connection interface to the MBean server - */ - MBeanServerConnection getJmxServerConnection(); - - /** - * Register an MBean on the JOnAS MBeanServer. - * @param mbean MBean to be registered - * @param objectName Stringified ObjectName of the MBean to be registered - */ - void registerMBean(Object mbean, String objectName); - - /** - * Register an MBean on the JOnAS MBeanServer. - * @param mbean MBean to be registered - * @param objectName ObjectName of the MBean to be registered - */ - void registerMBean(Object mbean, ObjectName objectName); - - /** - * Unregister an MBean from the JOnAS MBeanServer. - * @param objectName the MBean's ObjectName - */ - void unregisterMBean(ObjectName objectName); - - /** - * Register a Model MBean on the JOnAS MBeanServer. - * @param mbean MBean to be registered - * @param objectName Stringified ObjectName of the MBean to be registered - * @exception Exception throwed when registering a modeler MBean - */ - void registerModelMBean(Object mbean, String objectName) throws Exception; - - /** - * Register a Model MBean on the JOnAS MBeanServer. - * @param mbean MBean to be registered - * @param objectName ObjectName of the MBean to be registered - * @exception Exception throwed when registering a modeler MBean - */ - void registerModelMBean(Object mbean, ObjectName objectName) throws Exception; - - /** - * Unegister a Model MBean from the JOnAS MBeanServer. - * @param objectName the Mbean ObjectName - */ - void unregisterModelMBean(ObjectName objectName); - - /** - * Load additional mbean descriptors. - * @param packageName name of the package containing the descriptors file - * @param cl class loader containing the resource - */ - void loadDescriptors(String packageName, ClassLoader cl); - - /** - * @return Returns a {@link JMXServiceURL} array containing the adresses - * associated to the JMX connector servers - */ - JMXServiceURL[] getConnectorServerURLs(); - - /** - * @return The current server name - */ - String getJonasServerName(); - - /** - * @return The current management domain name - */ - String getDomainName(); - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jtm/TransactionService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jtm/TransactionService.java deleted file mode 100644 index d1bb845c9dc352b58871745500a6cedf14a410d0..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/jtm/TransactionService.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.jtm; - -import javax.transaction.NotSupportedException; -import javax.transaction.SystemException; -import javax.transaction.UserTransaction; -import javax.transaction.xa.Xid; - -import org.objectweb.jotm.Current; -import org.objectweb.jotm.TransactionFactory; -import org.objectweb.jonas.service.Service; -import org.objectweb.transaction.jta.TransactionManager; - -/** - * Transaction Service interface. - */ -public interface TransactionService extends Service { - - /** - * Gets the Current object. - */ - Current getCurrent(); - - /** - * Gets the TransactionManager. - */ - TransactionManager getTransactionManager(); - - /** - * @return Returns the {@link UserTransaction} object. - */ - UserTransaction getUserTransaction(); - - /** - * @return Returns the {@link TransactionFactory} object (JTM factory). - */ - TransactionFactory getTransactionFactory(); - - /** - * Sets the default transaction timeout. - * @param t default transaction timeout. - */ - void setTimeout(int t); - - /** - * Attach the current calling {@link Thread} to the given {@link Xid}. - * @param xid Transaction id. - * @param timeout Transaction timeout. - * @throws SystemException if the TM cannot attach the given {@link Xid}. - * @throws NotSupportedException if the TM cannot attach the given {@link Xid}. - */ - void attachTransaction(Xid xid, long timeout) throws NotSupportedException, SystemException; - - /** - * Detach the current {@link Thread} of the running Transaction. - */ - void detachTransaction(); -} - diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/MailService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/MailService.java deleted file mode 100644 index ffd323b6e06e86298cb870a085d98ff6b064d391..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/MailService.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id:MailService.java 10050 2007-03-07 10:45:32Z sauthieg $ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.mail; - -//import java.util -import java.util.Properties; - -//import jonas -import org.objectweb.jonas.service.Service; -import org.objectweb.jonas.mail.factory.JavaMail; - -/** - * This interface provides a description of the JavaMail service. - * @author Ludovic Bert - * @author Florent Benoit - */ -public interface MailService extends Service { - - /** - * Session marker. - */ - String SESSION_PROPERTY_TYPE = "javax.mail.Session"; - - /** - * MimePart DataSource marker. - */ - String MIMEPART_PROPERTY_TYPE = "javax.mail.internet.MimePartDataSource"; - - /** - * JOnAS-specific properties (name). - */ - String PROPERTY_NAME = "mail.factory.name"; - - /** - * JOnAS-specific properties (type). - */ - String PROPERTY_TYPE = "mail.factory.type"; - - /** - * Create a mail factory with the specified properties and register it into - * the registry. The created object is an instance of one of the 2 classes : - * JavaMailSession or JavaMailMimePartDS. - * @param name the mail factory name - * @param props the properties used to configure the mail factory. - * @throws MailServiceException if the creation or the registration of the - * factory failed. - */ - void createMailFactory(String name, Properties props) throws MailServiceException; - - /** - * This method is used when a Mail Factory configuration is modified via - * jonasAdmin. In this case, the updated JavaMail object (JavaMailSession or - * JavaMailMimePartDS object) must be rebound in JNDI - * @param factory the factory - * @throws MailServiceException if the recreation of the factory failed. - */ - void recreateJavaMailFactory(JavaMail factory) throws MailServiceException; - - /** - * This method is used when a particular Mail Factory configuration - * operation is done via jonasAdmin : when the JNDI name of this resource is - * modified. In this case, the initial JavaMail object (JavaMailSession or - * JavaMailMimePartDS object) must be unbound and the updated JavaMail - * object must be reloaded. Also, the Mail Service private data structures - * must be updated. - * @param oldName old name of the factory - * @param factory the new factory - * @throws MailServiceException if the rename of the the factory failed. - */ - void renameJavaMailFactory(String oldName, JavaMail factory) throws MailServiceException; - - /** - * Unregister all the binding factories on the server. - * @throws MailServiceException if the unregistration of the factories - * failed. - */ - void unbindMailFactories() throws MailServiceException; - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/MailServiceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/MailServiceException.java deleted file mode 100644 index c187036b756c6d98476a7c4f2dc790a4dc97b02a..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/MailServiceException.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Florent BENOIT & Ludovic BERT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.mail; - - -//import jonas -import org.objectweb.jonas.service.ServiceException; - -/** - * The class MailServiceException that indicates conditions that a - * reasonable application might want to catch. - * @author Ludovic Bert - * @author Florent Benoit - */ -public class MailServiceException extends ServiceException { - - /** - * Constructs a new MailServiceException with the specified - * message. - * @param message the detail message. - */ - public MailServiceException(String message) { - super(message, null); - } - - /** - * Constructs a new MailServiceException with the specified - * message. - * @param message the detail message. - * @param throwable the exception - */ - public MailServiceException(String message, Throwable throwable) { - super(message, throwable); - } -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/factory/JavaMail.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/factory/JavaMail.java deleted file mode 100644 index 53bee3ba4e6e3806c8d04660500ec53b247c690b..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/mail/factory/JavaMail.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.mail.factory; - -import java.util.Properties; - -import javax.naming.Referenceable; - -/** - * Represents a JavaMail resource. - * @author Guillaume Sauthier - */ -public interface JavaMail extends Referenceable { - - /** - * Return the jndi name of this object. - * @return the jndi name - */ - String getName(); - - /** - * Set the jndi name of this object. - * @param name the jndi name - */ - void setName(String name); - - /** - * Return the name of this mail factory. - * @return name of this mail factory. - */ - String getFactoryName(); - - /** - * Return the type of the factory. - * @return the type of the mail factory - */ - String getType(); - - /** - * @return Returns the mailSessionProperties. - */ - Properties getMailSessionProperties(); - - /** - * @param mailSessionProperties The mailSessionProperties to set. - */ - void setMailSessionProperties(Properties mailSessionProperties); - - /** - * Retrieves the session properties of this object. - * @return the session properties of this object. - */ - Properties getSessionProperties(); - - /** - * Set the session properties. - * @param props the session properties. - */ - void setSessionProperties(Properties props); - - /** - * Retrieves the authentication properties of this object. - * @return the authentication properties of this object. - */ - Properties getAuthenticationProperties(); - - /** - * Set the authentication properties. - * @param props the authentication properties. - */ - void setAuthenticationProperties(Properties props); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JComponentContextFactory.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JComponentContextFactory.java deleted file mode 100644 index 4a7d8664855ef40b0985d46acb0b3502bb197264..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JComponentContextFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.naming; - -import javax.naming.Context; -import javax.naming.NamingException; - -/** - * A JComponentContextFactory is a factory for JOnAS Component's Context. - * @see org.objectweb.jonas.naming.context.ComponentContext - * @author Guillaume Sauthier - */ -public interface JComponentContextFactory { - - /** - * Create {@link Context} for component environments. - * The returned context is a Java EE Component Context. - * It contains pre-defined references (according to - * the registered {@link JComponentContextFactoryDelegate}): - *
    - *
  • java:comp/ORB
  • - *
  • java:comp/HandleDelegate
  • - *
  • java:comp/UserTransaction
  • - *
- * - * @param id the Context ID. - * @return Naming {@link Context} for component environment - * @throws NamingException If exception encountered when creating namespace. - * - */ - Context createComponentContext(String id) throws NamingException; - - /** - * Add the given {@link JComponentContextFactoryDelegate} to this NamingManager instance. - * @param extension Added delegate - * @throws NamingException if the delegates is not added. - */ - void addDelegate(JComponentContextFactoryDelegate extension) throws NamingException; - - /** - * Remove the given {@link JComponentContextFactoryDelegate} from this NamingManager instance. - * @param extension Removed delegate - * @throws NamingException if the delegates is not removed. - */ - void removeDelegate(JComponentContextFactoryDelegate extension) throws NamingException; -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JComponentContextFactoryDelegate.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JComponentContextFactoryDelegate.java deleted file mode 100644 index 818f45f86845c278f6a3a9f98507b0982e2e25e5..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JComponentContextFactoryDelegate.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.naming; - -import javax.naming.Context; -import javax.naming.NamingException; - -/** - * The JComponentContextFactoryDelegate interface is used to - * separate the NamingManager implementation of other container - * implementation details concerning the component Context content. - *
- * Example: Add the java:comp/ORB CORBA ORB instance in the Context. - * @author Guillaume Sauthier - */ -public interface JComponentContextFactoryDelegate { - - /** - * Gives the possibility to modify the java:comp component Context. - * @param componentContext java:comp/ component context to be modified. - * @throws NamingException thrown if something goes wrong - * during the {@link javax.naming.Context} update. - */ - void modify(Context componentContext) throws NamingException; - - /** - * Undo the changes done by this delegate on the given java:comp context. - * @param componentContext java:comp/ component context to be modified. - * @throws NamingException thrown if something goes wrong - * during the {@link javax.naming.Context} update. - */ - void undo(Context componentContext) throws NamingException; -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JNamingManager.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JNamingManager.java deleted file mode 100644 index 9a11c8730ce22f4090e061c53a4894fd8c56b0ce..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/naming/JNamingManager.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.naming; - -import javax.naming.Context; -import javax.naming.NamingException; -import java.util.Hashtable; -import javax.naming.InitialContext; - - -/** - * Provide naming services for JOnAS containers. Containers use this - * interface for binding the environment entries, remote object references, - * resource factories and for managing the naming context of the current - * thread. - */ -public interface JNamingManager { - - /** - * Return the Context associated with the current thread. - * - * @return Context for current thread. - * @throws NamingException If context namespace does not exist. - */ - Context getComponentContext() throws NamingException; - - /** - * Associate this Context with the current thread. - * This method should be called in preinvoke/postinvoke - * and when we build the bean environment. - * - * @param ctx Context to associate with the current thread. - * @return Previous context setting for current thread. - */ - Context setComponentContext(Context ctx); - - /** - * Set back the context with the given value. - * Don't return the previous context, use setComponentContext() method for this. - * @param ctx the context to associate to the current thread. - */ - void resetComponentContext(Context ctx); - - /** - * Associate the specified ComponentContext with the given classloader. - * @param ctx the context to associate to the classloader. - * @param cl the classloader which is bind to the context. - */ - void setComponentContext(Context ctx, ClassLoader cl); - - /** - * Set the context used by client container (per JVM instead of per thread) - * @param ctx the context to set - */ - void setClientContainerComponentContext(Context ctx); - - /** - * Return the ComponentContext associated with the given classloader. - * @param cl the classloader which is bind to the context. - * @return the ComponentContext associated with the given classloader. - */ - Context getComponentContext(ClassLoader cl); - - /** - * Remove the ComponentContext associated with the given classloader. - * @param cl the classloader which is bind to the context. - */ - void unSetComponentContext(ClassLoader cl); - - /** - * Gets the initial context - * @return the initial context - */ - InitialContext getInitialContext(); - - /** - * @return the environment associated to this initial context - */ - Hashtable getEnv(); - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/registry/RegistryService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/registry/RegistryService.java deleted file mode 100644 index 39b83cb465d6783b6b61420c2bdef3ec3b7e03f1..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/registry/RegistryService.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.registry; - -import java.net.URI; -import java.util.List; - -import javax.naming.spi.InitialContextFactory; - -import org.objectweb.jonas.service.Service; - -/** - * Registry Service interface. - * @author Julien Lehembre (Libelis) - */ -public interface RegistryService extends Service { - - /** - * @return Returns a {@link List} of currently active protocols - * names (rmi, irmi, iiop, ...). - */ - List getActiveProtocolNames(); - - /** - * @param protocolName protocol name - * @return Returns the given protocol provider URL. - */ - URI getProviderURL(String protocolName); - - /** - * @param protocolName protocol name - * @return Returns the given protocol port where objects are - * exported. Returns 0 if unset. - */ - int getExportedObjectPort(String protocolName); - - /** - * @param protocolName protocol name - * @return Returns the {@link InitialContextFactory} classname - * of the given protocol. - */ - String getInitialContextFactoryName(String protocolName); - - /** - * @return Returns the default protocol name. - */ - String getDefaultProtocolName(); - - /** - * Set the current protocol to the given parameter. - * @param protocolName the new default protocol name. - */ - void setDefaultProtocol(String protocolName); -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/resource/ResourceService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/resource/ResourceService.java deleted file mode 100644 index c2e5b883e7ed94d36433996d1e074bdb148fc592..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/resource/ResourceService.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): - * JOnAS 2.4 Sebastien Chassande-Barrioz (sebastien.chassande@inrialpes.fr) - * JOnAS 3.0 Eric Hardesty (Eric.Hardesty@bull.com) - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.resource; - -import java.net.URL; -import java.util.List; - -import javax.naming.Context; - -import org.objectweb.jonas.service.Service; - -/** - * JCA resource service implmentation - * @author Philippe Coq - * Contributor(s): - * JOnAS 2.4 Sebastien Chassande-Barrioz (sebastien.chassande@inrialpes.fr) - * JOnAS 3.0 Eric Hardesty (Eric.Hardesty@bull.com) - * JOnAS 4.0 Adriana Danes (JSR 77 + use of Jakarta Modeler Component : http://jakarta.apache.org/commons/modeler) - * Eric Hardesty (J2CA 1.5) - * - */ -public interface ResourceService extends Service { - - /** - * Create a Resource Adapter - * @param ctx Context that defines the: - * 1) name of the resource adapter. - * 2) information to determine if the rar is in an ear - * - * the configuration information for this resource adapter - * must be found in the xml files in the rar file - * being deployed - * @return The ObjectName of the MBean associated to the deployed J2EE Application - * @throws Exception if the create of the RAR object fails. - */ - String createResourceAdapter(Context ctx) throws Exception; - - /** - * Deploy an RAR, used by management applications via J2EEServer managed object - * @param fileName the fileName of the rar which must be be deployed. - * @return The ObjectName of the MBean associated to the deployed J2EE Application - * @throws Exception if the deployment of the RAR failed. - */ - String deployRar(String fileName) throws Exception; - - /** - * Deploy the given rars of an ear file with the specified parent - * classloader (ear classloader). (This method is only used for - * the ear applications). - * @param ctx Context that defines the: - * This context contains the following parameters :
- * - urls the list of the urls of the rars to deploy.
- * - earRootURL the URL of the ear application file.
- * - earClassLoader the ear classLoader of the j2ee app.
- * - altDDs the optional URI of deployment descriptor.
- * @throws ResourceServiceException if an error occurs during the deployment. - */ - void deployRars(Context ctx) throws ResourceServiceException; - - /** - * Test if the specified filename is already deployed or not. - * @param fileName the name of the rar file. - * @return true if the rar is deployed, else false. - */ - boolean isRarLoaded(String fileName); - - /** - * Test if the specified filename is already deployed or not. - * @param fileName the name of the rar file. - * @return true if the rar is deployed, else false. - */ - Boolean isRarDeployed(String fileName); - - /** - * Test if the specified unpack name is already deployed or not. This - * method is defined in the RarService interface. - * @param unpackName the name of the rar file. - * @return true if the rar is deployed, else false. - */ - boolean isRarDeployedByUnpackName(String unpackName); - - /** - * Undeploy an RAR, used by management applications via J2EEServer managed object - * @param fileName the fileName of the rar which must be be undeployed. - * @throws Exception if the undeployment of the RAR failed. - */ - void unDeployRar(String fileName) throws Exception; - - /** - * Undeploy the given rars of an ear file with the specified parent - * classloader (ear classloader). (This method is only used for - * the ear applications). - * @param urls the list of the urls of the rars to deploy. - * @param earUrl ear's URL - */ - void unDeployRars(URL[] urls, URL earUrl); - -} - - diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/resource/ResourceServiceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/resource/ResourceServiceException.java deleted file mode 100644 index a3192ba165cbef0760cb6e6057a7a5c57938b143..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/resource/ResourceServiceException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric Hardesty - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.resource; - -import org.objectweb.jonas.service.ServiceException; - -/** - * The class ResourceServiceException that indicates conditions that a - * reasonable application might want to catch. - * @author Ludovic Bert - * @author Florent Benoit - */ -public class ResourceServiceException extends ServiceException { - - /** - * Constructs a new ResourceServiceException with the specified - * message. - * @param message the detail message. - */ - public ResourceServiceException(String message) { - this(message, null); - } - - /** - * Constructs a new ResourceServiceException with the specified - * message. - * @param message the detail message. - * @param throwable the exception - */ - public ResourceServiceException(String message, Throwable throwable) { - super(message, throwable); - } -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/SecurityService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/SecurityService.java deleted file mode 100644 index e1a45b04f16af5f969ce9e95f8156b26a6c7e43e..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/SecurityService.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.security; - -import org.objectweb.jonas.service.Service; -import org.objectweb.jonas.security.realm.factory.JResource; - - -/** - * Defines the interface for the security service - */ -public interface SecurityService extends Service { - - /** - * Return a resource by giving its name - * @param name the wanted Resource - * @return a JResouce - */ - JResource getJResource(String name); - - - /** - * String representation of the JOnAS realm - * @return the xml representation of the JOnAS realm - */ - String toXML(); - - - /** - * Bind the given resource with the given name. - * @param name resource name - * @param resource resource - */ - void bindResource(String name, JResource resource); - - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/factory/JResource.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/factory/JResource.java deleted file mode 100644 index 970caa04b6c20ec71f1e2b98263a43c3711e8128..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/factory/JResource.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.security.realm.factory; - -import java.util.ArrayList; -import java.util.Hashtable; - -import javax.naming.NamingException; -import javax.naming.Reference; - -import org.objectweb.jonas.security.realm.principals.JUser; - - -/** - * This interface represents JOnAS realm factory objects. - * @author Guillaume Sauthier - */ -public interface JResource { - - /** - * Set the name of this resource - * @param name Name of the resource - */ - void setName(String name); - - /** - * Get the name of this resource - * @return the name of this resource - */ - String getName(); - - /** - * Retrieves the Reference of the object. The Reference contains the factory - * used to create this object and the optional parameters used to configure - * the factory. - * @return the non-null Reference of the object. - * @throws NamingException if a naming exception was encountered while - * retrieving the reference. - */ - Reference getReference() throws NamingException; - - /** - * Remove all the Mbeans used by this resource - * @throws JResourceException if the MBeans can not be removed - */ - void removeMBeans() throws JResourceException; - - /** - * Check if a user is found and return it - * @param name the wanted user name - * @return the user found or null - * @throws JResourceException if there is an error during the search - */ - JUser findUser(String name) throws JResourceException; - - /** - * Check if the given credential is the right credential for the given user - * @param user user to check its credentials - * @param credentials the given credentials - * @return true if the credential is valid for this user - */ - boolean isValidUser(JUser user, String credentials); - - /** - * Get all the roles (from the roles and from the groups) of the given user - * @param user the given user - * @return the array list of all the roles for a given user - * @throws JResourceException if it fails - */ - ArrayList getArrayListCombinedRoles(JUser user) throws JResourceException; - - /** - * Return users - * @return Return users - */ - Hashtable getUsers(); - - /** - * @param users The users to set. - */ - void setUsers(Hashtable users); - - /** - * Clear the cache - */ - void clearCache(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/factory/JResourceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/factory/JResourceException.java deleted file mode 100644 index 744a3fafe6b972ee1e14f5004c51c5d497b0dd37..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/factory/JResourceException.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.security.realm.factory; - -/** - * The class JResourceException indicates conditions that a reasonable - * application might want to catch. - * @author Ludovic Bert - * @author Florent Benoit - */ -public class JResourceException extends Exception { - - /** - * Uid for serializable class. - */ - private static final long serialVersionUID = -4879978965028070035L; - - /** - * Constructs a new JResourceException with the specified message. - * @param message the detail message. - */ - public JResourceException(String message) { - super(message); - } - - /** - * Constructs a new JResourceException exception with the specified detail message and - * cause.

Note that the detail message associated with - * cause is not automatically incorporated in - * this runtime exception's detail message. - * @param message the detail message. - * @param cause the cause - */ - public JResourceException(String message, Throwable cause) { - super(message, cause); - } - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/lib/HashPassword.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/lib/HashPassword.java deleted file mode 100644 index fd9ce7d0046851b19db76615ee4a06ada5c147f5..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/lib/HashPassword.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer: Florent Benoit - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.security.realm.lib; - -import java.io.Serializable; - -/** - * This class implements a way for storing the hash of a password and the - * correspondig algorithm - * @author Florent Benoit - */ -public class HashPassword implements Serializable { - - /** - * Hash password - */ - private String password; - - /** - * Algorithm used - */ - private String algorithm; - - /** - * Constructor - * @param password the hash of the password - * @param algorithm algorithm of the encoded password - */ - public HashPassword(String password, String algorithm) { - this.password = password; - this.algorithm = algorithm; - } - - /** - * Return the hash of the password - * @return the hash of the password - */ - public String getPassword() { - return password; - } - - /** - * Return the algorithm used for this password - * @return the algorithm used for this password - */ - public String getAlgorithm() { - return algorithm; - } - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/principals/JUser.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/principals/JUser.java deleted file mode 100644 index 6214398e9d7d9f9fad5d4cdb7a420862ba3c13df..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/security/realm/principals/JUser.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.security.realm.principals; - -import java.util.ArrayList; - -import org.objectweb.jonas.security.realm.lib.HashPassword; - -/** - * This interface represents a user in a security realm. - * @author Guillaume Sauthier - */ -public interface JUser { - - /** - * Set the name of this user - * @param name Name of the user - */ - void setName(String name); - - /** - * Get the name of this user - * @return the name of this user - */ - String getName(); - - /** - * Get the password of this user - * @return the password of this user - */ - String getPassword(); - - /** - * Set the password of this user - * @param password password of the user - */ - void setPassword(String password); - - /** - * Set the hashed password of this user - * @return hashPassword hashed password of this user - */ - HashPassword getHashPassword(); - - /** - * Set the groups of the user - * @param groups the comma separated list of the groups of the user - */ - void setGroups(String groups); - - /** - * Get the groups - * @return the comma separated list of groups - */ - String getGroups(); - - /** - * Get the groups - * @return the array of the groups - */ - String[] getArrayGroups(); - - /** - * Set the roles of the user - * @param roles the comma separated list of the roles of the user - */ - void setRoles(String roles); - - /** - * Add the specified group to this user - * @param group the group to add - */ - void addGroup(String group); - - /** - * Add a role to this user - * @param role the given role - */ - void addRole(String role); - - /** - * Remove a group from this user - * @param group the given group - */ - void removeGroup(String group); - - /** - * Remove a role from this user - * @param role the given role - */ - void removeRole(String role); - - /** - * Get the roles - * @return the array of the roles - */ - String getRoles(); - - /** - * Set the combined roles of this user - * @param combinedRoles combined of the user - */ - void setCombinedRoles(ArrayList combinedRoles); - - /** - * Get the combined roles of this user - * @return the combined of the user - */ - ArrayList getCombinedRoles(); - - /** - * Get the roles - * @return the array of the roles - */ - String[] getArrayRoles(); - - /** - * String representation of the user - * @return the xml representation of the user - */ - String toXML(); - -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/JonasAlreadyStartedException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/JonasAlreadyStartedException.java deleted file mode 100644 index 3bf498c56e25e5334c35808754393e03181f4764..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/JonasAlreadyStartedException.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): ______________________________________. - * - * - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - - -package org.objectweb.jonas.service; - -/** - * This exception is used by services that received java.rmi.AlreadyBoundException - * @author: Ph Coq - */ -public class JonasAlreadyStartedException extends ServiceException { - - /** - * Default constructor. - */ - public JonasAlreadyStartedException() { - super("JonAS already started"); - } -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/Service.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/Service.java deleted file mode 100644 index 220ada756a8889b00f107bd4b6f7e7101252c6a8..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/Service.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): ______________________________________. - * - * 01/06/15 Regis Le Brettevillois - Libelis / JOnAS team - Evidian - * Creation. - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.service; - -import javax.naming.Context; - -/** - * This interface defines a Service. - * Objects which implement this interface must have a public constructor - * with a string parameter which is the name of the service. - */ -public interface Service { - - /** - * Initialize the service - * @param ctx configuration of the service - * @throws ServiceException when init fails. - */ - void init(Context ctx) throws ServiceException; - - /** - * Start the service - * @throws ServiceException when start fails. - */ - void start() throws ServiceException; - - /** - * Stop the service - * @throws ServiceException when stop fails. - */ - void stop() throws ServiceException; - - /** - * @return Returns true if the service is started, false otherwise - */ - boolean isStarted(); - - /** - * Set the service's name - * @param name the service's name - */ - void setName(String name); - - /** - * @return Returns the service's name - */ - String getName(); -} \ No newline at end of file diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/ServiceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/ServiceException.java deleted file mode 100644 index 802af9e45f21a1097bcc5e72cacf3a4266adf046..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/service/ServiceException.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): ____________________________________. - * Contributor(s): ______________________________________. - * - * 01/06/15 Regis Le Brettevillois - Libelis / JOnAS team - Evidian - * Creation. - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - - -package org.objectweb.jonas.service; - -/** - * Exception thrown by JOnAS Services. - */ -public class ServiceException extends RuntimeException { - - /** - * Constructor specifying only the cause message. - * @param message Exception description - */ - public ServiceException(String message) { - this(message, null); - } - - /** - * Constructor with message description + cause - * @param message Exception description - * @param throwable cause of the Exception - */ - public ServiceException(String message, Throwable throwable) { - super(message, throwable); - } - - /** - * @return Returns the message description of the Exception - */ - public String getMessage() { - String msg = super.getMessage(); - if (getCause() != null) { - msg += ": " + getCause(); - } - return msg; - } - - /** - * @return Returns a String representation of the Exception - */ - public String toString() { - return getClass().getName() + " : " + getMessage(); - } - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/web/JWebContainerService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/web/JWebContainerService.java deleted file mode 100644 index 36e87b58c88d2a9a4ffaca28edd30448d664f154..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/web/JWebContainerService.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.web; - -import java.net.URL; -import java.net.URLClassLoader; -import java.rmi.RemoteException; -import java.util.List; - -import javax.naming.Context; - -import org.objectweb.jonas.service.Service; - - -/** - * JOnAS WEB Container Service interface. - * This interface provides a description of a web container service. - * @author Ludovic Bert - * @author Florent Benoit - */ -public interface JWebContainerService extends Service { - - /** - * Deploy the given wars of an ear file with the specified parent - * classloader (ejb classloader or ear classloader). (This method - * is only used for the ear applications, not for the - * web applications). - * @param ctx the context containing the configuration - * to deploy the wars.
- * This context contains the following parameters :
- * - urls the list of the urls of the wars to deploy.
- * - earURL the URL of the ear application file.
- * - parentClassLoader the parent classLoader of the wars.
- * - earClassLoader the ear classLoader of the j2ee app.
- * - altDDs the optional URI of deployment descriptor.
- * - contextRoots the optional context root of the wars.
- * @throws JWebContainerServiceException if an error occurs during - * the deployment. - */ - void deployWars(Context ctx) throws JWebContainerServiceException; - - /** - * Undeploy the given wars of an ear file with the specified parent - * classloader (ejb classloader or ear classloader). (This method - * is only used for the ear applications, not for the - * war applications). - * @param urls the list of the urls of the wars to undeploy. - */ - void unDeployWars(URL[] urls); - - /** - * Make a cleanup of the cache of deployment descriptor. This method must - * be invoked after the ear deployment by the EAR service. - * the deployment of an ear by . - * @param earClassLoader the ClassLoader of the ear application to - * remove from the cache. - */ - void removeCache(ClassLoader earClassLoader); - - /** - * Return the Default host name of the web container. - * @return the Default host name of the web container. - * @throws JWebContainerServiceException when it is impossible to get the Default Host. - */ - String getDefaultHost() throws JWebContainerServiceException; - - /** - * Return the Default HTTP port number of the web container (can - * be null if multiple HTTP connector has been set). - * @return the Default HTTP port number of the web container. - * @throws JWebContainerServiceException when it is impossible to get the Default Http port. - */ - String getDefaultHttpPort() throws JWebContainerServiceException; - - /** - * Return the Default HTTPS port number of the web container (can - * be null if multiple HTTPS connector has been set). - * @return the Default HTTPS port number of the web container. - * @throws JWebContainerServiceException when it is impossible to get the Default Https port. - */ - String getDefaultHttpsPort() throws JWebContainerServiceException; - - /** - * Return the class loader of the given warURL. Unpack the associated war - * and build the loader if it's not in the cache. - * @param warURL the url of the war we want to get the loader - * @param earAppName the name of the ear application containing - * the war. May be null in non ear case. - * @param ejbClassLoader the ejb class loader of the ear. - * May be null in non ear case. - * @return the class loader of the given warURL. - * @throws JWebContainerServiceException if the process failed. - */ - URLClassLoader getClassLoader(URL warURL, String earAppName, ClassLoader ejbClassLoader) throws JWebContainerServiceException; - - /** - * @param warURL the URL of the webapp - * @return Returns the ClassLoader used to link a JNDI environnment to a webapp - */ - ClassLoader getContextLinkedClassLoader(URL warURL); - - /** - * Register a WAR by delegating the operation to the registerWar() method. - * This is used for JMX management. - * @param fileName the name of the war to deploy. - * @throws RemoteException if rmi call failed. - * @throws JWebContainerServiceException if the registration failed. - */ - void registerWar(String fileName) throws RemoteException, JWebContainerServiceException; - - /** - * Test if the specified filename is already deployed or not. - * @param fileName the name of the war file. - * @return true if the war is deployed, else false. - */ - boolean isWarLoaded(String fileName); - - /** - * Unregister a WAR by delegating the operation to the unRegisterWar() - * method. This is used for JMX management. - * @param fileName the name of the war to undeploy. - * @throws RemoteException if rmi call failed. - * @throws JWebContainerServiceException if the unregistration failed. - */ - void unRegisterWar(String fileName) throws RemoteException, JWebContainerServiceException; - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/web/JWebContainerServiceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/web/JWebContainerServiceException.java deleted file mode 100644 index b1dcc1cc40e3d117feebb16f71c70cbbc4146b61..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/web/JWebContainerServiceException.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.web; - - -//import jonas -import org.objectweb.jonas.service.ServiceException; - -/** - * The class JWebContainerServiceException that indicates conditions that a - * reasonable application might want to catch. - * @author Ludovic Bert - * @author Florent Benoit - */ -public class JWebContainerServiceException extends ServiceException { - - /** - * Constructs a new JWebContainerServiceException with the specified - * message. - * @param message the detail message. - */ - public JWebContainerServiceException(final String message) { - super(message, null); - } - - /** - * Constructs a new JWebContainerServiceException with the specified - * message. - * @param message the detail message. - * @param throwable the exception - */ - public JWebContainerServiceException(final String message, final Throwable throwable) { - super(message, throwable); - } -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/workmanager/WorkManagerService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/workmanager/WorkManagerService.java deleted file mode 100644 index 08ce3aab801be928b864fb007b7c9b55160a9f2b..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/workmanager/WorkManagerService.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2007 Bull S.A.S - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.workmanager; - -import javax.resource.spi.work.WorkManager; - -import org.objectweb.jonas.service.Service; - -/** - * Give access to a {@link WorkManager} implementation. - * @author Guillaume Sauthier - */ -public interface WorkManagerService extends Service { - - /** - * @return Returns a {@link WorkManager} implementation. - */ - WorkManager getWorkManager(); -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ws/WSServiceException.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ws/WSServiceException.java deleted file mode 100644 index 459cc313b6ad8914a76471185cca17da4d3f81a0..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ws/WSServiceException.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.ws; - - -//import jonas -import org.objectweb.jonas.service.ServiceException; - -/** - * The class WSServiceException that indicates conditions that a - * reasonable application might want to catch. - * @author Xavier Delplanque - */ -public class WSServiceException extends ServiceException { - - /** - * Constructs a new WSServiceException with the specified - * message. - * @param message the detail message. - */ - public WSServiceException(String message) { - super(message, null); - } - - /** - * Constructs a new WSServiceException with the specified - * message. - * @param message the detail message. - * @param throwable the exception - */ - public WSServiceException(String message, Throwable throwable) { - super(message, throwable); - } -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ws/WebServicesService.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ws/WebServicesService.java deleted file mode 100644 index e1d93581084b4b452e1dea79816a71db1b416d13..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas/ws/WebServicesService.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- -*/ - -package org.objectweb.jonas.ws; - - -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.Reference; - -import org.objectweb.jonas_ws.deployment.api.IServiceRefDesc; - -import org.objectweb.jonas.service.Service; - - -/** - * WebServices Service interface. - * - * @author Guillaume Sauthier - */ -public interface WebServicesService extends Service { - - /** - * classloader Context param. - */ - String CLASSLOADER_CTX_PARAM = "classloader"; - - /** - * parentObjectName Context Param. - */ - String PARENT_OBJECTNAME_CTX_PARAM = "parentObjectName"; - - /** - * isInEar Context Param. - */ - String ISINEAR_CTX_PARAM = "isInEar"; - - /** - * warURL Context Param. - */ - String WARURL_CTX_PARAM = "warURL"; - - /** - * explore the context classloader to find Web service deployment - * descriptor (for endpoints) and service-ref element within standard - * deployment descriptor (for clients). It registers each endpoints in WS - * engine publishing relative WSDLs, and it instanciates and binds in the - * registry each clients classes. - * - * @param ctx the context containing the configuration to deploy the - * wars.
This context contains the following parameters :
- - * jarUrls the list of the urls of the jars to deploy.
- - * warUrls the list of the urls of the wars to deploy.
- - * parentClassLoader the parent classLoader of the wars.
- - * earClassLoader the ear classLoader of the j2ee app.
- altDDs - * the optional URI of deployment descriptor.
- * - * @throws WSServiceException if an error occurs during the deployment. - */ - void deployWebServices(Context ctx) throws WSServiceException; - - /** - * Remove the WebServices descriptors associated to the given ClassLoader. - * - * @param cl the key ClassLoader - */ - void removeCache(ClassLoader cl); - - /** - * Complete the WebServices Deployment (add informations in web environment). - * @param ctx Context containing the key ClassLoader - * @throws WSServiceException When Endpoints URLs binding fails - */ - void completeWSDeployment(Context ctx) throws WSServiceException; - - /** - * buildServiceRef from WS ref descriptor. - * @param rd WS ref descriptor - */ - Reference buildServiceRef(IServiceRefDesc rd, ClassLoader loader) throws NamingException; - - /** - * Undeploy the WebServices : unpublish WSDL + unregister MBeans. - * @param ctx Context containing undeployment informations - * @throws WSServiceException When undeployment fails - */ - void undeployWebServices(Context ctx) throws WSServiceException; - - /** - * Automatic WSGen is enabled ? - * @return true if automatic WSGen needs to be Called. - */ - boolean isAutoWsGenEngaged(); - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_ejb/container/JTimerHandleInfo.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_ejb/container/JTimerHandleInfo.java deleted file mode 100644 index 3cbb72614995edb84fca5edf735009e5a41a07fb..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_ejb/container/JTimerHandleInfo.java +++ /dev/null @@ -1,205 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2006-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_ejb.container; - -import java.io.Serializable; - -/** - * Hold TimerHandle datas. Used to retrieve a given Timer. - * @author Guillaume Sauthier - */ -public class JTimerHandleInfo implements Serializable { - - /** - * Serial Version UID. - */ - private static final long serialVersionUID = 3580043842820893364L; - - /** - * The EjbJar containing the wanted Timer. - */ - private String containerId = null; - - /** - * The Bean containing the Timer. - */ - private String beanId = null; - - /** - * Timer period. - */ - private long period; - - /** - * Timer start time. - */ - private long startTime; - - /** - * Timer duration. - */ - private long duration; - - /** - * Serializable info. - */ - private Serializable info; - - /** - * Encoded PK. If CMP2 is not used, no encoding is done. - */ - private Serializable pk; - - /** - * @return the beanId - */ - public String getBeanId() { - return beanId; - } - - /** - * @param beanId the beanId to set - */ - public void setBeanId(final String beanId) { - this.beanId = beanId; - } - - /** - * @return the containerId - */ - public String getContainerId() { - return containerId; - } - - /** - * @param containerId the containerId to set - */ - public void setContainerId(final String containerId) { - this.containerId = containerId; - } - - /** - * @return the duration - */ - public long getDuration() { - return duration; - } - - /** - * @param duration the duration to set - */ - public void setDuration(final long duration) { - this.duration = duration; - } - - /** - * @return the info - */ - public Serializable getInfo() { - return info; - } - - /** - * @param info the info to set - */ - public void setInfo(final Serializable info) { - this.info = info; - } - - /** - * @return the period - */ - public long getPeriod() { - return period; - } - - /** - * @param period the period to set - */ - public void setPeriod(final long period) { - this.period = period; - } - - /** - * @return the pk - */ - public Serializable getPk() { - return pk; - } - - /** - * @param pk the pk to set - */ - public void setPk(final Serializable pk) { - this.pk = pk; - } - - /** - * @return the startTime - */ - public long getStartTime() { - return startTime; - } - - /** - * @param startTime the startTime to set - */ - public void setStartTime(final long startTime) { - this.startTime = startTime; - } - - /** - * Test equality between 2 JTimerHandleInfo instances. - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (!(obj instanceof JTimerHandleInfo)) { - return false; - } - JTimerHandleInfo other = (JTimerHandleInfo) obj; - - if (!other.beanId.equals(beanId) - || !other.containerId.equals(containerId) - || other.duration != duration - || !other.info.equals(info) - || other.period != period - || !other.pk.equals(pk) - || other.startTime != startTime) { - return false; - } - - return true; - } - - /** - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - long compound = duration + period + startTime; - return (beanId + containerId + info + pk + compound).hashCode(); - } - -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_jms/api/JmsAdministration.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_jms/api/JmsAdministration.java deleted file mode 100644 index e5c4ee3a02d88948ad947763fdbcdf76deceb4fb..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_jms/api/JmsAdministration.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - - -package org.objectweb.jonas_jms.api; - -import javax.jms.Queue; -import javax.jms.Topic; -import javax.jms.XAConnectionFactory; -import javax.jms.XAQueueConnectionFactory; -import javax.jms.XATopicConnectionFactory; - - -/** - * JMS Administration interface. - * must be implemented for each jms provider - * JOnAS uses this interface to access the JMS provider. - * @author Philippe Coq - * Contributor(s): - * Jeff Mesnil: for JORAM 3.0 integration - * Frederic Maistre: for JORAM 3.4 (JMS 1.1) integration - * 03/05/25 : Adriana Danes : add JMS resource monitoring - */ -public interface JmsAdministration { - - /** - * Jms Administrator is created with newInstance(). - * initialization is done later with this method. - * The MOM will be started if collocated. - * This method should create an XAConnectionFactory, - * a XATopicConnectionFactory and a XAQueueConnectionFactory - * @param boolean true for if the MOM in run in the current JVM - * @param String url connexion that must be used. - */ - public void start(boolean collocated, String url) throws Exception; - - /** - * Stop the Jms Administrator - */ - public void stop(); - - /** - * Get the XAConnectionFactory - */ - public XAConnectionFactory getXAConnectionFactory(); - - /** - * Get the XATopicConnectionFactory - */ - public XATopicConnectionFactory getXATopicConnectionFactory(); - - /** - * Get the XAQueueConnectionFactory - */ - public XAQueueConnectionFactory getXAQueueConnectionFactory(); - - /** - * Create a Topic - */ - public Topic createTopic(String name) throws Exception; - - /** - * Create a Queue - */ - public Queue createQueue(String name) throws Exception; - - /** - * Delete a destination. - */ - public void deleteDestination(String name) throws Exception; - - /** - * Get number of pending messages on a queue - */ - public int getPendingMessages(javax.jms.Queue queue) throws Exception; - - /** - * Get number of pending requests on a queue - */ - public int getPendingRequests(javax.jms.Queue queue) throws Exception; - - /** - * Get number of subscriptions on a topic - */ - public int getSubscriptions(javax.jms.Topic topic) throws Exception; -} diff --git a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_jms/api/JmsManager.java b/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_jms/api/JmsManager.java deleted file mode 100644 index 380044e9438e64a0872ca5e22a1a5595c166e506..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/jonas-services-api/src/main/java/org/objectweb/jonas_jms/api/JmsManager.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or any later version. - * - * This library is distributed in the hoper that irt 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas_jms.api; - -import java.util.Enumeration; -import javax.jms.ConnectionFactory; -import javax.jms.Queue; -import javax.jms.QueueConnectionFactory; -import javax.jms.Topic; -import javax.jms.TopicConnectionFactory; -import javax.jms.XAConnectionFactory; -import javax.jms.XAQueueConnectionFactory; -import javax.jms.XATopicConnectionFactory; -import org.objectweb.transaction.jta.TransactionManager; - -/** - * JMS Manager interface. - * Implemented by the jms module (jonas_jms/JmsManagerImpl) - * This interface allows other jonas module to be independant - * of jonas_jms implementation. - * @author Philippe Coq - * Contributor(s): - * Jeff Mesnil: for JORAM 3.0 integration - * Frederic Maistre: for JORAM 3.4 (JMS 1.1) integration - */ -public interface JmsManager { - - /** - * Initialisation of JmsManager - * - * @param class cl class implementing administration process - * @param boolean true for launching the MOM in the same JVM - * @param String connexion url to the MOM (in case of remote mode) - * @param TransactionManager tm - * @exception Exception must be thrown if the MOM is unreachable - */ - public void init(Class cl, boolean collocated, String url, TransactionManager tm) throws Exception; - - /** - * Terminate the administering process - */ - public void stop() throws Exception; - - /** - * Create a Queue and bind it in the registry - */ - public Queue createQueue(String name) throws Exception; - - /** - * Get Queue (creates it if not exist) - */ - public Queue getQueue(String name) throws Exception; - - /** - * Get Queue Names - */ - public Enumeration getQueuesNames(); - - /** - * Create a Topic and bind it in the registry - */ - public Topic createTopic(String name) throws Exception; - - /** - * Get Topic (creates it if not exist) - */ - public Topic getTopic(String name) throws Exception; - - /** - * Get Topic Names - */ - public Enumeration getTopicsNames(); - - /** - * Get the unique ConnectionFactory - */ - public ConnectionFactory getConnectionFactory(); - - /** - * Get the unique XAConnectionFactory - */ - public XAConnectionFactory getXAConnectionFactory(); - - /** - * Get the unique TopicConnectionFactory - */ - public TopicConnectionFactory getTopicConnectionFactory(); - - /** - * Get the unique XATopicConnectionFactory - */ - public XATopicConnectionFactory getXATopicConnectionFactory(); - - /** - * Get the unique QueueConnectionFactory - */ - public QueueConnectionFactory getQueueConnectionFactory(); - - /** - * Get the unique XAQueueConnectionFactory - */ - public XAQueueConnectionFactory getXAQueueConnectionFactory(); -} - diff --git a/jonas/modules/apis/pom.xml b/jonas/modules/apis/pom.xml deleted file mode 100644 index 15be6569bf31cd3d25ecd1013543adef067cdd57..0000000000000000000000000000000000000000 --- a/jonas/modules/apis/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - org.objectweb.jonas - jonas-modules - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-apis - pom - JOnAS :: APIs - - - jonas-deployment-api - jonas-services-api - - - diff --git a/jonas/modules/client/pom.xml b/jonas/modules/client/pom.xml deleted file mode 100644 index cc0fbd6642d9becf8cbb45ab7f6dfa38c2e4f9de..0000000000000000000000000000000000000000 --- a/jonas/modules/client/pom.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - org.objectweb.jonas - jonas-modules - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-client - JOnAS :: Client Container - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.objectweb.jonas.client.ClientContainer - true - - - - - - - - - - org.objectweb.carol - carol - provided - - - org.objectweb.jonas - jonas-deployment - ${jonas.version} - - - org.objectweb.jonas - jonas-commons - ${jonas.version} - - - org.objectweb.jonas - jonas-deployment - ${jonas.version} - - - org.objectweb.jonas - jonas-webservices-base - ${jonas.version} - - - org.objectweb.jonas - jonas-naming - ${jonas.version} - - - org.objectweb.jonas - jonas-security - ${jonas.version} - - - org.objectweb.jonas - jonas-generators-wsgen - ${jonas.version} - - - org.objectweb.jonas - jonas-tm-jotm - ${jonas.version} - - - org.objectweb.jonas - jonas-carol-registry - ${jonas.version} - - - org.objectweb.jonas - jonas-ejb-2.1 - ${jonas.version} - - - org.objectweb.monolog - monolog-api - ${monolog.version} - - - \ No newline at end of file diff --git a/jonas/modules/client/src/main/java/org/objectweb/jonas/client/ClientContainer.java b/jonas/modules/client/src/main/java/org/objectweb/jonas/client/ClientContainer.java deleted file mode 100644 index 2444bbf7d2f2a1fe945beef600d59733fc54e58a..0000000000000000000000000000000000000000 --- a/jonas/modules/client/src/main/java/org/objectweb/jonas/client/ClientContainer.java +++ /dev/null @@ -1,1260 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 1any 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.client; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import javax.naming.Context; -import javax.naming.LinkRef; -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.naming.StringRefAddr; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.login.LoginContext; - -import org.objectweb.carol.util.configuration.CarolDefaultValues; -import org.objectweb.carol.util.configuration.ConfigurationRepository; -import org.objectweb.jonas.client.naming.ClientInitialContextFactory; -import org.objectweb.jonas.common.Log; -import org.objectweb.jonas.common.cpmanager.EarClassPathManager; -import org.objectweb.jonas.common.cpmanager.EarClassPathManagerException; -import org.objectweb.jonas.common.cpmanager.JarList; -import org.objectweb.jonas.common.cpmanager.JarListException; -import org.objectweb.jonas.naming.JComponentContextFactory; -import org.objectweb.jonas.naming.JNamingManager; -import org.objectweb.jonas.naming.context.SingletonComponentContextFactory; -import org.objectweb.jonas.naming.manager.SingletonNamingManager; -import org.objectweb.jonas.security.auth.callback.NoInputCallbackHandler; -import org.objectweb.jonas.security.jacc.JPolicyUserRoleMapping; -import org.objectweb.jonas.work.EarFileManager; -import org.objectweb.jonas.ws.JServiceFactory; -import org.objectweb.jonas.ws.base.ClientJServiceFactoryFinder; -import org.objectweb.jonas_client.deployment.api.ClientContainerDeploymentDesc; -import org.objectweb.jonas_client.deployment.api.ClientContainerDeploymentDescException; -import org.objectweb.jonas_client.deployment.lib.ClientDeploymentDescManager; -import org.objectweb.jonas_ear.deployment.api.EarDeploymentDesc; -import org.objectweb.jonas_ear.deployment.api.EarDeploymentDescException; -import org.objectweb.jonas_ear.deployment.lib.EarDeploymentDescManager; -import org.objectweb.jonas_ear.deployment.xml.Web; -import org.objectweb.jonas_ejb.deployment.lib.EjbDeploymentDescManager; - -import org.objectweb.jonas_lib.deployment.api.IMessageDestinationRefDesc; -import org.objectweb.jonas_lib.deployment.api.IEJBRefDesc; -import org.objectweb.jonas_lib.deployment.api.IEnvEntryDesc; -import org.objectweb.jonas_lib.deployment.api.IResourceEnvRefDesc; -import org.objectweb.jonas_lib.deployment.api.IResourceRefDesc; -import org.objectweb.jonas_lib.files.FileUtils; -import org.objectweb.jonas_lib.version.Version; -import org.objectweb.jonas_web.deployment.lib.WebDeploymentDescManager; - -import org.objectweb.jonas_ws.deployment.api.IServiceRefDesc; -import org.objectweb.jonas_ws.wsgen.WsGen; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * Defines the class use for the client container This class analyze the ear or - * the jar client and launch the client - * @author Florent Benoit - */ -public class ClientContainer { - - /** - * Name of the carol file - */ - private static final String CAROL_FILE = "carol.properties"; - - /** - * Main class to use to launch the application client - */ - private String mainClass = null; - - /** - * Temporary directory - */ - private String tmpDir = null; - - /** - * Jar client to use (if many) - */ - private String jarClient = null; - - /** - * Classpath for the application client - */ - private String classpath = null; - - /** - * trace.properties file to use instead of the default file. - */ - private String clientTraceFile = null; - - /** - * Reference on the NamingManager. - */ - private JNamingManager naming; - - /** - * carol.properties file to use instead of the default file. - */ - private String carolFile = null; - - /** - * Arguments used by the client - */ - private String[] args = null; - - /** - * Class loader of the EAR - */ - private URLClassLoader earClassLoader = null; - - /** - * Extra Arguments - */ - private ArrayList appArgs = null; - - /** - * URLs resolved in the case of the extension mechanism in the Ear case - */ - private URL[] extensionsURLs = null; - - /** - * Logger to use - */ - private Logger logger = null; - - /** - * true if the user want to auto generate web services artifacts - */ - private boolean applyWsGen = true; - - /** - * Constructor for a Client container - * @param args the arguments of the instance of the client container - */ - private ClientContainer(String[] args) { - this.args = args; - - appArgs = new ArrayList(); - } - - /** - * Call the Log class to instanciate the client container logger - */ - private void initLogger() { - // Allow tracing ejb/jms code - Log.configure(clientTraceFile); - // init the logger - this.logger = Log.getLogger(Log.JONAS_CLIENT_PREFIX); - } - - /** - * Main method of the Client container - * @param args the arguments of the client container - */ - public static void main(String[] args) { - // Retrieve command line parameters - ClientContainer cc = new ClientContainer(args); - - try { - cc.start(); - } catch (InvocationTargetException ite) { - Throwable t = ite.getTargetException(); - String message = t.getMessage(); - if (t instanceof Error) { - System.err.println("There was the following error : " + message); - } else if (t instanceof Exception) { - System.err.println("There was the following exception : " + message); - } - t.printStackTrace(System.err); - } catch (Exception e) { - System.err.println("There was the following exception : " + e.getMessage()); - e.printStackTrace(); - System.exit(-1); - } - } - - /** - * Start the client container - * @throws Exception if it fails - */ - private void start() throws Exception { - analyzeArgs(); - - // Use the specified traceclient.properties - if (clientTraceFile != null) { - File tClient = new File(clientTraceFile); - - if (!tClient.exists()) { - throw new ClientContainerException("The file '" + clientTraceFile + "' was not found."); - } - - if (!tClient.isFile()) { - throw new ClientContainerException("The file '" + clientTraceFile - + "' is not a valid file. Maybe a directory ?"); - } - - // Configure log - System.setProperty("jonas.client.trace.file", clientTraceFile); - Log.reset(); - } else { - clientTraceFile = "traceclient"; - } - - initLogger(); - - // Get the filename - String userArg = null; - String fileName = null; - boolean fileMode = true; - - try { - userArg = (String) appArgs.get(0); - } catch (IndexOutOfBoundsException ioobe) { - usage(); - throw new ClientContainerException( - "You haven't specify a jar, an ear file or class name as argument. See the Usage."); - } - - String className = null; - // Test if this is an ear or a jar file else it must be a class name - if (!(userArg.toLowerCase().endsWith(".jar") || userArg.toLowerCase().endsWith(".ear"))) { - className = userArg; - fileMode = false; - } else { - fileMode = true; - fileName = userArg; - } - - // WsGen - if (applyWsGen && fileMode) { - try { - File argFile = new File(fileName); - - if (!argFile.exists()) { - throw new ClientContainerException("The specified file '" - + fileName + "' doesn't exists."); - } - Manifest manifest = new JarFile(argFile).getManifest(); - - if (manifest == null) { - throw new ClientContainerException( - "No manifest was found inside the file" + argFile); - } - - // Extract attributes - Attributes attributes = manifest.getMainAttributes(); - - if (attributes == null) { - throw new ClientContainerException( - "No attributes were found in the manifest of the file '" - + argFile + "'."); - } - String archiveVersion = attributes.getValue("WsGen-JOnAS-Version"); - if (!Version.getNumber().equals(archiveVersion)) { - this.logger.log(BasicLevel.DEBUG, "Archive was not compiled with the latest WsGen. Regenerating ..."); - // different versions, re-generate Stuff - WsGen wsgen = new WsGen(); - String[] args = {"-d", System.getProperty("java.io.tmpdir"), - argFile.getPath()}; - String resultJarFile = wsgen.execute(args); - - if (!resultJarFile.equals(argFile.getPath())) { - // WsGen changed the archive - FileUtils.copyFile(resultJarFile, argFile.getPath()); - FileUtils.delete(resultJarFile); - } - } - - } catch (Exception e) { - throw new ClientContainerException( - "Cannot apply WsGen on the client archive : " + userArg, e); - } - } - - - - // Build file and test if it exists - File clientJarFile = null; - if (fileMode) { - File argFile = new File(fileName); - - // Unpack and analyze EAR file if it is an ear - if (fileName.toLowerCase().endsWith(".ear")) { - clientJarFile = extractAndAnalyzeEar(argFile); - } else { - //Client jar is the given file - clientJarFile = argFile; - } - } - - // Carol initialisation (property) - System.setProperty("javax.rmi.CORBA.PortableRemoteObjectClass", - "org.objectweb.carol.rmi.multi.MultiPRODelegate"); - System.setProperty("org.omg.PortableInterceptor.ORBInitializerClass.org.objectweb.jotm.ots.OTSORBInitializer", - ""); - System.setProperty("org.omg.PortableInterceptor.ORBInitializerClass.org.objectweb.jonas.security.interceptors.iiop.SecurityInitializer", - ""); - System.setProperty("org.omg.CORBA.ORBClass" , "org.jacorb.orb.ORB"); - System.setProperty("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton"); - System.setProperty("org.omg.PortableInterceptor.ORBInitializerClass.standard_init" , "org.jacorb.orb.standardInterceptors.IORInterceptorInitializer"); - System.setProperty("javax.rmi.CORBA.UtilClass" , "org.objectweb.carol.util.delegate.UtilDelegateImpl"); - - // Build a classloader for the initialisation of carol - // Priority - // 1/ file as argument - // 2/ file in the jar client - // 3/ file in client.jar - URL urlCarolFile = null; - - if (carolFile != null) { - File fCarol = new File(carolFile); - - if (!fCarol.exists()) { - throw new ClientContainerException("The file '" + carolFile + "' was not found."); - } - - if (!fCarol.isFile()) { - throw new ClientContainerException("The file '" + carolFile - + "' is not a valid file. Maybe a directory ?"); - } - - if (!fCarol.getName().equals(CAROL_FILE)) { - throw new ClientContainerException("The file '" + carolFile + "' must be named '" + CAROL_FILE + "'."); - } - - try { - urlCarolFile = fCarol.toURL(); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Using carol.properties file specified by the user on command line"); - } - } catch (MalformedURLException mue) { - throw new ClientContainerException("Error when building an URL for the file '" + fCarol + "'.", mue); - } - } - - // carol.properties file in client jar, use it if this is the case ? - if (urlCarolFile == null && fileMode) { - URL tmpUrl = null; - try { - tmpUrl = clientJarFile.toURL(); - } catch (MalformedURLException mue) { - throw new ClientContainerException("Error when building an URL for the file '" + clientJarFile + "'.", mue); - } - // Build classloader with null parent CL, to see if it is in the file. - ClassLoader tmpCl = new URLClassLoader(new URL[] {tmpUrl}, null); - - urlCarolFile = tmpCl.getResource(CarolDefaultValues.CAROL_CONFIGURATION_FILE); - if (urlCarolFile != null) { - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Using carol.properties file of the '" + clientJarFile + "' file."); - } - } - } - - - - if (urlCarolFile != null) { - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Init carol with URL '" + urlCarolFile + "'."); - } - ConfigurationRepository.init(urlCarolFile); - } else { - ConfigurationRepository.init(); - } - // Add Csiv2 Interceptors - ConfigurationRepository.addInterceptors("iiop", "org.objectweb.jonas.security.iiop.Csiv2Initializer"); - - // Must be done AFTER carol init because carol set this property internally. - System.setProperty("java.naming.factory.initial", ClientInitialContextFactory.class.getName()); - - - // Carol configuration is done - // Extract Main-Class to use in the jar from the manifest - if (fileMode) { - Manifest manifest = new JarFile(clientJarFile).getManifest(); - - if (manifest == null) { - throw new ClientContainerException("No manifest was found inside the file" + clientJarFile); - } - - // Extract attributes - Attributes attributes = manifest.getMainAttributes(); - - if (attributes == null) { - throw new ClientContainerException("No attributes were found in the manifest of the file '" - + clientJarFile + "'."); - } - mainClass = attributes.getValue(Attributes.Name.MAIN_CLASS); - } else { - mainClass = className; - } - - // Invoke the client if there is no need of XML parsing - if (!fileMode) { - ClassLoader clientCL = new URLClassLoader(getUserClasspathUrls()); - Thread.currentThread().setContextClassLoader(clientCL); - invokeClient(); - return; - } - - if (mainClass == null || mainClass.length() == 0) { - throw new ClientContainerException("No main class was found inside the Manifest of the file '" - + clientJarFile + "'. This attribute is required to launch the application client."); - } - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Using Main-Class :" + mainClass); - } - - // Convert file to URL - URL clientJarURL = null; - - try { - clientJarURL = clientJarFile.toURL(); - } catch (MalformedURLException mue) { - throw new ClientContainerException("Error when building an URL with the file '" + clientJarFile + "'.", mue); - } - - // Build the urls for the classloader - URL[] urlsClient = null; - - // URLs for the classloader - if (extensionsURLs != null) { - // There were URLs with the extension mechanism in the EAR - urlsClient = new URL[extensionsURLs.length + 1]; - - for (int i = 0; i < extensionsURLs.length; i++) { - urlsClient[i] = extensionsURLs[i]; - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Adding " + extensionsURLs[i] + " to the urls of the client"); - } - } - - urlsClient[extensionsURLs.length] = clientJarURL; - } else { - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Only one url for urls of client"); - } - - // No extension or jar case. - urlsClient = new URL[1]; - urlsClient[0] = clientJarURL; - } - - // Build classloader - URLClassLoader clientClassloader = new URLClassLoader(urlsClient, Thread.currentThread() - .getContextClassLoader()); - Thread.currentThread().setContextClassLoader(clientClassloader); - - // Get the deployment descriptor from file - ClientContainerDeploymentDesc clientDD = null; - if (extensionsURLs != null) { - EjbDeploymentDescManager.getInstance().addClassLoaderUrlMapping(clientClassloader, extensionsURLs); - } - - try { - clientDD = ClientDeploymentDescManager.getInstance().getDeploymentDesc(clientJarURL, clientClassloader, earClassLoader); - } catch (ClientContainerDeploymentDescException e) { - String err = "Cannot read the deployment descriptors '" + clientJarURL + "'"; - error(err); - throw new ClientContainerException(err, e); - } - - // Populate the java:comp/env (ENC) environment. - try { - setClientEnvironment(clientDD); - } catch (Exception e) { - //populating environment failed. - String err = "Error when populating "; - error(err); - throw new ClientContainerException(err, e); - } - - // JAAS - String jaasFile = clientDD.getJaasFile(); - String jaasEntry = clientDD.getJaasEntry(); - String username = clientDD.getUsername(); - String password = clientDD.getPassword(); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Using jaas file = " + jaasFile); - } - - String jaasConfigFile = null; - - if (jaasFile != null) { - // Use JAAS - jaasConfigFile = "jar:" + clientJarURL.toExternalForm() + "!/" + jaasFile; - System.setProperty("java.security.auth.login.config", jaasConfigFile); - } - - CallbackHandler ch = null; - - if ((username != null) && (password != null)) { - ch = new NoInputCallbackHandler(username, password); - info("Using the login/password specified in the jonas-client.xml file with a specific CallbackHandler"); - } else { - // Is there a callbackHandler specified ? - String ddCallbackHandler = clientDD.getCallbackHandler(); - - if (ddCallbackHandler != null) { - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Using '" + ddCallbackHandler + "' class as CallbackHandler."); - } - - Class clazz = null; - - //try to invoke this class - try { - clazz = clientClassloader.loadClass(ddCallbackHandler); - } catch (Exception e) { - throw new ClientContainerException("There was an error while trying to instantiate the class '" - + ddCallbackHandler - + "' which is specified in the application.xml as CallbackHandler class", e); - } - - try { - ch = (CallbackHandler) clazz.newInstance(); - } catch (Exception e) { - throw new ClientContainerException( - "Error while triyng to cast the class '" - + ddCallbackHandler - + "' to CallbackHandler interface, maybe the specified class doesn't implement this interface.", - e); - } - } - } - - // Use JAAS - if (ch != null) { - if (jaasFile == null) { - throw new ClientContainerException( - "You have defined that you want use a CallbackHandler but you haven't specify the jaas file to use for the JAAS configuration."); - } - - if (jaasEntry == null) { - throw new ClientContainerException( - "You have defined that you want use a CallbackHandler but you haven't specify the jaas entry to use from the jaas config file."); - } - - info("Using JAAS loginContext '" + jaasEntry + "' from the file '" + jaasConfigFile + "'."); - - try { - LoginContext lc = new LoginContext(jaasEntry, ch); - lc.login(); - } catch (Exception e) { - String err = "Can not use the JAAS authentication"; - error(err); - throw new ClientContainerException(err, e); - } - } - - // Start client - invokeClient(); - - } - - /** - * Start the client on its main class with the thread class loader - * @throws ClassNotFoundException if class is not found - * @throws NoSuchMethodException if method (main) is not found - * @throws IllegalAccessException if access is illegal - * @throws InvocationTargetException if invocation failed - */ - private void invokeClient() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, - InvocationTargetException { - ClassLoader clientClassloader = Thread.currentThread().getContextClassLoader(); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - if (clientClassloader instanceof URLClassLoader) { - URLClassLoader urlClassLoader = (URLClassLoader) clientClassloader; - URL[] urls = urlClassLoader.getURLs(); - logger.log(BasicLevel.DEBUG, "URLs of the classloader :"); - for (int u = 0; u < urls.length; u++) { - logger.log(BasicLevel.DEBUG, "URL[" + u + "] = " + urls[u]); - } - } - } - - // Invoke client - // Launch the "class_to_run" by using our classloader. - Class clazz = clientClassloader.loadClass(mainClass); - Class[] argList = new Class[] {args.getClass()}; - Method meth = clazz.getMethod("main", argList); - - // Remove name of the file from arguments - String[] newArgs = new String[appArgs.size() - 1]; - String txtArgs = ""; - - for (int i = 0; i < newArgs.length; i++) { - newArgs[i] = (String) appArgs.get(i + 1); - txtArgs += (newArgs[i] + " "); - } - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Starting the application client with the arguments '" + txtArgs + "'."); - } - - info("Starting client..."); - - meth.invoke(null, new Object[] {newArgs}); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "End of main method"); - } - - } - - /** - * Set the environment of this client - * @param clientDD deployment descriptor used for build the environment - * @throws NamingException if the creation of the environment fails - */ - private void setClientEnvironment(ClientContainerDeploymentDesc clientDD) throws NamingException { - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, ""); - } - - //Init the naming manager - JComponentContextFactory ccf = null; - try { - naming = SingletonNamingManager.getInstance(); - ccf = SingletonComponentContextFactory.getInstance(); - } catch (NamingException e) { - throw new ClientContainerException("Error when getting the reference to the Naming manager", e); - } - - Context javaCtx = ccf.createComponentContext("ClientContainer"); - naming.setClientContainerComponentContext(javaCtx); - - Context envCtx = javaCtx.createSubcontext("comp/env"); - - // Bean Environment - IEnvEntryDesc[] envt = clientDD.getEnvEntryDesc(); - - for (int i = 0; i < envt.length; i++) { - // get information in descriptor - String name = envt[i].getName(); - Object obj = envt[i].getValue(); - - // register object in JNDI - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Binding object " + name + " -> " + obj); - } - - envCtx.rebind(name, obj); - } - - // Resource References - IResourceRefDesc[] resref = clientDD.getResourceRefDesc(); - - for (int i = 0; i < resref.length; i++) { - // get information in descriptor - String name = resref[i].getName(); - String resname = resref[i].getJndiName(); - String type = resref[i].getTypeName(); - - // build the LinkRef that will be registered: - // FactoryClassName = null, size = 1, refAddr = resname. - // register object in JNDI - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Linking resource " + name + " -> " + resname); - } - - if (type.equalsIgnoreCase("java.net.URL")) { - // Specify the factory to use with the right URL - Reference ref = new Reference("java.net.URL", "org.objectweb.jonas_lib.naming.factory.URLFactory", null); - StringRefAddr refAddr = new StringRefAddr("url", resname); - ref.add(refAddr); - envCtx.rebind(name, ref); - } else { - LinkRef lref = new LinkRef(resname); - envCtx.rebind(name, lref); - } - } - - // Resource Environment References - IResourceEnvRefDesc[] resEnvref = clientDD.getResourceEnvRefDesc(); - - for (int i = 0; i < resEnvref.length; i++) { - // get information in descriptor - String name = resEnvref[i].getName(); - String resname = resEnvref[i].getJndiName(); - LinkRef lref = new LinkRef(resname); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Linking resource environment " + name + " -> " + resname); - } - - envCtx.rebind(name, lref); - } - - // EJB References - IEJBRefDesc[] ejbref = clientDD.getEjbRefDesc(); - - for (int i = 0; i < ejbref.length; i++) { - // get information in descriptor - String name = ejbref[i].getEjbRefName(); - String ejbname = null; - ejbname = ejbref[i].getJndiName(); - - LinkRef lref = new LinkRef(ejbname); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Linking ejb " + name + " -> " + ejbname); - } - - envCtx.rebind(name, lref); - } - - // ServiceRef - IServiceRefDesc[] serviceRefs = clientDD.getServiceRefDesc(); - if (serviceRefs.length != 0) { - - // get the current ClassLoader - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - - // get the JServiceFactory - JServiceFactory factory = ClientJServiceFactoryFinder.getJOnASServiceFactory(); - - for (int i = 0; i < serviceRefs.length; i++) { - // Create the Service from the ServiceRef description - String refname = serviceRefs[i].getServiceRefName(); - - Reference ref = factory.getServiceReference(serviceRefs[i], loader); - envCtx.rebind(refname, ref); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Adding service-ref 'java:comp/env/" + refname + "'"); - } - } - } - - // MessageDestination References - IMessageDestinationRefDesc[] mdref = clientDD.getMessageDestinationRefDesc(); - - for (int i = 0; i < mdref.length; i++) { - // get information in descriptor - String name = mdref[i].getMessageDestinationRefName(); - String mdname = null; - mdname = mdref[i].getJndiName(); - - LinkRef lref = new LinkRef(mdname); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Linking message-destination-ref " + name + " -> " + mdname); - } - - envCtx.rebind(name, lref); - } - } - - /** - * Analyze arguments and extract parameters for the client container - * @throws Exception if there is an error when analyzing arguments - */ - private void analyzeArgs() throws Exception { - for (int argn = 0; argn < args.length; argn++) { - String arg = args[argn]; - - try { - if (arg.equals("-tmpDir")) { - tmpDir = args[++argn]; - - continue; - } - - if (arg.equals("-jarClient")) { - jarClient = args[++argn]; - - continue; - } - - if (arg.equals("-traceFile")) { - clientTraceFile = args[++argn]; - - continue; - } - - if (arg.equals("-carolFile")) { - carolFile = args[++argn]; - - continue; - } - - if (arg.equals("-cp")) { - classpath = args[++argn]; - continue; - } - - if (arg.equals("-nowsgen")) { - applyWsGen = false; - continue; - } - - if (arg.equals("--help") || arg.equals("-help") || arg.equals("-h") || arg.equals("-?")) { - usage(); - System.exit(1); - } - - // Add argument to the application arguments - appArgs.add(arg); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // The next argument is not in the array - throw new ClientContainerException("A required parameter was missing after the argument" + arg); - } - } - } - - /** - * Print the usage of this client - */ - private void usage() { - System.out.println("Usage of this client :"); - System.out.println("-------------------------------------------------------------------"); - System.out.println("java -jar client.jar [options]"); - System.out.println("-------------------------------------------------------------------"); - System.out.println(" -jarClient : Specify the client jar to use of the ear if many."); - System.out.println(" -traceFile : Specify the configuration file to use for the traces\n" - + " of this client instead of the default file\n" - + " (traceclient.properties) present in client.jar."); - System.out.println(" -carolFile : Specify the carol.properties file to use instead of \n" - + " the default carol.properties file of the client.jar"); - System.out.println(" -tmpDir : Specify the temp directory where unpack the ear."); - System.out.println(" -cp : Specify the classpath to use for the jar client."); - System.out.println(" -nowsgen : Specify if the Container shouldn't use Automated WsGen."); - System.out.println("-------------------------------------------------------------------"); - System.out.println(" --help : Display this help."); - System.out.println(" -help : Display this help."); - System.out.println(" -h : Display this help."); - System.out.println(" -? : Display this help."); - System.out.println("-------------------------------------------------------------------"); - } - - /** - * Extract the client of an ear and analyze ear too - * @param earFile ear to be analyzed - * @return the file of the client which was extracted - * @throws Exception if the analyze and/or extract fails - */ - private File extractAndAnalyzeEar(File earFile) throws Exception { - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, ""); - } - - URL earUrl = null; - - try { - earUrl = earFile.toURL(); - } catch (MalformedURLException mue) { - throw new ClientContainerException("Can not build an url with the filename '" + earFile + "'.", mue); - } - - // Create classLoader - URL[] arrURL = new URL[1]; - arrURL[0] = earUrl; - - // parent classloader is the current classloader - ClassLoader currentLoader = Thread.currentThread().getContextClassLoader(); - URLClassLoader loaderCls = new URLClassLoader(arrURL, currentLoader); - - EarDeploymentDesc earDD = null; - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Getting the deployment descriptor of the file" + earFile.getPath()); - } - - try { - earDD = EarDeploymentDescManager.getDeploymentDesc(earFile.getPath(), loaderCls); - } catch (EarDeploymentDescException e) { - String err = "Error in the Deployment descriptor '" + earFile + "'"; - throw new ClientContainerException(err, e); - } - - Map userToRoleMapping = earDD.getUserToRoleMapping(); - // Do user-to-role mapping - if (userToRoleMapping != null) { - for (Iterator itMapping = userToRoleMapping.keySet().iterator(); itMapping.hasNext();) { - String principalName = (String) itMapping.next(); - List roles = (List) userToRoleMapping.get(principalName); - String[] roleNames = (String[]) roles.toArray(new String[roles.size()]); - JPolicyUserRoleMapping.addGlobalUserToRoleMapping(principalName, roleNames); - } - } - - - // Get the tags from the Deployment descriptor - String[] ejbTags = earDD.getEjbTags(); - Web[] webs = earDD.getWebTags(); - String[] webTags = new String[webs.length]; - String[] clientTags = earDD.getClientTags(); - String[] altDDEjbs = earDD.getAltDDEjbs(); - String[] altDDWebs = earDD.getAltDDWebs(); - String[] altDDClients = earDD.getAltDDClients(); - - // Check if all modules are inside the EAR file - // no relatives mode like ../../file1.jar - File fEar = null; - File tmpFile = null; - - try { - fEar = earFile.getCanonicalFile(); - } catch (IOException ioe) { - String err = "Error : Can not get canonical file for the file '" + earFile + "'."; - throw new ClientContainerException(err, ioe); - } - - try { - for (int i = 0; i < ejbTags.length; i++) { - tmpFile = new File(fEar, ejbTags[i]); - tmpFile = tmpFile.getCanonicalFile(); - if (!tmpFile.getPath().startsWith(fEar.getPath())) { - String err = "Error : The ejb-jar file " + ejbTags[i] + " is not inside the ear file " + fEar; - throw new ClientContainerException(err); - } - } - - for (int i = 0; i < webs.length; i++) { - tmpFile = new File(fEar, webs[i].getWebUri()); - tmpFile = tmpFile.getCanonicalFile(); - if (!tmpFile.getPath().startsWith(fEar.getPath())) { - String err = "Error : The webapp file " + webs[i] + " is not inside the ear file " + fEar; - throw new ClientContainerException(err); - } - webTags[i] = webs[i].getWebUri(); - } - - for (int i = 0; i < clientTags.length; i++) { - tmpFile = new File(fEar, clientTags[i]); - tmpFile = tmpFile.getCanonicalFile(); - - if (!tmpFile.getPath().startsWith(fEar.getPath())) { - String err = "Error : The client jar file " + clientTags[i] + " is not inside the ear file " + fEar; - throw new ClientContainerException(err); - } - } - } catch (IOException ioe) { - String err = "Error while trying to get the canonical file of " + tmpFile; - throw new ClientContainerException(err, ioe); - } - - //Changing array into JarList - JarList ejbsList = new JarList(ejbTags); - JarList websList = new JarList(webTags); - JarList clientsList = new JarList(clientTags); - - // Temporary directory - String tempDir = null; - - if (tmpDir != null) { - // use specific directory - tempDir = tmpDir; - info("Use your specified temp directory '" + tempDir + "'."); - } else { - // use default - tempDir = System.getProperty("java.io.tmpdir"); - } - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Using temp directory '" + tempDir + "'."); - } - - // Can we write to ? - File tmpFileDir = new File(tempDir); - - if (!tmpFileDir.exists() || !tmpFileDir.isDirectory()) { - throw new ClientContainerException("The temp directory '" + tempDir - + "' doesn't exist or is not a directory."); - } - - if (!tmpFileDir.canWrite()) { - throw new ClientContainerException("Can not write to the temporary directory '" + tempDir + "'."); - } - - // Unpack the ear file and get the unpacked dir - URL dirUnpackURL = null; - - try { - dirUnpackURL = EarFileManager.unpackEar(earUrl, tmpFileDir.toURL(), false); - } catch (Exception e) { - String err = "Error while unpacking the file '" + earUrl + "'"; - throw new ClientContainerException(err, e); - } - - // Ear is unpacked, now analyze manifest Class-path: - EarClassPathManager earCPManager = null; - - try { - earCPManager = new EarClassPathManager(clientsList, dirUnpackURL); - } catch (EarClassPathManagerException e) { - String err = "Error while creating the Ear class path manager of the ear : '" + earUrl + "'"; - error(err + " : " + e.getMessage()); - throw new ClientContainerException(err, e); - } - - URL[] classpathURLs = null; - - //Get the urls of the ear class path manager - try { - classpathURLs = earCPManager.getResolvedClassPath(); - } catch (EarClassPathManagerException e) { - String err = "Error while trying to resolve the classpath of the ejbjars and wars of the ear : '" + earUrl - + "'"; - error(err + " : " + e.getMessage()); - throw new ClientContainerException(err, e); - } - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "EAR : ejbs = " + ejbsList); - logger.log(BasicLevel.DEBUG, "EAR : clientUrls = " + clientsList); - } - - currentLoader = Thread.currentThread().getContextClassLoader(); - earClassLoader = new URLClassLoader(new URL[0], currentLoader); - - //Extract the urls of the jarList - URL[] jarUrls = null; - URL[] warUrls = null; - URL[] clientUrls = null; - - try { - jarUrls = ejbsList.getURLs(dirUnpackURL.toExternalForm()); - warUrls = websList.getURLs(dirUnpackURL.toExternalForm()); - clientUrls = clientsList.getURLs(dirUnpackURL.toExternalForm()); - } catch (JarListException e) { - String err = "Error while geting the Urls from jarlist of the ear : '" + earUrl + "'"; - throw new ClientContainerException(err, e); - } - - //Fill Alt-DD for Ejbs and Clients - String altdd = null; - File fAltDD = null; - - //Transorm the array altDDWebs into an array with the absolute URL to - // the file - URL[] clientsAltDDs = new URL[altDDClients.length]; - - for (int i = 0; i < altDDClients.length; i++) { - if (altDDClients[i] != null) { - altdd = altDDClients[i]; - - if (altdd != null) { - try { - fAltDD = new File(new URL(dirUnpackURL.toExternalForm() + File.separator + altdd).getFile()); - clientsAltDDs[i] = fAltDD.getCanonicalFile().toURL(); - } catch (MalformedURLException e) { - String err = "Can't build URL for alt-dd '" + altdd; - error(err + "': " + e.getMessage()); - throw new ClientContainerException(err, e); - } catch (IOException ioe) { - String err = "Can't get canonicalFile() for the file '" + fAltDD; - error(err + "': " + ioe.getMessage()); - throw new ClientContainerException(err, ioe); - } - } - } - } - - URL[] ejbsAltDDs = new URL[altDDEjbs.length]; - - for (int i = 0; i < altDDEjbs.length; i++) { - if (altDDEjbs[i] != null) { - altdd = altDDEjbs[i]; - - if (altdd != null) { - try { - fAltDD = new File(new URL(dirUnpackURL.toExternalForm() + File.separator + altdd).getFile()); - ejbsAltDDs[i] = fAltDD.getCanonicalFile().toURL(); - } catch (MalformedURLException e) { - String err = "Can't build URL for alt-dd '" + altdd; - error(err + "': " + e.getMessage()); - throw new ClientContainerException(err, e); - } catch (IOException ioe) { - String err = "Can't get canonicalFile() for the file '" + fAltDD; - error(err + "': " + ioe.getMessage()); - throw new ClientContainerException(err, ioe); - } - } - } - } - - URL[] websAltDDs = new URL[altDDWebs.length]; - - for (int i = 0; i < altDDWebs.length; i++) { - if (altDDWebs[i] != null) { - altdd = altDDWebs[i]; - - if (altdd != null) { - try { - fAltDD = new File(new URL(dirUnpackURL.toExternalForm() + File.separator + altdd).getFile()); - websAltDDs[i] = fAltDD.getCanonicalFile().toURL(); - } catch (MalformedURLException e) { - String err = "Can't build URL for alt-dd '" + altdd; - error(err + "': " + e.getMessage()); - throw new ClientContainerException(err, e); - } catch (IOException ioe) { - String err = "Can't get canonicalFile() for the file '" + fAltDD; - error(err + "': " + ioe.getMessage()); - throw new ClientContainerException(err, ioe); - } - } - } - } - - EjbDeploymentDescManager.getInstance().setAvailableEjbJarsAndAltDDs(earClassLoader, jarUrls, ejbsAltDDs); - WebDeploymentDescManager.getInstance().setAltDD(earClassLoader, warUrls, websAltDDs); - ClientDeploymentDescManager.getInstance().setAltDD(earClassLoader, clientUrls, clientsAltDDs); - - // Construct the ejb classloader for all the ejb-jars of the same - // ear application. Because there is one ejb classloader for all - // the ejb-jars of the same ear application. - URL[] userURLs = getUserClasspathUrls(); - extensionsURLs = new URL[jarUrls.length + classpathURLs.length + userURLs.length]; - - System.arraycopy(jarUrls, 0, extensionsURLs, 0, jarUrls.length); - System.arraycopy(classpathURLs, 0, extensionsURLs, jarUrls.length, classpathURLs.length); - System.arraycopy(userURLs, 0, extensionsURLs, jarUrls.length + classpathURLs.length, userURLs.length); - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Extensions urls :"); - - for (int ii = 0; ii < extensionsURLs.length; ii++) { - logger.log(BasicLevel.DEBUG, "url[" + ii + "] = " + extensionsURLs[ii]); - } - } - - // Choose the jar client - if (clientUrls.length == 0) { - throw new ClientContainerException("No java client was found in the application.xml file of the Ear '" - + earUrl + "'."); - } - - File fClient = null; - - // User has specify an application client to execute - // Search it - if (jarClient != null) { - int f = 0; - File ff = null; - boolean found = false; - - while (f < clientUrls.length && !found) { - ff = new File(clientUrls[f].getFile()); - - if (ff.getPath().endsWith(jarClient)) { - found = true; - fClient = ff; - - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Found a matching client with the name " + ff); - } - } - - f++; - } - - if (!found) { - throw new ClientContainerException("No client with the name '" + jarClient - + "' was found in this Ear file"); - } - } else { - // Take first - fClient = new File(clientUrls[0].getFile()); - - // Warning if many - if (clientUrls.length > 1) { - warn("There are " + clientUrls.length + " clients in this ear, choosing the first one : " - + fClient.getName()); - } - } - - info("Use the application client '" + fClient + "' of the Ear '" + earUrl + "'."); - - return fClient; - } - - /** - * Gets the URL of user classpath (can be empty - * @return URL of user classpath (-cp arg) - */ - private URL[] getUserClasspathUrls() { - if (classpath == null) { - return new URL[0]; - } - String sep = File.pathSeparator; - List clUser = new ArrayList(); - StringTokenizer tokenizer = new StringTokenizer(classpath, sep); - while (tokenizer.hasMoreTokens()) { - File file = new File(tokenizer.nextToken()); - try { - clUser.add(file.toURL()); - } catch (MalformedURLException mue) { - logger.log(BasicLevel.WARN, "Cannot transform to URL the file : '" + file + "'", mue); - } - } - return (URL[]) clUser.toArray(new URL[0]); - } - - /** - * Display an info message with the logger - * @param s the message - */ - private void info(String s) { - logger.log(BasicLevel.INFO, s); - } - - /** - * Display an error message with the logger - * @param s the message - */ - private void error(String s) { - logger.log(BasicLevel.ERROR, s); - } - - /** - * Display a warn message with the logger - * @param s the message - */ - private void warn(String s) { - logger.log(BasicLevel.WARN, s); - } -} diff --git a/jonas/modules/client/src/main/java/org/objectweb/jonas/client/ClientContainerException.java b/jonas/modules/client/src/main/java/org/objectweb/jonas/client/ClientContainerException.java deleted file mode 100644 index f66fe3fc516be91509fbc764ab053562d7fb6348..0000000000000000000000000000000000000000 --- a/jonas/modules/client/src/main/java/org/objectweb/jonas/client/ClientContainerException.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Florent BENOIT - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.client; - -import org.objectweb.jonas.service.ServiceException; - - -/** - * The class ClientContainerException that indicates conditions that a - * reasonable application might want to catch. - * - * @author Florent Benoit - */ -public class ClientContainerException extends ServiceException { - /** - * Constructs a new ClientContainerException with the specified message. - * - * @param message the detail message. - */ - public ClientContainerException(String message) { - this(message, null); - } - - /** - * Constructs a new ClientContainerException with the specified message. - * - * @param message the detail message. - * @param throwable the exception - */ - public ClientContainerException(String message, Throwable throwable) { - super(message, throwable); - } -} diff --git a/jonas/modules/client/src/main/java/org/objectweb/jonas/client/naming/ClientInitialContextFactory.java b/jonas/modules/client/src/main/java/org/objectweb/jonas/client/naming/ClientInitialContextFactory.java deleted file mode 100644 index 60ebbb4feff77f5790e70f4e7bf4f3aa41d38116..0000000000000000000000000000000000000000 --- a/jonas/modules/client/src/main/java/org/objectweb/jonas/client/naming/ClientInitialContextFactory.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Philippe Durieux, Guillaume Sauthier. - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.client.naming; - -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.naming.spi.InitialContextFactory; - -import org.objectweb.jonas.common.Log; -import org.objectweb.jonas.container.delegate.HandleDelegateCCFDelegate; -import org.objectweb.jonas.jtm.jotm.delegate.UserTransactionCCFDelegate; -import org.objectweb.jonas.naming.JComponentContextFactory; -import org.objectweb.jonas.naming.context.SingletonComponentContextFactory; -import org.objectweb.jonas.registry.carol.delegate.ORBCCFDelegate; - -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -public class ClientInitialContextFactory implements InitialContextFactory { - - /** - * Logger used for traces - */ - private static Logger logger = Log.getLogger(Log.JONAS_NAMING_PREFIX); - - /** - * This object is recreated each time. SO, we use a static here to - * avoid multiple initializations of SingletonComponentContextFactory - */ - private static JComponentContextFactory ccf = null; - - /** - * Creates an Initial Context for begining name resolution. - * This class is necessary for the Client to provide a correct Context - * with the delegate objects added (UserTransaction, ...). - * @param env The possibly null environment specifying information - * to be used in the creation of the initial context. - * @return A non-null initial context object that implements the Context - * interface. - * @exception NamingException If cannot create an initial context. - */ - public Context getInitialContext(Hashtable env) throws NamingException { - if (ccf == null) { - // Initialize here the ComponentContextFactory - logger.log(BasicLevel.DEBUG, "Init ComponentContextFactory"); - ccf = SingletonComponentContextFactory.getInstance(); - ccf.addDelegate(new UserTransactionCCFDelegate()); - ccf.addDelegate(new HandleDelegateCCFDelegate()); - ccf.addDelegate(new ORBCCFDelegate()); - } - // redirect to carol MultiOrb InitialContextFactory - env.put(Context.INITIAL_CONTEXT_FACTORY, "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory"); - return new InitialContext(env); - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/cp/pom.xml b/jonas/modules/ee-components/jca/jdbc/cp/pom.xml deleted file mode 100644 index c50c3748b58202f5e7037137628e528047180787..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/cp/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-jdbc - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-jdbc-cp - rar - JOnAS :: EE Components :: JCA :: JDBC :: CP - - - - org.objectweb.jonas - jonas-jca-jdbc-glue - ${jonas.version} - - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/cp/src/main/rar/META-INF/jonas-ra.xml b/jonas/modules/ee-components/jca/jdbc/cp/src/main/rar/META-INF/jonas-ra.xml deleted file mode 100644 index de58d7301662db6279c6516f687589f6b689e2f8..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/cp/src/main/rar/META-INF/jonas-ra.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - JOnASJDBC_CP - - false - - - 0 - 0 - 100 - 0 - 0 - 0 - 0 - 0 - 30 - - - 0 - - - - dsClass - - - - user - - - - password - - - - databaseName - - - - description - - - - portNumber - - - - serverName - - - - loginTimeout - - - - dbSpecificMethods - - - - isolationLevel - - - - mapperName - - - - logTopic - - - - diff --git a/jonas/modules/ee-components/jca/jdbc/cp/src/main/rar/META-INF/ra.xml b/jonas/modules/ee-components/jca/jdbc/cp/src/main/rar/META-INF/ra.xml deleted file mode 100644 index 542bdd07fa98cf1724a39413ea628780b52a936a..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/cp/src/main/rar/META-INF/ra.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - JOnAS Connection Pool RA - JOnAS Connection Pool RA - Objectweb - 1.0 - JDBC - 1.0 - - org.objectweb.jonas.jdbc.ConnectionPoolMCFImpl - javax.sql.DataSource - org.objectweb.jonas.jdbc.DataSourceImpl - java.sql.Connection - org.objectweb.jonas.ConnectionImpl - XATransaction - - dsClass - java.lang.String - - - - user - java.lang.String - - - - password - java.lang.String - - - - databaseName - java.lang.String - - - - description - java.lang.String - - - - portNumber - java.lang.String - - - - serverName - java.lang.String - - - - loginTimeout - java.lang.String - 0 - - - dbSpecificMethods - java.lang.String - - - - isolationLevel - java.lang.String - - - - mapperName - java.lang.String - - - - logTopic - java.lang.String - - - false - - diff --git a/jonas/modules/ee-components/jca/jdbc/dm/pom.xml b/jonas/modules/ee-components/jca/jdbc/dm/pom.xml deleted file mode 100644 index 4066f509baff1c588239145d6f58fafab3bdd6ab..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/dm/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-jdbc - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-jdbc-dm - rar - JOnAS :: EE Components :: JCA :: JDBC :: DM - - - - org.objectweb.jonas - jonas-jca-jdbc-glue - ${jonas.version} - - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/dm/src/main/rar/META-INF/jonas-ra.xml b/jonas/modules/ee-components/jca/jdbc/dm/src/main/rar/META-INF/jonas-ra.xml deleted file mode 100644 index 556ea42348119d4ffdc29dcf3f60313f8f576857..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/dm/src/main/rar/META-INF/jonas-ra.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - JOnASJDBC_DM - - false - - - 0 - 0 - 100 - 0 - 0 - 0 - 0 - 0 - 30 - - - 0 - - - - dsClass - - - - URL - - - - user - - - - password - - - - loginTimeout - - - - isolationLevel - - - - mapperName - - - - logTopic - - - - diff --git a/jonas/modules/ee-components/jca/jdbc/dm/src/main/rar/META-INF/ra.xml b/jonas/modules/ee-components/jca/jdbc/dm/src/main/rar/META-INF/ra.xml deleted file mode 100644 index 51d87cd86da234d27aa4f583f96ae0dc68650776..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/dm/src/main/rar/META-INF/ra.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - JOnAS DriverManager RA - JOnAS DriverManager RA - Objectweb - 1.0 - JDBC - 1.0 - - org.objectweb.jonas.jdbc.DriverManagerMCFImpl - javax.sql.DataSource - org.objectweb.jonas.jdbc.DataSourceImpl - java.sql.Connection - org.objectweb.jonas.ConnectionImpl - XATransaction - - dsClass - java.lang.String - - - - URL - java.lang.String - - - - user - java.lang.String - - - - password - java.lang.String - - - - loginTimeout - java.lang.String - 0 - - - isolationLevel - java.lang.String - - - - mapperName - java.lang.String - - - - logTopic - java.lang.String - - - false - - diff --git a/jonas/modules/ee-components/jca/jdbc/ds/pom.xml b/jonas/modules/ee-components/jca/jdbc/ds/pom.xml deleted file mode 100644 index dcae65fd7c11611bb45a2b01ae6cacf4d271c9c2..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/ds/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-jdbc - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-jdbc-ds - rar - JOnAS :: EE Components :: JCA :: JDBC :: DS - - - - org.objectweb.jonas - jonas-jca-jdbc-glue - ${jonas.version} - - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/ds/src/main/rar/META-INF/jonas-ra.xml b/jonas/modules/ee-components/jca/jdbc/ds/src/main/rar/META-INF/jonas-ra.xml deleted file mode 100644 index 74597f0a943b4bdc11a56766fbd980a8a7801ebd..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/ds/src/main/rar/META-INF/jonas-ra.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - JOnASJDBC_DS - - false - - - 0 - 0 - 100 - 0 - 0 - 0 - 0 - 0 - 30 - - - 0 - - - - dsClass - - - - user - - - - password - - - - databaseName - - - - description - - - - portNumber - - - - serverName - - - - loginTimeout - - - - dbSpecificMethods - - - - isolationLevel - - - - mapperName - - - - logTopic - - - - diff --git a/jonas/modules/ee-components/jca/jdbc/ds/src/main/rar/META-INF/ra.xml b/jonas/modules/ee-components/jca/jdbc/ds/src/main/rar/META-INF/ra.xml deleted file mode 100644 index 2df8fd4330277aca77c9a2978e2225a2ab2a5082..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/ds/src/main/rar/META-INF/ra.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - JOnAS Data Source RA - JOnAS Data Source RA - Objectweb - 1.0 - JDBC - 1.0 - - org.objectweb.jonas.jdbc.DataSourceMCFImpl - javax.sql.DataSource - org.objectweb.jonas.jdbc.DataSourceImpl - java.sql.Connection - org.objectweb.jonas.ConnectionImpl - XATransaction - - dsClass - java.lang.String - - - - user - java.lang.String - - - - password - java.lang.String - - - - databaseName - java.lang.String - - - - description - java.lang.String - - - - portNumber - java.lang.String - - - - serverName - java.lang.String - - - - loginTimeout - java.lang.String - 0 - - - dbSpecificMethods - java.lang.String - - - - isolationLevel - java.lang.String - - - - mapperName - java.lang.String - - - - logTopic - java.lang.String - - - false - - diff --git a/jonas/modules/ee-components/jca/jdbc/glue/pom.xml b/jonas/modules/ee-components/jca/jdbc/glue/pom.xml deleted file mode 100644 index 495b89c54733de4bd45e5b49934964605e1b2588..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-jdbc - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-jdbc-glue - jar - JOnAS :: EE Components :: JCA :: JDBC :: Glue - - - - - org.objectweb.jonas - jonas-resource - ${jonas.version} - provided - - - org.ow2.spec.ee - ow2-connector-1.5-spec - provided - - - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionImpl.java deleted file mode 100644 index aa0fa33a029e2cd3252592be462b4e330836deaa..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionImpl.java +++ /dev/null @@ -1,686 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.io.PrintWriter; -import java.util.Map; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Statement; - -import javax.resource.ResourceException; - -import org.objectweb.jonas.resource.IJDBCConnection; -import org.objectweb.jonas.resource.SQLManager; -import org.objectweb.jonas.resource.cm.ManagedConnectionInfo; - -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * The class ConnectionImpl provides the Connection implementation for - * encapsulating JDBC {@link Connection}s - * @author Eric hardesty -*/ -public class ConnectionImpl implements IJDBCConnection { - - protected boolean autocommit_set = false; - - protected boolean autocommit_unset = false; - - public Logger trace = null; - - ManagedConnectionImpl mc = null; - - Connection connection = null; - - PrintWriter pw = null; - - long key = 0; - - String user = ""; - - private SQLManager conman = null; - - private ManagedConnectionInfo mci = null; - - /** - * Traces are enabled ? - */ - private final boolean isDebugging; - - protected ConnectionImpl(ManagedConnectionImpl _mc, Connection _con, long _key, PrintWriter _pw) { - mc = _mc; - connection = _con; - key = _key; - pw = _pw; - trace = mc.trace; - isDebugging = trace.isLoggable(BasicLevel.DEBUG); - } - - /* (non-Javadoc) - * @see org.objectweb.jonas.jdbc.IJDBCConnection#isPhysicallyClosed() - */ - public boolean isPhysicallyClosed() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - return (connection.isClosed()); - } - - /* (non-Javadoc) - * @see org.objectweb.jonas.jdbc.IJDBCConnection#setJonasInfo(org.objectweb.jonas.resource.cm.ManagedConnectionInfo, org.objectweb.jonas.resource.SQLManager) - */ - public void setJonasInfo(ManagedConnectionInfo _mci, SQLManager _conman) { - mci = _mci; - conman = _conman; - } - - /* (non-Javadoc) - * @see org.objectweb.jonas.jdbc.IJDBCConnection#setUser() - */ - public void setUser() { - try { - user = mc.getMetaData().getUserName(); - } catch (Exception ex) { - } - } - - // IMPLEMENTATION OF METHODS FROM THE java.sql.Connection INTERFACE // - - public void clearWarnings() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - connection.clearWarnings(); - } - - public void close() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - closeConnectionImpl(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "error"); - e.printStackTrace(); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - public void commit() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - connection.commit(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - public Statement createStatement() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "checkContext error", e, "ConnectionImpl", "createStatement"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.createStatement(); - } - - public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.createStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.createStatement(resultSetType, resultSetConcurrency); - } - - public boolean getAutoCommit() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - return connection.getAutoCommit(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getAC error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - public String getCatalog() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getCatalog: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.getCatalog(); - } - - // JDK 1.4 SQL - public int getHoldability() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getHoldability: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.getHoldability(); - } - - public DatabaseMetaData getMetaData() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getMetaData: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.getMetaData(); - } - - public int getTransactionIsolation() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getTransactionIsolation: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.getTransactionIsolation(); - } - - public Map getTypeMap() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getTypeMap: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.getTypeMap(); - } - - public SQLWarning getWarnings() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.getWarnings: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.getWarnings(); - } - - public boolean isClosed() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - return (key == 0); - } - - public boolean isReadOnly() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.isReadOnly: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.isReadOnly(); - } - - public String nativeSQL(String sql) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.nativeSQL: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.nativeSQL(sql); - } - - public CallableStatement prepareCall(String sql) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareCall: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.prepareCall(sql); - } - - public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { - - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareCall: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.prepareCall(sql, resultSetType, resultSetConcurrency); - } - - public PreparedStatement prepareStatement(String sql) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - if (conman != null && conman.getMaxPstmtPoolSize() >= 0) { - return conman.getPStatement(mci, connection, user, sql); - } else { - return connection.prepareStatement(sql); - } - } - - public PreparedStatement prepareStatement(String sql, int rsettype, int rsetconcurrency) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - if (conman != null && conman.getMaxPstmtPoolSize() >= 0) { - return conman.getPStatement(mci, connection, user, sql, rsettype, rsetconcurrency); - } else { - return connection.prepareStatement(sql, rsettype, rsetconcurrency); - } - } - - public void rollback() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - connection.rollback(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, e.getMessage()); - e.printStackTrace(); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - // JDK 1.4 SQL - - public PreparedStatement prepareStatement(String sql, int rsettype, int rsetconcurrency, int holdability) - throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - if (conman != null && conman.getMaxPstmtPoolSize() >= 0) { - return conman.getPStatement(mci, connection, user, sql, rsettype, rsetconcurrency, holdability); - } else { - return connection.prepareStatement(sql, rsettype, rsetconcurrency, holdability); - } - } - - // JDK 1.4 SQL - - public PreparedStatement prepareStatement(String sql, int[] t) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - if (conman != null && conman.getMaxPstmtPoolSize() >= 0) { - return conman.getPStatement(mci, connection, user, sql, t); - } else { - return connection.prepareStatement(sql, t); - } - } - - // JDK 1.4 SQL - public PreparedStatement prepareStatement(String sql, String[] t) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - if (conman != null && conman.getMaxPstmtPoolSize() >= 0) { - return conman.getPStatement(mci, connection, user, sql, t); - } else { - return connection.prepareStatement(sql, t); - } - } - - // JDK 1.4 SQL - public PreparedStatement prepareStatement(String sql, int autoGenKeys) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - if (conman != null && conman.getMaxPstmtPoolSize() >= 0) { - return conman.getPStatement(mci, connection, user, sql, autoGenKeys); - } else { - return connection.prepareStatement(sql, autoGenKeys); - } - } - - // JDK 1.4 SQL - public CallableStatement prepareCall(String sql, int rsettype, int rsetconcurrency, int holdability) - throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.prepareCall(sql, rsettype, rsetconcurrency, holdability); - } - - // JDK 1.4 SQL - public Statement createStatement(int rsettype, int rsetconcurrency, int holdability) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.prepareStatement: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - return connection.createStatement(rsettype, rsetconcurrency, holdability); - } - - // JDK 1.4 SQL - public void releaseSavepoint(java.sql.Savepoint sp) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - connection.releaseSavepoint(sp); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, e.getMessage()); - e.printStackTrace(); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - // JDK 1.4 SQL - public void rollback(java.sql.Savepoint sp) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - connection.rollback(sp); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, e.getMessage()); - e.printStackTrace(); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - // JDK 1.4 SQL - public java.sql.Savepoint setSavepoint() throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - return connection.setSavepoint(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, e.getMessage()); - e.printStackTrace(); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - // JDK 1.4 SQL - public java.sql.Savepoint setSavepoint(String name) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - return connection.setSavepoint(name); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, e.getMessage()); - e.printStackTrace(); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - /* (non-Javadoc) - * @see org.objectweb.jonas.jdbc.IJDBCConnection#setAutoCommit(boolean) - */ - public void setAutoCommit(boolean isauto) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, "isauto=" + isauto); - } - try { - try { - checkContext(); - - if (isauto == false) { - if (autocommit_unset == false) { // cache for optimization - connection.setAutoCommit(false); - autocommit_set = false; - autocommit_unset = true; - } - } else { - if (autocommit_set == false) { // cache for optimization - connection.setAutoCommit(true); - autocommit_set = true; - autocommit_unset = false; - } - } - } catch (SQLException e) { - String s = e.getMessage().toLowerCase(); - if (s.indexOf("set chained command not allowed") != -1) { - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "failed..."); - trace.log(BasicLevel.DEBUG, "Committing then retrying"); - } - // These lines for Sybase only, hoping they don't broke - // anything for others DBs. - connection.commit(); - connection.setAutoCommit(isauto); // Shouldn't fail now. - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "succeeded after retry"); - } - } else { - // rethrow if not sybase - throw e; - } - } - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.setAC: error", e); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - } - - public void setCatalog(String catalog) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.setCatalog: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - connection.setCatalog(catalog); - } - - // JDK 1.4 SQL - public void setHoldability(int holdability) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.setCatalog: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - connection.setHoldability(holdability); - } - - public void setReadOnly(boolean readOnly) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.setReadOnly: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - connection.setReadOnly(readOnly); - } - - public void setTransactionIsolation(int level) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.setTransactionIsolation: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - connection.setTransactionIsolation(level); - } - - public void setTypeMap(Map map) throws SQLException { - if (isDebugging) { - trace.log(BasicLevel.DEBUG, ""); - } - try { - checkContext(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "ConnectionImpl.setTypeMap: checkContext error"); - throw new SQLException("JOnAS JDBC: " + e.getMessage()); - } - connection.setTypeMap(map); - } - - private void closeConnectionImpl() throws ResourceException { - if (key != 0) { - mc.close(this); - key = 0; - } - } - - private void checkContext() throws Exception { - if (key == 0) { - throw new Exception("Connection is closed"); - } - if (key != mc.getSignature()) { - if (mc.getSignature() == 0) { - mc.setSignature(key); - } else { - throw new Exception("Connection w/sig(" + key + ") is not currect active Connection (" - + mc.getSignature() + ")"); - } - } - } - - public void setSignature(long sig) { - key = sig; - } -} diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionManagerImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionManagerImpl.java deleted file mode 100644 index b132a2394fdc986aea666ddf5c31c190c0f7b78b..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionManagerImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import javax.resource.spi.ManagedConnection; - -import java.io.Serializable; -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionManager; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnectionFactory; - -/** - * Description of the ConnectionManagerImpl. Default ConnectionManager - * for the JDBC RA. - * - *@author Eric Hardesty - *@created 22 May 2003 - */ -public class ConnectionManagerImpl - implements ConnectionManager, Serializable -{ - - public ConnectionManagerImpl() - { - } - - /** - * No pooling is done for non-managed connections, just get a new MC and - * connection to the database. - * - */ - public Object allocateConnection(ManagedConnectionFactory mcf, ConnectionRequestInfo info) - throws ResourceException - { - ManagedConnection mc = mcf.createManagedConnection(null, info); - return mc.getConnection(null, info); - } -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionPoolMCFImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionPoolMCFImpl.java deleted file mode 100644 index 38eb01a084fe24df82dda4e999108c28cbbf7383..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionPoolMCFImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - - -import java.sql.SQLException; - -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ResourceAllocationException; -import javax.resource.spi.security.PasswordCredential; -import javax.security.auth.Subject; -import javax.sql.ConnectionPoolDataSource; - -/** - * JDBC RA connection pool MCF implmentation - * @author Eric Hardesty - * Contributor(s): - * - */ -public class ConnectionPoolMCFImpl - extends ManagedConnectionFactoryImpl { - - - ConnectionPoolDataSource ds = null; - - public ManagedConnection createManagedConnection(Subject subject, - ConnectionRequestInfo cxReq) - throws ResourceException { - - PasswordCredential pc = Utility.getPasswordCredential(this, subject, cxReq, pw); - if(ds == null) { - try { - ds = (ConnectionPoolDataSource) Utility.getDataSource(this, pc, trace); - } catch(Exception ex) { - throw new ResourceException(ex.getMessage(), ex); - } - } - - javax.sql.PooledConnection pConnection = null; - java.sql.Connection connection = null; - try { - if(cxReq != null) { - ConnectionRequestInfoImpl cx = (ConnectionRequestInfoImpl) cxReq; - pConnection = ds.getPooledConnection(cx.getUser(), cx.getPassword()); - } else if (pc != null){ - pConnection = ds.getPooledConnection(pc.getUserName(), new String(pc.getPassword())); - } else if (mcfData.getMCFData(MCFData.USER).length() > 0){ - pConnection = ds.getPooledConnection(mcfData.getMCFData(MCFData.USER), - mcfData.getMCFData(MCFData.PASSWORD)); - } else { - pConnection = ds.getPooledConnection(); - } - if (pConnection != null) { - connection = pConnection.getConnection(); - } - } - catch(SQLException sqle) - { - throw new ResourceAllocationException("The connection could not be allocated: " + sqle.getMessage(), sqle); - } - return new ManagedConnectionImpl(this, pc, connection, pConnection, null, null); - } - - /* Determine if the factories are equal - */ - public boolean equals(Object obj) { - if (obj instanceof ConnectionPoolMCFImpl) { - return mcfData.equals(((ConnectionPoolMCFImpl)obj).mcfData); - } - else { - return false; - } - } - - // JOnAS JDBC RA ConnectionPool config properties - public String getDatabaseName() - { - return mcfData.getMCFData(MCFData.DATABASENAME); - } - - public void setDatabaseName(String val) - { - mcfData.setMCFData(MCFData.DATABASENAME, val); - } - - public String getDescription() - { - return mcfData.getMCFData(MCFData.DESCRIPTION); - } - - public void setDescription(String val) - { - mcfData.setMCFData(MCFData.DESCRIPTION, val); - } - - public String getPortNumber() - { - return mcfData.getMCFData(MCFData.PORTNUMBER); - } - - public void setPortNumber(String val) - { - mcfData.setMCFData(MCFData.PORTNUMBER, val); - } - - public String getServerName() - { - return mcfData.getMCFData(MCFData.SERVERNAME); - } - - public void setServerName(String val) - { - mcfData.setMCFData(MCFData.SERVERNAME, val); - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionRequestInfoImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionRequestInfoImpl.java deleted file mode 100644 index 006d2ab75285340736c730aabea88cf118d803bc..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ConnectionRequestInfoImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.io.Serializable; -import javax.resource.spi.ConnectionRequestInfo; - -/** - * Basic implementation of JCA {@link ConnectionRequestInfo}. - * @author Eric Hardesty - */ -public class ConnectionRequestInfoImpl - implements ConnectionRequestInfo, Serializable { - - /* User/password for this connection */ - String user; - String password; - - public ConnectionRequestInfoImpl() { - user = ""; - password = ""; - } - - public ConnectionRequestInfoImpl(String _user, String _password) { - user = _user; - password = _password; - } - - public boolean equals(Object obj) { - if(obj == null) { - return false; - } - if(obj instanceof ConnectionRequestInfoImpl) { - ConnectionRequestInfoImpl cri = - (ConnectionRequestInfoImpl) obj; - // TODO Object.equals(Object) should be used here - return (user == cri.user) && (password == cri.password); - } else { - return false; - } - } - - public String getPassword() { - return password; - } - - public String getUser() { - return user; - } - - public int hashCode() { - String val = "" + user + password; - return val.hashCode(); - } - - public void setPassword(String pass) { - password = pass; - } - - public void setUser(String _user) { - user = _user; - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DataSourceImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DataSourceImpl.java deleted file mode 100644 index 9ec592d692a8d1c5ff5b85ad40f9e0b89963a01d..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DataSourceImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.io.PrintWriter; -import java.io.Serializable; - -import java.sql.Connection; -import java.sql.SQLException; - -import javax.naming.Reference; - -import javax.resource.Referenceable; -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionManager; - -import org.objectweb.util.monolog.api.BasicLevel; - -/** - * Description of the DataSourceImpl. This is the dataSource for the JDBC RA. - * @author Eric Hardesty - * @created 22 May 2003 - */ -public class DataSourceImpl implements javax.sql.DataSource, Serializable, Referenceable { - - private ConnectionManager cm; - - private ManagedConnectionFactoryImpl mcf; - - private PrintWriter pw; - - private Reference reference; - - int loginTimeout = 0; - - /** - * Logging (debug enabled) - */ - private final boolean isDebugOn; - - public DataSourceImpl(ManagedConnectionFactoryImpl _mcf, ConnectionManager _cm) { - if (_cm == null) { - cm = new ConnectionManagerImpl(); - } else { - cm = _cm; - } - mcf = _mcf; - isDebugOn = mcf.trace.isLoggable(BasicLevel.DEBUG); - } - - public Connection getConnection() throws SQLException { - if (isDebugOn) { - mcf.trace.log(BasicLevel.DEBUG, ""); - } - try { - Connection con = (Connection) cm.allocateConnection(mcf, null); - if (con == null) { - SQLException se = new SQLException("Null connection object returned"); - throw se; - } - return con; - } catch (ResourceException re) { - throw new SQLException(re.getMessage()); - } - } - - public Connection getConnection(String user, String pwd) throws SQLException { - if (isDebugOn) { - mcf.trace.log(BasicLevel.DEBUG, "" + user); - } - try { - ConnectionRequestInfoImpl info = new ConnectionRequestInfoImpl(user, pwd); - Connection con = (Connection) cm.allocateConnection(mcf, info); - if (con == null) { - SQLException se = new SQLException("Null connection object returned"); - throw se; - } - return con; - } catch (ResourceException re) { - throw new SQLException(re.getMessage()); - } - } - - public int getLoginTimeout() throws SQLException { - return loginTimeout; - } - - public PrintWriter getLogWriter() throws SQLException { - return pw; - } - - public Reference getReference() { - return reference; - } - - public void setLoginTimeout(int _loginTimeout) throws SQLException { - loginTimeout = _loginTimeout; - } - - public void setLogWriter(PrintWriter _pw) throws SQLException { - pw = _pw; - } - - public void setReference(Reference _ref) { - reference = _ref; - } - - /* JOnAS JDBC implementation for CMP */ - - public String getMapperName() { - String mn = mcf.getMapperName(); - if (isDebugOn) { - mcf.trace.log(BasicLevel.DEBUG, mn); - } - return mn; - } - -} diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DataSourceMCFImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DataSourceMCFImpl.java deleted file mode 100644 index b9446d3932a5924a43cc435c4047ed85812df9a4..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DataSourceMCFImpl.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - - -import java.sql.SQLException; - -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ResourceAllocationException; -import javax.resource.spi.security.PasswordCredential; -import javax.security.auth.Subject; -import javax.sql.DataSource; - -import org.objectweb.util.monolog.api.BasicLevel; - -public class DataSourceMCFImpl - extends ManagedConnectionFactoryImpl { - - DataSource ds = null; - - public ManagedConnection createManagedConnection(Subject subject, - ConnectionRequestInfo cxReq) - throws ResourceException { - - PasswordCredential pc = Utility.getPasswordCredential(this, subject, cxReq, pw); - if(ds == null) { - try { - ds = (DataSource) Utility.getDataSource(this, pc, trace); - } catch(Exception ex) { - throw new ResourceException(ex.getMessage(), ex); - } - } - java.sql.Connection connection = null; - try { - if(cxReq != null) { - ConnectionRequestInfoImpl cx = (ConnectionRequestInfoImpl) cxReq; - connection = ds.getConnection(cx.getUser(), cx.getPassword()); - } else if (pc != null){ - connection = ds.getConnection(pc.getUserName(), new String(pc.getPassword())); - } else if (mcfData.getMCFData(MCFData.USER).length() > 0){ - connection = ds.getConnection(mcfData.getMCFData(MCFData.USER), - mcfData.getMCFData(MCFData.PASSWORD)); - } else { - connection = ds.getConnection(); - } - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "Connection object returned is "+connection); - } - } - catch(SQLException sqle) - { - throw new ResourceAllocationException("The connection could not be allocated: " + sqle.getMessage(), sqle); - } - return new ManagedConnectionImpl(this, pc, connection, null, null, null); - } - - /* Determine if the factories are equal - */ - public boolean equals(Object obj) { - if (obj instanceof DataSourceMCFImpl) { - return mcfData.equals(((DataSourceMCFImpl)obj).mcfData); - } - else { - return false; - } - } - - // JOnAS JDBC RA DataSource config properties - public String getDatabaseName() - { - return mcfData.getMCFData(MCFData.DATABASENAME); - } - - public void setDatabaseName(String val) - { - mcfData.setMCFData(MCFData.DATABASENAME, val); - } - - public String getDescription() - { - return mcfData.getMCFData(MCFData.DESCRIPTION); - } - - public void setDescription(String val) - { - mcfData.setMCFData(MCFData.DESCRIPTION, val); - } - - public String getPortNumber() - { - return mcfData.getMCFData(MCFData.PORTNUMBER); - } - - public void setPortNumber(String val) - { - mcfData.setMCFData(MCFData.PORTNUMBER, val); - } - - public String getServerName() - { - return mcfData.getMCFData(MCFData.SERVERNAME); - } - - public void setServerName(String val) - { - mcfData.setMCFData(MCFData.SERVERNAME, val); - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DriverManagerMCFImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DriverManagerMCFImpl.java deleted file mode 100644 index daff30878eb688bce11148c4763ec8363c0c7fad..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DriverManagerMCFImpl.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - - -import java.sql.DriverManager; -import java.sql.SQLException; - -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ResourceAllocationException; -import javax.resource.spi.security.PasswordCredential; -import javax.security.auth.Subject; - -import org.objectweb.util.monolog.api.BasicLevel; - -public class DriverManagerMCFImpl - extends ManagedConnectionFactoryImpl { - - public ManagedConnection createManagedConnection(Subject subject, - ConnectionRequestInfo cxReq) - throws ResourceException { - - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG,"subject:"+subject+" connectionRequest:"+cxReq); - } - PasswordCredential pc = Utility.getPasswordCredential(this, subject, cxReq, pw); - String clsName = null; - DriverWrapper dWrap = null; - try - { - clsName = mcfData.getMCFData(MCFData.DSCLASS); - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - java.sql.Driver d = (java.sql.Driver) Class.forName(clsName, true, loader).newInstance(); - dWrap = new DriverWrapper(d); - DriverManager.registerDriver(dWrap); - } - catch(ClassNotFoundException cnfe) - { - throw new ResourceException("Class Name not found:" + clsName, cnfe); - } - catch(Exception ex) - { - throw new ResourceException("Error loading driver manager: " + clsName+" "+ex.getMessage(), ex); - } - - java.sql.Connection connection = null; - try { - String val = null; - if ((val = mcfData.getMCFData(MCFData.LOGINTIMEOUT)) != null) { - if (val.length() > 0) { - DriverManager.setLoginTimeout(Integer.parseInt(val)); - } - } - if(cxReq != null) { - ConnectionRequestInfoImpl cx = (ConnectionRequestInfoImpl) cxReq; - connection = DriverManager.getConnection(mcfData.getMCFData(MCFData.URL), - cx.getUser(), cx.getPassword()); - } else if (pc != null){ - connection = DriverManager.getConnection(mcfData.getMCFData(MCFData.URL), - pc.getUserName(), new String(pc.getPassword())); - } else { - connection = DriverManager.getConnection(mcfData.getMCFData(MCFData.URL), - mcfData.getMCFData(MCFData.USER), - mcfData.getMCFData(MCFData.PASSWORD)); - } - } - catch(SQLException sqle) - { - sqle.printStackTrace(); - throw new ResourceAllocationException("The connection could not be allocated: " + sqle.getMessage(), sqle); - } - catch(Exception ex) - { - ex.printStackTrace(); - throw new ResourceAllocationException("Error on allocation: " + ex.getMessage(), ex); - } - ManagedConnectionImpl mci = new ManagedConnectionImpl(this, pc, connection, null, null, dWrap); - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "Create Mc="+mci+" with connection="+connection); - } - return mci; - } - - /* Determine if the factories are equal - */ - public boolean equals(Object obj) { - if (obj instanceof DriverManagerMCFImpl) { - return mcfData.equals(((DriverManagerMCFImpl)obj).mcfData); - } - else { - return false; - } - } - - // JOnAS JDBC RA DriverManager config properties - public String getURL() - { - return mcfData.getMCFData(MCFData.URL); - } - - public void setURL(String val) - { - mcfData.setMCFData(MCFData.URL, val); - } -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DriverWrapper.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DriverWrapper.java deleted file mode 100644 index d0eb61ee35c796544af17e500656b8e423be398a..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/DriverWrapper.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.util.Properties; - -class DriverWrapper implements Driver { - private Driver driver; - - DriverWrapper(Driver d) { - this.driver = d; - } - - public boolean acceptsURL(String u) throws SQLException { - return this.driver.acceptsURL(u); - } - - public Connection connect(String u, Properties p) throws SQLException { - return this.driver.connect(u, p); - } - - public int getMajorVersion() { - return this.driver.getMajorVersion(); - } - - public int getMinorVersion() { - return this.driver.getMinorVersion(); - } - - public DriverPropertyInfo[] getPropertyInfo(String u, Properties p) throws SQLException { - return this.driver.getPropertyInfo(u, p); - } - - public boolean jdbcCompliant() { - return this.driver.jdbcCompliant(); - } -} - diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/MCFData.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/MCFData.java deleted file mode 100644 index 6584351cb05531b067280cc86300434ec2c77973..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/MCFData.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.util.Enumeration; -import java.util.Properties; - -public class MCFData { - - /* Properties object to hold all MCF config information */ - Properties mcfData = null; - - public static String dsMethodNames[] = { - "setDSClass", - "setDbSpecificMethods", - "setDatabaseName", - "setDataSourceName", - "setDescription", - "setPortNumber", - "setServerName", - "setURL", - "setUser", - "setPassword", - "setLoginTimeout", - "setIsolationLevel", - "setInitialPoolSize", - "setMinPoolSize", - "setMaxIdleTime", - "setMaxPoolSize", - "setMaxStatements", - "setPropertyCycle", - "setMapperName", - "setLogTopic", - "setConnCheckLevel", - "setConnMaxAge", - "setConnTestStmt", - }; - // Config properties for JDBC drivers - public static final int DSCLASS = 0; - public static final int DBSPECIFICMETHODS = 1; - public static final int DATABASENAME = 2; - public static final int DATASOURCENAME = 3; - public static final int DESCRIPTION = 4; - public static final int PORTNUMBER = 5; - public static final int SERVERNAME = 6; - public static final int URL = 7; - public static final int USER = 8; - public static final int PASSWORD = 9; - public static final int LOGINTIMEOUT = 10; - public static final int ISOLATIONLEVEL = 11; - - // Config values for JDBC 3.0 - public static final int INITIALPOOLSIZE = 12; - public static final int MINPOOLSIZE = 13; - public static final int MAXIDLETIME = 14; - public static final int MAXPOOLSIZE = 15; - public static final int MAXSTATEMENTS = 16; - public static final int PROPERTYCYCLE = 17; - - //This must be set to the last nonJOnAS config item - public static final int JONASOFFSET = 17; - - // JOnAS specific items - // Config values for CMP 2.0 use with JORM - public static final int MAPPERNAME = 18; - - // Config values for JOnAS logger - public static final int LOGTOPIC = 19; - - // Config values for JOnAS connection testing - public static final int CONNCHECKLEVEL = 20; - public static final int CONNMAXAGE = 21; - public static final int CONNTESTSTMT = 22; - - - public MCFData() { - mcfData = new Properties(); - } - - - public boolean equals(Object obj) { - if (obj instanceof MCFData) { - return mcfData.equals(((MCFData)obj).mcfData); - } else { - return false; - } - } - - /* Return the specified property */ - public String getMCFData(int prop) { - return mcfData.getProperty(""+prop); - } - - public int hashCode() { - return mcfData.hashCode(); - } - - /* Set the specified property/value combination */ - public void setMCFData(int prop, String val) { - mcfData.setProperty(""+prop, val); - } - - public String getProperty(String key) { - return mcfData.getProperty(key); - } - - public Enumeration getProperties() { - return mcfData.propertyNames(); - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ManagedConnectionFactoryImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ManagedConnectionFactoryImpl.java deleted file mode 100644 index fe6f822a02fd91fcbf96f07437d7c5d6f4562ccc..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ManagedConnectionFactoryImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.io.PrintWriter; -import java.io.Serializable; -import java.sql.Connection; -import java.util.Iterator; -import java.util.Set; - -import javax.naming.InitialContext; -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionManager; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ManagedConnectionFactory; -import javax.security.auth.Subject; - -import org.objectweb.jonas.common.Log; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; -import org.objectweb.util.monolog.api.LoggerFactory; -import org.objectweb.util.monolog.wrapper.printwriter.LoggerImpl; - -/** - * @author Eric hardesty - */ -public abstract class ManagedConnectionFactoryImpl implements ManagedConnectionFactory, Serializable { - - // Factory config data property - MCFData mcfData = null; - - int hashcode = 0; - - PrintWriter pw; - - String logTopic = ""; - - protected static final String LOGGER_FACTORY = "org.objectweb.util.monolog.loggerFactory"; - - public Logger trace = null; - - /** - * Debug level ? - */ - private boolean isEnabledDebug = false; - - - public ManagedConnectionFactoryImpl() { - pw = null; - mcfData = new MCFData(); - } - - /* Abstract methods, specific implementation is different - * for each type of MCF - */ - public abstract ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxReq) - throws ResourceException; - - public abstract boolean equals(Object obj); - - /* Common methods for each MCF type - */ - public Object createConnectionFactory() throws ResourceException { - return new DataSourceImpl(this, null); - } - - public Object createConnectionFactory(ConnectionManager cxMgr) throws ResourceException { - return new DataSourceImpl(this, cxMgr); - } - - public void getLogger(String _logTopic) throws Exception { - InitialContext ic = new InitialContext(); - - if (trace == null || !(logTopic.equals(_logTopic))) { - logTopic = _logTopic; // set the log topic value - // Get the trace module: - try { - LoggerFactory mf = Log.getLoggerFactory(); - if (logTopic != null && logTopic.length() > 0) { - trace = mf.getLogger(logTopic); - } else if (pw != null) { - trace = new LoggerImpl(pw); - } else { - trace = mf.getLogger("org.objectweb.jonas.jdbc.RA"); - } - } catch (Exception ex) { - try { - if (pw != null) { - trace = new LoggerImpl(pw); - } - } catch (Exception e3) { - throw new Exception("Cannot get logger"); - } - } - } - isEnabledDebug = trace.isLoggable(BasicLevel.DEBUG); - if (isEnabledDebug) { - trace.log(BasicLevel.DEBUG, "getLogger(" + _logTopic + ")"); - } - } - - public PrintWriter getLogWriter() throws ResourceException { - return pw; - } - - public int hashCode() { - if (hashcode == 0) { - hashcode = mcfData.hashCode(); - try { - getLogger(mcfData.getMCFData(MCFData.LOGTOPIC)); - } catch (Exception ex) { - } - } - - return hashcode; - } - - public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxReq) - throws ResourceException { - if (isEnabledDebug) { - trace.log(BasicLevel.DEBUG, "matchManagedConnection(" + connectionSet + "," + subject + "," + cxReq + ")"); - } - if (connectionSet == null) { - return null; - } - javax.resource.spi.security.PasswordCredential pc = Utility.getPasswordCredential(this, subject, cxReq, pw); - Iterator it = connectionSet.iterator(); - Object obj = null; - ManagedConnectionImpl mc = null; - while (it.hasNext()) { - try { - obj = it.next(); - if (obj instanceof ManagedConnectionImpl) { - ManagedConnectionImpl mc1 = (ManagedConnectionImpl) obj; - if (pc == null && equals(mc1.mcf)) { - mc = mc1; - break; - } - if (pc != null && pc.equals(mc.pc)) { - mc = mc1; - break; - } - } - } catch (Exception ex) { - throw new ResourceException(ex.getMessage()); - } - } - if (isEnabledDebug) { - trace.log(BasicLevel.DEBUG, "matchManagedConnection returns(" + mc + ")"); - } - return mc; - } - - public void setLogWriter(PrintWriter _pw) throws ResourceException { - pw = _pw; - } - - /* Common getter/setters */ - public String getDbSpecificMethods() { - return mcfData.getMCFData(MCFData.DBSPECIFICMETHODS); - } - - public void setDbSpecificMethods(String val) { - mcfData.setMCFData(MCFData.DBSPECIFICMETHODS, val); - } - - public String getDsClass() { - return mcfData.getMCFData(MCFData.DSCLASS); - } - - public void setDsClass(String val) { - mcfData.setMCFData(MCFData.DSCLASS, val); - } - - public String getIsolationLevel() { - String str = mcfData.getMCFData(MCFData.ISOLATIONLEVEL); - String retStr = "default"; - - if (str.length() == 0 || str.equals("-1")) { - return retStr; - } - - int isolationLevel; - try { - isolationLevel = Integer.parseInt(str); - } catch (Exception ex) { - return retStr; - } - - if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) { - retStr = "serializable"; - } else if (isolationLevel == Connection.TRANSACTION_NONE) { - retStr = "none"; - } else if (isolationLevel == Connection.TRANSACTION_READ_COMMITTED) { - retStr = "read_committed"; - } else if (isolationLevel == Connection.TRANSACTION_READ_UNCOMMITTED) { - retStr = "read_uncommitted"; - } else if (isolationLevel == Connection.TRANSACTION_REPEATABLE_READ) { - retStr = "repeatable_read"; - } - return retStr; - } - - public void setIsolationLevel(String val) { - int isolationLevel = -1; - - if (val.equals("serializable")) { - isolationLevel = Connection.TRANSACTION_SERIALIZABLE; - } else if (val.equals("none")) { - isolationLevel = Connection.TRANSACTION_NONE; - } else if (val.equals("read_committed")) { - isolationLevel = Connection.TRANSACTION_READ_COMMITTED; - } else if (val.equals("read_uncommitted")) { - isolationLevel = Connection.TRANSACTION_READ_UNCOMMITTED; - } else if (val.equals("repeatable_read")) { - isolationLevel = Connection.TRANSACTION_REPEATABLE_READ; - } - - mcfData.setMCFData(MCFData.ISOLATIONLEVEL, "" + isolationLevel); - } - - public String getLoginTimeout() { - return mcfData.getMCFData(MCFData.LOGINTIMEOUT); - } - - public void setLoginTimeout(String val) { - mcfData.setMCFData(MCFData.LOGINTIMEOUT, val); - } - - public String getLogTopic() { - return mcfData.getMCFData(MCFData.LOGTOPIC); - } - - public void setLogTopic(String val) { - mcfData.setMCFData(MCFData.LOGTOPIC, val); - try { - getLogger(val.trim()); - } catch (Exception ex) { - } - } - - public String getMapperName() { - return mcfData.getMCFData(MCFData.MAPPERNAME); - } - - public void setMapperName(String val) { - mcfData.setMCFData(MCFData.MAPPERNAME, val); - } - - public String getPassword() { - return mcfData.getMCFData(MCFData.PASSWORD); - } - - public void setPassword(String val) { - mcfData.setMCFData(MCFData.PASSWORD, val); - } - - public String getUser() { - return mcfData.getMCFData(MCFData.USER); - } - - public void setUser(String val) { - mcfData.setMCFData(MCFData.USER, val); - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ManagedConnectionImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ManagedConnectionImpl.java deleted file mode 100644 index fc1189a4f15f616b79f8ca7d067276c0ce0b5c7b..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/ManagedConnectionImpl.java +++ /dev/null @@ -1,428 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.io.PrintWriter; -import java.sql.DriverManager; -import java.util.HashSet; -import java.util.Iterator; - -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionEvent; -import javax.resource.spi.ConnectionEventListener; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.LocalTransaction; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ManagedConnectionMetaData; -import javax.resource.spi.security.PasswordCredential; -import javax.security.auth.Subject; -import javax.sql.DataSource; -import javax.sql.PooledConnection; -import javax.sql.XAConnection; -import javax.transaction.xa.XAResource; - -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * @author Eric hardesty - */ -public class ManagedConnectionImpl implements ManagedConnection, javax.resource.spi.LocalTransaction { - - public Logger trace = null; - - protected PrintWriter out = null; - - protected DataSource factory = null; - - protected HashSet cels = null; - - protected boolean inLocalTransaction = false; - - ManagedConnectionFactoryImpl mcf = null; - - java.sql.Connection connection = null; - - PooledConnection poolCon = null; - - XAConnection xaCon = null; - - PasswordCredential pc = null; - - DriverWrapper wrapper = null; - - private XAResource xares; - - private boolean isAutoCommit = true; - - private boolean closed = false; - - private long[] sigList; - - private int maxSigs; - - private long signature; - - private long lastSig; - - /** - * Logging (debug enabled) - */ - private final boolean isDebugOn; - - public ManagedConnectionImpl(ManagedConnectionFactoryImpl _mcf, PasswordCredential _pc, java.sql.Connection _con, - PooledConnection _pcon, XAConnection _xa, DriverWrapper wrp) { - - mcf = _mcf; - pc = _pc; - connection = _con; - poolCon = _pcon; - xaCon = _xa; - wrapper = wrp; - xares = null; - out = mcf.pw; - cels = new HashSet(); - maxSigs = 50; - sigList = new long[maxSigs]; - signature = 0; - lastSig = 0; - trace = mcf.trace; - isDebugOn = trace.isLoggable(BasicLevel.DEBUG); - } - - public void signalEvent(int code, Object ch, Exception ex) { - ConnectionEvent ce = null; - if (ex == null) { - ce = new ConnectionEvent(this, code); - } else { - ce = new ConnectionEvent(this, code, ex); - } - if (ch != null) { - ce.setConnectionHandle(ch); - } - for (Iterator it = cels.iterator(); it.hasNext();) { - switch (code) { - case ConnectionEvent.CONNECTION_CLOSED: - ((ConnectionEventListener) it.next()).connectionClosed(ce); - break; - case ConnectionEvent.LOCAL_TRANSACTION_STARTED: - ((ConnectionEventListener) it.next()).localTransactionStarted(ce); - break; - case ConnectionEvent.LOCAL_TRANSACTION_COMMITTED: - ((ConnectionEventListener) it.next()).localTransactionCommitted(ce); - break; - case ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK: - ((ConnectionEventListener) it.next()).localTransactionRolledback(ce); - break; - case ConnectionEvent.CONNECTION_ERROR_OCCURRED: - ((ConnectionEventListener) it.next()).connectionErrorOccurred(ce); - break; - default: - throw new IllegalArgumentException("Illegal eventType: " + code); - } - } - } - - public synchronized boolean getAutoCommit() throws ResourceException { - return isAutoCommit; - } - - public synchronized void setAutoCommit(boolean ac) throws ResourceException { - isAutoCommit = ac; - try { - if (connection != null) { - connection.setAutoCommit(ac); - } - } catch (Exception e) { - throw new ResourceException(e.getMessage()); - } - } - - /** - * Adds a connection event listener. - */ - public void addConnectionEventListener(ConnectionEventListener listener) { - cels.add(listener); - } - - /** - * Change the association of a connection handle - */ - public synchronized void associateConnection(Object con) throws ResourceException { - if (isDebugOn) { - trace.log(BasicLevel.DEBUG, "connection:" + con); - } - if (con instanceof ConnectionImpl) { - ConnectionImpl ci = (ConnectionImpl) con; - long sig = getNewSignature(true); - ci.setSignature(sig); - } else { - throw new ResourceException("The managedConnection cannot associate this connection: " + con); - } - } - - /** - * Cleanup the ManagedConnection instance. - */ - public void cleanup() throws ResourceException { - if (inLocalTransaction) throw new ResourceException("A local transaction is not complete"); - clearSignature(); - } - - /** - * Destroys the physical connection. - */ - public synchronized void destroy() throws ResourceException { - if (isDebugOn) { - trace.log(BasicLevel.DEBUG, "destroy mc=" + this + " with connection=" + connection); - } - try { - if (wrapper != null) { - DriverManager.deregisterDriver(wrapper); - } - } catch (Exception ex) { - trace.log(BasicLevel.ERROR, "Unable to deregister Driver wrapper", ex); - } - if (connection != null) { - try { - connection.close(); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "", e, "ManagedConnectionImpl", "destroy"); - throw new ResourceException(e); - } - connection = null; - poolCon = null; - xaCon = null; - xares = null; - } - } - - /** - * Create a connection handle - */ - public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException { - if (isDebugOn) { - trace.log(BasicLevel.DEBUG, "subject:" + subject + " connectionRequest:" + cxRequestInfo); - } - - long sig = getNewSignature(true); - - try { - return new ConnectionImpl(this, connection, sig, out); - } catch (Exception e) { - trace.log(BasicLevel.ERROR, "", e, "ManagedConnectionImpl", "getConnection"); - throw new ResourceException(e.getMessage()); - } - } - - /** - * Returns an javax.resource.spi.LocalTransaction instance. - */ - public LocalTransaction getLocalTransaction() throws ResourceException { - return (LocalTransaction) this; - } - - /** - * Gets the log writer for this ManagedConnection instance. - */ - public PrintWriter getLogWriter() { - return out; - } - - /** - * Gets the metadata information for this connection's underlying EIS - * resource manager instance. - */ - public ManagedConnectionMetaData getMetaData() throws ResourceException { - return new MetaDataImpl(this); - } - - /** - * Check if the mc is in local transaction - */ - public XAResource getXAResource() throws ResourceException { - if (isDebugOn) { - trace.log(BasicLevel.DEBUG, ""); - } - if (inLocalTransaction) - throw new ResourceException( - "The managedConnection is already in a local transaction and an XA resource cannot be obtained"); - if (xares == null) { - if (xaCon != null) { - try { - xares = xaCon.getXAResource(); - } catch (Exception ex) { - throw new ResourceException("Unable to obtain XAResource: ", ex); - } - } else { - if (isDebugOn) { - trace.log(BasicLevel.DEBUG, "JDBC driver doesn't support XA, simulate it with " + xares); - } - } - xares = new XAResourceImpl(this, xares); - } - return xares; - } - - /** - * Removes an already registered connection event listener from the - * ManagedConnection instance - */ - public void removeConnectionEventListener(ConnectionEventListener listener) { - cels.remove(listener); - } - - /** - * Sets the log writer for this ManagedConnection instance. - */ - public void setLogWriter(PrintWriter _out) { - out = _out; - } - - public void addSignature(long sig) { - int off = -1; - for (int i = 0; i < maxSigs; i++) - if (sigList[i] == 0) { - off = i; - break; - } - - if (off > -1) - sigList[off] = sig; - else { - maxSigs += 20; - long[] tmp = new long[maxSigs]; - System.arraycopy(sigList, 0, tmp, 0, maxSigs - 20); - sigList = tmp; - sigList[maxSigs - 20] = sig; - } - } - - public void clearSignature() { - for (int i = 0; i < maxSigs; i++) - sigList[i] = 0; - signature = 0; - } - - public void clearSignature(long sig, boolean clear) { - for (int i = 0; i < maxSigs; i++) { - if (sig == sigList[i]) { - sigList[i] = 0; - break; - } - } - if (clear) { - signature = 0; - } - } - - public void setSignature(long sig) { - if (signature == 0) { - signature = sig; - } - } - - /** - * Gets the signature value passed in if found in the signature hash table - * @param long sig value to find in signature table - * @return long signature value or 0 if not found - */ - public long getSignature(long sig) { - // find signature - long retSig = 0; - if (sig > 0) { - for (int i = 0; i < maxSigs; i++) - if (sig == sigList[i]) { - retSig = sig; - break; - } - } - return (retSig); - } - - /** - * Gets the current signature value - * @return long current signature value - */ - public long getSignature() { - return (signature); - } - - /** - * Gets the next signature value - * @return long next signature value - */ - public long getNewSignature(boolean setSig) { - long sig = System.currentTimeMillis(); - if (sig <= lastSig && lastSig != 0) { - sig = lastSig++; - } - if (isDebugOn) { - trace.log(BasicLevel.DEBUG, "Sig is " + sig + " last Sig was " + lastSig); - } - lastSig = sig; - addSignature(sig); - if (setSig) { - signature = sig; - } - return sig; - } - - public void close(ConnectionImpl ch) throws ResourceException { - clearSignature(ch.key, true); - signalEvent(ConnectionEvent.CONNECTION_CLOSED, ch, null); - } - - /** ******************************************************* */ - /** IMPLEMENTATION OF INTERFACE LocalTransaction * */ - /** ******************************************************* */ - public void begin() throws ResourceException { - if (inLocalTransaction) throw new ResourceException("The managedConnection is already in a LocalTransaction"); - try { - inLocalTransaction = true; - connection.setAutoCommit(false); - } catch (Exception ex) { - } - } - - public void commit() throws ResourceException { - try { - connection.commit(); - connection.setAutoCommit(true); - inLocalTransaction = false; - } catch (Exception ex) { - } - } - - public void rollback() throws ResourceException { - try { - connection.rollback(); - connection.setAutoCommit(true); - inLocalTransaction = false; - } catch (Exception ex) { - } - } - -} diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/MetaDataImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/MetaDataImpl.java deleted file mode 100644 index c1537ac8470da338560610e9fa22f4c106de3441..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/MetaDataImpl.java +++ /dev/null @@ -1,118 +0,0 @@ - /* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.sql.DatabaseMetaData; -import java.sql.SQLException; - -import javax.resource.ResourceException; - -/** - * Description of the MetaDataImpl. This is the DatabaseMetadata for - * the current JDBC connection. - * - *@author Eric Hardesty - *@created 22 May 2003 - */ -public class MetaDataImpl - implements javax.resource.spi.ManagedConnectionMetaData { - - private ManagedConnectionImpl mcon; - private DatabaseMetaData dMetaData; - - public - MetaDataImpl(ManagedConnectionImpl _mcon) - throws ResourceException { - dMetaData = null; - try { - mcon = _mcon; - dMetaData = mcon.connection.getMetaData(); - } catch (SQLException se) { - throw new ResourceException(se.getMessage()); - } - } - - /** Returns the JDBC Product name - * - * @return String Product name of the JDBC instance. - **/ - public - String getEISProductName() throws ResourceException - { - try { - return(dMetaData.getDatabaseProductName()); - } catch (SQLException se) { - throw new ResourceException(se.getMessage()); - } - } - - /** Returns the JDBC Product version - * - * @return String Product version of the JDBC instance - **/ - public - String getEISProductVersion() throws ResourceException - { - try { - return(dMetaData.getDatabaseProductVersion()); - } catch (SQLException se) { - throw new ResourceException(se.getMessage()); - } - } - - /** Returns maximum limit on number of active concurrent connections - * that this JDBC instance can support across client processes. - * - * @return int of maximum limit for number of active concurrent - * connections. 0 is an unlimited number of connections - **/ - public - int getMaxConnections() throws ResourceException - { - try { - return(dMetaData.getMaxConnections()); - } catch (SQLException se) { - throw new ResourceException(se.getMessage()); - } - } - - /** Returns the name of the user associated with the JdbcRaManagedConnection - * instance. The name corresponds to the resource principal under - * whose security context, a connection to the DB has been - * established. - * - * @return String name of the user - **/ - public - String getUserName() throws ResourceException - { - try { - return(dMetaData.getUserName()); - } catch (SQLException se) { - throw new ResourceException(se.getMessage()); - } - } -} diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/Utility.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/Utility.java deleted file mode 100644 index 8898ef45864426b07e0b3001092dcd292903aea0..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/Utility.java +++ /dev/null @@ -1,363 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.lang.reflect.Method; -import java.io.ByteArrayInputStream; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.Properties; -import java.util.Set; -import java.util.Vector; - -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnectionFactory; -import javax.resource.spi.SecurityException; -import javax.resource.spi.security.PasswordCredential; -import javax.security.auth.Subject; - -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - *

This class contains the support methods for the Resource Adapter. - * @author Eric Hardesty - */ -public class Utility { - - static synchronized Object getDataSource(ManagedConnectionFactoryImpl mcf, PasswordCredential pc, Logger trace) - throws ResourceException { - - MCFData prop = mcf.mcfData; - - if (prop.getMCFData(MCFData.DSCLASS) == null) { - ResourceException re = new ResourceException("A DataSource (dsClass) value must be specified"); - trace.log(BasicLevel.INFO, re.getMessage()); - } - String clsName = prop.getMCFData(MCFData.DSCLASS); - Class dsClass = null; - Object dsObj = null; - try { - dsClass = Class.forName(clsName, true, Thread.currentThread().getContextClassLoader()); - dsObj = dsClass.newInstance(); - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "dsClass(" + clsName + ") is " + dsObj); - } - } catch (ClassNotFoundException cnfe) { - throw new ResourceException("Class Name not found:" + clsName, cnfe); - } catch (Exception ex) { - throw new ResourceException("Error in class: " + clsName + " " + ex.getMessage(), ex); - } - - Object[] param = new Object[1]; - String methodName = null; - String paramVal = null; - Method meth = null; - for (Enumeration e = prop.getProperties(); e.hasMoreElements();) { - int offset = Integer.parseInt((String) e.nextElement()); - methodName = MCFData.dsMethodNames[offset]; - if (!(methodName.equals("setDSClass") || methodName.equals("setDbSpecificMethods") || offset > MCFData.JONASOFFSET)) { - try { - /* Determine if a String method exist */ - paramVal = prop.getProperty("" + offset); - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "calling method " + methodName + " with String " + paramVal); - } - meth = dsClass.getMethod(methodName, new Class[] {String.class}); - param[0] = paramVal; - meth.invoke(dsObj, param); - } catch (NoSuchMethodException ns) { - try { - /* Valid case, determine if an Integer method exist */ - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "calling method " + methodName + " with int " + paramVal); - } - meth = dsClass.getMethod(methodName, new Class[] {int.class}); - param[0] = new Integer(paramVal); - meth.invoke(dsObj, param); - } catch (NoSuchMethodException nsme) { - // Valid case no String or Integer method continue thru - // remainder of properties - ; - } catch (NumberFormatException nfm) { - // Valid case cannot convert to an Integer - ; - } catch (Exception ex0) { - ex0.printStackTrace(); - throw new ResourceException("Error on method: " + methodName + " " + ex0.getMessage(), ex0); - } - } catch (IllegalArgumentException iae) { - ; - } catch (Exception ex) { - ex.printStackTrace(); - throw new ResourceException("Error on method: " + methodName + " " + ex.getMessage(), ex); - } - } - if (methodName.equals("setDbSpecificMethods")) { - Vector meths = new Vector(); - Vector methParams = new Vector(); - Vector methTypes = new Vector(); - try { - Utility.parseValues(prop.getProperty("" + offset), meths, methParams, methTypes, trace); - } catch (Exception ex1) { - throw new ResourceException("Error parsing dbSpecificMethods: " + ex1.getMessage()); - } - if (meths != null && meths.size() > 0) { - for (int i = 0; i < meths.size(); i++) { - try { - /* Determine if a String method exist */ - methodName = (String) meths.elementAt(i); - Class toPass = null; - String curMethType = (String) methTypes.elementAt(i); - if (curMethType.equalsIgnoreCase("String")) { - toPass = String.class; - param[0] = (String) methParams.elementAt(i); - } else if (curMethType.equalsIgnoreCase("Integer")) { - toPass = Integer.class; - param[0] = Integer.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equalsIgnoreCase("int")) { - toPass = int.class; - param[0] = Integer.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("Float")) { - toPass = Float.class; - param[0] = Float.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("float")) { - toPass = float.class; - param[0] = Float.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("Boolean")) { - toPass = Boolean.class; - param[0] = Boolean.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("boolean")) { - toPass = boolean.class; - param[0] = Boolean.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equalsIgnoreCase("Character")) { - toPass = Character.class; - param[0] = new Character(((String) methParams.elementAt(i)).charAt(0)); - } else if (curMethType.equalsIgnoreCase("char")) { - toPass = char.class; - param[0] = new Character(((String) methParams.elementAt(i)).charAt(0)); - } else if (curMethType.equals("Double")) { - toPass = Double.class; - param[0] = Double.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("double")) { - toPass = double.class; - param[0] = Double.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("Byte")) { - toPass = Byte.class; - param[0] = Byte.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("byte")) { - toPass = byte.class; - param[0] = Byte.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("Short")) { - toPass = Short.class; - param[0] = Short.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("short")) { - toPass = short.class; - param[0] = Short.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("Long")) { - toPass = Long.class; - param[0] = Long.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("long")) { - toPass = long.class; - param[0] = Long.valueOf((String) methParams.elementAt(i)); - } else if (curMethType.equals("Properties") || curMethType.equals("java.lang.Properties")) { - toPass = Properties.class; - param[0] = Utility.buildProperties((String) methParams.elementAt(i), trace); - } - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "calling method " + methodName + " with " + param[0]); - } - meth = dsClass.getMethod(methodName, new Class[] {toPass}); - meth.invoke(dsObj, param); - } catch (NoSuchMethodException ns) { - throw new ResourceException("No such method: " + methodName + " " + ns.getMessage(), ns); - } catch (Exception ex) { - ex.printStackTrace(); - throw new ResourceException("Error on method: " + methodName + " " + ex.getMessage(), ex); - } - } - } - } - } - if (pc != null) { - try { - param[0] = pc.getUserName(); - meth = dsClass.getMethod("setUserName", new Class[] {Class.forName("String")}); - meth.invoke(dsObj, param); - - param[0] = new String(pc.getPassword()); - meth = dsClass.getMethod("setPassword", new Class[] {Class.forName("String")}); - meth.invoke(dsObj, param); - } catch (Exception ex) { - throw new ResourceException("Error on method: " + methodName + " " + ex.getMessage(), ex); - } - } - - if (trace.isLoggable(BasicLevel.DEBUG)) { - try { - meth = dsClass.getMethod("getURL", (Class[]) null); - trace.log(BasicLevel.DEBUG, "URL is " + meth.invoke(dsObj, (Object[]) null)); - } catch (Exception e) { - } - } - return dsObj; - - } - private static Properties buildProperties(String val, Logger trace) - throws Exception { - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "" + val); - } - Properties ret = new Properties(); - - if (val.length() == 0) { - return ret; - } - String pairs = val.substring(1, val.length()-1); - String parseVal = pairs.replace(',', '\n'); - try { - ByteArrayInputStream valStream = new ByteArrayInputStream(parseVal.getBytes()); - ret.load(valStream); - } catch (Exception ex) { - ex.printStackTrace(); - throw new Exception("Invalid value specified for Properties parameter in dbSpecificMethods"); - } - - return ret; - } - - private static void parseValues(String val, Vector vMeth, Vector vValues, Vector vTypes, Logger trace) - throws Exception { - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, ""); - } - char delim = ':'; - boolean done = false; - String methName = null; - int offset = 0; - boolean parsed = false; - String parseVal = val.trim(); - String typeVal = ""; - String valVal = ""; - - if (parseVal.length() == 0) { - return; - } - if (parseVal.startsWith(":")) { - delim = parseVal.charAt(1); - parseVal = parseVal.substring(2); - } - while (!parsed) { - offset = parseVal.indexOf('='); - if (offset < 0) { - throw new Exception("Invalid value specified for dbSpecificMethods"); - } - methName = parseVal.substring(0, offset); - vMeth.add(methName); - parseVal = parseVal.substring(offset + 1); - if (parseVal.charAt(0) == delim) { - valVal = ""; - } else { - offset = parseVal.indexOf(delim); - if (offset < 0) { - valVal = parseVal; - offset = valVal.length() - 1; - } else { - valVal = parseVal.substring(0, offset); - } - } - vValues.add(valVal); - if (offset < 0) { - parsed = true; - } else { - parseVal = parseVal.substring(offset + 1); - if (parseVal.length() == 0) { - parsed = true; - } - } - if (parseVal.startsWith("" + delim)) { - parseVal = parseVal.substring(1); - offset = parseVal.indexOf(delim); - if (offset < 0) { - typeVal = parseVal; - } else { - typeVal = parseVal.substring(0, offset); - } - vTypes.add(typeVal); - if (offset < 0) { - parsed = true; - } else { - parseVal = parseVal.substring(offset + 1); - if (parseVal.length() == 0) { - parsed = true; - } - } - } else { - vTypes.add("String"); - } - if (trace.isLoggable(BasicLevel.DEBUG)) { - trace.log(BasicLevel.DEBUG, "Parsed: method(" + methName + ") value(" + valVal + ") type(" + typeVal + ")"); - } - } - } - - /** - * Returns the Password credential - * @param mcf ManagedConnectionFactory currently being used - * @param subject Subject associated with this call - * @param info ConnectionRequestInfo - * @return PasswordCredential for this user - */ - static synchronized PasswordCredential getPasswordCredential(ManagedConnectionFactory mcf, Subject subject, - ConnectionRequestInfo info, java.io.PrintWriter out) throws ResourceException { - - if (subject == null) { - if (info == null) { - return null; - } - ConnectionRequestInfoImpl crii = (ConnectionRequestInfoImpl) info; - PasswordCredential pc = new PasswordCredential(crii.user, crii.password.toCharArray()); - pc.setManagedConnectionFactory(mcf); - return pc; - } - Set cred = subject.getPrivateCredentials(PasswordCredential.class); - PasswordCredential pc = null; - for (Iterator iter = cred.iterator(); iter.hasNext();) { - PasswordCredential tmpPc = (PasswordCredential) iter.next(); - if (tmpPc.getManagedConnectionFactory().equals(mcf)) { - pc = tmpPc; - break; - } - } - if (pc == null) { - SecurityException se = new SecurityException("No PasswordCredential found"); - out.println("" + se); - throw se; - } - return pc; - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/XAMCFImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/XAMCFImpl.java deleted file mode 100644 index a8010ee6d2d65ee1fd03e5b4022a06207122438d..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/XAMCFImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - - -import java.sql.SQLException; - -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ResourceAllocationException; -import javax.resource.spi.security.PasswordCredential; -import javax.security.auth.Subject; -import javax.sql.XADataSource; - -public class XAMCFImpl - extends ManagedConnectionFactoryImpl { - - XADataSource ds = null; - - public ManagedConnection createManagedConnection(Subject subject, - ConnectionRequestInfo cxReq) - throws ResourceException { - - PasswordCredential pc = Utility.getPasswordCredential(this, subject, cxReq, pw); - if(ds == null) { - try { - ds = (XADataSource) Utility.getDataSource(this, pc, trace); - } catch(Exception ex) { - throw new ResourceException(ex.getMessage(), ex); - } - } - javax.sql.XAConnection xaConnection = null; - java.sql.Connection connection = null; - try { - if(cxReq != null) { - ConnectionRequestInfoImpl cx = (ConnectionRequestInfoImpl) cxReq; - xaConnection = ds.getXAConnection(cx.getUser(), cx.getPassword()); - } else if (pc != null){ - xaConnection = ds.getXAConnection(pc.getUserName(), new String(pc.getPassword())); - } else if (mcfData.getMCFData(MCFData.USER).length() > 0){ - xaConnection = ds.getXAConnection(mcfData.getMCFData(MCFData.USER), - mcfData.getMCFData(MCFData.PASSWORD)); - } else { - xaConnection = ds.getXAConnection(); - } - if (xaConnection != null) { - connection = xaConnection.getConnection(); - } - } - catch(SQLException sqle) - { - throw new ResourceAllocationException("The connection could not be allocated: " + sqle.getMessage(), sqle); - } - return new ManagedConnectionImpl(this, pc, connection, null, xaConnection, null); - } - - /* Determine if the factories are equal - */ - public boolean equals(Object obj) { - if (obj instanceof XAMCFImpl) { - return mcfData.equals(((XAMCFImpl)obj).mcfData); - } - else { - return false; - } - } - - // JOnAS JDBC RA DataSource config properties - public String getDatabaseName() - { - return mcfData.getMCFData(MCFData.DATABASENAME); - } - - public void setDatabaseName(String val) - { - mcfData.setMCFData(MCFData.DATABASENAME, val); - } - - public String getDescription() - { - return mcfData.getMCFData(MCFData.DESCRIPTION); - } - - public void setDescription(String val) - { - mcfData.setMCFData(MCFData.DESCRIPTION, val); - } - - public String getPortNumber() - { - return mcfData.getMCFData(MCFData.PORTNUMBER); - } - - public void setPortNumber(String val) - { - mcfData.setMCFData(MCFData.PORTNUMBER, val); - } - - public String getServerName() - { - return mcfData.getMCFData(MCFData.SERVERNAME); - } - - public void setServerName(String val) - { - mcfData.setMCFData(MCFData.SERVERNAME, val); - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/XAResourceImpl.java b/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/XAResourceImpl.java deleted file mode 100644 index 7c86dbfeef136e609895e64bb205de369afa2567..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/glue/src/main/java/org/objectweb/jonas/jdbc/XAResourceImpl.java +++ /dev/null @@ -1,317 +0,0 @@ - /* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Eric HARDESTY - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jdbc; - -import java.sql.SQLException; - -import javax.resource.spi.ConnectionEvent; -import javax.transaction.xa.XAException; -import javax.transaction.xa.XAResource; -import javax.transaction.xa.Xid; - -import org.objectweb.util.monolog.api.BasicLevel; - -/** - * This is an implementation of XAResource used for transaction mgmt - * with a JDBC driver. The standard JDBC drivers don't support real - * XA, so the prepare will just return OK and work will be done in the - * commit/rollback. - */ -public class XAResourceImpl implements XAResource { - - // Current Xid - private Xid currentXid = null; - - // Is a xa transaction started ? - boolean started = false; - boolean ended = true; - - protected ManagedConnectionImpl mc = null; - private XAResource xares = null; - - /** - * XAResourceImpl constructor - * @param mc ManagedConnectionImpl used with this object - * @param xares XAResource from DB if supported - */ - public XAResourceImpl(ManagedConnectionImpl mc, XAResource xares) { - this.mc = mc; - this.xares = xares; - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + mc + "," + xares); - } - } - - /** - * Commit the global transaction specified by xid. - */ - public void commit(Xid xid, boolean onePhase) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xid + "," + onePhase); - } - - // Commit the transaction - try { - if (xares != null) { - xares.commit(xid, onePhase); - if (xid.equals(currentXid)) { - started = false; - } - } else { - // Make sure that this call is for the XID - if (currentXid == null || !currentXid.equals(xid) || !started) { - mc.trace.log(BasicLevel.ERROR, "passed xid(" + xid - + "),current Xid(" - + currentXid - + "),started(" + started + ")"); - throw new XAException("Commit: Must call correct XAResource for its started XID"); - } - mc.connection.commit(); - started = false; - } - } catch (XAException xe) { - mc.trace.log(BasicLevel.ERROR, xe.getMessage()); - throw xe; - } catch (SQLException e) { - mc.trace.log(BasicLevel.ERROR, e.getMessage()); - try { - mc.signalEvent(ConnectionEvent.CONNECTION_ERROR_OCCURRED, null, e); - } catch (Exception ex) {} - throw new XAException("Error on commit"); - } - - try { - if (!mc.connection.getAutoCommit()) { - mc.connection.setAutoCommit(true); - } - } catch (Exception exc) { - if (xares == null) { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, - "Unable to set autoCommit to true:", exc); - } - } - } - } - - /** - * Ends the transaction - */ - public void end(Xid xid, int flags) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xid + "," + flags); - } - // Make sure that the Xid has started - if (currentXid == null || !currentXid.equals(xid)) { - throw new XAException(XAException.XA_RBPROTO); - } - if (!started && ended) { - throw new XAException(XAException.XA_RBPROTO); - } - ended = true; - if (xares != null) { - xares.end(xid, flags); - } - } - - /** - * Need to forget the heuristically completed Xid - */ - public void forget(Xid xid) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xid); - } - if (xares != null) { - xares.forget(xid); - } - } - - /** - * Get the current transaction timeout for this XAResource - */ - public int getTransactionTimeout() throws XAException { - if (xares != null) { - return xares.getTransactionTimeout(); - } - return 0; - } - - /** - * Determine if the resource manager instance is the same as the - * resouce manager being passed in - */ - public boolean isSameRM(XAResource xaRes) throws XAException { - - boolean ret = false; - if (xaRes.equals(this)) { - ret = true; - } else if (!(xaRes instanceof XAResourceImpl)) { - ret = false; - } else { - XAResourceImpl xaResImpl = (XAResourceImpl) xaRes; - if (mc == xaResImpl.mc) { - ret = true; - } - } - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xaRes + "," + this + " is " + ret); - } - return ret; - } - - /** - * Prepare the Xid for a transaction commit - */ - public int prepare(Xid xid) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xid); - } - if (xares != null) { - int ret = xares.prepare(xid); - // If read-only, then do what would have been done in the commit call - if (ret == XA_RDONLY) { - started = false; - try { - if (!mc.connection.getAutoCommit()) { - mc.connection.setAutoCommit(true); - } - } catch (Exception exc) { } - } - return ret; - } - // Just return true, since we are just simulating XA with our wrapper - return XA_OK; - } - - /** - * Obtain a list of prepared transaction branches from a resource manager. - */ - public Xid[] recover(int flag) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + flag); - } - if (xares != null) { - return xares.recover(flag); - } - // Not a full RM, so just return null - return null; - } - - /** - * Roll back work done on the Xid - */ - public void rollback(Xid xid) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xid); - } - - // Rollback the Xid - try { - if (xares != null) { - xares.rollback(xid); - if (xid.equals(currentXid)) { - started = false; - } - } else { - // Make sure that this call is for the XID - if (currentXid == null || !currentXid.equals(xid) || !started) { - mc.trace.log(BasicLevel.ERROR, "passed xid(" + xid - + "),current Xid(" + currentXid - + "),started(" + started + ")"); - throw new XAException("Rollback: Must call correct XAResource for its started XID"); - } - mc.connection.rollback(); - started = false; - } - } catch (XAException xe) { - mc.trace.log(BasicLevel.ERROR, xe.getMessage()); - throw xe; - } catch (SQLException e) { - try { - mc.trace.log(BasicLevel.ERROR, e.getMessage()); - mc.signalEvent( - ConnectionEvent.CONNECTION_ERROR_OCCURRED, null, e); - } catch (Exception ex) {} - throw(new XAException("Error on rollback")); - } - try { - if (!mc.connection.getAutoCommit()) { - mc.connection.setAutoCommit(true); - } - } catch (Exception exc) { - if (xares == null) { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, - "Unable to set autoCommit to true:", exc); - } - } - } - } - - /** - * Set the current transaction timeout value for this XAResource - */ - public boolean setTransactionTimeout(int seconds) throws XAException { - if (xares != null) { - return xares.setTransactionTimeout(seconds); - } - return false; - } - - /** - * Start work on this Xid. If TMJOIN is on, then join an existing transaction - * already started by the RM. - */ - public void start(Xid xid, int flags) throws XAException { - if (mc.trace.isLoggable(BasicLevel.DEBUG)) { - mc.trace.log(BasicLevel.DEBUG, "" + xid + "," + flags); - } - try { - if (mc.connection.getAutoCommit()) { - mc.connection.setAutoCommit(false); - } - } catch (Exception ex) { - ex.printStackTrace(); - mc.trace.log(BasicLevel.ERROR, - "Unable to set autoCommit to false:" + ex.getMessage()); - throw(new XAException( - "Error : Unable to set autoCommit to false in start")); - } - - if (xares != null) { - xares.start(xid, flags); - } else { - if (started && (currentXid == null || !currentXid.equals(xid))) { - mc.trace.log(BasicLevel.ERROR, - "Must call correct XAResource for its started XID"); - throw new XAException("XAResourceImpl.start : Must call correct XAResource for its started XID"); - } - } - currentXid = xid; - started = true; - ended = false; - } -} diff --git a/jonas/modules/ee-components/jca/jdbc/pom.xml b/jonas/modules/ee-components/jca/jdbc/pom.xml deleted file mode 100644 index 2e8ea475b1b0aa4396880eac79b118f38014650c..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - org.objectweb.jonas - jonas-jca - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-jca-jdbc - pom - JOnAS :: EE Components :: JCA :: JDBC - - - glue - cp - dm - ds - xa - - - diff --git a/jonas/modules/ee-components/jca/jdbc/xa/pom.xml b/jonas/modules/ee-components/jca/jdbc/xa/pom.xml deleted file mode 100644 index 64b4f985464ed03493448323ba3203832022976f..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/xa/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-jdbc - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-jdbc-xa - rar - JOnAS :: EE Components :: JCA :: JDBC :: XA - - - - org.objectweb.jonas - jonas-jca-jdbc-glue - ${jonas.version} - - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/jdbc/xa/src/main/rar/META-INF/jonas-ra.xml b/jonas/modules/ee-components/jca/jdbc/xa/src/main/rar/META-INF/jonas-ra.xml deleted file mode 100644 index c6237d7a5a13ce3c737f3c8e799c4c4c39279680..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/xa/src/main/rar/META-INF/jonas-ra.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - JOnASJDBC_XA - - false - - - 0 - 0 - 100 - 0 - 0 - 0 - 0 - 0 - 30 - - - 0 - - - - dsClass - - - - user - - - - password - - - - databaseName - - - - description - - - - portNumber - - - - serverName - - - - loginTimeout - - - - dbSpecificMethods - - - - isolationLevel - - - - mapperName - - - - logTopic - - - - diff --git a/jonas/modules/ee-components/jca/jdbc/xa/src/main/rar/META-INF/ra.xml b/jonas/modules/ee-components/jca/jdbc/xa/src/main/rar/META-INF/ra.xml deleted file mode 100644 index 3b3675c43ac05ccecec579ffa2d5e6fc9fda6057..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/jdbc/xa/src/main/rar/META-INF/ra.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - JOnAS XA RA - JOnAS XA RA - Objectweb - 1.0 - JDBC - 1.0 - - org.objectweb.jonas.jdbc.XAMCFImpl - javax.sql.DataSource - org.objectweb.jonas.jdbc.DataSourceImpl - java.sql.Connection - org.objectweb.jonas.ConnectionImpl - XATransaction - - dsClass - java.lang.String - - - - user - java.lang.String - - - - password - java.lang.String - - - - databaseName - java.lang.String - - - - description - java.lang.String - - - - portNumber - java.lang.String - - - - serverName - java.lang.String - - - - loginTimeout - java.lang.String - 0 - - - dbSpecificMethods - java.lang.String - - - - isolationLevel - java.lang.String - - - - mapperName - java.lang.String - - - - logTopic - java.lang.String - - - false - - diff --git a/jonas/modules/ee-components/jca/pom.xml b/jonas/modules/ee-components/jca/pom.xml deleted file mode 100644 index 35c0fd69aff8334ec1b6aedeedb8c9056e53c151..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - org.objectweb.jonas - jonas-ee-components - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-jca - pom - JOnAS :: EE Components :: JCA - - - scout - jdbc - - - diff --git a/jonas/modules/ee-components/jca/scout/glue/pom.xml b/jonas/modules/ee-components/jca/scout/glue/pom.xml deleted file mode 100644 index 75aeba9a62c06f38405e0006f9ac267a9dae46f5..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/glue/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-scout - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-scout-glue - jar - JOnAS :: EE Components :: JCA :: Scout :: Glue - - - - org.ow2.spec.ee - ow2-connector-1.5-spec - provided - - - org.objectweb.jonas - jonas-commons - ${jonas.version} - provided - - - scout - scout - 0.5 - - - juddi - juddi - 0.9RC4 - - - org.objectweb.monolog - monolog-api - ${monolog.version} - provided - - - geronimo-spec - geronimo-spec-jaxr - 1.0-rc4 - provided - - - - - - - repository.jboss.com - Maven2 JBoss Repository - http://repository.jboss.com/maven2 - - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/JAXRResourceAdapter.java b/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/JAXRResourceAdapter.java deleted file mode 100644 index 3146396114c7036de799f7d934a7b96199b89eb6..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/JAXRResourceAdapter.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * JOnAS : Java(TM) OpenSource Application Server - * Copyright (C) 2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jaxr.scout; - -import javax.resource.ResourceException; -import javax.resource.spi.ActivationSpec; -import javax.resource.spi.BootstrapContext; -import javax.resource.spi.ResourceAdapter; -import javax.resource.spi.ResourceAdapterInternalException; -import javax.resource.spi.endpoint.MessageEndpointFactory; -import javax.transaction.xa.XAResource; -import org.objectweb.jonas.common.Log; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * This is a very simple ResourceAdapter just used to display traces. - * - * @author Guillaume Sauthier - */ -public class JAXRResourceAdapter implements ResourceAdapter { - - /** - * Logger for this ra - */ - private static Logger logger = null; - - - /** - * Display Info log at JAXR Connector start. - * @see javax.resource.spi.ResourceAdapter#start(javax.resource.spi.BootstrapContext) - */ - public void start(BootstrapContext bCtx) throws ResourceAdapterInternalException { - logger = Log.getLogger(Log.JONAS_JAXR_PREFIX); - logger.log(BasicLevel.INFO, "Starting Scout ResourceAdapter"); - } - - /** - * Display Info log at JAXR Connector stop. - * @see javax.resource.spi.ResourceAdapter#stop() - */ - public void stop() { - logger.log(BasicLevel.INFO, "Stopping Scout ResourceAdapter"); - logger = null; - } - - /** - * Not used. - * @see javax.resource.spi.ResourceAdapter#endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec) - */ - public void endpointActivation(MessageEndpointFactory mef, ActivationSpec as) throws ResourceException { - // NA - } - - /** - * Not used. - * @see javax.resource.spi.ResourceAdapter#endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec) - */ - public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) { - // NA - } - - /** - * Not used. - * @see javax.resource.spi.ResourceAdapter#getXAResources(javax.resource.spi.ActivationSpec[]) - */ - public XAResource[] getXAResources(ActivationSpec[] as) throws ResourceException { - // NA - return null; - } -} diff --git a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/JConnectionFactory.java b/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/JConnectionFactory.java deleted file mode 100644 index 9badd057d15d02b0cd93389ac42fa333fdc45d0c..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/JConnectionFactory.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * JOnAS : Java(TM) OpenSource Application Server - * Copyright (C) 2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jaxr.scout; - -import javax.naming.NamingException; -import javax.naming.Reference; -import javax.resource.Referenceable; -import org.apache.ws.scout.registry.ConnectionFactoryImpl; - -/** - * JConnectionFactory is an extension of Scout ConnectionFactoryImpl. - * It's used to store the Naming Reference used by the resource service to recreate the - * ConnectionFactory instance. - * - * @author Guillaume Sauthier - */ -public class JConnectionFactory extends ConnectionFactoryImpl implements Referenceable { - - /** - * UID - */ - private static final long serialVersionUID = 3257569490513573686L; - - /** - * stored Reference - */ - private Reference ref = null; - - /** - * @see javax.naming.Referenceable#getReference() - */ - public Reference getReference() throws NamingException { - return ref; - } - - /** - * @see javax.resource.Referenceable#setReference(javax.naming.Reference) - */ - public void setReference(Reference ref) { - this.ref = ref; - } -} diff --git a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/ManagedConnectionFactoryImpl.java b/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/ManagedConnectionFactoryImpl.java deleted file mode 100644 index cf54c1f8b888414fe2511e63b137a36af26c742f..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/ManagedConnectionFactoryImpl.java +++ /dev/null @@ -1,234 +0,0 @@ -/** - * JOnAS : Java(TM) OpenSource Application Server - * Copyright (C) 2005 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ -package org.objectweb.jonas.jaxr.scout; - -import java.io.PrintWriter; -import java.util.Set; -import javax.resource.ResourceException; -import javax.resource.spi.ConnectionManager; -import javax.resource.spi.ConnectionRequestInfo; -import javax.resource.spi.ManagedConnection; -import javax.resource.spi.ManagedConnectionFactory; -import javax.security.auth.Subject; -import javax.xml.registry.ConnectionFactory; -import org.apache.ws.scout.registry.ConnectionFactoryImpl; - -/** - * - * - * @author Guillaume Sauthier - */ -public class ManagedConnectionFactoryImpl implements ManagedConnectionFactory { - - /** - * UID - */ - private static final long serialVersionUID = 3258690988061833009L; - - /** - * PrintWriter - */ - private PrintWriter pw = null; - - /** - * Query Manager URL - */ - private String queryManagerURL = null; - - /** - * LifeCycle Manager URL - */ - private String lifeCycleManagerURL = null; - - /** - * semantic Equivalence property - */ - private String semanticEquivalences = null; - - /** - * Authentication method name to use - */ - private String authenticationMethod = null; - - /** - * maxRows property - */ - private Integer maxRows = null; - - /** - * Scheme of the postal address - */ - private String postalAddressScheme = null; - - /** - * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory(javax.resource.spi.ConnectionManager) - */ - public Object createConnectionFactory(ConnectionManager manager) - throws ResourceException { - return newConnectionFactory(); - } - - /** - * @return Returns a new JAXr ConnectionFactory instance - */ - private ConnectionFactory newConnectionFactory() { - // create the CF - ConnectionFactoryImpl factory = new JConnectionFactory(); - // assign properties - factory.setAuthenticationMethod(this.authenticationMethod); - factory.setLifeCycleManagerURL(this.lifeCycleManagerURL); - factory.setQueryManagerURL(this.queryManagerURL); - factory.setMaxRows(this.maxRows); - factory.setPostalAddressScheme(this.postalAddressScheme); - factory.setSemanticEquivalences(this.semanticEquivalences); - return factory; - } - - /** - * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory() - */ - public Object createConnectionFactory() throws ResourceException { - return newConnectionFactory(); - } - - /** - * Not used. - * @see javax.resource.spi.ManagedConnectionFactory#createManagedConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo) - */ - public ManagedConnection createManagedConnection(Subject subject, - ConnectionRequestInfo cri) throws ResourceException { - // NA - return null; - } - - /** - * Not used. - * @see javax.resource.spi.ManagedConnectionFactory#matchManagedConnections(java.util.Set, javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo) - */ - public ManagedConnection matchManagedConnections(Set set, Subject subject, - ConnectionRequestInfo cri) throws ResourceException { - // NA - return null; - } - - /** - * @see javax.resource.spi.ManagedConnectionFactory#setLogWriter(java.io.PrintWriter) - */ - public void setLogWriter(PrintWriter pw) throws ResourceException { - this.pw = pw; - } - - /** - * @see javax.resource.spi.ManagedConnectionFactory#getLogWriter() - */ - public PrintWriter getLogWriter() throws ResourceException { - return pw; - } - - /** - * @return Returns the authenticationMethod. - */ - public String getAuthenticationMethod() { - return authenticationMethod; - } - - /** - * @param authenticationMethod The authenticationMethod to set. - */ - public void setAuthenticationMethod(String authenticationMethod) { - this.authenticationMethod = authenticationMethod; - } - - /** - * @return Returns the lifeCycleManagerURL. - */ - public String getLifeCycleManagerURL() { - return lifeCycleManagerURL; - } - - /** - * @param lifeCycleManagerURL The lifeCycleManagerURL to set. - */ - public void setLifeCycleManagerURL(String lifeCycleManagerURL) { - this.lifeCycleManagerURL = lifeCycleManagerURL; - } - - /** - * @return Returns the maxRows. - */ - public Integer getMaxRows() { - return maxRows; - } - - /** - * @param maxRows The maxRows to set. - */ - public void setMaxRows(Integer maxRows) { - this.maxRows = maxRows; - } - - /** - * @return Returns the postalAddressScheme. - */ - public String getPostalAddressScheme() { - return postalAddressScheme; - } - - /** - * @param postalAddressScheme The postalAddressScheme to set. - */ - public void setPostalAddressScheme(String postalAddressScheme) { - this.postalAddressScheme = postalAddressScheme; - } - - /** - * @return Returns the queryManagerURL. - */ - public String getQueryManagerURL() { - return queryManagerURL; - } - - /** - * @param queryManagerURL The queryManagerURL to set. - */ - public void setQueryManagerURL(String queryManagerURL) { - this.queryManagerURL = queryManagerURL; - } - - /** - * @return Returns the semanticEquivalences. - */ - public String getSemanticEquivalences() { - return semanticEquivalences; - } - - /** - * @param semanticEquivalences The semanticEquivalences to set. - */ - public void setSemanticEquivalences(String semanticEquivalences) { - this.semanticEquivalences = semanticEquivalences; - } - -} diff --git a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/jonas-ra.xml b/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/jonas-ra.xml deleted file mode 100644 index 1c2a499d11b75bb8e88c268f5e219262cbe75834..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/jonas-ra.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - javax.xml.registry.ConnectionFactory - eis/JAXR - - - diff --git a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/ra.xml b/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/ra.xml deleted file mode 100644 index a57e1497b6a53ba47d02d2912ddfc382ccfd433e..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/glue/src/main/java/org/objectweb/jonas/jaxr/scout/ra.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - JOnAS JAX-R RA - Objectweb - JAX-R - 1 - - - org.objectweb.jonas.jaxr.scout.JAXRResourceAdapter - - - - - org.objectweb.jonas.jaxr.scout.ManagedConnectionFactoryImpl - - - queryManagerURL - java.lang.String - http://localhost:9000/juddi/inquiry - - - lifeCycleManagerURL - java.lang.String - http://localhost:9000/juddi/publish - - - semanticEquivalences - java.lang.String - - - - authenticationMethod - java.lang.String - UDDI_GET_AUTHTOKEN - - - maxRows - java.lang.Integer - 100 - - - postalAddressScheme - java.lang.String - - - - javax.xml.registry.ConnectionFactory - - - org.objectweb.jonas.jaxr.scout.JConnectionFactory - - - javax.xml.registry.Connection - - - org.apache.ws.scout.registry.ConnectionImpl - - - NoTransaction - false - - - diff --git a/jonas/modules/ee-components/jca/scout/pom.xml b/jonas/modules/ee-components/jca/scout/pom.xml deleted file mode 100644 index fd33d5bc1cfe1a0670839154cc220e3cedb6c276..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - org.objectweb.jonas - jonas-jca - 5.0.0-SNAPSHOT - - 4.0.0 - org.objectweb.jonas - jonas-jca-scout - pom - JOnAS :: EE Components :: JCA :: Scout - - - glue - rar - - - diff --git a/jonas/modules/ee-components/jca/scout/rar/pom.xml b/jonas/modules/ee-components/jca/scout/rar/pom.xml deleted file mode 100644 index 10593620ffbb465d15e70d75151b269544839af9..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/rar/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - org.objectweb.jonas - jonas-jca-scout - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-jca-scout-rar - rar - JOnAS :: EE Components :: JCA :: Scout :: RAR - - - - org.objectweb.jonas - jonas-jca-scout-glue - ${jonas.version} - - - - - scout_for_jonas_ra - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jca/scout/rar/src/main/rar/META-INF/jonas-ra.xml b/jonas/modules/ee-components/jca/scout/rar/src/main/rar/META-INF/jonas-ra.xml deleted file mode 100644 index 1c2a499d11b75bb8e88c268f5e219262cbe75834..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/rar/src/main/rar/META-INF/jonas-ra.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - javax.xml.registry.ConnectionFactory - eis/JAXR - - - diff --git a/jonas/modules/ee-components/jca/scout/rar/src/main/rar/META-INF/ra.xml b/jonas/modules/ee-components/jca/scout/rar/src/main/rar/META-INF/ra.xml deleted file mode 100644 index a57e1497b6a53ba47d02d2912ddfc382ccfd433e..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jca/scout/rar/src/main/rar/META-INF/ra.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - JOnAS JAX-R RA - Objectweb - JAX-R - 1 - - - org.objectweb.jonas.jaxr.scout.JAXRResourceAdapter - - - - - org.objectweb.jonas.jaxr.scout.ManagedConnectionFactoryImpl - - - queryManagerURL - java.lang.String - http://localhost:9000/juddi/inquiry - - - lifeCycleManagerURL - java.lang.String - http://localhost:9000/juddi/publish - - - semanticEquivalences - java.lang.String - - - - authenticationMethod - java.lang.String - UDDI_GET_AUTHTOKEN - - - maxRows - java.lang.Integer - 100 - - - postalAddressScheme - java.lang.String - - - - javax.xml.registry.ConnectionFactory - - - org.objectweb.jonas.jaxr.scout.JConnectionFactory - - - javax.xml.registry.Connection - - - org.apache.ws.scout.registry.ConnectionImpl - - - NoTransaction - false - - - diff --git a/jonas/modules/ee-components/jonas-admin/pom.xml b/jonas/modules/ee-components/jonas-admin/pom.xml deleted file mode 100644 index 97c26d7a1ef36314743aabc367ad63dc8a668f3c..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - org.objectweb.jonas - jonas-ee-components - 5.0.0-SNAPSHOT - - 4.0.0 - jonas-admin - war - JOnAS :: EE Components :: JOnAS Admin Console - - - - - - org.apache.tomcat - servlet-api - provided - - - org.apache.tomcat - jsp-api - provided - - - org.objectweb.jonas - jonas-commons - ${jonas.version} - provided - - - org.objectweb.jonas - jonas-jmx - ${jonas.version} - provided - - - org.objectweb.jonas - jonas-domain - ${jonas.version} - provided - - - struts - struts - 1.2.9 - - - commons-beanutils - commons-beanutils - - - commons-logging - commons-logging - - - commons-validator - commons-validator - - - oro - oro - - - xml-apis - xml-apis - - - antlr - antlr - - - xalan - xalan - - - - - commons-io - commons-io - 1.2 - - - commons-fileupload - commons-fileupload - 1.1.1 - - - commons-digester - commons-digester - - - commons-beanutils - commons-beanutils - - - commons-collections - commons-collections - - - commons-logging - commons-logging - - - xml-apis - xml-apis - - - - - velocity - velocity-dep - 1.4 - - - commons-beanutils - commons-beanutils - 1.7.0 - provided - - - - - jonasAdmin - - \ No newline at end of file diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ApplicationLocales.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ApplicationLocales.java deleted file mode 100644 index f5bb21f75fefae4921df53662446668937147cd0..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ApplicationLocales.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Struts", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.ResourceBundle; - -import org.apache.struts.Globals; -import org.apache.struts.action.ActionServlet; -import org.apache.struts.util.MessageResources; - -/** - * Class to hold the Locales supported by this package. - * - * @author Patrick Luby - * @author Craig R. McClanahan - * @version $Revision$ $Date$ - */ - -public final class ApplicationLocales { - -// ----------------------------------------------------------- Constructors - - /** - * Initialize the set of Locales supported by this application. - * - * @param servlet ActionServlet we are associated with - */ - public ApplicationLocales(ActionServlet servlet) { - - super(); - Locale list[] = Locale.getAvailableLocales(); - MessageResources resources = (MessageResources) - servlet.getServletContext().getAttribute(Globals.MESSAGES_KEY); - if (resources == null) { - return; - } - String config = resources.getConfig(); - if (config == null) { - return; - } - for (int i = 0; i < list.length; i++) { - ResourceBundle bundle = ResourceBundle.getBundle(config, list[i]); - if (bundle == null) { - continue; - } - if (list[i].equals(bundle.getLocale())) { - localeLabels.add(list[i].getDisplayName()); - localeValues.add(list[i].toString()); - supportedLocales.add(list[i]); - } - } - - } - -// ----------------------------------------------------- Instance Variables - - /** - * The set of Locale labels supported by this application. - */ - protected ArrayList localeLabels = new ArrayList(); - - /** - * The set of Locale values supported by this application. - */ - protected ArrayList localeValues = new ArrayList(); - - /** - * The set of supported Locales for this application. - */ - protected ArrayList supportedLocales = new ArrayList(); - -// --------------------------------------------------------- Public Methods - - /** - * Return the set of Locale labels supported by this application. - */ - public List getLocaleLabels() { - - return (localeLabels); - - } - - /** - * Return the set of Locale values supported by this application. - */ - public List getLocaleValues() { - - return (localeValues); - - } - - /** - * Return the set of Locales supported by this application. - */ - public List getSupportedLocales() { - - return (supportedLocales); - - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ApplyTopAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ApplyTopAction.java deleted file mode 100644 index fe201218f826ffe3497f961313eae59aeecd27cb..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ApplyTopAction.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionMessage; -import org.apache.struts.action.ActionMessages; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - - -/** - * @author Michel-Ange Anton (initial developer)
- * @author Adriana Danes - * @author Florent Benoit (changes for struts 1.2.2) - */ -public class ApplyTopAction extends JonasBaseAction { - -// --------------------------------------------------------- Public Methods - - public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form, HttpServletRequest p_Request - , HttpServletResponse p_Response) - throws IOException, ServletException { - - // Forward control back to the ActionEditTop - return (p_Mapping.findForward("ActionEditTop")); - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/EditTopAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/EditTopAction.java deleted file mode 100644 index dde6e389908c9ffcee3f48c43479222598cdffed..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/EditTopAction.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; -import java.util.ArrayList; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.Globals; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.objectweb.jonas.common.Log; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * Test Action that handles events from the tree control test - * page. - * @author Michel-Ange Anton (initial developer)
- * @author Florent Benoit (changes for struts 1.2.2) - */ - -public class EditTopAction extends JonasBaseAction { - -// --------------------------------------------------------- Public Methods - - /** - * Process the specified HTTP request, and create the corresponding HTTP - * response (or forward to another web component that will create it). - * Return an ActionForward instance describing where and how - * control should be forwarded, or null if the response has - * already been completed. - * - * @param mapping The ActionMapping used to select this instance - * @param actionForm The optional ActionForm bean for this request (if any) - * @param request The HTTP request we are processing - * @param response The HTTP response we are creating - * - * @exception IOException if an input/output error occurs - * @exception ServletException if a servlet exception occurs - */ - public ActionForward executeAction(ActionMapping mapping, ActionForm form, HttpServletRequest request - , HttpServletResponse response) - throws IOException, ServletException { - - // Test if force to reload all the frames - ActionErrors oActionErrors = (ActionErrors) request.getAttribute(Globals.ERROR_KEY); - if (oActionErrors != null) { - request.setAttribute("errorServerSelect", new Boolean(true)); - } else { - String sFirstCall = request.getParameter("firstCall"); - if (sFirstCall == null) { - request.setAttribute("reloadAll", new Boolean(true)); - } - } - - // Form used - TopForm topFm = new TopForm(); - request.setAttribute("topForm", topFm); - try { - String serverName = m_WhereAreYou.getCurrentJonasServerName(); - topFm.setServerSelect(serverName); - } catch (Throwable t) { - String message = "Problem when accessing to JOnAS ! : " + t.getMessage(); - //getServlet().log(message, t); - Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, message); - } - response.sendError(HttpServletResponse.SC_BAD_REQUEST, message); - return (null); - } - - // Forward to the jsp. - return (mapping.findForward("Top")); - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JettyObjectName.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JettyObjectName.java deleted file mode 100644 index 011dd3d068978a18d767b652f91ac9415ac828e5..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JettyObjectName.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import javax.management.ObjectName; - -/** - * A set of static classes used to build the names of Jetty MBeans used in JOnAS. - * - * @author Michel-Ange ANTON - */ -public class JettyObjectName { - - public static ObjectName jettyServer(String pDomain) { - try { - return new ObjectName(pDomain + ":type=webContainer,name=Jetty"); - } catch (javax.management.MalformedObjectNameException e) { - // this should never occur - return null; - } - } - - public static ObjectName jettyContexts(String pDomain) { - try { - return new ObjectName(pDomain + ":type=webContainer,name=Jetty,*"); - } catch (javax.management.MalformedObjectNameException e) { - // this should never occur - return null; - } - } - - public static ObjectName jettyContexts(String pDomain, String pPath) { - try { - return new ObjectName(pDomain + ":type=webContainer,name=Jetty,context=" + pPath + ",*"); - } catch (javax.management.MalformedObjectNameException e) { - // this should never occur - return null; - } - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/Jlists.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/Jlists.java deleted file mode 100644 index bee5d74405b3990917f14c1b42030b574240eb1c..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/Jlists.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.StringTokenizer; - -import org.objectweb.jonas.webapp.taglib.LabelValueBean; - -/** - * General purpose utility methods to create lists of objects that are - * commonly required in building the user interface. In all cases, if there - * are no matching elements, a zero-length list (rather than null) - * is returned. - * - * @author Craig R. McClanahan - * @version $Revision$ $Date$ - */ - -public class Jlists { - -// --------------------------------------------------------- Constants - - public final static String SEPARATOR = ","; - -// ----------------------------------------------------------- Constructors - - /** - * Protected constructor to prevent instantiation. - */ - protected Jlists() {} - -// ------------------------------------------------------- Static Variables - - /** - * Precomputed list of debug level labels and values. - */ - private static List debugLevels = new ArrayList(); - - static { - debugLevels.add(new LabelValueBean("0", "0")); - debugLevels.add(new LabelValueBean("1", "1")); - debugLevels.add(new LabelValueBean("2", "2")); - debugLevels.add(new LabelValueBean("3", "3")); - debugLevels.add(new LabelValueBean("4", "4")); - debugLevels.add(new LabelValueBean("5", "5")); - debugLevels.add(new LabelValueBean("6", "6")); - debugLevels.add(new LabelValueBean("7", "7")); - debugLevels.add(new LabelValueBean("8", "8")); - debugLevels.add(new LabelValueBean("9", "9")); - } - - /** - * Precomputed list of verbosity level labels and values. - */ - private static List verbosityLevels = new ArrayList(); - - static { - verbosityLevels.add(new LabelValueBean("0", "0")); - verbosityLevels.add(new LabelValueBean("1", "1")); - verbosityLevels.add(new LabelValueBean("2", "2")); - verbosityLevels.add(new LabelValueBean("3", "3")); - verbosityLevels.add(new LabelValueBean("4", "4")); - } - - /** - * Precomputed list of Jonas logger level labels and values. - */ - private static List loggerJonasLevels = new ArrayList(); - - static { - loggerJonasLevels.add(new LabelValueBean("DEBUG", "DEBUG")); - loggerJonasLevels.add(new LabelValueBean("WARN", "WARN")); - loggerJonasLevels.add(new LabelValueBean("INFO", "INFO")); - loggerJonasLevels.add(new LabelValueBean("ERROR", "ERROR")); - loggerJonasLevels.add(new LabelValueBean("INHERIT", "INHERIT")); - } - - /** - * Precomputed list of (true,false) labels and values. - */ - private static List booleanValues = new ArrayList(); - - static { - booleanValues.add(new LabelValueBean("True", "true")); - booleanValues.add(new LabelValueBean("False", "false")); - } - - /** - * Precomputed list of JdbcConnectionCheckingLevel labels and values. - */ - private static List jdbcConnectionCheckingLevels = new ArrayList(); - - static { - jdbcConnectionCheckingLevels.add(new LabelValueBean("0", "0")); - jdbcConnectionCheckingLevels.add(new LabelValueBean("1", "1")); - jdbcConnectionCheckingLevels.add(new LabelValueBean("2", "2")); - jdbcConnectionCheckingLevels.add(new LabelValueBean("3", "3")); - } - - /** - * Precomputed list of SpecVersions labels and values. - */ - private static List specVersion = new ArrayList(); - - static { - specVersion.add(new LabelValueBean("1.0", "1.0")); - specVersion.add(new LabelValueBean("1.5", "1.5")); - } - - /** - * Precomputed list of SecurityAuthenticationLdap labels and values. - */ - private static List securityAuthenticationLdapValues = new ArrayList(); - - static { - securityAuthenticationLdapValues.add(new LabelValueBean("none", "none")); - securityAuthenticationLdapValues.add(new LabelValueBean("simple", "simple")); - securityAuthenticationLdapValues.add(new LabelValueBean("strong", "strong")); - securityAuthenticationLdapValues.add(new LabelValueBean("CRAM-MD5", "CRAM-MD5")); - securityAuthenticationLdapValues.add(new LabelValueBean("DIGEST-MD5", "DIGEST-MD5")); - } - - /** - * Precomputed list of AuthenticationModeLdapValues labels and values. - */ - private static List authenticationModeLdapValues = new ArrayList(); - - static { - authenticationModeLdapValues.add(new LabelValueBean("compare", "compare")); - authenticationModeLdapValues.add(new LabelValueBean("bind", "bind")); - } - - /** - * Precomputed list of securityAlgorithms labels and values. - */ - private static List securityAlgorithms = new ArrayList(); - - static { - securityAlgorithms.add(new LabelValueBean("", "")); - securityAlgorithms.add(new LabelValueBean("MD5", "MD5")); - securityAlgorithms.add(new LabelValueBean("MD2", "MD2")); - securityAlgorithms.add(new LabelValueBean("SHA-1", "SHA-1")); - securityAlgorithms.add(new LabelValueBean("SHA", "SHA")); - } - -// --------------------------------------------------------- Public Methods - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for debug properties. - */ - public static List getDebugLevels() { - return (debugLevels); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for verbosity properties. - */ - public static List getVerbosityLevels() { - return (verbosityLevels); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for boolean properties. - */ - public static List getBooleanValues() { - return (booleanValues); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for Logger Jonas Levels properties. - */ - public static List getLoggerJonasLevels() { - return (loggerJonasLevels); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for Jdbc Connection Checking Levels properties. - */ - public static List getJdbcConnectionCheckingLevels() { - return (jdbcConnectionCheckingLevels); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for Spec-Version property. - * @return a List of legal values. - */ - public static List getSpecVersion() { - return (specVersion); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for SecurityAuthenticationLdap properties. - */ - public static List getSecurityAuthenticationLdapValues() { - return (securityAuthenticationLdapValues); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for AuthenticationModeLdap properties. - */ - public static List getAuthenticationModeLdapValues() { - return (authenticationModeLdapValues); - } - - /** - * Return a List of {@link LabelValueBean}s for the legal - * settings for SecurityAlgorithms properties. - */ - public static List getSecurityAlgorithms() { - return (securityAlgorithms); - } - - /** - * Transform the collection like a string, each element are separated by the separator. - * - * @param p_Collection The collection to transform - * @param p_Separator The separator - * @return The collection string - */ - public static String getString(Collection p_Collection, String p_Separator) { - StringBuffer sb = new StringBuffer(); - Iterator it = p_Collection.iterator(); - while (it.hasNext()) { - sb.append(it.next()); - if (it.hasNext()) { - sb.append(p_Separator); - } - } - return sb.toString(); - } - - /** - * Transform the string like a ArrayString, each element are separated by the separator. - * - * @param p_String - * @param p_Separator The separator - * @return The list - */ - public static ArrayList getArrayList(String p_String, String p_Separator) { - ArrayList al = new ArrayList(); - StringTokenizer st = new StringTokenizer(p_String, p_Separator); - while (st.hasMoreTokens()) { - al.add(st.nextToken().trim()); - } - return al; - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JmsConnFact.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JmsConnFact.java deleted file mode 100644 index d0c63caa695d50deff8cb724626627a1a2e6281e..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JmsConnFact.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -public final class JmsConnFact { - private String name = null; - private String comment = null; - - protected JmsConnFact(String name, String comment) { - this.name = name; - this.comment = comment; - } - - public String getName() { - return name; - } - - public String getComment() { - return comment; - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasAdminException.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasAdminException.java deleted file mode 100644 index 276a4316f3d6c2c0816e6799918092be2657d1a9..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasAdminException.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import org.objectweb.jonas.service.ServiceException; - -/** - * JOnAS Administration Application Exception. - * Generic exception for all troubles of the JOnAS Administration Application. - * - * @author Michel-Ange ANTON - */ - -public class JonasAdminException extends ServiceException { -// --------------------------------------------------------- Protected variables - - /** - * Error ID - */ - protected String m_Id = null; - -// --------------------------------------------------------- Public Methods - - public JonasAdminException(String p_Id, String p_Message, Throwable p_Throwable) { - super(p_Message, p_Throwable); - m_Id = p_Id; - } - - public JonasAdminException(String p_Id, String p_Message) { - super(p_Message); - m_Id = p_Id; - } - - public JonasAdminException(String p_Id) { - super(""); - m_Id = p_Id; - } - - /** - * Accessor to the error ID. - * @return String The error ID - */ - public String getId() { - return m_Id; - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasAdminJmx.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasAdminJmx.java deleted file mode 100644 index 0de9393a157a8632415d2cb01e9222efa8945a20..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasAdminJmx.java +++ /dev/null @@ -1,1221 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; - -import org.apache.struts.util.MessageResources; -import org.objectweb.jonas.jmx.oname.J2eeObjectName; -import org.objectweb.jonas.jmx.oname.JonasObjectName; -import org.objectweb.jonas.mail.MailService; -import org.objectweb.jonas.webapp.jonasadmin.common.BeanComparator; -import org.objectweb.jonas.webapp.jonasadmin.common.CatalinaObjectName; -import org.objectweb.jonas.webapp.jonasadmin.logging.LoggerItem; -import org.objectweb.jonas.webapp.jonasadmin.mbean.MbeanItem; -import org.objectweb.jonas.webapp.jonasadmin.service.container.WebAppItem; - -/** - * Helper class supporting manipulation of MBeans (accessing MBeans). - * @author Michel-Ange ANTON

- * Contributors: Adriana Danes - */ -public class JonasAdminJmx { - -// ----------------------------------------------------------- Constants - - private static Object s_Synchro = new Object(); - -// ----------------------------------------------------------- Constructors - - /** - * Protected constructor to prevent instantiation. - */ - protected JonasAdminJmx() { - } - -// --------------------------------------------------------- Public Methods - - /** - * Replace any occurrence of the specified placeholder in the specified - * template string with the specified replacement value. - * - * @param template Pattern string possibly containing the placeholder - * @param placeholder Placeholder expression to be replaced - * @param value Replacement value for the placeholder - * @return A complete string - */ - public static String replace(String template, String placeholder, String value) { - if (template == null) { - return (null); - } - if ((placeholder == null) || (value == null)) { - return (template); - } - String sRet = new String(template); - while (true) { - int index = sRet.indexOf(placeholder); - if (index < 0) { - break; - } - StringBuffer temp = new StringBuffer(sRet.substring(0, index)); - temp.append(value); - temp.append(sRet.substring(index + placeholder.length())); - sRet = temp.toString(); - } - return (sRet); - - } - - public static ObjectName getArchiveConfigObjectName(String domainName, String serverName) { - ObjectName onUtils = JonasObjectName.ArchiveConfig(domainName); - return getFirstMbean(onUtils, serverName); - } - - public static ObjectName getRarConfigObjectName(String domainName, String serverName) { - ObjectName onUtils = JonasObjectName.RarConfig(domainName); - return getFirstMbean(onUtils, serverName); - } - - /** - * Return the ObjectName corresponding to the J2EEServer managed object registered in the - * current MBeanServer and belonging to a domain. - * We should have one ObjectName corresponding to the current JOnAS server instance. - * @param p_DomainName The name of the management domain. - * @return an ObjectName which corresponds to a J2EEServer ObjectName pattern or null if - * no J2EEServer found for the given management domain - * (having j2eeType key property equal to J2EEServer) - * @throws ManagementException if could not connect to the MBean server - */ - public static ObjectName getJ2eeServerObjectName(String p_DomainName, String serverName) throws ManagementException { - // Lookup for a J2EEServer managed object in the current MBeanServer - ObjectName pattern_server_on = J2eeObjectName.J2EEServers(p_DomainName); - ObjectName server_on = null; - Iterator it = JonasManagementRepr.queryNames(pattern_server_on, serverName).iterator(); - if (it.hasNext()) { - // Got one J2EEServer managed object ; normally should not be more than one - server_on = (ObjectName) it.next(); - } - return server_on; - } - - /** - * Return the ObjectName corresponding to the J2EEServer managed object registered in the - * current MBeanServer. This method is used by EditTopAction to determine the list of - * JOnAS servers registered in the current registry (this code is particular to the current - * domain concept implementation). - * We should have one ObjectName corresponding to the current JOnAS server instance. - * @return an ObjectName which corresponds to a J2EEServer ObjectName pattern - * (having j2eeType key property equal to J2EEServer) - */ - public static ObjectName getJ2eeServerObjectName(String serverName) { - // Lookup for a J2EEServer managed object in the current MBeanServer - ObjectName pattern_server_on = J2eeObjectName.J2EEServers(); - ObjectName server_on = null; - Iterator it = JonasManagementRepr.queryNames(pattern_server_on, serverName).iterator(); - if (it.hasNext()) { - // Got one J2EEServer managed object ; normally should not be more than one - server_on = (ObjectName) it.next(); - } - return server_on; - } - - /** - * Verify if the Mbean gotten by the query in the current MbeanServer exists. - * - * @param p_On Query Mbean name to search - * @return true if MBean exists - * @throws ManagementException - */ - public static boolean hasMBeanName(ObjectName p_On, String serverName) - throws ManagementException { - synchronized (s_Synchro) { - ArrayList al = new ArrayList(); - Iterator itNames = JonasManagementRepr.queryNames(p_On, serverName).iterator(); - if (itNames.hasNext()) { - return true; - } - return false; - } - } - - /** - * Return the first Mbean name gotten by the query in the current MbeanServer. - * - * @param p_On Query Mbean name to search - * @return The first MBean name or null if not found - * @throws ManagementException - */ - public static String getFirstMBeanName(ObjectName p_On, String serverName) - throws ManagementException { - synchronized (s_Synchro) { - ArrayList al = new ArrayList(); - Iterator itNames = JonasManagementRepr.queryNames(p_On, serverName).iterator(); - if (itNames.hasNext()) { - return itNames.next().toString(); - } - return null; - } - } - - /** - * Return the list of Mbean name gotten by the query in the current MbeanServer. - * - * @param p_On Query Mbean name to search - * @return A list of string Mbean name - */ - public static List getListMBeanName(ObjectName p_On, String serverName) { - synchronized (s_Synchro) { - ArrayList al = new ArrayList(); - Iterator itNames = JonasManagementRepr.queryNames(p_On, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName item = (ObjectName) itNames.next(); - al.add(item.toString()); - } - Collections.sort(al); - return al; - } - } - - /** - * Return the first ObjectName Mbean gotten by the query - * in the current MbeanServer. - * - * @param p_On Query Mbean name to search - * @return The first ObjectName or null if not found - * @throws ManagementException - */ - public static ObjectName getFirstMbean(ObjectName p_On, String serverName) - throws ManagementException { - synchronized (s_Synchro) { - Iterator itNames = JonasManagementRepr.queryNames(p_On, serverName).iterator(); - if (itNames.hasNext()) { - return (ObjectName) itNames.next(); - } - return null; - } - } - - /** - * Return the list of ObjectName Mbean gotten by the query - * in the current MbeanServer. - * - * @param p_On Query Mbeans to search - * @return The list of ObjectName - * @throws ManagementException - */ - public static List getListMbean(ObjectName p_On, String serverName) - throws ManagementException { - synchronized (s_Synchro) { - ArrayList al = new ArrayList(); - Iterator itNames = JonasManagementRepr.queryNames(p_On, serverName).iterator(); - while (itNames.hasNext()) { - al.add(itNames.next()); - } - return al; - } - } - - /** - * Extract the value of a key property from the MBean name. - * This method is usefull when we have the String form and not the ObjectName - * (avoid creating an ObjectName instance). - * @param pName Name of the key property - * @param pMBeanName Stringified ObjectName - * @return The value or null if not found - */ - public static String extractValueMbeanName(String pName, String pMBeanName) { - String sValue = null; - try { - String sSearch = pName.trim() + "="; - int iPos = pMBeanName.indexOf(sSearch); - if (iPos > -1) { - sValue = pMBeanName.substring(iPos + sSearch.length()); - iPos = sValue.indexOf(","); - if (iPos > -1) { - sValue = sValue.substring(0, iPos); - } - } - } catch (NullPointerException e) { - // none - sValue = null; - } - return sValue; - } - - /** - * Extract the filename of complete path. - * - * @param p_Path Complete path (directory and filename) - * @return The filename or null - */ - public static String extractFilename(String p_Path) { - String sFilename = null; - try { - int iPosSeparator = p_Path.lastIndexOf("/"); - if (iPosSeparator < 0) { - iPosSeparator = p_Path.lastIndexOf("\\"); - if (iPosSeparator < 0) { - sFilename = new String(p_Path); - } - else { - sFilename = p_Path.substring(iPosSeparator + 1); - } - } - else { - sFilename = p_Path.substring(iPosSeparator + 1); - } - if (sFilename.length() > 0) { - int iPos_1 = p_Path.indexOf(DIR_AUTOLOAD + "/" + sFilename); - int iPos_2 = p_Path.indexOf(DIR_AUTOLOAD + "\\" + sFilename); - if (iPos_1 > -1) { - sFilename = DIR_AUTOLOAD + "/" + sFilename; - } - else if (iPos_2 > -1) { - sFilename = DIR_AUTOLOAD + "\\" + sFilename; - } - } - else { - sFilename = null; - } - } - catch (NullPointerException e) { - // none action - sFilename = null; - } - return sFilename; - } - - /** - * - */ - private static String DIR_RARS = "rars"; - private static String DIR_AUTOLOAD = "autoload"; - private static String DIR_CONF = "conf"; - - private static ArrayList getFilenames(String p_Directory, String p_Extension) { - ArrayList al = new ArrayList(); - String sExt = "." + p_Extension.toLowerCase(); - String sFile; - - File oFile = new File(p_Directory); - String[] asFiles = oFile.list(); - int iPos; - if (asFiles != null) { - for (int i = 0; i < asFiles.length; i++) { - oFile = new File(p_Directory, asFiles[i]); - if (oFile.isFile() == true) { - sFile = oFile.getName().toLowerCase(); - iPos = sFile.lastIndexOf(sExt); - if (iPos > -1) { - if (iPos == (sFile.length() - sExt.length())) { - al.add(oFile.getName()); - } - } - } - } - } - Collections.sort(al); - return al; - } - - private static ArrayList getDirectories(String p_Directory) { - ArrayList al = new ArrayList(); - String sFile; - - File oFile = new File(p_Directory); - String[] asFiles = oFile.list(); - - if (asFiles != null) { - for (int i = 0; i < asFiles.length; i++) { - oFile = new File(p_Directory, asFiles[i]); - if (oFile.isDirectory() == true) { - al.add(oFile.getName()); - } - } - } - Collections.sort(al); - return al; - } - - private static void appendDirectory(ArrayList p_List, String p_Dir) { - String sDir = p_Dir + "/"; - for (int i = 0; i < p_List.size(); i++) { - p_List.set(i, sDir + p_List.get(i)); - } - } - - /** - * Return the list of JAR filename ready to deploy in the current server. - * - * @return The list of JAR filename. - * @throws ManagementException - */ - public static ArrayList getJarFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployableJars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getJarsDirectory", null, null, serverName); - - String sEarDir = null; - try { - sEarDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - } catch (Exception e) { - // nothing, Ear service not found - } - return prepareContainersToDisplay(al, sDir, sEarDir); - } - - /** - * Return the list of deployed JAR filename in the current server. - * - * @return The list of JAR filename. - * @throws ManagementException - */ - public static ArrayList getJarFilesDeployed(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployedJars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getJarsDirectory", null, null, serverName); - - String sEarDir = null; - try { - sEarDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - } catch (Exception e) { - // nothing, Ear service not found - } - return prepareContainersToDisplay(al, sDir, sEarDir); - } - - /** - * Return the list of EAR filename ready to deploy in the current server. - * - * @return The list of EAR filename. - * @throws ManagementException - */ - public static ArrayList getEarFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployableEars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", null, null, serverName); - return prepareContainersToDisplay(al, sDir, null); - } - - /** - * Return the list of WAR filename ready to deploy in the current server. - * - * @return The list of WAR filename. - * @throws ManagementException - */ - public static ArrayList getWarFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployableWars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getWarsDirectory", null, null, serverName); - - String sEarDir = null; - try { - sEarDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - } catch (Exception e) { - // nothing, Ear service not found - } - return prepareContainersToDisplay(al, sDir, sEarDir); - } - - /** - * Return the list of RAR filename ready to deploy in the current server. - * - * @return The list of RAR filename. - * @throws ManagementException - */ - public static ArrayList getRarFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployableRars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getRarsDirectory", new Object[0], new String[0], serverName); - - String sEarDir = null; - try { - sEarDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - } catch (Exception e) { - // nothing, Ear service not found - } - return prepareContainersToDisplay(al, sDir, sEarDir); - } - - /** - * Return the list of deployed WAR filename in the current server. - * - * @return The list of WAR filename. - * @throws ManagementException - */ - public static ArrayList getWarFilesDeployed(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployedWars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getWarsDirectory", new Object[0], new String[0], serverName); - String sEarDir = null; - try { - sEarDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - } catch (ManagementException e) { - // nothing, Ear service not found - } - return prepareContainersToDisplay(al, sDir, sEarDir); - } - - /** - * Return the list of deployed EAR filename in the current server. - * - * @return The list of EAR filename. - * @throws ManagementException - */ - public static ArrayList getEarFilesDeployed(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployedEars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - return prepareContainersToDisplay(al, sDir, null); - } - - /** - * Return the list of deployed RAR filename in the current server. - * - * @return The list of RAR filename. - * @throws ManagementException - */ - public static ArrayList getRarFilesDeployed(String domainName, String serverName) - throws ManagementException { - ObjectName on = J2eeObjectName.J2EEServer(domainName, serverName); - ArrayList al = (ArrayList) JonasManagementRepr.invoke(on, "getDeployedRars", new Object[0], new String[0], serverName); - String sDir = (String) JonasManagementRepr.invoke(on, "getRarsDirectory", new Object[0], new String[0], serverName); - - String sEarDir = null; - try { - sEarDir = (String) JonasManagementRepr.invoke(on, "getAppsDirectory", new Object[0], new String[0], serverName); - } catch (ManagementException e) { - // nothing, Ear service not found - } - return prepareContainersToDisplay(al, sDir, sEarDir); - } - - /** - * Prepare a list of containers to diplay. - * Deleting prefix root container directory, sorting the list. - * @param p_Containers The list of containers - * @param p_ContainerDir The root container directory - * @param p_EarDir The root ear directory or null - * @return The list of containers ready to display - */ - public static ArrayList prepareContainersToDisplay(ArrayList p_Containers - , String p_ContainerDir, String p_EarDir) { - int iPos; - String sPath; - boolean bAdd; - ArrayList al = new ArrayList(); - for (int i = 0; i < p_Containers.size(); i++) { - // Delete prefix root container directory - sPath = p_Containers.get(i).toString(); - iPos = sPath.indexOf(p_ContainerDir); - if (iPos > -1) { - sPath = sPath.substring(p_ContainerDir.length()); - } - // Delete suffix slash - if (sPath.endsWith("/") == true) { - sPath = sPath.substring(0, sPath.length() - 1); - } - // Flag to filter - bAdd = true; - // Filter Jar or War include in Ear - if (p_EarDir != null) { - iPos = sPath.indexOf(p_EarDir); - if (iPos > -1) { - bAdd = false; - } - - } - if (bAdd == true) { - al.add(sPath); - } - } - // Sort - Collections.sort(al); - return al; - } - - private static ArrayList getFilesDeployed(ObjectName on, String serverName) - throws ManagementException { - ArrayList alDeployed = new ArrayList(); - String sPath; - String sFile; - Iterator itNames = JonasAdminJmx.getListMBeanName(on, serverName).iterator(); - while (itNames.hasNext()) { - sPath = JonasAdminJmx.extractValueMbeanName("fname", itNames.next().toString()); - sFile = JonasAdminJmx.extractFilename(sPath); - if (sFile != null) { - alDeployed.add(sFile); - } - } - Collections.sort(alDeployed); - return alDeployed; - - } - - /** - * Return the list of Mail factory files ready to deploy in the current server. - * - * @return The list of Mail factory properties filenames. - * @throws ManagementException - */ - public static ArrayList getMailFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = JonasObjectName.mailService(domainName); - return (ArrayList) JonasManagementRepr.invoke(on, "getMailFactoryPropertiesFiles", new Object[0], new String[0], serverName); - } - - /** - * Return the list of MimePartDataSource Mail factory files ready to deploy in the current server. - * - * @return The list of MimePartDataSource Mail factory properties filenames. - * @throws ManagementException - */ - public static ArrayList getMimePartMailFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = JonasObjectName.mailService(domainName); - return (ArrayList) JonasManagementRepr.invoke(on - , "getMimePartMailFactoryPropertiesFiles", new Object[0], new String[0], serverName); - } - - /** - * Return the list of Session Mail factory files ready to deploy in the current server. - * - * @return The list of Session Mail factory properties filenames. - * @throws ManagementException - */ - public static ArrayList getSessionMailFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = JonasObjectName.mailService(domainName); - return (ArrayList) JonasManagementRepr.invoke(on, "getSessionMailFactoryPropertiesFiles", new Object[0], new String[0], serverName); - } - - /** - * Return the list of deployed MimePartDataSource Mail factories in the current server. - * - * @param p_WhereAreYou The container WhereAreYou - * @return The list of MimePartDataSource Mail factory filename. - * @throws ManagementException - */ - public static ArrayList getMimePartMailFilesDeployed(WhereAreYou p_WhereAreYou) - throws ManagementException { - ArrayList alDeployed = new ArrayList(); - String sName; - String domainName = p_WhereAreYou.getCurrentDomainName(); - String serverName = p_WhereAreYou.getCurrentJonasServerName(); - ObjectName on = J2eeObjectName.JavaMailResources(domainName, serverName - , MailService.MIMEPART_PROPERTY_TYPE); - Iterator itNames = JonasManagementRepr.queryNames(on, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName it_on = (ObjectName) itNames.next(); - sName = it_on.getKeyProperty("name"); - if (sName != null) { - alDeployed.add(sName); - } - } - Collections.sort(alDeployed); - return alDeployed; - } - - /** - * Return the list of deployed Session Mail factories in the current server. - * - * @param p_WhereAreYou The container WhereAreYou - * @return The list of Session Mail factory filename. - * @throws ManagementException - */ - public static ArrayList getSessionMailFilesDeployed(WhereAreYou p_WhereAreYou) - throws ManagementException { - ArrayList alDeployed = new ArrayList(); - String sName; - String domainName = p_WhereAreYou.getCurrentDomainName(); - String serverName = p_WhereAreYou.getCurrentJonasServerName(); - ObjectName on = J2eeObjectName.JavaMailResources(domainName, serverName - , MailService.SESSION_PROPERTY_TYPE); - Iterator itNames = JonasManagementRepr.queryNames(on, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName it_on = (ObjectName) itNames.next(); - sName = it_on.getKeyProperty("name"); - if (sName != null) { - alDeployed.add(sName); - } - } - Collections.sort(alDeployed); - return alDeployed; - } - - /** - * Return the list of deployed Mail factories in the current server. - * - * @param p_WhereAreYou The container WhereAreYou - * @return The list of Mail factory filename. - * @throws ManagementException - */ - public static ArrayList getMailFilesDeployed(WhereAreYou p_WhereAreYou) - throws ManagementException { - ArrayList alDeployed = getSessionMailFilesDeployed(p_WhereAreYou); - alDeployed.addAll(getMimePartMailFilesDeployed(p_WhereAreYou)); - Collections.sort(alDeployed); - return alDeployed; - } - - /** - * Return the list of Datasource properties files ready to deploy in the current server. - * - * @return The list of Datasource properties filenames. - * @throws ManagementException Could not get managzement info from the MBeanServer - */ - public static ArrayList getDatasourceFilesDeployable(String domainName, String serverName) - throws ManagementException { - ObjectName on = JonasObjectName.databaseService(domainName); - return (ArrayList) JonasManagementRepr.getAttribute(on, "DataSourcePropertiesFiles", serverName); - } - - /** - * Return the list of deployed Datasources in the current server. - * @param domainName Current domain name - * @param serverName Current server name - * @return The list of Datasource filename. - * @throws ManagementException Could not get managzement info from the MBeanServer - */ - public static ArrayList getDatasourceFilesDeployed(String domainName, String serverName) - throws ManagementException { - - ArrayList alDeployed = new ArrayList(); - ObjectName ons = J2eeObjectName.JDBCDataSources(domainName, serverName); - // iterate ovent the JDBCDataSources within the current server - Iterator itNames = JonasManagementRepr.queryNames(ons, serverName).iterator(); - String sName = null; - while (itNames.hasNext()) { - ObjectName on = (ObjectName) itNames.next(); - sName = on.getKeyProperty("name"); - if (sName != null) { - alDeployed.add(sName); - } - } - Collections.sort(alDeployed); - return alDeployed; - } - - /** - * Return the list of Datasource dependences for a given datasource name in the current server. - * - * @param pDatasourceName The name of the datasource - * @param domainName Current domain name - * @param serverName Current server name - * @return The list of Datasource dependence (a list of names corresponding to EJBs using this datasource). - * @throws ManagementException Could not get managzement info from the MBeanServer - * @throws MalformedObjectNameException - */ - public static ArrayList getDatasourceDependences(String pDatasourceName, String domainName, String serverName) - throws ManagementException { - ObjectName jdbcDatasource = J2eeObjectName.getJDBCDataSource(domainName, serverName, pDatasourceName); - String[] asParam = new String[1]; - String[] asSignature = new String[1]; - asSignature[0] = "java.lang.String"; - ArrayList al = new ArrayList(); - asParam[0] = (String) JonasManagementRepr.getAttribute(jdbcDatasource, "jndiName", serverName); - if (JonasManagementRepr.isRegistered(JonasObjectName.ejbService(domainName), serverName)) { - String sName; - Iterator it = ((java.util.Set) JonasManagementRepr.invoke(JonasObjectName.ejbService(domainName) - , "getDataSourceDependence", asParam, asSignature, serverName)).iterator(); - while (it.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", it.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - } - return al; - } - - /** - * Return the list of Mail factory dependences in the current server for a given factory name. - * - * @param p_MailFactoryName The name of the mail factory - * @param p_WhereAreYou The container WhereAreYou - * @return The list of Mail factory dependences (a list of names corresponding to EJBs using this mail factory). - * @throws ManagementException - */ - public static ArrayList getMailFactoryDependences(String p_MailFactoryName - , WhereAreYou p_WhereAreYou) - throws ManagementException { - String jndiName = null; - String domainName = p_WhereAreYou.getCurrentDomainName(); - String serverName = p_WhereAreYou.getCurrentJonasServerName(); - String type = MailService.SESSION_PROPERTY_TYPE; - // create an MBean name with the given MailFactory name - // - try with a session Mail Factory type - ObjectName on = J2eeObjectName.JavaMailResource(domainName, p_MailFactoryName, serverName - , type); - //ObjectName on = JonasObjectName.sessionMailFactory(p_MailFactoryName); - if (JonasManagementRepr.isRegistered(on, serverName) != true) { - // in this case, this is a MimePartDataSource mail factory - //on = JonasObjectName.mimeMailFactory(p_MailFactoryName); - type = MailService.MIMEPART_PROPERTY_TYPE; - on = J2eeObjectName.JavaMailResource(domainName, p_MailFactoryName, serverName, type); - } - jndiName = (String) JonasManagementRepr.getAttribute(on, "Name", serverName); - - String[] asParam = new String[1]; - String[] asSignature = new String[1]; - asSignature[0] = "java.lang.String"; - ArrayList al = new ArrayList(); - asParam[0] = jndiName; - if (JonasManagementRepr.isRegistered(JonasObjectName.ejbService(domainName), serverName) == true) { - String sName; - Iterator it = ((java.util.Set) JonasManagementRepr.invoke(JonasObjectName.ejbService(domainName) - , "getMailFactoryDependence", asParam, asSignature, serverName)).iterator(); - while (it.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", it.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - } - return al; - } - - /** - * Return the list of deployed Session Mail Factories in the current server. - * - * @param p_WhereAreYou The container WhereAreYou - * @return The list - * @throws ManagementException - */ - public static ArrayList getSessionMailFactoriesDeployed(WhereAreYou p_WhereAreYou) - throws ManagementException { - - ArrayList alDeployed = new ArrayList(); - String sName; - String domainName = p_WhereAreYou.getCurrentDomainName(); - String serverName = p_WhereAreYou.getCurrentJonasServerName(); - String type = MailService.SESSION_PROPERTY_TYPE; - - ObjectName any_on = J2eeObjectName.JavaMailResources(domainName, serverName, type); - Iterator itNames = JonasManagementRepr.queryNames(any_on, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName on = (ObjectName) itNames.next(); - sName = on.getKeyProperty("name"); - if (sName != null) { - alDeployed.add(sName); - } - } - - Collections.sort(alDeployed); - return alDeployed; - } - - /** - * Return the list of deployed MimePartDatasource Mail Factories in the current server. - * - * @param p_WhereAreYou The container WhereAreYou - * @return The list - * @throws ManagementException - */ - public static ArrayList getMimeMailPartFactoriesDeployed(WhereAreYou p_WhereAreYou) - throws ManagementException { - ArrayList alDeployed = new ArrayList(); - String sName; - String domainName = p_WhereAreYou.getCurrentDomainName(); - String serverName = p_WhereAreYou.getCurrentJonasServerName(); - String type = MailService.MIMEPART_PROPERTY_TYPE; - - ObjectName any_on = J2eeObjectName.JavaMailResources(domainName, serverName, type); - Iterator itNames = JonasManagementRepr.queryNames(any_on, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName on = (ObjectName) itNames.next(); - sName = on.getKeyProperty("name"); - if (sName != null) { - alDeployed.add(sName); - } - } - Collections.sort(alDeployed); - return alDeployed; - } - - /** - * Return the list of Security Memory Factories in the current server. - * - * @return The list of Security Memory Factories - * @throws MalformedObjectNameException - */ - public static ArrayList getSecurityMemoryFactories(String domainName, String serverName) - throws MalformedObjectNameException { - String sName; - ArrayList al = new ArrayList(); - Iterator itNames = getListMBeanName(JonasObjectName.allSecurityMemoryFactories(domainName), serverName).iterator(); - while (itNames.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", itNames.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - return al; - } - - /** - * Return the list of Security Datasource Factories in the current server. - * - * @return The list of Security Datasource Factories - * @throws MalformedObjectNameException - */ - public static ArrayList getSecurityDatasourceFactories(String domainName, String serverName) - throws MalformedObjectNameException { - String sName; - ArrayList al = new ArrayList(); - Iterator itNames = getListMBeanName(JonasObjectName.allSecurityDatasourceFactories(domainName), serverName). - iterator(); - while (itNames.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", itNames.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - return al; - } - - /** - * Return the list of Security Ldap Factories in the current server. - * - * @return The list of Security Ldap Factories - * @throws MalformedObjectNameException - */ - public static ArrayList getSecurityLdapFactories(String domainName, String serverName) - throws MalformedObjectNameException { - String sName; - ArrayList al = new ArrayList(); - Iterator itNames = getListMBeanName(JonasObjectName.allSecurityLdapFactories(domainName), serverName).iterator(); - while (itNames.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", itNames.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - return al; - } - - /** - * Return the SubType of a Security Factory in the current server. - * - * @param p_NameFactory The factory name to find - * @return The SubType or null if not found - * @throws ManagementException - * @throws MalformedObjectNameException - */ - public static String findSecurityFactorySubType(String p_NameFactory, String domainName, String serverName) - throws MalformedObjectNameException { - String sName; - String sSubType = null; - ObjectName on = null; - - Iterator itNames = getListMBeanName(JonasObjectName.allSecurityFactories(domainName), serverName).iterator(); - while (itNames.hasNext()) { - on = new ObjectName(itNames.next().toString()); - sName = on.getKeyProperty("name"); - if (p_NameFactory.equals(sName) == true) { - sSubType = on.getKeyProperty("subtype"); - break; - } - } - return sSubType; - } - - /** - * Return the list of all users in a resource. - * @param domainName the domain name - * @param p_Resource The resource - * @return The list of users - * @throws ManagementException - * @throws MalformedObjectNameException - */ - public static ArrayList getUsers(String domainName, String p_Resource, String serverName) - throws ManagementException, MalformedObjectNameException { - String sName; - ArrayList al = new ArrayList(); - Iterator itNames = getListMBeanName(JonasObjectName.allUsers(domainName, p_Resource), serverName).iterator(); - while (itNames.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", itNames.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - return al; - } - - /** - * Return the list of all roles in a resource. - * @param domainName the domain name - * @param p_Resource The resource - * @return The list of roles - * @throws ManagementException - * @throws MalformedObjectNameException - */ - public static ArrayList getRoles(String domainName, String p_Resource, String serverName) - throws ManagementException, MalformedObjectNameException { - String sName; - ArrayList al = new ArrayList(); - Iterator itNames = getListMBeanName(JonasObjectName.allRoles(domainName, p_Resource), serverName).iterator(); - while (itNames.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", itNames.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - return al; - } - - /** - * Return the list of all groups in a resource. - * @param domainName the domain name - * @param p_Resource The resource - * @return The list of groups - * @throws ManagementException - * @throws MalformedObjectNameException - */ - public static ArrayList getGroups(String domainName, String p_Resource, String serverName) - throws ManagementException, MalformedObjectNameException { - String sName; - ArrayList al = new ArrayList(); - Iterator itNames = getListMBeanName(JonasObjectName.allGroups(domainName, p_Resource), serverName).iterator(); - while (itNames.hasNext()) { - sName = JonasAdminJmx.extractValueMbeanName(",name", itNames.next().toString()); - if (sName != null) { - al.add(sName); - } - } - Collections.sort(al); - return al; - } - - /** - * Return the Queue destinations list. - * @return The list - */ - public static ArrayList getQueuesList(String domainName, String serverName) { - synchronized (s_Synchro) { - ObjectName jmsServMB = JonasObjectName.jmsService(domainName); - Set queues = (Set) JonasManagementRepr.getAttribute(jmsServMB - , "AllJmsQueueDestinationNames", serverName); - ArrayList al = new ArrayList(); - Iterator itNames = queues.iterator(); - while (itNames.hasNext()) { - al.add(itNames.next()); - } - return al; - } - } - - /** - * Return the Topic destinations list. - * @return The list - */ - public static ArrayList getTopicsList(String domainName, String serverName) { - synchronized (s_Synchro) { - ObjectName jmsServMB = JonasObjectName.jmsService(domainName); - Set topics = (Set) JonasManagementRepr.getAttribute(jmsServMB - , "AllJmsTopicDestinationNames", serverName); - ArrayList al = new ArrayList(); - Iterator itNames = topics.iterator(); - while (itNames.hasNext()) { - al.add(itNames.next()); - } - return al; - } - } - - /** - * Return the default Connection Factories. - * - * @param p_Resources The messages - * @return The list - */ - public static ArrayList getConnectionFactoriesList(MessageResources p_Resources, String domainName, String serverName) { - synchronized (s_Synchro) { - ObjectName jmsServMB = JonasObjectName.jmsService(domainName); - String cfName = (String) JonasManagementRepr.getAttribute(jmsServMB - , "DefaultConnectionFactoryName", serverName); - String tcfName = (String) JonasManagementRepr.getAttribute(jmsServMB - , "DefaultTopicConnectionFactoryName", serverName); - String qcfName = (String) JonasManagementRepr.getAttribute(jmsServMB - , "DefaultQueueConnectionFactoryName", serverName); - ArrayList al = new ArrayList(); - String comment = p_Resources.getMessage("tab.connfact.defaultconnfact"); - JmsConnFact cf = new JmsConnFact(cfName, comment); - al.add(cf); - comment = p_Resources.getMessage("tab.connfact.defaulttopicconnfact"); - cf = new JmsConnFact(tcfName, comment); - al.add(cf); - comment = p_Resources.getMessage("tab.connfact.defaultqueueconnfact"); - cf = new JmsConnFact(qcfName, comment); - al.add(cf); - return al; - } - } - - /** - * Return the list of all used loggers in this JOnAS server. - * @param p_Resources The used message resource - * @param p_WhereAreYou The used WhereAreYou instance - * @param p_Action True to get the action (to use directly in jsp) or False to get the same action but in forward (write in the file struts-config.xml) - * @return The list of loggers - * @throws ManagementException - */ - public static ArrayList getLoggers(MessageResources p_Resources, WhereAreYou p_WhereAreYou - , boolean p_Action) - throws MalformedObjectNameException { - String serverName = p_WhereAreYou.getCurrentJonasServerName(); - ArrayList al = new ArrayList(); - String sActionForward; - // Get JONAS logger - if (p_Action == true) { - sActionForward = "EditLoggingJonas.do"; - } - else { - sActionForward = "ActionEditLoggingJonas"; - } - String itemName = p_Resources.getMessage("logger.jonas.name"); - String type = LoggerItem.LOGGER_JONAS; - LoggerItem li = new LoggerItem(itemName, type, sActionForward); - al.add(li); - // Get Catalina Logger - if (p_WhereAreYou.isCatalinaServer() == true) { - ObjectName on = CatalinaObjectName.catalinaAccessLogValves(p_WhereAreYou. - getCurrentCatalinaDomainName()); - - Iterator it = getListMbean(on, serverName).iterator(); - while (it.hasNext()) { - ObjectName oItem = (ObjectName) it.next(); - if (p_Action) { - sActionForward = "EditCatalinaAccessLogger.do?select=" + oItem.toString(); - } - else { - sActionForward = "ActionEditCatalinaAccessLogger"; - } - itemName = p_Resources.getMessage("logger.catalina.access.name"); - String hostName = oItem.getKeyProperty("host"); - String containerName = null; - String containerType = null; - String containerLabel = null; - if (hostName == null) { - type = LoggerItem.LOGGER_CATALINA_ACCESS_ENGINE; - containerType = p_Resources.getMessage("label.loggers.container.engine"); - containerName = p_Resources.getMessage("label.loggers.container.engine.name"); - containerLabel = containerName; - } else { - String pathName = oItem.getKeyProperty("path"); - if (pathName != null) { - type = LoggerItem.LOGGER_CATALINA_ACCESS_CONTEXT; - containerName = pathName; - containerType = p_Resources.getMessage("label.loggers.container.context"); - containerLabel = WebAppItem.extractLabelPathContext(containerName, p_WhereAreYou.getCurrentCatalinaDefaultHostName()); - } else { - type = LoggerItem.LOGGER_CATALINA_ACCESS_HOST; - containerName = hostName; - containerType = p_Resources.getMessage("label.loggers.container.host"); - containerLabel = containerName; - } - } - itemName = itemName.concat(" " + containerLabel); - li = new LoggerItem(itemName, type, sActionForward, oItem.toString(), containerType, containerName); - al.add(li); - } - } - BeanComparator beanComparator = new BeanComparator(new String[]{"name"}); - // sort - Collections.sort(al, beanComparator); - return al; - } - - /** - * Create a list for each family of Mbean. - * - * @return An array of lists - * @throws ManagementException - */ - public static ArrayList getMbeansLists(String serverName) - throws ManagementException { - - MbeanItem oItem; - - // Create the new list - ArrayList al = new ArrayList(); - // Dispath each Mbean in its list - Iterator it = JonasAdminJmx.getListMbean(null, serverName).iterator(); - while (it.hasNext()) { - oItem = MbeanItem.build((ObjectName) it.next()); - al.add(oItem); - } - return al; - } - - /** - * Create a list for each family of Mbean. - * - * @return An array of lists - * @throws ManagementException - */ - public static ArrayList[] getFamiliesMbeansLists(String serverName) - throws ManagementException { - - MbeanItem oItem; - - // Create the new lists - ArrayList[] als = new ArrayList[3]; - for (int i = 0; i < MbeanItem.SIZE_FAMILIES; i++) { - als[i] = new ArrayList(); - } - // Dispath each Mbean in its list - Iterator it = JonasAdminJmx.getListMbean(null, serverName).iterator(); - while (it.hasNext()) { - oItem = MbeanItem.build((ObjectName) it.next()); - int i = oItem.getFamily(); - als[i].add(oItem); - } - return als; - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasBaseAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasBaseAction.java deleted file mode 100644 index c31eee431cfe6ba6eeb31272ec425da2b5ce25fd..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasBaseAction.java +++ /dev/null @@ -1,764 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.StringTokenizer; - -import javax.management.ObjectName; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.struts.Globals; -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionMessage; -import org.apache.struts.action.ActionMessages; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.util.MessageResources; - -import org.objectweb.jonas.common.Log; -import org.objectweb.jonas.jmx.oname.J2eeObjectName; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * @author Michel-Ange ANTON - * @author Florent Benoit (changes for struts 1.2.2) - */ - -public abstract class JonasBaseAction extends Action { - -// ----------------------------------------------------- Constants - - public static final int DEPTH_DOMAIN = 1; - public static final int DEPTH_SERVER = 2; - - /** - * Global Forward error page name. - */ - public static final String GLOBAL_ERROR_FORWARD = "Global Error"; - -// --------------------------------------------------------- Instance Variables - - /** - * The MessageResources we will be retrieving messages from. - */ - protected MessageResources m_Resources = null; - protected HttpSession m_Session = null; - protected ActionMessages m_Errors = null; - protected WhereAreYou m_WhereAreYou = null; - -// --------------------------------------------------------- Public Methods - - public abstract ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException; - - /** - * Process the specified HTTP request, and create the corresponding HTTP - * response (or forward to another web component that will create it). - * Return an ActionForward instance describing where and how - * control should be forwarded, or null if the response has - * already been completed. - * - * @param p_Mapping The ActionMapping used to select this instance - * @param p_Form The optional ActionForm bean for this request (if any) - * @param p_Request The HTTP request we are processing - * @param p_Response The HTTP response we are creating - * - * @return The forward where redirect - * - * @exception IOException if an input/output error occurs - * @exception ServletException if a servlet exception occurs - */ - public ActionForward execute(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException { - - ActionForward oActionForward = null; - - // Instance variables - initialize(p_Request); - - // Verify that a instance of WhereAreYou object exists - if (m_WhereAreYou == null) { - oActionForward = (p_Mapping.findForward("Main Index")); - } else { - oActionForward = executeAction(p_Mapping, p_Form, p_Request, p_Response); - } - return oActionForward; - } - - /** - * Initialize the instance variables. - * @param p_Request The HTTP request we are processing - */ - protected void initialize(HttpServletRequest p_Request) { - // Acquire the resources that we need - m_Session = p_Request.getSession(); - if (m_Resources == null) { - m_Resources = (MessageResources) getServlet().getServletContext().getAttribute(Globals.MESSAGES_KEY); - } - m_Errors = new ActionMessages(); - m_WhereAreYou = (WhereAreYou) m_Session.getAttribute(WhereAreYou.SESSION_NAME); - - } - - /** - * Return the name of the branch in the tree for the selected node. - * - * @param p_Width Depth of the branch - * @return The branch name - */ - protected String getTreeBranchName(int p_Width) { - StringBuffer sb = new StringBuffer(); - try { - StringTokenizer st = new StringTokenizer(m_WhereAreYou.getSelectedNameNode() - , WhereAreYou.NODE_SEPARATOR); - for (int i = 0; (st.hasMoreTokens() && (i < p_Width)); i++) { - if (i > 0) { - sb.append(WhereAreYou.NODE_SEPARATOR); - } - sb.append(st.nextToken()); - } - } catch (NullPointerException e) { - // none action - } - return sb.toString(); - } - - /** - * Add a global error in m_Errorsinstance of m_ErrorsActionMessages - * and log it. - * - * @param p_Throwable Error to add - */ - protected void addGlobalError(Throwable p_Throwable) { - String sMessResource; - String sMessageError = p_Throwable.getMessage(); - if (sMessageError == null) { - sMessResource = m_Resources.getMessage("error.global.log" - , p_Throwable.getClass().getName()); - //getServlet().log(sMessResource, p_Throwable); - Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, sMessResource); - } - m_Errors.add("error.global", new ActionMessage("error.global" - , p_Throwable.getClass().getName())); - } else { - sMessResource = m_Resources.getMessage("error.global.message.log" - , p_Throwable.getClass().getName(), sMessageError); - //getServlet().log(sMessResource, p_Throwable); - Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, sMessResource); - } - m_Errors.add("error.global", new ActionMessage("error.global.message" - , p_Throwable.getClass().getName(), sMessageError)); - } - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected String getStringAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - String s = (String) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return s; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected String[] getStringArrayAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - String[] s = (String[]) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return s; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @param p_Value Value to write - */ - protected void setStringAttribute(ObjectName p_ObjectName, String ps_AttrName, String p_Value) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - JonasManagementRepr.setAttribute(p_ObjectName, ps_AttrName, p_Value, pServer); - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected int getIntegerAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Integer o = (Integer) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.intValue(); - } catch (Exception e) { - addGlobalError(e); - } - return 0; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected String toStringIntegerAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String serverName = m_WhereAreYou.getCurrentJonasServerName(); - try { - Integer o = (Integer) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, serverName); - return o.toString(); - } catch (Exception e) { - addGlobalError(e); - } - return null; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @param p_Value Value to write - */ - protected void setIntegerAttribute(ObjectName p_ObjectName, String ps_AttrName, int p_Value) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - JonasManagementRepr.setAttribute(p_ObjectName, ps_AttrName, new Integer(p_Value), pServer); - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @param p_Value Value to write - */ - protected void setIntegerAttribute(ObjectName p_ObjectName, String ps_AttrName, String p_Value) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - if ((p_Value != null) && (p_Value.length() > 0)) { - JonasManagementRepr.setAttribute(p_ObjectName, ps_AttrName, new Integer(p_Value), pServer); - } - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected long getLongAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Long o = (Long) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.longValue(); - } catch (Exception e) { - addGlobalError(e); - } - return 0; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected String toStringLongAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Long o = (Long) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.toString(); - } catch (Exception e) { - addGlobalError(e); - // None - } - return null; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @param p_Value Value to write - */ - protected void setLongAttribute(ObjectName p_ObjectName, String ps_AttrName, long p_Value) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - JonasManagementRepr.setAttribute(p_ObjectName, ps_AttrName, new Long(p_Value), pServer); - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected long getShortAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Short o = (Short) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.longValue(); - } catch (Exception e) { - addGlobalError(e); - // None - } - return 0; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected String toStringShortAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Short o = (Short) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.toString(); - } catch (Exception e) { - addGlobalError(e); - // None - } - return null; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @param p_Value Value to write - */ - protected void setShortAttribute(ObjectName p_ObjectName, String ps_AttrName, long p_Value) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - JonasManagementRepr.setAttribute(p_ObjectName, ps_AttrName, new Long(p_Value), pServer); - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected boolean getBooleanAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Boolean o = (Boolean) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.booleanValue(); - } catch (Exception e) { - addGlobalError(e); - // None - } - return false; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected String toStringBooleanAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - Boolean o = (Boolean) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer); - return o.toString(); - } catch (Exception e) { - addGlobalError(e); - // None - } - return null; - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @param p_Value Value to write - */ - protected void setBooleanAttribute(ObjectName p_ObjectName, String ps_AttrName, boolean p_Value) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - JonasManagementRepr.setAttribute(p_ObjectName, ps_AttrName, new Boolean(p_Value), pServer); - } - - /** - * MBean ObjectName accessor. - * - * @param p_ObjectName Instance of ObjectName to access to MBean - * @param ps_AttrName Attribute name of MBean - * @return The value of attribute - */ - protected List getListAttribute(ObjectName p_ObjectName, String ps_AttrName) { - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - try { - return ((List) JonasManagementRepr.getAttribute(p_ObjectName, ps_AttrName, pServer)); - } catch (Exception e) { - addGlobalError(e); - // None - } - return new ArrayList(); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @return The value of attribute - */ - protected String getStringAttribute(Properties p_Props, String ps_AttrName) { - return p_Props.getProperty(ps_AttrName); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Default The returned value if the attribute don't exists in the properties - * @return The value of attribute - */ - protected String getStringAttribute(Properties p_Props, String ps_AttrName, String p_Default) { - return p_Props.getProperty(ps_AttrName, p_Default); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Value Value to write - */ - protected void setStringAttribute(Properties p_Props, String ps_AttrName, String p_Value) { - if (p_Value != null) { - p_Props.setProperty(ps_AttrName, p_Value); - } - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Value Value to write - * @param p_Default The forced value if the value is null or empty - */ - protected void setStringAttribute(Properties p_Props, String ps_AttrName, String p_Value - , String p_Default) { - if ((p_Value != null) && (p_Value.length() == 0)) { - p_Props.setProperty(ps_AttrName, p_Default); - } else { - p_Props.setProperty(ps_AttrName, p_Value); - } - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @return The value of attribute (return 0 if attribute don't exists) - */ - protected int getIntegerAttribute(Properties p_Props, String ps_AttrName) { - return getIntegerAttribute(p_Props, ps_AttrName, 0); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Default The returned value if the attribute don't exists in the properties - * @return The value of attribute - */ - protected int getIntegerAttribute(Properties p_Props, String ps_AttrName, int p_Default) { - try { - String s = getStringAttribute(p_Props, ps_AttrName); - if (s != null) { - return Integer.parseInt(s); - } - } catch (Exception e) { - addGlobalError(e); - // None - } - return p_Default; - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Value Value to write - */ - protected void setIntegerAttribute(Properties p_Props, String ps_AttrName, int p_Value) { - p_Props.setProperty(ps_AttrName, String.valueOf(p_Value)); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @return The value of attribute (return 0 if attribute don't exists) - */ - protected long getLongAttribute(Properties p_Props, String ps_AttrName) { - return getLongAttribute(p_Props, ps_AttrName, 0L); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Default The returned value if the attribute don't exists in the properties - * @return The value of attribute - */ - protected long getLongAttribute(Properties p_Props, String ps_AttrName, long p_Default) { - try { - String s = getStringAttribute(p_Props, ps_AttrName); - if (s != null) { - return Long.parseLong(s); - } - } catch (Exception e) { - addGlobalError(e); - // None - } - return p_Default; - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Value Value to write - */ - protected void setLongAttribute(Properties p_Props, String ps_AttrName, long p_Value) { - p_Props.setProperty(ps_AttrName, String.valueOf(p_Value)); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @return The value of attribute (return false if attribute don't exists) - */ - protected boolean getBooleanAttribute(Properties p_Props, String ps_AttrName) { - return getBooleanAttribute(p_Props, ps_AttrName, false); - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Default The returned value if the attribute don't exists in the properties - * @return The value of attribute - */ - protected boolean getBooleanAttribute(Properties p_Props, String ps_AttrName, boolean p_Default) { - try { - String s = getStringAttribute(p_Props, ps_AttrName); - if (s != null) { - return Boolean.getBoolean(s); - } - } catch (Exception e) { - addGlobalError(e); - // None - } - return p_Default; - } - - /** - * Properties accessor. - * - * @param p_Props Instance of Properties - * @param ps_AttrName Attribute name of Properties - * @param p_Value Value to write - */ - protected void setBooleanAttribute(Properties p_Props, String ps_AttrName, boolean p_Value) { - p_Props.setProperty(ps_AttrName, String.valueOf(p_Value)); - } - - protected Properties getPropsFromString(String ps_Props) { - // Clean the string - String sProps = ps_Props.trim(); - sProps = removeChar(sProps, '\r'); - sProps = removeChar(sProps, '\n'); - Properties sp = new Properties(); - StringTokenizer st = new StringTokenizer(sProps, ","); - while (st.hasMoreTokens()) { - String token = st.nextToken(); - int pos = token.indexOf("="); - String propName = token.substring(0, pos); - String propValue = token.substring(pos + 1); - sp.setProperty(propName, propValue); - } - return sp; - } - - /** - * Remove a specific character in a String - * Do not use replaceAll as it is a JDK 1.4 method - * @param string the given string - * @param c character to remove in the String - * @return a string - */ - protected static String removeChar(String string, char c) { - StringBuffer sb = new StringBuffer(); - sb.setLength(string.length()); - int i = 0; - for (int j = 0; j < string.length(); j++) { - char cur = string.charAt(j); - if (cur != c) { - sb.setCharAt(i++, cur); - } - } - return sb.toString(); - } - /** - * Refresh the management tree. - * - * @throws Exception - */ - protected void refreshServerTree(HttpServletRequest p_Request) throws Exception { - // Get current tree - TreeControl oControl = m_WhereAreYou.getTreeControl(); - // tree root - TreeControlNode root = oControl.getRoot(); - // domain node - TreeControlNode domainNode = oControl.findNode("domain"); - if (domainNode != null) { - // Enable auto-refresh mode - oControl.enableAutoRefresh(); - // Remove node - domainNode.remove(); - // Build node and his children - JonasTreeBuilder oBuilder = new JonasTreeBuilder(); - oBuilder.getDomain(root, m_Resources, p_Request); - // Disable auto-refresh mode - oControl.disableAutoRefresh(); - } - } - - /** - * Refresh the domain deployment nodes of the tree. - * @param p_Request - * @throws Exception - */ - protected void refreshDomainDeployTree(HttpServletRequest p_Request) throws Exception { - // Get current tree - TreeControl oControl = m_WhereAreYou.getTreeControl(); - TreeControlNode domainNode = oControl.findNode("domain"); - if (domainNode != null) { - // Enable auto-refresh mode - oControl.enableAutoRefresh(); - // Remove node - // Build node and his children - JonasTreeBuilder oBuilder = new JonasTreeBuilder(); - oBuilder.getDomainDeploy(oControl.findNode("domain"), m_Resources, p_Request); - // Disable auto-refresh mode - oControl.disableAutoRefresh(); - } - - } - - /** - * Refresh the domain monitoring nodes of the tree. - * @param p_Request - * @throws Exception - */ - protected void refreshDomainMonitoringTree(HttpServletRequest p_Request) throws Exception { - // Get current tree - TreeControl oControl = m_WhereAreYou.getTreeControl(); - String domainName = m_WhereAreYou.getCurrentDomainName(); - String serverName = m_WhereAreYou.getCurrentJonasServerName(); - TreeControlNode domainNode = oControl.findNode("domain"); - if (domainNode != null) { - // Enable auto-refresh mode - oControl.enableAutoRefresh(); - // Remove node - // Build node and his children - JonasTreeBuilder oBuilder = new JonasTreeBuilder(); - oBuilder.getMonitoring(oControl.findNode("domain"), m_Resources, p_Request, domainName, serverName); - // Disable auto-refresh mode - oControl.disableAutoRefresh(); - } - - } - /** - * - * @return the current server's JONAS_BASE - */ - protected String getJonasBase() { - String pDomain = m_WhereAreYou.getCurrentDomainName(); - String pServer = m_WhereAreYou.getCurrentJonasServerName(); - ObjectName j2eeServerOn = J2eeObjectName.J2EEServer(pDomain, pServer); - String jonasBase = getStringAttribute(j2eeServerOn, "jonasBase"); - if (!jonasBase.endsWith(File.separator)) { - jonasBase = jonasBase.concat(File.separator); - } - return jonasBase; - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasManagementRepr.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasManagementRepr.java deleted file mode 100644 index 0f708a278a326ccb3396aebc3b252b866dc100d7..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasManagementRepr.java +++ /dev/null @@ -1,296 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; -import java.util.Hashtable; -import java.util.Set; - -import javax.management.Attribute; -import javax.management.AttributeList; -import javax.management.MBeanException; -import javax.management.MBeanInfo; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.ReflectionException; -import javax.management.RuntimeErrorException; -import javax.management.RuntimeMBeanException; -import javax.management.RuntimeOperationsException; - -import org.objectweb.jonas.management.monitoring.DomainMonitor; -import org.objectweb.jonas.webapp.jonasadmin.ManagementException; - -/** - * Wrapper class allowing to apply a management operations (getAttribute, setAttribute, invoke, etc.) - * on the corresponding to managed server's connection. - * The managed server is identified by a name (serverName parameter). - * The corresponding connection is kept in the serverConnections table. - * @author Adriana Danes - */ -public class JonasManagementRepr { - - /** - * Ref on the DomainMonitor - */ - private static DomainMonitor dm = DomainMonitor.getInstance(); - - /** - * Cache of managed server MBeanServerConnection's - */ - private static Hashtable serverConnections = - new Hashtable(); - - /** - * Return the connection corresponding to a given server. - * @param serverName The managed server name - * @return The MBeanServerConnection corresponding to the managed server - * @throws ManagementException Couldn't get the connection - */ - private static MBeanServerConnection getServerConnection(String serverName) throws ManagementException { - MBeanServerConnection conn = serverConnections.get(serverName); - if (conn == null) { - conn = dm.getConnection(serverName); - if (conn == null) { - throw new ManagementException("Can't manage server " + serverName + " as couldn't get connection"); - } - serverConnections.put(serverName, conn); - } - return conn; - } - - /** - * @return True if the MBean is already registered in the MBean server, false otherwise or if an exception is catched. - * @param on ObjectName of the MBean we are looking for - * @param serverName The server name - * @throws ManagementException management operation failed - */ - public static boolean isRegistered(ObjectName on, String serverName) throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - return repr.isRegistered(on); - } catch (IOException e) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while calling isRegister attribute: ", e); - } - } - - /** - * Gets the value of a specific attribute of a named MBean. - * @param on The ObjectName of the MBean. - * @param attribute A String specifying the name of the attribute to be retrieved. - * @param serverName The server name - * @return The value of the attribute. - * @throws ManagementException management operation failed - */ - public static Object getAttribute(ObjectName on, String attribute, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - return repr.getAttribute(on, attribute); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while calling getting attribute: ", ioe); - } catch (Exception e) { - throw new ManagementException("Error while calling getting attribute: ", e); - } - } - - /** - * Gets the values of several attributes of a named MBean. - * @param on The ObjectName of the MBean. - * @param attributes Array of attribute names to be retrieved. - * @param serverName The server name - * @return The value of the attribute. - * @throws ManagementException management operation failed - */ - public static AttributeList getAttributes(ObjectName on, String[] attributes, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - return repr.getAttributes(on, attributes); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while calling getting attributes: ", ioe); - } catch (Exception e) { - throw new ManagementException("Error while calling getting attributes: ", e); - } - } - - /** - * Sets the value of a specific attribute of a named MBean. - * @param on The ObjectName of the MBean. - * @param serverName The server name - * @param attribute A String specifying the name of the attribute to be set. - * @param value The value to set to the attribute. - * @throws ManagementException management operation failed - */ - public static void setAttribute(ObjectName on, String attribute, Object value, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - repr.setAttribute(on, new Attribute(attribute, value)); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while calling setting attribute: ", ioe); - } catch (Exception e) { - throw new ManagementException("Error while calling setting attribute: ", e); - } - } - - /** - * @param on The ObjectName of the MBean within which the attribute is to be set. - * @param serverName The server name - * @param attributes A list of attributes: The identification of the attribute to be set and the value it is to be set to - * @throws ManagementException management operation failed - */ - public static void setAttributes(ObjectName on, AttributeList attributes, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - repr.setAttributes(on, attributes); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while setting getting attributes: ", ioe); - } catch (Exception e) { - throw new ManagementException("Error while setting attributes: ", e); - } - } - - /** - * Invokes an operation on an MBean. - * @param on MBean name - * @param operation operation to invoke - * @param param invoke parameters - * @param signature invoke parameters signature - * @param serverName The server name - * @return The object returned by the operation - * @throws ManagementException management operation failed - */ - public static Object invoke(ObjectName on, String operation, Object[] param, String[] signature, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - return repr.invoke(on, operation, param, signature); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while invoking opeartion: ", ioe); - } catch (Exception e) { - String message = ""; - Throwable exc = null; - if (e instanceof MBeanException - || e instanceof ReflectionException - || e instanceof RuntimeMBeanException - || e instanceof RuntimeOperationsException - || e instanceof RuntimeErrorException) { - - Exception targetExc = null; - if (e instanceof MBeanException) { - targetExc = ((MBeanException) e).getTargetException(); - } else if (e instanceof ReflectionException) { - targetExc = ((ReflectionException) e).getTargetException(); - } else if (e instanceof RuntimeMBeanException) { - targetExc = ((RuntimeMBeanException) e).getTargetException(); - } else if (e instanceof RuntimeOperationsException) { - targetExc = ((RuntimeOperationsException) e).getTargetException(); - } else if (e instanceof RuntimeErrorException) { - Error atargetExc = ((RuntimeErrorException) e).getTargetError(); - targetExc = new Exception(atargetExc.getMessage()); - } - exc = targetExc; - } else { - exc = e; - } - throw new ManagementException(message, exc); - } - } - - /** - * @return A set containing the ObjectNames for the MBeans selected. - * @param on MBean name - * @param serverName The server name - * @throws ManagementException management operation failed - */ - public static Set queryNames(ObjectName on, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - return (Set) repr.queryNames(on, null); - } catch (IOException e) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while getting MBeans names: ", e); - } - } - - - /** - * @return An instance of MBeanInfo allowing the retrieval of all - * attributes and operations of this MBean. - * @param name MBean's ObjectName - * @param serverName The server name - * @throws ManagementException management operation failed - */ - public static MBeanInfo getMBeanInfo(ObjectName on, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - return (MBeanInfo) repr.getMBeanInfo(on); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while getting MBean info: ", ioe); - } catch (Exception e) { - throw new ManagementException("Error while getting MBean info: ", e); - } - } - - /** - * Unregisters an MBean from the managed server's MBean server. - * @param on The object name of the MBean. - * @param serverName The server name - * @throws ManagementException wraps exception thrown by the called management operation - */ - public static void unregisterMBean(ObjectName on, String serverName) - throws ManagementException { - MBeanServerConnection repr = getServerConnection(serverName); - try { - repr.unregisterMBean(on); - } catch (IOException ioe) { - // Connection has become obsolete. - serverConnections.remove(serverName); - throw new ManagementException("Error while unregistering MBean: ", ioe); - } catch (Exception e) { - throw new ManagementException("Error while unregistering MBean: ", e); - } - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasServerItem.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasServerItem.java deleted file mode 100644 index a9175b051452129845ebecd0de59127078242d90..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasServerItem.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Michel-Ange ANTON - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.Serializable; - -public class JonasServerItem implements Serializable { - private String nameServer = null; - private String nameRmiConnector = null; - public JonasServerItem() { - super(); - } - - public String getNameServer() { - return nameServer; - } - - public void setNameServer(String nameServer) { - this.nameServer = nameServer; - } - - public String getNameRmiConnector() { - return nameRmiConnector; - } - - public void setNameRmiConnector(String nameRmiConnector) { - this.nameRmiConnector = nameRmiConnector; - } - -} \ No newline at end of file diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasTreeBuilder.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasTreeBuilder.java deleted file mode 100644 index b97147b2c2131188bb82b40bd6264e239a9870cd..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/JonasTreeBuilder.java +++ /dev/null @@ -1,2762 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.StringTokenizer; - -import javax.management.MBeanAttributeInfo; -import javax.management.MBeanInfo; -import javax.management.MBeanOperationInfo; -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.Globals; -import org.apache.struts.action.ActionServlet; -import org.apache.struts.util.MessageResources; -import org.objectweb.jonas.common.Log; -import org.objectweb.jonas.jmx.oname.J2eeObjectName; -import org.objectweb.jonas.jmx.oname.JonasObjectName; -import org.objectweb.jonas.jmx.oname.JoramObjectName; -import org.objectweb.jonas.webapp.jonasadmin.catalina.ConnectorItem; -import org.objectweb.jonas.webapp.jonasadmin.catalina.ConnectorItemByPort; -import org.objectweb.jonas.webapp.jonasadmin.common.BeanComparator; -import org.objectweb.jonas.webapp.jonasadmin.common.CatalinaObjectName; -import org.objectweb.jonas.webapp.jonasadmin.jonasmqconnect.util.MqObjectNames; -import org.objectweb.jonas.webapp.jonasadmin.joramplatform.ItemDestination; -import org.objectweb.jonas.webapp.jonasadmin.logging.LoggerItem; -import org.objectweb.jonas.webapp.jonasadmin.mbean.J2eeMbeanItem; -import org.objectweb.jonas.webapp.jonasadmin.mbean.MbeanItem; -import org.objectweb.jonas.webapp.jonasadmin.mbean.OwnerMbeanItem; -import org.objectweb.jonas.webapp.jonasadmin.service.container.ContainerItem; -import org.objectweb.jonas.webapp.jonasadmin.service.container.ContainerItemByFile; -import org.objectweb.jonas.webapp.jonasadmin.service.container.WebAppItem; -import org.objectweb.jonas.webapp.jonasadmin.service.container.WebAppItemByPathContext; -import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItem; -import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItemByNameComparator; -import org.objectweb.jonas.webapp.jonasadmin.service.resource.ResourceItem; -import org.objectweb.jonas.webapp.jonasadmin.service.resource.ResourceItemByFile; -import org.objectweb.jonas.webapp.jonasadmin.service.webservice.provider.JOnASProvider; -import org.objectweb.jonas.webapp.jonasadmin.service.webservice.provider.element.HandlerItem; -import org.objectweb.jonas.webapp.jonasadmin.service.webservice.provider.element.PortComponentItem; -import org.objectweb.jonas.webapp.jonasadmin.service.webservice.provider.element.WebServiceDescriptionItem; -import org.objectweb.jonas.webapp.taglib.TreeBuilder; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * Implementation of TreeBuilder that adds the nodes required - * for administering the Jonas server. - * - * @author Michel-Ange ANTON (initial developer) - * @author Adriana Danes : add nodes for JMS service - * @author Florent Benoit (changes for struts 1.2.2) - */ -/** - * @author eyindanga - * - */ -public class JonasTreeBuilder implements TreeBuilder { - -// ----------------------------------------------------- Instance Variables - private static Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); -// ---------------------------------------------------- TreeBuilder Methods - /** - * Add the required nodes to the specified treeControl - * instance. - * - * @param treeControl The TreeControl to which we should - * add our nodes - * @param servlet The controller servlet for the admin application - * @param request The servlet request we are processing - */ - public void buildTree(TreeControl treeControl, ActionServlet servlet - , HttpServletRequest request) { - try { - TreeControlNode rootNode = treeControl.getRoot(); - MessageResources resources = (MessageResources) servlet.getServletContext(). - getAttribute(Globals.MESSAGES_KEY); - getDomain(rootNode, resources, request); - } catch (Throwable t) { - t.printStackTrace(System.out); - } - } - -// ------------------------------------------------------ Protected Methods - - /** - * Append nodes for the current domain. - * - * @param p_RootNode Root node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getDomain(TreeControlNode p_RootNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - // Add domain node - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - //String sDomain = oWhere.getCurrentDomain().toString();// OBJECT_NAME - String sDomainName = oWhere.getCurrentDomainName();// value of the 'name' key property - String sServerName = oWhere.getCurrentJonasServerName(); - - String sNodeLabel = p_Resources.getMessage("treenode.jonas.domain") + " ( " + sDomainName + " )"; - TreeControlNode domainNode = new TreeControlNode("domain" - , "icon/domain_jonas.gif" - , sNodeLabel - , "EditDomain.do?select=" + encode(sDomainName) - , "content", true); - if (!addNode(p_RootNode, domainNode)) { - return; - } - - // Add children - if (isMaster(sDomainName, sServerName)) { - getMonitoring(domainNode, p_Resources, p_Request, sDomainName, sServerName); - getDomainDeploy(domainNode, p_Resources, p_Request); - } - getServer(domainNode, p_Resources, p_Request, sDomainName, sServerName); - getJoramPlatform(domainNode, sServerName, p_Resources, p_Request); - getMBeans(domainNode, p_Resources, p_Request); - } - - /** - * Returns if the current server (with discovery running) is a master server. - * @return if the current server is a master server. - */ - protected boolean isMaster(String domainName, String serverName) { - boolean result = false; - ObjectName oObjectName = JonasObjectName.discoveryService(domainName); - if (JonasAdminJmx.hasMBeanName(oObjectName, serverName)) { - result = ((Boolean) JonasManagementRepr.getAttribute(oObjectName, "IsDiscoveryMaster", serverName)).booleanValue(); - } - return result; - } - - /** - * Append nodes for domain management deployment. - * - * @param p_DomainNode Domain node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - * @param p_DomainName The name of the domain. - */ - protected void getDomainDeploy(TreeControlNode p_DomainNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - String domainName = oWhere.getCurrentDomainName(); - - TreeControlNode nodeDeployments = new TreeControlNode(p_DomainNode.getName() - + WhereAreYou.NODE_SEPARATOR + "deployments", "icon/deployDomainManage.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments"), null, "content", true); - if (addNode(p_DomainNode, nodeDeployments, 1)) { - if (JonasAdminJmx.hasMBeanName(JonasObjectName.earService(domainName), serverName)) { - getDomainDeploymentEar(nodeDeployments, p_Resources); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.ejbService(domainName), serverName)) { - getDomainDeploymentEjb(nodeDeployments, p_Resources); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.webContainerService(domainName), serverName)) { - getDomainDeploymentWebAppli(nodeDeployments, p_Resources); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.resourceService(domainName), serverName)) { - getDomainDeploymentRar(nodeDeployments, p_Resources); - } - } - } - - /** - * Append node for Ear deployment using domain management. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDomainDeploymentEar(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_EAR - , "icon/deployDomain_ear.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_EAR) - , "EditDomainDeploy.do?type=" + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_EAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append node for Ejb deployment using domain management. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDomainDeploymentEjb(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_JAR - , "icon/deployDomain_jar.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_JAR) - , "EditDomainDeploy.do?type=" + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_JAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append node for Web deployment using domain management. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDomainDeploymentWebAppli(TreeControlNode p_NodeDeployments - , MessageResources p_Resources) { - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_WAR - , "icon/deployDomain_war.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_WAR) - , "EditDomainDeploy.do?type=" + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_WAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append node for Rar deployment using domain management. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDomainDeploymentRar(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_RAR - , "icon/deployDomain_rar.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_RAR) - , "EditDomainDeploy.do?type=" + WhereAreYou.DOMAIN_DEPLOYMENT_STRING_RAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append nodes for monitoring of elements in the domain (servers, clusters, cluster daemons) - */ - protected void getMonitoring(TreeControlNode p_DomainNode, MessageResources p_Resources - , HttpServletRequest p_Request, String domainName, String serverName) { - String domainNodeName = p_DomainNode.getName(); - TreeControlNode nodeMonitoring = new TreeControlNode(domainNodeName - + WhereAreYou.NODE_SEPARATOR + "monitoring" - , "icon/monitoring.gif" - , p_Resources.getMessage("treenode.jonas.domain.monitoring") - , null, "content", true); - if (addNode(p_DomainNode, nodeMonitoring, 0)) { - getMonitoringNodeList(nodeMonitoring, p_Resources, p_Request, domainName, serverName); - //disable the clusterd administration - //getMonitoringClusterList(nodeMonitoring, p_Resources, p_Request, domainName, serverName); - getMonitoringCDList(nodeMonitoring, p_Resources, p_Request, domainName, serverName, false); - } - } - - /** - * Append nodes for servers monitoring - */ - protected void getMonitoringNodeList(TreeControlNode p_ParentNode, MessageResources p_Resources - , HttpServletRequest p_Request, String domainName, String serverName) { - // get server proxies - try { - ObjectName on = JonasObjectName.serverProxys(domainName); - Iterator itNames = JonasAdminJmx.getListMbean(on, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName elem = (ObjectName) itNames.next(); - TreeControlNode node = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR + elem.getKeyProperty("name") - , "icon/BalJonasTree.gif" - , elem.getKeyProperty("name") - , "DisplayNodeInfo.do?node=" + elem.getKeyProperty("name") - , "content", true); - addNode(p_ParentNode, node); - } - } catch (MalformedObjectNameException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return; - } - } - - /** - * Append nodes for clusters monitoring - */ - protected void getMonitoringClusterList(TreeControlNode p_ParentNode, MessageResources p_Resources - , HttpServletRequest p_Request, String domainName, String serverName) { - - String clusterType; - String iconPath; - String membersAttribute; - String clusterActionPage; - String memberActionPage; - - // tomcat cluster - clusterType = "TomcatCluster"; - iconPath = "icon/domain_jonas.gif"; - membersAttribute = "Members"; - clusterActionPage = "TomcatClusterInfo.do?clust="; - memberActionPage = "TomcatMemberInfo.do"; - - displayClusterMembers(domainName, p_ParentNode, clusterType, - iconPath, membersAttribute, - clusterActionPage, memberActionPage, - domainName, serverName); - - - // loadbalancing cluster - clusterType = "JkCluster"; - iconPath = "icon/domain_jonas.gif"; - membersAttribute = "Members"; - clusterActionPage = "JkClusterInfo.do?clust="; - memberActionPage = "JkMemberInfo.do"; - - displayClusterMembers(domainName, p_ParentNode, clusterType, - iconPath, membersAttribute, - clusterActionPage, memberActionPage, - domainName, serverName); - - // CMI cluster - clusterType = "CmiCluster"; - iconPath = "icon/domain_jonas.gif"; - membersAttribute = "Members"; - clusterActionPage = "CmiClusterInfo.do?clust="; - memberActionPage = "CmiMemberInfo.do"; - - displayClusterMembers(domainName, p_ParentNode, clusterType, - iconPath, membersAttribute, - clusterActionPage, memberActionPage, - domainName, serverName); - - // EjbHa cluster - clusterType = "EjbHaCluster"; - iconPath = "icon/domain_jonas.gif"; - membersAttribute = "Members"; - clusterActionPage = "EjbHaClusterInfo.do?clust="; - memberActionPage = "EjbHaMemberInfo.do"; - - displayClusterMembers(domainName, p_ParentNode, clusterType, - iconPath, membersAttribute, - clusterActionPage, memberActionPage, - domainName, serverName); - - // Joram cluster - clusterType = "JoramCluster"; - iconPath = "icon/domain_jonas.gif"; - membersAttribute = "Members"; - clusterActionPage = "JoramClusterInfo.do?clust="; - memberActionPage = "JoramMemberInfo.do"; - - displayClusterMembers(domainName, p_ParentNode, clusterType, - iconPath, membersAttribute, - clusterActionPage, memberActionPage, - domainName, serverName); - - // Logical cluster - clusterType = "LogicalCluster"; - iconPath = "icon/domain_jonas.gif"; - membersAttribute = "Members"; - clusterActionPage = "LogicalClusterInfo.do?clust="; - memberActionPage = "LogicalMemberInfo.do"; - - displayClusterMembers(domainName, p_ParentNode, clusterType, - iconPath, membersAttribute, - clusterActionPage, memberActionPage, - domainName, serverName); - } - /** - * - * @param sDomainName - * @param p_ParentNode - * @param clusterType - * @param iconPath - * @param membersAttribute - * @param clusterActionPage - * @param memberActionPage - */ - private void displayClusterMembers(String sDomainName, TreeControlNode p_ParentNode, String clusterType, - String iconPath, String membersAttribute, - String clusterActionPage, String memberActionPage, String domainName, String serverName) { - boolean isLogicalCluster = false; - if (clusterType.equals("LogicalCluster")) { - isLogicalCluster = true; - } - ObjectName onClusters; - try { - onClusters = JonasObjectName.clusters(sDomainName, clusterType); - Iterator itNames = JonasAdminJmx.getListMbean(onClusters, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName on = (ObjectName) itNames.next(); - String clusterName = on.getKeyProperty("name"); - if (clusterName.equals(domainName)) { - continue; - } - String clusterNodeName = clusterName + " - (" + on.getKeyProperty("type") + ")"; - // Cluster node - TreeControlNode nodeCluster = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR + clusterNodeName - , iconPath - , clusterNodeName - , clusterActionPage + clusterName - , "content", true); - if (addNode(p_ParentNode, nodeCluster)) { - String[] members = null; - members = (String[]) JonasManagementRepr.getAttribute(on, membersAttribute, serverName); - String memberAction = null; - if (members != null) { - for (int i = 0; i < members.length; i++) { - ObjectName onMember = new ObjectName(members[i]); - String memberName = onMember.getKeyProperty("name"); - if ("LogicalCluster".equals(clusterType)) { - memberAction = null; - } else { - memberAction = memberActionPage - + "?member=" + memberName - + "&clust=" + clusterName; - } - // Members node - TreeControlNode node = new TreeControlNode(nodeCluster.getName() - + WhereAreYou.NODE_SEPARATOR + memberName, "icon/BalJonasTree.gif" - , memberName - , memberAction, "content", true); - addNode(nodeCluster, node); - } - } - } - } - } catch (MalformedObjectNameException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return; - } - } - - /** - * Append nodes for cluster daemons. - * TO DO remove isNotMonitoring usage. This method is now always called - * for monitoring purpose. - * @param p_ParentNode - * @param p_Resources - * @param p_Request - * @param domainName - * @param serverName - * @param isNotMonitoring - */ - protected void getMonitoringCDList(TreeControlNode p_ParentNode, MessageResources p_Resources - , HttpServletRequest p_Request, String domainName, String serverName, boolean isNotMonitoring) { - try { - ObjectName on = JonasObjectName.clusterDaemonProxys(domainName); - Iterator itNames = JonasAdminJmx.getListMbean(on, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName elem = (ObjectName) itNames.next(); - String state= (String) JonasManagementRepr.getAttribute(elem, "State", serverName); - if (state.equals("RUNNING")) { - TreeControlNode node = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR + "ClusterDaemonProxy" + elem.getKeyProperty("name") - , "icon/BalJonasGreen.gif" - , elem.getKeyProperty("name") - , "DaemonProxyClusterInfo.do?node=" + elem.getKeyProperty("name") + "&isNotMonitoring=" + isNotMonitoring - , "content", true); - addNode(p_ParentNode, node); - } - } - } catch (MalformedObjectNameException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return; - } - } - - /** - * Append nodes for a defined Jonas server. - * - * @param p_DomainNode Domain node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getServer(TreeControlNode p_DomainNode - , MessageResources p_Resources, HttpServletRequest p_Request - , String p_DomainName, String p_ServerName) { - // Add server node - String sServerName = p_ServerName; - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String sServer = oWhere.getCurrentJonasServer().toString(); - String sNodeLabel = p_Resources.getMessage("treenode.jonas.server") + " ( " + sServerName + " )"; - TreeControlNode serverNode = new TreeControlNode(p_DomainNode.getName() - + WhereAreYou.NODE_SEPARATOR + sServerName - , "icon/BalJonasTree.gif" - , sNodeLabel - , "EditJonasServer.do?select=" + encode(sServer) - , "content", true); - if (addNode(p_DomainNode,serverNode)) { - getServerMonitoring(serverNode, p_Resources); - getLogging(serverNode, p_Resources, p_Request); - getProtocols(serverNode, p_Resources, p_Request); - getServices(serverNode, p_Resources, p_Request, p_DomainName, sServerName); - getDeployments(serverNode, p_Resources, p_Request); - getResources(serverNode, p_Resources, p_Request); - getSecurity(serverNode, p_Resources, p_Request); - // Add node for MQ connector support - getJonasMqConnectorPlatform(serverNode, sServerName, p_Resources, p_Request); - } - } - - /** - * Append nodes for Server Monitoring. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * messages - */ - protected void getServerMonitoring(TreeControlNode p_ServerNode, MessageResources p_Resources) { - // Monitoring server Service node - TreeControlNode node = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "monitoring" - , "icon/monitoring.gif" - , p_Resources.getMessage("treenode.jonas.server.monitoring") - , "EditMonitoring.do" - , "content", false); - addNode(p_ServerNode, node); - } - - /** - * Append nodes for Logging. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getLogging(TreeControlNode p_ServerNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - // Logging server Service node - TreeControlNode node = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "logging" - , "icon/loggers.gif" - , p_Resources.getMessage("treenode.jonas.server.logging") - , "ListLoggers.do" - , "content", false); - addNode(p_ServerNode, node); - // Add all loggers - getLoggers(node, p_Resources, p_Request); - } - - /** - * Append nodes for each logger. - * - * @param p_LoggingNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - public void getLoggers(TreeControlNode p_LoggingNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - // Get WhereAreYou instance in session - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - // Get list of loggers with Action name - ArrayList al = null; - try { - al = JonasAdminJmx.getLoggers(p_Resources, oWhere, true); - // Build the node of each logger - LoggerItem oLog; - String sIcon = "icon/loggers.gif"; - String rootNodeName = p_LoggingNode.getName(); - String nodeName; - for (int i = 0; i < al.size(); i++) { - oLog = (LoggerItem) al.get(i); - if (LoggerItem.LOGGER_JONAS.equals(oLog.getType())) { - sIcon = "icon/logger_jonas.gif"; - nodeName = rootNodeName + WhereAreYou.NODE_SEPARATOR + LoggerItem.LOGGER_JONAS; - } else /*if (LoggerItem.LOGGER_CATALINA_ACCESS.equals(oLog.getType()) == true)*/ { - sIcon = "icon/logger_http.gif"; - nodeName = rootNodeName - + WhereAreYou.NODE_SEPARATOR - + oLog.getType() - + WhereAreYou.NODE_SEPARATOR - + oLog.getContainerName(); - } - // Add a logger node - TreeControlNode node = new TreeControlNode(nodeName, sIcon - , oLog.getName() - , oLog.getForward() - , "content", false); - addNode(p_LoggingNode, node); - } - } catch (MalformedObjectNameException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return; - } - } - - /** - * Append nodes for all defined services for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - * @exception Exception if an exception occurs building the tree - */ - protected void getServices(TreeControlNode p_ServerNode, MessageResources p_Resources - , HttpServletRequest p_Request, String p_DomainName, String p_ServerName) { - // Services node - TreeControlNode nodeAllServices = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "services" - , "icon/services.gif" - , p_Resources.getMessage("treenode.jonas.server.services") - , "ListServices.do" - , "content", false); - if (addNode(p_ServerNode, nodeAllServices)) { - String serverName = p_ServerName; - // Detail Service node - if (JonasAdminJmx.hasMBeanName(JonasObjectName.earService(p_DomainName), serverName)) { - getServiceApp(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.ejbService(p_DomainName), serverName)) { - getServiceEjbContainer(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.webContainerService(p_DomainName), serverName)) { - getServiceWeb(nodeAllServices, p_Resources, p_Request, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.databaseService(p_DomainName), serverName)) { - getServiceDatabase(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.resourceService(p_DomainName), serverName)) { - getServiceResourceAdapter(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.transactionService(p_DomainName), serverName)) { - getServiceTransaction(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.jmsService(p_DomainName), serverName)) { - getServiceJms(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.mailService(p_DomainName), serverName)) { - getServiceMail(nodeAllServices, p_Resources, p_Request, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.securityService(p_DomainName), serverName)) { - getServiceSecurity(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.discoveryService(p_DomainName), serverName)) { - getServiceDiscovery(nodeAllServices, p_Resources, p_DomainName, p_ServerName); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.wsService(p_DomainName), serverName)) { - getServiceWebService(nodeAllServices, p_Resources, p_Request, p_DomainName, p_ServerName); - } - } - } - - /** - * Append node for Ear service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - * - * @exception Exception if an exception occurs building the tree - */ - protected void getServiceApp(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "ear", "icon/service_application.gif" - , p_Resources.getMessage("treenode.jonas.server.services.ear") - , "ListAppContainers.do" - , "content", false); - if (addNode(p_NodeServices, nodeService)) { - // Add App Containers nodes - getAppContainers(nodeService, p_Resources, p_DomainName, p_ServerName); - } - } - - /** - * Append node for all App Containers. - * - * @param p_NodeParent Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - public void getAppContainers(TreeControlNode p_NodeParent, MessageResources p_Resources, String p_DomainName, String p_ServerName) { - String sPath; - String sFile; - String sNodeName; - String sName; - ArrayList al = new ArrayList(); - String serverName = p_ServerName; - // Get Container List - ObjectName ons = J2eeObjectName.J2EEApplications(p_DomainName, p_ServerName); - Iterator itNames = JonasManagementRepr.queryNames(ons, serverName).iterator(); - while (itNames.hasNext()) { - ObjectName it_on = (ObjectName) itNames.next(); - sPath = (String) JonasManagementRepr.getAttribute(it_on, "earUrl", serverName).toString(); - sFile = JonasAdminJmx.extractFilename(sPath); - sNodeName = p_NodeParent.getName() + WhereAreYou.NODE_SEPARATOR + sFile; - sName = it_on.getKeyProperty("name"); - if (sFile != null) { - al.add(new ContainerItem(sFile, sPath, sNodeName, it_on.toString(), sName)); - } - } - // Sort list - Collections.sort(al, new ContainerItemByFile()); - // Build nodes - ContainerItem oItem; - for (int i = 0; i < al.size(); i++) { - oItem = (ContainerItem) al.get(i); - TreeControlNode node = new TreeControlNode(oItem.getNodeName() - , "icon/ear.gif" - , oItem.getFile() - , "EditEar.do?select=" + oItem.getObjectName() - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append node for EJBContainer service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - * messages - */ - protected void getServiceEjbContainer(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "ejbContainers" - , "icon/service_ejb.gif" - , p_Resources.getMessage("treenode.jonas.server.services.ejbContainers") - , "ListContainers.do" - , "content", false); - if (addNode(p_NodeServices, nodeService)) { - getContainers(nodeService, p_Resources, p_DomainName, p_ServerName); - } - } - - /** - * Append node for all Containers. - * - * @param p_NodeParent Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - public void getContainers(TreeControlNode p_NodeParent - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - String sPath; - String sFile; - String sName; - String sNodeName; - ObjectName onContainer; - ArrayList al = new ArrayList(); - - // Get Container List - Iterator itNames = JonasManagementRepr.queryNames(J2eeObjectName.getEJBModules(p_DomainName, p_ServerName), p_ServerName).iterator(); - while (itNames.hasNext()) { - ObjectName it_on = (ObjectName) itNames.next(); - sPath = (String) JonasManagementRepr.getAttribute(it_on, "fileName", p_ServerName); - sFile = JonasAdminJmx.extractFilename(sPath); - sNodeName = p_NodeParent.getName() + WhereAreYou.NODE_SEPARATOR + sFile; - sName = it_on.getKeyProperty("name"); - if (sFile != null) { - al.add(new ContainerItem(sFile, sPath, sNodeName, it_on.toString(), sName)); - } - } - - // Sort list - Collections.sort(al, new ContainerItemByFile()); - // Build nodes - ContainerItem oItem; - for (int i = 0; i < al.size(); i++) { - oItem = (ContainerItem) al.get(i); - TreeControlNode node = new TreeControlNode(oItem.getNodeName() - , "icon/jar.gif" - , oItem.getFile() - , "EditContainer.do?select=" + oItem.getObjectName() - , "content", false); - if (addNode(p_NodeParent, node)) { - // Add ejb node - getEjbs(node, p_Resources, oItem.getPath(), p_DomainName, p_ServerName, oItem.getName()); - } - } - } - - /** - * Append node for all Ejbs for a Container. - * - * @param p_NodeParent Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Filename Filename of container - */ - protected void getEjbs(TreeControlNode p_NodeParent, MessageResources p_Resources - , String p_Filename, String p_DomainName, String p_ServerName, String p_moduleName) { - //String sName; - Iterator itNames; - ObjectName on; - ArrayList al = new ArrayList(); - - on = J2eeObjectName.getEntityBeans(p_DomainName, p_moduleName, p_ServerName); - - itNames = JonasAdminJmx.getListMbean(on, p_ServerName).iterator(); - while (itNames.hasNext()) { - al.add(new EjbItem((ObjectName) itNames.next(), p_ServerName)); - } - on = J2eeObjectName.getStatefulSessionBeans(p_DomainName, p_moduleName, p_ServerName); - itNames = JonasAdminJmx.getListMbean(on, p_ServerName).iterator(); - while (itNames.hasNext()) { - al.add(new EjbItem((ObjectName) itNames.next(), p_ServerName)); - } - on = J2eeObjectName.getStatelessSessionBeans(p_DomainName, p_moduleName, p_ServerName); - itNames = JonasAdminJmx.getListMbean(on, p_ServerName).iterator(); - while (itNames.hasNext()) { - al.add(new EjbItem((ObjectName) itNames.next(), p_ServerName)); - } - on = J2eeObjectName.getMessageDrivenBeans(p_DomainName, p_moduleName, p_ServerName); - itNames = JonasAdminJmx.getListMbean(on, p_ServerName).iterator(); - while (itNames.hasNext()) { - al.add(new EjbItem((ObjectName) itNames.next(), p_ServerName)); - } - - // Sort by name - Collections.sort(al, new EjbItemByNameComparator()); - - // Add all node Ejb - String sNodeName; - String sAction; - TreeControlNode nodeEjb; - EjbItem oEjb; - for (int i = 0; i < al.size(); i++) { - oEjb = (EjbItem) al.get(i); - sNodeName = p_NodeParent.getName() + WhereAreYou.NODE_SEPARATOR + oEjb.getName(); - sAction = "EditEjb" + oEjb.getTypeString() + ".do?select=" + oEjb.getObjectName(); - // Add node Ejb - nodeEjb = new TreeControlNode(sNodeName - , "icon/bean.gif" - , oEjb.getName() - , sAction - , "content", false); - addNode(p_NodeParent, nodeEjb); - } - } - - /** - * Append node for Database service for the JOnAS services. - * - * @param pNodeServices Services node for the tree control - * @param pResources The MessageResources for our localized messages - * @param pDomainName The name of the current management domain - * @param pServerName The name of the currently managed JOnAS server - */ - protected void getServiceDatabase(TreeControlNode pNodeServices - , MessageResources pResources, String pDomainName, String pServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(pNodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "database" - , "icon/service_database.gif" - , pResources.getMessage("treenode.jonas.server.services.database") - , "ListDatabases.do" - , "content", false); - if (addNode(pNodeServices, nodeService)) { - // Add Datasources nodes - getDatasources(nodeService, pResources, pDomainName, pServerName); - } - } - - /** - * Append node for all deployed Datasources. - * - * @param pNodeParent Server node for the tree control - * @param pResources The MessageResources for our localized messages - * @param pDomainName The name of the current management domain - * @param pServerName The name of the currently managed JOnAS server - */ - public void getDatasources(TreeControlNode pNodeParent - , MessageResources pResources, String pDomainName, String pServerName) { - - ArrayList al = JonasAdminJmx.getDatasourceFilesDeployed(pDomainName, pServerName); - // Build nodes - for (int i = 0; i < al.size(); i++) { - TreeControlNode node = new TreeControlNode(pNodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + al.get(i).toString() - , "icon/Datasource.gif" - , al.get(i).toString() - , "EditDatasource.do?name=" + al.get(i), "content", false); - addNode(pNodeParent, node); - } - } - - /** - * Append node for Web service for the JOnAS services. - * - * @param pNodeServices Services node for the tree control - * @param pResources The MessageResources for our localized messages - * @param pRequest The servlet request we are processing - * @param pDomainName The name of the current management domain - * @param pServerName The name of the currently managed JOnAS server - */ - protected void getServiceWeb(TreeControlNode pNodeServices, MessageResources pResources - , HttpServletRequest pRequest, String pDomainName, String pServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(pNodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "web" - , "icon/service_web.gif" - , pResources.getMessage("treenode.jonas.server.services.web") - , "ListWebContainers.do" - , "content", false); - if (addNode(pNodeServices, nodeService)) { - // Add Web Containers nodes - getWebContainers(nodeService, pResources, pRequest); - } - } - - /** - * Append node for all Web Containers. - * - * @param p_NodeParent Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - public void getWebContainers(TreeControlNode p_NodeParent, MessageResources p_Resources - , HttpServletRequest p_Request) { - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - String domainName = oWhere.getCurrentDomainName(); - ArrayList al = new ArrayList(); - // Detect Catalina items present - if (oWhere.isCatalinaServer()) { - // Get the list of WebModule - Iterator itOns = JonasAdminJmx.getListMbean(J2eeObjectName.getWebModules(oWhere. - getCurrentCatalinaDomainName()), serverName).iterator(); - while (itOns.hasNext()) { - WebAppItem item = new WebAppItem((ObjectName) itOns.next(), oWhere.getCurrentCatalinaDefaultHostName()); - al.add(item); - } - } - // Detect Jetty items present - else if (oWhere.isJettyServer()) { - ObjectName on; - String sPathContext; - HashMap hWebAppItems = new HashMap(); - - // Get the list of Jetty contexts - Iterator itOnContexts = JonasAdminJmx.getListMbean(JettyObjectName.jettyContexts(domainName), serverName). - iterator(); - while (itOnContexts.hasNext()) { - on = (ObjectName) itOnContexts.next(); - sPathContext = on.getKeyProperty("context"); - if (sPathContext != null) { - if (!hWebAppItems.containsKey(sPathContext) && on.getKeyProperty("WebApplicationContext") != null && - on.getKeyProperty("WebApplicationHandler") == null && on.getKeyProperty("config") == null) { - WebAppItem item = new WebAppItem(sPathContext, on.toString()); - hWebAppItems.put(sPathContext, item); - } - } - } - // Prepare to display - al.addAll(hWebAppItems.values()); - } - WebAppItemByPathContext webAppItemByPathContext = new WebAppItemByPathContext(); - // Sort list - Collections.sort(al, webAppItemByPathContext); - // Build nodes - WebAppItem oItem; - for (int i = 0; i < al.size(); i++) { - oItem = (WebAppItem) al.get(i); - TreeControlNode node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getObjectName() - , "icon/war.gif" - , oItem.getLabelPathContext() - , "EditWebApp.do?on=" + oItem.getObjectName() - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append node for Transaction service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - * messages - * - * @exception Exception if an exception occurs building the tree - */ - protected void getServiceTransaction(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "transaction" - , "icon/service_transaction.gif" - , p_Resources.getMessage("treenode.jonas.server.services.transaction") - , "EditJtmService.do" - , "content", false); - addNode(p_NodeServices, nodeService); - } - - /** - * Append node for discovery service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - * messages - */ - protected void getServiceDiscovery(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "discovery" - , "icon/service_transaction.gif" - , p_Resources.getMessage("treenode.jonas.server.services.discovery") - , "EditServiceDiscovery.do" - , "content", false); - addNode(p_NodeServices, nodeService); - } - - /** - * Append node for WebService (ws) service for the JOnAS services. - * - * @param p_NodeServices - * Services node for the tree control - * @param p_Resources - * The MessageResources for our localized messages - * @param request - * The HTTP request object currently in use. - * @param p_DomainName - * The domain name for the instance - * @param p_ServerName - * The server name for the instance being monitored - */ - public void getServiceWebService(TreeControlNode p_NodeServices, - MessageResources p_Resources, HttpServletRequest request, String p_DomainName, - String p_ServerName) { - String nodeName = p_NodeServices.getName() + WhereAreYou.NODE_SEPARATOR + "WebService"; - TreeControlNode nodeService = null; - // Rebuild the webservice tree. - nodeService = p_NodeServices.getTree().findNode(nodeName); - if (nodeService != null) { - nodeService.remove(); - } - // (Re)Add Web Service node - nodeService = new TreeControlNode( - nodeName, - "icon/war.gif", - p_Resources.getMessage("treenode.jonas.server.services.webservices"), - "ListWebService.do", - "content", - false); - if (addNode(p_NodeServices, nodeService)) { - getWebServiceDetails(nodeService, p_Resources, request); - } - } - - /** - * Append Web Service names for web services node in tree. - * - * @param p_WebServicesNode - * Web Services node for the tree control - * @param p_Resources - * The MessageResources for our localized messages - * @param p_Request - * The servlet request we are processing - */ - public void getWebServiceDetails(TreeControlNode p_webServicesNode, - MessageResources p_Resources, HttpServletRequest p_Request) { - // Get WhereAreYou - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute( - WhereAreYou.SESSION_NAME); - - // Get the server name - String serverName = oWhere.getCurrentJonasServerName(); - // Get the list of webservice descriptions from mbean server. - Collection al = new ArrayList(); - JOnASProvider jProvider = new JOnASProvider(serverName); - try { - al = jProvider.getWebServiceDescription(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return; - } - - // Build the nodes - TreeControlNode node; - WebServiceDescriptionItem oWebServiceDescription = null; - String sLabel; - Iterator it = al.iterator(); - while (it.hasNext()) { - oWebServiceDescription = (WebServiceDescriptionItem) it.next(); - node = new TreeControlNode(p_webServicesNode.getName() - + WhereAreYou.NODE_SEPARATOR - + oWebServiceDescription.getName() - , "icon/war.gif" - , oWebServiceDescription.getName() - , "WebServiceDetails.do?select=" + oWebServiceDescription.getName() - , "content", false); - if (addNode(p_webServicesNode, node)) { - getPortComponents(oWebServiceDescription, node, p_Resources); - } - } - } - - /** - * Append port component names for a web service node in tree. - * - * @param wsd - * Web Service Description for current web service. - * @param p_WebServicesNode - * Connector node for the tree control - * @param p_Resources - * The MessageResources for our localized messages - */ - private void getPortComponents(WebServiceDescriptionItem wsd, - TreeControlNode p_webServiceNode, MessageResources p_Resources) { - String sLabel; - // Build the nodes - TreeControlNode node = null; - for (int i = 0; i < wsd.getPortComponentCount(); i++) { - PortComponentItem pc = wsd.getPortComponent(i); - node = new TreeControlNode(p_webServiceNode.getName() - + WhereAreYou.NODE_SEPARATOR + pc.getName() - , "icon/war.gif" - , pc.getName() - , "PortComponentsDetails.do?pcselect=" + pc.getName() + "&wsdselect=" + wsd.getName() - , "content", false); - if (addNode(p_webServiceNode, node)) { - getPortComponentHandler(wsd, pc, node, p_Resources); - } - } - - } - - /** - * Append handler names for port component node in tree. - * - * @param wsd - * Web Service Description for current web service. - * @param pc - * Port Component for current web service. - * @param p_portComponentNode - * Port component node for the tree control - * @param p_Resources - * The MessageResources for our localized messages - */ - private void getPortComponentHandler(WebServiceDescriptionItem wsd, - PortComponentItem pc, TreeControlNode p_portComponentNode, - MessageResources p_Resources) { - // Build the nodes - TreeControlNode node = null; - for (int i = 0; i < pc.getHandlerCount(); i++) { - HandlerItem handler = pc.getHandler(i); - node = new TreeControlNode(p_portComponentNode.getName() - + WhereAreYou.NODE_SEPARATOR + handler.getName() - , "icon/war.gif" - , handler.getName() - , "HandlersDetails.do?pcselect=" + pc.getName() + "&wsdselect=" - + wsd.getName() + "&handlerselect=" + handler.getName() - , "content", false); - addNode(p_portComponentNode, node); - } - - } - - /** - * Append node for Jms service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getServiceJms(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "jms" - , "icon/service_jms.gif" - , p_Resources.getMessage("treenode.jonas.server.services.jms") - , "EditJmsService.do" - , "content", false); - if (addNode(p_NodeServices, nodeService)) { - // Add JMS administred objects (resources) - getJmsResources(nodeService, p_Resources, p_DomainName, p_ServerName); - } - } - - /** - * Append 3 subnodes for the JMS resource types + subnodes for all the ressources - * - * @param p_NodeParent JMS service node - * @param p_Resources The MessageResources for our localized messages - */ - public void getJmsResources(TreeControlNode p_NodeParent - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add node for Connection Factories - TreeControlNode node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + "cf" - , "icon/jms_connector.gif" - , p_Resources.getMessage("treenode.jonas.server.services.jms.cf") - , "ListConnectionFactories.do" - , "content", false); - if (addNode(p_NodeParent, node)) { - getJmsConnectionFactories(node, p_Resources, p_DomainName, p_ServerName); - } - // Add node for Queues - node = new TreeControlNode(p_NodeParent.getName() + WhereAreYou.NODE_SEPARATOR + "queue" - , "icon/jms_queue.gif" - , p_Resources.getMessage("treenode.jonas.server.services.jms.queues") - , "ListQueues.do" - , "content", false); - if (addNode(p_NodeParent, node)) { - getJmsQueues(node, p_Resources, p_DomainName, p_ServerName); - } - // Add node for Topics - node = new TreeControlNode(p_NodeParent.getName() + WhereAreYou.NODE_SEPARATOR + "topic" - , "icon/jms_topic.gif" - , p_Resources.getMessage("treenode.jonas.server.services.jms.topics") - , "ListTopics.do" - , "content", false); - if (addNode(p_NodeParent, node)) { - getJmsTopics(node, p_Resources, p_DomainName, p_ServerName); - } - } - - /** - * Append subnodes for ConnectionFactory resources - * - * @param p_NodeParent CFs subnode - * @param p_Resources The MessageResources for our localized messages - */ - public void getJmsConnectionFactories(TreeControlNode p_NodeParent - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Get the 3 connection factories created by default: - // - default ConnectionFactory , default Topic ConnectionFactory, default Queue ConnectionFactory, - int nbConnFacts = 3; - String cfNames[] = new String[3]; - ObjectName jmsServMB = JonasObjectName.jmsService(p_DomainName); - cfNames[0] = (String) JonasManagementRepr.getAttribute(jmsServMB - , "DefaultConnectionFactoryName", p_ServerName); - cfNames[1] = (String) JonasManagementRepr.getAttribute(jmsServMB - , "DefaultTopicConnectionFactoryName", p_ServerName); - cfNames[2] = (String) JonasManagementRepr.getAttribute(jmsServMB - , "DefaultQueueConnectionFactoryName", p_ServerName); - TreeControlNode node; - for (int i = 0; i < nbConnFacts; i++) { - node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + cfNames[i] - , "icon/jms_connector.gif" - , cfNames[i] - , "PresentConnectionFactory.do?name=" + cfNames[i] - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append subnodes node for Queue destinations - * - * @param p_NodeParent Queue subnode - * @param p_Resources The MessageResources for our localized messages - */ - public void getJmsQueues(TreeControlNode p_NodeParent - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Get queues list - Iterator itNames = ((java.util.Set) JonasManagementRepr.getAttribute(JonasObjectName. - jmsService(p_DomainName), "AllJmsQueueDestinationNames", p_ServerName)).iterator(); - while (itNames.hasNext()) { - String sNodeName = (String) itNames.next(); - String sQueueName = sNodeName; - // Add node for each queue - TreeControlNode node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + sNodeName - , "icon/jms_queue.gif" - , sQueueName - , "PresentQueue.do?name=" + sQueueName - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append subnodes node for Topic destinations - * - * @param p_NodeParent Topic subnode - * @param p_Resources The MessageResources for our localized messages - */ - public void getJmsTopics(TreeControlNode p_NodeParent - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Get topics list - Iterator itNames = ((java.util.Set) JonasManagementRepr.getAttribute(JonasObjectName. - jmsService(p_DomainName), "AllJmsTopicDestinationNames", p_ServerName)).iterator(); - while (itNames.hasNext()) { - String sNodeName = (String) itNames.next(); - String sTopicName = sNodeName; - // Add node for each topic - TreeControlNode node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + sNodeName - , "icon/jms_topic.gif", sTopicName - , "PresentTopic.do?name=" + sTopicName - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append node for Mail service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - * messages - */ - protected void getServiceMail(TreeControlNode p_NodeServices, MessageResources p_Resources - , HttpServletRequest p_Request, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "mail", "icon/service_mail.gif" - , p_Resources.getMessage("treenode.jonas.server.services.mail") - , "EditMailService.do" - , "content", false); - if (addNode(p_NodeServices, nodeService)) { - // Add nodes for MailFactories - getAllSessionMailFactories(nodeService, p_Resources, p_Request); - getAllMimePartDSMailFactories(nodeService, p_Resources, p_Request); - } - } - - public void getAllSessionMailFactories(TreeControlNode p_NodeParent - , MessageResources p_Resources, HttpServletRequest p_Request) { - // Add parent node for all the Session Mail Factories - TreeControlNode nodeSessionMailFactories = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + "session" - , "icon/mail_session.gif" - , p_Resources.getMessage("treenode.jonas.server.services.mail.session") - , "ListSessionMailFactories.do" - , "content", false); - if (addNode(p_NodeParent, nodeSessionMailFactories)) { - // Add a node for each Session Mail Factory - getSessionMailFactories(nodeSessionMailFactories, p_Resources, p_Request); - } - } - - public void getAllMimePartDSMailFactories(TreeControlNode p_NodeParent - , MessageResources p_Resources, HttpServletRequest p_Request) { - // Add parent node for all the Session Mail Factories - TreeControlNode nodeMimePartMailFactories = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + "mimepart" - , "icon/mail_mime.gif" - , p_Resources.getMessage("treenode.jonas.server.services.mail.mimepart") - , "ListMimePartMailFactories.do" - , "content", false); - if (addNode(p_NodeParent, nodeMimePartMailFactories)) { - // Add a node for each Session Mail Factory - getMimePartMailFactories(nodeMimePartMailFactories, p_Resources, p_Request); - } - } - - protected void getSessionMailFactories(TreeControlNode p_NodeParent - , MessageResources p_Resources, HttpServletRequest p_Request) { - String sPath; - String sFile; - String sNodeName; - ArrayList al = new ArrayList(); - - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - - // Get list - java.util.List deployedFactories = (java.util.List) JonasAdminJmx. - getSessionMailFactoriesDeployed(oWhere); - Iterator itNames = deployedFactories.iterator(); - while (itNames.hasNext()) { - al.add(itNames.next().toString()); - } - // Sort list - Collections.sort(al); - // Build nodes - for (int i = 0; i < al.size(); i++) { - TreeControlNode node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + al.get(i).toString() - , "icon/mail_session.gif" - , al.get(i).toString() - , "EditSessionMailFactory.do?name=" + al.get(i).toString() - , "content", false); - addNode(p_NodeParent, node); - } - } - - protected void getMimePartMailFactories(TreeControlNode p_NodeParent - , MessageResources p_Resource, HttpServletRequest p_Request) { - String sPath; - String sFile; - String sNodeName; - ArrayList al = new ArrayList(); - - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - - // Get List - Iterator itNames = ((java.util.List) JonasAdminJmx.getMimeMailPartFactoriesDeployed(oWhere)). - iterator(); - while (itNames.hasNext()) { - al.add(itNames.next().toString()); - } - // Sort list - Collections.sort(al); - // Build nodes - for (int i = 0; i < al.size(); i++) { - TreeControlNode node = new TreeControlNode(p_NodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + al.get(i).toString() - , "icon/mail_mime.gif" - , al.get(i).toString() - , "EditMimePartMailFactory.do?name=" + al.get(i).toString() - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append node for Resource service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getServiceResourceAdapter(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "resourceAdapter" - , "icon/service_resource.gif" - , p_Resources.getMessage("treenode.jonas.server.services.resource") - , "ListResourceAdapters.do" - , "content", false); - if (addNode(p_NodeServices, nodeService)) { - // Add Containers nodes - getResourceAdapters(nodeService, p_Resources, p_DomainName, p_ServerName); - } - } - - /** - * Append node for all Resource Adapters. - * - * @param p_NodeParent Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param pDomainName The name of the current management domain - * @param pServerName The name of the currently managed JOnAS server - */ - public void getResourceAdapters(TreeControlNode p_NodeParent, MessageResources p_Resources, - String p_DomainName, String p_ServerName) { - String sPath; - String sFile; - String sNodeName; - String sName; - ObjectName on; - ArrayList al = new ArrayList(); - - // Get Resource Adapters - ObjectName ons = J2eeObjectName.getResourceAdapters(p_DomainName, p_ServerName); - Iterator itNames = JonasManagementRepr.queryNames(ons, p_ServerName).iterator(); - while (itNames.hasNext()) { - ObjectName it_on = (ObjectName) itNames.next(); - sPath = (String) JonasManagementRepr.getAttribute(it_on, "fileName", p_ServerName); - sFile = JonasAdminJmx.extractFilename(sPath); - sNodeName = p_NodeParent.getName() + WhereAreYou.NODE_SEPARATOR + sFile; - sName = it_on.getKeyProperty("name"); - if (sFile != null) { - al.add(new ResourceItem(sFile, sPath, sNodeName, it_on.toString(), sName)); - } - } - // Sort list - Collections.sort(al, new ResourceItemByFile()); - // Build nodes - ResourceItem oItem; - for (int i = 0; i < al.size(); i++) { - oItem = (ResourceItem) al.get(i); - TreeControlNode node = new TreeControlNode(oItem.getNodeName() - , "icon/ear.gif" - , oItem.getFile() - , "EditResourceAdapter.do?select=" + oItem.getObjectName() - , "content", false); - addNode(p_NodeParent, node); - } - } - - /** - * Append node for Security service for the JOnAS services. - * - * @param p_NodeServices Services node for the tree control - * @param p_Resources The MessageResources for our localized messages - * messages - */ - protected void getServiceSecurity(TreeControlNode p_NodeServices - , MessageResources p_Resources, String p_DomainName, String p_ServerName) { - // Add Service node - TreeControlNode nodeService = new TreeControlNode(p_NodeServices.getName() - + WhereAreYou.NODE_SEPARATOR + "security" - , "icon/service_security.gif" - , p_Resources.getMessage("treenode.jonas.server.services.security") - , "EditServiceSecurity.do" - , "content", false); - addNode(p_NodeServices, nodeService); - } - - /** - * Append nodes for Deployments services for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDeployments(TreeControlNode p_ServerNode - , MessageResources p_Resources, HttpServletRequest p_Request) { - // Deployments node - TreeControlNode nodeDeployments = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "deployments", "icon/deploy.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments"), null, "content", false); - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - String domainName = oWhere.getCurrentDomainName(); - if (addNode(p_ServerNode, nodeDeployments)) { - // Detail Service node - if (JonasAdminJmx.hasMBeanName(JonasObjectName.earService(domainName), serverName)) { - getDeploymentEar(nodeDeployments, p_Resources); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.ejbService(domainName), serverName)) { - getDeploymentEjb(nodeDeployments, p_Resources); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.webContainerService(domainName), serverName)) { - getDeploymentWebAppli(nodeDeployments, p_Resources); - } - if (JonasAdminJmx.hasMBeanName(JonasObjectName.resourceService(domainName), serverName)) { - getDeploymentRar(nodeDeployments, p_Resources); - } - } - } - - /** - * Append node for Ear deployment. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDeploymentEar(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - // Add node - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DEPLOYMENT_STRING_EAR - , "icon/deploy_ear.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." - + WhereAreYou.DEPLOYMENT_STRING_EAR) - , "EditDeploy.do?type=" + WhereAreYou.DEPLOYMENT_STRING_EAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append node for Ejb deployment. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDeploymentEjb(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - // Add node - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DEPLOYMENT_STRING_JAR - , "icon/deploy_jar.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." - + WhereAreYou.DEPLOYMENT_STRING_JAR) - , "EditDeploy.do?type=" + WhereAreYou.DEPLOYMENT_STRING_JAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append node for Web deployment. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getDeploymentWebAppli(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - // Add node - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DEPLOYMENT_STRING_WAR - , "icon/deploy_war.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." - + WhereAreYou.DEPLOYMENT_STRING_WAR) - , "EditDeploy.do?type=" + WhereAreYou.DEPLOYMENT_STRING_WAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append node for Rar deployment. - * - * @param p_NodeDeployments Deployment node for the tree control - * @param p_Resources The MessageResources for our localized messages - * - * @exception Exception if an exception occurs building the tree - */ - protected void getDeploymentRar(TreeControlNode p_NodeDeployments, MessageResources p_Resources) { - // Add node - TreeControlNode oNode = new TreeControlNode(p_NodeDeployments.getName() - + WhereAreYou.NODE_SEPARATOR + WhereAreYou.DEPLOYMENT_STRING_RAR - , "icon/deploy_rar.gif" - , p_Resources.getMessage("treenode.jonas.server.deployments." - + WhereAreYou.DEPLOYMENT_STRING_RAR) - , "EditDeploy.do?type=" + WhereAreYou.DEPLOYMENT_STRING_RAR - , "content", false); - addNode(p_NodeDeployments, oNode); - } - - /** - * Append nodes for Resources services for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getResources(TreeControlNode p_ServerNode - , MessageResources p_Resources, HttpServletRequest p_Request) { - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - String domainName = oWhere.getCurrentDomainName(); - - // Resources node - TreeControlNode nodeDeployments = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "resources" - , "icon/resources.gif" - , p_Resources.getMessage("treenode.jonas.server.resources") - , null, "content", false); - if (addNode(p_ServerNode, nodeDeployments)) { - // - database resources - if (JonasAdminJmx.hasMBeanName(JonasObjectName.databaseService(domainName), serverName)) { - getResourceDatabase(nodeDeployments, p_Resources); - } - // - jms resources - if (JonasAdminJmx.hasMBeanName(JonasObjectName.jmsService(domainName), serverName)) { - getJmsResource(nodeDeployments, p_Resources); - } - // - mail resources - if (JonasAdminJmx.hasMBeanName(JonasObjectName.mailService(domainName), serverName)) { - getMailResource(nodeDeployments, p_Resources); - } - } - } - - /** - * Append nodes for Mail Resources for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getMailResource(TreeControlNode p_ServerNode, MessageResources p_Resources) { - // Mail resources node - TreeControlNode nodeDeployments = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "mail" - , "icon/mail.gif" - , p_Resources.getMessage("treenode.jonas.server.resources.mail") - , "EditDeploy.do?type=" + WhereAreYou.DEPLOYMENT_STRING_MAILFACTORY - , "content", false); - addNode(p_ServerNode, nodeDeployments); - } - - /** - * Append nodes for Jms Resource for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getJmsResource(TreeControlNode p_ServerNode, MessageResources p_Resources) { - // Jms resources node - TreeControlNode nodeDeployments = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "jms" - , "icon/jms.gif" - , p_Resources.getMessage("treenode.jonas.server.resources.jms") - , "ListJmsResources.do" - , "content", false); - addNode(p_ServerNode, nodeDeployments); - } - - /** - * Append nodes for Database Resource for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - protected void getResourceDatabase(TreeControlNode p_ServerNode, MessageResources p_Resources) { - // Database Resources node - TreeControlNode nodeDeployments = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "database" - , "icon/Database.gif" - , p_Resources.getMessage("treenode.jonas.server.resources.database") - , "EditDeploy.do?type=" + WhereAreYou.DEPLOYMENT_STRING_DATASOURCE - , "content", false); - addNode(p_ServerNode, nodeDeployments); - } - - /** - * Append nodes for Security for the specified server. - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getSecurity(TreeControlNode p_ServerNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - String domainName = oWhere.getCurrentDomainName(); - // Detect JOnAS item presents - boolean bJonasSecurityService = JonasAdminJmx.hasMBeanName(JonasObjectName.securityService(domainName), serverName); - // Detect Catalina items present - boolean bCatalinaRealm = false; - if (oWhere.isCatalinaServer()) { - ObjectName catalinaRealmOn = null; - try { - catalinaRealmOn = CatalinaObjectName.catalinaRealm(oWhere.getCurrentCatalinaServiceName()); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get catalina realm: " + e); - } - return; - } - bCatalinaRealm = JonasAdminJmx.hasMBeanName(catalinaRealmOn, serverName); - } - // Add nodes - if ((bJonasSecurityService) || (bCatalinaRealm)) { - // Active action - String sAction = null; - if (bJonasSecurityService) { - sAction = "ListRealms.do?realm=all"; - } - else if (bCatalinaRealm) { - sAction = "EditSecurityCatalinaRealm.do"; - } - // Security node - TreeControlNode nodeSecurity = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "security" - , "icon/security.gif" - , p_Resources.getMessage("treenode.jonas.server.security") - , sAction - , "content", false); - if (addNode(p_ServerNode, nodeSecurity)) { - // Detail Security node for JOnAS service - if (bJonasSecurityService) { - getSecurityFactories(nodeSecurity, p_Resources, p_Request); - } - } - } - } - - /** - * Append nodes for Security factories for the specified server. - * - * @param p_SecurityNode Security node for the tree control - * @param p_Resources The MessageResources for our localized messages - */ - public void getSecurityFactories(TreeControlNode p_SecurityNode - , MessageResources p_Resources, HttpServletRequest p_Request) { - ArrayList al = null; - String sName = null; - TreeControlNode nodeSecurityFactories = null; - TreeControlNode nodeSecurityFactory = null; - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - String domainName = oWhere.getCurrentDomainName(); - // Security Memory factories - try { - al = JonasAdminJmx.getSecurityMemoryFactories(domainName, serverName); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get memory security factories: " + e); - } - } - if (al.size() > 0) { - // Security factories node - nodeSecurityFactories = new TreeControlNode(p_SecurityNode.getName() - + WhereAreYou.NODE_SEPARATOR + "factory.memory" - , "icon/security_memory.gif" - , p_Resources.getMessage("treenode.jonas.server.security.factory.memory") - , "ListRealms.do?realm=memory" - , "content", false); - if (addNode(p_SecurityNode, nodeSecurityFactories)) { - // List Security factories - for (int i = 0; i < al.size(); i++) { - sName = al.get(i).toString(); - // Security factory node - nodeSecurityFactory = new TreeControlNode(nodeSecurityFactories.getName() - + WhereAreYou.NODE_SEPARATOR + sName - , "icon/security_memory.gif", sName - , "EditMemoryRealm.do?resource=" + sName - , "content", false); - addNode(nodeSecurityFactories, nodeSecurityFactory); - } - } - } - // Security Datasource factories - try { - al = JonasAdminJmx.getSecurityDatasourceFactories(domainName, serverName); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get datasource security factories: " + e); - } - } - if (al.size() > 0) { - // Security factories node - nodeSecurityFactories = new TreeControlNode(p_SecurityNode.getName() - + WhereAreYou.NODE_SEPARATOR + "factory.datasource", "icon/security_database.gif" - , p_Resources.getMessage("treenode.jonas.server.security.factory.datasource") - , "ListRealms.do?realm=datasource", "content", false); - if (addNode(p_SecurityNode, nodeSecurityFactories)) { - // List Security factories - for (int i = 0; i < al.size(); i++) { - sName = al.get(i).toString(); - // Security factory node - nodeSecurityFactory = new TreeControlNode(nodeSecurityFactories.getName() - + WhereAreYou.NODE_SEPARATOR + sName - , "icon/security_database.gif", sName - , "EditDatasourceRealm.do?resource=" + sName - , "content", false); - addNode(nodeSecurityFactories, nodeSecurityFactory); - } - } - } - // Security Ldap factories - try { - al = JonasAdminJmx.getSecurityLdapFactories(domainName, serverName); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get ldap security factories: " + e); - } - } - if (al.size() > 0) { - // Security factories node - nodeSecurityFactories = new TreeControlNode(p_SecurityNode.getName() - + WhereAreYou.NODE_SEPARATOR + "factory.ldap" - , "icon/security_ldap.gif" - , p_Resources.getMessage("treenode.jonas.server.security.factory.ldap") - , "ListRealms.do?realm=ldap" - , "content", false); - if (addNode(p_SecurityNode, nodeSecurityFactories)) { - // List Security factories - for (int i = 0; i < al.size(); i++) { - sName = al.get(i).toString(); - // Security factory node - nodeSecurityFactory = new TreeControlNode(nodeSecurityFactories.getName() - + WhereAreYou.NODE_SEPARATOR + sName - , "icon/security_ldap.gif", sName - , "EditLdapRealm.do?resource=" + sName - , "content", false); - addNode(nodeSecurityFactories, nodeSecurityFactory); - } - } - } - } - - /** - * Append nodes for Memory Security Factory for the specified server. - * - * @param p_SecurityMemoryNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_ResourceFactory The name of resource - */ - protected void getSecurityMemoryFactory(TreeControlNode p_SecurityMemoryNode - , MessageResources p_Resources, String p_ResourceFactory) { - TreeControlNode node = null; - // Users node - node = new TreeControlNode(p_SecurityMemoryNode.getName() - + WhereAreYou.NODE_SEPARATOR + "users", "icon/security_memory.gif" - , p_Resources.getMessage("treenode.jonas.server.security.factory.memory.users") - , "EditMemoryRealmUsers.do?resource=" + p_ResourceFactory - , "content", false); - addNode(p_SecurityMemoryNode, node); - // Groups node - node = new TreeControlNode(p_SecurityMemoryNode.getName() - + WhereAreYou.NODE_SEPARATOR + "groups", "icon/security_memory.gif" - , p_Resources.getMessage("treenode.jonas.server.security.factory.memory.groups") - , "EditMemoryRealmGroups.do?resource=" + p_ResourceFactory - , "content", false); - addNode(p_SecurityMemoryNode, node); - // Roles node - node = new TreeControlNode(p_SecurityMemoryNode.getName() - + WhereAreYou.NODE_SEPARATOR + "roles", "icon/security_memory.gif" - , p_Resources.getMessage("treenode.jonas.server.security.factory.memory.roles") - , "EditMemoryRealmRoles.do?resource=" + p_ResourceFactory - , "content", false); - addNode(p_SecurityMemoryNode, node); - } - - /** - * Append nodes for the Servlet server - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getProtocols(TreeControlNode p_ServerNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - // Catalina server - ObjectName cOn; - try { - cOn = CatalinaObjectName.catalinaServer(); - if (JonasAdminJmx.hasMBeanName(cOn, serverName)) { - getCatalinaProtocols(p_ServerNode, p_Resources, p_Request); - } - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get Catalina Server MBean: " + e); - } - return; - } - } - - /** - * Append nodes for the Catalina server - * - * @param p_ServerNode Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getCatalinaProtocols(TreeControlNode p_ServerNode, MessageResources p_Resources - , HttpServletRequest p_Request) { - // Add Catalina server node - TreeControlNode catalinaNode = new TreeControlNode(p_ServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "protocols" - , "icon/protocol.gif" - , p_Resources.getMessage("treenode.jonas.server.protocols") - , "ListCatalinaConnectors.do" - , "content", false); - if (addNode(p_ServerNode, catalinaNode)) { - // Add Connectors nodes - getCatalinaConnector(catalinaNode, p_Resources, p_Request); - } - } - - /** - * Append node for the Connector catalina server - * - * @param p_CatalinaServerNode Catalina Server node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - protected void getCatalinaConnector(TreeControlNode p_CatalinaServerNode - , MessageResources p_Resources, HttpServletRequest p_Request) { - // Add Connector node - TreeControlNode connectorNode = new TreeControlNode(p_CatalinaServerNode.getName() - + WhereAreYou.NODE_SEPARATOR + "connectors" - , "icon/connectors.gif" - , p_Resources.getMessage("treenode.jonas.server.protocols.connectors") - , "ListCatalinaConnectors.do" - , "content", false); - if (addNode(p_CatalinaServerNode, connectorNode)) { - getCatalinaDetailConnectors(connectorNode, p_Resources, p_Request); - } - } - - /** - * Append nodes for all the Connectors catalina server - * - * @param p_ConnectorNode Connector node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - public void getCatalinaDetailConnectors(TreeControlNode p_ConnectorNode - , MessageResources p_Resources, HttpServletRequest p_Request) { - - // Get WhereAreYou - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - - String serverName = oWhere.getCurrentJonasServerName(); - // Get the domain name - String sDomain = oWhere.getCurrentCatalinaDomainName(); - int appServerPort = oWhere.getApplicationServerPort(); - // Get the list of connectors - ArrayList al = new ArrayList(); - ObjectName conns = null; - try { - conns = CatalinaObjectName.catalinaConnectors(sDomain); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get catalina connectors MBeans: " + e); - } - return; - } - Iterator it = JonasAdminJmx.getListMBeanName(conns, serverName).iterator(); - while (it.hasNext()) { - String ons = (String) it.next(); - ObjectName connOn = null; - try { - connOn = ObjectName.getInstance(ons); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.INFO)) { - logger.log(BasicLevel.INFO, "Can't get catalina connector MBean " + ons + ": " + e); - } - continue; - } - ConnectorItem item = new ConnectorItem(connOn, appServerPort, serverName); - al.add(item); - } - // Sort - Collections.sort(al, new ConnectorItemByPort()); - // Build the nodes - TreeControlNode node; - ConnectorItem oConnector; - String sLabel; - for (int i = 0; i < al.size(); i++) { - oConnector = (ConnectorItem) al.get(i); - String nodeName = p_ConnectorNode.getName() - + WhereAreYou.NODE_SEPARATOR - + sDomain - + WhereAreYou.NODE_SEPARATOR - + oConnector.getPort(); - String address = oConnector.getAddress(); - if (address != null) { - nodeName = nodeName + address; - } - node = new TreeControlNode(nodeName, "icon/connector.gif" - , oConnector.getLabel() - , "EditCatalinaConnector.do?select=" + oConnector.getObjectName() - , "content", false); - addNode(p_ConnectorNode, node); - } - } - - /** - * Append node for JORAM platform management. - * - * @param pDomainNode Domain node for the tree control - * @param jonasServerName the name of the JOnAS server to which the current JORAM server is connected - * @param pResources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - public void getJoramPlatform(TreeControlNode pDomainNode, String jonasServerName, - MessageResources pResources, HttpServletRequest p_Request) { - - ObjectName joramPlatformOn = null; - try { - joramPlatformOn = JoramObjectName.joramPlatform(); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.WARN)) { - logger.log(BasicLevel.WARN, "Can't get JoramPlatform MBean: " + e); - } - return; - } - if (!JonasAdminJmx.hasMBeanName(joramPlatformOn, jonasServerName)) { - // No Joram to manage - // reset localServerId in case we just switched management context - // from a server which has Joram to this server which does not - if (p_Request.getSession().getAttribute("localId") != null) { - p_Request.getSession().setAttribute("localId", null); - } - return; - } - - // Joram platform present, create node for it - TreeControlNode platformNode = - new TreeControlNode(pDomainNode.getName() - + WhereAreYou.NODE_SEPARATOR + "joramplatform" - ,"icon/service_jms.gif" - ,pResources.getMessage("treenode.joramplatform") - ,"EditJoramPlatform.do" - ,"content", - false); - // Create node for the local server (Joram server to which the admin client is connected) - if (addNode(pDomainNode, platformNode)) { - getJoramServers(platformNode, jonasServerName, joramPlatformOn, pResources, p_Request); - } - } - - /** - * Append nodes for Joram server defined in tbe platform - * @param platformNode Joram platform node - * @param jonasServerName the name of the JOnAS server to which the current JORAM server is connected - * @param joramPlatformOn ObjectName of Joram Platform MBean - * @param pResources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - */ - public void getJoramServers(TreeControlNode platformNode - , String jonasServerName - , ObjectName joramPlatformOn - , MessageResources pResources - , HttpServletRequest p_Request) { - - if (joramPlatformOn == null) { - // called by the refresjJoramTree - try { - joramPlatformOn = JoramObjectName.joramPlatform(); - } catch (MalformedObjectNameException e) { - // This can't arrive normally - if (logger.isLoggable(BasicLevel.WARN)) { - logger.log(BasicLevel.WARN, "Can't get JoramPlatform MBean: " + e); - } - return; - } - } - Object attributeValue = null; - boolean collocatedServer = false; - ObjectName joramAdapterON = null; - try { - joramAdapterON = (ObjectName) (JonasManagementRepr.queryNames(JoramObjectName.joramAdapter(), jonasServerName)).iterator().next(); - if (JonasManagementRepr.isRegistered(joramAdapterON, jonasServerName)) { - attributeValue = JonasManagementRepr.getAttribute(joramAdapterON, "CollocatedServer", jonasServerName); - if (attributeValue != null) { - collocatedServer = ((Boolean) attributeValue).booleanValue(); - } - } - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.WARN)) { - logger.log(BasicLevel.WARN, "Can't get JoramAdapter MBean: " + e); - } - } - // get local Joram server - String localId = null; - attributeValue = JonasManagementRepr.getAttribute(joramPlatformOn, "LocalServerId", jonasServerName); - if (attributeValue != null) { - Integer localIdInt = (Integer) attributeValue; - localId = localIdInt.toString(); - } - // Create the node for the currently managed JORAM server - TreeControlNode currentServerNode = null; - String nodeName = null; - String icon = "icon/service_jms.gif"; - String label = null; - String action = "EditJoramServer.do?id=" + localId; - if (collocatedServer) { - nodeName = platformNode.getName() + WhereAreYou.NODE_SEPARATOR + "joramlocalserver"; - label = pResources.getMessage("treenode.joramplatform.joramlocalserver") + " (" + localId + ")"; - } else { - nodeName = platformNode.getName() + WhereAreYou.NODE_SEPARATOR + "joramcurrentserver"; - label = pResources.getMessage("treenode.joramplatform.joramcurrentserver") + " (" + localId + ")"; - } - currentServerNode = new TreeControlNode(nodeName, icon, label, action, "content", false); - if (addNode(platformNode, currentServerNode)) { - // Add local or current server resources - getJoramResources(currentServerNode, jonasServerName, localId, pResources, p_Request); - } - - p_Request.getSession().setAttribute("localId", localId); - p_Request.getSession().setAttribute("collocatedServer", new Boolean(collocatedServer)); - - // get the other (remote) Joram servers - List list = (List) JonasManagementRepr.getAttribute(joramPlatformOn, "ServersIds", jonasServerName); - if (list != null) { - Iterator it = list.iterator(); - Integer serverId; - String id; - TreeControlNode remoteServerNode = null; - while (it.hasNext()) { - serverId = (Integer) it.next(); - id = serverId.toString(); - String joramremoteserver = null; - if (!id.equals(localId)) { - joramremoteserver = "joramremoteserver" + id; - nodeName = platformNode.getName() + WhereAreYou.NODE_SEPARATOR + joramremoteserver; - label = pResources.getMessage("treenode.joramplatform.joramremoteserver") + " (" + id + ")"; - action = "EditJoramServer.do?id=" + id; - remoteServerNode = new TreeControlNode(nodeName, icon, label, action, "content", false); - if (addNode(platformNode, remoteServerNode)) { - // Add remote server's resources - getJoramResources(remoteServerNode, jonasServerName, id, pResources, p_Request); - } - } - } - } - } - /** - * Append nodes for Joram DEstinations created in a Joram server - * @param joramServerNode Joram server node - * @param jonasServerName the name of the JOnAS server to which the current JORAM server is connected - * @param serverId Joram server id - * @param pResources The MessageResources for our localized messages - * @param p_Request The servlet request we are processing - * @throws MalformedObjectNameException - */ - public void getJoramResources(TreeControlNode joramServerNode, String jonasServerName, String serverId, - MessageResources pResources, HttpServletRequest p_Request) { - - String joramServerNodeName = joramServerNode.getName(); - - ObjectName joramAdminOn = null; - try { - joramAdminOn = JoramObjectName.joramAdmin(); - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.WARN)) { - logger.log(BasicLevel.WARN, "Can't get JoramAdmin MBean: " + e); - } - return; - } - List destList = (List) JonasManagementRepr.getAttribute(joramAdminOn, "Destinations", jonasServerName); - ArrayList destArray = new ArrayList(); - if (destList != null && !destList.isEmpty()) { - Iterator it = destList.iterator(); - while (it.hasNext()) { - ItemDestination destinationItem = getDestinationItem((String) it.next(), jonasServerName); - if (destinationItem.getOn() == null) { - // If we have no associated MBean, the resource can't be managed ! - continue; - } - if (destinationItem.getServerId().equals(serverId)) { - if (destinationItem.getType().equals("queue")) { - // insert in head - destArray.add(0, destinationItem); - } else if (destinationItem.getType().equals("topic")) { - // append - destArray.add(destinationItem); - } - } - } - } - // Add sub-nodes for destinations belonging to the server - for (int i = 0; i < destArray.size(); i++) { - ItemDestination item = (ItemDestination) destArray.get(i); - String name = item.getName(); - String type = item.getType(); - TreeControlNode destinationNode = null; - String nodeName = null; - String action = null; - String icon = null; - String label = null; - if (type.equals("queue")) { - nodeName = joramServerNodeName + WhereAreYou.NODE_SEPARATOR + "joramqueue" + name; - icon = "icon/jms_queue.gif"; - label = pResources.getMessage("treenode.joramplatform.queue") + " (" + name + ")"; - action = "EditJoramQueue.do?name=" + name + "&id=" + serverId; - } else if (type.equals("topic")) { - nodeName = joramServerNodeName + WhereAreYou.NODE_SEPARATOR + "joramtopic" + name; - icon = "icon/jms_topic.gif"; - label = pResources.getMessage("treenode.joramplatform.topic") + " (" + name + ")"; - action = "EditJoramTopic.do?name=" + name + "&id=" + serverId; - } - if (item.getOn() == null) { - if (!item.isRegistered()) { - Object[] asParam = { - new Integer(serverId), name - }; - String[] asSignature = { - "int", "java.lang.String" - }; - if (type.equals("queue")) { - JonasManagementRepr.invoke(joramAdminOn, "createQueue", asParam, asSignature, jonasServerName); - } else if (type.equals("topic")) { - JonasManagementRepr.invoke(joramAdminOn, "createTopic", asParam, asSignature, jonasServerName); - } - } else { - action = null; - } - } - destinationNode = new TreeControlNode(nodeName, icon, label, action, "content", false); - if (destinationNode != null) { - addNode(joramServerNode, destinationNode); - } - } - } - - /** - * Append nodes for all defined MBeans. - * - * @param domainNode Root node for the tree control - * @param resources The MessageResources for our localized messages - */ - public void getMBeans(TreeControlNode domainNode, MessageResources resources, HttpServletRequest p_Request) { - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - TreeControlNode nodeMBeans = new TreeControlNode(domainNode.getName() - + WhereAreYou.NODE_SEPARATOR - + "mbeans" - , "icon/mbeans.gif" - , resources.getMessage("treenode.allmbeans") - , "ListMBeans.do", "content", false); - if (addNode(domainNode, nodeMBeans)) { - ArrayList[] als = JonasAdminJmx.getFamiliesMbeansLists(serverName); - if (als[MbeanItem.FAMILY_J2EE].size() > 0) { - getJ2eeMBeans(nodeMBeans, resources, als[MbeanItem.FAMILY_J2EE]); - } - if (als[MbeanItem.FAMILY_OWNER].size() > 0) { - getOwnerMBeans(nodeMBeans, resources, als[MbeanItem.FAMILY_OWNER]); - } - if (als[MbeanItem.FAMILY_UNKNOWN].size() > 0) { - getUnknownMBeans(nodeMBeans, resources, als[MbeanItem.FAMILY_UNKNOWN]); - } - } - } - - /** - * Append nodes for all defined Owner MBeans. - * - * @param p_ParentNode Parent node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_List The list of Mbeans - */ - public void getOwnerMBeans(TreeControlNode p_ParentNode, MessageResources p_Resources - , ArrayList p_List) { - - TreeControlNode nodeMBeans = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR - + "owner" - , "icon/mbeans.gif" - , p_Resources.getMessage("treenode.mbeans.owner") - , "ListOwnerMBeans.do" - , "content", false); - if (!addNode(p_ParentNode, nodeMBeans)) { - return; - } - // Sort list - Collections.sort(p_List, new BeanComparator(new String[] { - "domain", "type", "objectName"})); - - // Detail MBean node - String sLastDomain = ""; - String sLastType = ""; - TreeControlNode nodeMBean = null; - TreeControlNode nodeDomain = null; - TreeControlNode nodeType = null; - TreeControlNode nodeParent = null; - OwnerMbeanItem oItem; - - Iterator it = p_List.iterator(); - while (it.hasNext()) { - oItem = (OwnerMbeanItem) it.next(); - - nodeParent = nodeMBeans; - if (oItem.getDomain() != null) { - // Domain node - if (!oItem.getDomain().equals(sLastDomain)) { - sLastDomain = oItem.getDomain(); - nodeDomain = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getDomain(), "icon/mbeandomain.gif" - , oItem.getDomain(), null, "content", false); - addNode(nodeMBeans, nodeDomain); - } - nodeParent = nodeDomain; - - if (oItem.getType() != null) { - // Type node - if (!oItem.getType().equals(sLastType)) { - sLastType = oItem.getType(); - nodeType = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getType(), "icon/mbeantype.gif" - , oItem.getType(), null, "content", false); - addNode(nodeDomain, nodeType); - } - nodeParent = nodeType; - } - } - - // Mbean node - nodeMBean = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR - + oItem.getObjectName() - , "icon/mbean.gif" - , oItem.getObjectName() - , "ListMBeanDetails.do?select=" + encode(oItem.getObjectName()) - , "content", false); - addNode(nodeParent, nodeMBean); - } - } - - /** - * Append nodes for all defined J2EE MBeans. - * - * @param p_ParentNode Parent node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_List The list of Mbeans - */ - public void getJ2eeMBeans(TreeControlNode p_ParentNode, MessageResources p_Resources - , ArrayList p_List) { - - TreeControlNode nodeMBeans = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR - + "j2ee" - , "icon/mbeans.gif" - , p_Resources.getMessage("treenode.mbeans.j2ee") - , "ListJ2eeMBeans.do", "content", false); - if (!addNode(p_ParentNode, nodeMBeans)) { - return; - } - // Sort list - Collections.sort(p_List, new BeanComparator(new String[] { - "domain", "j2eeType", "name", "objectName"})); - - // Detail MBean node - J2eeMbeanItem oItem; - String sLastDomain = ""; - String sLastType = ""; - TreeControlNode nodeMBean = null; - TreeControlNode nodeDomain = null; - TreeControlNode nodeType = null; - TreeControlNode nodeParent = null; - - Iterator it = p_List.iterator(); - while (it.hasNext()) { - oItem = (J2eeMbeanItem) it.next(); - - nodeParent = nodeMBeans; - if (oItem.getDomain() != null) { - // Domain node - if (!oItem.getDomain().equals(sLastDomain)) { - sLastDomain = oItem.getDomain(); - nodeDomain = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getDomain(), "icon/mbeandomain.gif" - , oItem.getDomain(), null, "content", false); - addNode(nodeMBeans, nodeDomain); - } - nodeParent = nodeDomain; - } - if (oItem.getJ2eeType() != null) { - // Type node - if (!oItem.getJ2eeType().equals(sLastType)) { - sLastType = oItem.getJ2eeType(); - nodeType = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getJ2eeType(), "icon/mbeantype.gif" - , oItem.getJ2eeType(), null, "content", false); - addNode(nodeDomain, nodeType); - } - nodeParent = nodeType; - } - - // Mbean node - nodeMBean = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR - + oItem.getObjectName() - , "icon/mbean.gif" - , oItem.getObjectName() - , "ListMBeanDetails.do?select=" + encode(oItem.getObjectName()) - , "content", false); - addNode(nodeParent, nodeMBean); - - } - } - - /** - * Append nodes for all defined Unknown MBeans. - * - * @param p_ParentNode Parent node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_List The list of Mbeans - */ - public void getUnknownMBeans(TreeControlNode p_ParentNode, MessageResources p_Resources - , ArrayList p_List) { - - TreeControlNode nodeMBeans = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR - + "unknown" - , "icon/mbeans.gif" - , p_Resources.getMessage("treenode.mbeans.unknown") - , "ListUnknownMBeans.do", "content", false); - if (!addNode(p_ParentNode, nodeMBeans)) { - return; - } - // Sort list - Collections.sort(p_List, new BeanComparator(new String[] { - "domain", "objectName"})); - - // Detail MBean node - MbeanItem oItem; - String sLastDomain = ""; - TreeControlNode nodeMBean = null; - TreeControlNode nodeDomain = null; - TreeControlNode nodeType = null; - TreeControlNode nodeParent = null; - - Iterator it = p_List.iterator(); - while (it.hasNext()) { - oItem = (MbeanItem) it.next(); - - nodeParent = nodeMBeans; - if (oItem.getDomain() != null) { - // Domain node - if (!oItem.getDomain().equals(sLastDomain)) { - sLastDomain = oItem.getDomain(); - nodeDomain = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getDomain(), "icon/mbeandomain.gif" - , oItem.getDomain(), null, "content", false); - addNode(nodeMBeans, nodeDomain); - } - nodeParent = nodeDomain; - - } - - // Mbean node - nodeMBean = new TreeControlNode(p_ParentNode.getName() - + WhereAreYou.NODE_SEPARATOR - + oItem.getObjectName() - , "icon/mbean.gif" - , oItem.getObjectName() - , "ListMBeanDetails.do?select=" + encode(oItem.getObjectName()) - , "content", false); - addNode(nodeParent, nodeMBean); - - } - } - - /** - * Append nodes Attributes and Operations for a defined MBean. - * - * @param nodeMBean The MBean node - * @param onMBean The MBean Object name - * @param resources Resource - * @throws Exception - */ - protected void getMBeanInfo(TreeControlNode nodeMBean, ObjectName onMBean - , MessageResources resources, HttpServletRequest p_Request) - throws Exception { - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - // Get all infos of a MBean - MBeanInfo oMBeanInfo = JonasManagementRepr.getMBeanInfo(onMBean, serverName); - // Get attributes infos - MBeanAttributeInfo[] aoMBeanAttributeInfo = oMBeanInfo.getAttributes(); - if (aoMBeanAttributeInfo.length > 0) { - // Append attributes node - TreeControlNode nodeAttributes = new TreeControlNode("Attributes" - + WhereAreYou.NODE_SEPARATOR + onMBean.toString(), "icon/JonasQuestion.gif" - , resources.getMessage("treenode.allmbeans.attributes"), null, "content", false); - addNode(nodeMBean, nodeAttributes); - // Loop to append each attribute node - for (int i = 0; i < aoMBeanAttributeInfo.length; i++) { - TreeControlNode nodeAttr = new TreeControlNode(String.valueOf(i) - + WhereAreYou.NODE_SEPARATOR + onMBean.toString() + WhereAreYou.NODE_SEPARATOR - + aoMBeanAttributeInfo[i].getName(), "icon/property.gif" - , aoMBeanAttributeInfo[i].getName(), null, "content", false); - addNode(nodeAttributes, nodeAttr); - } - } - // Get operations infos - MBeanOperationInfo[] aoMBeanOperationInfo = oMBeanInfo.getOperations(); - if (aoMBeanOperationInfo.length > 0) { - // Append operations node - TreeControlNode nodeOperations = new TreeControlNode("Operations" - + WhereAreYou.NODE_SEPARATOR + onMBean.toString(), "icon/JonasQuestion.gif" - , resources.getMessage("treenode.allmbeans.operations"), null, "content", false); - addNode(nodeMBean, nodeOperations); - // Loop to append each operation node - for (int i = 0; i < aoMBeanOperationInfo.length; i++) { - TreeControlNode nodeOpe = new TreeControlNode(String.valueOf(i) - + WhereAreYou.NODE_SEPARATOR + onMBean.toString() + WhereAreYou.NODE_SEPARATOR - + aoMBeanOperationInfo[i].getName(), "icon/action.gif" - , aoMBeanOperationInfo[i].getName(), null, "content", false); - addNode(nodeOperations, nodeOpe); - } - } - } - - /** - * Create a ItemDestination object from a String structured as follows: - * type=queue/topic, name=destName, id=#x.y.z - * @param joramAdminDestination String containing destination description - * @param serverName the name of the JOnAS server to which the current JORAM server is connected - * @return ItemDestination containing name, type, id and ObjectName (on) of the MBean associated to the corresponding destination - * If on == null, the MBean associated to the destination was not found in the MBean server !! - */ - private ItemDestination getDestinationItem(String joramAdminDestination, String serverName) { - ItemDestination destinationItem = new ItemDestination(); - ObjectName destinationOn = null; - StringTokenizer st = new StringTokenizer(joramAdminDestination, ","); - String type = null; - String name = null; - String id = null; - String serverId = null; - while (st.hasMoreTokens()) { - // A couple has the following structure: key=value - String couple = st.nextToken().trim(); - int index = couple.indexOf("="); - String key = couple.substring(0, index); - String value = couple.substring(index + 1, couple.length()); - if (key.equals("type")) { - type = value; - destinationItem.setType(type); - } - if (key.equals("name")) { - name = value; - destinationItem.setName(name); - } - if (key.equals("id")) { - id = value; - destinationItem.setId(id); - int indexBefore = id.indexOf("#"); - int indexAfter = id.indexOf(".", indexBefore); - serverId = id.substring(indexBefore + 1, indexAfter); - destinationItem.setServerId(serverId); - } - } - if (name != null && type != null && id != null) { - try { - if (type.equals("topic")) { - destinationOn = JoramObjectName.joramTopic(name); - } else if (type.equals("queue")) { - destinationOn = JoramObjectName.joramQueue(name); - } - } catch (MalformedObjectNameException e) { - if (logger.isLoggable(BasicLevel.WARN)) { - logger.log(BasicLevel.WARN, "Can't get Joram" + type + " MBean: " + e); - } - } - if (destinationOn != null - && - JonasAdminJmx.hasMBeanName(destinationOn, serverName)) { - destinationItem.setRegistered(true); - // exists a destination MBean with the given type and name, check the id - String foundId = (String) JonasManagementRepr.getAttribute(destinationOn, "Name", serverName); - if (id.equals(foundId)) { - destinationItem.setOn(destinationOn); - } - } - } - return destinationItem; - } - - // MQ Connector support - //---------------------- - /** - * - */ - public void getJonasMqConnectorPlatform(TreeControlNode pServerNode, - String sServerName, MessageResources pResources, - HttpServletRequest p_Request) { - /* - * retrieve the domain name - */ - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute( - WhereAreYou.SESSION_NAME); - String sDomainName = oWhere.getCurrentDomainName(); - - TreeControlNode platformNode = new TreeControlNode(pServerNode - .getName() - + WhereAreYou.NODE_SEPARATOR + "jonasmqconnect", - "icon/service_jms.gif", pResources - .getMessage("treenode.joansmqconnect.name"), - "JonasMqConnectPlatform.do", "content", false); - - if (!addNode(pServerNode, platformNode)) { - return; - } - //ObjectName mqOnPattern = new ObjectName(sDomainName + ":type=JonasMQConnector,*"); - ObjectName[] mqOns = MqObjectNames.getConnectorsON(sDomainName, sServerName); - for (int i = 0; i < mqOns.length; i++) { - ObjectName on = (ObjectName) mqOns[i]; - String connectorName = on.getKeyProperty("name"); - TreeControlNode serverNode = new TreeControlNode(platformNode - .getName() - + WhereAreYou.NODE_SEPARATOR - + "jonasmqconnector" - + WhereAreYou.NODE_SEPARATOR + connectorName, - "icon/jms_connector.gif", connectorName, - "JonasMqConnect.do?operation=view&connector=" + connectorName, - "content", false); - if (addNode(platformNode, serverNode)) { - getJonasMqDestinations(serverNode, connectorName, sServerName, pResources, p_Request); - } - } - - } - /** - * - * Build the destination nodes - */ - public void getJonasMqDestinations(TreeControlNode pMQNode, String connectorName, - String sServerName, MessageResources pResources, - HttpServletRequest p_Request) { - - WhereAreYou oWhere = (WhereAreYou) p_Request.getSession().getAttribute( - WhereAreYou.SESSION_NAME); - String sDomainName = oWhere.getCurrentDomainName(); - //ObjectName mqDestPattern = new ObjectName(sDomainName + ":type=MQDestination,JonasMQConnector=" + connectorName+ ",*"); - //System.err.println("JOnASTreeBuilder querying " + mqDestPattern + " for server " + sServerName); - ObjectName mqDestPattern = MqObjectNames.getDestinationsON(sDomainName, connectorName); - Set destOns = JonasManagementRepr.queryNames(mqDestPattern, sServerName); - for (Iterator i = destOns.iterator(); i.hasNext();) { - ObjectName on = (ObjectName) i.next(); - String destName = on.getKeyProperty("name"); - boolean isTopic = ((Boolean) JonasManagementRepr.getAttribute(on, "IsTopic", sServerName)).booleanValue(); - TreeControlNode serverNode = new TreeControlNode(pMQNode.getName() - + WhereAreYou.NODE_SEPARATOR + "destination" - + WhereAreYou.NODE_SEPARATOR + destName, - "icon/" + (isTopic ? "jms_topic.gif" : "jms_queue.gif"), destName, - "JonasMqConnectDestinationEdit.do?operation=view&jndiName=" + destName + "&connector=" + connectorName, - "content", false); - addNode(pMQNode, serverNode); - } - } - - /** - * Add a new node in the tree as child of the current node - * @param currentNode the current node - * @param node the node to add - * @return true if success, false if the new node couldn't be added - */ - private boolean addNode(TreeControlNode currentNode, TreeControlNode node) { - String nodeName = node.getName(); - try { - currentNode.addChild(node); - } catch(IllegalArgumentException iae) { - // the name of the new child node is not unique - if (logger.isLoggable(BasicLevel.ERROR)) { - logger.log(BasicLevel.ERROR, "Can't add node " + nodeName + " in the management tree as node name is not unique"); - } - return false; - } - return true; - } - /** - * Add a new node in the tree as child of the current node - * @param currentNode the current node - * @param node the node to add - * @param offset Zero-relative offset at which the new node - * should be inserted - * @return true if success, false if the new node couldn't be added - */ - private boolean addNode(TreeControlNode currentNode, TreeControlNode node, int offset) { - String nodeName = node.getName(); - try { - currentNode.addChild(offset, node); - } catch(IllegalArgumentException iae) { - // the name of the new child node is not unique - if (logger.isLoggable(BasicLevel.ERROR)) { - logger.log(BasicLevel.ERROR, "Can't add node " + nodeName + " in the management tree as node name is not unique"); - } - return false; - } - return true; - } - - private String encode(String name) { - try { - return URLEncoder.encode(name, "UTF-8"); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return null; - } - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/LogOutAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/LogOutAction.java deleted file mode 100644 index f6dbb09c3f124436617a750965d673629cdfaa3c..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/LogOutAction.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Struts", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -/** - * Implementation of Action that logs out of the current - * session and returns to the Main Index (which will trigger the login form). - * - * @author Craig R. McClanahan - * @author Florent Benoit (changes for struts 1.2.2) - * @version $Revision$ $Date$ - */ - -public final class LogOutAction extends Action { - - // --------------------------------------------------------- Public Methods - - /** - * Process the specified HTTP request, and create the corresponding HTTP - * response (or forward to another web component that will create it). - * Return an ActionForward instance describing where and how - * control should be forwarded, or null if the response has - * already been completed. - * - * @param mapping The ActionMapping used to select this instance - * @param actionForm The optional ActionForm bean for this request (if any) - * @param request The HTTP request we are processing - * @param response The HTTP response we are creating - * - * @exception IOException if an input/output error occurs - * @exception ServletException if a servlet exception occurs - */ - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request - , HttpServletResponse response) - throws IOException, ServletException { - - // Invalidate the current session and create a new one - HttpSession session = request.getSession(); - session.invalidate(); - session = request.getSession(true); - - // Forward control back to the Main Index - return (mapping.findForward("Main Index")); - - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/MBeanTreeBuilder.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/MBeanTreeBuilder.java deleted file mode 100644 index dfc37c715a1d8b567ad0fe61331e34055534f11b..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/MBeanTreeBuilder.java +++ /dev/null @@ -1,362 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; - -import javax.management.MBeanAttributeInfo; -import javax.management.MBeanInfo; -import javax.management.MBeanOperationInfo; -import javax.management.ObjectName; -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.Globals; -import org.apache.struts.action.ActionServlet; -import org.apache.struts.util.MessageResources; - -import org.objectweb.jonas.webapp.jonasadmin.common.BeanComparator; -import org.objectweb.jonas.webapp.jonasadmin.mbean.J2eeMbeanItem; -import org.objectweb.jonas.webapp.jonasadmin.mbean.MbeanItem; -import org.objectweb.jonas.webapp.jonasadmin.mbean.OwnerMbeanItem; -import org.objectweb.jonas.webapp.taglib.TreeBuilder; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; - -/** - * Implementation of TreeBuilder that adds the nodes required - * for administering the Jonas server. - * - * @author Michel-Ange ANTON (initial developer) - * @author Florent Benoit (changes for struts 1.2.2) - */ - -public class MBeanTreeBuilder implements TreeBuilder { -// ----------------------------------------------------- Instance Variables - -// ---------------------------------------------------- TreeBuilder Methods - - /** - * Add the required nodes to the specified treeControl - * instance. - * - * @param treeControl The TreeControl to which we should - * add our nodes - * @param servlet The controller servlet for the admin application - * @param request The servlet request we are processing - */ - public void buildTree(TreeControl treeControl, ActionServlet servlet - , HttpServletRequest request) { - try { - TreeControlNode rootNode = treeControl.getRoot(); - MessageResources resources = (MessageResources) servlet.getServletContext(). - getAttribute(Globals.MESSAGES_KEY); - getMBeans(rootNode, resources, request); - } - catch (Throwable t) { - t.printStackTrace(System.out); - } - } - -// ------------------------------------------------------ Protected Methods - - /** - * Append nodes for all defined MBeans. - * - * @param rootNode Root node for the tree control - * @param resources The MessageResources for our localized messages - * - * @exception Exception if an exception occurs building the tree - */ - public void getMBeans(TreeControlNode rootNode, MessageResources resources, - HttpServletRequest request) - throws Exception { - - TreeControlNode nodeMBeans = new TreeControlNode("mbeans", "icon/mbeans.gif" - , resources.getMessage("treenode.allmbeans"), "ListMBeans.do", "content", false); - rootNode.addChild(nodeMBeans); - - WhereAreYou oWhere = (WhereAreYou) request.getSession().getAttribute(WhereAreYou. - SESSION_NAME); - String serverName = oWhere.getCurrentJonasServerName(); - - ArrayList[] als = JonasAdminJmx.getFamiliesMbeansLists(serverName); - if (als[MbeanItem.FAMILY_J2EE].size() > 0) { - getJ2eeMBeans(nodeMBeans, resources, als[MbeanItem.FAMILY_J2EE]); - } - if (als[MbeanItem.FAMILY_OWNER].size() > 0) { - getOwnerMBeans(nodeMBeans, resources, als[MbeanItem.FAMILY_OWNER]); - } - if (als[MbeanItem.FAMILY_UNKNOWN].size() > 0) { - getUnknownMBeans(nodeMBeans, resources, als[MbeanItem.FAMILY_UNKNOWN]); - } - } - - /** - * Append nodes for all defined Owner MBeans. - * - * @param p_ParentNode Parent node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_List The list of Mbeans - * - * @exception Exception if an exception occurs building the tree - */ - public void getOwnerMBeans(TreeControlNode p_ParentNode, MessageResources p_Resources - , ArrayList p_List) - throws Exception { - - TreeControlNode nodeMBeans = new TreeControlNode("mbeans" + WhereAreYou.NODE_SEPARATOR - + "owner", "icon/mbeans.gif", p_Resources.getMessage("treenode.mbeans.owner") - , "ListOwnerMBeans.do", "content", false); - p_ParentNode.addChild(nodeMBeans); - // Sort list - Collections.sort(p_List, new BeanComparator(new String[] { - "domain", "type", "objectName"})); - - // Detail MBean node - String sLastDomain = ""; - String sLastType = ""; - TreeControlNode nodeMBean = null; - TreeControlNode nodeDomain = null; - TreeControlNode nodeType = null; - TreeControlNode nodeParent = null; - OwnerMbeanItem oItem; - - Iterator it = p_List.iterator(); - while (it.hasNext()) { - oItem = (OwnerMbeanItem) it.next(); - - nodeParent = nodeMBeans; - if (oItem.getDomain() != null) { - // Domain node - if (oItem.getDomain().equals(sLastDomain) == false) { - sLastDomain = oItem.getDomain(); - nodeDomain = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getDomain(), "icon/mbeandomain.gif" - , oItem.getDomain(), null, "content", false); - nodeMBeans.addChild(nodeDomain); - } - nodeParent = nodeDomain; - - if (oItem.getType() != null) { - // Type node - if (oItem.getType().equals(sLastType) == false) { - sLastType = oItem.getType(); - nodeType = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getType(), "icon/mbeantype.gif" - , oItem.getType(), null, "content", false); - nodeDomain.addChild(nodeType); - } - nodeParent = nodeType; - } - } - - // Mbean node - nodeMBean = new TreeControlNode("mbeans" + WhereAreYou.NODE_SEPARATOR - + oItem.getObjectName(), "icon/mbean.gif", oItem.getObjectName() - , "ListMBeanDetails.do?select=" + URLEncoder.encode(oItem.getObjectName() - , "UTF-8"), "content", false); - nodeParent.addChild(nodeMBean); - - } - } - - /** - * Append nodes for all defined J2EE MBeans. - * - * @param p_ParentNode Parent node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_List The list of Mbeans - * - * @exception Exception if an exception occurs building the tree - */ - public void getJ2eeMBeans(TreeControlNode p_ParentNode, MessageResources p_Resources - , ArrayList p_List) - throws Exception { - - TreeControlNode nodeMBeans = new TreeControlNode("mbeans" + WhereAreYou.NODE_SEPARATOR - + "j2ee", "icon/mbeans.gif", p_Resources.getMessage("treenode.mbeans.j2ee") - , "ListJ2eeMBeans.do", "content", false); - p_ParentNode.addChild(nodeMBeans); - // Sort list - Collections.sort(p_List, new BeanComparator(new String[] { - "domain", "j2eeType", "name", "objectName"})); - - // Detail MBean node - J2eeMbeanItem oItem; - String sLastDomain = ""; - String sLastType = ""; - TreeControlNode nodeMBean = null; - TreeControlNode nodeDomain = null; - TreeControlNode nodeType = null; - TreeControlNode nodeParent = null; - - Iterator it = p_List.iterator(); - while (it.hasNext()) { - oItem = (J2eeMbeanItem) it.next(); - - nodeParent = nodeMBeans; - if (oItem.getDomain() != null) { - // Domain node - if (oItem.getDomain().equals(sLastDomain) == false) { - sLastDomain = oItem.getDomain(); - nodeDomain = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getDomain(), "icon/mbeandomain.gif" - , oItem.getDomain(), null, "content", false); - nodeMBeans.addChild(nodeDomain); - } - nodeParent = nodeDomain; - } - if (oItem.getJ2eeType() != null) { - // Type node - if (oItem.getJ2eeType().equals(sLastType) == false) { - sLastType = oItem.getJ2eeType(); - nodeType = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getJ2eeType(), "icon/mbeantype.gif" - , oItem.getJ2eeType(), null, "content", false); - nodeDomain.addChild(nodeType); - } - nodeParent = nodeType; - } - - // Mbean node - nodeMBean = new TreeControlNode("mbeans" + WhereAreYou.NODE_SEPARATOR - + oItem.getObjectName(), "icon/mbean.gif", oItem.getObjectName() - , "ListMBeanDetails.do?select=" + URLEncoder.encode(oItem.getObjectName() - , "UTF-8"), "content", false); - nodeParent.addChild(nodeMBean); - - } - } - - /** - * Append nodes for all defined Unknown MBeans. - * - * @param p_ParentNode Parent node for the tree control - * @param p_Resources The MessageResources for our localized messages - * @param p_List The list of Mbeans - * - * @exception Exception if an exception occurs building the tree - */ - public void getUnknownMBeans(TreeControlNode p_ParentNode, MessageResources p_Resources - , ArrayList p_List) - throws Exception { - - TreeControlNode nodeMBeans = new TreeControlNode("mbeans" + WhereAreYou.NODE_SEPARATOR - + "unknown", "icon/mbeans.gif", p_Resources.getMessage("treenode.mbeans.unknown") - , "ListUnknownMBeans.do", "content", false); - p_ParentNode.addChild(nodeMBeans); - // Sort list - Collections.sort(p_List, new BeanComparator(new String[] { - "domain", "objectName"})); - - // Detail MBean node - MbeanItem oItem; - String sLastDomain = ""; - TreeControlNode nodeMBean = null; - TreeControlNode nodeDomain = null; - TreeControlNode nodeType = null; - TreeControlNode nodeParent = null; - - Iterator it = p_List.iterator(); - while (it.hasNext()) { - oItem = (MbeanItem) it.next(); - - nodeParent = nodeMBeans; - if (oItem.getDomain() != null) { - // Domain node - if (oItem.getDomain().equals(sLastDomain) == false) { - sLastDomain = oItem.getDomain(); - nodeDomain = new TreeControlNode(nodeParent.getName() - + WhereAreYou.NODE_SEPARATOR + oItem.getDomain(), "icon/mbeandomain.gif" - , oItem.getDomain(), null, "content", false); - nodeMBeans.addChild(nodeDomain); - } - nodeParent = nodeDomain; - - } - - // Mbean node - nodeMBean = new TreeControlNode("mbeans" + WhereAreYou.NODE_SEPARATOR - + oItem.getObjectName(), "icon/mbean.gif", oItem.getObjectName() - , "ListMBeanDetails.do?select=" + URLEncoder.encode(oItem.getObjectName() - , "UTF-8"), "content", false); - nodeParent.addChild(nodeMBean); - - } - } - - /** - * Append nodes Attributes and Operations for a defined MBean. - * - * @param nodeMBean The MBean node - * @param onMBean The MBean Object name - * @param resources Resource - * @throws Exception - */ - protected void getMBeanInfo(TreeControlNode nodeMBean, ObjectName onMBean - , MessageResources resources, String serverName) - throws Exception { - // Get all infos of a MBean - MBeanInfo oMBeanInfo = JonasManagementRepr.getMBeanInfo(onMBean, serverName); - // Get attributes infos - MBeanAttributeInfo[] aoMBeanAttributeInfo = oMBeanInfo.getAttributes(); - if (aoMBeanAttributeInfo.length > 0) { - // Append attributes node - TreeControlNode nodeAttributes = new TreeControlNode("Attributes" - + WhereAreYou.NODE_SEPARATOR + onMBean.toString(), "icon/JonasQuestion.gif" - , resources.getMessage("treenode.allmbeans.attributes"), null, "content", false); - nodeMBean.addChild(nodeAttributes); - // Loop to append each attribute node - for (int i = 0; i < aoMBeanAttributeInfo.length; i++) { - TreeControlNode nodeAttr = new TreeControlNode(String.valueOf(i) - + WhereAreYou.NODE_SEPARATOR + onMBean.toString() + WhereAreYou.NODE_SEPARATOR - + aoMBeanAttributeInfo[i].getName(), "icon/property.gif" - , aoMBeanAttributeInfo[i].getName(), null, "content", false); - nodeAttributes.addChild(nodeAttr); - } - } - // Get operations infos - MBeanOperationInfo[] aoMBeanOperationInfo = oMBeanInfo.getOperations(); - if (aoMBeanOperationInfo.length > 0) { - // Append operations node - TreeControlNode nodeOperations = new TreeControlNode("Operations" - + WhereAreYou.NODE_SEPARATOR + onMBean.toString(), "icon/JonasQuestion.gif" - , resources.getMessage("treenode.allmbeans.operations"), null, "content", false); - nodeMBean.addChild(nodeOperations); - // Loop to append each operation node - for (int i = 0; i < aoMBeanOperationInfo.length; i++) { - TreeControlNode nodeOpe = new TreeControlNode(String.valueOf(i) - + WhereAreYou.NODE_SEPARATOR + onMBean.toString() + WhereAreYou.NODE_SEPARATOR - + aoMBeanOperationInfo[i].getName(), "icon/action.gif" - , aoMBeanOperationInfo[i].getName(), null, "content", false); - nodeOperations.addChild(nodeOpe); - } - } - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ManagementException.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ManagementException.java deleted file mode 100644 index 3e96a12cf87a0f3a0bb23ad355e98170d234b871..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/ManagementException.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -/** - * Implement exceptions thrown by the management operations - * @author Bruno Michel and Guillaume Riviere - */ -public class ManagementException extends RuntimeException { - - public ManagementException(String message) { - super(message); - } - - public ManagementException(String message, Throwable cause) { - super(message, cause); - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/SetUpTreeAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/SetUpTreeAction.java deleted file mode 100644 index 087c8a748678aacff5c89b1bbba901873c41a350..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/SetUpTreeAction.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.StringTokenizer; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionServlet; -import org.objectweb.jonas.webapp.taglib.TreeBuilder; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; - -/** - * Test Action sets up tree control data structure - * for tree widget - * - * @author Jazmin Jonson - * @author Manveen Kaur - * @author Florent Benoit (changes for struts 1.2.2) - * @version $Revision$ $Date$ - */ - -public class SetUpTreeAction extends Action { - - public static final int INIT_PLUGIN_MAX = 10; - public static final String TREEBUILDER_KEY = "treebuilders"; - public static final String ROOTNODENAME_KEY = "rootnodename"; - -// --------------------------------------------------------- Public Methods - - /** - * Process the specified HTTP request, and create the corresponding HTTP - * response (or forward to another web component that will create it). - * Return an ActionForward instance describing where and how - * control should be forwarded, or null if the response has - * already been completed. - * - * @param mapping The ActionMapping used to select this instance - * @param actionForm The optional ActionForm bean for this request (if any) - * @param request The HTTP request we are processing - * @param response The HTTP response we are creating - * - * @exception IOException if an input/output error occurs - * @exception ServletException if a servlet exception occurs - */ - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request - , HttpServletResponse response) - throws IOException, ServletException { - - //ApplicationServlet servlet = (ApplicationServlet) getServlet(); - ActionServlet servlet = (ActionServlet) getServlet(); - - // Getting init parms from web.xml - - // Get the string to be displayed as root node while rendering the tree - String rootnodeName = (String) servlet.getServletConfig().getInitParameter(ROOTNODENAME_KEY); - - String treeBuildersStr = (String) servlet.getServletConfig().getInitParameter( - TREEBUILDER_KEY); - - // Make the root node and tree control - - // The root node gets rendered only if its value - // is set as an init-param in web.xml - - TreeControlNode root = new TreeControlNode("ROOT-NODE", null, rootnodeName - , "setUpTree.do?select=ROOT-NODE", "content", true); - - TreeControl control = new TreeControl(root); - - if (treeBuildersStr != null) { - Class treeBuilderImpl; - TreeBuilder treeBuilderBase; - - ArrayList treeBuilders = new ArrayList(INIT_PLUGIN_MAX); - int i = 0; - StringTokenizer st = new StringTokenizer(treeBuildersStr, ","); - while (st.hasMoreTokens()) { - treeBuilders.add(st.nextToken().trim()); - } - - if (treeBuilders.size() == 0) { - treeBuilders.add(treeBuildersStr.trim()); - } - for (i = 0; i < treeBuilders.size(); i++) { - try { - treeBuilderImpl = Class.forName((String) treeBuilders.get(i)); - treeBuilderBase = (TreeBuilder) treeBuilderImpl.newInstance(); - treeBuilderBase.buildTree(control, servlet, request); - } - catch (Throwable t) { - t.printStackTrace(System.out); - } - } - } - - HttpSession session = request.getSession(); - session.setAttribute("treeControl", control); - - WhereAreYou oWhere = (WhereAreYou) session.getAttribute(WhereAreYou.SESSION_NAME); - oWhere.setTreeControl(control); - - String name = request.getParameter("select"); - if (name != null) { - control.selectNode(name); - // Forward back to the Blank page - return (mapping.findForward("Blank")); - } - - return (mapping.findForward("Tree")); - - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/SetupWhereAreYouAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/SetupWhereAreYouAction.java deleted file mode 100644 index 4a6583957e42e5a3d41ca690181c2115a6d32da3..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/SetupWhereAreYouAction.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionMessage; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.objectweb.jonas.common.Log; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * @author Michel-Ange ANTON (initial developer) - * @author Florent Benoit (changes for struts 1.2.2) - */ -public class SetupWhereAreYouAction extends JonasBaseAction { - -// --------------------------------------------------------- Public Methods - - public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException { - // nothing to do - return null; - } - - public ActionForward execute(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException { - - // Initialize the instance variables - initialize(p_Request); - - try { - if (m_WhereAreYou == null) { - m_WhereAreYou = new WhereAreYou(); - m_WhereAreYou.initialize(getServlet(), p_Request); - m_Session.setAttribute(WhereAreYou.SESSION_NAME, m_WhereAreYou); - } else { - m_WhereAreYou.refreshServers(p_Request); - } - } catch (JonasAdminException e) { - - String message = m_Resources.getMessage(e.getId()); - //getServlet().log(message); - Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, message); - } - m_Errors.add(e.getId(), new ActionMessage(e.getId())); - saveErrors(p_Request, m_Errors); - return (p_Mapping.findForward("Global Error")); - } - return (p_Mapping.findForward("Frame Main")); - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/TopForm.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/TopForm.java deleted file mode 100644 index f36ac2730d585041de4c280d4a2eceadef3cd324..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/TopForm.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * Initial developer(s): Michel-Ange ANTON - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; - -/** - * Form bean for the Jonas server form page. - */ - -public final class TopForm extends ActionForm { - -// ----------------------------------------------------- Instance Variables - -// ------------------------------------------------------------- Properties - private String serverSelect = null; - - public String getServerSelect() { - return this.serverSelect; - } - - public void setServerSelect(String serverSelect) { - this.serverSelect = serverSelect; - } - -// --------------------------------------------------------- Public Methods - - /** - * Reset all properties to their default values. - * - * @param mapping The mapping used to select this instance - * @param request The servlet request we are processing - */ - public void reset(ActionMapping mapping, HttpServletRequest request) { - this.serverSelect = null; - } - - /** - * Validate the properties that have been set from this HTTP request, - * and return an ActionErrors object that encapsulates any - * validation errors that have been found. If no errors are found, return - * null or an ActionErrors object with no - * recorded error messages. - * - * @param mapping The mapping used to select this instance - * @param request The servlet request we are processing - */ - public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { - return new ActionErrors(); - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/TreeAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/TreeAction.java deleted file mode 100644 index 77eb8b8191253475ac90787d2625dbac2f4d29cd..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/TreeAction.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.IOException; -import java.net.URLEncoder; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.struts.action.Action; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.objectweb.jonas.common.Log; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; -import org.objectweb.util.monolog.api.BasicLevel; -import org.objectweb.util.monolog.api.Logger; - -/** - * Test Action that handles events from the tree control test - * page. - * - * @author Craig R. McClanahan - * @version $Revision$ $Date$ - */ - -public class TreeAction extends Action { - - private static Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX); - -// --------------------------------------------------------- Public Methods - - /** - * Process the specified HTTP request, and create the corresponding HTTP - * response (or forward to another web component that will create it). - * Return an ActionForward instance describing where and how - * control should be forwarded, or null if the response has - * already been completed. - * - * @param mapping The ActionMapping used to select this instance - * @param actionForm The optional ActionForm bean for this request (if any) - * @param request The HTTP request we are processing - * @param response The HTTP response we are creating - * - * @exception IOException if an input/output error occurs - * @exception ServletException if a servlet exception occurs - */ - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request - , HttpServletResponse response) - throws IOException, ServletException { - - String name = null; - HttpSession session = request.getSession(); - WhereAreYou oWhere = (WhereAreYou) session.getAttribute(WhereAreYou.SESSION_NAME); - // Detect if a WhereAreYou instance is present - if (oWhere == null) { - // Re-init - //getServlet().log("Instance WhereAreYou not found in session : re-init"); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Instance WhereAreYou not found in session : re-init"); - } - return (mapping.findForward("Main Index")); - } - // Get the tree - TreeControl control = oWhere.getTreeControl(); - // Handle a tree expand/contract event - name = request.getParameter("tree"); - if (name != null) { - //getServlet().log("Tree expand/contract on " + name); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Tree expand/contract on " + name); - } - TreeControlNode node = control.findNode(name); - if (node != null) { - //getServlet().log("Found Node: " + name + "[" + node.getLabel() + "]"); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Found Node: " + name + "[" + node.getLabel() + "]"); - } - node.setExpanded(!node.isExpanded()); - // Add the anchor - request.setAttribute("anchorToGo", URLEncoder.encode(name, "UTF-8")); - } - } - else { - //getServlet().log("tree param is null"); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "tree param is null"); - } - } - - // Handle a select item event - name = request.getParameter("select"); - if (name != null) { - //getServlet().log("Select event on " + name); - if (logger.isLoggable(BasicLevel.DEBUG)) { - logger.log(BasicLevel.DEBUG, "Select event on " + name); - } - control.selectNode(name); - // Add the anchor - request.setAttribute("anchorToGo", URLEncoder.encode(name, "UTF-8")); - } - - // Forward back to the test page - return (mapping.findForward("Tree")); - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/WhereAreYou.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/WhereAreYou.java deleted file mode 100644 index b0853ef442402812cf39e214c306ba8e74817575..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/WhereAreYou.java +++ /dev/null @@ -1,592 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 1999-2007 Bull S.A.S - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin; - -import java.io.UnsupportedEncodingException; - -import javax.management.ObjectName; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionServlet; -import org.objectweb.jonas.common.JProp; -import org.objectweb.jonas.webapp.jonasadmin.common.CatalinaObjectName; -import org.objectweb.jonas.jmx.oname.J2eeObjectName; -import org.objectweb.jonas.jmx.oname.JonasObjectName; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; - -/** - * @author Michel-Ange ANTON - */ -/** - * @author eyindanga - */ -public class WhereAreYou { - -// --------------------------------------------------------- Public Constants - /** - * Exceptions - */ - public final static String EXCEPTION_MBEANSERVER_NOTFOUND = "error.mbeanserver.notfound"; - public final static String EXCEPTION_JONASSERVER_NOTFOUND = "error.jonasserver.notfound"; - public final static String EXCEPTION_MBEAN_J2EEDOMAIN_NOTFOUND = "error.mbean.j2eedomain.notfound"; - public final static String EXCEPTION_MBEAN_J2EESERVER_NOTFOUND = "error.mbean.j2eeserver.notfound"; - - /** - * Name of the variable in http session - */ - public final static String SESSION_NAME = "WhereAreYou"; - - // Constant environnement - public final static String TAGS_IMAGES_ROOT_KEY = "tagsimagesroot"; - public final static String CONTEXT_MACRO = "${CONTEXT}"; - public final static String TREE_PAGE_REFRESH = "viewTree.do?select="; - - /** - * Used separator in the ident node in the tree - */ - public final static String NODE_SEPARATOR = "*"; - - // Deployment identification number - public final static int DEPLOYMENT_EAR = 1; - public final static int DEPLOYMENT_JAR = 2; - public final static int DEPLOYMENT_WAR = 3; - public final static int DEPLOYMENT_RAR = 4; - public final static int DEPLOYMENT_DATASOURCE = 5; - public final static int DEPLOYMENT_JMS = 6; - public final static int DEPLOYMENT_MAIL = 7; - - // Deployment identification number for domain management - public final static int DOMAIN_DEPLOYMENT_EAR = 8; - public final static int DOMAIN_DEPLOYMENT_JAR = 9; - public final static int DOMAIN_DEPLOYMENT_WAR = 10; - public final static int DOMAIN_DEPLOYMENT_RAR = 11; - - // Deployment identification string - public final static String DEPLOYMENT_STRING_EAR = "ear"; - public final static String DEPLOYMENT_STRING_JAR = "jar"; - public final static String DEPLOYMENT_STRING_WAR = "war"; - public final static String DEPLOYMENT_STRING_RAR = "rar"; - public final static String DEPLOYMENT_STRING_DATASOURCE = "datasource"; - public final static String DEPLOYMENT_STRING_JMS = "jms"; - public final static String DEPLOYMENT_STRING_MAILFACTORY = "mail"; - -// Deployment identification strings for domain management - public final static String DOMAIN_DEPLOYMENT_STRING_EAR = "domain-ear"; - public final static String DOMAIN_DEPLOYMENT_STRING_JAR = "domain-jar"; - public final static String DOMAIN_DEPLOYMENT_STRING_WAR = "domain-war"; - public final static String DOMAIN_DEPLOYMENT_STRING_RAR = "domain-rar"; - -// --------------------------------------------------------- Properties variable - - private String imagesRoot = null; - private TreeControl treeControl = null; - private boolean treeToRefresh = false; - - private int applicationServerPort = 0; - private String applicationContextPath = null; - - private boolean catalinaServer = false; - private String currentCatalinaDomainName = null; - private String currentCatalinaServiceName = null; - private String currentCatalinaEngineName = null; - private String currentCatalinaDefaultHostName = null; - private boolean jettyServer = false; - - // J2EE Management information (used in construction of JSR77 ObjectNames) - // These names correspond to the server being currently managed - private ObjectName currentDomain = null; - private ObjectName currentJonasServer = null; - //the curent cluster daemon object name - /** - * @uml.property name="currentClusterDaemon" - */ - private ObjectName currentClusterDaemon = null; - - /** - * @uml.property name="currentDomainName" - */ - private String currentDomainName = null; - private String currentJonasServerName = null; - //the current cluster daemon name - /** - * @uml.property name="currentClusterDaemonName" - */ - private String currentClusterDaemonName = null; - - // The server hosting JonasAdmin application - private String adminJonasServerName = null; - // The hosting server's configuration directory - private String adminJonasServerConfDir = null; - private boolean theCurrentJonasServer = false; - /** - * Type of deployment in progress : JAR, EAR, WAR, RAR, DATASOURCE. - */ - private int currentJonasDeploymentType = 0; - - -// --------------------------------------------------------- Constructor - - public WhereAreYou() { - try { - // Get the name of the Jonas Server who is running the application - JProp oJProp = JProp.getInstance(); - adminJonasServerName = oJProp.getValue(JProp.JONAS_NAME); - adminJonasServerConfDir = oJProp.getConfDir(); - currentDomainName = oJProp.getValue(JProp.DOMAIN_NAME); - currentDomain = J2eeObjectName.J2EEDomain(currentDomainName); - currentJonasServerName = adminJonasServerName; - currentJonasServer = J2eeObjectName.J2EEServer(currentDomainName, currentJonasServerName); - } catch (Exception e) { - // Current Jonas not found, can't run jonasAdmin - throw new JonasAdminException(EXCEPTION_JONASSERVER_NOTFOUND, e.getMessage(), e); - } - } - -// --------------------------------------------------------- Public Methods - - /** - * Initialize the properties in only reading. - * - * @param p_Servlet The instance of servlet to access to the parameter of the servlet config - * @param p_Request The request to access to the HTTP informations - * @throws JonasAdminException - */ - public void initialize(ActionServlet p_Servlet, HttpServletRequest p_Request) - throws JonasAdminException { - // Tags Images Root directory - String sImagesRoot = (String) p_Servlet.getServletConfig().getInitParameter( - TAGS_IMAGES_ROOT_KEY); - if (sImagesRoot != null) { - sImagesRoot = JonasAdminJmx.replace(sImagesRoot, CONTEXT_MACRO - , p_Request.getContextPath()); - } - this.imagesRoot = sImagesRoot; - refreshServers(p_Request, currentDomainName, currentJonasServerName); - } - - /** - * Return the current Jonas server name. - * - * @return The name - */ - public String getCurrentJonasServerName() { - return currentJonasServerName; - } - - /** - * Return the ObjectName of the MBean associated to the current Jonas server. - * - * @return The ObjectName - */ - public ObjectName getCurrentJonasServer() { - return currentJonasServer; - } - - /** - * Return the current J2EE domain ObjectName. - * - * @return The ObjectName - */ - public ObjectName getCurrentDomain() { - return currentDomain; - } - - /** - * Return the current J2EE domain name. - * - * @return The name - */ - public String getCurrentDomainName() { - return currentDomainName; - } - - /** - * Return the name of the selected node in the tree. - * - * @return The name - */ - public String getSelectedNameNode() { - if (treeControl != null) { - TreeControlNode oNode = treeControl.getSelected(); - if (oNode != null) { - return oNode.getName(); - } - } - return null; - } - - /** - * Return the URL to refresh the selected node in the tree. - * - * @param p_Request HTTP request - * @param p_Response HTTP response - * @return The URL - */ - public String getUrlToRefreshSelectedNode(HttpServletRequest p_Request - , HttpServletResponse p_Response) { - if (treeControl != null) { - TreeControlNode oNode = treeControl.getSelected(); - if (oNode != null) { - // Disable refresh - treeToRefresh = false; - // Build URL refresh - String encodedName = null; - try { - encodedName = java.net.URLEncoder.encode(oNode.getName(), "UTF-8"); - } catch (UnsupportedEncodingException e) { - // Node name can't be encoded - encodedName = oNode.getName(); - } - StringBuffer sb = new StringBuffer(); - sb.append(p_Request.getContextPath()); - sb.append("/"); - sb.append(TREE_PAGE_REFRESH); - sb.append(encodedName); - // Force the browser to refresh the tree (Netscape and Mozilla) - sb.append("&s="); - sb.append(Math.random()); - - return p_Response.encodeURL(sb.toString()); - } - } - return null; - } - - /** - * Select the node in the tree. - * - * @param p_Name The name of node to select - * @param p_Expand Expand parent branch - */ - public void selectNameNode(String p_Name, boolean p_Expand) { - if (treeControl != null) { - // Changing node ? - if (p_Name.equals(getSelectedNameNode()) == false) { - // Change node - treeControl.selectNode(p_Name); - if (p_Expand == true) { - treeControl.expandSelectedParents(); - } - treeToRefresh = true; - } - // Query node not found - if ((getSelectedTreeControlNode() == null) && (p_Name != null) && (p_Name.length() > 0)) { - // Try to select the parent node - String s = p_Name.substring(0, p_Name.lastIndexOf(WhereAreYou.NODE_SEPARATOR)); - if ((s != null) && (s.length() > 0)) { - selectNameNode(s, p_Expand); - } - } - } - } - - /** - * Return the selected node in the tree. - * - * @return The selected node - */ - public TreeControlNode getSelectedTreeControlNode() { - if (treeControl != null) { - return treeControl.getSelected(); - } - return null; - } - - /** - * Return the state of current display of tree. - * - * @return True if the current tree is not correctly displaying - */ - public boolean isTreeToRefresh() { - return treeToRefresh; - } - - /** - * Change the state of current display of tree. - * - * @param treeToRefresh True to refresh - */ - public void setTreeToRefresh(boolean treeToRefresh) { - this.treeToRefresh = treeToRefresh; - } - - /** - * Refresh all the servers properties. - * - * @param p_Request The request to access to the HTTP informations - * @throws ManagementException if could not connect to the MBeanServer - * @throws JonasAdminException - */ - public void refreshServers(HttpServletRequest p_Request, String domainName, String serverName) - throws ManagementException, JonasAdminException { - refreshJonas(p_Request, serverName); - applicationServerPort = p_Request.getServerPort(); - applicationContextPath = p_Request.getContextPath(); - refreshCatalina(p_Request, domainName); - refreshJetty(p_Request, domainName); - } - public void refreshServers(HttpServletRequest p_Request) { - // Nothing to do, no server change - } - /** - * Refresh the Catalina server properties. - * - * @param p_Request The request to access to the HTTP informations - */ - public void refreshCatalina(HttpServletRequest p_Request, String domainName) { - resetCatalina(); - try { - String servletServerName = getServletServerName(domainName); - if (servletServerName == null) { - return; - } - String sServer = servletServerName.toLowerCase(); - catalinaServer = (sServer.indexOf("tomcat") > -1); - if (catalinaServer) { - ObjectName onServer = JonasAdminJmx.getFirstMbean(CatalinaObjectName.catalinaServer(), currentJonasServerName); - ObjectName[] aonServices = (ObjectName[]) JonasManagementRepr.getAttribute(onServer - , "serviceNames", currentJonasServerName); - // Service : the first ! - currentCatalinaServiceName = aonServices[0].getKeyProperty("serviceName"); - // Domain - currentCatalinaDomainName = aonServices[0].getDomain(); - // Engine - currentCatalinaEngineName = currentCatalinaDomainName; - ObjectName onEngine = CatalinaObjectName.catalinaEngine(currentCatalinaDomainName); - // Default Host - currentCatalinaDefaultHostName = (String) JonasManagementRepr.getAttribute(onEngine - , "defaultHost", currentJonasServerName); - } - } catch (Exception e) { - // none - } - } - - /** - * Refresh the Jetty server properties. - * - * @param p_Request The request to access to the HTTP informations - */ - public void refreshJetty(HttpServletRequest p_Request, String domainName) { - resetJetty(); - try { - String servletServerName = getServletServerName(domainName); - if (servletServerName == null) { - return; - } - String sServer = servletServerName.toLowerCase(); - jettyServer = (sServer.indexOf("jetty") > -1); - if (jettyServer == true) { - // none action - } - } - catch (Exception e) { - // none - } - } - - /** - * Refresh the managed JOnAS server properties. - * - * @param p_Request The request to access to the HTTP informations - * @throws ManagementException if could not connect to the MBeanServer - * @throws JonasAdminException - */ - public void refreshJonas(HttpServletRequest p_Request, String serverName) - throws ManagementException, JonasAdminException { - resetJonas(); - // Set J2EEServer information - currentJonasServerName = serverName; - currentJonasServer = J2eeObjectName.J2EEServer(currentDomainName, serverName); - - // Detect if the current managed JOnAS server is the one where the application is running - theCurrentJonasServer = adminJonasServerName.equals(currentJonasServerName); - - } - - /** - * Return in a string the contents of the instance for each propertie. - * Debug utility. - * - * @return The string contents - */ - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("imagesRoot=[").append(imagesRoot).append("] "); - sb.append("treeControl=[").append(treeControl).append("] "); - sb.append("catalinaServer=[").append(catalinaServer).append("] "); - return sb.toString(); - } - -// --------------------------------------------------------- Protected Methods - - /** - * Return the name of the servlet server. - * @return The name of the servlet server. - */ - protected String getServletServerName(String domainName) throws ManagementException { - String servletServerName = null; - ObjectName on = JonasObjectName.webContainerService(domainName); - if (JonasManagementRepr.isRegistered(on, currentJonasServerName)) { - servletServerName = (String) JonasManagementRepr.getAttribute(on, "ServerName", currentJonasServerName); - } - return servletServerName; - } - - /** - * Reset the Catalina server properties. - */ - protected void resetCatalina() { - catalinaServer = false; - currentCatalinaServiceName = null; - } - - /** - * Reset the Jetty server properties. - */ - protected void resetJetty() { - jettyServer = false; - } - - /** - * Reset the JOnAS server properties. - */ - protected void resetJonas() { - theCurrentJonasServer = false; - currentJonasServer = null; - currentJonasServerName = null; - } - - /** - * Reset the domain properties. - */ - protected void resetDomain() { - currentDomain = null; - currentDomainName = null; - } - -// --------------------------------------------------------- Properties Methods - - public String getImagesRoot() { - return imagesRoot; - } - - public TreeControl getTreeControl() { - return treeControl; - } - - public void setTreeControl(TreeControl treeControl) { - this.treeControl = treeControl; - } - - public boolean isCatalinaServer() { - return catalinaServer; - } - - public String getCurrentCatalinaServiceName() { - return currentCatalinaServiceName; - } - - public boolean isCurrentJonasServer() { - return theCurrentJonasServer; - } - - public int getCurrentJonasDeploymentType() { - return currentJonasDeploymentType; - } - - public void setCurrentJonasDeploymentType(int currentJonasDeploymentType) { - this.currentJonasDeploymentType = currentJonasDeploymentType; - } - - public int getApplicationServerPort() { - return applicationServerPort; - } - - public String getApplicationContextPath() { - return applicationContextPath; - } - - public String getCurrentCatalinaDefaultHostName() { - return currentCatalinaDefaultHostName; - } - - public String getCurrentCatalinaEngineName() { - return currentCatalinaEngineName; - } - - public String getCurrentCatalinaDomainName() { - return currentCatalinaDomainName; - } - - public boolean isJettyServer() { - return jettyServer; - } - /** - * @return Returns the adminJonasServerName. - */ - public String getAdminJonasServerName() { - return adminJonasServerName; - } - - public String getAdminJonasServerConfDir() { - return adminJonasServerConfDir; - } - - /** - * @return - * @uml.property name="currentClusterDaemon" - */ - public ObjectName getCurrentClusterDaemon() { - return currentClusterDaemon; - } - - /** - * @param currentClusterDaemon - * @uml.property name="currentClusterDaemon" - */ - public void setCurrentClusterDaemon(ObjectName currentClusterDaemon) { - this.currentClusterDaemon = currentClusterDaemon; - } - - /** - * @return - * @uml.property name="currentClusterDaemonName" - */ - public String getCurrentClusterDaemonName() { - return currentClusterDaemonName; - } - - /** - * @param currentClusterDaemonName - * @uml.property name="currentClusterDaemonName" - */ - public void setCurrentClusterDaemonName(String currentClusterDaemonName) { - this.currentClusterDaemonName = currentClusterDaemonName; - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorAction.java deleted file mode 100644 index a5737d53078e13e86001e9db19b059e64669bad9..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorAction.java +++ /dev/null @@ -1,189 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2003-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin.catalina; - -import java.io.IOException; -import java.net.InetAddress; - -import javax.management.ObjectName; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; -import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx; -import org.objectweb.jonas.webapp.jonasadmin.JonasManagementRepr; -import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; -import org.objectweb.jonas.webapp.jonasadmin.common.CatalinaObjectName; - -/** - * @author Michel-Ange ANTON - * @author Adriana Danes - update to Tomact 5.0 - * Replace MBeanFactory usage with JOnAS CatalinaConnectorFactory MBean - * in order to avoid class loader problems occuring with JRMP - */ -public class ApplyConnectorAction extends CatalinaBaseAction { - - /** - * Signature for the createStandardConnector operation. - */ - private String[] saCreateStandardConnectorTypes = { - "java.lang.String", "java.lang.String", "int" // port - }; - -// --------------------------------------------------------- Public Methods - - public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException { - // Current JOnAS server name - String serverName = m_WhereAreYou.getCurrentJonasServerName(); - // Next forward - String sForward = "Catalina Connector"; - // Identify the requested action - ConnectorForm oForm = (ConnectorForm) p_Form; - String sAction = oForm.getAction(); - String sObjectName = oForm.getObjectName(); - String sConnectorType = oForm.getConnectorType(); - - // Populate - try { - // Perform a "Create Connector operation" - if ("create".equals(sAction)) { - String address = oForm.getAddress(); // IP address - - // Ensure that the requested connector name is unique - ObjectName onConnector = CatalinaObjectName.catalinaConnector( - m_WhereAreYou.getCurrentCatalinaDomainName(), - oForm.getPortText()); - if (JonasAdminJmx.hasMBeanName(onConnector, serverName)) { - m_Errors.add("connector", new ActionMessage("error.catalina.connector.exists")); - saveErrors(p_Request, m_Errors); - return (new ActionForward(p_Mapping.getInput())); - } - - Object values[] = new Object[3]; - String operation = null; - - // Look up the Catalina MBeanFactory - ObjectName onFactory = CatalinaObjectName.catalinaFactory(); - values[0] = CatalinaObjectName.catalinaService(m_WhereAreYou. - getCurrentCatalinaDomainName() - , m_WhereAreYou.getCurrentCatalinaServiceName()).toString(); - values[1] = address; - values[2] = new Integer(oForm.getPortText()); - - if ("HTTP".equalsIgnoreCase(sConnectorType)) { - operation = "createHttpConnector"; // HTTP - } - else if ("HTTPS".equalsIgnoreCase(sConnectorType)) { - operation = "createHttpsConnector"; // HTTPS - } - else { - operation = "createAjpConnector"; // AJP(HTTP) - } - sObjectName = (String) JonasManagementRepr.invoke(onFactory, operation, values - , saCreateStandardConnectorTypes, serverName); - - if (sObjectName == null) { - saveErrors(p_Request, m_Errors); - return (p_Mapping.findForward("Global Error")); - } - // refresh tree - refreshTree(p_Request); - // Force the node selected in tree - String nodeName = getTreeBranchName(DEPTH_SERVER) - + WhereAreYou.NODE_SEPARATOR + "protocols" - + WhereAreYou.NODE_SEPARATOR + "connectors"; - //+ WhereAreYou.NODE_SEPARATOR + m_WhereAreYou.getCurrentCatalinaServiceName() - //+ WhereAreYou.NODE_SEPARATOR + oForm.getPortText(); - if (address != null) { - nodeName = nodeName - + WhereAreYou.NODE_SEPARATOR + address; - } - m_WhereAreYou.selectNameNode(nodeName, true); - - } - - ObjectName oObjectName = new ObjectName(sObjectName); - - setIntegerAttribute(oObjectName, "acceptCount", oForm.getAcceptCountText()); - String addressValue = oForm.getAddress(); - InetAddress inetAddress = InetAddress.getByName(addressValue); - JonasManagementRepr.setAttribute(oObjectName, "address", inetAddress, serverName); - setBooleanAttribute(oObjectName, "allowTrace", oForm.isAllowTrace()); - setIntegerAttribute(oObjectName, "connectionTimeout", oForm.getConnTimeOutText()); - setIntegerAttribute(oObjectName, "bufferSize", oForm.getBufferSizeText()); - setIntegerAttribute(oObjectName, "maxPostSize", oForm.getMaxPostSizeText()); - setBooleanAttribute(oObjectName, "enableLookups", oForm.isEnableLookups()); - setBooleanAttribute(oObjectName, "emptySessionPath", oForm.isEmptySessionPath()); - setBooleanAttribute(oObjectName, "xpoweredBy", oForm.isXpoweredBy()); - setBooleanAttribute(oObjectName, "tcpNoDelay", oForm.isTcpNoDelay()); - setBooleanAttribute(oObjectName, "useBodyEncodingForURI", oForm.isUseBodyEncodingForURI()); - setIntegerAttribute(oObjectName, "redirectPort", oForm.getRedirectPortText()); - setIntegerAttribute(oObjectName, "maxThreads", oForm.getMaxThreadsText()); - setIntegerAttribute(oObjectName, "minSpareThreads", oForm.getMinSpareThreadsText()); - setIntegerAttribute(oObjectName, "maxSpareThreads", oForm.getMaxSpareThreadsText()); - - // proxy name and port do not exist for AJP connector - if ("AJP".equalsIgnoreCase(sConnectorType) == false) { - setStringAttribute(oObjectName, "proxyName", oForm.getProxyName()); - setIntegerAttribute(oObjectName, "proxyPort", oForm.getProxyPortText()); - } - - // HTTPS specific properties - if ("HTTPS".equalsIgnoreCase(sConnectorType) == true) { - setBooleanAttribute(oObjectName, "clientAuth", oForm.isClientAuth()); - setStringAttribute(oObjectName, "keystoreFile", oForm.getKeystoreFile()); - setStringAttribute(oObjectName, "keystorePass", oForm.getKeystorePass()); - } - - if ("create".equals(sAction) == true) { - m_Session.removeAttribute(p_Mapping.getAttribute()); - sForward = "ActionListCatalinaConnectors"; - } - - // Save in configuration file - if (oForm.isSave() == true) { - oForm.setSave(false); - p_Request.setAttribute("forward", sForward); - sForward = "ActionEditServletServer"; - //ObjectName on = CatalinaObjectName.catalinaServer(); - //JonasManagementRepr.invoke(on, "store", null, null); - } - } catch (Throwable t) { - addGlobalError(t); - saveErrors(p_Request, m_Errors); - return (p_Mapping.findForward("Global Error")); - } - - // Forward to the connector display page or the list if create - return p_Mapping.findForward(sForward); - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorsAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorsAction.java deleted file mode 100644 index 212e38e541ed47437be330eee48ea6ba61f37034..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorsAction.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2003-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin.catalina; - -import java.io.IOException; -import java.util.ArrayList; - -import javax.management.ObjectName; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; - -/** - * @author Michel-Ange ANTON - */ -public class ApplyConnectorsAction extends CatalinaBaseAction { - - -// --------------------------------------------------------- Public Methods - - public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException { - - // Form used - ItemsConnectorsForm oForm = (ItemsConnectorsForm) p_Form; - // Current server - String serverName = m_WhereAreYou.getCurrentJonasServerName(); - - // Actions - try { - - // Search type realm - ArrayList alSelected = new ArrayList(); - for (int i = 0; i < oForm.getSelectedItems().length; i++) { - alSelected.add(new ConnectorItem(new ObjectName(oForm.getSelectedItems()[i]), 0, serverName)); - } - m_Session.setAttribute("listConnectorsSelected", alSelected); - } - catch (Throwable t) { - addGlobalError(t); - saveErrors(p_Request, m_Errors); - return (p_Mapping.findForward("Global Error")); - } - - // Forward to the connector display page or the list if create - return p_Mapping.findForward("Catalina Connectors Confirm"); - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorsConfirmAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorsConfirmAction.java deleted file mode 100644 index 62394556af9ac700b54003b574e05c26e73ca725..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ApplyConnectorsConfirmAction.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2003-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin.catalina; - -import java.io.IOException; -import java.util.ArrayList; - -import javax.management.ObjectName; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.objectweb.jonas.webapp.jonasadmin.JonasManagementRepr; -import org.objectweb.jonas.webapp.jonasadmin.common.CatalinaObjectName; - -/** - * @author Michel-Ange ANTON - */ -public class ApplyConnectorsConfirmAction extends CatalinaBaseAction { - - /** - * Signature for the removeConnector operation. - */ - private String removeConnectorTypes[] = { - "java.lang.String", // Object name - }; - -// --------------------------------------------------------- Public Methods - - public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form - , HttpServletRequest p_Request, HttpServletResponse p_Response) - throws IOException, ServletException { - - // Form used - ArrayList alSelected = (ArrayList) m_Session.getAttribute("listConnectorsSelected"); - String serverName = m_WhereAreYou.getCurrentJonasServerName(); - // Actions - try { - String[] values = new String[1]; - String operation = "removeConnector"; - // Look up the Catalina MBeanFactory - ObjectName onFactory = CatalinaObjectName.catalinaFactory(); - // Remove connectors - for (int i = 0; i < alSelected.size(); i++) { - ConnectorItem o = (ConnectorItem) alSelected.get(i); - values[0] = o.getObjectName(); - JonasManagementRepr.invoke(onFactory, operation, values, removeConnectorTypes, serverName); - } - // refresh tree - refreshTree(p_Request); - } - catch (Throwable t) { - addGlobalError(t); - saveErrors(p_Request, m_Errors); - return (p_Mapping.findForward("Global Error")); - } - - // Forward to the connector display page or the list if create - return p_Mapping.findForward("ActionListCatalinaConnectors"); - } -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/CatalinaBaseAction.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/CatalinaBaseAction.java deleted file mode 100644 index 3c48298ba0faf6a27153205163a2e2b19b8f6055..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/CatalinaBaseAction.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2003-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin.catalina; - -import javax.servlet.http.HttpServletRequest; - -import org.objectweb.jonas.webapp.jonasadmin.JonasTreeBuilder; -import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou; -import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction; -import org.objectweb.jonas.webapp.taglib.TreeControl; -import org.objectweb.jonas.webapp.taglib.TreeControlNode; - -/** - * @author Michel-Ange ANTON - */ -abstract public class CatalinaBaseAction extends BaseDeployAction { - -// --------------------------------------------------------- Public Methods - /** - * Refresh the tree. - * - * @param p_Request Current instance - * @throws Exception - */ - protected void refreshTree(HttpServletRequest p_Request) - throws Exception { - // Refresh Security Tree - refreshConnectorsTree(p_Request); - // Refresh MBeans Tree - refreshMBeansTree(p_Request); - // Force display to refresh - m_WhereAreYou.setTreeToRefresh(true); - } - - /** - * Refresh the connectors branch tree. - * - * @param p_Request Current instance - * @throws Exception - */ - protected void refreshConnectorsTree(HttpServletRequest p_Request) - throws Exception { - // Get the current node name - String sCurrentNodeNameItem = getTreeBranchName(DEPTH_SERVER) - + WhereAreYou.NODE_SEPARATOR + "protocols" - + WhereAreYou.NODE_SEPARATOR + "connectors"; - // Get current tree - TreeControl oControl = m_WhereAreYou.getTreeControl(); - // Get branch root node - TreeControlNode oBranchRootNode = oControl.findNode(sCurrentNodeNameItem); - // Enable auto-refresh mode - oControl.enableAutoRefresh(); - // Remove old children - TreeControlNode[] aoNodes = oBranchRootNode.findChildren(); - for (int i = 0; i < aoNodes.length; i++) { - aoNodes[i].remove(); - } - // Build node for the Service - JonasTreeBuilder oBuilder = new JonasTreeBuilder(); - oBuilder.getCatalinaDetailConnectors(oBranchRootNode, m_Resources, p_Request); - // Disable auto-refresh mode - oControl.disableAutoRefresh(); - } - -} diff --git a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ConnectorForm.java b/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ConnectorForm.java deleted file mode 100644 index 99d6e19051f590b23bd0c7c10de252d4adfa7eba..0000000000000000000000000000000000000000 --- a/jonas/modules/ee-components/jonas-admin/src/main/java/org/objectweb/jonas/webapp/jonasadmin/catalina/ConnectorForm.java +++ /dev/null @@ -1,1106 +0,0 @@ -/** - * JOnAS: Java(TM) Open Application Server - * Copyright (C) 2003-2004 Bull S.A. - * Contact: jonas-team@objectweb.org - * - * 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.1 of the License, or 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - * -------------------------------------------------------------------------- - * $Id$ - * -------------------------------------------------------------------------- - */ - -package org.objectweb.jonas.webapp.jonasadmin.catalina; - -import java.net.InetAddress; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts.action.ActionMessage; -import org.apache.struts.action.ActionErrors; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; - -/** - * Form bean for the connector page. - * - * @author Michel-Ange ANTON - * @author Adriana Danes - * - update to Tomact 5.0 - * - update to Tomact 5.5 (04/2005) - */ - -public final class ConnectorForm extends ActionForm { - - // ----------------------------------------------------- Instance Variables - - /** - * The administrative action represented by this form. - */ - private String action = "edit"; - - /** - * The administrative sub-action state. - */ - private boolean save = false; - - /** - * The object name of the Connector this bean refers to. - */ - private String objectName = null; - - /** - * The name of the service this connector belongs to. - */ - private String serviceName = null; - /** - * The text for choosing the connector type at creation - */ - private String connectorType = null; - /** - * Generic max value used by the numberCheck method - */ - private int MAX_VALUE = Integer.MAX_VALUE; - - // Common Connector attributes - // --------------------------- - /** - * Used to enable/disable the TRACE HTTP method - */ - private boolean allowTrace = false; - /** - * The 'empty session path' flag for this Connector - */ - private boolean emptySessionPath = false; - /** - * The 'enable DNS lookups' flag for this Connector - */ - private boolean enableLookups = true; - /** - * Maximum size in bytes of a POST which will be handled by the servlet API provided features - */ - private String maxPostSizeText = "2097152"; - /** - * Coyote protocol handler in use - */ - private String protocol = "HTTP/1.1"; - /** - * The text for the proxyName. - */ - private String proxyName = null; - /** - * The text for the proxy Port Number. - */ - private String proxyPortText = "0"; - /** - * The text for the scheme. - */ - private String scheme = "http"; - /** - * Is this a secure (SSL) Connector? - */ - private boolean secure = false; - /** - * Character encoding used to decode the URI - */ - private String URIEncoding = null; - /** - * Should the body encoding be used for URI query parameters - */ - private boolean useBodyEncodingForURI = false; - /** - * Is generation of X-Powered-By response header enabled/disabled? - */ - private boolean xpoweredBy = false; - - // Additional attributes specific to org.apache.coyote.tomcat5.CoyoteConnector - // --------------------------------------------------------------------------- - /** - * The text for the accept Count. - */ - private String acceptCountText = "10"; - /** - * The IP address on which to bind. - */ - private String address = null; - /** - * The text for the TCP port the created socked awaits for incomming requests - */ - private String portText = null; - /** - * The text for the redirect port for non-SSL to SSL redirects - */ - private String redirectPortText = "-1"; - /** - * Should we use TCP no delay? - */ - private boolean tcpNoDelay = true; - - // Thread pool management - /** - * The text for the number of request processing threads that will be created - * when the connector is first started - */ - private String minSpareThreadsText = "4"; - /** - * The text for the maximum number of unused request processing threads - */ - private String maxSpareThreadsText = "50"; - /** - * The text for the max Threads. - */ - private String maxThreadsText = "200"; - - // The followings are not usefull for AJP / JK connectors - /** - * The text for the buffer size to be provided fo input streams. - */ - private String bufferSizeText = "2048"; - /** - * Compression value - */ - private String compression = "off"; - /** - * Linger value on the incoming connection - * Default value is -1 (socket linger is disabled). - */ - private String connectionLingerText = "-1"; - /** - * The text for the Timeout value on the incoming connection - */ - private String connTimeOutText = "60000"; - /** - * The text for the Timeout value on the incoming connection - * during request processing - */ - private String connectionUploadTimeoutText = null; - /** - * Should Tomcat ignore setting a timeout for uploads? - */ - private boolean disableUploadTimeout = false; - /** - * Text for Maximum size in bytes of the HTTP header - */ - private String maxHttpHeaderSizeText = "4096"; - /** - * Text for Maximum number of Keep-Alive requests to honor per connection - */ - private String maxKeepAliveRequestsText = "100"; - /** - * Thread pool strategy - */ - private String strategy = "If"; - /** - * Text for the priority of request processing threads - */ - private String threadPriorityText = "5"; - - // The following is specific to AJP connectors only - /** - * The text for the output buffer size. If -1 buffering is disabled. - */ - private String outputBufferSizeText = "-1"; - /** - * Should Tomcat perform all authentications? - */ - private boolean tomcatAuthentication = true; - - // The followings are dedicated to SSL support - /** - * The certificate encoding algorithm to be used - */ - private String algorithm = "SunX509"; - /** - * Whether client authentication is supported. - */ - private boolean clientAuth = false; - /** - * Pathname of the keystore file - */ - private String keystoreFile = ".keystore"; - /** - * The keyStore Password. - */ - private String keystorePass = "changeit"; - /** - * The keyStore type - */ - private String keystoreType = "JKS"; - /** - * SSL protocol - */ - private String sslProtocol = "TLS"; - /** - * list of encription ciphers - */ - private String ciphers = null; - - // ------------------------- - /** - * The text for the connectorName. - */ - private String connectorName = null; - - /** - * Represent boolean (true, false) values for enableLookups etc. - */ - private List booleanVals = null; - - /** - * Represent supported connector types. - */ - private List connectorTypeVals = null; - - // --------------------------------------------------------- Public Methods - /** - * Validate the properties that have been set from this HTTP request, - * and return an ActionErrors object that encapsulates any - * validation errors that have been found. If no errors are found, return - * null or an ActionErrors object with no - * recorded error messages. - * - * @param mapping The mapping used to select this instance - * @param request The servlet request we are processing - * @return the ActionErrors - */ - public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { - - ActionErrors oErrors = new ActionErrors(); - - // general - numberCheck(oErrors, "acceptCountText", acceptCountText, true, 0, MAX_VALUE); - numberCheck(oErrors, "connTimeOutText", connTimeOutText, true, 0, MAX_VALUE); - numberCheck(oErrors, "bufferSizeText", bufferSizeText, true, 0, MAX_VALUE); - numberCheck(oErrors, "outputBufferSizeText", outputBufferSizeText, true, -1, MAX_VALUE); - - // The IP address can also be null -- - // which means open the server socket on *all* IP addresses for this host - if (address.length() > 0) { - try { - InetAddress.getByName(address); - } catch (Exception e) { - oErrors.add("address", new ActionMessage("error.catalina.connector.address.invalid")); - } - } else { - address = null; - } - - // ports - numberCheck(oErrors, "portNumber", portText, true, 1, MAX_VALUE); - numberCheck(oErrors, "redirectPortText", redirectPortText, true, -1, MAX_VALUE); - - numberCheck(oErrors, "maxThreadsText", maxThreadsText, true, 1, MAX_VALUE); - numberCheck(oErrors, "maxSpareThreadsText", maxSpareThreadsText, true, 1, MAX_VALUE); - numberCheck(oErrors, "minSpareThreadsText", minSpareThreadsText, true, 1, MAX_VALUE); - try { - // if min is a valid integer, then check that max >= min - int min = Integer.parseInt(minSpareThreadsText); - numberCheck(oErrors, "maxThreadsText", maxThreadsText, true, min, MAX_VALUE); - } catch (Exception e) { - } - - // proxy - if ((proxyName != null) && (proxyName.length() > 0)) { - try { - /* - * The proxyName is the server name to be returned for calls to - * request.getServerName() - * This name is the value of the part before ":" in the Host header value, if any, - * or the resolved server name, or the server IP address. - InetAddress.getByName(proxyName); - */ - } catch (Exception e) { - oErrors.add("proxyName" - , new ActionMessage("error.catalina.connector.proxyName.invalid")); - } - } - - // supported only by Coyote HTTP and HTTPS connectors - if (!("AJP".equalsIgnoreCase(connectorType))) { - numberCheck(oErrors, "proxyPortText", proxyPortText, true, 0, MAX_VALUE); - } - - return oErrors; - } - - /** - * Helper method to check that it is a required number and - * is a valid integer within the given range. (min, max). - * - * @param field The field name in the form for which this error occured. - * @param numText The string representation of the number. - * @param rangeCheck Boolean value set to true of reange check should be performed. - * - * @param min The lower limit of the range - * @param max The upper limit of the range - * @param pErrors the ActionErrors - */ - public void numberCheck(ActionErrors pErrors, String field, String numText, boolean rangeCheck - , int min, int max) { - // Check for 'is required' - if ((numText == null) || (numText.length() < 1)) { - pErrors.add(field, new ActionMessage("error.catalina.connector." + field + ".required")); - } else { - - // check for 'must be a number' in the 'valid range' - try { - int num = Integer.parseInt(numText); - // perform range check only if required - if (rangeCheck) { - if ((num < min) || (num > max)) { - pErrors.add(field - , new ActionMessage("error.catalina.connector." + field + ".range")); - } - } - } catch (NumberFormatException e) { - pErrors.add(field, new ActionMessage("error.catalina.connector." + field + ".format")); - } - } - } - -// ------------------------------------------------------------- Properties methods - - /** - * Return the administrative action represented by this form. - * @return the administrative action - */ - public String getAction() { - return this.action; - } - - /** - * Set the administrative action represented by this form. - * @param action the action to set - */ - public void setAction(String action) { - this.action = action; - } - - /** - * Return the object name of the Connector this bean refers to. - * @return the object name of the Connector MBean - */ - public String getObjectName() { - return this.objectName; - } - - /** - * Set the object name of the Connector this bean refers to. - * @param objectName object name of the Connector MBean - */ - public void setObjectName(String objectName) { - this.objectName = objectName; - } - - /** - * Return the object name of the service this connector belongs to. - * @return the object name o