notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2785 - in development/main: depot/console/src/main/net/dpml/depot/lang depot/console/src/main/net/dpml/depot/logging depot/prefs/src/main/net/dpml/depot/prefs transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/management transit/core/handler/src/main/net/dpml/transit/manager
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2785 - in development/main: depot/console/src/main/net/dpml/depot/lang depot/console/src/main/net/dpml/depot/logging depot/prefs/src/main/net/dpml/depot/prefs transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/management transit/core/handler/src/main/net/dpml/transit/manager
- Date: Tue, 07 Jun 2005 19:39:35 -0400
Author: mcconnell AT dpml.net
Date: Tue Jun 7 19:39:34 2005
New Revision: 2785
Modified:
development/main/depot/console/src/main/net/dpml/depot/lang/Main.java
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
development/main/transit/core/handler/src/main/net/dpml/transit/cache/CacheHandler.java
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
development/main/transit/core/handler/src/main/net/dpml/transit/management/HostManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
Log:
testing, improving, validating, etc.
Modified:
development/main/depot/console/src/main/net/dpml/depot/lang/Main.java
==============================================================================
--- development/main/depot/console/src/main/net/dpml/depot/lang/Main.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/lang/Main.java
Tue Jun 7 19:39:34 2005
@@ -64,6 +64,15 @@
public static void main( final String[] args )
throws Exception
{
+ for( int i=0; i < args.length; i++ )
+ {
+ String arg = args[i];
+ if( arg.equals( "-debug" ) )
+ {
+ System.setProperty( "dpml.logging.level", "FINE" );
+ }
+ }
+
Logger logger = Logger.getLogger( "depot" );
logger.info( "Depot (Build ID: " + DPML.BUILD_ID + ")." );
Modified:
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
Tue Jun 7 19:39:34 2005
@@ -39,7 +39,8 @@
public ConfigurationHandler()
{
Preferences prefs = Preferences.userNodeForPackage( getClass()
).node( "nodes" );
- String rootLevel = prefs.get( "level", "INFO" );
+ String defaultLevel = prefs.get( "level", "INFO" );
+ String rootLevel = System.getProperty( "dpml.logging.level",
defaultLevel ).toUpperCase();
Properties properties = new Properties();
properties.setProperty(
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostManagerPanel.java
Tue Jun 7 19:39:34 2005
@@ -554,7 +554,17 @@
boolean trusted = m_trusted.isSelected();
boolean enabled = m_enabled.isSelected();
LayoutModel layout = (LayoutModel) m_strategy.getSelectedItem();
- m_manager.update( base, null, enabled, trusted, layout, m_auth,
"", "" );
+ try
+ {
+ m_manager.update( base, null, enabled, trusted, layout,
m_auth, "", "" );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error while attempting to update the host.";
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
m_parent.hide();
dispose();
}
Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java
Tue Jun 7 19:39:34 2005
@@ -189,11 +189,7 @@
{
String base = m_base.getText();
- System.out.println( "# base: " + base );
- System.out.println( "# host: " + m_host );
-
boolean flag = ( false == m_host.equals( base ) );
- System.out.println( "# flag/1: " + flag );
PasswordAuthentication auth = m_manager.getAuthentication();
if( null == m_auth )
@@ -208,8 +204,6 @@
flag = true;
}
- System.out.println( "# flag/2: " + flag );
-
m_ok.setEnabled( flag );
m_revert.setEnabled( flag );
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java
Tue Jun 7 19:39:34 2005
@@ -391,6 +391,7 @@
{
setCacheHandler( model );
}
+ getCacheHandler().initialize();
}
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/CacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/CacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/CacheHandler.java
Tue Jun 7 19:39:34 2005
@@ -39,6 +39,16 @@
*/
public interface CacheHandler
{
+ /**
+ * Initialization of the cache handler. This operation is invoked by
+ * the transit context following the establishment of bootstrap
+ * services. During initialization the implementation loads any custom
+ * resource hosts.
+ *
+ * @exception TransitException if a custom host deployment error occurs
+ */
+ public void initialize() throws TransitException;
+
/**
* Attempts to download and cache a remote artifact using a set of remote
* repositories.
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
Tue Jun 7 19:39:34 2005
@@ -136,9 +136,9 @@
m_logger = model.getLogger();
- if( m_logger.isDebugEnabled() )
+ if( getLogger().isDebugEnabled() )
{
- m_logger.debug( "cache controller initialization" );
+ getLogger().debug( "cache initialization" );
}
//
@@ -150,9 +150,9 @@
//
HostModel[] hosts = model.getHostModels();
- if( m_logger.isDebugEnabled() )
+ if( getLogger().isDebugEnabled() )
{
- m_logger.debug( "cache configuration host count: " +
hosts.length );
+ getLogger().debug( "host count: " + hosts.length );
}
for( int i=0; i<hosts.length; i++ )
{
@@ -160,18 +160,11 @@
if( null == host.getPluginURI() )
{
String id = host.getID();
- if( m_logger.isDebugEnabled() )
- {
- final String message =
- "Creating bootstrap host: " + id
- + "\nBase URL: " + host.getBaseURL();
- m_logger.debug( message );
- }
ResourceHost handler = createDefaultResourceHost( host );
m_resourceHosts.put( id, handler );
}
}
-
+
//
// setup the cache directory
//
@@ -179,9 +172,72 @@
File cache = model.getCacheDirectory();
setLocalCacheDirectory( cache );
- if( m_logger.isDebugEnabled() )
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "bootstrap initialization complete" );
+ }
+ }
+
+ //
------------------------------------------------------------------------
+ // CacheListener
+ //
------------------------------------------------------------------------
+
+ /**
+ * Notify the listener of a change to the cache directory.
+ * @param event the cache directory change event
+ */
+ public void cacheDirectoryChanged( FileChangeEvent event )
+ {
+ File cache = event.getFile();
+ synchronized( this )
+ {
+ setLocalCacheDirectory( cache );
+ }
+ }
+
+ /**
+ * Notify the listener of the addition of a new host.
+ * @param event the host added event
+ */
+ public void hostAdded( HostNodeEvent event )
+ {
+ HostModel host = event.getHostModel();
+ try
+ {
+ handleHostAddition( host );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "An internal error occured while attempting to handle host
addition.";
+ m_model.getLogger().error( error, e );
+ }
+ }
+
+ /**
+ * Notify the listener of the removal of a host.
+ * @param event the host removed event
+ */
+ public void hostRemoved( HostNodeEvent event )
+ {
+ synchronized( m_resourceHosts )
{
- m_logger.debug( "cache controller initialization complete" );
+ HostModel model = event.getHostModel();
+ String id = model.getID();
+ ResourceHost host = (ResourceHost) m_resourceHosts.get( id );
+ if( null != host )
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "removing host: " + id );
+ }
+ if( host instanceof Handler )
+ {
+ Handler handler = (Handler) host;
+ handler.dispose();
+ }
+ m_resourceHosts.remove( id );
+ }
}
}
@@ -228,6 +284,11 @@
*/
public void initialize() throws TransitException
{
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "secondary initialization phase" );
+ }
+
m_model.addCacheListener( this );
HostModel[] hosts = m_model.getHostModels();
@@ -250,10 +311,15 @@
final String error =
"Dropping custom resource host due to a deployment
failure."
+ "\nHost ID: " + host.getID();
- m_logger.error( error, e );
+ getLogger().error( error, e );
}
}
}
+
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "cache subsystem established" );
+ }
}
/**
@@ -270,17 +336,17 @@
if( null == m_cacheDir )
{
final String message =
- "Setting local cache directory."
- + "\nDirectory: " + cache;
- m_logger.debug( message );
+ "Setting cache to: "
+ + cache;
+ getLogger().debug( message );
}
else
{
final String message =
- "Changing cache directory."
+ "Changing cache:"
+ "\nOld: " + m_cacheDir
+ "\nNew: " + cache;
- m_logger.debug( message );
+ getLogger().debug( message );
}
if( false == cache.isAbsolute() )
{
@@ -576,65 +642,6 @@
}
//
------------------------------------------------------------------------
- // CacheListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify the listener of a change to the cache directory.
- * @param event the cache directory change event
- */
- public void cacheDirectoryChanged( FileChangeEvent event )
- {
- File cache = event.getFile();
- synchronized( this )
- {
- setLocalCacheDirectory( cache );
- }
- }
-
- /**
- * Notify the listener of the addition of a new host.
- * @param event the host added event
- */
- public void hostAdded( HostNodeEvent event )
- {
- HostModel host = event.getHostModel();
- try
- {
- handleHostAddition( host );
- }
- catch( Throwable e )
- {
- final String error =
- "An internal error occured while attempting to handle host
addition.";
- m_model.getLogger().error( error, e );
- }
- }
-
- /**
- * Notify the listener of the removal of a host.
- * @param event the host removed event
- */
- public void hostRemoved( HostNodeEvent event )
- {
- synchronized( m_resourceHosts )
- {
- HostModel model = event.getHostModel();
- String id = model.getID();
- ResourceHost host = (ResourceHost) m_resourceHosts.get( id );
- if( null != host )
- {
- if( host instanceof Handler )
- {
- Handler handler = (Handler) host;
- handler.dispose();
- }
- m_resourceHosts.remove( id );
- }
- }
- }
-
- //
------------------------------------------------------------------------
// internals
//
------------------------------------------------------------------------
@@ -644,6 +651,10 @@
synchronized( m_resourceHosts )
{
String id = model.getID();
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "adding host: " + id );
+ }
if( null == m_resourceHosts.get( id ) )
{
ResourceHost host = createResourceHost( model );
@@ -678,7 +689,7 @@
Repository loader = Transit.getInstance().getRepository();
try
{
- return (ResourceHost) loader.instantiate( clazz, new Object[]{
model } );
+ return (ResourceHost) loader.instantiate( clazz, new Object[]{
model, m_registry } );
}
catch( Throwable e )
{
@@ -701,7 +712,7 @@
{
try
{
- m_logger.debug( "loading host plugin: " + uri );
+ getLogger().debug( "loading host plugin: " + uri );
Repository loader = Transit.getInstance().getRepository();
ClassLoader classloader =
Thread.currentThread().getContextClassLoader();
clazz = loader.getPluginClass( classloader, uri );
@@ -731,17 +742,28 @@
private ResourceHost createDefaultResourceHost( HostModel model ) throws
TransitException
{
- if( m_logger.isDebugEnabled() )
+ if( getLogger().isDebugEnabled() )
{
- final String message =
- "Creating new classic resource host."
- + "\nHost ID: " + model.getID()
- + "\nBase URL: " + model.getBaseURL();
- m_logger.debug( message );
+ if( model.isBootstrap() )
+ {
+ final String message =
+ "Creating bootstrap host ["
+ + model.getID()
+ + "] on " + model.getBaseURL();
+ getLogger().debug( message );
+ }
+ else
+ {
+ final String message =
+ "Creating host ["
+ + model.getID()
+ + "] on " + model.getBaseURL();
+ getLogger().debug( message );
+ }
}
try
{
- return new DefaultResourceHost( model, m_resolver );
+ return new DefaultResourceHost( model, m_registry );
}
catch( Throwable e )
{
@@ -751,5 +773,10 @@
throw new TransitException( error, e );
}
}
+
+ private Logger getLogger()
+ {
+ return m_model.getLogger();
+ }
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
Tue Jun 7 19:39:34 2005
@@ -50,19 +50,16 @@
import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
-
import net.dpml.transit.artifact.Artifact;
-
import net.dpml.transit.layout.ClassicLayout;
+import net.dpml.transit.layout.LayoutRegistry;
import net.dpml.transit.layout.Layout;
-
import net.dpml.transit.network.ConnectionCache;
import net.dpml.transit.network.DelegatingAuthenticator;
import net.dpml.transit.network.NetworkLoader;
import net.dpml.transit.network.RequestIdentifier;
import net.dpml.transit.network.TransitAuthenticator;
import net.dpml.transit.network.TransitAuthenticatorImpl;
-
import net.dpml.transit.Handler;
import net.dpml.transit.model.HostModel;
import net.dpml.transit.model.HostListener;
@@ -104,6 +101,8 @@
*/
private ConnectionCache m_connections;
+ private LayoutRegistry m_registry;
+
private Layout m_layout;
private HostModel m_model;
@@ -119,12 +118,12 @@
* @param layout the host layout strategy
* @exception UnknownHostException if the supplied base url references
an unknown host
*/
- public DefaultResourceHost( HostModel model, Layout layout )
+ public DefaultResourceHost( HostModel model, LayoutRegistry registry )
throws UnknownHostException, IOException
{
m_model = model;
- m_layout = layout;
-
+ m_registry = registry;
+ m_layout = registry.getLayout( model.getLayoutModel().getID() );
model.addHostListener( this );
m_connections = ConnectionCache.getInstance();
String[] groups = setupGroups();
@@ -158,6 +157,10 @@
{
synchronized( this )
{
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "updating runtime" );
+ }
try
{
setupAuthenticator();
@@ -179,6 +182,7 @@
*/
public void nameChanged( HostNameEvent event )
{
+ // not used by the runtime
}
/**
@@ -187,6 +191,10 @@
*/
public void priorityChanged( HostPriorityEvent event )
{
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "setting priority to " + event.getPriority()
);
+ }
}
/**
@@ -195,6 +203,24 @@
*/
public void layoutChanged( HostLayoutEvent event )
{
+ synchronized( m_layout )
+ {
+ try
+ {
+ final String id = event.getLayoutModel().getID();
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "setting layout to " + id );
+ }
+ m_layout = m_registry.getLayout( id );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Layout change could not be completed.";
+ getLogger().error( error, e );
+ }
+ }
}
//
------------------------------------------------------------------------
@@ -535,6 +561,11 @@
return "[HOST: " + getURL() + "]";
}
+ private Logger getLogger()
+ {
+ return m_model.getLogger();
+ }
+
//
------------------------------------------------------------------------
// static (utils)
//
------------------------------------------------------------------------
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/management/HostManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/management/HostManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/management/HostManager.java
Tue Jun 7 19:39:34 2005
@@ -50,7 +50,7 @@
public void update(
URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
- PasswordAuthentication auth, String scheme, String prompt );
+ PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException;
void setName( String name );
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
Tue Jun 7 19:39:34 2005
@@ -154,7 +154,7 @@
public void update(
URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
- PasswordAuthentication auth, String scheme, String prompt )
+ PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException
{
synchronized( m_lock )
{
@@ -165,12 +165,11 @@
m_layout = layout;
m_authentication = auth;
m_identifier = getRequestIdentifier( base, scheme, prompt );
-
- setModified();
HostChangeEvent e =
new HostChangeEvent(
- this, base, index, m_identifier, auth, enabled, trusted );
+ this, base, index, m_identifier, auth, enabled, trusted );
enqueueEvent( e );
+ setLayoutModel( layout );
}
}
- svn commit: r2785 - in development/main: depot/console/src/main/net/dpml/depot/lang depot/console/src/main/net/dpml/depot/logging depot/prefs/src/main/net/dpml/depot/prefs transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/management transit/core/handler/src/main/net/dpml/transit/manager, mcconnell, 06/07/2005
Archive powered by MHonArc 2.6.24.