notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2638 - in development/main/transit/core/handler/src/main/net/dpml/transit: cache content host manager model network
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2638 - in development/main/transit/core/handler/src/main/net/dpml/transit: cache content host manager model network
- Date: Fri, 20 May 2005 22:43:14 +0000
Author: mcconnell AT dpml.net
Date: Fri May 20 22:43:11 2005
New Revision: 2638
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/EnabledEvent.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostNodeEvent.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/NameChangeEvent.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/PriorityEvent.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/TrustedEvent.java
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/FileCacheHandler.java
development/main/transit/core/handler/src/main/net/dpml/transit/content/ContentHandlerRegistry.java
development/main/transit/core/handler/src/main/net/dpml/transit/host/ClassicResourceHost.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/CacheManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/ContentManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/HostManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/RegistryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheListener.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/HostChangeEvent.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostEvent.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostListener.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryListener.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/network/TransitAuthenticatorImpl.java
Log:
General enhancements to the model and manager implementation.
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/FileCacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/FileCacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/FileCacheHandler.java
Fri May 20 22:43:11 2005
@@ -148,9 +148,9 @@
/**
* Creation of a new file based cache handler using supplied hosts and
properties.
- * @param monitor the assigned monitor
* @param hosts the assigned hosts
* @param props the properties against which this instance will be
configured
+ * @param resolver the location resolver
*/
public FileCacheHandler( ResourceHost[] hosts, Properties props,
LocationResolver resolver )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/content/ContentHandlerRegistry.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/content/ContentHandlerRegistry.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/content/ContentHandlerRegistry.java
Fri May 20 22:43:11 2005
@@ -34,7 +34,7 @@
* the a handler is available the handler is returned otherwise the
returned
* value is null.
*
- * @param the artifact type
+ * @param type the artifact type
* @return the content handler or null if not available
*/
ContentHandler getContentHandler( final String type ) throws IOException;
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/host/ClassicResourceHost.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/host/ClassicResourceHost.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/host/ClassicResourceHost.java
Fri May 20 22:43:11 2005
@@ -146,7 +146,7 @@
* implementation registeres itdself as a preferences change listener
and maintains
* the synchronization of this instance with the supplied preferences
instance.
*
- * @param prefs the host preferences object
+ * @param descriptor the host descriptor object
* @exception UnknownHostException if the supplied base url references
an unknown host
*/
public ClassicResourceHost( HostDescriptor descriptor )
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/CacheManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/CacheManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/CacheManager.java
Fri May 20 22:43:11 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.manager;
import java.io.File;
+import java.io.IOException;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
@@ -32,6 +33,7 @@
import java.util.prefs.NodeChangeEvent;
import java.util.prefs.NodeChangeListener;
import java.net.URI;
+import java.net.UnknownHostException;
import net.dpml.transit.model.CacheModel;
import net.dpml.transit.model.HostModel;
@@ -39,7 +41,7 @@
import net.dpml.transit.model.PluginListener;
import net.dpml.transit.model.CacheListener;
import net.dpml.transit.model.FileChangeEvent;
-import net.dpml.transit.model.HostEvent;
+import net.dpml.transit.model.HostNodeEvent;
import net.dpml.transit.model.ModelException;
import net.dpml.transit.util.PropertyResolver;
@@ -132,7 +134,18 @@
public void childAdded( NodeChangeEvent event )
{
Preferences prefs = event.getChild();
- addHostModel( prefs, true );
+ try
+ {
+ addHostModel( prefs, true );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unable to add host due to an unresolved host url."
+ + "\nPreferences Node: " + event.getChild()
+ + "\nHost path: " + event.getChild().get( "base", null );
+ getLogger().log( Level.SEVERE, error, e );
+ }
}
public void childRemoved( NodeChangeEvent event )
@@ -145,10 +158,10 @@
// internal
//
------------------------------------------------------------------------
- private void addHostModel( Preferences prefs, boolean notify )
+ private void addHostModel( Preferences prefs, boolean notify ) throws
UnknownHostException, IOException
{
Logger logger = getLogger();
- HostModel model = new HostManager( logger, prefs );
+ HostModel model = new HostManager( logger, prefs ); // TODO: move to
plugin based creation
String id = model.getID();
int priority = model.getPriority();
synchronized( m_list )
@@ -225,7 +238,7 @@
/**
* Add a cache change listener.
- * @param the listener to add
+ * @param listener the listener to add
*/
public void addCacheListener( CacheListener listener )
{
@@ -234,7 +247,7 @@
/**
* Remove a cache change listener.
- * @param the listener to remove
+ * @param listener the listener to remove
*/
public void removeCacheListener( CacheListener listener )
{
@@ -247,9 +260,9 @@
{
super.processPluginChangeEvent( (PluginChangeEvent) event );
}
- else if( event instanceof HostEvent )
+ else if( event instanceof HostNodeEvent )
{
- processHostEvent( (HostEvent) event );
+ processHostEvent( (HostNodeEvent) event );
}
else if( event instanceof CacheDirectoryChangeEvent )
{
@@ -264,7 +277,7 @@
}
}
- public void processHostEvent( HostEvent event )
+ public void processHostEvent( HostNodeEvent event )
{
EventListener[] listeners = super.listeners();
for( int i=0; i<listeners.length; i++ )
@@ -389,7 +402,7 @@
}
}
- static class HostAddedEvent extends HostEvent
+ static class HostAddedEvent extends HostNodeEvent
{
private int m_priority;
@@ -404,7 +417,7 @@
}
}
- static class HostRemovedEvent extends HostEvent
+ static class HostRemovedEvent extends HostNodeEvent
{
public HostRemovedEvent( CacheModel source, HostModel host )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/ContentManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/ContentManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/ContentManager.java
Fri May 20 22:43:11 2005
@@ -82,7 +82,7 @@
/**
* Add a content listener to the director.
- * @param the listener to add
+ * @param listener the listener to add
*/
public void addContentListener( ContentListener listener )
{
@@ -91,7 +91,7 @@
/**
* Remove a content listener from the director.
- * @param the listener to remove
+ * @param listener the listener to remove
*/
public void removeContentListener( ContentListener listener )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/HostManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/HostManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/HostManager.java
Fri May 20 22:43:11 2005
@@ -18,14 +18,17 @@
package net.dpml.transit.manager;
+import java.io.IOException;
import java.util.Map;
+import java.util.ArrayList;
import java.util.EventObject;
import java.util.EventListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.net.URI;
import java.net.URL;
-import java.net.Authenticator;
+import java.net.UnknownHostException;
+import java.net.PasswordAuthentication;
import java.util.prefs.Preferences;
import java.util.prefs.PreferenceChangeEvent;
import java.util.prefs.PreferenceChangeListener;
@@ -34,8 +37,16 @@
import net.dpml.transit.model.HostModel;
import net.dpml.transit.model.PluginModel;
import net.dpml.transit.model.PluginChangeEvent;
+import net.dpml.transit.model.HostEvent;
import net.dpml.transit.model.HostChangeEvent;
import net.dpml.transit.model.HostListener;
+import net.dpml.transit.model.EnabledEvent;
+import net.dpml.transit.model.TrustedEvent;
+import net.dpml.transit.model.PriorityEvent;
+import net.dpml.transit.model.NameChangeEvent;
+
+import net.dpml.transit.network.RequestIdentifier;
+
/**
* Default implementation of a host manager. The implementation establishes
@@ -56,122 +67,177 @@
private URL m_index;
private boolean m_enabled = true;
private boolean m_trusted = false;
- private Authenticator m_authenticator;
private URI m_resolver;
private boolean m_available = false;
private int m_priority = 100;
+ private RequestIdentifier m_identifier;
+ private PasswordAuthentication m_authentication;
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
- public HostManager( Logger logger, Preferences prefs )
+ public HostManager( Logger logger, Preferences prefs ) throws
UnknownHostException, IOException
{
super( logger, prefs );
m_id = prefs.name();
+ m_name = prefs.get( "name", m_id );
+ m_trusted = prefs.getBoolean( "trusted", m_trusted );
+ m_enabled = prefs.getBoolean( "enabled", m_enabled );
+ m_priority = prefs.getInt( "priority", m_priority );
+ m_base = resolveBase( prefs );
+ m_index = resolveIndex( m_base, prefs );
+ m_identifier = resolveRequestIdentifier( m_base, prefs );
+ m_authentication = resolvePasswordAuthentication( prefs );
}
- //
------------------------------------------------------------------------
- // PreferenceChangeListener
- //
------------------------------------------------------------------------
-
- public void preferenceChange( PreferenceChangeEvent event )
+ private URL resolveBase( Preferences prefs ) throws
UnknownHostException, IOException
{
- String key = event.getKey();
- if( "modified".equals( key ) )
+ String baseSpec = prefs.get( "base", null );
+ if( null == baseSpec )
{
- fireChangeNotification();
+ final String error =
+ "Undefined base url.";
+ throw new UnknownHostException( error );
}
+ return new URL( baseSpec );
}
- //
------------------------------------------------------------------------
- // internal
- //
------------------------------------------------------------------------
-
- public void fireChangeNotification()
+ private URL resolveIndex( URL base, Preferences prefs ) throws
IOException
{
- HostChangeEvent event = new HostChangeEvent( this, new String[0] );
- enqueueEvent( event );
+ String indexSpec = prefs.get( "index", null );
+ if( null != indexSpec )
+ {
+ return new URL( base, indexSpec );
+ }
+ else
+ {
+ return null;
+ }
}
- public void setFeatures( Map map )
- {
- setFeatures( map, true );
- }
+ //
------------------------------------------------------------------------
+ // PreferenceChangeListener
+ //
------------------------------------------------------------------------
- private void setFeatures( Map map, boolean notify )
+ public void preferenceChange( PreferenceChangeEvent event )
{
- synchronized( this ) // prevent access during batch update
+ String key = event.getKey();
+ if( "enabled".equals( key ) )
+ {
+ boolean flag = event.getNode().getBoolean( "enabled", m_enabled
);
+ if( m_enabled != flag )
+ {
+ m_enabled = flag;
+ EnabledEvent e = new EnabledEvent( this, m_enabled );
+ enqueueEvent( e );
+ }
+ }
+ else if( "trusted".equals( key ) )
+ {
+ boolean flag = event.getNode().getBoolean( "trusted", m_trusted
);
+ if( m_trusted != flag )
+ {
+ m_trusted = flag;
+ TrustedEvent e = new TrustedEvent( this, m_trusted );
+ enqueueEvent( e );
+ }
+ }
+ else if( "priority".equals( key ) )
+ {
+ int priority = event.getNode().getInt( "priority", m_priority );
+ if( m_priority != priority )
+ {
+ m_priority = priority;
+ PriorityEvent e = new PriorityEvent( this, m_priority );
+ enqueueEvent( e );
+ }
+ }
+ else if( "name".equals( key ) )
+ {
+ String name = event.getNode().get( "name", m_name );
+ if( m_name != name )
+ {
+ m_name = name;
+ NameChangeEvent e = new NameChangeEvent( this, m_name );
+ enqueueEvent( e );
+ }
+ }
+ else if( "modified".equals( key ) )
{
- String name = m_name;
- URL base = m_base;
- URL index = m_index;
- boolean enabled = m_enabled;
- boolean trusted = m_trusted;
- Authenticator authenticator = m_authenticator;
- URI resolver = m_resolver;
+ // this is a trigger marking modification to any of the
+ // attributes "base", "username", "password", "prompt" or
"scheme"
+ // in which case we notify a host controller of the change via
+ // a single HostChangeEvent
- String[] keys = (String[]) map.keySet().toArray( new String[0] );
- for( int i=0; i<keys.length; i++ )
+ synchronized( this )
{
- String key = keys[i];
+ Preferences prefs = event.getNode();
try
{
- if( "name".equals( key ) )
- {
- m_name = (String) map.get( key );
- }
- else if( "base".equals( key ) )
- {
- m_base = (URL) map.get( key );
- }
- else if( "index".equals( key ) )
- {
- m_index = (URL) map.get( key );
- }
- else if( "enabled".equals( key ) )
- {
- m_enabled = ((Boolean)map.get( key )).booleanValue();
- }
- else if( "trusted".equals( key ) )
- {
- m_trusted = ((Boolean)map.get( key )).booleanValue();
- }
- else if( "authenticator".equals( key ) )
- {
- m_authenticator = (Authenticator) map.get( key );
- }
- else if( "resolver".equals( key ) )
- {
- m_resolver = (URI) map.get( key );
- }
- }
- catch( Throwable e )
- {
- m_name = name;
+ URL base = resolveBase( prefs );
+ URL index = resolveIndex( m_base, prefs );
+ RequestIdentifier identifier = resolveRequestIdentifier(
m_base, prefs );
+ PasswordAuthentication authentication =
resolvePasswordAuthentication( prefs );
+
m_base = base;
m_index = index;
- m_enabled = enabled;
- m_trusted = trusted;
- m_authenticator = authenticator;
- m_resolver = resolver;
-
- final String error =
- "Unexpected error while handling client supplied
feature map."
- + "\nKey: " + key;
- throw new IllegalArgumentException( error );
+ m_identifier = identifier;
+ m_authentication = authentication;
+
+ HostChangeEvent e =
+ new HostChangeEvent( this, base, index, identifier,
authentication );
+ enqueueEvent( e );
+ }
+ catch( UnknownHostException uhe )
+ {
+ final String error =
+ "Unable to propergate change event due to an
unresolved host."
+ + "\nPreferences Node: " + prefs
+ + "\nHost path: " + prefs.get( "base", null );
+ getLogger().log( Level.SEVERE, error, uhe );
+ }
+ catch( IOException ioe )
+ {
+ final String error =
+ "Unable to propergate change event due to an
unexpected IO error."
+ + "\nPreferences Node: " + prefs;
+ getLogger().log( Level.SEVERE, error, ioe );
}
}
+ }
+ }
- // TODO: construct a set of keys that correspond to changed
values
-
- m_available = m_base != null;
- if( notify )
+ private RequestIdentifier resolveRequestIdentifier( URL base,
Preferences prefs )
+ {
+ String scheme = prefs.get( "scheme", "" );
+ String prompt = prefs.get( "prompt", "" );
+ String protocol = base.getProtocol();
+ String host = base.getHost();
+ int port = base.getPort();
+ if( port == 0 )
+ {
+ if( protocol.equals( "http" ) )
+ {
+ port = HTTP_PORT;
+ }
+ else if( protocol.equals( "ftp" ) )
+ {
+ port = FTP_PORT;
+ }
+ else if( protocol.equals( "https" ) )
{
- HostChangeEvent event = new HostChangeEvent( this, keys );
- super.enqueueEvent( event );
+ port = HTTPS_PORT;
}
}
+ return new RequestIdentifier( host, port, protocol, scheme, prompt );
+ }
+
+ private PasswordAuthentication resolvePasswordAuthentication(
Preferences prefs )
+ {
+ String username = prefs.get( "username", "" );
+ String password = prefs.get( "password", "" );
+ return new PasswordAuthentication( username, password.toCharArray()
);
}
//----------------------------------------------------------------------
@@ -193,7 +259,10 @@
*/
public int getPriority()
{
- return m_priority;
+ synchronized( this )
+ {
+ return m_priority;
+ }
}
/**
@@ -267,20 +336,32 @@
return m_trusted;
}
}
-
+
/**
- * Return the host authenticator.
- * @return the authenticator
+ * Return the host password authentication credentials.
+ * @return the password authentication credentials
*/
- public Authenticator getAuthenticator()
+ public PasswordAuthentication getAuthentication()
{
synchronized( this )
{
- return m_authenticator;
+ return m_authentication;
}
}
/**
+ * Return the host request identifier.
+ * @return the identifier
+ */
+ public RequestIdentifier getRequestIdentifier()
+ {
+ synchronized( this )
+ {
+ return m_identifier;
+ }
+ }
+
+ /**
* Return the location resolver plugin uri.
* @return the uri of the location resolver plugin
*/
@@ -324,6 +405,18 @@
{
processHostChangeEvent( (HostChangeEvent) event );
}
+ else if( event instanceof EnabledEvent )
+ {
+ processEnabledEvent( (EnabledEvent) event );
+ }
+ else if( event instanceof TrustedEvent )
+ {
+ processTrustedEvent( (TrustedEvent) event );
+ }
+ else if( event instanceof PriorityEvent )
+ {
+ processPriorityEvent( (PriorityEvent) event );
+ }
else
{
final String error =
@@ -333,8 +426,85 @@
}
}
+ private void processEnabledEvent( EnabledEvent event )
+ {
+ HostListener[] listeners = getHostListeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ HostListener listener = listeners[i];
+ try
+ {
+ listener.enabledStateChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "HostListener enabled status change notification error.";
+ getLogger().log( Level.SEVERE, error, e );
+ }
+ }
+ }
+
+ private void processTrustedEvent( TrustedEvent event )
+ {
+ HostListener[] listeners = getHostListeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ HostListener listener = listeners[i];
+ try
+ {
+ listener.trustedStateChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "HostListener trusted status change notification error.";
+ getLogger().log( Level.SEVERE, error, e );
+ }
+ }
+ }
+
+ private void processPriorityEvent( PriorityEvent event )
+ {
+ HostListener[] listeners = getHostListeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ HostListener listener = listeners[i];
+ try
+ {
+ listener.priorityChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "HostListener priority change notification error.";
+ getLogger().log( Level.SEVERE, error, e );
+ }
+ }
+ }
+
private void processHostChangeEvent( HostChangeEvent event )
{
+ HostListener[] listeners = getHostListeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ HostListener listener = listeners[i];
+ try
+ {
+ listener.hostChanged( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "HostListener change notification error.";
+ getLogger().log( Level.SEVERE, error, e );
+ }
+ }
+ }
+
+ private HostListener[] getHostListeners()
+ {
+ ArrayList list = new ArrayList();
EventListener[] listeners = super.listeners();
for( int i=0; i<listeners.length; i++ )
{
@@ -342,18 +512,36 @@
if( eventListener instanceof HostListener )
{
HostListener listener = (HostListener) eventListener;
- try
- {
- listener.hostChanged( event );
- }
- catch( Throwable e )
- {
- final String error =
- "HostListener change notification error.";
- getLogger().log( Level.SEVERE, error, e );
- }
+ list.add( listener );
}
}
+ return (HostListener[]) list.toArray( new HostListener[0] );
+ }
+
+ //
------------------------------------------------------------------------
+ // static (utils)
+ //
------------------------------------------------------------------------
+
+ static class HostEnabledEvent extends HostEvent
+ {
+ private boolean m_enabled;
+
+ /**
+ * Creation of a new HostEnabledEvent.
+ *
+ * @param source the object initiating the event
+ * @param plugin the plugin uri
+ */
+ public HostEnabledEvent( HostModel source, boolean enabled )
+ {
+ super( source );
+ m_enabled = enabled;
+ }
+
+ public boolean isEnabled()
+ {
+ return m_enabled;
+ }
}
static class HostPluginChangeEvent extends PluginChangeEvent
@@ -370,5 +558,19 @@
}
}
+ /**
+ * HTTP port number.
+ */
+ private static final int HTTP_PORT = 80;
+
+ /**
+ * FTP port number.
+ */
+ private static final int FTP_PORT = 21;
+
+ /**
+ * HTTPS port number.
+ */
+ private static final int HTTPS_PORT = 443;
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/RegistryManager.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/RegistryManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/RegistryManager.java
Fri May 20 22:43:11 2005
@@ -136,7 +136,7 @@
/**
* Add a regstry change listener.
- * @param the registry change listener to add
+ * @param listener the registry change listener to add
*/
public void addRegistryListener( RegistryListener listener )
{
@@ -145,7 +145,7 @@
/**
* Remove a regstry change listener.
- * @param the registry change listener to remove
+ * @param listener the registry change listener to remove
*/
public void removeRegistryListener( RegistryListener listener )
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheListener.java
Fri May 20 22:43:11 2005
@@ -32,12 +32,12 @@
* Notify the listener of the addition of a new host.
* @param event the host added event
*/
- void hostAdded( HostEvent event );
+ void hostAdded( HostNodeEvent event );
/**
* Notify the listener of the removal of a host.
* @param event the host removed event
*/
- void hostRemoved( HostEvent event );
+ void hostRemoved( HostNodeEvent event );
}
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
Fri May 20 22:43:11 2005
@@ -41,13 +41,13 @@
/**
* Add a content listener to the director.
- * @param the listener to add
+ * @param listener the listener to add
*/
void addContentListener( ContentListener listener );
/**
* Remove a content listener from the director.
- * @param the listener to remove
+ * @param listener the listener to remove
*/
void removeContentListener( ContentListener listener );
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/EnabledEvent.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/EnabledEvent.java
Fri May 20 22:43:11 2005
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+public class EnabledEvent extends HostEvent
+{
+ private final boolean m_enabled;
+
+ public EnabledEvent( HostModel host, boolean enabled )
+ {
+ super( host );
+ m_enabled = enabled;
+ }
+
+ public boolean isEnabled()
+ {
+ return m_enabled;
+ }
+}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostChangeEvent.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostChangeEvent.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostChangeEvent.java
Fri May 20 22:43:11 2005
@@ -18,20 +18,47 @@
package net.dpml.transit.model;
+import java.net.URL;
import java.util.EventObject;
+import java.net.PasswordAuthentication;
-public class HostChangeEvent extends EventObject
+import net.dpml.transit.network.RequestIdentifier;
+
+public class HostChangeEvent extends HostEvent
{
- private final String[] m_features;
+ private final URL m_base;
+ private final URL m_index;
+ private final RequestIdentifier m_identifier;
+ private final PasswordAuthentication m_authentication;
- public HostChangeEvent( HostModel host, String[] features )
+ public HostChangeEvent(
+ HostModel host, URL base, URL index,
+ RequestIdentifier identifier, PasswordAuthentication auth )
{
super( host );
- m_features = features;
+ m_base = base;
+ m_index = index;
+ m_identifier = identifier;
+ m_authentication = auth;
}
- public String[] getFeatureNames()
+ public URL getBaseURL()
+ {
+ return m_base;
+ }
+
+ public URL getIndexURL()
+ {
+ return m_index;
+ }
+
+ public RequestIdentifier getRequestIdentifier()
+ {
+ return m_identifier;
+ }
+
+ public PasswordAuthentication getPasswordAuthentication()
{
- return m_features;
+ return m_authentication;
}
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostEvent.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostEvent.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostEvent.java
Fri May 20 22:43:11 2005
@@ -24,10 +24,10 @@
{
private final HostModel m_host;
- public HostEvent( CacheModel source, HostModel host )
+ public HostEvent( HostModel source )
{
super( source );
- m_host = host;
+ m_host = source;
}
public HostModel getHostModel()
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostListener.java
Fri May 20 22:43:11 2005
@@ -33,5 +33,24 @@
* @param event the host change event
*/
void hostChanged( HostChangeEvent event );
+
+ /**
+ * Notify a consumer of a change to the enabled state.
+ * @param event the host event
+ */
+ void enabledStateChanged( EnabledEvent event );
+
+ /**
+ * Notify a consumer of a change to the trusted state.
+ * @param event the host event
+ */
+ void trustedStateChanged( TrustedEvent event );
+
+ /**
+ * Notify a consumer of a change to the host priority.
+ * @param event the host event
+ */
+ void priorityChanged( PriorityEvent event );
+
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostModel.java
Fri May 20 22:43:11 2005
@@ -21,6 +21,9 @@
import java.net.URL;
import java.net.URI;
import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+
+import net.dpml.transit.network.RequestIdentifier;
/**
* The HostModel interface is implemented by objects that control the
@@ -94,10 +97,16 @@
boolean getTrusted();
/**
- * Return the host authenticator.
- * @return the authenticator
+ * Return the host password authentication credentials.
+ * @return the password authentication credentials
+ */
+ public PasswordAuthentication getAuthentication();
+
+ /**
+ * Return the host request identifier.
+ * @return the identifier
*/
- public Authenticator getAuthenticator();
+ public RequestIdentifier getRequestIdentifier();
/**
* Return the location resolver plugin uri.
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostNodeEvent.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/HostNodeEvent.java
Fri May 20 22:43:11 2005
@@ -0,0 +1,37 @@
+/*
+ * 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;
+
+import java.util.EventObject;
+
+public abstract class HostNodeEvent extends EventObject
+{
+ private final HostModel m_host;
+
+ public HostNodeEvent( CacheModel source, HostModel host )
+ {
+ super( source );
+ m_host = host;
+ }
+
+ public HostModel getHostModel()
+ {
+ return m_host;
+ }
+}
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/NameChangeEvent.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/NameChangeEvent.java
Fri May 20 22:43:11 2005
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+public class NameChangeEvent extends HostEvent
+{
+ private final String m_name;
+
+ public NameChangeEvent( HostModel host, String name )
+ {
+ super( host );
+ m_name = name;
+ }
+
+ public String getName()
+ {
+ return m_name;
+ }
+}
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/PriorityEvent.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/PriorityEvent.java
Fri May 20 22:43:11 2005
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+public class PriorityEvent extends HostEvent
+{
+ private final int m_priority;
+
+ public PriorityEvent( HostModel host, int priority )
+ {
+ super( host );
+ m_priority = priority;
+ }
+
+ public int getPriority()
+ {
+ return m_priority;
+ }
+}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryListener.java
Fri May 20 22:43:11 2005
@@ -28,14 +28,14 @@
public interface RegistryListener extends EventListener
{
/**
- * Notify all listeners of the addition of a content director.
- * @param the registry event
+ * Notify all listeners of the addition of a content model.
+ * @param event the registry event
*/
void contentAdded( RegistryEvent event );
/**
- * Notify all listeners of the removal of a content director.
- * @param the registry event
+ * Notify all listeners of the removal of a content model.
+ * @param event the registry event
*/
void contentRemoved( RegistryEvent event );
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/RegistryModel.java
Fri May 20 22:43:11 2005
@@ -35,13 +35,13 @@
/**
* Add a regstry change listener.
- * @param the registry change listener to add
+ * @param listener the registry change listener to add
*/
void addRegistryListener( RegistryListener listener );
/**
* Remove a regstry change listener.
- * @param the registry change listener to remove
+ * @param listener the registry change listener to remove
*/
void removeRegistryListener( RegistryListener listener );
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/TrustedEvent.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/TrustedEvent.java
Fri May 20 22:43:11 2005
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+public class TrustedEvent extends HostEvent
+{
+ private final boolean m_trusted;
+
+ public TrustedEvent( HostModel host, boolean trusted )
+ {
+ super( host );
+ m_trusted = trusted;
+ }
+
+ public boolean isTrusted()
+ {
+ return m_trusted;
+ }
+}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/network/TransitAuthenticatorImpl.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/network/TransitAuthenticatorImpl.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/network/TransitAuthenticatorImpl.java
Fri May 20 22:43:11 2005
@@ -48,6 +48,21 @@
/**
* Creation of a new simple authenticator.
+ * @param authenticator a password authenticator
+ * @exception NullArgumentException if either the authenticator argument
is null
+ */
+ public TransitAuthenticatorImpl( PasswordAuthentication authenticator )
+ throws NullArgumentException
+ {
+ if( authenticator == null )
+ {
+ throw new NullArgumentException( "authenticator" );
+ }
+ m_authentication = authenticator;
+ }
+
+ /**
+ * Creation of a new simple authenticator.
* @param username the username
* @param password the password
* @exception NullArgumentException if either the username or password
argument is null
- svn commit: r2638 - in development/main/transit/core/handler/src/main/net/dpml/transit: cache content host manager model network, mcconnell, 05/20/2005
Archive powered by MHonArc 2.6.24.