vmassol 2002/08/27 15:54:18
Modified: anttasks/src/java/org/apache/cactus/ant ResinRun.java
Log:
new coding conventions
Revision Changes Path
1.6 +40 -29
jakarta-cactus/anttasks/src/java/org/apache/cactus/ant/ResinRun.java
Index: ResinRun.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/anttasks/src/java/org/apache/cactus/ant/ResinRun.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ResinRun.java 21 Jul 2002 11:48:58 -0000 1.5
+++ ResinRun.java 27 Aug 2002 22:54:17 -0000 1.6
@@ -58,6 +58,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+
import java.util.ArrayList;
/**
@@ -79,22 +80,23 @@
private Object resinServer;
/**
- * Entry point to start/stop the Resin server.
- *
* @param theArgs the command line arguments
*/
- public static void main(String[] theArgs)
+ public ResinRun(String[] theArgs)
{
- ResinRun resin = new ResinRun(theArgs);
- resin.doRun();
+ super(theArgs);
}
/**
+ * Entry point to start/stop the Resin server.
+ *
* @param theArgs the command line arguments
*/
- public ResinRun(String[] theArgs)
+ public static void main(String[] theArgs)
{
- super(theArgs);
+ ResinRun resin = new ResinRun(theArgs);
+
+ resin.doRun();
}
/**
@@ -103,23 +105,29 @@
*/
protected void doStartServer()
{
- try {
- Class resinClass =
+ try
+ {
+ Class resinClass =
Class.forName("com.caucho.server.http.ResinServer");
Constructor constructor = resinClass.getConstructor(
- new Class[]{this.args.getClass(), boolean.class});
+ new Class[] { this.args.getClass(), boolean.class });
+
this.resinServer = constructor.newInstance(
- new Object[]{this.args, new Boolean(true)});
+ new Object[] { this.args, new Boolean(true) });
// Try Resin 2.0 first
- try {
+ try
+ {
startResin20(this.resinServer);
- } catch (NoSuchMethodException nsme) {
+ }
+ catch (NoSuchMethodException nsme)
+ {
// Try Resin 2.1
startResin21(this.resinServer);
}
-
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
throw new RuntimeException("Cannot create instance of ResinServer");
}
@@ -133,10 +141,10 @@
*/
private void startResin20(Object theResinServer) throws Exception
{
- Method initMethod = theResinServer.getClass().getMethod("init",
- new Class[]{boolean.class});
- initMethod.invoke(theResinServer, new Object[]{
- new Boolean(true)});
+ Method initMethod = theResinServer.getClass().getMethod("init",
+ new Class[] { boolean.class });
+
+ initMethod.invoke(theResinServer, new Object[] { new Boolean(true) });
}
/**
@@ -145,12 +153,12 @@
* @param theResinServer the <code>ResinServer</code> instance
* @throws Exception if an error happens when starting the server
*/
- private void startResin21(Object theResinServer)
- throws Exception
+ private void startResin21(Object theResinServer) throws Exception
{
Method initMethod = theResinServer.getClass().getMethod("init",
- new Class[]{ArrayList.class});
- initMethod.invoke(theResinServer, new Object[]{ null });
+ new Class[] { ArrayList.class });
+
+ initMethod.invoke(theResinServer, new Object[] { null });
}
/**
@@ -159,15 +167,18 @@
*/
protected void doStopServer()
{
- try {
- Method closeMethod =
- this.resinServer.getClass().getMethod("close", null);
+ try
+ {
+ Method closeMethod = this.resinServer.getClass().getMethod(
+ "close", null);
+
closeMethod.invoke(this.resinServer, null);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
throw new RuntimeException("Cannot stop running instance of "
+ "ResinServer");
}
}
-
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>