notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2898 - in development: central/site central/site/src/docs/transit/latest/guide main/depot/console/src/main/net/dpml/depot main/depot/console/src/main/net/dpml/depot/profile main/depot/station/src/main/net/dpml/depot/station main/metro main/metro/composition/content main/metro/composition/control/src/main/net/dpml/composition/model main/metro/composition/control/src/main/net/dpml/composition/unit main/metro/composition/part main/metro/main main/metro/main/src/main/net/dpml/metro main/metro/main/src/main/net/dpml/metro/model main/metro/main/src/main/net/dpml/metro/part main/metro/main/src/main/net/dpml/metro/part/images main/test/components/http main/test/components/plus/src/main/net/dpml/test/acme/state main/test/plugins main/test/plugins/content main/test/plugins/content/src main/test/plugins/content/src/main/net/dpml/composition/content main/transit/core/handler/src/main/net/dpml/transit/home main/transit/core/handler/src/main/net/dpml/transit/model main/transit/core/handler/src/main/net/dpml/transit/unit planet planet/facilities planet/http planet/http/api planet/http/demo planet/http/demo/src/main/net/dpml/http planet/http/impl planet/http/impl/src/main/net/dpml/http/impl planet/http/spi planet/http/util planet/services planet/site
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2898 - in development: central/site central/site/src/docs/transit/latest/guide main/depot/console/src/main/net/dpml/depot main/depot/console/src/main/net/dpml/depot/profile main/depot/station/src/main/net/dpml/depot/station main/metro main/metro/composition/content main/metro/composition/control/src/main/net/dpml/composition/model main/metro/composition/control/src/main/net/dpml/composition/unit main/metro/composition/part main/metro/main main/metro/main/src/main/net/dpml/metro main/metro/main/src/main/net/dpml/metro/model main/metro/main/src/main/net/dpml/metro/part main/metro/main/src/main/net/dpml/metro/part/images main/test/components/http main/test/components/plus/src/main/net/dpml/test/acme/state main/test/plugins main/test/plugins/content main/test/plugins/content/src main/test/plugins/content/src/main/net/dpml/composition/content main/transit/core/handler/src/main/net/dpml/transit/home main/transit/core/handler/src/main/net/dpml/transit/model main/transit/core/handler/src/main/net/dpml/transit/unit planet planet/facilities planet/http planet/http/api planet/http/demo planet/http/demo/src/main/net/dpml/http planet/http/impl planet/http/impl/src/main/net/dpml/http/impl planet/http/spi planet/http/util planet/services planet/site
- Date: Wed, 22 Jun 2005 02:03:04 -0400
Author: mcconnell AT dpml.net
Date: Wed Jun 22 02:03:03 2005
New Revision: 2898
Added:
development/main/metro/main/src/main/net/dpml/metro/model/
development/main/metro/main/src/main/net/dpml/metro/model/DefaultMetroModel.java
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java
development/main/metro/main/src/main/net/dpml/metro/part/
development/main/metro/main/src/main/net/dpml/metro/part/IconHelper.java
development/main/metro/main/src/main/net/dpml/metro/part/PartContentHandler.java
development/main/metro/main/src/main/net/dpml/metro/part/PartContentHandlerControlPanel.java
development/main/metro/main/src/main/net/dpml/metro/part/images/
development/main/metro/main/src/main/net/dpml/metro/part/images/setup.png
(contents, props changed)
development/main/metro/main/src/main/net/dpml/metro/part/images/source.png
(contents, props changed)
development/main/metro/main/src/main/net/dpml/metro/part/images/temp.png
(contents, props changed)
development/main/metro/main/src/main/net/dpml/metro/part/images/working.png
(contents, props changed)
development/main/metro/main/src/main/net/dpml/metro/part/package.html
development/main/test/plugins/content/
- copied from r2870, development/main/metro/composition/content/
development/main/test/plugins/content/build.xml
- copied, changed from r2897,
development/main/metro/composition/content/build.xml
development/main/test/plugins/content/src/
- copied from r2897, development/main/metro/composition/content/src/
development/main/transit/core/handler/src/main/net/dpml/transit/model/PropertyChangeEvent.java
development/planet/http/
- copied from r2873, development/main/test/components/http/
development/planet/http/api/
- copied from r2897, development/main/test/components/http/api/
development/planet/http/build.xml
- copied unchanged from r2897,
development/main/test/components/http/build.xml
development/planet/http/demo/
- copied from r2897, development/main/test/components/http/demo/
development/planet/http/impl/
- copied from r2897, development/main/test/components/http/impl/
development/planet/http/index.xml
- copied, changed from r2897,
development/main/test/components/http/index.xml
development/planet/http/spi/
- copied from r2897, development/main/test/components/http/spi/
development/planet/http/util/
- copied from r2897, development/main/test/components/http/util/
development/planet/index.xml
development/planet/module.properties
Removed:
development/central/site/src/docs/transit/latest/guide/plugins.xml
development/main/metro/composition/content/
development/main/metro/composition/part/
development/main/metro/main/src/main/net/dpml/metro/Metro.java
development/main/test/components/http/
development/main/test/components/plus/src/main/net/dpml/test/acme/state/
development/planet/facilities/
development/planet/services/
development/planet/site/
Modified:
development/central/site/build.xml
development/main/depot/console/src/main/net/dpml/depot/Main.java
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfileStorage.java
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
development/main/metro/composition/control/src/main/net/dpml/composition/model/ComponentTable.java
development/main/metro/composition/control/src/main/net/dpml/composition/unit/CompositionHelper.java
development/main/metro/composition/control/src/main/net/dpml/composition/unit/ControllerStorageUnit.java
development/main/metro/composition/control/src/main/net/dpml/composition/unit/DefaultControllerModel.java
development/main/metro/index.xml
development/main/metro/main/ (props changed)
development/main/metro/main/build.xml
development/main/test/plugins/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java
development/main/test/plugins/index.xml
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentHome.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentListener.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/Model.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
development/planet/build.xml
development/planet/http/demo/build.xml
development/planet/http/demo/src/main/net/dpml/http/Demo.java
development/planet/http/impl/src/main/net/dpml/http/impl/NcsaRequestLog.java
Log:
Move http to planet, simplfy implemetation logic in transit storage model,
some improvements to http (default, logging, etc.), enhancements to the metro
inital context, and some refactoring of the content handler for the part
datatype. Removed a bunch of unused directories in planet and a few other
housekeeping things.
Modified: development/central/site/build.xml
==============================================================================
--- development/central/site/build.xml (original)
+++ development/central/site/build.xml Wed Jun 22 02:03:03 2005
@@ -31,7 +31,6 @@
<x:filter key="dpml-transit-tools" feature="uri"
token="MAGIC-BOOTSTRAP-URI"/>
<x:filter key="dpml-magic-core" feature="plugin"
token="MAGIC-PLUGIN-URI"/>
<x:filter key="dpml-transit-main" feature="uri"
token="TRANSIT-MAIN-URI"/>
- <x:filter key="dpml-transit-plugin" feature="plugin"
token="TRANSIT-PLUGIN-URI"/>
<x:filter key="dpml-transit" feature="api" token="TRANSIT-DOCS-PATH"/>
<x:filter key="dpml-magic" feature="api" token="MAGIC-DOCS-PATH"/>
<x:filter key="dpml-metro" feature="api" token="METRO-JAVADOC-PATH"/>
Modified: development/main/depot/console/src/main/net/dpml/depot/Main.java
==============================================================================
--- development/main/depot/console/src/main/net/dpml/depot/Main.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/Main.java Wed
Jun 22 02:03:03 2005
@@ -34,6 +34,7 @@
import java.rmi.RMISecurityManager;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
+import java.util.ArrayList;
import java.util.Date;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
@@ -68,6 +69,8 @@
*/
public final class Main
{
+ private static Object OBJECT;
+
public static void start( final String[] args )
throws Exception
{
@@ -81,80 +84,79 @@
System.exit( 0 );
}
- public static void main( final String[] args )
- throws Exception
+ private static boolean isFlagPresent( String[] args, String flag )
{
- long start = new Date().getTime();
- System.setSecurityManager(new RMISecurityManager());
- boolean termination = false;
-
for( int i=0; i < args.length; i++ )
{
String arg = args[i];
- if( arg.equals( "-station" ) )
+ if( arg.equals( flag ) )
{
- System.setProperty( "dpml.system.group", "station" );
- break;
+ return true;
}
}
+ return false;
+ }
- //
- // check if -debug level logging should be enabled
- //
-
+ private static String[] consolidate( String [] args, String argument )
+ {
+ ArrayList list = new ArrayList();
for( int i=0; i < args.length; i++ )
{
String arg = args[i];
- if( arg.equals( "-debug" ) )
+ if( false == arg.equals( argument ) )
{
- System.setProperty( "dpml.logging.level", "FINE" );
- break;
+ list.add( arg );
}
}
+ return (String[]) list.toArray( new String[0] );
+ }
- LOGGER = new LoggingAdapter( java.util.logging.Logger.getLogger(
"depot" ) );
- Logger logger = getLogger();
-
- //
- // check if a preferences -reset has been requested
- //
-
- for( int i=0; i < args.length; i++ )
+ public static void main( String[] args )
+ throws Exception
+ {
+ long start = new Date().getTime();
+ System.setSecurityManager(new RMISecurityManager());
+ boolean termination = false;
+ System.setProperty( "dpml.system.group", "depot" );
+
+ boolean help = isFlagPresent( args, "-help" );
+ if( help )
{
- String arg = args[i];
- if( arg.equals( "-reset" ) )
- {
- clearPreferences( Main.class );
- clearPreferences( Transit.class );
- return;
- }
+ handleHelp();
+ return;
}
- //
- // check if -help has been requested
- //
-
- for( int i=0; i < args.length; i++ )
+ boolean reset = isFlagPresent( args, "-reset" );
+ if( reset )
{
- String arg = args[i];
- if( arg.equals( "-help" ) )
- {
- handleHelp( logger );
- return;
- }
+ clearPreferences( Main.class );
+ clearPreferences( Transit.class );
+ return;
}
- //
- // check if -version info has been requested
- //
-
+ boolean version = isFlagPresent( args, "-version" );
+ if( version )
+ {
+ handleVersion();
+ return;
+ }
+
+ boolean debug = isFlagPresent( args, "-debug" );
+ if( debug )
+ {
+ args = consolidate( args, "-debug" );
+ System.setProperty( "dpml.logging.level", "FINE" );
+ }
+
+
+
for( int i=0; i < args.length; i++ )
{
String arg = args[i];
- if( arg.equals( "-version" ) )
+ if( arg.equals( "-station" ) )
{
- handleVersion( logger );
- return;
+ System.setProperty( "dpml.system.group", "station" );
+ break;
}
}
@@ -170,13 +172,13 @@
if( i+1 < args.length )
{
String path = args[i+1];
- handleGet( logger, args, path );
+ handleGet( getLogger(), args, path );
}
else
{
final String error =
"Missing get parameter value.";
- logger.error( error );
+ getLogger().error( error );
}
return;
}
@@ -189,9 +191,9 @@
// application profile and load the profile from the depot
manager
//
- Date creation = new Date();
+ Logger logger = getLogger();
Preferences prefs = getRootPreferences();
- DepotStorage store = new DepotStorage( prefs, logger, creation,
false );
+ DepotStorage store = new DepotStorage( prefs, logger, false );
DepotModel manager = store.getDepotModel();
//
@@ -229,7 +231,7 @@
if( null == profile )
{
- handleHelp( logger );
+ handleHelp();
return;
}
@@ -247,71 +249,54 @@
applySystemProperties( properties );
ClassLoader system = getSystemClassLoader();
URI uri = profile.getCodeBaseURI();
- try
- {
- String id = profile.getID();
- Properties params = profile.getProperties();
- Logger log = logger.getChildLogger( id );
+ String id = profile.getID();
+ Logger log = logger.getChildLogger( id );
- Object object = resolveTargetObject( system, uri, args,
manager, model, log, profile );
+ OBJECT = resolveTargetObject( system, uri, args, manager, model,
log, profile );
- Connection connection = profile.getConnection();
- if( null != connection )
- {
- logger.info( "service is requesting a connection" );
- logger.info( "host: " + connection.getHost() );
- logger.info( "port: " + connection.getPort() );
+ Connection connection = profile.getConnection();
+ if( null != connection )
+ {
+ logger.info( "service is requesting a connection" );
+ logger.info( "host: " + connection.getHost() );
+ logger.info( "port: " + connection.getPort() );
- Registry registry = getRegistry( connection, true );
+ Registry registry = getRegistry( connection, true );
- registry.bind( id, (Remote) object );
- if( null == connection.getHost() )
- {
- logger.info(
- "service bound to "
- + connection.getPort() + "/" + id );
- }
- else
- {
- logger.info(
- "service bound to " + connection.getHost()
- + ":" + connection.getPort() + "/" + id );
- }
- }
- else if( object instanceof Runnable )
+ registry.bind( id, (Remote) OBJECT );
+ if( null == connection.getHost() )
{
- //
- // run the plugin
- //
-
- Thread thread = null;
- logger.info( "starting " + object.getClass().getName() );
- thread = new Thread( (Runnable) object );
- thread.start();
- setShutdownHook( thread );
+ logger.info(
+ "service bound to "
+ + connection.getPort() + "/" + id );
}
else
{
- logger.info( "loaded " + object.getClass().getName() );
+ logger.info(
+ "service bound to " + connection.getHost()
+ + ":" + connection.getPort() + "/" + id );
}
}
- catch( TransitError e )
+ else if( OBJECT instanceof Runnable )
{
- final String error =
- "Cannot load profile to an unrecoverable Transit error.";
- getLogger().error( error, e );
- throw new HandledError();
+ //
+ // run the plugin
+ //
+
+ Thread thread = null;
+ logger.info( "starting " + OBJECT.getClass().getName() );
+ thread = new Thread( (Runnable) OBJECT );
+ thread.start();
+ setShutdownHook( thread );
}
- catch( Throwable e )
+ else
{
- final String error =
- "Cannot load profile due to an application establishment
error.";
- getLogger().error( error, e );
- throw new HandledError();
+ logger.info( "loaded " + OBJECT.getClass().getName() );
}
}
- catch( HandledError handledError )
+ catch( Throwable e )
{
+ getLogger().error( e.getMessage(), e.getCause() );
System.exit( -1 );
}
@@ -330,135 +315,66 @@
private static Object resolveTargetObject(
ClassLoader parent, URI uri, String[] args, DepotModel manager,
TransitModel model,
Logger logger, ApplicationProfile profile )
- throws HandledError
+ throws Exception
{
- try
- {
- Transit transit = Transit.getInstance( model );
- Repository loader = transit.getRepository();
-
- Artifact artifact = Artifact.createArtifact( uri );
- String type = artifact.getType();
- if( "plugin".equals( type ) )
- {
- Properties props = profile.getProperties();
- return loader.getPlugin( parent, uri, new Object[]{ args,
manager, model, logger, props } );
- }
- else
- {
- final String error =
- "Artifact type [" + type + "] is not supported.";
- getLogger().error( error );
- throw new HandledError();
- }
- }
- catch( HandledError e )
- {
- throw e;
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected error while attempting to deploy object."
- + "\nURI: " + uri;
- getLogger().error( error, e );
- throw new HandledError();
- }
- }
+ Transit transit = Transit.getInstance( model );
+ Repository loader = transit.getRepository();
- private static void handleGet( Logger logger, String[] args, String path
) throws HandledError
- {
- TransitModel model = loadTransitModel( args, logger, false );
- try
+ Artifact artifact = Artifact.createArtifact( uri );
+ String type = artifact.getType();
+ if( "plugin".equals( type ) )
{
- Transit transit = Transit.getInstance( model );
- 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 );
+ return loader.getPlugin( parent, uri, new Object[]{ args,
manager, model, logger, profile } );
}
- catch( URISyntaxException e )
+ else if( "part".equals( type ) )
{
- final String error =
- "Supplied path argument could not be converted to a valid URI."
- + "\nPath: " + path;
- getLogger().error( error );
- throw new HandledError();
+ String path = uri.toASCIIString();
+ URL url = new URL( path );
+ return url.getContent( new Class[]{ Object.class } );
}
- catch( MalformedURLException e )
- {
- final String error =
- "Supplied path argument could not be converted to a valid URL."
- + "\nPath: " + path
- + "\nCause: " + e.getMessage();
- getLogger().error( error );
- throw new HandledError();
- }
- catch( IOException e )
- {
- final String error =
- "IOException while attemopting to resolve artifact."
- + "\nURI: " + path
- + "\nCause: " + e.getMessage();
- getLogger().error( error );
- throw new HandledError();
- }
- catch( Exception e )
+ else
{
final String error =
- "Unexpected exception while attempting to get artifact.";
- getLogger().error( error, e );
- throw new HandledError();
- }
- }
-
- private static ApplicationProfile createPrefsProfile( Logger logger )
throws HandledError
- {
- try
- {
- String id = "prefs";
- Date creation = new Date();
- Logger log = logger.getChildLogger( "prefs" );
- boolean policy = true;
- URI uri = new URI( "@DEPOT-PREFS-URI@" );
- String title = "Depot Preferences";
- boolean command = false;
- Properties args = new Properties();
- return new DefaultApplicationProfile(
- log, creation, id, title, null, command, null, uri, args );
+ "Artifact type [" + type + "] is not supported.";
+ throw new Exception( error );
}
- catch( Exception e )
- {
- final String error =
- "Unexpected exception while attempting to construct the
preferences profile.";
- getLogger().error( error, e );
- throw new HandledError();
- }
}
- private static ApplicationProfile createStationProfile( Logger logger )
throws HandledError
+ private static void handleGet( Logger logger, String[] args, String path
) throws Exception
{
- try
- {
- String id = "station";
- Date creation = new Date();
- Logger log = logger.getChildLogger( "station" );
- boolean policy = true;
- URI uri = new URI( "@STATION-PLUGIN-URI@" );
- String title = "Depot Station";
- boolean command = false;
- Connection connection = new Connection();
- Properties args = new Properties();
- return new DefaultApplicationProfile(
- log, creation, id, title, null, command, connection, uri, args
);
- }
- catch( Exception e )
- {
- final String error =
- "Unexpected exception while attempting to construct the
station profile.";
- getLogger().error( error, e );
- throw new HandledError();
- }
+ TransitModel model = loadTransitModel( args, logger, false );
+ Transit transit = Transit.getInstance( model );
+ 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 );
+ }
+
+ private static ApplicationProfile createPrefsProfile( Logger logger )
throws Exception
+ {
+ String id = "prefs";
+ Logger log = logger.getChildLogger( "prefs" );
+ boolean policy = true;
+ URI uri = new URI( "@DEPOT-PREFS-URI@" );
+ String title = "Depot Preferences";
+ boolean command = false;
+ Properties args = new Properties();
+ return new DefaultApplicationProfile(
+ log, id, title, null, command, null, uri, args );
+ }
+
+ private static ApplicationProfile createStationProfile( Logger logger )
throws Exception
+ {
+ String id = "station";
+ Logger log = logger.getChildLogger( "station" );
+ boolean policy = true;
+ URI uri = new URI( "@STATION-PLUGIN-URI@" );
+ String title = "Depot Station";
+ boolean command = false;
+ Connection connection = new Connection();
+ Properties args = new Properties();
+ return new DefaultApplicationProfile(
+ log, id, title, null, command, connection, uri, args );
}
public static Registry getRegistry( Connection connection, boolean
create )
@@ -492,17 +408,7 @@
}
else
{
- try
- {
- return LocateRegistry.getRegistry( host, port );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unable to establish the RMI Registry.";
- getLogger().error( error, e );
- throw new HandledError();
- }
+ return LocateRegistry.getRegistry( host, port );
}
}
}
@@ -515,25 +421,9 @@
}
private static ApplicationProfile getApplicationProfile( DepotModel
manager, String target )
+ throws Exception
{
- try
- {
- return manager.getApplicationProfile( target );
- }
- catch( UnknownKeyException e )
- {
- final String error =
- "Requested application profile '" + target + "' does not
exist.";
- getLogger().error( error );
- throw new HandledError();
- }
- catch( RemoteException e )
- {
- final String error =
- "Unexpected remote exception while resolving '" + target + "'
profile.";
- getLogger().error( error );
- throw new HandledError();
- }
+ return manager.getApplicationProfile( target );
}
private static ClassLoader getSystemClassLoader()
@@ -541,18 +431,11 @@
return ClassLoader.getSystemClassLoader();
}
- private static void clearPreferences( Class c )
+ private static void clearPreferences( Class c ) throws Exception
{
- try
- {
- Preferences prefs = Preferences.userNodeForPackage( c );
- getLogger().info( "Resetting: " + prefs );
- prefs.removeNode();
- }
- catch( Throwable e )
- {
- getLogger().error( "User preferences reset failure.", e );
- }
+ Preferences prefs = Preferences.userNodeForPackage( c );
+ getLogger().info( "Resetting: " + prefs );
+ prefs.removeNode();
}
/**
@@ -616,7 +499,7 @@
final String error =
"Missing profile name.";
getLogger().error( error );
- throw new HandledError();
+ System.exit( -1 );
}
}
}
@@ -677,41 +560,44 @@
private static Logger getLogger()
{
+ if( null == LOGGER )
+ {
+ LOGGER = new LoggingAdapter( java.util.logging.Logger.getLogger(
"depot" ) );
+ }
return LOGGER;
}
- private static void handleHelp( Logger logger )
+ private static void handleHelp()
{
final String message =
"Depot application deployment."
- + "\n\nUsage: depot [option] [args]"
+ + "\n\nUsage: depot [-help] | [-version] | [-prefs] | [-get
[artifact]] | [-profile [name]]"
+ "\n\nAvailable command line options:"
- + "\n\n -debug Enable debug level logging."
+ + "\n\n -debug Enable debug level logging."
+ "\n -get [artifact] Load the supplied artifact to the cache."
+ "\n -help List command line help."
+ "\n -prefs Start the Depot preferences editor."
+ "\n -profile [name] Launch a named application."
+ "\n -reset Clear Depot and Transit prefences."
- + "\n -station Start the Depot Station Server activation
system."
+ "\n -version List Depot version information.";
- logger.info( message );
+ getLogger().info( message );
}
- private static void handleVersion( Logger logger )
+ private static void handleVersion()
{
final String message =
"Depot Version.\n"
+ "\nConsole: \t@DEPOT-CONSOLE-URI@"
+ "\nPreferences: \t@DEPOT-PREFS-URI@"
+ "\nStation: \t@STATION-PLUGIN-URI@";
- logger.info( message );
+ getLogger().info( message );
}
// TODO: add support for transit configuration profile selection
private static TransitModel loadTransitModel( String[] args, Logger
logger, boolean resolve )
+ throws Exception
{
- //int port = ActivationSystem.SYSTEM_PORT;
int port = Registry.REGISTRY_PORT;
Connection connection = new Connection( null, port, true, true );
@@ -735,30 +621,13 @@
{
return createTransitModel( args, logger );
}
- catch( Throwable e )
- {
- final String error =
- "Unexpected error while attempting to construct the transit
model.";
- getLogger().error( error, e );
- throw new HandledError();
- }
}
- private static TransitModel createTransitModel( String[] args, Logger
logger )
+ private static TransitModel createTransitModel( String[] args, Logger
logger ) throws Exception
{
logger.info( "creating new transit model" );
- try
- {
- TransitHome home = new TransitStorageUnit();
- return home.create();
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected error while attempting to construct the transit
model.";
- getLogger().error( error, e );
- throw new HandledError();
- }
+ TransitHome home = new TransitStorageUnit();
+ return home.create();
}
//--------------------------------------------------------------------------
@@ -782,8 +651,5 @@
private static Logger LOGGER = null;
private static final Preferences ROOT_PREFS =
Preferences.userNodeForPackage( Main.class );
- private static class HandledError extends Error
- {
- }
}
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
Wed Jun 22 02:03:03 2005
@@ -44,9 +44,5 @@
void setConnection( Connection connection ) throws RemoteException;
- Properties getProperties() throws RemoteException;
-
- void setProperties( Properties properties ) throws RemoteException;
-
}
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfileStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfileStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfileStorage.java
Wed Jun 22 02:03:03 2005
@@ -48,10 +48,10 @@
//
------------------------------------------------------------------------
public ApplicationProfileStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException, RemoteException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
String id = getID();
String title = getTitle();
@@ -64,7 +64,7 @@
m_profile =
new DefaultApplicationProfile(
- logger, creation, this, id, title, properties, command,
connection, uri, enabled, args );
+ logger, this, id, title, properties, command, connection, uri,
enabled, args );
}
//
------------------------------------------------------------------------
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
Wed Jun 22 02:03:03 2005
@@ -39,20 +39,20 @@
private Properties m_params;
public DefaultApplicationProfile(
- Logger logger, Date creation, String id, String title,
+ Logger logger, String id, String title,
Properties properties, boolean command, Connection connection, URI
uri, Properties args )
throws RemoteException
{
- this( logger, creation, null, id, title, properties, command,
connection, uri, true, args );
+ this( logger, null, id, title, properties, command, connection, uri,
true, args );
}
public DefaultApplicationProfile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
+ Logger logger, ProfileHome home, String id, String title,
Properties properties, boolean command, Connection connection, URI
uri,
boolean enabled, Properties params )
throws RemoteException
{
- super( logger, creation, home, id, title, properties, uri );
+ super( logger, home, id, title, properties, uri );
m_enabled = enabled;
m_connection = connection;
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
Wed Jun 22 02:03:03 2005
@@ -44,10 +44,10 @@
private final List m_list = Collections.synchronizedList( new
LinkedList() );
- public DefaultDepotModel( Logger logger, Date creation, Home home,
ApplicationProfile[] profiles )
+ public DefaultDepotModel( Logger logger, Home home, ApplicationProfile[]
profiles )
throws NullPointerException, ProfileException, RemoteException
{
- super( logger, creation );
+ super( logger );
m_home = home;
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
Wed Jun 22 02:03:03 2005
@@ -42,10 +42,10 @@
private Properties m_properties;
public DefaultProfile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
+ Logger logger, ProfileHome home, String id, String title,
Properties properties, URI uri ) throws RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
m_id = id;
m_title = title;
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
Wed Jun 22 02:03:03 2005
@@ -46,15 +46,16 @@
//
------------------------------------------------------------------------
public DepotStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException, RemoteException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
setupTestProfile();
setupMexicoProfile();
setupMetroProfile();
+ setupHttpProfile();
ApplicationProfile[] profiles = getApplicationProfiles();
- m_depot = new DefaultDepotModel( logger, creation, this, profiles );
+ m_depot = new DefaultDepotModel( logger, this, profiles );
}
//
------------------------------------------------------------------------
@@ -96,15 +97,13 @@
Preferences prefs = getPreferences().node( "profiles" ).node( id );
Logger logger = getLogger().getChildLogger( id );
boolean policy = getStoragePolicy();
- Date creation = getCreationDate();
- ApplicationProfileStorage store = new ApplicationProfileStorage(
prefs, logger, creation, policy );
+ ApplicationProfileStorage store = new ApplicationProfileStorage(
prefs, logger, policy );
return store.getApplicationProfile();
}
private void setupTestProfile() throws ProfileException, RemoteException
{
String id = "test";
- Date creation = getCreationDate();
Logger logger = getLogger().getChildLogger( id );
boolean policy = getStoragePolicy();
Preferences prefs = getPreferences().node( "profiles" ).node( id );
@@ -116,7 +115,6 @@
private void setupMexicoProfile() throws ProfileException
{
String id = "mexico";
- Date creation = getCreationDate();
Logger logger = getLogger().getChildLogger( id );
boolean policy = getStoragePolicy();
Preferences prefs = getPreferences().node( "profiles" ).node( id );
@@ -127,11 +125,21 @@
private void setupMetroProfile() throws ProfileException
{
String id = "metro";
- Date creation = new Date();
Logger logger = getLogger().getChildLogger( id );
boolean policy = getStoragePolicy();
Preferences prefs = getPreferences().node( "profiles" ).node( id );
prefs.put( "uri",
"artifact:plugin:dpml/metro/dpml-metro-main#SNAPSHOT" );
prefs.put( "title", "Metro" );
}
+
+ private void setupHttpProfile() throws ProfileException
+ {
+ String id = "http";
+ Logger logger = getLogger().getChildLogger( id );
+ boolean policy = getStoragePolicy();
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ prefs.put( "uri",
"artifact:part:dpml/planet/http/dpml-http-demo#SNAPSHOT" );
+ prefs.put( "title", "HTTP Demo" );
+ }
+
}
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
Wed Jun 22 02:03:03 2005
@@ -40,10 +40,10 @@
//
------------------------------------------------------------------------
public ProfileStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -83,28 +83,4 @@
return getProperties( prefs );
}
- protected Properties getProperties( Preferences prefs ) throws
ProfileException
- {
- Properties properties = new Properties();
- try
- {
- String[] keys = prefs.keys();
- for( int i=0; i<keys.length; i++ )
- {
- String key = keys[i];
- String value = prefs.get( key, null );
- if( null != value )
- {
- properties.setProperty( key, value );
- }
- }
- return properties;
- }
- catch( BackingStoreException e )
- {
- final String error =
- "Internal error while resolving persistent application
properties.";
- throw new ProfileException( error, e );
- }
- }
}
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
Wed Jun 22 02:03:03 2005
@@ -41,11 +41,11 @@
private CodeBaseProfile[] m_profiles;
public ActivationGroupProfile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
+ Logger logger, ProfileHome home, String id, String title,
Properties properties, URI uri, String classname, CodeBaseProfile[]
profiles )
throws ProfileException, RemoteException
{
- super( logger, creation, home, id, title, properties, uri, classname
);
+ super( logger, home, id, title, properties, uri, classname );
m_profiles = profiles;
}
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
Wed Jun 22 02:03:03 2005
@@ -48,10 +48,10 @@
//
------------------------------------------------------------------------
public ActivationGroupStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException, RemoteException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
String id = getID();
String title = getTitle();
@@ -62,21 +62,20 @@
m_profile =
new ActivationGroupProfile(
- logger, creation, this, id, title, properties, uri, classname,
profiles );
+ logger, this, id, title, properties, uri, classname, profiles );
}
protected CodeBaseProfile[] getCodeBaseProfiles()
throws ProfileException
{
Logger logger = getLogger();
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
Preferences prefs = getPreferences().node( "entries" );
- return getCodeBaseProfiles( prefs, logger, creation, policy );
+ return getCodeBaseProfiles( prefs, logger, policy );
}
protected static CodeBaseProfile[] getCodeBaseProfiles(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException
{
if( false == ( "entries".equals( prefs.name() ) ) )
@@ -96,14 +95,14 @@
if( true == p.getBoolean( "group", false ) )
{
ActivationGroupStorage store =
- new ActivationGroupStorage( p, log, creation, policy );
+ new ActivationGroupStorage( p, log, policy );
CodeBaseProfile profile =
store.getActivationGroupProfile();
profiles[i] = profile;
}
else
{
ActivationStorage store =
- new ActivationStorage( p, log, creation, policy );
+ new ActivationStorage( p, log, policy );
CodeBaseProfile profile = store.getActivationProfile();
profiles[i] = profile;
}
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
Wed Jun 22 02:03:03 2005
@@ -40,11 +40,11 @@
private boolean m_restart;
public ActivationProfile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
+ Logger logger, ProfileHome home, String id, String title,
Properties properties, URI uri, String classname, boolean restart )
throws ProfileException, RemoteException
{
- super( logger, creation, home, id, title, properties, uri, classname
);
+ super( logger, home, id, title, properties, uri, classname );
m_restart = restart;
}
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
Wed Jun 22 02:03:03 2005
@@ -49,10 +49,10 @@
//
------------------------------------------------------------------------
public ActivationStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException, RemoteException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
String id = getID();
String title = getTitle();
@@ -64,8 +64,7 @@
logger.debug( "Creating activation profile: " + id );
m_profile =
new ActivationProfile(
- logger, creation, this, id, title, properties,
- uri, classname, restart );
+ logger, this, id, title, properties, uri, classname, restart );
}
public ActivationProfile getActivationProfile()
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java
Wed Jun 22 02:03:03 2005
@@ -43,11 +43,11 @@
private String m_classname;
public CodeBaseProfile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
+ Logger logger, ProfileHome home, String id, String title,
Properties properties, URI uri, String classname )
throws ProfileException, RemoteException
{
- super( logger, creation, home, id, title, properties, uri );
+ super( logger, home, id, title, properties, uri );
m_classname = classname;
}
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java
Wed Jun 22 02:03:03 2005
@@ -42,9 +42,9 @@
//
------------------------------------------------------------------------
public CodeBaseStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
throws ProfileException
+ Preferences prefs, Logger logger, boolean policy ) throws
ProfileException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
protected String getClassname() throws ProfileException
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
Wed Jun 22 02:03:03 2005
@@ -42,10 +42,10 @@
private CodeBaseProfile[] m_profiles;
public StationProfile(
- Logger logger, Date creation, Home home, Properties properties,
CodeBaseProfile[] profiles )
+ Logger logger, Home home, Properties properties, CodeBaseProfile[]
profiles )
throws RemoteException
{
- super( logger, creation );
+ super( logger );
m_home = home;
m_properties = properties;
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
Wed Jun 22 02:03:03 2005
@@ -49,10 +49,10 @@
//
------------------------------------------------------------------------
public StationStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws ProfileException, RemoteException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
Properties properties = getProperties();
@@ -61,17 +61,16 @@
setupBootstrapProfiles();
CodeBaseProfile[] profiles = getCodeBaseProfiles( prefs.node(
"entries" ) );
- m_profile = new StationProfile( logger, creation, this, properties,
profiles );
+ m_profile = new StationProfile( logger, this, properties, profiles );
}
private CodeBaseProfile[] getCodeBaseProfiles( Preferences prefs )
throws ProfileException
{
Logger logger = getLogger();
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
logger.info( "Station Entries: " + prefs );
- return ActivationGroupStorage.getCodeBaseProfiles( prefs, logger,
creation, policy );
+ return ActivationGroupStorage.getCodeBaseProfiles( prefs, logger,
policy );
}
protected Properties getProperties() throws ProfileException
@@ -122,7 +121,6 @@
private void setupMexicoProfile() throws ProfileException
{
String id = "mexico";
- Date creation = getCreationDate();
Logger logger = getLogger().getChildLogger( id );
boolean policy = getStoragePolicy();
Preferences prefs = getPreferences().node( "entries" ).node( id );
Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/model/ComponentTable.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/model/ComponentTable.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/model/ComponentTable.java
Wed Jun 22 02:03:03 2005
@@ -21,6 +21,7 @@
import java.io.Serializable;
import java.util.Map;
import java.util.WeakHashMap;
+import java.util.Hashtable;
/**
* The parts model is a model of the set of parts maintained by a parent
model.
@@ -32,7 +33,8 @@
{
private final CompositionModel m_model;
- private final Map m_components = new WeakHashMap();
+ //private final Map m_components = new WeakHashMap();
+ private final Map m_components = new Hashtable();
/**
* Creation of a new instance table.
@@ -61,7 +63,8 @@
}
synchronized( m_components )
{
- ComponentEntry[] components = (ComponentEntry[])
m_components.keySet().toArray( new ComponentEntry[0] );
+ ComponentEntry[] components =
+ (ComponentEntry[]) m_components.keySet().toArray( new
ComponentEntry[0] );
for( int i=0; i<components.length; i++ )
{
ComponentEntry component = components[i];
Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/unit/CompositionHelper.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/unit/CompositionHelper.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/unit/CompositionHelper.java
Wed Jun 22 02:03:03 2005
@@ -100,10 +100,9 @@
Preferences prefs = profiles.node( "unit" );
Logger logger = new LoggingAdapter( "metro" );
- Date creation = new Date();
boolean policy = false;
- ControllerStorageUnit home = new ControllerStorageUnit ( prefs,
logger, creation, policy );
+ ControllerStorageUnit home = new ControllerStorageUnit ( prefs,
logger, policy );
DefaultControllerModel context = (DefaultControllerModel)
home.getContentModel();
context.setWorkingDirectory( base );
m_context = context;
Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/unit/ControllerStorageUnit.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/unit/ControllerStorageUnit.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/unit/ControllerStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -61,9 +61,9 @@
* values may be resolved
*/
public ControllerStorageUnit(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
m_model = createContentModel();
}
@@ -75,7 +75,6 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
URI uri = getCodeBaseURI();
String type = getType();
String title = getTitle();
@@ -84,7 +83,7 @@
try
{
return new DefaultControllerModel(
- logger, creation, this, uri, type, title, work, temp );
+ logger, this, uri, type, title, work, temp );
}
catch( RemoteException e )
{
Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/unit/DefaultControllerModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/unit/DefaultControllerModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/unit/DefaultControllerModel.java
Wed Jun 22 02:03:03 2005
@@ -75,10 +75,10 @@
//----------------------------------------------------------------------------
public DefaultControllerModel(
- Logger logger, Date creation, ContentHome home,
+ Logger logger, ContentHome home,
URI uri, String type, String title, String work, String temp ) throws
RemoteException
{
- super( logger, creation, home, uri, type, title );
+ super( logger, home, uri, type, title, new Properties() );
m_work = getWorkingDirectory( work );
m_temp = getTempDirectory( temp );
}
Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Wed Jun 22 02:03:03 2005
@@ -156,35 +156,6 @@
</dependencies>
</project>
- <project basedir="composition/part">
- <info>
- <group>dpml/metro</group>
- <name>dpml-composition-part</name>
- <types>
- <type>jar</type>
- <type>plugin</type>
- </types>
- </info>
- <dependencies>
- <include key="dpml-composition-control"/>
- </dependencies>
- </project>
-
- <project basedir="composition/content">
- <info>
- <group>dpml/metro</group>
- <name>dpml-composition-content</name>
- <types>
- <type>jar</type>
- <type>plugin</type>
- </types>
- </info>
- <dependencies>
- <include key="dpml-composition-part" build="false"/>
- <include key="dpml-transit-main" tag="api"/>
- </dependencies>
- </project>
-
<project basedir="main">
<info>
<group>dpml/metro</group>
@@ -199,7 +170,6 @@
</dependencies>
</project>
-
<!-- EXTERNAL RESOURCES -->
<resource>
Modified: development/main/metro/main/build.xml
==============================================================================
--- development/main/metro/main/build.xml (original)
+++ development/main/metro/main/build.xml Wed Jun 22 02:03:03 2005
@@ -5,8 +5,21 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>
+ <target name="init" depends="standard.init">
+ <x:filter feature="name" token="NAME"/>
+ <x:filter feature="version" token="VERSION"/>
+ <x:filter feature="group" token="GROUP"/>
+ </target>
+
+ <target name="build" depends="standard.build">
+ <x:path id="build.path"/>
+ <rmic base="${basedir}/target/classes" classpathref="build.path">
+ <include name="**/DefaultMetroModel.class"/>
+ </rmic>
+ </target>
+
<target name="package" depends="standard.package">
- <x:export class="net.dpml.metro.Metro"/>
+ <x:export class="net.dpml.metro.part.PartContentHandler"/>
</target>
</project>
Added:
development/main/metro/main/src/main/net/dpml/metro/model/DefaultMetroModel.java
==============================================================================
--- (empty file)
+++
development/main/metro/main/src/main/net/dpml/metro/model/DefaultMetroModel.java
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 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.metro.model;
+
+import java.io.File;
+import java.net.URI;
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Map;
+import java.util.EventObject;
+import java.util.EventListener;
+import java.util.WeakHashMap;
+import java.util.Properties;
+import java.util.prefs.Preferences;
+import java.util.prefs.PreferenceChangeListener;
+import java.util.prefs.PreferenceChangeEvent;
+
+import net.dpml.part.control.ControllerContext;
+import net.dpml.part.control.ControllerContextListener;
+import net.dpml.part.control.ControllerContextEvent;
+
+import net.dpml.transit.home.ContentHome;
+import net.dpml.transit.model.DefaultModel;
+import net.dpml.transit.model.ContentModel;
+import net.dpml.transit.model.DefaultContentModel;
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.util.PropertyResolver;
+
+/**
+ * The ControllerContext is a management service supplied to a controller
instance. It
+ * provides support for operations though which the context state may be
updated and
+ * a provision for default values based on underlying preferences.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class DefaultMetroModel extends DefaultModel implements
ControllerContext
+{
+
//----------------------------------------------------------------------------
+ // state
+
//----------------------------------------------------------------------------
+
+ /**
+ * Working directory.
+ */
+ private File m_work;
+
+ /**
+ * Temp directory.
+ */
+ private File m_temp;
+
+ private final ContentModel m_model;
+
+
//----------------------------------------------------------------------------
+ // constructor
+
//----------------------------------------------------------------------------
+
+ public DefaultMetroModel( ContentModel model ) throws RemoteException
+ {
+ super( "metro" );
+
+ m_model = model;
+
+ // TODO: add listeners to chnages to the content model properties
+
+ String work = model.getProperty( "work.dir", "${dpml.data}/work" );
+ String temp = model.getProperty( "temp.dir", "${java.io.tmpdir}" );
+
+ m_work = getWorkingDirectory( work );
+ m_temp = getTempDirectory( temp );
+ }
+
+
//----------------------------------------------------------------------------
+ // ControllerContext
+
//----------------------------------------------------------------------------
+
+ /**
+ * Return any command line arguments.
+ * @return the possibly empty set of command line arguments.
+ */
+ public String[] getArgs() throws RemoteException
+ {
+ return new String[0];
+ }
+
+ /**
+ * Return the context uri.
+ *
+ * @return the uri for this context.
+ */
+ public URI getURI() throws RemoteException
+ {
+ return CONTEXT_URI;
+ }
+
+ /**
+ * Return the root working directory.
+ *
+ * @return directory representing the root of the working directory
hierachy
+ */
+ public File getWorkingDirectory() throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ return m_work;
+ }
+ }
+
+ /**
+ * Set the root working directory.
+ *
+ * @param dir the root of the working directory hierachy
+ */
+ public void setWorkingDirectory( File dir ) throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ m_work = dir;
+ }
+ }
+
+ /**
+ * Return the root temporary directory.
+ *
+ * @return directory representing the root of the temporary directory
hierachy.
+ */
+ public File getTempDirectory() throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ return m_temp;
+ }
+ }
+
+ /**
+ * Add the supplied controller context listener to the controller
context. A
+ * controller implementation should not maintain strong references to
supplied
+ * listeners.
+ *
+ * @param listener the controller context listener to add
+ */
+ public void addControllerContextlistener( ControllerContextListener
listener )
+ throws RemoteException
+ {
+ addListener( listener );
+ }
+
+ /**
+ * Remove the supplied controller context listener from the controller
context.
+ *
+ * @param listener the controller context listener to remove
+ */
+ public void removeControllerContextlistener( ControllerContextListener
listener )
+ throws RemoteException
+ {
+ removeListener( listener );
+ }
+
+
//----------------------------------------------------------------------------
+ // private
+
//----------------------------------------------------------------------------
+
+ protected void processEvent( EventObject event )
+ {
+ if( event instanceof WorkingDirectoryChangeEvent )
+ {
+ processWorkingDirectoryChangeEvent(
(WorkingDirectoryChangeEvent) event );
+ }
+ else if( event instanceof TempDirectoryChangeEvent )
+ {
+ processTempDirectoryChangeEvent( (TempDirectoryChangeEvent)
event );
+ }
+ else
+ {
+ super.processEvent( event );
+ }
+ }
+
+ public void processWorkingDirectoryChangeEvent(
WorkingDirectoryChangeEvent event )
+ {
+ EventListener[] listeners = super.listeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ EventListener eventListener = listeners[i];
+ if( eventListener instanceof ControllerContextListener )
+ {
+ ControllerContextListener listener =
(ControllerContextListener) eventListener;
+ try
+ {
+ listener.workingDirectoryChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "ControllerContextListener working dir change
notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ }
+ }
+
+ public void processTempDirectoryChangeEvent( TempDirectoryChangeEvent
event )
+ {
+ EventListener[] listeners = super.listeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ EventListener eventListener = listeners[i];
+ if( eventListener instanceof ControllerContextListener )
+ {
+ ControllerContextListener listener =
(ControllerContextListener) eventListener;
+ try
+ {
+ listener.tempDirectoryChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "ControllerContextListener temp dir change
notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ }
+ }
+
+ private File getWorkingDirectory( String value )
+ {
+ Properties properties = System.getProperties();
+ String path = PropertyResolver.resolve( properties, value );
+ return new File( path );
+ }
+
+ private File getTempDirectory( String value )
+ {
+ Properties properties = System.getProperties();
+ String path = PropertyResolver.resolve( properties, value );
+ return new File( path );
+ }
+
+
//----------------------------------------------------------------------------
+ // static (private)
+
//----------------------------------------------------------------------------
+
+ private static URI CONTEXT_URI = setupContextURI();
+
+ private static URI setupContextURI()
+ {
+ try
+ {
+ return new URI( "metro:local" );
+ }
+ catch( Throwable e )
+ {
+ return null;
+ }
+ }
+
+ static class WorkingDirectoryChangeEvent extends ControllerContextEvent
+ {
+ public WorkingDirectoryChangeEvent(
+ DefaultMetroModel source, File oldDir, File newDir )
+ {
+ super( source, oldDir, newDir );
+ }
+ }
+
+ static class TempDirectoryChangeEvent extends ControllerContextEvent
+ {
+ public TempDirectoryChangeEvent(
+ DefaultMetroModel source, File oldDir, File newDir )
+ {
+ super( source, oldDir, newDir );
+ }
+ }
+}
Added:
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java
==============================================================================
--- (empty file)
+++
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,134 @@
+/*
+ * 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.metro.model;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.prefs.Preferences;
+import java.util.Date;
+
+import net.dpml.composition.control.CompositionManager;
+
+import net.dpml.part.control.ControllerContext;
+
+import net.dpml.transit.adapter.LoggingAdapter;
+import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.StandardLoader;
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.ContentModel;
+
+/**
+ * A utility class used for the deployment of components in embedded
scenarios
+ * includuing but not limited to test-cases.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ */
+public class MetroHelper
+{
+
+ //------------------------------------------------------------------
+ // state
+ //------------------------------------------------------------------
+
+ private ControllerContext m_context;
+ private CompositionManager m_manager;
+
+ //------------------------------------------------------------------
+ // constructor
+ //------------------------------------------------------------------
+
+ public MetroHelper( ContentModel model ) throws Exception
+ {
+ if( null == model )
+ {
+ throw new NullPointerException( "model" );
+ }
+
+ m_context = new DefaultMetroModel( model );
+ m_manager = new CompositionManager( m_context );
+ }
+
+ //------------------------------------------------------------------
+ // internal
+ //------------------------------------------------------------------
+
+ public CompositionManager getCompositionManager()
+ {
+ return m_manager;
+ }
+
+ public URI toURI( String path )
+ {
+ try
+ {
+ File base = m_context.getWorkingDirectory();
+ File target = new File( base, path );
+ return target.toURI();
+ }
+ catch( Throwable e )
+ {
+ return null;
+ }
+ }
+
+ public void dispose()
+ {
+ getCompositionManager().dispose();
+ System.gc();
+ }
+
+ private static URI createStaticURI( String path )
+ {
+ try
+ {
+ return new URI( path );
+ }
+ catch( Throwable e )
+ {
+ return null;
+ }
+ }
+
+ //------------------------------------------------------------------
+ // static
+ //------------------------------------------------------------------
+
+ public static File getTestWorkingDir()
+ {
+ String dir = System.getProperty( "project.test.dir" );
+ if( null == dir )
+ {
+ final String error =
+ "System property 'project.test.dir' is undefined.";
+ throw new IllegalStateException( error );
+ }
+
+ try
+ {
+ return new File( dir ).getCanonicalFile();
+ }
+ catch( IOException e )
+ {
+ return new File( dir );
+ }
+ }
+}
Added:
development/main/metro/main/src/main/net/dpml/metro/part/IconHelper.java
==============================================================================
--- (empty file)
+++ development/main/metro/main/src/main/net/dpml/metro/part/IconHelper.java
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,53 @@
+/*
+ * 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.metro.part;
+
+import java.net.URL;
+
+import javax.swing.JLabel;
+import javax.swing.ImageIcon;
+
+/**
+ */
+public class IconHelper
+{
+ public static JLabel createImageIconJLabel( ClassLoader classloader,
String path, String description, String text )
+ {
+ ImageIcon icon = createImageIcon( classloader, path, description );
+ JLabel label = new JLabel( text, icon, JLabel.LEFT );
+ return label;
+ }
+
+ public static ImageIcon createImageIcon( ClassLoader classloader, String
path, String description )
+ {
+ URL url = classloader.getResource( path );
+ if( null != url )
+ {
+ return new ImageIcon( url );
+ }
+ else
+ {
+ final String error =
+ "Supplied image icon resource path is unknown ["
+ + path
+ + "].";
+ throw new IllegalArgumentException( error );
+ }
+ }
+}
Added:
development/main/metro/main/src/main/net/dpml/metro/part/PartContentHandler.java
==============================================================================
--- (empty file)
+++
development/main/metro/main/src/main/net/dpml/metro/part/PartContentHandler.java
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,218 @@
+/*
+ * 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.metro.part;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLConnection;
+import java.net.ContentHandler;
+import java.net.UnknownServiceException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.Hashtable;
+import java.util.Map;
+
+import net.dpml.composition.control.CompositionManager;
+
+import net.dpml.transit.repository.Repository;
+
+import net.dpml.part.control.ControlException;
+import net.dpml.part.control.ControlRuntimeException;
+import net.dpml.part.control.ControllerContext;
+
+import net.dpml.part.part.Part;
+import net.dpml.part.model.Model;
+import net.dpml.part.model.Provider;
+import net.dpml.part.model.Component;
+
+import net.dpml.transit.Transit;
+import net.dpml.transit.model.ContentModel;
+
+import net.dpml.metro.model.DefaultMetroModel;
+
+/**
+ * A utility class used for the deployment of components in embedded
scenarios
+ * includuing but not limited to test-cases.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ */
+public class PartContentHandler extends ContentHandler
+{
+ //------------------------------------------------------------------
+ // state
+ //------------------------------------------------------------------
+
+ private CompositionManager m_manager;
+
+ //------------------------------------------------------------------
+ // constructor
+ //------------------------------------------------------------------
+
+ public PartContentHandler( ContentModel model ) throws Exception
+ {
+ if( null == model )
+ {
+ throw new NullPointerException( "model" );
+ }
+
+ ControllerContext context = new DefaultMetroModel( model );
+ m_manager = new CompositionManager( context );
+ }
+
+ //------------------------------------------------------------------
+ // ContentHandler
+ //------------------------------------------------------------------
+
+ public Object getContent( URLConnection connection )
+ {
+ return getContent( connection, new Class[0] );
+ }
+
+ public Object getContent( URLConnection connection, Class[] classes )
+ {
+ URL url = connection.getURL();
+ if( classes.length == 0 )
+ {
+ return getPart( url );
+ }
+ else
+ {
+ for( int i=0; i<classes.length; i++ )
+ {
+ Class c = classes[i];
+ if( Part.class.isAssignableFrom( c ) )
+ {
+ return getPart( url );
+ }
+ else if( Model.class.isAssignableFrom( c ) )
+ {
+ return getModel( url );
+ }
+ else if( Provider.class.isAssignableFrom( c ) )
+ {
+ try
+ {
+ Model model = getModel( url );
+ return model.getProvider();
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unable to load provider: " + url;
+ throw new RuntimeException( error, e );
+ }
+
+ }
+ else if( Remote.class.isAssignableFrom( c ) )
+ {
+ return getModel( url );
+ }
+ else if( Object.class.equals( c ) )
+ {
+ Model model = getModel( url );
+ try
+ {
+ return model.getProvider().resolve( false );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unable to load part: " + url;
+ throw new RuntimeException( error, e );
+ }
+ }
+ else
+ {
+ final String error =
+ "Unsupported class argument: " + c.getName();
+ throw new RuntimeException( error );
+ }
+ }
+ return null;
+ }
+ }
+
+ private Part getPart( URL url )
+ {
+ try
+ {
+ String path = url.toExternalForm();
+ URI uri = new URI( path );
+ return (Part) m_manager.loadPart( uri );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Error occured while attempting to load part: " + url;
+ throw new RuntimeException( error, e );
+ }
+ }
+
+ private Model getModel( URL url )
+ {
+ try
+ {
+ String path = url.toExternalForm();
+ URI uri = new URI( path );
+ return m_manager.getModel( uri );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Error occured while attempting to load part: " + url;
+ throw new RuntimeException( error, e );
+ }
+ }
+
+ //------------------------------------------------------------------
+ // internal
+ //------------------------------------------------------------------
+
+ public CompositionManager getCompositionManager()
+ {
+ return m_manager;
+ }
+
+ public void dispose()
+ {
+ try
+ {
+ getCompositionManager().dispose();
+ }
+ catch( Throwable e )
+ {
+ }
+ finally
+ {
+ System.gc();
+ }
+ }
+
+ //------------------------------------------------------------------
+ // static utils
+ //------------------------------------------------------------------
+
+ static
+ {
+ System.setProperty( "java.util.logging.config.class",
"net.dpml.depot.logging.ConfigurationHandler" );
+ }
+}
Added:
development/main/metro/main/src/main/net/dpml/metro/part/PartContentHandlerControlPanel.java
==============================================================================
--- (empty file)
+++
development/main/metro/main/src/main/net/dpml/metro/part/PartContentHandlerControlPanel.java
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,369 @@
+/*
+ * Copyright 2005 Stephen 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.metro.part;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import javax.swing.JDialog;
+import javax.swing.border.EmptyBorder;
+import javax.swing.JPanel;
+import javax.swing.Action;
+import javax.swing.AbstractAction;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+import javax.swing.JButton;
+import javax.swing.BoxLayout;
+import javax.swing.Box;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.ImageIcon;
+import javax.swing.JTextField;
+
+/**
+ * A registry of descriptions of plugable content handlers. This
implementation
+ * maps user defined preferences to instance of ContentHandlerDescriptor.
+ */
+public class PartContentHandlerControlPanel extends JDialog implements
PropertyChangeListener
+{
+ private static String METRO_ICON_FILENAME =
"net/dpml/metro/part/images/setup.png";
+
+ private static String SOURCE_ICON_FILENAME =
"net/dpml/metro/part/images/source.png";
+
+ private static String WORK_ICON_FILENAME =
"net/dpml/metro/part/images/working.png";
+
+ private static String TEMP_ICON_FILENAME =
"net/dpml/metro/part/images/temp.png";
+
+ private static String PLUGIN_VERSION = "@VERSION@";
+
+ private static String PLUGIN_GROUP = "@GROUP@";
+
+ private static String PLUGIN_NAME = "@NAME@";
+
+ private PropertyChangeSupport m_propertyChangeSupport;
+
+
+ public PartContentHandlerControlPanel( Dialog parent )
+ {
+ super( parent );
+
+ m_propertyChangeSupport = new PropertyChangeSupport( this );
+
+ setTitle( "Metro FT Content Controller" );
+ setModal( true );
+ setBackground( Color.white );
+
+ // create the header label
+
+ JLabel header = createHeaderLabel();
+
+ // create the body content
+
+ JPanel body = createBodyContent( this );
+ body.setBorder( new EmptyBorder( 0, 7, 7, 7 ) );
+
+ // create the buttons in the footer
+
+ ButtonPanel buttons = new ButtonPanel( this );
+ buttons.setBorder( new EmptyBorder( 0, 7, 7, 7 ) );
+
+ //
+ // package
+ //
+
+ JPanel assembly = new JPanel( new BorderLayout() );
+ assembly.setBackground( Color.white );
+ assembly.add( header, BorderLayout.NORTH );
+ assembly.add( body, BorderLayout.CENTER );
+ assembly.add( buttons, BorderLayout.SOUTH );
+ setContentPane( assembly );
+
+ setSize( new Dimension( 400, 360 ) );
+ getRootPane().setDefaultButton( buttons.getDefaultButton() );
+
+ m_propertyChangeSupport.addPropertyChangeListener( this );
+
+ }
+
+ //--------------------------------------------------------------
+ // PropertyChangeListener
+ //--------------------------------------------------------------
+
+ /**
+ * The actions dealing with changes to the dialog raise change events
that
+ * are captured here. This listener checks changes and enables or
disabled
+ * the ok and undo buttons based on the state of controls relative to the
+ * underlying preferences for this host.
+ */
+ public void propertyChange( PropertyChangeEvent event )
+ {
+ // TODO
+ }
+
+ private JLabel createHeaderLabel()
+ {
+ JLabel label =
+ IconHelper.createImageIconJLabel(
+ getClass().getClassLoader(), METRO_ICON_FILENAME, "", "Metro
(FT) Content Handler" );
+ label.setBorder( new EmptyBorder( 15, 10, 10, 10 ) );
+ return label;
+ }
+
+ private JPanel createBodyContent( JDialog parent )
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ JPanel stack = createStack();
+ panel.add( stack, BorderLayout.NORTH );
+ return panel;
+ }
+
+ private JPanel createStack()
+ {
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JPanel spec = createPluginSpecPanel();
+ JPanel dirs = createDirectoryPanel();
+ stack.add( spec );
+ stack.add( dirs );
+ return stack;
+ }
+
+ private JPanel createPluginSpecPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder(
+ new CompoundBorder(
+ new TitledBorder(
+ null, "Plugin", TitledBorder.LEFT, TitledBorder.TOP),
+ new EmptyBorder( 5, 5, 5, 10)
+ )
+ );
+
+ /*
+ ImageIcon label =
+ IconHelper.createImageIcon(
+ getClass().getClassLoader(), SOURCE_ICON_FILENAME, "Plugin" );
+ JPanel labelHolder = new JPanel( new BorderLayout() );
+ labelHolder.setBackground( Color.white );
+ labelHolder.setBorder( new EmptyBorder( 3, 0, 0, 10 ) );
+ labelHolder.add( new JLabel( label ), BorderLayout.NORTH );
+ panel.add( labelHolder, BorderLayout.WEST );
+ */
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel group = new JLabel( "Group: " + PLUGIN_GROUP );
+ JLabel name = new JLabel( "Name: " + PLUGIN_NAME );
+ JLabel version = new JLabel( "Version: " + PLUGIN_VERSION );
+ stack.add( group );
+ stack.add( name );
+ stack.add( version );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private JPanel createDirectoryPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder(
+ new CompoundBorder(
+ new TitledBorder(
+ null, "Directories", TitledBorder.LEFT, TitledBorder.TOP),
+ new EmptyBorder( 5, 5, 5, 10)
+ )
+ );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ JPanel working = createWorkingDirectoryPanel();
+ JPanel temp = createTempDirectoryPanel();
+ stack.add( working );
+ stack.add( temp );
+ panel.add( stack, BorderLayout.NORTH );
+ return panel;
+ }
+
+ private JPanel createWorkingDirectoryPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+
+ ImageIcon label =
+ IconHelper.createImageIcon(
+ getClass().getClassLoader(), WORK_ICON_FILENAME, "Working
Directory" );
+ JPanel labelHolder = new JPanel( new BorderLayout() );
+ labelHolder.setBackground( Color.white );
+ labelHolder.setBorder( new EmptyBorder( 3, 0, 0, 10 ) );
+ labelHolder.add( new JLabel( label ), BorderLayout.SOUTH );
+ panel.add( labelHolder, BorderLayout.WEST );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel dirLabel = new JLabel( "Working Directory:" );
+ JPanel dirLabelHolder = new JPanel( new BorderLayout() );
+ dirLabelHolder.add( dirLabel, BorderLayout.WEST );
+ dirLabelHolder.setBackground( Color.white );
+ dirLabelHolder.setBorder( new EmptyBorder( 0, 0, 3, 0 ) );
+ JTextField dirValue = new JTextField( "${user.dir}" );
+ stack.add( dirLabelHolder );
+ stack.add( dirValue );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private JPanel createTempDirectoryPanel()
+ {
+ JPanel panel = new JPanel( new BorderLayout() );
+ panel.setBackground( Color.white );
+ panel.setBorder( new EmptyBorder( 10, 0, 5, 0 ) );
+
+ ImageIcon label =
+ IconHelper.createImageIcon(
+ getClass().getClassLoader(), TEMP_ICON_FILENAME, "Temp
Directory" );
+ JPanel labelHolder = new JPanel( new BorderLayout() );
+ labelHolder.setBackground( Color.white );
+ labelHolder.setBorder( new EmptyBorder( 3, 0, 0, 10 ) );
+ labelHolder.add( new JLabel( label ), BorderLayout.SOUTH );
+ panel.add( labelHolder, BorderLayout.WEST );
+
+ JPanel stack = new JPanel();
+ stack.setLayout( new BoxLayout( stack, BoxLayout.Y_AXIS ) );
+ stack.setBackground( Color.white );
+ JLabel dirLabel = new JLabel( "Temporary Directory:" );
+ JPanel dirLabelHolder = new JPanel( new BorderLayout() );
+ dirLabelHolder.add( dirLabel, BorderLayout.WEST );
+ dirLabelHolder.setBackground( Color.white );
+ dirLabelHolder.setBorder( new EmptyBorder( 0, 0, 3, 0 ) );
+ JTextField dirValue = new JTextField( "${java.temp.dir}" );
+ stack.add( dirLabelHolder );
+ stack.add( dirValue );
+
+ JPanel holder = new JPanel( new BorderLayout() );
+ holder.add( stack, BorderLayout.NORTH );
+ panel.add( holder );
+ return panel;
+ }
+
+ private class ButtonPanel extends Box
+ {
+ private JButton m_close = new JButton();
+ private JButton m_ok = new JButton();
+ private JButton m_revert = new JButton( new RevertAction( "Undo" ) );
+
+ ButtonPanel( PartContentHandlerControlPanel dialog )
+ {
+ super( BoxLayout.Y_AXIS );
+ setBackground( Color.white );
+
+ OKAction ok = new OKAction( "OK", dialog );
+ m_ok.setAction( ok );
+ Action closeAction = new CancelAction( "Close", dialog );
+ m_close.setAction( closeAction );
+
+ JPanel buttonPanel = new JPanel( new FlowLayout(
FlowLayout.RIGHT ) );
+ buttonPanel.setBackground( Color.white );
+ buttonPanel.add( m_revert );
+ buttonPanel.add( m_ok );
+ buttonPanel.add( m_close );
+ add( buttonPanel );
+ }
+
+ JButton getDefaultButton()
+ {
+ return m_close;
+ }
+ }
+
+ private class CancelAction extends AbstractAction
+ {
+ private PartContentHandlerControlPanel m_dialog;
+
+ public CancelAction( String label, PartContentHandlerControlPanel
dialog )
+ {
+ super( label );
+ m_dialog = dialog;
+ }
+
+ /**
+ * Called when the cancel button is trigged.
+ * @param event the action event
+ */
+ public void actionPerformed( ActionEvent event )
+ {
+ m_propertyChangeSupport.removePropertyChangeListener( m_dialog );
+ m_dialog.hide();
+ }
+ }
+
+ private class OKAction extends AbstractAction
+ {
+ private PartContentHandlerControlPanel m_dialog;
+
+ OKAction( String name, PartContentHandlerControlPanel dialog )
+ {
+ super( name );
+ setEnabled( false );
+ m_dialog = dialog;
+ }
+
+ // TODO: we need a solution in place under which we log
+ // information about preference changes
+
+ public void actionPerformed( ActionEvent event )
+ {
+ m_propertyChangeSupport.removePropertyChangeListener( m_dialog );
+ m_dialog.hide();
+ }
+ }
+
+ private class RevertAction extends AbstractAction
+ {
+ RevertAction( String name )
+ {
+ super( name );
+ setEnabled( false );
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ PropertyChangeEvent e =
+ new PropertyChangeEvent(
+ this, "revert", null, null );
+ m_propertyChangeSupport.firePropertyChange( e );
+ }
+ }
+}
Added:
development/main/metro/main/src/main/net/dpml/metro/part/images/setup.png
==============================================================================
Binary file. No diff available.
Added:
development/main/metro/main/src/main/net/dpml/metro/part/images/source.png
==============================================================================
Binary file. No diff available.
Added:
development/main/metro/main/src/main/net/dpml/metro/part/images/temp.png
==============================================================================
Binary file. No diff available.
Added:
development/main/metro/main/src/main/net/dpml/metro/part/images/working.png
==============================================================================
Binary file. No diff available.
Added: development/main/metro/main/src/main/net/dpml/metro/part/package.html
==============================================================================
--- (empty file)
+++ development/main/metro/main/src/main/net/dpml/metro/part/package.html
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,9 @@
+
+<body>
+<p>
+The 'part' package contains a ContentHandler that supports the "part"
content type. The
+implementation establishes a anonomouse controller context using preferences
as the source
+for container configuration.
+</p>
+
+</body>
Copied: development/main/test/plugins/content/build.xml (from r2897,
development/main/metro/composition/content/build.xml)
==============================================================================
--- development/main/metro/composition/content/build.xml (original)
+++ development/main/test/plugins/content/build.xml Wed Jun 22 02:03:03
2005
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<project name="dpml-composition-content" default="install" basedir="."
+<project name="dpml-test-content" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core">
<transit:import uri="artifact:template:dpml/magic/standard"/>
<target name="init" depends="standard.init">
- <x:property key="dpml-composition-part" feature="uri" type="plugin"
name="part.plugin"/>
+ <x:property key="dpml-metro-main" feature="uri" type="plugin"
name="part.plugin"/>
<filter token="COMPOSITION-CONTENT-PART-HANDLER-PLUGIN-URI"
value="${part.plugin}"/>
</target>
Modified:
development/main/test/plugins/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java
==============================================================================
---
development/main/metro/composition/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java
(original)
+++
development/main/test/plugins/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java
Wed Jun 22 02:03:03 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package net.dpml.composition.content;
+package net.dpml.test.content;
import java.io.IOException;
import java.net.URI;
Modified: development/main/test/plugins/index.xml
==============================================================================
--- development/main/test/plugins/index.xml (original)
+++ development/main/test/plugins/index.xml Wed Jun 22 02:03:03 2005
@@ -19,4 +19,19 @@
</dependencies>
</project>
+ <project basedir="content">
+ <info>
+ <group>dpml/test</group>
+ <name>dpml-test-content</name>
+ <types>
+ <type>jar</type>
+ <type>plugin</type>
+ </types>
+ </info>
+ <dependencies>
+ <include key="dpml-metro-main" build="false"/>
+ <include key="dpml-transit-main" tag="api"/>
+ </dependencies>
+ </project>
+
</index>
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentHome.java
Wed Jun 22 02:03:03 2005
@@ -30,4 +30,8 @@
ContentModel getContentModel();
void setTitle( String title );
+
+ void setProperty( String key, String value );
+
+ void removeProperty( String key );
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentListener.java
Wed Jun 22 02:03:03 2005
@@ -34,4 +34,11 @@
* @param event the content plugin change event
*/
void titleChanged( ContentEvent event ) throws RemoteException;
+
+ /**
+ * Notify a regstry listener of a change to a property of the content
model.
+ * @param event the content property change event
+ */
+ void propertyChanged( PropertyChangeEvent event ) throws RemoteException;
+
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentModel.java
Wed Jun 22 02:03:03 2005
@@ -46,6 +46,14 @@
*/
void setTitle( String title ) throws RemoteException;
+ String getProperty( String key ) throws RemoteException;
+
+ String getProperty( String key, String value ) throws RemoteException;
+
+ void setProperty( String key, String value ) throws RemoteException;
+
+ void removeProperty( String key ) throws RemoteException;
+
/**
* Add a content listener to the director.
* @param listener the listener to add
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
Wed Jun 22 02:03:03 2005
@@ -77,11 +77,11 @@
//
------------------------------------------------------------------------
public DefaultCacheModel(
- Logger logger, Date creation, CacheHome home,
+ Logger logger, CacheHome home,
URI uri, File cache, HostModel[] hosts, LayoutModel layout,
LayoutRegistryModel registry )
throws DuplicateKeyException, RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
if( null == cache )
{
throw new NullPointerException( "cache" );
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
Wed Jun 22 02:03:03 2005
@@ -53,10 +53,10 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultCodeBaseModel( Logger logger, Date creation, CodeBaseHome
home, URI uri )
+ public DefaultCodeBaseModel( Logger logger, CodeBaseHome home, URI uri )
throws RemoteException
{
- super( logger, creation );
+ super( logger );
m_uri = uri;
m_home = home;
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
Wed Jun 22 02:03:03 2005
@@ -23,6 +23,7 @@
import java.util.EventObject;
import java.util.EventListener;
import java.util.Date;
+import java.util.Properties;
import net.dpml.transit.home.ContentHome;
import net.dpml.transit.home.Removable;
@@ -41,6 +42,7 @@
private final ContentHome m_home;
private final String m_type;
+ private final Properties m_properties;
private String m_title;
@@ -49,13 +51,14 @@
//----------------------------------------------------------------------
public DefaultContentModel(
- Logger logger, Date creation, ContentHome home,
- URI uri, String type, String title ) throws RemoteException
+ Logger logger, ContentHome home,
+ URI uri, String type, String title, Properties properties ) throws
RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
m_type = type;
m_title = title;
m_home = home;
+ m_properties = properties;
}
//----------------------------------------------------------------------
@@ -80,6 +83,60 @@
return m_title;
}
+ public void setTitle( String title ) throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ m_title = title;
+
+ if( m_home.isMutable() )
+ {
+ m_home.setTitle( title );
+ }
+
+ ContentEvent event = new ContentEvent( this );
+ super.enqueueEvent( event );
+ }
+ }
+
+ public String getProperty( String key )
+ {
+ return m_properties.getProperty( key );
+ }
+
+ public String getProperty( String key, String value )
+ {
+ return m_properties.getProperty( key, value );
+ }
+
+ public void setProperty( String key, String value )
+ {
+ synchronized( m_lock )
+ {
+ Object result = m_properties.setProperty( key, value );
+ if( m_home.isMutable() )
+ {
+ m_home.setProperty( key, value );
+ }
+ PropertyChangeEvent event = new PropertyChangeEvent( this, key,
value );
+ super.enqueueEvent( event );
+ }
+ }
+
+ public void removeProperty( String key )
+ {
+ synchronized( m_lock )
+ {
+ Object result = m_properties.remove( key );
+ if( m_home.isMutable() )
+ {
+ m_home.removeProperty( key );
+ }
+ PropertyChangeEvent event = new PropertyChangeEvent( this, key,
null );
+ super.enqueueEvent( event );
+ }
+ }
+
/**
* Add a content listener to the director.
* @param listener the listener to add
@@ -98,22 +155,6 @@
super.removeListener( listener );
}
- public void setTitle( String title ) throws RemoteException
- {
- synchronized( m_lock )
- {
- m_title = title;
-
- if( m_home.isMutable() )
- {
- m_home .setTitle( title );
- }
-
- ContentEvent event = new ContentEvent( this );
- super.enqueueEvent( event );
- }
- }
-
//----------------------------------------------------------------------
// Disposable
//----------------------------------------------------------------------
@@ -134,7 +175,11 @@
protected void processEvent( EventObject event )
{
- if( event instanceof ContentEvent )
+ if( event instanceof PropertyChangeEvent )
+ {
+ processPropertyChangeEvent( (PropertyChangeEvent) event );
+ }
+ else if( event instanceof ContentEvent )
{
processContentEvent( (ContentEvent) event );
}
@@ -152,7 +197,7 @@
EventListener eventListener = listeners[i];
if( eventListener instanceof ContentListener )
{
- ContentListener listener = (ContentListener ) eventListener;
+ ContentListener listener = (ContentListener) eventListener;
try
{
listener.titleChanged( event );
@@ -166,5 +211,28 @@
}
}
}
+
+ public void processPropertyChangeEvent( PropertyChangeEvent event )
+ {
+ EventListener[] listeners = super.listeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ EventListener eventListener = listeners[i];
+ if( eventListener instanceof ContentListener )
+ {
+ ContentListener listener = (ContentListener) eventListener;
+ try
+ {
+ listener.propertyChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "ContentListener property change notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ }
+ }
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
Wed Jun 22 02:03:03 2005
@@ -54,10 +54,10 @@
//
------------------------------------------------------------------------
public DefaultContentRegistryModel(
- Logger logger, Date creation, ContentRegistryHome home, URI uri,
ContentModel[] models )
+ Logger logger, ContentRegistryHome home, URI uri, ContentModel[]
models )
throws DuplicateKeyException, RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
m_home = home;
for( int i=0; i<models.length; i++ )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
Wed Jun 22 02:03:03 2005
@@ -69,13 +69,13 @@
//
------------------------------------------------------------------------
public DefaultHostModel(
- Logger logger, Date creation, HostHome home,
+ Logger logger, HostHome home,
String id, Strategy strategy, URL base, URL index,
String name, boolean trusted, boolean enabled, int priority,
LayoutModel layout,
PasswordAuthentication auth, String scheme, String prompt )
throws RemoteException
{
- super( logger, creation, home, null );
+ super( logger, home, null );
m_home = home;
m_id = id;
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
Wed Jun 22 02:03:03 2005
@@ -52,11 +52,11 @@
//----------------------------------------------------------------------
public DefaultLayoutModel(
- final Logger logger, Date creation, final LayoutHome home,
+ final Logger logger, final LayoutHome home,
final String id, Strategy strategy, final String title )
throws RemoteException
{
- super( logger, creation, home, null );
+ super( logger, home, null );
m_id = id;
m_title = title;
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
Wed Jun 22 02:03:03 2005
@@ -57,10 +57,10 @@
//
------------------------------------------------------------------------
public DefaultLayoutRegistryModel(
- Logger logger, Date creation, LayoutRegistryHome home, URI uri,
LayoutModel[] managers )
+ Logger logger, LayoutRegistryHome home, URI uri, LayoutModel[]
managers )
throws DuplicateKeyException, RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
m_home = home;
for( int i=0; i<managers.length; i++ )
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
Wed Jun 22 02:03:03 2005
@@ -22,7 +22,6 @@
import java.net.URI;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
-import java.util.Date;
import java.util.EventObject;
import java.util.EventListener;
import java.util.List;
@@ -30,6 +29,7 @@
import java.util.Map;
import java.util.WeakHashMap;
+import net.dpml.transit.adapter.LoggingAdapter;
import net.dpml.transit.home.Home;
/**
@@ -54,21 +54,17 @@
*/
protected final Object m_lock = new Object();
- /**
- * Last modification date.
- */
- protected Date m_creation = new Date();
-
- /**
- * Last modification date.
- */
- protected Date m_modification;
-
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
- public DefaultModel( Logger logger, Date creation )
+ public DefaultModel( String name )
+ throws NullPointerException, RemoteException
+ {
+ this( getLoggerForCategory( name ) );
+ }
+
+ public DefaultModel( Logger logger )
throws NullPointerException, RemoteException
{
super();
@@ -78,7 +74,6 @@
throw new NullPointerException( "logger" );
}
m_logger = logger;
- m_creation = creation;
}
//
------------------------------------------------------------------------
@@ -91,51 +86,6 @@
}
//
------------------------------------------------------------------------
- // Manager
- //
------------------------------------------------------------------------
-
- public Date getCreationDate()
- {
- synchronized( m_lock )
- {
- return m_creation;
- }
- }
-
- public void setCreationDate( Date date )
- {
- synchronized( m_lock )
- {
- m_creation = date;
- }
- }
-
- public Date getModificationDate()
- {
- synchronized( m_lock )
- {
- if( null == m_modification )
- {
- return m_creation;
- }
- else
- {
- return m_modification;
- }
- }
- }
-
- public boolean isModified()
- {
- synchronized( m_lock )
- {
- long modification = getModificationDate().getTime();
- long creation = getCreationDate().getTime();
- return modification > creation;
- }
- }
-
- //
------------------------------------------------------------------------
// DefaultModel
//
------------------------------------------------------------------------
@@ -432,4 +382,16 @@
return m_uri.hashCode();
}
}
+
+ static Logger getLoggerForCategory( String name )
+ {
+ if( null == name )
+ {
+ return new LoggingAdapter( "" );
+ }
+ else
+ {
+ return new LoggingAdapter( name );
+ }
+ }
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
Wed Jun 22 02:03:03 2005
@@ -55,11 +55,11 @@
//
------------------------------------------------------------------------
public DefaultProxyModel(
- Logger logger, Date creation, ProxyHome home,
+ Logger logger, ProxyHome home,
URL host, PasswordAuthentication auth, String[] excludes )
throws NullPointerException, RemoteException
{
- super( logger, creation );
+ super( logger );
m_host = host;
m_authentication = auth;
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
Wed Jun 22 02:03:03 2005
@@ -32,10 +32,10 @@
*/
public class DefaultRepositoryModel extends DisposableCodeBaseModel
implements RepositoryModel
{
- public DefaultRepositoryModel( Logger logger, Date creation,
RepositoryHome home, URI uri )
+ public DefaultRepositoryModel( Logger logger, RepositoryHome home, URI
uri )
throws RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
}
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
Wed Jun 22 02:03:03 2005
@@ -47,11 +47,11 @@
//
------------------------------------------------------------------------
public DefaultTransitModel(
- Logger logger, Date creation, TransitHome home, CacheModel cache,
+ Logger logger, TransitHome home, CacheModel cache,
ContentRegistryModel content, RepositoryModel repository,
ProxyModel proxy ) throws RemoteException
{
- super( logger, creation );
+ super( logger );
if( null == home )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
Wed Jun 22 02:03:03 2005
@@ -39,10 +39,10 @@
// constructor
//
------------------------------------------------------------------------
- public DisposableCodeBaseModel( Logger logger, Date creation,
CodeBaseHome home, URI uri )
+ public DisposableCodeBaseModel( Logger logger, CodeBaseHome home, URI
uri )
throws RemoteException
{
- super( logger, creation, home, uri );
+ super( logger, home, uri );
}
//----------------------------------------------------------------------
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/Model.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/Model.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/Model.java
Wed Jun 22 02:03:03 2005
@@ -26,18 +26,4 @@
*/
public interface Model extends Remote
{
- /**
- * Return the logging channel.
- * @return the logging channel.
- */
- //Logger getLogger();
-
- //Date getCreationDate();
-
- //Date getModificationDate();
-
- //void setCreationDate( Date date );
-
- //boolean isModified();
-
}
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/PropertyChangeEvent.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/PropertyChangeEvent.java
Wed Jun 22 02:03:03 2005
@@ -0,0 +1,60 @@
+/*
+ * 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.transit.model;
+
+/**
+ * A event pertaining to content model changes.
+ */
+public class PropertyChangeEvent extends ContentEvent
+{
+ private final String m_key;
+
+ private final String m_value;
+
+ /**
+ * Creation of a new ContentEvent signalling modification of
+ * content director configuration.
+ *
+ * @param content the content director that was added or removed
+ */
+ public PropertyChangeEvent( ContentModel content, String key, String
value )
+ {
+ super( content );
+ m_key = key;
+ m_value = value;
+ }
+
+ /**
+ * Return the key to the modified property.
+ * @return the property key
+ */
+ public String getKey()
+ {
+ return m_key;
+ }
+
+ /**
+ * Return the value of the modified property.
+ * @return the property value (possibly null)
+ */
+ public String getValue()
+ {
+ return m_value;
+ }
+}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -44,17 +44,15 @@
private Preferences m_prefs;
private boolean m_policy;
private Logger m_logger;
- private Date m_creation;
//
------------------------------------------------------------------------
// constructors
//
------------------------------------------------------------------------
- public AbstractStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
+ public AbstractStorageUnit( Preferences prefs, Logger logger, boolean
policy )
{
m_prefs = prefs;
m_policy = policy;
- m_creation = creation;
m_logger = logger;
}
@@ -82,11 +80,6 @@
return m_prefs;
}
- public Date getCreationDate()
- {
- return m_creation;
- }
-
public Logger getLogger()
{
return m_logger;
@@ -107,14 +100,6 @@
}
}
- protected void setModified()
- {
- checkAccess();
- Date modified = new Date();
- long time = modified.getTime();
- getPreferences().putLong( "modified", time );
- }
-
public URI getURI( String key ) throws BuilderException
{
Preferences prefs = getPreferences();
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -57,9 +57,9 @@
// constructor
//
------------------------------------------------------------------------
- CacheStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ CacheStorageUnit( Preferences prefs, Logger logger, boolean policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
m_registry = createLayoutRegistryModel();
@@ -72,7 +72,7 @@
try
{
m_manager = new DefaultCacheModel(
- logger, creation, this, uri, cache, hosts, layout, m_registry
);
+ logger, this, uri, cache, hosts, layout, m_registry );
}
catch( DuplicateKeyException e )
{
@@ -123,9 +123,8 @@
Preferences prefs = getHostsNodePreferences().node( id );
Logger logger = getLogger().getChildLogger( id );
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
- HostStorageUnit unit = new HostStorageUnit( prefs, logger, creation,
policy );
+ HostStorageUnit unit = new HostStorageUnit( prefs, logger, policy );
return unit.createHostModel( m_registry );
}
@@ -151,13 +150,12 @@
{
Preferences prefs = getPreferences().node( "layout" );
Logger logger = getLogger().getChildLogger( "layout" );
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
try
{
LayoutRegistryStorageUnit unit =
- new LayoutRegistryStorageUnit( prefs, logger, creation, policy
);
+ new LayoutRegistryStorageUnit( prefs, logger, policy );
return unit.getLayoutRegistryModel();
}
catch( DuplicateKeyException e )
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -19,9 +19,10 @@
import java.net.URI;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
+import java.util.Date;
+import java.util.Properties;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
-import java.util.Date;
import net.dpml.transit.home.CodeBaseHome;
import net.dpml.transit.model.Logger;
@@ -36,9 +37,9 @@
// constructor
//
------------------------------------------------------------------------
- public CodeBaseStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
+ public CodeBaseStorageUnit( Preferences prefs, Logger logger, boolean
policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -55,6 +56,42 @@
setURI( "uri", uri );
}
+ protected Properties getProperties( Preferences prefs ) throws
BuilderException
+ {
+ Properties properties = new Properties();
+ try
+ {
+ String[] keys = prefs.keys();
+ for( int i=0; i<keys.length; i++ )
+ {
+ String key = keys[i];
+ String value = prefs.get( key, null );
+ if( null != value )
+ {
+ properties.setProperty( key, value );
+ }
+ }
+ return properties;
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Internal error while resolving persistent application
properties.";
+ throw new BuilderException( error, e );
+ }
+ }
+
+ protected void setProperty( Preferences prefs, String key, String value )
+ {
+ prefs.put( key, value );
+ }
+
+ public void removeProperty( Preferences prefs, String key )
+ {
+ prefs.remove( key );
+ }
+
+
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -44,9 +44,9 @@
// constructor
//
------------------------------------------------------------------------
- ContentRegistryStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
+ ContentRegistryStorageUnit( Preferences prefs, Logger logger, boolean
policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -67,9 +67,8 @@
Preferences prefs = getPreferences();
Preferences p = prefs.node( id );
Logger logger = getLogger().getChildLogger( id );
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
- return createContentModel( p, logger, creation, policy );
+ return createContentModel( p, logger, policy );
}
public ContentModel[] createContentModels()
@@ -103,14 +102,13 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
try
{
URI uri = getCodeBaseURI();
ContentModel[] models = createContentModels();
- return new DefaultContentRegistryModel( logger, creation, this,
uri, models );
+ return new DefaultContentRegistryModel( logger, this, uri,
models );
}
catch( Exception e )
{
@@ -121,10 +119,10 @@
}
private ContentModel createContentModel(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
throws BuilderException
{
- ContentStorageUnit store = new ContentStorageUnit( prefs, logger,
creation, policy );
+ ContentStorageUnit store = new ContentStorageUnit( prefs, logger,
policy );
return store.createContentModel();
}
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -20,6 +20,7 @@
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import java.util.Date;
+import java.util.Properties;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -42,9 +43,9 @@
// constructor
//
------------------------------------------------------------------------
- protected ContentStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
+ protected ContentStorageUnit( Preferences prefs, Logger logger, boolean
policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
m_model = createContentModel();
}
@@ -63,6 +64,24 @@
setValue( "title", title );
}
+ public void setProperty( String key, String value )
+ {
+ Preferences prefs = getPreferences().node( "properties" );
+ setProperty( prefs, key, value );
+ }
+
+ public void removeProperty( String key )
+ {
+ Preferences prefs = getPreferences().node( "properties" );
+ removeProperty( prefs, key );
+ }
+
+ protected Properties getProperties()
+ {
+ Preferences prefs = getPreferences().node( "properties" );
+ return getProperties( prefs );
+ }
+
//
------------------------------------------------------------------------
// Removable
//
------------------------------------------------------------------------
@@ -87,13 +106,13 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
URI uri = getCodeBaseURI();
String type = getType();
String title = getTitle();
+ Properties properties = getProperties();
try
{
- return new DefaultContentModel( logger, creation, this, uri,
type, title );
+ return new DefaultContentModel( logger, this, uri, type, title,
properties );
}
catch( RemoteException e )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -58,9 +58,9 @@
//
------------------------------------------------------------------------
HostStorageUnit(
- Preferences prefs, Logger logger, Date creation, boolean policy )
+ Preferences prefs, Logger logger, boolean policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -159,7 +159,6 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
String id = prefs.name();
String name = prefs.get( "name", id );
@@ -177,7 +176,7 @@
if( bootstrap )
{
return new DefaultHostModel(
- logger, creation, this, id,
+ logger, this, id,
new Local( DEFAULT_HOST_CLASSNAME, bootstrap ),
base, index, name, trusted, enabled, priority,
layout, auth, scheme, prompt );
@@ -186,7 +185,7 @@
{
URI uri = getCodeBaseURI();
return new DefaultHostModel(
- logger, creation, this, id,
+ logger, this, id,
new Plugin( uri ), base, index, name, trusted,
enabled, priority, layout, auth, scheme, prompt );
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -49,17 +49,17 @@
// constructor
//
------------------------------------------------------------------------
- LayoutRegistryStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
+ LayoutRegistryStorageUnit( Preferences prefs, Logger logger, boolean
policy )
throws DuplicateKeyException
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
URI uri = getCodeBaseURI();
LayoutModel[] layouts = createLayoutModels();
try
{
- m_manager = new DefaultLayoutRegistryModel( logger, creation,
this, uri, layouts );
+ m_manager = new DefaultLayoutRegistryModel( logger, this, uri,
layouts );
}
catch( RemoteException e )
{
@@ -78,9 +78,8 @@
Preferences prefs = getPreferences();
Preferences p = prefs.node( id );
Logger logger = getLogger().getChildLogger( id );
- Date creation = getCreationDate();
boolean policy = getStoragePolicy();
- LayoutStorageUnit unit = new LayoutStorageUnit( p, logger, creation,
policy );
+ LayoutStorageUnit unit = new LayoutStorageUnit( p, logger, policy );
return unit.createLayoutModel();
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -46,9 +46,9 @@
// constructor
//
------------------------------------------------------------------------
- LayoutStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ LayoutStorageUnit( Preferences prefs, Logger logger, boolean policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -106,14 +106,13 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
URI uri = getCodeBaseURI();
String id = prefs.name();
String title = prefs.get( "title", id );
if( null != uri )
{
Plugin plugin = new Plugin( uri );
- return new DefaultLayoutModel( logger, creation, this, id,
plugin, title );
+ return new DefaultLayoutModel( logger, this, id, plugin, title );
}
else
{
@@ -134,13 +133,13 @@
}
Local local = new Local( classname, false );
- return new DefaultLayoutModel( logger, creation, this, id,
local, title );
+ return new DefaultLayoutModel( logger, this, id, local,
title );
}
else
{
classname = ClassicLayout.class.getName();
Local local = new Local( classname, false );
- return new DefaultLayoutModel( logger, creation, this, id,
local, title );
+ return new DefaultLayoutModel( logger, this, id, local,
title );
}
}
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -39,9 +39,9 @@
// constructor
//
------------------------------------------------------------------------
- ProxyStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ ProxyStorageUnit( Preferences prefs, Logger logger, boolean policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -109,14 +109,13 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
URL host = getURL( "host" );
String[] excludes = getExcludes();
PasswordAuthentication auth = getAuthentication();
try
{
- return new DefaultProxyModel( logger, creation, this, host,
auth, excludes );
+ return new DefaultProxyModel( logger, this, host, auth,
excludes );
}
catch( RemoteException e )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -40,9 +40,9 @@
// constructor
//
------------------------------------------------------------------------
- RepositoryStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ RepositoryStorageUnit( Preferences prefs, Logger logger, boolean policy )
{
- super( prefs, logger, creation, policy );
+ super( prefs, logger, policy );
}
//
------------------------------------------------------------------------
@@ -54,12 +54,11 @@
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
- Date creation = getCreationDate();
URI uri = getCodeBaseURI();
try
{
- return new DefaultRepositoryModel( logger, creation, this, uri );
+ return new DefaultRepositoryModel( logger, this, uri );
}
catch( RemoteException e )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
Wed Jun 22 02:03:03 2005
@@ -156,7 +156,6 @@
public TransitModel create()
throws BuilderException
{
- Date creation = new Date();
Logger logger = getLogger();
Preferences prefs = getPreferences();
URL authority = getAuthority();
@@ -207,10 +206,10 @@
// cache system setup)
//
- ProxyStorageUnit proxyUnit = createProxyUnit( creation );
- CacheStorageUnit cacheUnit = createCacheUnit( creation );
- ContentRegistryStorageUnit contentUnit = createContentRegistryUnit(
creation );
- RepositoryStorageUnit repositoryUnit = createRepositoryUnit(
creation );
+ ProxyStorageUnit proxyUnit = createProxyUnit();
+ CacheStorageUnit cacheUnit = createCacheUnit();
+ ContentRegistryStorageUnit contentUnit = createContentRegistryUnit();
+ RepositoryStorageUnit repositoryUnit = createRepositoryUnit();
ProxyModel proxy = proxyUnit.createProxyModel();
RepositoryModel repository = repositoryUnit.createRepositoryModel();
@@ -224,7 +223,7 @@
try
{
return new DefaultTransitModel(
- logger, creation, this, cache, content, repository, proxy );
+ logger, this, cache, content, repository, proxy );
}
catch( Throwable e )
{
@@ -234,14 +233,14 @@
}
}
- private ProxyStorageUnit createProxyUnit( Date creation ) throws
BuilderException
+ private ProxyStorageUnit createProxyUnit() throws BuilderException
{
try
{
boolean policy = getStoragePolicy();
Logger logger = getLogger().getChildLogger( "proxy" );
Preferences prefs = getPreferences().node( "proxy" );
- return new ProxyStorageUnit( prefs, logger, creation, policy );
+ return new ProxyStorageUnit( prefs, logger, policy );
}
catch( Throwable e )
{
@@ -251,14 +250,14 @@
}
}
- private RepositoryStorageUnit createRepositoryUnit( Date creation )
throws BuilderException
+ private RepositoryStorageUnit createRepositoryUnit() throws
BuilderException
{
try
{
boolean policy = getStoragePolicy();
Logger logger = getLogger().getChildLogger( "repository" );
Preferences prefs = getPreferences().node( "repository" );
- return new RepositoryStorageUnit( prefs, logger, creation,
policy );
+ return new RepositoryStorageUnit( prefs, logger, policy );
}
catch( Throwable e )
{
@@ -268,14 +267,14 @@
}
}
- private CacheStorageUnit createCacheUnit( Date creation ) throws
BuilderException
+ private CacheStorageUnit createCacheUnit() throws BuilderException
{
try
{
boolean policy = getStoragePolicy();
Logger logger = getLogger().getChildLogger( "cache" );
Preferences prefs = getPreferences().node( "cache" );
- return new CacheStorageUnit( prefs, logger, creation, policy );
+ return new CacheStorageUnit( prefs, logger, policy );
}
catch( Throwable e )
{
@@ -285,14 +284,14 @@
}
}
- private ContentRegistryStorageUnit createContentRegistryUnit( Date
creation ) throws BuilderException
+ private ContentRegistryStorageUnit createContentRegistryUnit() throws
BuilderException
{
try
{
boolean policy = getStoragePolicy();
Logger logger = getLogger().getChildLogger( "content" );
Preferences prefs = getPreferences().node( "content" );
- return new ContentRegistryStorageUnit( prefs, logger, creation,
policy );
+ return new ContentRegistryStorageUnit( prefs, logger, policy );
}
catch( Throwable e )
{
Modified: development/planet/build.xml
==============================================================================
--- development/planet/build.xml (original)
+++ development/planet/build.xml Wed Jun 22 02:03:03 2005
@@ -1,28 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright 2005 Peter Neubauer
-
- 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.
--->
-
-<project name="planet" default="ci" basedir=".">
-
-
- <target name="ci">
- <!--to let the DPML contineous integration system pick up your project,
- insert it here, eg
- <ant dir="myprojectdir" antfile="build.xml"/>
- -->
- </target>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright 2005 Peter Neubauer
+ 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.
+-->
+
+<project name="dpml-planet" default="default" basedir="."
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="artifact:template:dpml/magic/reactor"/>
+
+ <target name="ci">
+ <ant dir="http" antfile="build.xml"/>
+ </target>
+
+</project>
Modified: development/planet/http/demo/build.xml
==============================================================================
--- development/main/test/components/http/demo/build.xml (original)
+++ development/planet/http/demo/build.xml Wed Jun 22 02:03:03 2005
@@ -29,8 +29,7 @@
<component xmlns="plugin:dpml/composition/dpml-composition-builder"
type="net.dpml.http.Demo"
- name="demo"
- dest="target/test/demo.part" >
+ name="demo">
<parts>
<component type="net.dpml.http.impl.HttpServerImpl" name="server">
<context>
@@ -40,6 +39,11 @@
<entry key="requestsPerGC" value="100"/>
</context>
</component>
+ <component type="net.dpml.http.impl.SocketListener"
name="socketListener">
+ <context>
+ <reference key="httpServer" uri="parts:server"/>
+ </context>
+ </component>
<component name="context" type="net.dpml.http.impl.HttpContextImpl" >
<context>
<entry key="name" value="context"/>
@@ -50,13 +54,21 @@
</value>
<component key="requestLog"
type="net.dpml.http.impl.NcsaRequestLog">
<context>
- <entry key="filename" value="static_request.log"/>
+ <entry key="filename"
value="${dpml.data}/logs/http/static_request.log"/>
<entry key="append" value="true"/>
<entry key="extended" value="true"/>
</context>
</component>
</context>
</component>
+ <component name="resourceHandler"
type="net.dpml.http.impl.ResourceHandler">
+ <context>
+ <entry key="name" value="resource-handler"/>
+ <entry key="dirAllowed" value="true"/>
+ <entry key="allowedMethods" value="GET"/>
+ <reference key="httpContext" uri="parts:context"/>
+ </context>
+ </component>
<component name="notFoundHandler"
type="net.dpml.http.impl.NotFoundHandler">
<context>
<entry key="name" value="not-found-handler"/>
@@ -65,8 +77,8 @@
</component>
</parts>
</component>
-
+ <mkdir dir="target/test"/>
+ <copy file="target/deliverables/parts/${project.filename}"
toFile="target/test/demo.part"/>
</target>
-
</project>
Modified: development/planet/http/demo/src/main/net/dpml/http/Demo.java
==============================================================================
---
development/main/test/components/http/demo/src/main/net/dpml/http/Demo.java
(original)
+++ development/planet/http/demo/src/main/net/dpml/http/Demo.java Wed
Jun 22 02:03:03 2005
@@ -23,21 +23,31 @@
import net.dpml.http.HttpService;
import net.dpml.http.HttpContextService;
+import net.dpml.part.model.Model;
+import net.dpml.part.model.Component;
import net.dpml.part.model.Provider;
import org.mortbay.http.HttpHandler;
-public class Demo
+public class Demo implements Startable
{
public interface Parts
{
- Provider getServerProvider();
- Provider getNotFoundHandlerProvider();
- Provider getContextProvider();
+ Model getServerModel();
+ Model getSocketListenerModel();
+ Model getContextModel();
+ Model getNotFoundHandlerModel();
+ Model getResourceHandlerModel();
}
- private Logger m_logger;
- private Parts m_parts;
+ private final Logger m_logger;
+ private final Parts m_parts;
+
+ private Object m_context;
+ private Object m_server;
+ private Object m_listener;
+ private Object m_handler;
+ private Object m_nf;
public Demo( Logger logger, Parts parts )
{
@@ -47,8 +57,20 @@
public void start() throws Exception
{
- Object server = m_parts.getServerProvider().resolve( false );
- m_logger.info( "Started: " + server );
+ m_logger.info( "Starting" );
+ m_server = m_parts.getServerModel().getProvider().resolve( false );
+ m_context = m_parts.getContextModel().getProvider().resolve( false );
+ m_listener = m_parts.getSocketListenerModel().getProvider().resolve(
false );
+ m_handler = m_parts.getResourceHandlerModel().getProvider().resolve(
false );
+ m_nf = m_parts.getNotFoundHandlerModel().getProvider().resolve(
false );
+ m_logger.info( "Started" );
+ }
+
+ public void stop() throws Exception
+ {
+ m_logger.info( "Stopping" );
+ //m_parts.getServerModel().getComponent().terminate();
+ m_logger.info( "Stopped" );
}
}
Modified:
development/planet/http/impl/src/main/net/dpml/http/impl/NcsaRequestLog.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NcsaRequestLog.java
(original)
+++
development/planet/http/impl/src/main/net/dpml/http/impl/NcsaRequestLog.java
Wed Jun 22 02:03:03 2005
@@ -15,6 +15,8 @@
*/
package net.dpml.http.impl;
+import java.io.File;
+
import net.dpml.activity.Startable;
import net.dpml.transit.util.PropertyResolver;
@@ -62,6 +64,9 @@
if( filename != null )
{
filename = PropertyResolver.resolve( System.getProperties(),
filename );
+ File file = new File( filename );
+ File parent = file.getParentFile();
+ parent.mkdirs();
setFilename( filename );
}
Copied: development/planet/http/index.xml (from r2897,
development/main/test/components/http/index.xml)
==============================================================================
--- development/main/test/components/http/index.xml (original)
+++ development/planet/http/index.xml Wed Jun 22 02:03:03 2005
@@ -79,6 +79,10 @@
<name>dpml-http-demo</name>
<version>1.0.0</version>
<status>SNAPSHOT</status>
+ <types>
+ <type>part</type>
+ <type>jar</type>
+ </types>
</info>
<dependencies>
<include key="dpml-http-impl"/>
Added: development/planet/index.xml
==============================================================================
--- (empty file)
+++ development/planet/index.xml Wed Jun 22 02:03:03 2005
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<index>
+
+ <import uri="${dpml.transit.uri}"/>
+ <import uri="${dpml.depot.uri}"/>
+ <import uri="${dpml.magic.uri}"/>
+ <import uri="${dpml.metro.uri}"/>
+
+ <import index="http/index.xml" />
+
+</index>
Added: development/planet/module.properties
==============================================================================
--- (empty file)
+++ development/planet/module.properties Wed Jun 22 02:03:03 2005
@@ -0,0 +1,22 @@
+
+project.module.repository = http://www.dpml.net
+project.module.svn = http://paris.dpml.net/svn/main
+project.module.docs = http://www.dpml.net
+project.module.home = ${project.module.docs}/central
+project.module.license = ${project.module.home}/about/legal/license.html
+project.module.notice = ${project.module.home}/about/legal/notice.html
+project.module.publisher = The Digital Product Meta Library
+
+dpml.ant.version = 1.6.4
+
+dpml.transit.version = ${dpml.build.signature}
+dpml.transit.uri =
artifact:module:dpml/transit/dpml-transit#${dpml.transit.version}
+
+dpml.magic.version = ${dpml.build.signature}
+dpml.magic.uri = artifact:module:dpml/magic/dpml-magic#${dpml.magic.version}
+
+dpml.metro.version = ${dpml.build.signature}
+dpml.metro.uri = artifact:module:dpml/metro/dpml-metro#${dpml.metro.version}
+
+dpml.depot.version = ${dpml.build.signature}
+dpml.depot.uri = artifact:module:dpml/depot/dpml-depot#${dpml.depot.version}
- svn commit: r2898 - in development: central/site central/site/src/docs/transit/latest/guide main/depot/console/src/main/net/dpml/depot main/depot/console/src/main/net/dpml/depot/profile main/depot/station/src/main/net/dpml/depot/station main/metro main/metro/composition/content main/metro/composition/control/src/main/net/dpml/composition/model main/metro/composition/control/src/main/net/dpml/composition/unit main/metro/composition/part main/metro/main main/metro/main/src/main/net/dpml/metro main/metro/main/src/main/net/dpml/metro/model main/metro/main/src/main/net/dpml/metro/part main/metro/main/src/main/net/dpml/metro/part/images main/test/components/http main/test/components/plus/src/main/net/dpml/test/acme/state main/test/plugins main/test/plugins/content main/test/plugins/content/src main/test/plugins/content/src/main/net/dpml/composition/content main/transit/core/handler/src/main/net/dpml/transit/home main/transit/core/handler/src/main/net/dpml/transit/model main/transit/core/handler/src/main/net/dpml/transit/unit planet planet/facilities planet/http planet/http/api planet/http/demo planet/http/demo/src/main/net/dpml/http planet/http/impl planet/http/impl/src/main/net/dpml/http/impl planet/http/spi planet/http/util planet/services planet/site, mcconnell, 06/22/2005
Archive powered by MHonArc 2.6.24.