notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r853 - trunk/main/depot/core/console/src/main/net/dpml/depot
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r853 - trunk/main/depot/core/console/src/main/net/dpml/depot
- Date: Wed, 4 Jan 2006 19:25:06 +0100
Author: mcconnell
Date: 2006-01-04 19:25:04 +0100 (Wed, 04 Jan 2006)
New Revision: 853
Removed:
trunk/main/depot/core/console/src/main/net/dpml/depot/Handler.java
trunk/main/depot/core/console/src/main/net/dpml/depot/ShutdownHandler.java
Modified:
trunk/main/depot/core/console/src/main/net/dpml/depot/Main.java
Log:
Completion of the Depot CLI handler clean-up.
Deleted: trunk/main/depot/core/console/src/main/net/dpml/depot/Handler.java
===================================================================
--- trunk/main/depot/core/console/src/main/net/dpml/depot/Handler.java
2006-01-04 17:14:49 UTC (rev 852)
+++ trunk/main/depot/core/console/src/main/net/dpml/depot/Handler.java
2006-01-04 18:25:04 UTC (rev 853)
@@ -1,36 +0,0 @@
-/*
- * Copyright 2005 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.depot;
-
-/**
- * Interface implemented by Depot subsystems that support formal
- * shutdown semantics.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public interface Handler
-{
- /**
- * Terminate the handler.
- */
- void destroy();
-
-}
-
Modified: trunk/main/depot/core/console/src/main/net/dpml/depot/Main.java
===================================================================
--- trunk/main/depot/core/console/src/main/net/dpml/depot/Main.java
2006-01-04 17:14:49 UTC (rev 852)
+++ trunk/main/depot/core/console/src/main/net/dpml/depot/Main.java
2006-01-04 18:25:04 UTC (rev 853)
@@ -18,12 +18,10 @@
package net.dpml.depot;
-import java.io.File;
import java.net.URL;
import java.net.URI;
import java.rmi.RMISecurityManager;
import java.util.ArrayList;
-import java.util.prefs.Preferences;
import java.util.Enumeration;
import net.dpml.transit.Transit;
@@ -47,7 +45,7 @@
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
-public final class Main implements ShutdownHandler
+public final class Main //implements ShutdownHandler
{
private static Main m_MAIN;
private static final PID PROCESS_ID = new PID();
@@ -59,12 +57,8 @@
* Processes command line options to establish the command handler plugin
to deploy.
* Command parameters recognixed by the console include the following:
* <ul>
- * <li>-help</li>
- * <li>-version</li>
- * <li>-reset</li>
+ * <li>-Ddpml.depot.addplication=transit|station|metro|build</li>
* <li>-debug</li>
- * <li>-station</li>
- * <li>-metro</li>
* </ul>
* @param args the command line argument array
* @exception Exception if a error occurs
@@ -128,30 +122,6 @@
}
}
- /**
- * Exit.
- */
- public void exit()
- {
- exit( 0 );
- }
-
- /**
- * Exit.
- * @param flag result status
- */
- public void exit( int flag )
- {
- System.exit( flag );
- }
-
- //private void handleSetup( String[] args )
- //{
- // String name = "setup";
- // String spec = "@DEPOT-INSTALL-URI@";
- // handlePlugin( name, spec, args );
- //}
-
private void handleBuild( String[] args )
{
String name = "build";
@@ -159,19 +129,6 @@
handlePlugin( name, spec, args, false, true );
}
- //private void handleRun( String[] args, boolean tools )
- //{
- // if( args.length < 1 )
- // {
- // System.out.println( "Target URI required." );
- // System.exit( -1 );
- // }
- // String name = "run";
- // String spec = args[0];
- // args = CLIHelper.consolidate( args, spec );
- // handlePlugin( name, spec, args, false, tools );
- //}
-
private void handleMetro( String[] arguments )
{
String[] args = processSystemProperties( arguments );
@@ -218,15 +175,15 @@
private void handlePlugin( String name, String spec, String[] args,
boolean wait, boolean tools )
{
System.setSecurityManager( new RMISecurityManager() );
- boolean waitForCompletion = deployHandler( name, spec, args, this,
wait, tools );
+ boolean waitForCompletion = deployHandler( name, spec, args, /*this,
*/ wait, tools );
if( !waitForCompletion )
{
- exit();
+ System.exit( 0 );
}
}
private boolean deployHandler(
- String command, String path, String[] args, ShutdownHandler shutdown,
boolean waitFor, boolean tools )
+ String command, String path, String[] args, /*ShutdownHandler
shutdown,*/ boolean waitFor, boolean tools )
{
Logger logger = getLogger().getChildLogger( command );
if( m_debug )
@@ -249,7 +206,7 @@
m_plugin =
repository.getPlugin(
ClassLoader.getSystemClassLoader(),
- uri, new Object[]{model, args, logger, shutdown} );
+ uri, new Object[]{model, args, logger/*, shutdown*/} );
}
catch( RepositoryException e )
{
@@ -257,18 +214,18 @@
if( ( null != cause ) && ( cause instanceof GeneralException ) )
{
getLogger().error( cause.getMessage() );
- return false;
+ System.exit( 1 );
}
else
{
getLogger().error( e.getMessage(), e.getCause() );
- return false;
+ System.exit( 1 );
}
}
catch( GeneralException e )
{
getLogger().error( e.getMessage() );
- return false;
+ System.exit( 1 );
}
catch( Throwable e )
{
@@ -277,13 +234,9 @@
+ command
+ "] handler due to deployment failure.";
getLogger().error( error, e );
- return false;
+ System.exit( 1 );
}
- if( m_plugin instanceof Handler )
- {
- setInternalShutdownHook( logger, (Handler) m_plugin );
- }
if( m_plugin instanceof Runnable )
{
getLogger().debug( "starting " + m_plugin.getClass().getName() );
@@ -348,36 +301,6 @@
return DefaultTransitModel.getDefaultModel( logger );
}
- /*
- private void handleGet( Logger logger, String[] args, String path )
throws Exception
- {
- try
- {
- Transit transit = Transit.getInstance();
- setupMonitors( transit, (Adapter) getLogger() );
- URI uri = new URI( path );
- URL url = new URL( uri.toASCIIString() );
- File file = (File) url.getContent( new Class[]{File.class} );
- getLogger().info( "Cached as: " + file );
- }
- catch( Throwable e )
- {
- final String error = "ERROR: Could not complete get request.";
- getLogger().error( error, e );
- }
- }
- */
-
- private static URL getCodeSourceLocation()
- {
- return
Main.class.getProtectionDomain().getCodeSource().getLocation();
- }
-
- //private static Preferences getRootPreferences()
- //{
- // return ROOT_PREFS;
- //}
-
private static Logger getLogger()
{
if( null == m_LOGGER )
@@ -388,50 +311,6 @@
return m_LOGGER;
}
- //private static void handleHelp()
- //{
- // final String message =
- // "Help"
- // + "\n\nUsage: depot [-help] | [-version] | [-setup] | [-prefs] |
[-get [artifact]] | [-exec [spec]]"
- // + "\n\nAvailable command line options:"
- // + "\n"
- // + "\n -help List command line help."
- // + "\n -version List version information."
- // + "\n -run [plugin] Load and run the plugin."
- // + "\n -build Launch the project builder."
- // + "\n -exec [spec] Launch an application using a supplied
specification."
- // + "\n -reset Clear Depot and Transit preferences."
- // + "\n -station Start the DPML Station process"
- // + "\n -debug Enable debug level logging."
- // + "\n -D[name]=[value] Set one or more system properties."
- // + "\n";
- // getLogger().info( message );
- //}
-
- //private static void handleVersion( boolean debug )
- //{
- // final String message =
- // "Version\n"
- // + "\n"
- // + "\n Process ID: \t" + PROCESS_ID
- // + "\n Java Runtime: \t"
- // + System.getProperty( "java.runtime.name" ) + " ("
- // + System.getProperty( "java.version" ).replace( '_', ' ' ) + ")"
- // + "\n Depot Console: \t@DEPOT-CONSOLE-URI@"
- // + "\n Exec Handler: \t@DEPOT-EXEC-URI@"
- // + "\n Build Handler: \t@DEPOT-BUILD-URI@"
- // + "\n Install Handler: \t@DEPOT-INSTALL-URI@"
- // + "\n Station Handler: \t@DEPOT-STATION-URI@"
- // + "\n Transit Library: \t@TRANSIT-CORE-URI@"
- // + "\n";
- // getLogger().info( message );
- //
- // if( debug )
- // {
- // System.getProperties().list( System.out );
- // }
- //}
-
//--------------------------------------------------------------------------
// static utilities for setup of logging manager and root prefs
//--------------------------------------------------------------------------
@@ -502,38 +381,6 @@
}
/**
- * Create a shutdown hook that will trigger shutdown of the supplied
plugin.
- * @param thread the application thread
- */
- private void setInternalShutdownHook( final Logger logger, final Handler
handler )
- {
- //
- // Create a shutdown hook to trigger clean disposal of the
- // handler
- //
-
- Runtime.getRuntime().addShutdownHook(
- new Thread()
- {
- public void run()
- {
- try
- {
- logger.info( "shutdown" );
- handler.destroy();
- }
- catch( Throwable e )
- {
- // ignore it
- boolean ignorable = true;
- }
- System.runFinalization();
- }
- }
- );
- }
-
- /**
* DPML build key.
*/
private static final String BUILD_KEY = "dpml.build";
Deleted:
trunk/main/depot/core/console/src/main/net/dpml/depot/ShutdownHandler.java
===================================================================
---
trunk/main/depot/core/console/src/main/net/dpml/depot/ShutdownHandler.java
2006-01-04 17:14:49 UTC (rev 852)
+++
trunk/main/depot/core/console/src/main/net/dpml/depot/ShutdownHandler.java
2006-01-04 18:25:04 UTC (rev 853)
@@ -1,41 +0,0 @@
-/*
- * Copyright 2005 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.depot;
-
-/**
- * Interface through which Depot command handlers can request process
- * termination.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public interface ShutdownHandler
-{
- /**
- * Invoke virtual machine termination.
- */
- void exit();
-
- /**
- * Invoke virtual machine termination.
- * @param flag the exit status
- */
- void exit( int flag );
-}
-
- r853 - trunk/main/depot/core/console/src/main/net/dpml/depot, mcconnell at BerliOS, 01/04/2006
Archive powered by MHonArc 2.6.24.