donaldp 01/04/24 20:16:24
Modified: src/java/org/apache/phoenix/engine Main.java
Log:
Reflected changes in Embeddor interface.
Revision Changes Path
1.14 +29 -19
jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine/Main.java
Index: Main.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine/Main.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Main.java 2001/04/25 01:30:22 1.13
+++ Main.java 2001/04/25 03:16:24 1.14
@@ -23,6 +23,7 @@
* The class to load the kernel and start it running.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
+ * @author <a href="[EMAIL PROTECTED]">Leo Simons</a>
*/
public class Main
{
@@ -46,8 +47,6 @@
protected String m_appsPath = DEFAULT_APPS_PATH;
protected String m_logFile = DEFAULT_LOG_FILE;
- protected CLOptionDescriptor[] m_options;
-
/**
* Main entry point.
*
@@ -78,11 +77,11 @@
* Display usage report.
*
*/
- protected void usage()
+ protected void usage( final CLOptionDescriptor[] options )
{
System.out.println( "java " + getClass().getName() + " [options]" );
System.out.println( "\tAvailable options:");
- System.out.println( CLUtil.describeOptions( m_options ) );
+ System.out.println( CLUtil.describeOptions( options ) );
}
/**
@@ -119,22 +118,15 @@
return options;
}
- /**
- * Setup properties, classloader, policy, logger etc.
- *
- * @param clOptions the command line options
- * @exception Exception if an error occurs
- */
- protected void execute( final String[] args )
- throws Exception
+ private boolean parseCommandLineOptions( final String[] args )
{
- m_options = createCLOptions();
- final CLArgsParser parser = new CLArgsParser( args, m_options );
+ final CLOptionDescriptor[] options = createCLOptions();
+ final CLArgsParser parser = new CLArgsParser( args, options );
if( null != parser.getErrorString() )
{
System.err.println( "Error: " + parser.getErrorString() );
- return;
+ return false;
}
final List clOptions = parser.getArguments();
@@ -151,8 +143,8 @@
System.err.println( "Error: Unknown argument" +
option.getArgument() );
//fall threw
case HELP_OPT:
- usage();
- return;
+ usage( options );
+ return false;
case DEBUG_LOG_OPT: debugLog = true; break;
case LOG_FILE_OPT: m_logFile = option.getArgument(); break;
@@ -162,6 +154,23 @@
if( !debugLog ) LogKit.setGlobalPriority( Priority.DEBUG );
+ return true;
+ }
+
+ /**
+ * Setup properties, classloader, policy, logger etc.
+ *
+ * @param clOptions the command line options
+ * @exception Exception if an error occurs
+ */
+ protected void execute( final String[] args )
+ throws Exception
+ {
+ if( false == parseCommandLineOptions( args ) )
+ {
+ return;
+ }
+
try
{
final PrivilegedExceptionAction action = new PrivilegedExceptionAction()
@@ -209,6 +218,7 @@
System.out.println();
embeddor.init();
+ embeddor.start();
try
{
@@ -216,8 +226,8 @@
}
finally
{
- //TODO: Should we really try to force shutdown here???
- //embeddor.dispose();
+ embeddor.stop();
+ embeddor.dispose();
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]