Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2865 - in development/main: depot/console depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs depot/prefs/src/main/net/dpml/depot/prefs depot/station depot/station/src/main/net/dpml/depot/station depot/test/mexico metro/composition/content/src/main/net/dpml/composition/content metro/composition/control/src/main/net/dpml/composition/control metro/composition/part metro/composition/part/src/main/net/dpml/composition/part metro/parts/src/main/net/dpml/parts/control transit/core/handler transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/artifact transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/network transit/core/handler/src/main/net/dpml/transit/repository transit/core/handler/src/main/net/dpml/transit/runtime transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/test/net/dpml/transit/manager

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2865 - in development/main: depot/console depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs depot/prefs/src/main/net/dpml/depot/prefs depot/station depot/station/src/main/net/dpml/depot/station depot/test/mexico metro/composition/content/src/main/net/dpml/composition/content metro/composition/control/src/main/net/dpml/composition/control metro/composition/part metro/composition/part/src/main/net/dpml/composition/part metro/parts/src/main/net/dpml/parts/control transit/core/handler transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/artifact transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/network transit/core/handler/src/main/net/dpml/transit/repository transit/core/handler/src/main/net/dpml/transit/runtime transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/test/net/dpml/transit/manager
  • Date: Fri, 17 Jun 2005 05:54:23 -0400

Author: mcconnell AT dpml.net
Date: Fri Jun 17 05:54:23 2005
New Revision: 2865

Added:

development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
- copied, changed from r2860,
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.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
- copied, changed from r2860,
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/Connection.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/AbstractLayout.java
Removed:

development/main/metro/composition/part/src/main/net/dpml/composition/part/CompositionControllerContext.java

development/main/metro/parts/src/main/net/dpml/parts/control/TempDirectoryChangeEvent.java

development/main/metro/parts/src/main/net/dpml/parts/control/WorkingDirectoryChangeEvent.java
Modified:
development/main/depot/console/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/DepotListener.java

development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java

development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
development/main/depot/prefs/build.xml

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheDirectoryPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheModelPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheTableModel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryModelPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryTableModel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutComboBoxModel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryModelPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryTableModel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginModelPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyExcludesTableModel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyFeaturesPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyModelPanel.java
development/main/depot/station/build.xml

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/StationProfile.java

development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
development/main/depot/test/mexico/build.xml

development/main/metro/composition/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
development/main/metro/composition/part/build.xml

development/main/metro/composition/part/src/main/net/dpml/composition/part/CompositionContentHandler.java

development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContext.java

development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContextListener.java
development/main/transit/core/handler/build.xml

development/main/transit/core/handler/src/main/net/dpml/transit/SecuredTransitContext.java

development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java

development/main/transit/core/handler/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java

development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/home/TransitHome.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/CacheModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseListener.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseModel.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/ContentRegistryListener.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryModel.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/Disposable.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/DisposalListener.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/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/LayoutListener.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryListener.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/Model.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyListener.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/model/TransitModel.java

development/main/transit/core/handler/src/main/net/dpml/transit/network/RequestIdentifier.java

development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/CacheHandler.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultCacheHandler.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultContentRegistry.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultLayoutRegistry.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultResourceHost.java

development/main/transit/core/handler/src/main/net/dpml/transit/runtime/EclipseLayout.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/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
Log:
Updates to Transit, Depot and Metro to support remote access to a transit
model.

Modified: development/main/depot/console/build.xml
==============================================================================
--- development/main/depot/console/build.xml (original)
+++ development/main/depot/console/build.xml Fri Jun 17 05:54:23 2005
@@ -25,6 +25,14 @@
<filter token="DEPOT-PREFS-URI" value="${prefs.plugin}" />
</target>

+ <target name="build" depends="standard.build">
+ <rmic base="${basedir}/target/classes">
+ <include name="**/DefaultProfile.class"/>
+ <include name="**/DefaultApplicationProfile.class"/>
+ <include name="**/DefaultDepotModel.class"/>
+ </rmic>
+ </target>
+
<target name="install" depends="standard.install,win32-exe-install">
<echo>

#----------------------------------------------------------------------------------

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 Fri
Jun 17 05:54:23 2005
@@ -42,6 +42,7 @@
import net.dpml.transit.adapter.LoggingAdapter;
import net.dpml.transit.home.TransitHome;
import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;
import net.dpml.transit.model.UnknownKeyException;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.repository.Repository;
@@ -50,7 +51,7 @@
import net.dpml.depot.lang.DPML;
import net.dpml.depot.lang.DepotClassLoader;
import net.dpml.depot.profile.ApplicationProfile;
-import net.dpml.depot.profile.ApplicationProfile.Connection;
+import net.dpml.depot.profile.DefaultApplicationProfile;
import net.dpml.depot.profile.DepotModel;
import net.dpml.depot.profile.DepotStorage;
import net.dpml.depot.profile.Profile;
@@ -233,14 +234,14 @@
URI uri = profile.getCodeBaseURI();
try
{
+ String id = profile.getID();
TransitModel model = loadTransitModel( args, logger );
Transit transit = Transit.getInstance( model );
- Logger log = profile.getLogger();
+ Logger log = logger.getChildLogger( id );
Repository loader = transit.getRepository();
Object object = loader.getPlugin( system, uri, new Object[]{
args, manager, model, log } );
if( registry != null )
{
- String id = profile.getID();
registry.bind( id, (Remote) object );
if( null == connection.getHost() )
{
@@ -368,7 +369,7 @@
URI uri = new URI( "@DEPOT-PREFS-URI@" );
String title = "Depot Preferences";
boolean command = false;
- return new ApplicationProfile( log, creation, id, title, null,
command, null, uri );
+ return new DefaultApplicationProfile( log, creation, id, title,
null, command, null, uri );
}
catch( Exception e )
{
@@ -390,8 +391,8 @@
URI uri = new URI( "@STATION-PLUGIN-URI@" );
String title = "Depot Station";
boolean command = false;
- ApplicationProfile.Connection connection = new
ApplicationProfile.Connection();
- return new ApplicationProfile( log, creation, id, title, null,
command, connection, uri );
+ Connection connection = new Connection();
+ return new DefaultApplicationProfile( log, creation, id, title,
null, command, connection, uri );
}
catch( Exception e )
{
@@ -468,6 +469,13 @@
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();
+ }
}

private static DepotClassLoader getSystemClassLoader()

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
Fri Jun 17 05:54:23 2005
@@ -19,108 +19,30 @@
package net.dpml.depot.profile;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Properties;
import java.util.Date;

-import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;
import net.dpml.transit.home.Home;

/**
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class ApplicationProfile extends Profile
+public interface ApplicationProfile extends Profile
{
- private boolean m_enabled;
- private boolean m_command;
- private Connection m_connection;
-
- public ApplicationProfile(
- Logger logger, Date creation, String id, String title,
- Properties properties, boolean command, Connection connection, URI uri
)
- {
- this( logger, creation, null, id, title, properties, command,
connection, uri, true );
- }
-
- public ApplicationProfile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
- Properties properties, boolean command, Connection connection, URI
uri, boolean enabled )
- {
- super( logger, creation, home, id, title, properties, uri );
-
- m_enabled = enabled;
- m_connection = connection;
- m_command = command;
- }
-
- //----------------------------------------------------------------------
- // impl
- //----------------------------------------------------------------------
-
- public boolean isEnabled()
- {
- return m_enabled;
- }
-
- public void setEnabled( boolean value )
- {
- m_enabled = value;
- }
-
- public boolean getCommandPolicy()
- {
- return m_command;
- }
-
- public void setCommandPolicy( boolean policy )
- {
- m_command = policy;
- }
-
- public Connection getConnection()
- {
- return m_connection;
- }
-
- public void setConnection( Connection connection )
- {
- m_connection = connection;
- }
-
- public static class Connection
- {
- private String m_host;
- private int m_port;
-
- public Connection()
- {
- this( null, 1099 );
- }
-
- public Connection( String host, int port )
- {
- m_host = host;
- m_port = port;
- }
-
- public String getHost()
- {
- return m_host;
- }
-
- public void setHost( String host )
- {
- m_host = host;
- }
-
- public int getPort()
- {
- return m_port;
- }
-
- public void setPort( int port )
- {
- m_port = port;
- }
- }
+ boolean isEnabled() throws RemoteException;
+
+ void setEnabled( boolean value ) throws RemoteException;
+
+ boolean getCommandPolicy() throws RemoteException;
+
+ void setCommandPolicy( boolean policy ) throws RemoteException;
+
+ Connection getConnection() throws RemoteException;
+
+ void setConnection( Connection connection ) 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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.net.URI;
import java.net.URISyntaxException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
@@ -27,9 +28,9 @@

import net.dpml.transit.home.Home;
import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;

import net.dpml.depot.profile.ProfileStorage;
-import net.dpml.depot.profile.ApplicationProfile.Connection;

/**
* A ProfileHome maintains a persistent application profile.
@@ -48,7 +49,7 @@

public ApplicationProfileStorage(
Preferences prefs, Logger logger, Date creation, boolean policy )
- throws ProfileException
+ throws ProfileException, RemoteException
{
super( prefs, logger, creation, policy );

@@ -59,8 +60,9 @@
boolean command = getCommandPolicy();
boolean enabled = getEnabled();
URI uri = getPluginURI();
+
m_profile =
- new ApplicationProfile(
+ new DefaultApplicationProfile(
logger, creation, this, id, title, properties, command,
connection, uri, enabled );
}

@@ -126,7 +128,9 @@
Preferences prefs = root.node( "connection" );
String host = prefs.get( "host", null );
int port = prefs.getInt( "port", 1099 );
- return new Connection( host, port );
+ boolean optional = prefs.getBoolean( "optional", true );
+ boolean enabled = prefs.getBoolean( "enabled", true );
+ return new Connection( host, port, optional, enabled );
}
}
catch( BackingStoreException e )

Copied:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
(from r2860,
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/DefaultApplicationProfile.java
Fri Jun 17 05:54:23 2005
@@ -19,32 +19,36 @@
package net.dpml.depot.profile;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Properties;
import java.util.Date;

-import net.dpml.transit.model.Logger;
import net.dpml.transit.home.Home;
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;

/**
- * A ProfileModel maintains information about the configuration
+ * A DefaultApplicationProfile maintains information about the configuration
* of an application profile.
*/
-public class ApplicationProfile extends Profile
+public class DefaultApplicationProfile extends DefaultProfile implements
ApplicationProfile
{
private boolean m_enabled;
private boolean m_command;
private Connection m_connection;

- public ApplicationProfile(
+ public DefaultApplicationProfile(
Logger logger, Date creation, String id, String title,
- Properties properties, boolean command, Connection connection, URI uri
)
+ Properties properties, boolean command, Connection connection, URI uri
)
+ throws RemoteException
{
this( logger, creation, null, id, title, properties, command,
connection, uri, true );
}

- public ApplicationProfile(
+ public DefaultApplicationProfile(
Logger logger, Date creation, ProfileHome home, String id, String
title,
Properties properties, boolean command, Connection connection, URI
uri, boolean enabled )
+ throws RemoteException
{
super( logger, creation, home, id, title, properties, uri );

@@ -57,27 +61,27 @@
// impl
//----------------------------------------------------------------------

- public boolean isEnabled()
+ public boolean isEnabled() throws RemoteException
{
return m_enabled;
}

- public void setEnabled( boolean value )
+ public void setEnabled( boolean value ) throws RemoteException
{
m_enabled = value;
}

- public boolean getCommandPolicy()
+ public boolean getCommandPolicy() throws RemoteException
{
return m_command;
}

- public void setCommandPolicy( boolean policy )
+ public void setCommandPolicy( boolean policy ) throws RemoteException
{
m_command = policy;
}

- public Connection getConnection()
+ public Connection getConnection() throws RemoteException
{
return m_connection;
}
@@ -87,40 +91,4 @@
m_connection = connection;
}

- public static class Connection
- {
- private String m_host;
- private int m_port;
-
- public Connection()
- {
- this( null, 1099 );
- }
-
- public Connection( String host, int port )
- {
- m_host = host;
- m_port = port;
- }
-
- public String getHost()
- {
- return m_host;
- }
-
- public void setHost( String host )
- {
- m_host = host;
- }
-
- public int getPort()
- {
- return m_port;
- }
-
- public void setPort( int port )
- {
- m_port = port;
- }
- }
}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
Fri Jun 17 05:54:23 2005
@@ -0,0 +1,217 @@
+/*
+ * 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.depot.profile;
+
+import java.net.URI;
+import java.rmi.RemoteException;
+import java.util.Properties;
+import java.util.Date;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.EventListener;
+
+import net.dpml.transit.home.Home;
+import net.dpml.transit.model.DefaultModel;
+import net.dpml.transit.model.DuplicateKeyException;
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.UnknownKeyException;
+
+/**
+ * A ProfileModel maintains information about the configuration
+ * of an application profile.
+ */
+public class DefaultDepotModel extends DefaultModel implements DepotModel
+{
+ private final Home m_home;
+
+ private final List m_list = Collections.synchronizedList( new
LinkedList() );
+
+ public DefaultDepotModel( Logger logger, Date creation, Home home,
ApplicationProfile[] profiles )
+ throws NullPointerException, ProfileException, RemoteException
+ {
+ super( logger, creation );
+
+ m_home = home;
+
+ for( int i=0; i<profiles.length; i++ )
+ {
+ ApplicationProfile profile = profiles[i];
+ try
+ {
+ addApplicationProfile( profile, false );
+ }
+ catch( DuplicateKeyException e )
+ {
+ final String error =
+ "Cannot construct depot profile due to a duplicate
application key.";
+ throw new ProfileException( error, e );
+ }
+ }
+ }
+
+ public void addApplicationProfile( ApplicationProfile profile )
+ throws DuplicateKeyException, RemoteException
+ {
+ addApplicationProfile( profile, true );
+ }
+
+ public void removeApplicationProfile( ApplicationProfile profile )
throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ profile.dispose();
+ m_list.remove( profile );
+ ProfileRemovedEvent event = new ProfileRemovedEvent( this,
profile );
+ super.enqueueEvent( event );
+ }
+ }
+
+ public ApplicationProfile[] getApplicationProfiles() throws
RemoteException
+ {
+ synchronized( m_lock )
+ {
+ return (ApplicationProfile[]) m_list.toArray( new
ApplicationProfile[0] );
+ }
+ }
+
+ public ApplicationProfile getApplicationProfile( String key ) throws
UnknownKeyException, RemoteException
+ {
+ ApplicationProfile[] profiles = getApplicationProfiles();
+ for( int i=0; i<profiles.length; i++ )
+ {
+ ApplicationProfile profile = profiles[i];
+ if( key.equals( profile.getID() ) )
+ {
+ return profile;
+ }
+ }
+ throw new UnknownKeyException( key );
+ }
+
+ /**
+ * Add a depot content change listener.
+ * @param listener the registry change listener to add
+ */
+ public void addDepotListener( DepotListener listener ) throws
RemoteException
+ {
+ super.addListener( listener );
+ }
+
+ /**
+ * Remove a depot content change listener.
+ * @param listener the registry change listener to remove
+ */
+ public void removeDepotListener( DepotListener listener ) throws
RemoteException
+ {
+ super.removeListener( listener );
+ }
+
+ protected void processEvent( EventObject event )
+ {
+ if( event instanceof DepotEvent )
+ {
+ processDepotEvent( (DepotEvent) event );
+ }
+ else
+ {
+ super.processEvent( event );
+ }
+ }
+
+ private void addApplicationProfile( ApplicationProfile profile, boolean
notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ synchronized( m_lock )
+ {
+ String key = profile.getID();
+ try
+ {
+ ApplicationProfile current = getApplicationProfile( key );
+ throw new DuplicateKeyException( key );
+ }
+ catch( UnknownKeyException e )
+ {
+ m_list.add( profile );
+ if( notify )
+ {
+ ProfileAddedEvent event = new ProfileAddedEvent( this,
profile );
+ enqueueEvent( event );
+ }
+ }
+ }
+ }
+
+ private void processDepotEvent( DepotEvent event )
+ {
+ EventListener[] listeners = super.listeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ EventListener listener = listeners[i];
+ if( listener instanceof DepotListener )
+ {
+ DepotListener rl = (DepotListener) listener;
+ if( event instanceof ProfileAddedEvent )
+ {
+ try
+ {
+ rl.profileAdded( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "DepotListener profile addition notification
error.";
+ getLogger().error( error, e );
+ }
+ }
+ else if( event instanceof ProfileRemovedEvent )
+ {
+ try
+ {
+ rl.profileRemoved( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "DepotListener profile removed notification
error.";
+ getLogger().error( error, e );
+ }
+ }
+ }
+ }
+ }
+
+ static class ProfileAddedEvent extends DepotEvent
+ {
+ public ProfileAddedEvent( DepotModel source, ApplicationProfile
profile )
+ {
+ super( source, profile );
+ }
+ }
+
+ static class ProfileRemovedEvent extends DepotEvent
+ {
+ public ProfileRemovedEvent( DepotModel source, ApplicationProfile
profile )
+ {
+ super( source, profile );
+ }
+ }
+
+}

Copied:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
(from r2860,
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java)
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.depot.profile;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Properties;
import java.util.Date;
import java.util.EventObject;
@@ -32,7 +33,7 @@
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class Profile extends DisposableCodeBaseModel
+public class DefaultProfile extends DisposableCodeBaseModel implements
Profile
{
private final ProfileHome m_home;
private final String m_id;
@@ -40,9 +41,9 @@
private String m_title;
private Properties m_properties;

- public Profile(
+ public DefaultProfile(
Logger logger, Date creation, ProfileHome home, String id, String
title,
- Properties properties, URI uri )
+ Properties properties, URI uri ) throws RemoteException
{
super( logger, creation, home, uri );

@@ -52,27 +53,27 @@
m_home = home;
}

- public String getID()
+ public String getID() throws RemoteException
{
return m_id;
}

- public String getTitle()
+ public String getTitle() throws RemoteException
{
return m_title;
}

- public void setTitle( String title )
+ public void setTitle( String title ) throws RemoteException
{
m_title = title;
}

- public Properties getSystemProperties()
+ public Properties getSystemProperties() throws RemoteException
{
return m_properties;
}

- public void setSystemProperties( Properties properties )
+ public void setSystemProperties( Properties properties ) throws
RemoteException
{
m_properties = properties;
}
@@ -81,7 +82,7 @@
// Disposable
//----------------------------------------------------------------------

- public void dispose()
+ public void dispose() throws RemoteException
{
super.dispose();
if( null != m_home )

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotListener.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotListener.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotListener.java
Fri Jun 17 05:54:23 2005
@@ -18,23 +18,25 @@

package net.dpml.depot.profile;

+import java.rmi.Remote;
+import java.rmi.RemoteException;
import java.util.EventListener;

/**
* A ProxyListener maintains information about the configuration of
* tranist proxy settings.
*/
-public interface DepotListener extends EventListener
+public interface DepotListener extends EventListener, Remote
{
/**
* Notify the listener of the addition of a new application profile.
* @param event the depot event
*/
- void profileAdded( DepotEvent event );
+ void profileAdded( DepotEvent event ) throws RemoteException;

/**
* Notify a listener of the removal of an application profile.
* @param event the depot event
*/
- void profileRemoved( DepotEvent event );
+ void profileRemoved( DepotEvent event ) throws RemoteException;
}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
Fri Jun 17 05:54:23 2005
@@ -18,198 +18,36 @@

package net.dpml.depot.profile;

-import java.net.URI;
-import java.util.Properties;
-import java.util.Date;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Collections;
-import java.util.EventObject;
-import java.util.EventListener;
+import java.rmi.RemoteException;

-import net.dpml.transit.home.Home;
-import net.dpml.transit.model.DefaultModel;
+import net.dpml.transit.model.Model;
import net.dpml.transit.model.DuplicateKeyException;
-import net.dpml.transit.model.Logger;
import net.dpml.transit.model.UnknownKeyException;

/**
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class DepotModel extends DefaultModel
+public interface DepotModel extends Model
{
- private final Home m_home;
+ void addApplicationProfile( ApplicationProfile profile )
+ throws DuplicateKeyException, RemoteException;

- private final List m_list = Collections.synchronizedList( new
LinkedList() );
+ void removeApplicationProfile( ApplicationProfile profile ) throws
RemoteException;

- public DepotModel( Logger logger, Date creation, Home home,
ApplicationProfile[] profiles )
- throws NullPointerException, ProfileException
- {
- super( logger, creation );
-
- m_home = home;
-
- for( int i=0; i<profiles.length; i++ )
- {
- ApplicationProfile profile = profiles[i];
- try
- {
- addApplicationProfile( profile, false );
- }
- catch( DuplicateKeyException e )
- {
- final String error =
- "Cannot construct depot profile due to a duplicate
application key.";
- throw new ProfileException( error, e );
- }
- }
- }
-
- public void addApplicationProfile( ApplicationProfile profile ) throws
DuplicateKeyException
- {
- addApplicationProfile( profile, true );
- }
-
- public void removeApplicationProfile( ApplicationProfile profile )
- {
- synchronized( m_lock )
- {
- profile.dispose();
- m_list.remove( profile );
- ProfileRemovedEvent event = new ProfileRemovedEvent( this,
profile );
- super.enqueueEvent( event );
- }
- }
-
- public ApplicationProfile[] getApplicationProfiles()
- {
- synchronized( m_lock )
- {
- return (ApplicationProfile[]) m_list.toArray( new
ApplicationProfile[0] );
- }
- }
-
- public ApplicationProfile getApplicationProfile( String key ) throws
UnknownKeyException
- {
- ApplicationProfile[] profiles = getApplicationProfiles();
- for( int i=0; i<profiles.length; i++ )
- {
- ApplicationProfile profile = profiles[i];
- if( key.equals( profile.getID() ) )
- {
- return profile;
- }
- }
- throw new UnknownKeyException( key );
- }
+ ApplicationProfile[] getApplicationProfiles() throws RemoteException;
+
+ ApplicationProfile getApplicationProfile( String key ) throws
UnknownKeyException, RemoteException;

/**
* Add a depot content change listener.
* @param listener the registry change listener to add
*/
- public void addDepotListener( DepotListener listener )
- {
- super.addListener( listener );
- }
+ void addDepotListener( DepotListener listener ) throws RemoteException;

/**
* Remove a depot content change listener.
* @param listener the registry change listener to remove
*/
- public void removeDepotListener( DepotListener listener )
- {
- super.removeListener( listener );
- }
-
- protected void processEvent( EventObject event )
- {
- if( event instanceof DepotEvent )
- {
- processDepotEvent( (DepotEvent) event );
- }
- else
- {
- super.processEvent( event );
- }
- }
-
- private void addApplicationProfile( ApplicationProfile profile, boolean
notify )
- throws DuplicateKeyException
- {
- synchronized( m_lock )
- {
- String key = profile.getID();
- try
- {
- ApplicationProfile current = getApplicationProfile( key );
- throw new DuplicateKeyException( key );
- }
- catch( UnknownKeyException e )
- {
- m_list.add( profile );
- if( notify )
- {
- ProfileAddedEvent event = new ProfileAddedEvent( this,
profile );
- enqueueEvent( event );
- }
- }
- }
- }
-
- private void processDepotEvent( DepotEvent event )
- {
- EventListener[] listeners = super.listeners();
- for( int i=0; i<listeners.length; i++ )
- {
- EventListener listener = listeners[i];
- if( listener instanceof DepotListener )
- {
- DepotListener rl = (DepotListener) listener;
- if( event instanceof ProfileAddedEvent )
- {
- try
- {
- rl.profileAdded( event );
- }
- catch( Throwable e )
- {
- final String error =
- "DepotListener profile addition notification
error.";
- getLogger().error( error, e );
- }
- }
- else if( event instanceof ProfileRemovedEvent )
- {
- try
- {
- rl.profileRemoved( event );
- }
- catch( Throwable e )
- {
- final String error =
- "DepotListener profile removed notification
error.";
- getLogger().error( error, e );
- }
- }
- }
- }
- }
-
- static class ProfileAddedEvent extends DepotEvent
- {
- public ProfileAddedEvent( DepotModel source, ApplicationProfile
profile )
- {
- super( source, profile );
- }
- }
-
- static class ProfileRemovedEvent extends DepotEvent
- {
- public ProfileRemovedEvent( DepotModel source, ApplicationProfile
profile )
- {
- super( source, profile );
- }
- }
-
+ void removeDepotListener( DepotListener listener ) throws
RemoteException;
}

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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.net.URI;
import java.net.URISyntaxException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
@@ -46,12 +47,12 @@

public DepotStorage(
Preferences prefs, Logger logger, Date creation, boolean policy )
- throws ProfileException
+ throws ProfileException, RemoteException
{
super( prefs, logger, creation, policy );
-
+ setupTestProfile();
ApplicationProfile[] profiles = getApplicationProfiles();
- m_depot = new DepotModel( logger, creation, this, profiles );
+ m_depot = new DefaultDepotModel( logger, creation, this, profiles );
}

//
------------------------------------------------------------------------
@@ -63,7 +64,7 @@
return m_depot;
}

- private ApplicationProfile[] getApplicationProfiles() throws
ProfileException
+ private ApplicationProfile[] getApplicationProfiles() throws
ProfileException, RemoteException
{
try
{
@@ -88,7 +89,7 @@
}
}

- private ApplicationProfile createApplicationProfile( String id ) throws
ProfileException
+ private ApplicationProfile createApplicationProfile( String id ) throws
ProfileException, RemoteException
{
Preferences prefs = getPreferences().node( "profiles" ).node( id );
Logger logger = getLogger().getChildLogger( id );
@@ -99,7 +100,7 @@
return store.getApplicationProfile();
}

- private ApplicationProfile createTestProfile() throws ProfileException
+ private void setupTestProfile() throws ProfileException, RemoteException
{
String id = "test";
Date creation = getCreationDate();
@@ -109,7 +110,7 @@
prefs.put( "plugin", "@TEST-PLUGIN-URI@" );
prefs.put( "title", "Depot Station Test" );
prefs.putBoolean( "command", true );
- ApplicationProfileStorage store = new ApplicationProfileStorage(
prefs, logger, creation, policy );
- return store.getApplicationProfile();
+ //ApplicationProfileStorage store = new ApplicationProfileStorage(
prefs, logger, creation, policy );
+ //return store.getApplicationProfile();
}
}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
Fri Jun 17 05:54:23 2005
@@ -18,75 +18,26 @@

package net.dpml.depot.profile;

-import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Properties;
-import java.util.Date;
-import java.util.EventObject;
-import java.util.EventListener;

-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.DisposableCodeBaseModel;
+import net.dpml.transit.model.CodeBaseModel;
import net.dpml.transit.model.Disposable;

/**
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class Profile extends DisposableCodeBaseModel
+public interface Profile extends CodeBaseModel, Disposable
{
- private final ProfileHome m_home;
- private final String m_id;
+ String getID() throws RemoteException;

- private String m_title;
- private Properties m_properties;
+ String getTitle() throws RemoteException;

- public Profile(
- Logger logger, Date creation, ProfileHome home, String id, String
title,
- Properties properties, URI uri )
- {
- super( logger, creation, home, uri );
-
- m_id = id;
- m_title = title;
- m_properties = properties;
- m_home = home;
- }
-
- public String getID()
- {
- return m_id;
- }
-
- public String getTitle()
- {
- return m_title;
- }
-
- public void setTitle( String title )
- {
- m_title = title;
- }
-
- public Properties getSystemProperties()
- {
- return m_properties;
- }
-
- public void setSystemProperties( Properties properties )
- {
- m_properties = properties;
- }
-
- //----------------------------------------------------------------------
- // Disposable
- //----------------------------------------------------------------------
-
- public void dispose()
- {
- super.dispose();
- if( null != m_home )
- {
- m_home.remove();
- }
- }
+ void setTitle( String title ) throws RemoteException;
+
+ Properties getSystemProperties() throws RemoteException;
+
+ void setSystemProperties( Properties properties ) throws RemoteException;
}
+

Modified: development/main/depot/prefs/build.xml
==============================================================================
--- development/main/depot/prefs/build.xml (original)
+++ development/main/depot/prefs/build.xml Fri Jun 17 05:54:23 2005
@@ -6,6 +6,13 @@

<transit:import uri="artifact:template:dpml/magic/standard"/>

+ <target name="build" depends="standard.build">
+ <x:path id="build.path"/>
+ <rmic base="${basedir}/target/classes" classpathref="build.path">
+ <include name="**/*$Remote*.class"/>
+ </rmic>
+ </target>
+
<target name="package" depends="standard.package">
<x:export class="net.dpml.depot.prefs.DepotPreferencesFrame"/>
</target>

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java
Fri Jun 17 05:54:23 2005
@@ -28,6 +28,7 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -218,10 +219,11 @@
*/
public void propertyChange( PropertyChangeEvent event )
{
+
boolean flag = false;
{
boolean value = m_enabled.isSelected();
- if( m_profile.isEnabled() != value )
+ if( isProfileEnabled() != value )
{
flag = true;
}
@@ -242,7 +244,21 @@
}
catch( Throwable e )
{
- m_enabled.setSelected( m_profile.isEnabled() );
+ m_enabled.setSelected( isProfileEnabled() );
+ }
+ }
+
+ private boolean isProfileEnabled()
+ {
+ try
+ {
+ return m_profile.isEnabled();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while getting application profile
enabled state.";
+ throw new RuntimeException( error, e );
}
}

@@ -370,7 +386,7 @@

public void actionPerformed( ActionEvent event )
{
- m_enabled.setSelected( m_profile.isEnabled() );
+ m_enabled.setSelected( isProfileEnabled() );
m_base.setText( getBasePath() );
PropertyChangeEvent e =
new PropertyChangeEvent(
@@ -381,14 +397,23 @@

private String getBasePath()
{
- URI base = m_profile.getCodeBaseURI();
- if( null == base )
+ try
{
- return "";
+ URI base = m_profile.getCodeBaseURI();
+ if( null == base )
+ {
+ return "";
+ }
+ else
+ {
+ return base.toASCIIString();
+ }
}
- else
+ catch( RemoteException e )
{
- return base.toASCIIString();
+ final String error =
+ "Unexpected remote exception wyhile resolving codebase uri.";
+ throw new RuntimeException( error, e );
}
}
}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheDirectoryPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheDirectoryPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheDirectoryPanel.java
Fri Jun 17 05:54:23 2005
@@ -26,6 +26,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.File;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;

import javax.swing.AbstractAction;
import javax.swing.JButton;
@@ -47,7 +49,7 @@
*
* @author <a href="mailto:mcconnell AT osm.net";>OSM</a>
*/
-class CacheDirectoryPanel extends ClassicPanel implements CacheListener,
PropertyChangeListener
+class CacheDirectoryPanel extends ClassicPanel implements
PropertyChangeListener
{
//--------------------------------------------------------------
// static
@@ -66,9 +68,10 @@

private File m_target;

- private CacheModel m_manager;
+ private final CacheModel m_manager;

- private PropertyChangeSupport m_propertyChangeSupport;
+ private final PropertyChangeSupport m_propertyChangeSupport;
+ private final RemoteCacheListener m_cacheListener;

//--------------------------------------------------------------
// constructor
@@ -92,7 +95,8 @@
m_ok = new JButton( new OKAction( "OK" ) );
m_revert = new JButton( new RevertAction( "Undo" ) );

- m_manager.addCacheListener( this );
+ m_cacheListener = new RemoteCacheListener();
+ m_manager.addCacheListener( m_cacheListener );

if( null == cache )
{
@@ -127,41 +131,57 @@
public void dispose()
{
m_propertyChangeSupport.removePropertyChangeListener( this );
- m_manager.removeCacheListener( this );
+ try
+ {
+ m_manager.removeCacheListener( m_cacheListener );
+ }
+ catch( RemoteException e )
+ {
+ System.err.println( "CacheDirectoryPanel disposal error." );
+ e.printStackTrace();
+ }
}


//--------------------------------------------------------------------------
// CacheListener

//--------------------------------------------------------------------------

- /**
- * Notify the listener of a change to the cache directory.
- * @param event the cache directory change event
- */
- public void cacheDirectoryChanged( FileChangeEvent event )
+ private class RemoteCacheListener extends UnicastRemoteObject implements
CacheListener
{
- File cache = getCurrentCacheFile();
- String path = convertToPath( cache );
- String text = "Directory: " + path;
- m_label.setText( text );
- }
+ public RemoteCacheListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify the listener of the addition of a new host.
- * @param event the host added event
- */
- public void hostAdded( CacheEvent event )
- {
- // ignore
- }
+ /**
+ * Notify the listener of a change to the cache directory.
+ * @param event the cache directory change event
+ */
+ public void cacheDirectoryChanged( FileChangeEvent event )
+ {
+ File cache = getCurrentCacheFile();
+ String path = convertToPath( cache );
+ String text = "Directory: " + path;
+ m_label.setText( text );
+ }

- /**
- * Notify the listener of the removal of a host.
- * @param event the host removed event
- */
- public void hostRemoved( CacheEvent event )
- {
- // ignore
+ /**
+ * Notify the listener of the addition of a new host.
+ * @param event the host added event
+ */
+ public void hostAdded( CacheEvent event )
+ {
+ // ignore
+ }
+
+ /**
+ * Notify the listener of the removal of a host.
+ * @param event the host removed event
+ */
+ public void hostRemoved( CacheEvent event )
+ {
+ // ignore
+ }
}


//--------------------------------------------------------------------------
@@ -211,7 +231,16 @@
if( false == file.equals( m_target ) )
{
String path = convertToPath( m_target );
- m_manager.setCacheDirectory( new File( path ) );
+ try
+ {
+ m_manager.setCacheDirectory( new File( path ) );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to set cache directory due to a remote
exception.";
+ throw new RuntimeException( error, e );
+ }
}
}
m_parent.hide();
@@ -280,7 +309,16 @@

private File getCurrentCacheFile()
{
- return m_manager.getCacheDirectory();
+ try
+ {
+ return m_manager.getCacheDirectory();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while reading cache directory
value.";
+ throw new RuntimeException( error, e );
+ }
}

//--------------------------------------------------------------
@@ -288,4 +326,5 @@
//--------------------------------------------------------------

private static String CACHE_ICON_SRC =
"net/dpml/depot/prefs/images/cache.jpg";
+
}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -29,6 +29,7 @@
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.rmi.RemoteException;
import java.util.logging.Logger;
import java.util.logging.Level;

@@ -78,7 +79,7 @@
private final EditAction m_editAction;
private final JButton m_edit;
private final JButton m_delete;
- private final CacheModel m_manager;
+ private final CacheModel m_model;
private final LayoutRegistryModel m_layouts;
private final CacheAction m_cache;
private final CacheTableModel m_tableModel;
@@ -90,12 +91,12 @@
//--------------------------------------------------------------

public CacheModelPanel(
- Window parent, CacheModel manager, LayoutRegistryModel layouts )
+ Window parent, CacheModel model, LayoutRegistryModel layouts )
{
Transit.getInstance();

m_parent = parent;
- m_manager = manager;
+ m_model = model;
m_layouts = layouts;

m_editAction = new EditAction( "Edit" );
@@ -121,7 +122,7 @@
getBody().add( hostPanel );

TableColumnModel columns = createHostsColumnModel();
- m_tableModel = new CacheTableModel( manager );
+ m_tableModel = new CacheTableModel( model );
m_table = new ClassicTable( m_tableModel, columns );
m_table.addPropertyChangeListener( this );
m_table.setShowVerticalLines( false );
@@ -152,7 +153,7 @@
{
try
{
- HostModel model = m_manager.getHostModel( m_selection );
+ HostModel model = m_model.getHostModel( m_selection );
m_edit.setEnabled( true );
m_delete.setEnabled( false == model.isBootstrap() );

getRootPane().setDefaultButton( m_edit );
@@ -162,6 +163,13 @@
m_edit.setEnabled( false );
m_delete.setEnabled( false );
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Remote exception occured while interigating host
model.";
+ throw new RuntimeException( error, e );
+ }
+
}
else
{
@@ -189,7 +197,7 @@
final String title = "Resource Cache";
final Dimension size = new Dimension( 400, 160 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
- CacheDirectoryPanel panel = new CacheDirectoryPanel( dialog,
m_manager );
+ CacheDirectoryPanel panel = new CacheDirectoryPanel( dialog,
m_model );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
@@ -222,7 +230,7 @@
final Dimension size = new Dimension( 400, 240 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
PluginModelPanel panel =
- new PluginModelPanel( dialog, m_manager, m_cache,
CacheHandler.class );
+ new PluginModelPanel( dialog, m_model, m_cache,
CacheHandler.class );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
@@ -306,7 +314,7 @@
}
try
{
- m_manager.addHostModel( name );
+ m_model.addHostModel( name );
}
catch( Throwable e )
{
@@ -340,8 +348,8 @@
final String title = "Resource Host: " + m_selection;
final Dimension size = new Dimension( 400, 360 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
- HostModel manager = m_manager.getHostModel( m_selection );
- HostModelPanel panel = new HostModelPanel( dialog, manager,
m_layouts );
+ HostModel model = m_model.getHostModel( m_selection );
+ HostModelPanel panel = new HostModelPanel( dialog, model,
m_layouts );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( source );
dialog.setResizable( false );
@@ -376,8 +384,8 @@

try
{
- HostModel host = m_manager.getHostModel( m_selection );
- m_manager.removeHostModel( host );
+ HostModel host = m_model.getHostModel( m_selection );
+ m_model.removeHostModel( host );
}
catch( Throwable e )
{

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/CacheTableModel.java
Fri Jun 17 05:54:23 2005
@@ -17,6 +17,8 @@
package net.dpml.depot.prefs;

import java.util.Arrays;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;

import javax.swing.Icon;
import javax.swing.table.AbstractTableModel;
@@ -31,7 +33,7 @@
/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
*/
-public class CacheTableModel extends AbstractTableModel implements
CacheListener
+public class CacheTableModel extends AbstractTableModel
{

//--------------------------------------------------------------------------
// static
@@ -66,6 +68,8 @@

private final CacheModel m_manager;

+ private final RemoteCacheListener m_cacheListener;
+

//--------------------------------------------------------------------------
// constructor

//--------------------------------------------------------------------------
@@ -80,14 +84,24 @@
{
super();
m_manager = manager;
- manager.addCacheListener( this );
+ try
+ {
+ m_cacheListener = new RemoteCacheListener();
+ manager.addCacheListener( m_cacheListener );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Remote exception occured while creating cache listener.";
+ throw new RuntimeException( error, e );
+ }
}

public void dispose()
{
try
{
- m_manager.removeCacheListener( this );
+ m_manager.removeCacheListener( m_cacheListener );
}
catch( Throwable e )
{
@@ -98,31 +112,39 @@
// CacheListener

//--------------------------------------------------------------------------

- /**
- * Notify the listener of a change to the cache directory.
- * @param event the cache directory change event
- */
- public void cacheDirectoryChanged( FileChangeEvent event )
+ private class RemoteCacheListener extends UnicastRemoteObject implements
CacheListener
{
- // ignore
- }
+ public RemoteCacheListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify the listener of the addition of a new host.
- * @param event the host added event
- */
- public void hostAdded( CacheEvent event )
- {
- fireTableStructureChanged();
- }
+ /**
+ * Notify the listener of a change to the cache directory.
+ * @param event the cache directory change event
+ */
+ public void cacheDirectoryChanged( FileChangeEvent event )
+ {
+ // ignore
+ }

- /**
- * Notify the listener of the removal of a host.
- * @param event the host removed event
- */
- public void hostRemoved( CacheEvent event )
- {
- fireTableStructureChanged();
+ /**
+ * Notify the listener of the addition of a new host.
+ * @param event the host added event
+ */
+ public void hostAdded( CacheEvent event )
+ {
+ fireTableStructureChanged();
+ }
+
+ /**
+ * Notify the listener of the removal of a host.
+ * @param event the host removed event
+ */
+ public void hostRemoved( CacheEvent event )
+ {
+ fireTableStructureChanged();
+ }
}


//--------------------------------------------------------------------------

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -30,6 +30,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.net.ContentHandler;
+import java.rmi.RemoteException;
import java.util.logging.Logger;
import java.util.logging.Level;

@@ -259,6 +260,15 @@
Logger logger = Logger.getLogger( "depot.prefs" );
logger.log( Level.SEVERE, error, e );
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote error while attempting to add a content
type."
+ + "\nCODEBASE: "
+ +
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
}
}


Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ContentRegistryTableModel.java
Fri Jun 17 05:54:23 2005
@@ -16,6 +16,9 @@

package net.dpml.depot.prefs;

+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
import javax.swing.Icon;
import javax.swing.table.AbstractTableModel;

@@ -27,7 +30,7 @@
/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
*/
-public class ContentRegistryTableModel extends AbstractTableModel implements
ContentRegistryListener
+public class ContentRegistryTableModel extends AbstractTableModel
{

//--------------------------------------------------------------------------
// static
@@ -62,6 +65,8 @@

private final ContentRegistryModel m_manager;

+ private final RemoteContentRegistryListener m_listener;
+

//--------------------------------------------------------------------------
// constructor

//--------------------------------------------------------------------------
@@ -76,14 +81,24 @@
{
super();
m_manager = manager;
- manager.addRegistryListener( this );
+ try
+ {
+ m_listener = new RemoteContentRegistryListener();
+ manager.addRegistryListener( m_listener );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Remote exception while establishing content registry
listener.";
+ throw new RuntimeException( error, e );
+ }
}

public void dispose()
{
try
{
- m_manager.removeRegistryListener( this );
+ m_manager.removeRegistryListener( m_listener );
}
catch( Throwable e )
{
@@ -99,22 +114,31 @@
// ContentRegistryListener

//--------------------------------------------------------------------------

- /**
- * Notify all listeners of the addition of a content model.
- * @param event the registry event
- */
- public void contentAdded( ContentRegistryEvent event )
+ private class RemoteContentRegistryListener extends UnicastRemoteObject
+ implements ContentRegistryListener
{
- fireTableStructureChanged();
- }
+ public RemoteContentRegistryListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify all listeners of the removal of a content model.
- * @param event the registry event
- */
- public void contentRemoved( ContentRegistryEvent event )
- {
- fireTableStructureChanged();
+ /**
+ * Notify all listeners of the addition of a content model.
+ * @param event the registry event
+ */
+ public void contentAdded( ContentRegistryEvent event ) throws
RemoteException
+ {
+ fireTableStructureChanged();
+ }
+
+ /**
+ * Notify all listeners of the removal of a content model.
+ * @param event the registry event
+ */
+ public void contentRemoved( ContentRegistryEvent event ) throws
RemoteException
+ {
+ fireTableStructureChanged();
+ }
}


//--------------------------------------------------------------------------

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -27,6 +27,9 @@
import java.awt.Window;
import java.awt.Frame;
import java.awt.event.ActionEvent;
+import java.rmi.RemoteException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

@@ -77,7 +80,7 @@
// constructor
//--------------------------------------------------------------

- public DepotModelPanel( Window parent, DepotModel model )
+ public DepotModelPanel( Window parent, DepotModel model ) throws
Exception
{
super();

@@ -150,6 +153,12 @@
m_edit.setEnabled( false );
m_delete.setEnabled( false );
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while resolving selected
application profile.";
+ throw new RuntimeException( error, e );
+ }
}
else
{
@@ -266,7 +275,8 @@
"Unexpected error while attempting to construct
application profile dialog."
+ "\nCODEBASE: "
+
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
- m_model.getLogger().error( error, e );
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
}
}
}
@@ -297,7 +307,8 @@
"Unexpected error while attempting to delete a application
profile."
+ "\nCODEBASE: "
+
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
- m_model.getLogger().error( error, e );
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
}
}
}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java
Fri Jun 17 05:54:23 2005
@@ -25,6 +25,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.util.logging.Logger;
+import java.util.logging.Level;

import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -114,8 +116,18 @@
new Runnable() {
public void run()
{
- m_depotPanel = new DepotModelPanel( m_window, m_depot );
- tabbedPane.addTab( "Applications", m_depotPanel );
+ try
+ {
+ m_depotPanel = new DepotModelPanel( m_window, m_depot );
+ tabbedPane.addTab( "Applications", m_depotPanel );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected during depot panel establishment.";
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
}
}
);
@@ -124,13 +136,23 @@
new Runnable() {
public void run()
{
- final CacheModel cache = m_model.getCacheModel();
- final LayoutRegistryModel layouts =
cache.getLayoutRegistryModel();
- m_layoutPanel = new LayoutRegistryModelPanel( m_window,
layouts );
- m_cachePanel = new CacheModelPanel( m_window, cache, layouts
);
- tabbedPane.addTab( "Cache", m_cachePanel );
- tabbedPane.addTab( "Layout", m_layoutPanel );
- tabbedPane.revalidate();
+ try
+ {
+ final CacheModel cache = m_model.getCacheModel();
+ final LayoutRegistryModel layouts =
cache.getLayoutRegistryModel();
+ m_layoutPanel = new LayoutRegistryModelPanel( m_window,
layouts );
+ m_cachePanel = new CacheModelPanel( m_window, cache,
layouts );
+ tabbedPane.addTab( "Cache", m_cachePanel );
+ tabbedPane.addTab( "Layout", m_layoutPanel );
+ tabbedPane.revalidate();
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected during cache panel establishment.";
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
}
}
);
@@ -139,9 +161,20 @@
new Runnable() {
public void run()
{
- final ContentRegistryModel content =
m_model.getContentRegistryModel();
- m_registryPanel = new ContentRegistryModelPanel( m_window,
content );
- tabbedPane.addTab( "Content", m_registryPanel );
+ try
+ {
+ final ContentRegistryModel content =
m_model.getContentRegistryModel();
+ m_registryPanel = new ContentRegistryModelPanel(
m_window, content );
+ tabbedPane.addTab( "Content", m_registryPanel );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected during content registry panel
establishment.";
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
+
}
}
);
@@ -150,9 +183,19 @@
new Runnable() {
public void run()
{
- final ProxyModel proxy = m_model.getProxyModel();
- m_proxyPanel = new ProxyModelPanel( m_window, proxy );
- tabbedPane.addTab( "Proxy", m_proxyPanel );
+ try
+ {
+ final ProxyModel proxy = m_model.getProxyModel();
+ m_proxyPanel = new ProxyModelPanel( m_window, proxy );
+ tabbedPane.addTab( "Proxy", m_proxyPanel );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected during proxy panel establishment.";
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
}
}
);

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java
Fri Jun 17 05:54:23 2005
@@ -16,6 +16,9 @@

package net.dpml.depot.prefs;

+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
import javax.swing.Icon;
import javax.swing.table.AbstractTableModel;

@@ -27,7 +30,7 @@
/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
*/
-public class DepotTableModel extends AbstractTableModel implements
DepotListener
+public class DepotTableModel extends AbstractTableModel
{

//--------------------------------------------------------------------------
// static
@@ -61,6 +64,7 @@
DepotTableModel.class.getClassLoader(), ICON_PATH, "Features" );

private final DepotModel m_model;
+ private final RemoteListener m_listener;


//--------------------------------------------------------------------------
// constructor
@@ -72,18 +76,19 @@
*
* @param model the registry of application profiles
*/
- public DepotTableModel( DepotModel model )
+ public DepotTableModel( DepotModel model ) throws Exception
{
super();
m_model = model;
- model.addDepotListener( this );
+ m_listener = new RemoteListener();
+ model.addDepotListener( m_listener );
}

protected void dispose()
{
try
{
- m_model.removeDepotListener( this );
+ m_model.removeDepotListener( m_listener );
}
catch( Throwable e )
{
@@ -94,22 +99,30 @@
// DepotListener

//--------------------------------------------------------------------------

- /**
- * Notify all listeners of the addition of an application profile.
- * @param event the depot event
- */
- public void profileAdded( DepotEvent event )
+ private class RemoteListener extends UnicastRemoteObject implements
DepotListener
{
- fireTableStructureChanged();
- }
+ public RemoteListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify all listeners of the removal of an application profile.
- * @param event the depot event
- */
- public void profileRemoved( DepotEvent event )
- {
- fireTableStructureChanged();
+ /**
+ * Notify all listeners of the addition of an application profile.
+ * @param event the depot event
+ */
+ public void profileAdded( DepotEvent event ) throws RemoteException
+ {
+ fireTableStructureChanged();
+ }
+
+ /**
+ * Notify all listeners of the removal of an application profile.
+ * @param event the depot event
+ */
+ public void profileRemoved( DepotEvent event ) throws RemoteException
+ {
+ fireTableStructureChanged();
+ }
}


//--------------------------------------------------------------------------

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -29,6 +29,8 @@
import java.beans.PropertyChangeSupport;
import java.net.URL;
import java.net.PasswordAuthentication;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -66,7 +68,7 @@
* @author <a href="mailto:mcconnell AT osm.net";>OSM</a>
*/
class HostModelPanel extends ClassicPanel
- implements HostListener, PropertyChangeListener, DocumentListener,
ListDataListener
+ implements PropertyChangeListener, DocumentListener, ListDataListener
{
//--------------------------------------------------------------
// static
@@ -79,7 +81,7 @@
//--------------------------------------------------------------

private final JDialog m_parent;
- private final HostModel m_manager;
+ private final HostModel m_model;
private final LayoutRegistryModel m_layouts;

private JLabel m_label;
@@ -92,29 +94,31 @@
private CredentialsAction m_credentials;
private PasswordAuthentication m_auth;

- private PropertyChangeSupport m_propertyChangeSupport;
+ private final PropertyChangeSupport m_propertyChangeSupport;
+ private final RemoteHostListener m_listener;

//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------

- public HostModelPanel( JDialog parent, HostModel manager,
LayoutRegistryModel layouts ) throws Exception
+ public HostModelPanel( JDialog parent, HostModel model,
LayoutRegistryModel layouts ) throws Exception
{
super();

m_parent = parent;
- m_manager = manager;
+ m_model = model;
+ m_listener = new RemoteHostListener();
m_layouts = layouts;
- m_auth = manager.getAuthentication();
+ m_auth = model.getAuthentication();

- m_manager.addHostListener( this );
+ m_model.addHostListener( m_listener );
m_propertyChangeSupport = new PropertyChangeSupport( this );

//
// create the dialog label containing the host descriptor name
//

- String name = manager.getHostName();
+ String name = model.getHostName();
m_label =
IconHelper.createImageIconJLabel(
getClass().getClassLoader(),
@@ -188,7 +192,7 @@
border5 ) );
layoutPlusCredentials.add( layout );

- m_strategy = new LayoutComboBoxModel( m_layouts, m_manager );
+ m_strategy = new LayoutComboBoxModel( m_layouts, m_model );
m_strategy.addListDataListener( this );
JComboBox strategy = new JComboBox( m_strategy );
layout.add( strategy, BorderLayout.SOUTH );
@@ -234,7 +238,7 @@

m_enabled = new JCheckBox( new EnableAction( "Enabled" ) );
m_enabled.setBackground( Color.white );
- m_enabled.setSelected( m_manager.getEnabled() );
+ m_enabled.setSelected( m_model.getEnabled() );

JPanel enabledPanel = new JPanel();
enabledPanel.setLayout( new BorderLayout() );
@@ -247,7 +251,7 @@

m_trusted = new JCheckBox( new TrustedAction( "Trusted" ) );
m_trusted.setBackground( Color.white );
- m_trusted.setSelected( m_manager.getTrusted() );
+ m_trusted.setSelected( m_model.getTrusted() );

JPanel trustedPanel = new JPanel();
trustedPanel.setLayout( new BorderLayout() );
@@ -284,48 +288,61 @@

public void dispose()
{
- m_strategy.removeListDataListener( this );
- m_propertyChangeSupport.removePropertyChangeListener( this );
- m_base.getDocument().removeDocumentListener( this );
- m_manager.removeHostListener( this );
- m_strategy.dispose();
+ try
+ {
+ m_strategy.removeListDataListener( this );
+ m_propertyChangeSupport.removePropertyChangeListener( this );
+ m_base.getDocument().removeDocumentListener( this );
+ m_model.removeHostListener( m_listener );
+ m_strategy.dispose();
+ }
+ catch( Throwable e )
+ {
+ }
}

//--------------------------------------------------------------
// HostListener
//--------------------------------------------------------------

- /**
- * Notify a consumer of an aggregated set of changes.
- * @param event the host change event
- */
- public void hostChanged( HostChangeEvent event )
+ private class RemoteHostListener extends UnicastRemoteObject implements
HostListener
{
-
- }
+ public RemoteHostListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify a consumer of a change to the host priority.
- * @param event the host event
- */
- public void priorityChanged( HostPriorityEvent event )
- {
- }
+ /**
+ * Notify a consumer of an aggregated set of changes.
+ * @param event the host change event
+ */
+ public void hostChanged( HostChangeEvent event )
+ {
+ }

- /**
- * Notify a consumer of a change to the host priority.
- * @param event the host event
- */
- public void layoutChanged( HostLayoutEvent event )
- {
- }
+ /**
+ * Notify a consumer of a change to the host priority.
+ * @param event the host event
+ */
+ public void priorityChanged( HostPriorityEvent event )
+ {
+ }
+
+ /**
+ * Notify a consumer of a change to the host priority.
+ * @param event the host event
+ */
+ public void layoutChanged( HostLayoutEvent event )
+ {
+ }

- /**
- * Notify a consumer of a change to the availability status.
- * @param event the host event
- */
- public void nameChanged( HostNameEvent event )
- {
+ /**
+ * Notify a consumer of a change to the availability status.
+ * @param event the host event
+ */
+ public void nameChanged( HostNameEvent event )
+ {
+ }
}

//--------------------------------------------------------------
@@ -340,62 +357,71 @@
*/
public void propertyChange( PropertyChangeEvent event )
{
- boolean flag = false;
+ try
{
- boolean value = m_enabled.isSelected();
- if( m_manager.getEnabled() != value )
+ boolean flag = false;
{
- flag = true;
+ boolean value = m_enabled.isSelected();
+ if( m_model.getEnabled() != value )
+ {
+ flag = true;
+ }
}
- }
- {
- boolean value = m_trusted.isSelected();
- if( m_manager.getTrusted() != value )
{
- flag = true;
- }
- }
- {
- String path = m_base.getText();
- if( false == path.equals( getBasePath()) )
- {
- flag = true;
+ boolean value = m_trusted.isSelected();
+ if( m_model.getTrusted() != value )
+ {
+ flag = true;
+ }
}
- }
- {
- PasswordAuthentication auth = m_manager.getAuthentication();
- if( null == m_auth )
{
- if( null != auth )
+ String path = m_base.getText();
+ if( false == path.equals( getBasePath()) )
{
flag = true;
}
}
- else if( false == m_auth.equals( auth ) )
{
- flag = true;
+ PasswordAuthentication auth = m_model.getAuthentication();
+ if( null == m_auth )
+ {
+ if( null != auth )
+ {
+ flag = true;
+ }
+ }
+ else if( false == m_auth.equals( auth ) )
+ {
+ flag = true;
+ }
}
- }
- {
- LayoutModel layout = (LayoutModel) m_strategy.getSelectedItem();
- if( null != layout )
{
- if( false == layout.equals( m_manager.getLayoutModel() ) )
+ LayoutModel layout = (LayoutModel)
m_strategy.getSelectedItem();
+ if( null != layout )
{
- flag = true;
+ if( false == layout.equals( m_model.getLayoutModel() ) )
+ {
+ flag = true;
+ }
}
}
+ m_ok.setEnabled( flag );
+ m_revert.setEnabled( flag );
+ try
+ {
+ new URL( m_base.getText() );
+ m_enabled.setEnabled( true );
+ }
+ catch( Throwable e )
+ {
+ m_enabled.setSelected( m_model.getEnabled() );
+ }
}
- m_ok.setEnabled( flag );
- m_revert.setEnabled( flag );
- try
- {
- new URL( m_base.getText() );
- m_enabled.setEnabled( true );
- }
- catch( Throwable e )
+ catch( RemoteException re )
{
- m_enabled.setSelected( m_manager.getEnabled() );
+ final String error =
+ "Unexpected remote exception while interigating host model.";
+ throw new RuntimeException( error, re );
}
}

@@ -464,19 +490,29 @@
* @param e a <code>ListDataEvent</code> encapsulating the
* event information
*/
- public void contentsChanged(ListDataEvent e)
+ public void contentsChanged( ListDataEvent e )
{
Object selection = m_strategy.getSelectedItem();
if( selection instanceof LayoutModel )
{
- LayoutModel current = m_manager.getLayoutModel();
- LayoutModel model = (LayoutModel) selection;
- if( false == model.equals( current ) )
+ try
{
- PropertyChangeEvent event =
- new PropertyChangeEvent(
- this, "layout", current, model );
- m_propertyChangeSupport.firePropertyChange( event );
+ LayoutModel current = m_model.getLayoutModel();
+ LayoutModel model = (LayoutModel) selection;
+ if( false == model.equals( current ) )
+ {
+ PropertyChangeEvent event =
+ new PropertyChangeEvent(
+ this, "layout", current, model );
+ m_propertyChangeSupport.firePropertyChange( event );
+ }
+ }
+ catch( RemoteException re )
+ {
+ final String error =
+ "Remote exception ccured while interigating host model.";
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, re );
}
}
}
@@ -556,7 +592,7 @@
LayoutModel layout = (LayoutModel) m_strategy.getSelectedItem();
try
{
- m_manager.update( base, null, enabled, trusted, layout,
m_auth, "", "" );
+ m_model.update( base, null, enabled, trusted, layout,
m_auth, "", "" );
}
catch( Exception e )
{
@@ -588,11 +624,11 @@
}
try
{
- final String title = "Credentials: " +
m_manager.getHostName();
+ final String title = "Credentials: " + m_model.getHostName();
final Dimension size = new Dimension( 300, 280 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
ClassicCredentialsPanel panel =
- new ClassicCredentialsPanel( dialog,
m_manager.getAuthentication(), m_auth, this );
+ new ClassicCredentialsPanel( dialog,
m_model.getAuthentication(), m_auth, this );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
@@ -624,7 +660,7 @@
m_auth = event.getPasswordAuthentication();
PropertyChangeEvent e =
new PropertyChangeEvent(
- this, "auth", m_manager.getAuthentication(), m_auth );
+ this, "auth", null, m_auth );
m_propertyChangeSupport.firePropertyChange( e );
}
}
@@ -653,29 +689,47 @@

public void actionPerformed( ActionEvent event )
{
- m_enabled.setSelected( m_manager.getEnabled() );
- m_trusted.setSelected( m_manager.getTrusted() );
- m_strategy.setSelectedItem( m_manager.getLayoutModel() );
- m_base.setText( getBasePath() );
- m_auth = m_manager.getAuthentication();
- m_credentials.revert();
- PropertyChangeEvent e =
- new PropertyChangeEvent(
- this, "revert", null, null );
- m_propertyChangeSupport.firePropertyChange( e );
+ try
+ {
+ m_enabled.setSelected( m_model.getEnabled() );
+ m_trusted.setSelected( m_model.getTrusted() );
+ m_strategy.setSelectedItem( m_model.getLayoutModel() );
+ m_base.setText( getBasePath() );
+ m_auth = m_model.getAuthentication();
+ m_credentials.revert();
+ PropertyChangeEvent e =
+ new PropertyChangeEvent(
+ this, "revert", null, null );
+ m_propertyChangeSupport.firePropertyChange( e );
+ }
+ catch( RemoteException re )
+ {
+ final String error =
+ "Remote exception occured while updating host.";
+ throw new RuntimeException( error, re );
+ }
}
}

private String getBasePath()
{
- URL base = m_manager.getBaseURL();
- if( null == base )
+ try
{
- return "";
+ URL base = m_model.getBaseURL();
+ if( null == base )
+ {
+ return "";
+ }
+ else
+ {
+ return base.toExternalForm();
+ }
}
- else
+ catch( RemoteException e )
{
- return base.toExternalForm();
+ final String error =
+ "Remote exception while reading base url.";
+ throw new RuntimeException( error, e );
}
}
}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutComboBoxModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutComboBoxModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutComboBoxModel.java
Fri Jun 17 05:54:23 2005
@@ -17,6 +17,8 @@
package net.dpml.depot.prefs;

import java.awt.Component;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
@@ -32,14 +34,15 @@
import net.dpml.transit.model.LayoutRegistryListener;
import net.dpml.transit.model.LayoutRegistryEvent;

-class LayoutComboBoxModel extends DefaultComboBoxModel implements
LayoutRegistryListener, HostListener
+class LayoutComboBoxModel extends DefaultComboBoxModel
{

//--------------------------------------------------------------------------
// state

//--------------------------------------------------------------------------

- private final LayoutRegistryModel m_manager;
+ private final LayoutRegistryModel m_model;
private final HostModel m_host;
+ private final RemoteListener m_listener;


//--------------------------------------------------------------------------
// constructor
@@ -47,21 +50,22 @@

/**
* Creation of a new combox box containing the available set of
- * location resolvers declared by a location manager and a current
- * selection declared by a supplied host manager.
+ * location resolvers declared by a location model and a current
+ * selection declared by a supplied host model.
*
- * @param locations the layout manager
- * @param host the host manager
+ * @param locations the layout model
+ * @param host the host model
*/
- public LayoutComboBoxModel( LayoutRegistryModel manager, HostModel host )
+ public LayoutComboBoxModel( LayoutRegistryModel model, HostModel host )
throws Exception
{
- super( manager.getLayoutModels() );
+ super( model.getLayoutModels() );

- m_manager = manager;
+ m_model = model;
m_host = host;

- manager.addLayoutRegistryListener( this );
- host.addHostListener( this );
+ m_listener = new RemoteListener();
+ model.addLayoutRegistryListener( m_listener );
+ host.addHostListener( m_listener );
LayoutModel layout = host.getLayoutModel();
if( null != layout )
{
@@ -71,73 +75,91 @@

public void dispose()
{
- m_manager.removeLayoutRegistryListener( this );
- m_host.removeHostListener( this );
+ try
+ {
+ m_model.removeLayoutRegistryListener( m_listener );
+ m_host.removeHostListener( m_listener );
+ }
+ catch( Throwable e )
+ {
+ }
}

-
//--------------------------------------------------------------------------
- // LayoutRegistryListener (listen to changes to the available layouts)
-
//--------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
+ // RemoteListener
+
//------------------------------------------------------------------------------

- /**
- * Notify all listeners of the addition of a layout registry model.
- * @param event the layout registry event
- */
- public void layoutAdded( LayoutRegistryEvent event )
+ private class RemoteListener extends UnicastRemoteObject
+ implements HostListener, LayoutRegistryListener
{
- int n = m_manager.getLayoutModels().length;
- fireContentsChanged( this, 0, n );
- }
-
- /**
- * Notify all listeners of the removal of a layout model.
- * @param event the layout registry event
- */
- public void layoutRemoved( LayoutRegistryEvent event )
- {
- int n = m_manager.getLayoutModels().length;
- fireContentsChanged( this, 0, n );
- }
-
- //--------------------------------------------------------------
- // HostListener (listen for changes to the selected layout)
- //--------------------------------------------------------------
+ public RemoteListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify a consumer of an aggregated set of changes.
- * @param event the host change event
- */
- public void hostChanged( HostChangeEvent event )
- {
- }
+
//--------------------------------------------------------------------------
+ // LayoutRegistryListener (listen to changes to the available
layouts)
+
//--------------------------------------------------------------------------
+
+ /**
+ * Notify all listeners of the addition of a layout registry model.
+ * @param event the layout registry event
+ */
+ public void layoutAdded( LayoutRegistryEvent event ) throws
RemoteException
+ {
+ int n = m_model.getLayoutModels().length;
+ fireContentsChanged( this, 0, n );
+ }
+
+ /**
+ * Notify all listeners of the removal of a layout model.
+ * @param event the layout registry event
+ */
+ public void layoutRemoved( LayoutRegistryEvent event ) throws
RemoteException
+ {
+ int n = m_model.getLayoutModels().length;
+ fireContentsChanged( this, 0, n );
+ }

- /**
- * Notify a consumer of a change to the host priority.
- * @param event the host event
- */
- public void priorityChanged( HostPriorityEvent event )
- {
- }
+ //--------------------------------------------------------------
+ // HostListener (listen for changes to the selected layout)
+ //--------------------------------------------------------------
+
+ /**
+ * Notify a consumer of an aggregated set of changes.
+ * @param event the host change event
+ */
+ public void hostChanged( HostChangeEvent event ) throws
RemoteException
+ {
+ }

- /**
- * Notify a consumer of a change to the host name.
- * @param event the host event
- */
- public void nameChanged( HostNameEvent event )
- {
- }
+ /**
+ * Notify a consumer of a change to the host priority.
+ * @param event the host event
+ */
+ public void priorityChanged( HostPriorityEvent event ) throws
RemoteException
+ {
+ }
+
+ /**
+ * Notify a consumer of a change to the host name.
+ * @param event the host event
+ */
+ public void nameChanged( HostNameEvent event ) throws RemoteException
+ {
+ }

- /**
- * Notify a consumer of a change to the host priority.
- * @param event the host event
- */
- public void layoutChanged( HostLayoutEvent event )
- {
- LayoutModel layout = event.getLayoutModel();
- if( null != layout )
+ /**
+ * Notify a consumer of a change to the host priority.
+ * @param event the host event
+ */
+ public void layoutChanged( HostLayoutEvent event ) throws
RemoteException
{
- setSelectedItem( layout );
+ LayoutModel layout = event.getLayoutModel();
+ if( null != layout )
+ {
+ setSelectedItem( layout );
+ }
}
}
}
-

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -29,6 +29,8 @@
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.logging.Logger;
+import java.util.logging.Level;

import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
@@ -50,7 +52,6 @@
import net.dpml.transit.runtime.LayoutRegistry;
import net.dpml.transit.model.LayoutRegistryModel;
import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.LayoutModel;
import net.dpml.transit.model.DuplicateKeyException;
import net.dpml.transit.model.UnknownKeyException;

@@ -73,18 +74,18 @@
private JButton m_delete;
private String m_selection;

- private LayoutRegistryModel m_manager;
+ private LayoutRegistryModel m_model;
private LayoutRegistryTableModel m_tableModel;

//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------

- public LayoutRegistryModelPanel( Window parent, LayoutRegistryModel
manager )
+ public LayoutRegistryModelPanel( Window parent, LayoutRegistryModel
manager ) throws Exception
{
super();

- m_manager = manager;
+ m_model = manager;
m_parent = parent;

m_editAction = new EditAction( "Edit" );
@@ -144,7 +145,7 @@
{
try
{
- LayoutModel resolver = m_manager.getLayoutModel(
m_selection );
+ LayoutModel resolver = m_model.getLayoutModel(
m_selection );
m_edit.setEnabled( true );
if( false == resolver.isBootstrap() )
{
@@ -157,6 +158,12 @@
m_edit.setEnabled( false );
m_delete.setEnabled( false );
}
+ catch( Exception e )
+ {
+ final String error =
+ "unexpected remote exception while attempting to
resolve selected layout.";
+ throw new RuntimeException( error, e );
+ }
}
else
{
@@ -189,7 +196,7 @@
final Dimension size = new Dimension( 400, 240 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
PluginModelPanel panel =
- new PluginModelPanel( dialog, m_manager,
LayoutRegistry.class );
+ new PluginModelPanel( dialog, m_model,
LayoutRegistry.class );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
@@ -201,7 +208,8 @@
"Unexpected error while attempting to handle the
'Controller' action. "
+ "\nCODEBASE: "
+
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
- m_manager.getLogger().error( error, e );
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
}
}
}
@@ -258,15 +266,16 @@
}
try
{
- m_manager.addLayoutModel( id );
+ m_model.addLayoutModel( id );
}
- catch( DuplicateKeyException e )
+ catch( Exception e )
{
final String error =
"Unexpected error while attempting to add a new layout
model."
+ "\nCODEBASE: "
+
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
- m_manager.getLogger().error( error, e );
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
}
}
}
@@ -291,7 +300,7 @@
final String title = "Location Resolver";
final Dimension size = new Dimension( 400, 240 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
- LayoutModel manager = m_manager.getLayoutModel( m_selection
);
+ LayoutModel manager = m_model.getLayoutModel( m_selection );
if( null != manager )
{
PluginModelPanel panel =
@@ -308,7 +317,8 @@
"Unexpected error while attempting to construct plugin
dialog."
+ "\nCODEBASE: "
+
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
- m_manager.getLogger().error( error, e );
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
}
}
}
@@ -329,8 +339,8 @@
}
try
{
- LayoutModel layout = m_manager.getLayoutModel( m_selection );
- m_manager.removeLayoutModel( layout );
+ LayoutModel layout = m_model.getLayoutModel( m_selection );
+ m_model.removeLayoutModel( layout );
}
catch( Throwable e )
{
@@ -338,7 +348,8 @@
"Unexpected error while attempting to delete a layout
model."
+ "\nCODEBASE: "
+
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
- m_manager.getLogger().error( error, e );
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
}
}
}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/LayoutRegistryTableModel.java
Fri Jun 17 05:54:23 2005
@@ -16,6 +16,9 @@

package net.dpml.depot.prefs;

+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
import javax.swing.Icon;
import javax.swing.table.AbstractTableModel;

@@ -27,7 +30,7 @@
/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
*/
-public class LayoutRegistryTableModel extends AbstractTableModel implements
LayoutRegistryListener
+public class LayoutRegistryTableModel extends AbstractTableModel
{

//--------------------------------------------------------------------------
// static
@@ -61,6 +64,7 @@
LayoutRegistryTableModel.class.getClassLoader(), ICON_PATH,
"Features" );

private final LayoutRegistryModel m_manager;
+ private final RemoteListener m_listener;


//--------------------------------------------------------------------------
// constructor
@@ -72,44 +76,58 @@
*
* @param manager the registry configuration manager
*/
- public LayoutRegistryTableModel( LayoutRegistryModel manager )
+ public LayoutRegistryTableModel( LayoutRegistryModel manager ) throws
Exception
{
super();
m_manager = manager;
- manager.addLayoutRegistryListener( this );
+ m_listener = new RemoteListener();
+ manager.addLayoutRegistryListener( m_listener );
}

protected void dispose()
{
try
{
- m_manager.removeLayoutRegistryListener( this );
+ m_manager.removeLayoutRegistryListener( m_listener );
}
catch( Throwable e )
{
}
}

-
//--------------------------------------------------------------------------
- // LayoutRegistryListener
-
//--------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
+ // RemoteListener
+
//------------------------------------------------------------------------------

- /**
- * Notify all listeners of the addition of a layout registry model.
- * @param event the layout registry event
- */
- public void layoutAdded( LayoutRegistryEvent event )
+ private class RemoteListener extends UnicastRemoteObject
+ implements LayoutRegistryListener
{
- fireTableStructureChanged();
- }
+ public RemoteListener() throws RemoteException
+ {
+ super();
+ }

- /**
- * Notify all listeners of the removal of a layout model.
- * @param event the layout registry event
- */
- public void layoutRemoved( LayoutRegistryEvent event )
- {
- fireTableStructureChanged();
+
//--------------------------------------------------------------------------
+ // LayoutRegistryListener (listen to changes to the available
layouts)
+
//--------------------------------------------------------------------------
+
+ /**
+ * Notify all listeners of the addition of a layout registry model.
+ * @param event the layout registry event
+ */
+ public void layoutAdded( LayoutRegistryEvent event ) throws
RemoteException
+ {
+ fireTableStructureChanged();
+ }
+
+ /**
+ * Notify all listeners of the removal of a layout model.
+ * @param event the layout registry event
+ */
+ public void layoutRemoved( LayoutRegistryEvent event ) throws
RemoteException
+ {
+ fireTableStructureChanged();
+ }
}


//--------------------------------------------------------------------------

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/PluginModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -33,6 +33,8 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;

import javax.swing.Action;
import javax.swing.AbstractAction;
@@ -63,20 +65,21 @@
* @author <a href="mailto:mcconnell AT osm.net";>OSM</a>
*/
class PluginModelPanel extends ClassicPanel
- implements CodeBaseListener, PropertyChangeListener, DocumentListener
+ implements PropertyChangeListener, DocumentListener
{
//--------------------------------------------------------------
// state
//--------------------------------------------------------------

private final JDialog m_parent;
- private JTextField m_base;
- private JButton m_ok;
- private JButton m_revert;
- private SettingsAction m_settings;
- private CodeBaseModel m_manager;
- private PropertyChangeSupport m_propertyChangeSupport;
- private Action m_action;
+ private final RemoteListener m_listener;
+ private final CodeBaseModel m_manager;
+ private final PropertyChangeSupport m_propertyChangeSupport;
+ private final JTextField m_base;
+ private final JButton m_ok;
+ private final JButton m_revert;
+ private final SettingsAction m_settings;
+ private final Action m_action;

//--------------------------------------------------------------
// constructor
@@ -125,12 +128,13 @@

m_parent = parent;
m_propertyChangeSupport = new PropertyChangeSupport( this );
+ m_listener = new RemoteListener();
m_manager = manager;
m_action = action;

m_ok = new JButton( new OKAction( "Install", service ) );
m_revert = new JButton( new RevertAction( "Undo" ) );
- m_manager.addCodeBaseListener( this );
+ m_manager.addCodeBaseListener( m_listener );

setLayout( new BorderLayout() );
setBackground( Color.white );
@@ -269,45 +273,71 @@

private String getControllerFieldText()
{
- URI uri = m_manager.getCodeBaseURI();
- if( null == uri )
+ try
{
- return "artifact:plugin:";
+ URI uri = m_manager.getCodeBaseURI();
+ if( null == uri )
+ {
+ return "artifact:plugin:";
+ }
+ else
+ {
+ return uri.toString();
+ }
}
- else
+ catch( RemoteException e )
{
- return uri.toString();
+ final String error =
+ "Unexpected remote exception while resolving plugin uri.";
+ throw new RuntimeException( error, e );
}
}

private String getControllerPath()
{
- URI uri = m_manager.getCodeBaseURI();
- if( null == uri )
+ try
{
- return null;
+ URI uri = m_manager.getCodeBaseURI();
+ if( null == uri )
+ {
+ return null;
+ }
+ else
+ {
+ return uri.toString();
+ }
}
- else
+ catch( RemoteException e )
{
- return uri.toString();
+ final String error =
+ "Unexpected remote exception while resolving plugin uri.";
+ throw new RuntimeException( error, e );
}
}

//--------------------------------------------------------------
- // PluginListener
+ // CodeBaseListener
//--------------------------------------------------------------

- public void codeBaseChanged( CodeBaseEvent event )
+ private class RemoteListener extends UnicastRemoteObject implements
CodeBaseListener
{
- URI uri = event.getCodeBaseURI();
- String artifact = "";
- if( uri != null )
+ public RemoteListener() throws RemoteException
{
- artifact = uri.toString();
+ super();
}
- if( false == m_base.getText().equals( artifact ) )
+
+ public void codeBaseChanged( CodeBaseEvent event ) throws
RemoteException
{
- m_base.setText( artifact );
+ URI uri = event.getCodeBaseURI();
+ String artifact = "";
+ if( uri != null )
+ {
+ artifact = uri.toString();
+ }
+ if( false == m_base.getText().equals( artifact ) )
+ {
+ m_base.setText( artifact );
+ }
}
}

@@ -317,7 +347,13 @@

private void dispose()
{
- m_manager.removeCodeBaseListener( this );
+ try
+ {
+ m_manager.removeCodeBaseListener( m_listener );
+ }
+ catch( Throwable e )
+ {
+ }
}

private class CloseAction extends AbstractAction
@@ -396,7 +432,7 @@

private String getControllerClassname( URI uri ) throws Exception
{
- URL url = new URL( uri.toString() );
+ URL url = new URL( uri.toASCIIString() );
Plugin plugin = (Plugin) url.getContent( new Class[]{
Plugin.class } );
return plugin.getClassname();
}
@@ -468,17 +504,26 @@
String artifact = getControllerFieldText();
if( false == text.equals( artifact ) )
{
- if( "".equals( text ) )
- {
- m_manager.setCodeBaseURI( null );
- }
- else
+ try
{
- URI uri = validateControllerSpec( m_parent, text,
m_service );
- if( null != uri )
+ if( "".equals( text ) )
{
- m_manager.setCodeBaseURI( uri );
+ m_manager.setCodeBaseURI( null );
}
+ else
+ {
+ URI uri = validateControllerSpec( m_parent, text,
m_service );
+ if( null != uri )
+ {
+ m_manager.setCodeBaseURI( uri );
+ }
+ }
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while setting codebase
uri.";
+ throw new RuntimeException( error, e );
}
}
m_ok.setEnabled( false );

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyExcludesTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyExcludesTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyExcludesTableModel.java
Fri Jun 17 05:54:23 2005
@@ -16,6 +16,9 @@

package net.dpml.depot.prefs;

+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
import javax.swing.Icon;
import javax.swing.table.AbstractTableModel;

@@ -27,41 +30,57 @@
/**
* Table model that presents the set of excluded hosts.
*/
-public class ProxyExcludesTableModel extends AbstractTableModel implements
ProxyListener
+public class ProxyExcludesTableModel extends AbstractTableModel
{

//--------------------------------------------------------------------------
// state

//--------------------------------------------------------------------------

- ProxyModel m_model;
+ private final ProxyModel m_model;
+ private final RemoteListener m_listener;


//--------------------------------------------------------------------------
// constructor

//--------------------------------------------------------------------------

- public ProxyExcludesTableModel( ProxyModel model )
+ public ProxyExcludesTableModel( ProxyModel model ) throws Exception
{
super();
m_model = model;
- model.addProxyListener( this );
+ m_listener = new RemoteListener();
+ model.addProxyListener( m_listener );
}

protected void dispose()
{
- m_model.removeProxyListener( this );
+ try
+ {
+ m_model.removeProxyListener( m_listener );
+ }
+ catch( Throwable e )
+ {
+ }
}


//--------------------------------------------------------------------------
// ProxyListener

//--------------------------------------------------------------------------

- /**
- * Notify a listener of the change to Transit proxy settings.
- * @param event the proxy change event
- */
- public void proxyChanged( ProxyEvent event )
+ private class RemoteListener extends UnicastRemoteObject implements
ProxyListener
{
- fireTableStructureChanged();
+ public RemoteListener() throws RemoteException
+ {
+ super();
+ }
+
+ /**
+ * Notify a listener of the change to Transit proxy settings.
+ * @param event the proxy change event
+ */
+ public void proxyChanged( ProxyEvent event )
+ {
+ fireTableStructureChanged();
+ }
}


//--------------------------------------------------------------------------
@@ -104,9 +123,9 @@
*/
public Object getValueAt( int row, int col )
{
- String[] excludes = m_model.getExcludes();
try
{
+ String[] excludes = m_model.getExcludes();
return excludes[ row ];
}
catch( Throwable e )

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
Fri Jun 17 05:54:23 2005
@@ -35,6 +35,7 @@
import java.net.URISyntaxException;
import java.net.URI;
import java.net.URL;
+import java.rmi.RemoteException;
import java.util.logging.Logger;
import java.util.logging.Level;

@@ -67,11 +68,11 @@
//--------------------------------------------------------------

private final JDialog m_parent;
+ private final ProxyModel m_model;
private JTextField m_base;
private JButton m_ok;
private JButton m_revert;
private PropertyChangeSupport m_propertyChangeSupport;
- private ProxyModel m_manager;
private String m_host;
private CredentialsAction m_credentials;
private JButton m_close;
@@ -89,10 +90,10 @@
public ProxyFeaturesPanel( JDialog parent, ProxyModel manager ) throws
Exception
{
m_parent = parent;
- m_manager = manager;
+ m_model = manager;

m_host = getProxyHost();
- m_auth = m_manager.getAuthentication();
+ m_auth = m_model.getAuthentication();
m_propertyChangeSupport = new PropertyChangeSupport( this );
m_ok = new JButton( new OKAction( "OK" ) );
m_revert = new JButton( new RevertAction( "Undo" ) );
@@ -191,7 +192,7 @@

boolean flag = ( false == m_host.equals( base ) );

- PasswordAuthentication auth = m_manager.getAuthentication();
+ PasswordAuthentication auth = getAuthentication();
if( null == m_auth )
{
if( null != auth )
@@ -207,7 +208,7 @@
m_ok.setEnabled( flag );
m_revert.setEnabled( flag );

- if( m_manager.getAuthentication() != null )
+ if( getAuthentication() != null )
{
m_credentials.setEnabled( true );
}
@@ -243,6 +244,20 @@
// utilities
//--------------------------------------------------------------

+ private PasswordAuthentication getAuthentication()
+ {
+ try
+ {
+ return m_model.getAuthentication();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while retriving proxy
credentials.";
+ throw new RuntimeException( error, e );
+ }
+ }
+
private class CloseAction extends AbstractAction
{
CloseAction( String name )
@@ -268,7 +283,7 @@
{
String old = m_base.getText();
m_base.setText( m_host );
- m_auth = m_manager.getAuthentication();
+ m_auth = getAuthentication();
m_credentials.revert();
PropertyChangeEvent e =
new PropertyChangeEvent( this, "undo", null, null );
@@ -289,24 +304,33 @@
String text = m_base.getText();
if( false == text.equals( m_host ) )
{
- if( "".equals( text ) )
- {
- String[] excludes = m_manager.getExcludes();
- m_manager.update( null, m_auth, excludes );
- }
- else
+ try
{
- try
+ if( "".equals( text ) )
{
- URL url = new URL( text );
- String[] excludes = m_manager.getExcludes();
- m_manager.update( url, m_auth, excludes );
+ String[] excludes = m_model.getExcludes();
+ m_model.update( null, m_auth, excludes );
}
- catch( Exception e )
+ else
{
- e.printStackTrace();
+ try
+ {
+ URL url = new URL( text );
+ String[] excludes = m_model.getExcludes();
+ m_model.update( url, m_auth, excludes );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
}
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while retriving proxy
features.";
+ throw new RuntimeException( error, e );
+ }
}
m_parent.hide();
}
@@ -335,7 +359,7 @@
final Dimension size = new Dimension( 300, 280 );
ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
ClassicCredentialsPanel panel =
- new ClassicCredentialsPanel( dialog,
m_manager.getAuthentication(), m_auth, this );
+ new ClassicCredentialsPanel( dialog, getAuthentication(),
m_auth, this );
dialog.getBody().add( panel );
dialog.setLocationRelativeTo( (Component) event.getSource()
);
dialog.setResizable( false );
@@ -367,21 +391,30 @@
m_auth = event.getPasswordAuthentication();
PropertyChangeEvent e =
new PropertyChangeEvent(
- this, "auth", m_manager.getAuthentication(), m_auth );
+ this, "auth", getAuthentication(), m_auth );
m_propertyChangeSupport.firePropertyChange( e );
}
}

private String getProxyHost()
{
- URL host = m_manager.getHost();
- if( null == host )
+ try
{
- return "";
+ URL host = m_model.getHost();
+ if( null == host )
+ {
+ return "";
+ }
+ else
+ {
+ return host.toString();
+ }
}
- else
+ catch( RemoteException e )
{
- return host.toString();
+ final String error =
+ "Remote exception while resolving proxy host.";
+ throw new RuntimeException( error, e );
}
}


Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ProxyModelPanel.java
Fri Jun 17 05:54:23 2005
@@ -30,6 +30,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.net.ContentHandler;
+import java.rmi.RemoteException;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.ArrayList;
@@ -86,7 +87,7 @@
// constructor
//--------------------------------------------------------------

- public ProxyModelPanel( Window parent, ProxyModel model )
+ public ProxyModelPanel( Window parent, ProxyModel model ) throws
Exception
{
super();

@@ -178,7 +179,7 @@
return;
}
ArrayList list = new ArrayList();
- String[] excludes = m_model.getExcludes();
+ String[] excludes = getExcludes();
for( int i=0; i<excludes.length; i++ )
{
String s = excludes[i];
@@ -188,7 +189,7 @@
}
}
String[] values = (String[]) list.toArray( new String[0] );
- m_model.setExcludes( values );
+ setExcludes( values );
}

private void changeExclude( String exclude, String value )
@@ -202,7 +203,7 @@
return;
}
ArrayList list = new ArrayList();
- String[] excludes = m_model.getExcludes();
+ String[] excludes = getExcludes();
for( int i=0; i<excludes.length; i++ )
{
String s = excludes[i];
@@ -216,13 +217,13 @@
}
}
String[] values = (String[]) list.toArray( new String[0] );
- m_model.setExcludes( values );
+ setExcludes( values );
}

private void addExclude( String exclude )
{
ArrayList list = new ArrayList();
- String[] excludes = m_model.getExcludes();
+ String[] excludes = getExcludes();
for( int i=0; i<excludes.length; i++ )
{
String s = excludes[i];
@@ -230,7 +231,7 @@
}
list.add( exclude );
String[] values = (String[]) list.toArray( new String[0] );
- m_model.setExcludes( values );
+ setExcludes( values );
}

//--------------------------------------------------------------
@@ -337,6 +338,35 @@
}
}

+ private String[] getExcludes()
+ {
+ try
+ {
+ return m_model.getExcludes();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Remote exception while resolving proxy excludes.";
+ throw new RuntimeException( error, e );
+ }
+ }
+
+ private void setExcludes( String[] excludes )
+ {
+ try
+ {
+ m_model.setExcludes( excludes );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Remote exception while setting proxy excludes.";
+ throw new RuntimeException( error, e );
+ }
+ }
+
+
//--------------------------------------------------------------
// static (utils)
//--------------------------------------------------------------

Modified: development/main/depot/station/build.xml
==============================================================================
--- development/main/depot/station/build.xml (original)
+++ development/main/depot/station/build.xml Fri Jun 17 05:54:23 2005
@@ -7,8 +7,10 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="build" depends="standard.build">
- <rmic base="${basedir}/target/classes"
includes="**/DepotStation.class"/>
- <rmic base="${basedir}/target/classes"
includes="**/ClientListener.class"/>
+ <rmic base="${basedir}/target/classes">
+ <include name="**/DepotStation.class"/>
+ <include name="**/ClientListener.class"/>
+ </rmic>
</target>

<target name="package" depends="standard.package">

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.depot.station;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.rmi.activation.ActivationDesc;
@@ -42,7 +43,7 @@
public ActivationGroupProfile(
Logger logger, Date creation, ProfileHome home, String id, String
title,
Properties properties, URI uri, String classname, CodeBaseProfile[]
profiles )
- throws ProfileException
+ throws ProfileException, RemoteException
{
super( logger, creation, home, id, title, properties, uri, classname
);


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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.net.URI;
import java.net.URISyntaxException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
@@ -47,7 +48,8 @@
//
------------------------------------------------------------------------

public ActivationGroupStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
throws ProfileException
+ Preferences prefs, Logger logger, Date creation, boolean policy )
+ throws ProfileException, RemoteException
{
super( prefs, logger, creation, policy );


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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.depot.station;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.rmi.activation.ActivationDesc;
@@ -41,7 +42,7 @@
public ActivationProfile(
Logger logger, Date creation, ProfileHome home, String id, String
title,
Properties properties, URI uri, String classname, boolean restart )
- throws ProfileException
+ throws ProfileException, RemoteException
{
super( logger, creation, home, id, title, properties, uri, classname
);


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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.net.URI;
import java.net.URISyntaxException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
@@ -48,7 +49,8 @@
//
------------------------------------------------------------------------

public ActivationStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
throws ProfileException
+ Preferences prefs, Logger logger, Date creation, boolean policy )
+ throws ProfileException, RemoteException
{
super( prefs, logger, creation, policy );


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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.depot.station;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.rmi.activation.ActivationDesc;
@@ -28,6 +29,7 @@

import net.dpml.transit.model.Logger;

+import net.dpml.depot.profile.DefaultProfile;
import net.dpml.depot.profile.Profile;
import net.dpml.depot.profile.ProfileHome;
import net.dpml.depot.profile.ProfileException;
@@ -36,14 +38,14 @@
* A ActivationProfile maintains information about the configuration
* of an activation profile.
*/
-public abstract class CodeBaseProfile extends Profile
+public abstract class CodeBaseProfile extends DefaultProfile
{
private String m_classname;

public CodeBaseProfile(
Logger logger, Date creation, ProfileHome home, String id, String
title,
Properties properties, URI uri, String classname )
- throws ProfileException
+ throws ProfileException, RemoteException
{
super( logger, creation, home, id, title, properties, uri );


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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.depot.station;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Properties;
import java.util.Date;

@@ -42,6 +43,7 @@

public StationProfile(
Logger logger, Date creation, Home home, Properties properties,
CodeBaseProfile[] profiles )
+ throws RemoteException
{
super( logger, creation );


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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.net.URI;
import java.net.URISyntaxException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Properties;
import java.util.prefs.BackingStoreException;
@@ -48,7 +49,8 @@
//
------------------------------------------------------------------------

public StationStorage(
- Preferences prefs, Logger logger, Date creation, boolean policy )
throws ProfileException
+ Preferences prefs, Logger logger, Date creation, boolean policy )
+ throws ProfileException, RemoteException
{
super( prefs, logger, creation, policy );


Modified: development/main/depot/test/mexico/build.xml
==============================================================================
--- development/main/depot/test/mexico/build.xml (original)
+++ development/main/depot/test/mexico/build.xml Fri Jun 17 05:54:23
2005
@@ -7,8 +7,10 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="build" depends="standard.build">
- <rmic base="${basedir}/target/classes" includes="**/Server.class"/>
- <rmic base="${basedir}/target/classes"
includes="**/ClientListener.class"/>
+ <rmic base="${basedir}/target/classes">
+ <include name="**/Server.class"/>
+ <include name="**/ClientListener.class"/>
+ </rmic>
</target>

</project>

Modified:
development/main/metro/composition/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/metro/composition/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java
Fri Jun 17 05:54:23 2005
@@ -55,10 +55,10 @@
*
* @param model the registry model
*/
- public CompositionContentHandlerRegistry( ContentRegistryModel model )
throws Exception
+ public CompositionContentHandlerRegistry( ContentRegistryModel model,
Logger logger ) throws Exception
{
- super( model );
- m_logger = model.getLogger();
+ super( model, logger );
+ m_logger = logger;
m_model = model;

try
@@ -74,8 +74,6 @@
{
try
{
- Date creation = new Date();
- Logger logger = model.getLogger().getChildLogger( PART );
URI uri = new URI( PART_HANDLER_PLUGIN_PATH );
model.addContentModel( PART, TITLE, uri );
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
Fri Jun 17 05:54:23 2005
@@ -26,6 +26,7 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URISyntaxException;
+import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;
@@ -89,7 +90,7 @@
// constructor
//--------------------------------------------------------------------

- CompositionController( ControllerContext context )
+ CompositionController( ControllerContext context ) throws RemoteException
{
super();
m_logger = getLoggerForURI( context.getURI() );
@@ -167,15 +168,33 @@
{
if( "context.uri".equals( key ) )
{
- return m_context.getURI();
+ return getPartition();
}
else if( "work.dir".equals( key ) )
{
- return m_context.getWorkingDirectory();
+ try
+ {
+ return m_context.getWorkingDirectory();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while attempting to get
working directory.";
+ throw new ControlRuntimeException( CONTROLLER_URI,
error, e );
+ }
}
else if( "temp.dir".equals( key ) )
{
- return m_context.getTempDirectory();
+ try
+ {
+ return m_context.getTempDirectory();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while attempting to get
temp directory.";
+ throw new ControlRuntimeException( CONTROLLER_URI,
error, e );
+ }
}
else
{
@@ -221,7 +240,7 @@

public String getName()
{
- return m_context.getURI().toString();
+ return getPartition().toASCIIString();
}

public Model getPart( CompositionModel model, String key )
@@ -326,7 +345,8 @@
final ValueDirective directive = (ValueDirective) part;
getMonitor().debug( "creating nested value model using " +
directive );
URI partition = getPartition( model );
- return new ValueModel( m_monitor, key, this, partition,
m_valueController, classloader, directive, model );
+ return new ValueModel(
+ m_monitor, key, this, partition, m_valueController,
classloader, directive, model );
}
else
{
@@ -524,7 +544,16 @@

private URI getPartition()
{
- return m_context.getURI();
+ try
+ {
+ return m_context.getURI();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while attempting to resolve the
context uri.";
+ throw new ControlRuntimeException( CONTROLLER_URI, error, e );
+ }
}

private URI getPartition( Model model )

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionManager.java
Fri Jun 17 05:54:23 2005
@@ -168,11 +168,6 @@
// extras
//--------------------------------------------------------------------

- private URI getPartition()
- {
- return m_context.getURI();
- }
-
private ClassLoader getClassLoader()
{
return m_classloader;

Modified: development/main/metro/composition/part/build.xml
==============================================================================
--- development/main/metro/composition/part/build.xml (original)
+++ development/main/metro/composition/part/build.xml Fri Jun 17 05:54:23
2005
@@ -11,6 +11,13 @@
<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="**/CompositionContentHandlerModel.class"/>
+ </rmic>
+ </target>
+
<target name="package" depends="standard.package">
<x:export class="net.dpml.composition.part.CompositionContentHandler"/>
</target>

Modified:
development/main/metro/composition/part/src/main/net/dpml/composition/part/CompositionContentHandler.java
==============================================================================
---
development/main/metro/composition/part/src/main/net/dpml/composition/part/CompositionContentHandler.java
(original)
+++
development/main/metro/composition/part/src/main/net/dpml/composition/part/CompositionContentHandler.java
Fri Jun 17 05:54:23 2005
@@ -33,13 +33,16 @@

import net.dpml.transit.repository.Repository;

+import net.dpml.parts.control.ControlException;
import net.dpml.parts.control.ControlRuntimeException;
+import net.dpml.parts.control.ControllerContext;

import net.dpml.parts.part.Part;
import net.dpml.parts.model.Model;
import net.dpml.parts.model.Provider;
import net.dpml.parts.model.Component;

+import net.dpml.transit.model.ContentModel;

/**
* A utility class used for the deployment of components in embedded
scenarios
@@ -59,13 +62,26 @@
// constructor
//------------------------------------------------------------------

- public CompositionContentHandler( CompositionControllerContext context )
throws Exception
+ public CompositionContentHandler( ContentModel model ) throws Exception
{
- if( null == context )
+ if( null == model )
{
- throw new NullPointerException( "context" );
+ throw new NullPointerException( "model" );
+ }
+ if( model instanceof ControllerContext )
+ {
+ ControllerContext context = (ControllerContext) model;
+ m_manager = new CompositionManager( context, new String[0] );
+ }
+ else
+ {
+ final String error =
+ "Supplied content model is not an instance of "
+ + ControllerContext.class.getName()
+ + "."
+ + "\nContent Model: " + model.getClass().getName();
+ throw new IllegalArgumentException( error );
}
- m_manager = new CompositionManager( context, new String[0] );
}

//------------------------------------------------------------------

Modified:
development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContext.java
==============================================================================
---
development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContext.java
(original)
+++
development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContext.java
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,8 @@

package net.dpml.parts.control;

+import java.rmi.Remote;
+import java.rmi.RemoteException;
import java.net.URI;
import java.io.File;

@@ -27,27 +29,27 @@
* @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 interface ControllerContext
+public interface ControllerContext extends Remote
{
/**
* Return the URI identifying the controller working context.
* @return the context uri
*/
- URI getURI();
+ URI getURI() throws RemoteException;

/**
* Return the root working directory.
*
* @return directory representing the root of the working directory
hierachy
*/
- File getWorkingDirectory();
+ File getWorkingDirectory() throws RemoteException;

/**
* Return the root temporary directory.
*
* @return directory representing the root of the temporary directory
hierachy.
*/
- File getTempDirectory();
+ File getTempDirectory() throws RemoteException;

/**
* Add the supplied controller context listener to the controller
context. A
@@ -56,13 +58,13 @@
*
* @param listener the controller context listener to add
*/
- void addControllerContextlistener( ControllerContextListener listener );
+ void addControllerContextlistener( ControllerContextListener listener )
throws RemoteException;

/**
* Remove the supplied controller context listener from the controller
context.
*
* @param listener the controller context listener to remove
*/
- void removeControllerContextlistener( ControllerContextListener listener
);
+ void removeControllerContextlistener( ControllerContextListener listener
) throws RemoteException;

}

Modified:
development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContextListener.java
==============================================================================
---
development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContextListener.java
(original)
+++
development/main/metro/parts/src/main/net/dpml/parts/control/ControllerContextListener.java
Fri Jun 17 05:54:23 2005
@@ -34,13 +34,13 @@
*
* @param event the change event
*/
- void contextChanged( WorkingDirectoryChangeEvent event );
+ void workingDirectoryChanged( ControllerContextEvent event );

/**
* Notify the listener that the temporary directory has changed.
*
* @param event the change event
*/
- void contextChanged( TempDirectoryChangeEvent event );
+ void tempDirectoryChanged( ControllerContextEvent event );

}

Modified: development/main/transit/core/handler/build.xml
==============================================================================
--- development/main/transit/core/handler/build.xml (original)
+++ development/main/transit/core/handler/build.xml Fri Jun 17 05:54:23
2005
@@ -48,7 +48,26 @@
</target>

<target name="build" depends="standard.build">
- <rmic base="${basedir}/target/classes" includes="**/Remote*.class"/>
+ <rmic base="${basedir}/target/classes">
+ <include name="**/DefaultModel.class"/>
+ <include name="**/DefaultHostModel.class"/>
+ <include name="**/DefaultContentModel.class"/>
+ <include name="**/DefaultLayoutModel.class"/>
+ <include name="**/DefaultCacheModel.class"/>
+ <include name="**/DefaultContentRegistryModel.class"/>
+ <include name="**/DefaultLayoutRegistryModel.class"/>
+ <include name="**/DefaultRepositoryModel.class"/>
+ <include name="**/DefaultTransitModel.class"/>
+ <include name="**/DefaultProxyModel.class"/>
+ </rmic>
+ <rmic base="${basedir}/target/classes">
+ <include name="**/DefaultCacheHandler.class"/>
+ <include name="**/DefaultContentRegistry.class"/>
+ <include name="**/DefaultLayoutRegistry.class"/>
+ <include name="**/DefaultResourceHost.class"/>
+ <include name="**/SecuredTransitContext$TransitListener.class"/>
+ <include name="**/SecuredTransitContext$ProxyController.class"/>
+ </rmic>
</target>

<target name="package" depends="build">

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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,22 @@

package net.dpml.transit;

+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.prefs.Preferences;
+import java.util.Properties;
+
+import net.dpml.transit.adapter.LoggingAdapter;
import net.dpml.transit.link.FileLinkManager;
import net.dpml.transit.link.LinkManager;
import net.dpml.transit.model.Logger;
@@ -47,19 +63,6 @@
import net.dpml.transit.runtime.ClassicLayout;
import net.dpml.transit.util.Util;

-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.PasswordAuthentication;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.prefs.Preferences;
-import java.util.Properties;
-
/**
* The initial context of the transit system.
*
@@ -97,7 +100,7 @@
throw new NullArgumentException( "model" );
}

- Logger logger = model.getLogger();
+ Logger logger = new LoggingAdapter();
if( logger.isDebugEnabled() )
{
logger.debug( "creating transit context" );
@@ -105,7 +108,11 @@

try
{
- m_CONTEXT = new SecuredTransitContext( model );
+ m_CONTEXT = new SecuredTransitContext( model, logger );
+ }
+ catch( TransitException e )
+ {
+ throw e;
}
catch( Exception e )
{
@@ -184,9 +191,10 @@
* @param handler the cache handler
* @param registry the content handler registry
*/
- private SecuredTransitContext( TransitModel model ) throws
TransitException
+ private SecuredTransitContext( TransitModel model, Logger logger )
throws IOException
{
m_model = model;
+ m_logger = logger;

//
// During boostrap there is only the DefaultCacheHandler,
ClassicLayout
@@ -196,13 +204,14 @@
//

CacheModel cacheModel = model.getCacheModel();
- DefaultCacheHandler cache = new DefaultCacheHandler( cacheModel );
+ Logger cacheLogger = logger.getChildLogger( "cache" );
+ DefaultCacheHandler cache = new DefaultCacheHandler( cacheModel,
cacheLogger );
ContentRegistryModel registryModel = model.getContentRegistryModel();
- ContentRegistry registry = new DefaultContentRegistry( registryModel
);
+ Logger contentLogger = logger.getChildLogger( "content" );
+ ContentRegistry registry = new DefaultContentRegistry(
registryModel, contentLogger );

m_cacheHandler = cache;
m_registry = registry;
- m_logger = model.getLogger();
m_listener = new TransitListener();

ProxyModel proxy = m_model.getProxyModel();
@@ -262,7 +271,7 @@
* General setup.
* @exception UnknownHostException if a proxy host is declared but is
unknown
*/
- protected synchronized void setupProxy()
+ protected synchronized void setupProxy() throws RemoteException
{
ProxyModel model = m_model.getProxyModel();
URL proxy = model.getHost();
@@ -299,7 +308,7 @@
*
* @exception TransitException if an initialization error occurs
*/
- protected void initialize() throws TransitException
+ protected void initialize() throws IOException
{
m_linkManager = new FileLinkManager();
m_repository = new StandardLoader();
@@ -312,16 +321,18 @@
*
* @exception TransitException if an initialization error occurs
*/
- private void initializeRegistry() throws TransitException
+ private void initializeRegistry() throws IOException
{
synchronized( m_listener )
{
ContentRegistryModel model = m_model.getContentRegistryModel();
+ model.initialize();
model.addCodeBaseListener( m_listener );
URI uri = model.getCodeBaseURI();
if( null != uri )
{
- setContentRegistry( model );
+ handleDisposal( m_registry );
+ m_registry = setContentRegistry( model );
}
}
}
@@ -331,7 +342,7 @@
*
* @exception TransitException if an initialization error occurs
*/
- private void setContentRegistry( ContentRegistryModel model )
+ private ContentRegistry setContentRegistry( ContentRegistryModel model )
throws IOException
{
synchronized( m_registry )
{
@@ -341,18 +352,17 @@
m_logger.info( "loading custom content handler registry" );
try
{
- Object[] args = new Object[]{ model };
+ Logger log = m_logger.getChildLogger( "content" );
+ Object[] args = new Object[]{ model, log };
ClassLoader classloader = Transit.class.getClassLoader();
- ContentRegistry registry =
- (ContentRegistry) getRepository().getPlugin(
classloader, uri, args );
- handleDisposal( m_registry );
- m_registry = registry;
+ return (ContentRegistry) getRepository().getPlugin(
classloader, uri, args );
}
catch( Throwable e )
{
final String error =
- "Bypassing custom content hander registry assignment
due to internal error.";
- m_logger.error( error, e );
+ "Critical error while attempting to establish content
management subsystem."
+ + "\nURI: " + uri;
+ throw new TransitError( error, e );
}
}
else
@@ -361,7 +371,8 @@
{
m_logger.info( "loading standard content handler
registry" );
handleDisposal( m_registry );
- m_registry = new DefaultContentRegistry( model );
+ Logger log = m_logger.getChildLogger( "content" );
+ return new DefaultContentRegistry( model, log );
}
catch( Throwable e )
{
@@ -378,7 +389,7 @@
*
* @exception TransitException if an initialization error occurs
*/
- private void initializeCache() throws TransitException
+ private void initializeCache() throws IOException
{
synchronized( m_listener )
{
@@ -398,7 +409,7 @@
*
* @exception TransitException if an initialization error occurs
*/
- private void setCacheHandler( CacheModel model )
+ private void setCacheHandler( CacheModel model ) throws IOException
{
synchronized( m_cacheHandler )
{
@@ -408,7 +419,8 @@
m_logger.info( "loading custom cache handler" );
try
{
- Object[] args = new Object[]{ model };
+ Logger log = m_logger.getChildLogger( "cache" );
+ Object[] args = new Object[]{ model, log };
ClassLoader classloader = Transit.class.getClassLoader();
CacheHandler handler =
(CacheHandler) getRepository().getPlugin( classloader,
uri, args );
@@ -428,7 +440,8 @@
{
m_logger.info( "loading standard cache handler" );
handleDisposal( m_cacheHandler );
- m_cacheHandler = new DefaultCacheHandler( model );
+ Logger log = m_logger.getChildLogger( "cache" );
+ m_cacheHandler = new DefaultCacheHandler( model, log );
}
catch( Throwable e )
{
@@ -441,7 +454,7 @@
}


- private void handleDisposal( Object object )
+ private void handleDisposal( Object object )
{
if( object instanceof Handler )
{
@@ -457,15 +470,29 @@
}
}

- private class ProxyController implements ProxyListener
+ private class ProxyController extends UnicastRemoteObject implements
ProxyListener
{
+ public ProxyController() throws RemoteException
+ {
+ super();
+ }
+
/**
* Notify a listener of the change to Transit proxy settings.
* @param event the proxy change event
*/
public void proxyChanged( ProxyEvent event )
{
- setupProxy();
+ try
+ {
+ setupProxy();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected error while attrempting to set proxy
settings.";
+ getLogger().error( error, e );
+ }
}
}

@@ -475,13 +502,18 @@
*
* @param manager the transit manager
*/
- private class TransitListener implements CodeBaseListener
+ private class TransitListener extends UnicastRemoteObject implements
CodeBaseListener
{
+ public TransitListener() throws RemoteException
+ {
+ super();
+ }
+
/**
* Notification of the change to a plugin uri assigned to a
sub-system.
* @param event a plugin change event
*/
- public void codeBaseChanged( CodeBaseEvent event )
+ public void codeBaseChanged( CodeBaseEvent event ) throws
RemoteException
{
CodeBaseModel model = event.getCodeBaseModel();
URI uri = event.getCodeBaseURI();
@@ -500,10 +532,19 @@
// include the cache system, the layout registry and the
indexing system.
//

- if( m_model.getContentRegistryModel().equals( model ) )
+ if( model instanceof ContentRegistryModel )
{
- ContentRegistryModel m = m_model.getContentRegistryModel();
- setContentRegistry( m );
+ ContentRegistry registry = null;
+ try
+ {
+ registry = setContentRegistry( (ContentRegistryModel)
model );
+ handleDisposal( m_registry );
+ m_registry = registry;
+ }
+ catch( IOException e )
+ {
+ getLogger().error( e.getMessage(), e.getCause() );
+ }
}
}
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
Fri Jun 17 05:54:23 2005
@@ -21,6 +21,12 @@

import java.net.URI;
import java.net.URISyntaxException;
+import java.rmi.NotBoundException ;
+import java.rmi.AccessException;
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;

import java.io.File;
import java.io.FileOutputStream;
@@ -35,9 +41,10 @@
import net.dpml.transit.monitors.CacheMonitorRouter;
import net.dpml.transit.monitors.NetworkMonitorRouter;
import net.dpml.transit.link.LinkManager;
+import net.dpml.transit.model.Connection;
+import net.dpml.transit.model.DefaultTransitModel;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.model.DefaultTransitModel;
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
import net.dpml.transit.unit.TransitStorageUnit;
@@ -144,18 +151,18 @@
{
if( m_INSTANCE == null )
{
- try
- {
- TransitHome home = new TransitStorageUnit();
- TransitModel model = home.create();
- return getInstance( model );
- }
- catch( TransitException e )
- {
- String message = e.getMessage();
- Throwable cause = e.getCause();
- throw new TransitRuntimeException( message, cause );
- }
+ try
+ {
+ TransitHome home = new TransitStorageUnit();
+ TransitModel model = home.create();
+ return getInstance( model );
+ }
+ catch( IOException e )
+ {
+ String message = e.getMessage();
+ Throwable cause = e.getCause();
+ throw new TransitRuntimeException( message, cause );
+ }
}
else
{
@@ -171,14 +178,12 @@
* @exception TransitException if an error occurs during establishment
*/
public static Transit getInstance( TransitModel model )
- throws TransitException, NullArgumentException
+ throws IOException
{
synchronized( Transit.class )
{
if( m_INSTANCE == null )
{
- model.getLogger().info( "Creating managed Transit instance."
);
-
m_INSTANCE = new Transit( model );

// before returning from this method we need to give the
transit
@@ -202,11 +207,6 @@
//------------------------------------------------------------------

/**
- * Logging channel.
- */
- private Logger m_logger;
-
- /**
* Singleton repository monitor router.
*/
private RepositoryMonitorRouter m_repositoryMonitor;
@@ -240,13 +240,6 @@
*/
private Transit( TransitModel model ) throws TransitException
{
- m_logger = model.getLogger();
-
- if( m_logger.isDebugEnabled() )
- {
- m_logger.debug( "transit initialization" );
- }
-
//
// create the transit context
//
@@ -494,7 +487,6 @@
}
}

-
//------------------------------------------------------------------
// static internal
//------------------------------------------------------------------

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/ArtifactURLConnection.java
Fri Jun 17 05:54:23 2005
@@ -193,17 +193,7 @@
public Object getContent( Class[] classes )
throws IOException
{
- //
- // check to see if we have a content handler plugin declared for the
artifact type
- //
-
String type = m_artifact.getType();
- ContentRegistry registry = m_context.getContentHandlerRegistry();
- ContentHandler handler = registry.getContentHandler( type );
- if( null != handler )
- {
- return handler.getContent( this, classes );
- }

//
// if the type is a plugin then handle this directly
@@ -240,6 +230,17 @@
}

//
+ // check to see if we have a content handler plugin declared for the
artifact type
+ //
+
+ ContentRegistry registry = m_context.getContentHandlerRegistry();
+ ContentHandler handler = registry.getContentHandler( type );
+ if( null != handler )
+ {
+ return handler.getContent( this, classes );
+ }
+
+ //
// otherwise fallback on the default jvm content handling
//

@@ -257,7 +258,7 @@
}

//
- // and if all else fails, attempt to resolve this locally as we may
be dealing
+ // attempt to resolve this locally as we may be dealing
// with Magic references to the artifact File
//

@@ -266,11 +267,7 @@
Class c = classes[i];
if( c.equals( File.class ) )
{
- InputStream content = getInputStream();
- Layout resolver = new ClassicLayout();
- String name = resolver.resolvePath( m_artifact );
- File cache = new File( Transit.DPML_DATA, "cache" );
- return new File( cache, name );
+ return m_context.getCacheHandler().getLocalFile( m_artifact
);
}
}
return null;

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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,8 @@

package net.dpml.transit.home;

+import net.dpml.transit.model.ContentModel;
+
/**
* The ProxyManager is an interface implemented by proxy managers.
*
@@ -25,5 +27,7 @@
*/
public interface ContentHome extends CodeBaseHome
{
+ ContentModel getContentModel();
+
void setTitle( String title );
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java
Fri Jun 17 05:54:23 2005
@@ -29,7 +29,10 @@
*/
public interface ContentRegistryHome extends CodeBaseHome
{
+ ContentModel[] createContentModels();
+
ContentModel createContentModel( String type );

ContentModel createContentModel( String type, String title, URI uri );
+
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/TransitHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/TransitHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/TransitHome.java
Fri Jun 17 05:54:23 2005
@@ -32,6 +32,12 @@
*/
public interface TransitHome extends Home
{
+ /**
+ * Return the home identifier.
+ * @return the home id
+ */
+ String getID();
+
void setLogger( Logger logger );

void setProfile( String profile );

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 Jun 17 05:54:23 2005
@@ -19,28 +19,30 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* A listener for events related to the Transit cache subsystem.
*/
-public interface CacheListener extends EventListener
+public interface CacheListener extends EventListener, Remote
{
/**
* Notify the listener of a change to the cache directory.
* @param event the cache directory change event
*/
- void cacheDirectoryChanged( FileChangeEvent event );
+ void cacheDirectoryChanged( FileChangeEvent event ) throws
RemoteException;

/**
* Notify the listener of the addition of a new host.
* @param event the host added event
*/
- void hostAdded( CacheEvent event );
+ void hostAdded( CacheEvent event ) throws RemoteException;

/**
* Notify the listener of the removal of a host.
* @param event the host removed event
*/
- void hostRemoved( CacheEvent event );
+ void hostRemoved( CacheEvent event ) throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.java
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.io.File;
import java.net.URI;
+import java.rmi.RemoteException;

/**
* A CacheModel maintains information about the configuration of the Transit
@@ -36,20 +37,20 @@
* Return the directory to be used by the cache handler as the cache
directory.
* @return the cache directory.
*/
- File getCacheDirectory();
+ File getCacheDirectory() throws RemoteException;

/**
* Update the value the local cache directory.
*
* @param file the cache directory
*/
- void setCacheDirectory( final File file );
+ void setCacheDirectory( final File file ) throws RemoteException;

/**
* Return the array of hosts configured for the cache.
* @return the host director array
*/
- HostModel[] getHostModels();
+ HostModel[] getHostModels() throws RemoteException;

/**
* Return an identified host model.
@@ -57,50 +58,50 @@
* @return the host model
* @exception UnknownKeyException if the requested host id is unknown
*/
- HostModel getHostModel( String id ) throws UnknownKeyException;
+ HostModel getHostModel( String id ) throws UnknownKeyException,
RemoteException;

/**
* Add a cache listener to the director.
* @param listener the listener to add
*/
- void addCacheListener( CacheListener listener );
+ void addCacheListener( CacheListener listener ) throws RemoteException;

/**
* Remove a cache listener from the director.
* @param listener the listener to remove
*/
- void removeCacheListener( CacheListener listener );
+ void removeCacheListener( CacheListener listener ) throws
RemoteException;

/**
* Return the cache layout strategy model.
* @return the layout model
*/
- LayoutModel getLayoutModel();
+ LayoutModel getLayoutModel() throws RemoteException;

/**
* Return the layout registry model.
* @return the layout registry model
*/
- LayoutRegistryModel getLayoutRegistryModel();
+ LayoutRegistryModel getLayoutRegistryModel() throws RemoteException;

/**
* Add a new host model to the cache model.
* @param id the host identifier
* @exception DuplicateKeyException if a host of the same identifier
already exists
*/
- void addHostModel( String id ) throws DuplicateKeyException;
+ void addHostModel( String id ) throws DuplicateKeyException,
RemoteException;

/**
* Add a new host model to the cache model.
* @param model the host model to add to the cache model
* @exception DuplicateKeyException if a host of the same identifier
already exists
*/
- void addHostModel( HostModel model ) throws DuplicateKeyException;
+ void addHostModel( HostModel model ) throws DuplicateKeyException,
RemoteException;

/**
* Remove a host from the cache model.
* @param model the host model to remove
*/
- void removeHostModel( HostModel model );
+ void removeHostModel( HostModel model ) throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseListener.java
Fri Jun 17 05:54:23 2005
@@ -18,18 +18,20 @@

package net.dpml.transit.model;

+import java.rmi.Remote;
+import java.rmi.RemoteException;
import java.util.EventListener;

/**
* Interface implemented by objects concerning with plugin
* bindings.
*/
-public interface CodeBaseListener extends EventListener
+public interface CodeBaseListener extends EventListener, Remote
{
/**
* Notification of the change to a plugin uri assigned to a sub-system.
* @param event a plugin change event
*/
- void codeBaseChanged( CodeBaseEvent event );
+ void codeBaseChanged( CodeBaseEvent event ) throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/CodeBaseModel.java
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;

/**
* A PluginModel maintains information about the configuration of
@@ -30,24 +31,24 @@
* Return the uri of the plugin to be used for cache management.
* @return the cache handler plugin uri
*/
- URI getCodeBaseURI();
+ URI getCodeBaseURI() throws RemoteException;

/**
* Set the plugin uri value.
* @param uri the plugin uri
*/
- void setCodeBaseURI( URI uri );
+ void setCodeBaseURI( URI uri ) throws RemoteException;

/**
* Add a codebase listener to the model.
* @param listener the listener to add
*/
- void addCodeBaseListener( CodeBaseListener listener );
+ void addCodeBaseListener( CodeBaseListener listener ) throws
RemoteException;

/**
* Remove a codebase listener from the model.
* @param listener the listener to remove
*/
- void removeCodeBaseListener( CodeBaseListener listener );
+ void removeCodeBaseListener( CodeBaseListener listener ) throws
RemoteException;

}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/Connection.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/Connection.java
Fri Jun 17 05:54:23 2005
@@ -0,0 +1,146 @@
+/*
+ * 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.io.Serializable;
+import java.rmi.registry.Registry;
+
+/**
+ * The Connection class describes a service access point used during
+ * publication or location of a service.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class Connection implements Serializable
+{
+ private String m_host;
+ private int m_port;
+ private boolean m_optional;
+ private boolean m_enabled;
+
+ /**
+ * Creation of an optional enabled connection with a null host reference
and
+ * port value of 1099.
+ */
+ public Connection()
+ {
+ this( null, Registry.REGISTRY_PORT, true, true );
+ }
+
+ /**
+ * Creation of a connection description with a supplied
+ * host and port.
+ * @param host the connection host
+ * @param port the port
+ * @param optional the optional status
+ * @param enabled the enabled status
+ */
+ public Connection( String host, int port, boolean optional, boolean
enabled )
+ {
+ m_host = host;
+ m_port = port;
+ m_optional = optional;
+ m_enabled = enabled;
+ }
+
+ /**
+ * Return the connection host.
+ * @return the host value
+ */
+ public String getHost()
+ {
+ return m_host;
+ }
+
+ /**
+ * Return the connection port.
+ * @return the port value
+ */
+ public int getPort()
+ {
+ return m_port;
+ }
+
+ /**
+ * Return TRUE if this connection description is enabled.
+ * @return the enabled status
+ */
+ public boolean isEnabled()
+ {
+ return m_enabled;
+ }
+
+ /**
+ * Return TRUE if this connection is optional.
+ * @return the optional status
+ */
+ public boolean isOptional()
+ {
+ return m_optional;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( false == ( other instanceof Connection ) )
+ {
+ return false;
+ }
+ else
+ {
+ Connection connection = (Connection) other;
+ if( ( null == m_host ) && ( null != connection.m_host ) )
+ {
+ return false;
+ }
+ else if( m_port != connection.m_port )
+ {
+ return false;
+ }
+ else if( m_optional != connection.m_optional )
+ {
+ return false;
+ }
+ else if( m_enabled != connection.m_enabled )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+
+ public int hashCode()
+ {
+ int hash = new Integer( m_port ).hashCode();
+ if( null != m_host )
+ {
+ hash ^= m_host.hashCode();
+ }
+ hash ^= new Boolean( m_optional ).hashCode();
+ hash ^= new Boolean( m_enabled ).hashCode();
+ return hash;
+ }
+}
+

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
Fri Jun 17 05:54:23 2005
@@ -18,18 +18,20 @@

package net.dpml.transit.model;

+import java.rmi.Remote;
+import java.rmi.RemoteException;
import java.util.EventListener;

/**
* A ContentListener maintains information about the configuration of
* content type.
*/
-public interface ContentListener extends EventListener
+public interface ContentListener extends EventListener, Remote
{
/**
* Notify a regstry listener of the change to the plugin assigned
* to be the content handler for a content type.
* @param event the content plugin change event
*/
- void titleChanged( ContentEvent event );
+ void titleChanged( ContentEvent 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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,7 @@

package net.dpml.transit.model;

+import java.rmi.RemoteException;
import java.net.URI;

/**
@@ -31,30 +32,30 @@
* Return the immutable content type identifier.
* @return the content type
*/
- String getContentType();
+ String getContentType() throws RemoteException;

/**
* Returns the human readable name of the content type handler.
* @return the content type human readable name
*/
- public String getTitle();
+ public String getTitle() throws RemoteException;

/**
* Set the layout title.
* @param title the layout title to assign
*/
- void setTitle( String title );
+ void setTitle( String title ) throws RemoteException;

/**
* Add a content listener to the director.
* @param listener the listener to add
*/
- void addContentListener( ContentListener listener );
+ void addContentListener( ContentListener listener ) throws
RemoteException;

/**
* Remove a content listener from the director.
* @param listener the listener to remove
*/
- void removeContentListener( ContentListener listener );
+ void removeContentListener( ContentListener listener ) throws
RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryListener.java
Fri Jun 17 05:54:23 2005
@@ -19,24 +19,26 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* A ContentRegistryListener maintains information about the configuration
of a Transit
* content management system. An implementation of this interface would be
supplied
* a ContentRegistry implementation.
*/
-public interface ContentRegistryListener extends EventListener
+public interface ContentRegistryListener extends EventListener, Remote
{
/**
* Notify all listeners of the addition of a content model.
* @param event the registry event
*/
- void contentAdded( ContentRegistryEvent event );
+ void contentAdded( ContentRegistryEvent event ) throws RemoteException;

/**
* Notify all listeners of the removal of a content model.
* @param event the registry event
*/
- void contentRemoved( ContentRegistryEvent event );
+ void contentRemoved( ContentRegistryEvent event ) throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ContentRegistryModel.java
Fri Jun 17 05:54:23 2005
@@ -18,9 +18,10 @@

package net.dpml.transit.model;

+import java.io.IOException;
+import java.rmi.RemoteException;
import java.net.URI;

-
/**
* A RegistryModel maintains information about the configuration of the
Transit
* content registry subsystem. Instances of RegistryModel shall be supplied
to
@@ -29,10 +30,15 @@
public interface ContentRegistryModel extends CodeBaseModel
{
/**
- * Return an array of content directors currently assigned to the
registry.
- * @return the content director array
+ * Initialization of the content registry model.
+ */
+ void initialize() throws IOException;
+
+ /**
+ * Return an array of content managers currently assigned to the registry.
+ * @return the content manager array
*/
- ContentModel[] getContentModels();
+ ContentModel[] getContentModels() throws RemoteException;

/**
* Return a content model matching the supplied type. If the type is
unknown
@@ -40,27 +46,28 @@
*
* @return the content model
*/
- ContentModel getContentModel( String type ) throws UnknownKeyException;
+ ContentModel getContentModel( String type ) throws UnknownKeyException,
RemoteException;

- void addContentModel( String type ) throws DuplicateKeyException;
+ void addContentModel( String type ) throws DuplicateKeyException,
RemoteException;

- void addContentModel( String type, String title, URI uri ) throws
DuplicateKeyException;
+ void addContentModel( String type, String title, URI uri )
+ throws DuplicateKeyException, RemoteException;

- void addContentModel( ContentModel model ) throws DuplicateKeyException;
+ void addContentModel( ContentModel model ) throws DuplicateKeyException,
RemoteException;

- void removeContentModel( ContentModel model );
+ void removeContentModel( ContentModel model ) throws RemoteException;

/**
* Add a regstry change listener.
* @param listener the registry change listener to add
*/
- void addRegistryListener( ContentRegistryListener listener );
+ void addRegistryListener( ContentRegistryListener listener ) throws
RemoteException;

/**
* Remove a regstry change listener.
* @param listener the registry change listener to remove
*/
- void removeRegistryListener( ContentRegistryListener listener );
+ void removeRegistryListener( ContentRegistryListener listener ) throws
RemoteException;


}

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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.io.File;
import java.io.IOException;
+import java.rmi.RemoteException;
import java.net.URI;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -76,7 +77,7 @@
public DefaultCacheModel(
Logger logger, Date creation, CacheHome home,
URI uri, File cache, HostModel[] hosts, LayoutModel layout,
LayoutRegistryModel registry )
- throws DuplicateKeyException
+ throws DuplicateKeyException, RemoteException
{
super( logger, creation, home, uri );
if( null == cache )
@@ -106,7 +107,7 @@
/**
* Notify the listener of the disposal of a layout.
*/
- public void disposing( DisposalEvent event ) throws VetoDisposalException
+ public void disposing( DisposalEvent event ) throws
VetoDisposalException, RemoteException
{
final String message = "Layout currently assigned to cache.";
throw new VetoDisposalException( this, message );
@@ -115,7 +116,7 @@
/**
* Notify the listener of the disposal of a manager.
*/
- public void disposed( DisposalEvent event ) // should never happen
+ public void disposed( DisposalEvent event ) throws RemoteException //
should never happen
{
final String error =
"Unexpected notification of disposal of an assigned cache layout.";
@@ -130,7 +131,7 @@
* Return the cache layout strategy model.
* @return the layout model
*/
- public LayoutModel getLayoutModel()
+ public LayoutModel getLayoutModel() throws RemoteException
{
return m_layout;
}
@@ -140,7 +141,7 @@
*
* @param file the cache directory
*/
- public void setCacheDirectory( final File file )
+ public void setCacheDirectory( final File file ) throws RemoteException
{
setCacheDirectory( file, true );
}
@@ -150,7 +151,7 @@
*
* @param file the cache directory
*/
- public void setCacheDirectory( final File file, boolean notify )
+ public void setCacheDirectory( final File file, boolean notify ) throws
RemoteException
{
synchronized( m_lock )
{
@@ -188,7 +189,7 @@
}
}

- public LayoutRegistryModel getLayoutRegistryModel()
+ public LayoutRegistryModel getLayoutRegistryModel() throws
RemoteException
{
return m_registry;
}
@@ -198,7 +199,7 @@
*
* @return the host manager array
*/
- public HostModel[] getHostModels()
+ public HostModel[] getHostModels() throws RemoteException
{
synchronized( m_lock )
{
@@ -206,7 +207,7 @@
}
}

- public HostModel getHostModel( String id ) throws UnknownKeyException
+ public HostModel getHostModel( String id ) throws UnknownKeyException,
RemoteException
{
synchronized( m_lock )
{
@@ -223,18 +224,18 @@
}
}

- public void addHostModel( String id ) throws DuplicateKeyException
+ public void addHostModel( String id ) throws DuplicateKeyException,
RemoteException
{
HostModel manager = m_home.createHostModel( id );
addHostModel( manager );
}

- public void addHostModel( HostModel manager ) throws
DuplicateKeyException
+ public void addHostModel( HostModel manager ) throws
DuplicateKeyException, RemoteException
{
addHostModel( manager, true );
}

- public void addHostModel( HostModel manager, boolean notify ) throws
DuplicateKeyException
+ public void addHostModel( HostModel manager, boolean notify ) throws
DuplicateKeyException, RemoteException
{
synchronized( m_lock )
{
@@ -256,7 +257,7 @@
}
}

- public void removeHostModel( HostModel model )
+ public void removeHostModel( HostModel model ) throws RemoteException
{
synchronized( m_lock )
{
@@ -271,7 +272,7 @@
* Return the directory to be used by the cache handler as the cache
directory.
* @return the cache directory.
*/
- public File getCacheDirectory()
+ public File getCacheDirectory() throws RemoteException
{
return m_cache;
}
@@ -280,7 +281,7 @@
* Add a cache change listener.
* @param listener the listener to add
*/
- public void addCacheListener( CacheListener listener )
+ public void addCacheListener( CacheListener listener ) throws
RemoteException
{
super.addListener( listener );
}
@@ -289,7 +290,7 @@
* Remove a cache change listener.
* @param listener the listener to remove
*/
- public void removeCacheListener( CacheListener listener )
+ public void removeCacheListener( CacheListener listener ) throws
RemoteException
{
super.removeListener( listener );
}
@@ -298,7 +299,7 @@
// Disposable
//
------------------------------------------------------------------------

- public void dispose()
+ public void dispose() throws RemoteException
{
super.dispose();
m_layout.removeDisposalListener( this );

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.EventObject;
import java.util.EventListener;
@@ -53,6 +54,7 @@
//
------------------------------------------------------------------------

public DefaultCodeBaseModel( Logger logger, Date creation, CodeBaseHome
home, URI uri )
+ throws RemoteException
{
super( logger, creation );
m_uri = uri;

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.EventObject;
import java.util.EventListener;
import java.util.Date;
@@ -49,7 +50,7 @@

public DefaultContentModel(
Logger logger, Date creation, ContentHome home,
- URI uri, String type, String title )
+ URI uri, String type, String title ) throws RemoteException
{
super( logger, creation, home, uri );
m_type = type;
@@ -65,7 +66,7 @@
* Return the immutable content type identifier.
* @return the content type
*/
- public String getContentType()
+ public String getContentType() throws RemoteException
{
return m_type;
}
@@ -74,7 +75,7 @@
* Returns the human readable name of the content type handler.
* @return the content type human readable name
*/
- public String getTitle()
+ public String getTitle() throws RemoteException
{
return m_title;
}
@@ -83,7 +84,7 @@
* Add a content listener to the director.
* @param listener the listener to add
*/
- public void addContentListener( ContentListener listener )
+ public void addContentListener( ContentListener listener ) throws
RemoteException
{
super.addListener( listener );
}
@@ -92,12 +93,12 @@
* Remove a content listener from the director.
* @param listener the listener to remove
*/
- public void removeContentListener( ContentListener listener )
+ public void removeContentListener( ContentListener listener ) throws
RemoteException
{
super.removeListener( listener );
}

- public void setTitle( String title )
+ public void setTitle( String title ) throws RemoteException
{
synchronized( m_lock )
{
@@ -117,7 +118,7 @@
// Disposable
//----------------------------------------------------------------------

- public void dispose()
+ public void dispose() throws RemoteException
{
super.dispose();
if( m_home.isMutable() && ( m_home instanceof Removable ) )
@@ -131,7 +132,7 @@
// internal
//
------------------------------------------------------------------------

- public void processEvent( EventObject event )
+ protected void processEvent( EventObject event )
{
if( event instanceof ContentEvent )
{

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
Fri Jun 17 05:54:23 2005
@@ -18,7 +18,9 @@

package net.dpml.transit.model;

+import java.io.IOException;
import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -27,6 +29,7 @@
import java.util.EventObject;
import java.util.EventListener;

+import net.dpml.transit.Transit;
import net.dpml.transit.home.ContentRegistryHome;

/**
@@ -47,21 +50,18 @@

private ContentRegistryHome m_home;

+ private boolean m_init = false;
+
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

public DefaultContentRegistryModel(
Logger logger, Date creation, ContentRegistryHome home,
- URI uri, ContentModel[] managers ) throws DuplicateKeyException
+ URI uri ) throws DuplicateKeyException, RemoteException
{
super( logger, creation, home, uri );
m_home = home;
- for( int i=0; i<managers.length; i++ )
- {
- ContentModel manager = managers[i];
- addContentModel( manager, false );
- }
}

//
------------------------------------------------------------------------
@@ -69,10 +69,40 @@
//
------------------------------------------------------------------------

/**
+ * Initialization of the content registry model.
+ */
+ public void initialize() throws IOException
+ {
+ synchronized( m_lock )
+ {
+ if( false == m_init )
+ {
+ m_init = true;
+ try
+ {
+ Transit.getInstance();
+ ContentModel[] models = m_home.createContentModels();
+ for( int i=0; i<models.length; i++ )
+ {
+ ContentModel model = models[i];
+ addContentModel( model, false );
+ }
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected exception during late initialization of
content models.";
+ throw new ModelRuntimeException( error, e );
+ }
+ }
+ }
+ }
+
+ /**
* Return an array of content managers currently assigned to the registry.
* @return the content manager array
*/
- public ContentModel[] getContentModels()
+ public ContentModel[] getContentModels() throws RemoteException
{
synchronized( m_lock )
{
@@ -80,10 +110,14 @@
}
}

- public ContentModel getContentModel( String type ) throws
UnknownKeyException
+ public ContentModel getContentModel( String type ) throws
UnknownKeyException, RemoteException
{
synchronized( m_lock )
{
+ if( false == m_init )
+ {
+ throw new IllegalStateException( "init" );
+ }
ContentModel[] managers = getContentModels();
for( int i=0; i<managers.length; i++ )
{
@@ -97,24 +131,27 @@
}
}

- public void addContentModel( String type ) throws DuplicateKeyException
+ public void addContentModel( String type ) throws DuplicateKeyException,
RemoteException
{
ContentModel manager = m_home.createContentModel( type );
addContentModel( manager );
}

- public void addContentModel( String type, String title, URI uri ) throws
DuplicateKeyException
+ public void addContentModel( String type, String title, URI uri )
+ throws DuplicateKeyException, RemoteException
{
ContentModel manager = m_home.createContentModel( type, title, uri );
addContentModel( manager );
}

- public void addContentModel( ContentModel manager ) throws
DuplicateKeyException
+ public void addContentModel( ContentModel manager )
+ throws DuplicateKeyException, RemoteException
{
addContentModel( manager, true );
}

- private void addContentModel( ContentModel manager, boolean notify )
throws DuplicateKeyException
+ private void addContentModel( ContentModel manager, boolean notify )
+ throws DuplicateKeyException, RemoteException
{
synchronized( m_lock )
{
@@ -136,7 +173,7 @@
}
}

- public void removeContentModel( ContentModel model )
+ public void removeContentModel( ContentModel model ) throws
RemoteException
{
synchronized( m_lock )
{
@@ -151,7 +188,7 @@
* Add a regstry change listener.
* @param listener the registry change listener to add
*/
- public void addRegistryListener( ContentRegistryListener listener )
+ public void addRegistryListener( ContentRegistryListener listener )
throws RemoteException
{
super.addListener( listener );
}
@@ -160,7 +197,7 @@
* Remove a regstry change listener.
* @param listener the registry change listener to remove
*/
- public void removeRegistryListener( ContentRegistryListener listener )
+ public void removeRegistryListener( ContentRegistryListener listener )
throws RemoteException
{
super.removeListener( listener );
}

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.io.IOException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.Map;
import java.util.ArrayList;
@@ -45,7 +46,7 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
public class DefaultHostModel extends DisposableCodeBaseModel
- implements HostModel, DisposalListener
+ implements HostModel, DisposalListener, Comparable
{
private final HostHome m_home;
private final String m_id;
@@ -72,6 +73,7 @@
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 );

@@ -105,7 +107,7 @@
// Disposable
//----------------------------------------------------------------------

- public void dispose()
+ public void dispose() throws RemoteException
{
super.dispose();
m_layout.removeDisposalListener( this );
@@ -123,7 +125,7 @@
/**
* Notify the listener of the disposal of a layout.
*/
- public void disposing( DisposalEvent event ) throws VetoDisposalException
+ public void disposing( DisposalEvent event ) throws
VetoDisposalException, RemoteException
{
final String id = getID();
final String message = "Layout currently assigned to host: " + id;
@@ -133,7 +135,7 @@
/**
* Notify the listener of the disposal of the layout.
*/
- public void disposed( DisposalEvent event ) // should never happen
+ public void disposed( DisposalEvent event ) throws RemoteException //
should never happen
{
setEnabled( false );
final String error =
@@ -151,7 +153,7 @@

public void update(
URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
- PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException
+ PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException, RemoteException
{
synchronized( m_lock )
{
@@ -177,7 +179,7 @@
}
}

- public void setName( String name )
+ public void setName( String name ) throws RemoteException
{
synchronized( m_lock )
{
@@ -193,7 +195,7 @@
}
}

- public void setPriority( int priority )
+ public void setPriority( int priority ) throws RemoteException
{
synchronized( m_lock )
{
@@ -214,7 +216,7 @@
* a resolver model that is based on a classname as opposed to
* plugin (because bootstrap hosts are repository indepedent)
*/
- public void setLayoutModel( LayoutModel layout ) throws
BootstrapException
+ public void setLayoutModel( LayoutModel layout ) throws
BootstrapException, RemoteException
{
synchronized( m_lock )
{
@@ -233,7 +235,7 @@
}
}

- private void checkLayout( LayoutModel layout ) throws BootstrapException
+ private void checkLayout( LayoutModel layout ) throws
BootstrapException, RemoteException
{
if( isBootstrap() )
{
@@ -264,10 +266,19 @@
}
else
{
- HostModel host = (HostModel) other;
- Integer i = new Integer( getPriority() );
- Integer j = new Integer( host.getPriority() );
- return i.compareTo( j );
+ try
+ {
+ HostModel host = (HostModel) other;
+ Integer i = new Integer( getPriority() );
+ Integer j = new Integer( host.getPriority() );
+ return i.compareTo( j );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to compare host dur to a remote exception.";
+ throw new ModelRuntimeException( error, e );
+ }
}
}

@@ -275,7 +286,7 @@
* Return an immutable host identifier. The host identifier shall be
* guranteed to be unique and constant for the life of the model.
*/
- public String getID()
+ public String getID() throws RemoteException
{
return m_id;
}
@@ -285,7 +296,7 @@
* provided such that they independent of the Transit respository
* service.
*/
- public boolean isBootstrap()
+ public boolean isBootstrap() throws RemoteException
{
return m_bootstrap;
}
@@ -294,7 +305,7 @@
* Return the host priority.
* @return the host priority setting
*/
- public int getPriority()
+ public int getPriority() throws RemoteException
{
synchronized( m_lock )
{
@@ -306,7 +317,7 @@
* Return the name of the resource host. The value returned may be used
to uniquely
* identify the host within the set of managed hosts.
*/
- public String getHostName()
+ public String getHostName() throws RemoteException
{
synchronized( m_lock )
{
@@ -318,7 +329,7 @@
* Return the host base url.
* @return the base url
*/
- public URL getBaseURL()
+ public URL getBaseURL() throws RemoteException
{
synchronized( m_lock )
{
@@ -330,7 +341,7 @@
* Return index url.
* @return the index url
*/
- public URL getIndexURL()
+ public URL getIndexURL() throws RemoteException
{
synchronized( m_lock )
{
@@ -342,7 +353,7 @@
* Return the enabled status of the host.
* @return TRUE if enabled
*/
- public boolean getEnabled()
+ public boolean getEnabled() throws RemoteException
{
synchronized( m_lock )
{
@@ -354,7 +365,7 @@
* Return the trusted status.
* @return TRUE if trusted
*/
- public boolean getTrusted()
+ public boolean getTrusted() throws RemoteException
{
synchronized( m_lock )
{
@@ -366,7 +377,7 @@
* Return the host password authentication credentials.
* @return the password authentication credentials
*/
- public PasswordAuthentication getAuthentication()
+ public PasswordAuthentication getAuthentication() throws RemoteException
{
synchronized( m_lock )
{
@@ -378,7 +389,7 @@
* Return the host request identifier.
* @return the identifier
*/
- public RequestIdentifier getRequestIdentifier()
+ public RequestIdentifier getRequestIdentifier() throws RemoteException
{
synchronized( m_lock )
{
@@ -390,7 +401,7 @@
* Return the layout strategy model.
* @return the layout model
*/
- public LayoutModel getLayoutModel()
+ public LayoutModel getLayoutModel() throws RemoteException
{
synchronized( m_lock )
{
@@ -402,7 +413,7 @@
* Add a host change listener to the model.
* @param listener the host change listener to add
*/
- public void addHostListener( HostListener listener )
+ public void addHostListener( HostListener listener ) throws
RemoteException
{
super.addListener( listener );
}
@@ -411,7 +422,7 @@
* Remove a host change listener from the model.
* @param listener the host change listener to remove
*/
- public void removeHostListener( HostListener listener )
+ public void removeHostListener( HostListener listener ) throws
RemoteException
{
super.removeListener( listener );
}

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.EventObject;
import java.util.EventListener;
import java.util.Date;
@@ -53,6 +54,7 @@
public DefaultLayoutModel(
final Logger logger, Date creation, final LayoutHome home,
final String id, Strategy strategy, final String title )
+ throws RemoteException
{
super( logger, creation, home, null );

@@ -79,7 +81,7 @@
// LayoutModel
//----------------------------------------------------------------------

- public void setTitle( String title )
+ public void setTitle( String title ) throws RemoteException
{
synchronized( m_lock )
{
@@ -99,7 +101,7 @@
* Return the immutable resolver identifier.
* @return the resolver identifier
*/
- public String getID()
+ public String getID() throws RemoteException
{
return m_id;
}
@@ -109,7 +111,7 @@
*
* @return the bootstrap status of the resolver.
*/
- public boolean isBootstrap()
+ public boolean isBootstrap() throws RemoteException
{
return m_bootstrap;
}
@@ -120,7 +122,7 @@
*
* @return the resolver classname
*/
- public String getClassname()
+ public String getClassname() throws RemoteException
{
return m_classname;
}
@@ -129,7 +131,7 @@
* Returns the human readable name of the resolver.
* @return the resolver human readable name
*/
- public String getTitle()
+ public String getTitle() throws RemoteException
{
synchronized( m_lock )
{
@@ -141,7 +143,7 @@
* Add a resolver listener to the model.
* @param listener the listener to add
*/
- public void addLayoutListener( LayoutListener listener )
+ public void addLayoutListener( LayoutListener listener ) throws
RemoteException
{
super.addListener( listener );
}
@@ -150,7 +152,7 @@
* Remove a content listener from the director.
* @param listener the listener to remove
*/
- public void removeLayoutListener( LayoutListener listener )
+ public void removeLayoutListener( LayoutListener listener ) throws
RemoteException
{
super.removeListener( listener );
}
@@ -159,7 +161,7 @@
// Disposable
//----------------------------------------------------------------------

- public void dispose()
+ public void dispose() throws RemoteException
{
super.dispose();
if( m_home.isMutable() && ( m_home instanceof Removable ) )
@@ -175,7 +177,7 @@

public String toString()
{
- return " " + getTitle();
+ return " " + m_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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.util.ArrayList;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.List;
import java.util.LinkedList;
@@ -57,7 +58,7 @@

public DefaultLayoutRegistryModel(
Logger logger, Date creation, LayoutRegistryHome home, URI uri,
LayoutModel[] managers )
- throws DuplicateKeyException
+ throws DuplicateKeyException, RemoteException
{
super( logger, creation, home, uri );

@@ -77,7 +78,7 @@
* Add a regstry change listener.
* @param listener the registry change listener to add
*/
- public void addLayoutRegistryListener( LayoutRegistryListener listener )
+ public void addLayoutRegistryListener( LayoutRegistryListener listener )
throws RemoteException
{
super.addListener( listener );
}
@@ -86,23 +87,24 @@
* Remove a regstry change listener.
* @param listener the registry change listener to remove
*/
- public void removeLayoutRegistryListener( LayoutRegistryListener
listener )
+ public void removeLayoutRegistryListener( LayoutRegistryListener
listener ) throws RemoteException
{
super.removeListener( listener );
}

- public void addLayoutModel( String id ) throws DuplicateKeyException
+ public void addLayoutModel( String id ) throws DuplicateKeyException,
RemoteException
{
LayoutModel manager = m_home.createLayoutModel( id );
addLayoutModel( manager );
}

- public void addLayoutModel( LayoutModel manager ) throws
DuplicateKeyException
+ public void addLayoutModel( LayoutModel manager ) throws
DuplicateKeyException, RemoteException
{
addLayoutModel( manager, true );
}

- private void addLayoutModel( LayoutModel manager, boolean notify )
throws DuplicateKeyException
+ private void addLayoutModel( LayoutModel manager, boolean notify )
+ throws DuplicateKeyException, RemoteException
{
synchronized( m_lock )
{
@@ -128,7 +130,7 @@
* Return an array of content managers currently assigned to the registry.
* @return the content manager array
*/
- public LayoutModel[] getLayoutModels()
+ public LayoutModel[] getLayoutModels() throws RemoteException
{
synchronized( m_lock )
{
@@ -136,7 +138,7 @@
}
}

- public LayoutModel getLayoutModel( String id ) throws UnknownKeyException
+ public LayoutModel getLayoutModel( String id ) throws
UnknownKeyException, RemoteException
{
synchronized( m_lock )
{
@@ -157,7 +159,7 @@
}
}

- public void removeLayoutModel( LayoutModel model ) throws
ModelReferenceException
+ public void removeLayoutModel( LayoutModel model ) throws
ModelReferenceException, RemoteException
{
synchronized( m_lock )
{

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
Fri Jun 17 05:54:23 2005
@@ -18,7 +18,10 @@

package net.dpml.transit.model;

+import java.io.Serializable;
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;
@@ -33,7 +36,7 @@
* A abstract base class that established an event queue and handles event
dispatch
* operations for listeners declared in a class extending this base class.
*/
-public abstract class DefaultModel implements Model
+public abstract class DefaultModel extends UnicastRemoteObject implements
Model
{
//
------------------------------------------------------------------------
// state
@@ -66,8 +69,10 @@
//
------------------------------------------------------------------------

public DefaultModel( Logger logger, Date creation )
- throws NullPointerException
+ throws NullPointerException, RemoteException
{
+ super();
+
if( null == logger )
{
throw new NullPointerException( "logger" );
@@ -330,11 +335,11 @@
}
}

- public abstract static class Strategy
+ public abstract static class Strategy implements Serializable
{
}

- public static class Local extends Strategy
+ public static class Local extends Strategy
{
private String m_classname;
private boolean m_bootstrap;
@@ -354,6 +359,41 @@
{
return m_bootstrap;
}
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( other instanceof Local )
+ {
+ Local local = (Local) other;
+ if( false == m_classname.equals( local.getClassname() ) )
+ {
+ return false;
+ }
+ else if( isBootstrap() != local.isBootstrap() )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int hash = new Boolean( m_bootstrap ).hashCode();
+ hash ^= m_classname.hashCode();
+ return hash;
+ }
}

public static class Plugin extends Strategy
@@ -369,6 +409,27 @@
{
return m_uri;
}
- }

+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ if( other instanceof Plugin )
+ {
+ Plugin plugin = (Plugin) other;
+ return m_uri.equals( plugin.getURI() );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ return m_uri.hashCode();
+ }
+ }
}

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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.io.File;
import java.io.IOException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.EventObject;
import java.util.EventListener;
@@ -56,9 +57,10 @@
public DefaultProxyModel(
Logger logger, Date creation, ProxyHome home,
URL host, PasswordAuthentication auth, String[] excludes )
- throws NullPointerException
+ throws NullPointerException, RemoteException
{
super( logger, creation );
+
m_host = host;
m_authentication = auth;
m_excludes = excludes;

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.EventObject;
import java.util.Date;

@@ -31,7 +32,8 @@
*/
public class DefaultRepositoryModel extends DisposableCodeBaseModel
implements RepositoryModel
{
- public DefaultRepositoryModel( Logger logger, Date creation,
RepositoryHome home, URI uri )
+ public DefaultRepositoryModel( Logger logger, Date creation,
RepositoryHome home, URI uri )
+ throws RemoteException
{
super( logger, creation, 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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,7 @@

package net.dpml.transit.model;

+import java.rmi.RemoteException;
import java.util.Date;
import java.util.EventObject;

@@ -48,10 +49,14 @@
public DefaultTransitModel(
Logger logger, Date creation, TransitHome home, CacheModel cache,
ContentRegistryModel content, RepositoryModel repository,
- ProxyModel proxy )
+ ProxyModel proxy ) throws RemoteException
{
super( logger, creation );

+ if( null == home )
+ {
+ throw new NullPointerException( "home" );
+ }
if( null == cache )
{
throw new NullPointerException( "cache" );
@@ -81,6 +86,15 @@
//
------------------------------------------------------------------------

/**
+ * Return the model identifier.
+ * @return the model id
+ */
+ public String getID()
+ {
+ return m_home.getID();
+ }
+
+ /**
* Return the proxy model.
* @return the proxy configuration model.
*/
@@ -117,5 +131,6 @@
{
return m_repository;
}
+
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/Disposable.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/Disposable.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/Disposable.java
Fri Jun 17 05:54:23 2005
@@ -18,15 +18,17 @@

package net.dpml.transit.model;

+import java.rmi.RemoteException;
+
/**
* The abstract model interface.
*/
public interface Disposable
{
- void addDisposalListener( DisposalListener listener );
+ void addDisposalListener( DisposalListener listener ) throws
RemoteException;

- void removeDisposalListener( DisposalListener listener );
+ void removeDisposalListener( DisposalListener listener ) throws
RemoteException;

- void dispose();
+ void dispose() throws RemoteException;

}

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.EventObject;
import java.util.EventListener;
@@ -39,6 +40,7 @@
//
------------------------------------------------------------------------

public DisposableCodeBaseModel( Logger logger, Date creation,
CodeBaseHome home, URI uri )
+ throws RemoteException
{
super( logger, creation, home, uri );
}
@@ -51,7 +53,7 @@
* Add a disposal listener to the model.
* @param listener the listener to add
*/
- public void addDisposalListener( DisposalListener listener )
+ public void addDisposalListener( DisposalListener listener ) throws
RemoteException
{
super.addListener( listener );
}
@@ -60,18 +62,17 @@
* Remove a disposal listener from the model.
* @param listener the listener to remove
*/
- public void removeDisposalListener( DisposalListener listener )
+ public void removeDisposalListener( DisposalListener listener ) throws
RemoteException
{
super.removeListener( listener );
}

- public void dispose()
+ public void dispose() throws RemoteException
{
VetoableDisposalEvent veto = new VetoableDisposalEvent( this );
enqueueEvent( veto, false );
DisposalEvent disposal = new DisposalEvent( this );
enqueueEvent( disposal, false );
-
}

//----------------------------------------------------------------------
@@ -102,7 +103,16 @@
DisposalListener pl = (DisposalListener) listener;
if( event instanceof VetoableDisposalEvent )
{
- pl.disposing( event );
+ try
+ {
+ pl.disposing( event );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Disposal listener remote notification error.";
+ getLogger().error( error, e );
+ }
}
else
{

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposalListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposalListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposalListener.java
Fri Jun 17 05:54:23 2005
@@ -19,21 +19,23 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* A ProxyListener maintains information about the configuration of
* tranist proxy settings.
*/
-public interface DisposalListener extends EventListener
+public interface DisposalListener extends EventListener, Remote
{
/**
* Notify the listener of the disposal of a manager.
*/
- void disposing( DisposalEvent event ) throws VetoDisposalException;
+ void disposing( DisposalEvent event ) throws VetoDisposalException,
RemoteException;

/**
* Notify a listener of a change to the manager modification date.
* @param event the modification event
*/
- void disposed( DisposalEvent event );
+ void disposed( DisposalEvent event ) throws RemoteException;
}

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 Jun 17 05:54:23 2005
@@ -70,4 +70,14 @@
{
return m_authentication;
}
+
+ public boolean getEnabled()
+ {
+ return m_enabled;
+ }
+
+ public boolean getTrusted()
+ {
+ return m_trusted;
+ }
}

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 Jun 17 05:54:23 2005
@@ -19,6 +19,8 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* The HostListener is an interface implmented by resource host
@@ -26,32 +28,32 @@
* method that is invoked by a host director signalling one or more changes
* to the host configuration.
*/
-public interface HostListener extends EventListener
+public interface HostListener extends EventListener, Remote
{
/**
* Notify a consumer of the change to the host name.
* @param event the host name change event
*/
- void nameChanged( HostNameEvent event );
+ void nameChanged( HostNameEvent event ) throws RemoteException;

/**
* Notify a consumer of an aggregated set of changes concerning the
* base url, index, request identifier and/or authentication.
* @param event the host change event
*/
- void hostChanged( HostChangeEvent event );
+ void hostChanged( HostChangeEvent event ) throws RemoteException;

/**
* Notify a consumer of a change to the host priority.
* @param event the host event
*/
- void priorityChanged( HostPriorityEvent event );
+ void priorityChanged( HostPriorityEvent event ) throws RemoteException;

/**
* Notify a consumer of a change to the host layout.
* @param event the host layout change event
*/
- void layoutChanged( HostLayoutEvent event );
+ void layoutChanged( HostLayoutEvent event ) throws RemoteException;

}


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 Jun 17 05:54:23 2005
@@ -22,6 +22,7 @@
import java.net.URI;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
+import java.rmi.RemoteException;

import net.dpml.transit.network.RequestIdentifier;

@@ -33,74 +34,74 @@
* synchronization via change events raised by implementations of this
* interface.
*/
-public interface HostModel extends CodeBaseModel, Comparable, Disposable
+public interface HostModel extends CodeBaseModel, Disposable
{
/**
* Return an immutable host identifier. The host identifier shall be
* guranteed to be unique and constant for the life of the model.
*/
- String getID();
+ String getID() throws RemoteException;

/**
* Return TRUE if this is a bootstrap host. Bootstrap hosts shall be
* provided such that they independent of the Transit respository
* service.
*/
- boolean isBootstrap();
+ boolean isBootstrap() throws RemoteException;

/**
* Return the name of the resource host. The value returned may be used
to uniquely
* identify the host within the set of managed hosts.
*/
- String getHostName();
+ String getHostName() throws RemoteException;

/**
* Return the host priority.
* @return the host priority setting
*/
- int getPriority();
+ int getPriority() throws RemoteException;

/**
* Return the host base url.
* @return the base url
*/
- URL getBaseURL();
+ URL getBaseURL() throws RemoteException;

/**
* Return index url.
* @return the index url
*/
- URL getIndexURL();
+ URL getIndexURL() throws RemoteException;

/**
* Return the enabled status of the host.
* @return TRUE if enabled
*/
- boolean getEnabled();
+ boolean getEnabled() throws RemoteException;

/**
* Return the trusted status.
* @return TRUE if trusted
*/
- boolean getTrusted();
+ boolean getTrusted() throws RemoteException;

/**
* Return the host password authentication credentials.
* @return the password authentication credentials
*/
- public PasswordAuthentication getAuthentication();
+ public PasswordAuthentication getAuthentication() throws
RemoteException;

/**
* Return the host request identifier.
* @return the identifier
*/
- public RequestIdentifier getRequestIdentifier();
+ public RequestIdentifier getRequestIdentifier() throws RemoteException;

/**
* Return the layout strategy model.
* @return the layout model
*/
- LayoutModel getLayoutModel();
+ LayoutModel getLayoutModel() throws RemoteException;

/**
* HTTP port number.
@@ -117,27 +118,27 @@
*/
static final int HTTPS_PORT = 443;

- void setName( String name );
+ void setName( String name ) throws RemoteException;

- void setPriority( int priority );
+ void setPriority( int priority ) throws RemoteException;

- void setLayoutModel( LayoutModel layout ) throws BootstrapException;
+ void setLayoutModel( LayoutModel layout ) throws BootstrapException,
RemoteException;

void update(
URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
- PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException;
+ PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException, RemoteException;

/**
* Add a host change listener to the director.
* @param listener the host change listener to add
*/
- void addHostListener( HostListener listener );
+ void addHostListener( HostListener listener ) throws RemoteException;

/**
* Remove a host change listener from the director.
* @param listener the host change listener to remove
*/
- void removeHostListener( HostListener listener );
+ void removeHostListener( HostListener listener ) throws RemoteException;

}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutListener.java
Fri Jun 17 05:54:23 2005
@@ -19,17 +19,19 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* A ContentListener maintains information about the configuration of
* content type.
*/
-public interface LayoutListener extends EventListener
+public interface LayoutListener extends EventListener, Remote
{
/**
* Notify a listener of the change to the human readable name of
* a location resolver plaugin.
* @param event the resolver model event
*/
- void titleChanged( LayoutEvent event );
+ void titleChanged( LayoutEvent event ) throws RemoteException;
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutModel.java
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;

/**
* A LayoutModel maintains information about the configuration
@@ -30,14 +31,14 @@
* Return the immutable resolver identifier.
* @return the resolver identifier
*/
- String getID();
+ String getID() throws RemoteException;

/**
* Return true if this is a bootstrap resolver.
*
* @return the bootstrap status of the resolver.
*/
- boolean isBootstrap();
+ boolean isBootstrap() throws RemoteException;

/**
* Return a possibly null classname. If the classname is not null the
@@ -46,26 +47,26 @@
*
* @return the resolver classname
*/
- String getClassname();
+ String getClassname() throws RemoteException;

/**
* Returns the human readable name of the location resolver.
* @return the layout human readable name
*/
- public String getTitle();
+ public String getTitle() throws RemoteException;

- void setTitle( String title );
+ void setTitle( String title ) throws RemoteException;

/**
* Add a resolver model listener.
* @param listener the listener to add
*/
- void addLayoutListener( LayoutListener listener );
+ void addLayoutListener( LayoutListener listener ) throws RemoteException;

/**
* Remove a resolver listener from the model.
* @param listener the listener to remove
*/
- void removeLayoutListener( LayoutListener listener );
+ void removeLayoutListener( LayoutListener listener ) throws
RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryListener.java
Fri Jun 17 05:54:23 2005
@@ -19,24 +19,26 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* A RegistryListener maintains information about the configuration of a
Transit
* content management system. An implementation of this interface would be
supplied
* a ContentRegistry implementation.
*/
-public interface LayoutRegistryListener extends EventListener
+public interface LayoutRegistryListener extends EventListener, Remote
{
/**
* Notify all listeners of the addition of a location resolver model.
* @param event the layout event
*/
- void layoutAdded( LayoutRegistryEvent event );
+ void layoutAdded( LayoutRegistryEvent event ) throws RemoteException;

/**
* Notify all listeners of the removal of a location resolver model.
* @param event the layout event
*/
- void layoutRemoved( LayoutRegistryEvent event );
+ void layoutRemoved( LayoutRegistryEvent event ) throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/LayoutRegistryModel.java
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.model;

import java.net.URI;
+import java.rmi.RemoteException;

/**
* A LayoutRegistryModel maintains information about the configuration of
the Transit
@@ -30,7 +31,7 @@
* Return the set of location resolver models.
* @return the model array.
*/
- LayoutModel[] getLayoutModels();
+ LayoutModel[] getLayoutModels() throws RemoteException;

/**
* Return a layout resolver model matching the supplied id. If the id is
unknown
@@ -38,40 +39,40 @@
*
* @return the layout model
*/
- LayoutModel getLayoutModel( String id ) throws UnknownKeyException;
+ LayoutModel getLayoutModel( String id ) throws UnknownKeyException,
RemoteException;

/**
* Add a change listener.
* @param listener the registry change listener to add
*/
- void addLayoutRegistryListener( LayoutRegistryListener listener );
+ void addLayoutRegistryListener( LayoutRegistryListener listener ) throws
RemoteException;

/**
* Remove a change listener.
* @param listener the registry change listener to remove
*/
- void removeLayoutRegistryListener( LayoutRegistryListener listener );
+ void removeLayoutRegistryListener( LayoutRegistryListener listener )
throws RemoteException;

/**
* Add a new layout model to the registry.
* @param id the layout model identity
* @exception DuplicateKeyException if a layout model of the same id
already exists
*/
- void addLayoutModel( String id ) throws DuplicateKeyException;
+ void addLayoutModel( String id ) throws DuplicateKeyException,
RemoteException;

/**
* Add a new layout model to the registry.
* @param model the layout model
* @exception DuplicateKeyException if a layout model of the same id
already exists
*/
- void addLayoutModel( LayoutModel model ) throws DuplicateKeyException;
+ void addLayoutModel( LayoutModel model ) throws DuplicateKeyException,
RemoteException;

/**
* Remove a layout model from the registry.
* @param model the layout model to be removed
* @exception ModelReferenceException if the layout is in use
*/
- void removeLayoutModel( LayoutModel model ) throws
ModelReferenceException;
+ void removeLayoutModel( LayoutModel model ) throws
ModelReferenceException, RemoteException;

}


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
Fri Jun 17 05:54:23 2005
@@ -18,25 +18,26 @@

package net.dpml.transit.model;

+import java.rmi.Remote;
import java.util.Date;

/**
* The abstract model interface.
*/
-public interface Model
+public interface Model extends Remote
{
/**
* Return the logging channel.
* @return the logging channel.
*/
- Logger getLogger();
+ //Logger getLogger();

- Date getCreationDate();
+ //Date getCreationDate();

- Date getModificationDate();
+ //Date getModificationDate();

- void setCreationDate( Date date );
+ //void setCreationDate( Date date );

- boolean isModified();
+ //boolean isModified();

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyListener.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyListener.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyListener.java
Fri Jun 17 05:54:23 2005
@@ -19,17 +19,19 @@
package net.dpml.transit.model;

import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;

/**
* A ProxyListener maintains information about the configuration of
* tranist proxy settings.
*/
-public interface ProxyListener extends EventListener
+public interface ProxyListener extends EventListener, Remote
{
/**
* Notify a listener of the change to Transit proxy settings.
* @param event the proxy change event
*/
- void proxyChanged( ProxyEvent event );
+ void proxyChanged( ProxyEvent event ) throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ProxyModel.java
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@

import java.net.URL;
import java.net.PasswordAuthentication;
+import java.rmi.RemoteException;

import net.dpml.transit.network.RequestIdentifier;

@@ -34,44 +35,44 @@
*
* @return the proxy host (possibly null)
*/
- public URL getHost();
+ public URL getHost() throws RemoteException;

/**
* Return the proxy authentication or null if not defined.
* @return the proxy authentication credentials
*/
- PasswordAuthentication getAuthentication();
+ PasswordAuthentication getAuthentication() throws RemoteException;

/**
* Return the proxy host request identifier.
* @return the request identifier for the proxy host or null if not
defined.
*/
- RequestIdentifier getRequestIdentifier();
+ RequestIdentifier getRequestIdentifier() throws RemoteException;

/**
* Return the set of excluded hosts as an array.
* @return the excluded host array
*/
- String[] getExcludes();
+ String[] getExcludes() throws RemoteException;

- void update( URL host, PasswordAuthentication auth, String[] excludes );
+ void update( URL host, PasswordAuthentication auth, String[] excludes )
throws RemoteException;

- void setHost( URL host );
+ void setHost( URL host ) throws RemoteException;

- void setExcludes( String[] excludes );
+ void setExcludes( String[] excludes ) throws RemoteException;

- void setAuthentication( PasswordAuthentication auth );
+ void setAuthentication( PasswordAuthentication auth ) throws
RemoteException;

/**
* Add a proxy listener to the model.
* @param listener the listener to add
*/
- void addProxyListener( ProxyListener listener );
+ void addProxyListener( ProxyListener listener ) throws RemoteException;

/**
* Remove a proxy listener from the model.
* @param listener the listener to remove
*/
- void removeProxyListener( ProxyListener listener );
+ void removeProxyListener( ProxyListener listener ) throws
RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/TransitModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/TransitModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/TransitModel.java
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,9 @@

package net.dpml.transit.model;

+import java.rmi.RemoteException;
+
+
/**
* The TransitModel is an interface implemented by objects that
* manage the configuration of a running transit system.
@@ -25,16 +28,22 @@
public interface TransitModel extends Model
{
/**
+ * Return the model identifier.
+ * @return the model id
+ */
+ String getID() throws RemoteException;
+
+ /**
* Return the proxy model.
* @return the proxy model
*/
- ProxyModel getProxyModel();
+ ProxyModel getProxyModel() throws RemoteException;

/**
* Return the cache model.
* @return the cache director
*/
- CacheModel getCacheModel();
+ CacheModel getCacheModel() throws RemoteException;

/**
* Return the model maintaining configuration information about
@@ -42,7 +51,7 @@
*
* @return the content model
*/
- ContentRegistryModel getContentRegistryModel();
+ ContentRegistryModel getContentRegistryModel() throws RemoteException;

/**
* Return the model maintaining configuration information about
@@ -50,6 +59,6 @@
*
* @return the repository model
*/
- RepositoryModel getRepositoryModel();
+ RepositoryModel getRepositoryModel() throws RemoteException;

}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/network/RequestIdentifier.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/network/RequestIdentifier.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/network/RequestIdentifier.java
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@

package net.dpml.transit.network;

+import java.io.Serializable;
import java.net.InetAddress;

import net.dpml.transit.NullArgumentException;
@@ -26,7 +27,7 @@
/**
* A request identifier.
*/
-public final class RequestIdentifier
+public final class RequestIdentifier implements Serializable
{
//
------------------------------------------------------------------------
// static

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/repository/StandardLoader.java
Fri Jun 17 05:54:23 2005
@@ -377,7 +377,7 @@
else
{
final String error =
- "Unable to resolve a value for a constructor parameter
parameter."
+ "Unable to resolve a value for a constructor
parameter."
+ "\nConstructor class: " +
constructor.getDeclaringClass().getName()
+ "\nParameter class: " + c.getName()
+ "\nParameter position: " + ( i + 1 );

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/AbstractLayout.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/AbstractLayout.java
Fri Jun 17 05:54:23 2005
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ * Copyright 2004 Niclas Hedhman.
+ *
+ * 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.runtime;
+
+import java.io.Serializable;
+
+
+/**
+ */
+public abstract class AbstractLayout implements Layout, Serializable
+{
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else
+ {
+ return getClass().equals( other.getClass() );
+ }
+ }
+
+ public int hashCode()
+ {
+ return getClass().hashCode();
+ }
+}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/CacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/CacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/CacheHandler.java
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@

package net.dpml.transit.runtime;

+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -40,6 +41,13 @@
public interface CacheHandler
{
/**
+ * Return the cache directory.
+ *
+ * @return the working cache directory
+ */
+ File getLocalFile( Artifact artifact ) throws IOException;
+
+ /**
* 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
@@ -47,7 +55,7 @@
*
* @exception TransitException if a custom host deployment error occurs
*/
- public void initialize() throws TransitException;
+ void initialize() throws IOException;

/**
* Attempts to download and cache a remote artifact using a set of remote

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultCacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultCacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultCacheHandler.java
Fri Jun 17 05:54:23 2005
@@ -28,6 +28,8 @@
import java.io.OutputStream;
import java.net.URI;
import java.net.UnknownHostException;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
@@ -61,7 +63,7 @@
/**
* Default cache handler that maintains a file based cache.
*/
-public class DefaultCacheHandler implements CacheHandler, CacheListener,
Handler
+public class DefaultCacheHandler extends UnicastRemoteObject implements
CacheHandler, CacheListener, Handler
{
//
------------------------------------------------------------------------
// state
@@ -81,9 +83,9 @@

private ZipCache m_zipCache;

- private Logger m_logger;
+ private final Logger m_logger;

- private CacheModel m_model;
+ private final CacheModel m_model;

private final Map m_plugins = new WeakHashMap(); // plugin uris as keys
to plugin classes

@@ -99,14 +101,17 @@
*
* @param model the cache system confiuguration model
*/
- public DefaultCacheHandler( CacheModel model ) throws TransitException
+ public DefaultCacheHandler( CacheModel model, Logger logger ) throws
IOException
{
+ super();
+
m_model = model;
+ m_logger = logger;
m_zipCache = new ZipCache();
m_resourceHosts = new TreeMap();

LayoutRegistryModel layoutModel = model.getLayoutRegistryModel();
- m_registry = new DefaultLayoutRegistry( layoutModel );
+ m_registry = new DefaultLayoutRegistry( layoutModel, logger );
LayoutModel layout = model.getLayoutModel();
try
{
@@ -120,8 +125,6 @@
throw new TransitException( error, e );
}

- m_logger = model.getLogger();
-
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "cache initialization" );
@@ -169,10 +172,22 @@
//
------------------------------------------------------------------------

/**
+ * Return a file referencing the the locally cached resource.
+ *
+ * @return the cached file
+ */
+ public File getLocalFile( Artifact artifact ) throws IOException
+ {
+ File cache = getLocalCacheDirectory();
+ String name = m_resolver.resolvePath( artifact );
+ return new File( cache, name );
+ }
+
+ /**
* Notify the listener of a change to the cache directory.
* @param event the cache directory change event
*/
- public void cacheDirectoryChanged( FileChangeEvent event )
+ public void cacheDirectoryChanged( FileChangeEvent event ) throws
RemoteException
{
File cache = event.getFile();
synchronized( this )
@@ -185,7 +200,7 @@
* Notify the listener of the addition of a new host.
* @param event the host added event
*/
- public void hostAdded( CacheEvent event )
+ public void hostAdded( CacheEvent event ) throws RemoteException
{
HostModel host = event.getHostModel();
try
@@ -196,7 +211,7 @@
{
final String error =
"An internal error occured while attempting to handle host
addition.";
- m_model.getLogger().error( error, e );
+ getLogger().error( error, e );
}
}

@@ -204,7 +219,7 @@
* Notify the listener of the removal of a host.
* @param event the host removed event
*/
- public void hostRemoved( CacheEvent event )
+ public void hostRemoved( CacheEvent event ) throws RemoteException
{
synchronized( m_resourceHosts )
{
@@ -238,21 +253,30 @@
*/
public void dispose()
{
- m_model.removeCacheListener( this );
- synchronized( m_resourceHosts )
+ try
{
-
- ResourceHost[] hosts = (ResourceHost[])
m_resourceHosts.values().toArray( new ResourceHost[0] );
- for( int i=0; i<hosts.length; i++ )
+ m_model.removeCacheListener( this );
+ synchronized( m_resourceHosts )
{
- ResourceHost host = hosts[i];
- if( host instanceof Handler )
+
+ ResourceHost[] hosts = (ResourceHost[])
m_resourceHosts.values().toArray( new ResourceHost[0] );
+ for( int i=0; i<hosts.length; i++ )
{
- Handler handler = (Handler) host;
- handler.dispose();
+ ResourceHost host = hosts[i];
+ if( host instanceof Handler )
+ {
+ Handler handler = (Handler) host;
+ handler.dispose();
+ }
}
+ m_resourceHosts.clear();
}
- m_resourceHosts.clear();
+ }
+ catch( RemoteException e )
+ {
+ final String warning =
+ "Unexpected remote exception occured while attempting to
dispose of the cache handler.";
+ getLogger().error( warning, e );
}
}

@@ -268,7 +292,7 @@
*
* @exception TransitException if a custom host deployment error occurs
*/
- public void initialize() throws TransitException
+ public void initialize() throws IOException
{
if( getLogger().isDebugEnabled() )
{
@@ -669,7 +693,7 @@
}
}

- protected ResourceHost loadResourceHost( HostModel model ) throws
TransitException
+ protected ResourceHost loadResourceHost( HostModel model ) throws
IOException
{
Class clazz = loadResourceHostClass( model );
Repository loader = Transit.getInstance().getRepository();
@@ -686,7 +710,7 @@
}
}

- protected Class loadResourceHostClass( HostModel model ) throws
TransitException
+ protected Class loadResourceHostClass( HostModel model ) throws
IOException
{
URI uri = model.getCodeBaseURI();
Class clazz = (Class) m_plugins.get( uri );
@@ -726,7 +750,7 @@
}
}

- private ResourceHost createDefaultResourceHost( HostModel model ) throws
TransitException
+ private ResourceHost createDefaultResourceHost( HostModel model ) throws
IOException
{
if( getLogger().isDebugEnabled() )
{
@@ -749,7 +773,7 @@
}
try
{
- return new DefaultResourceHost( model, m_registry );
+ return new DefaultResourceHost( model, m_registry, m_logger );
}
catch( Throwable e )
{
@@ -762,7 +786,7 @@

private Logger getLogger()
{
- return m_model.getLogger();
+ return m_logger;
}
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultContentRegistry.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultContentRegistry.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultContentRegistry.java
Fri Jun 17 05:54:23 2005
@@ -23,6 +23,8 @@
import java.net.URL;
import java.net.URISyntaxException;
import java.net.ContentHandler;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
import java.util.Hashtable;
import java.util.Map;
import java.util.WeakHashMap;
@@ -46,7 +48,7 @@
* A registry of descriptions of plugable content handlers. This
implementation
* maps user defined preferences to instance of ContentHandlerDescriptor.
*/
-public class DefaultContentRegistry implements Handler, ContentRegistry,
ContentRegistryListener
+public class DefaultContentRegistry extends UnicastRemoteObject implements
Handler, ContentRegistry, ContentRegistryListener
{
//
------------------------------------------------------------------------
// state
@@ -71,10 +73,12 @@
* artifact types, and values that correspond to the description of a
* content type handler plugins.
*/
- public DefaultContentRegistry( ContentRegistryModel model )
+ public DefaultContentRegistry( ContentRegistryModel model, Logger logger
) throws RemoteException
{
+ super();
+
m_model = model;
- m_logger = model.getLogger();
+ m_logger = logger;
model.addRegistryListener( this );
}

@@ -89,7 +93,16 @@
*/
public void dispose()
{
- m_model.removeRegistryListener( this );
+ try
+ {
+ m_model.removeRegistryListener( this );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while disposing of content
registry.";
+ m_logger.error( error, e );
+ }
}

//
------------------------------------------------------------------------
@@ -124,7 +137,7 @@
* Notify all listeners of the addition of a content model.
* @param event the registry event
*/
- public void contentAdded( ContentRegistryEvent event )
+ public void contentAdded( ContentRegistryEvent event ) throws
RemoteException
{
synchronized( m_handlers )
{
@@ -151,7 +164,7 @@
* Notify all listeners of the removal of a content model.
* @param event the registry event
*/
- public void contentRemoved( ContentRegistryEvent event )
+ public void contentRemoved( ContentRegistryEvent event ) throws
RemoteException
{
synchronized( m_handlers )
{
@@ -175,7 +188,7 @@
// impl
//
------------------------------------------------------------------------

- protected ContentHandler getContentHandler( ContentModel model ) throws
TransitException
+ protected ContentHandler getContentHandler( ContentModel model ) throws
IOException
{
synchronized( m_handlers )
{
@@ -201,7 +214,7 @@
}
}

- protected Class loadContentHandlerClass( ContentModel model ) throws
TransitException
+ protected Class loadContentHandlerClass( ContentModel model ) throws
IOException
{
URI uri = model.getCodeBaseURI();

@@ -216,7 +229,8 @@
{
m_logger.debug( "loading content handler plugin: " + uri );
Repository loader = Transit.getInstance().getRepository();
- ClassLoader classloader =
Thread.currentThread().getContextClassLoader();
+ //ClassLoader classloader =
Thread.currentThread().getContextClassLoader();
+ ClassLoader classloader = model.getClass().getClassLoader();
clazz = loader.getPluginClass( classloader, uri );
}
catch( Exception e )

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultLayoutRegistry.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultLayoutRegistry.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultLayoutRegistry.java
Fri Jun 17 05:54:23 2005
@@ -23,6 +23,8 @@
import java.net.URL;
import java.net.URISyntaxException;
import java.net.ContentHandler;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
import java.util.Hashtable;
import java.util.Map;
import java.util.WeakHashMap;
@@ -44,7 +46,7 @@
* A registry of descriptions of plugable content handlers. This
implementation
* maps user defined preferences to instance of ContentHandlerDescriptor.
*/
-public class DefaultLayoutRegistry implements LayoutRegistry,
LayoutRegistryListener
+public class DefaultLayoutRegistry extends UnicastRemoteObject implements
LayoutRegistry, LayoutRegistryListener
{
//
------------------------------------------------------------------------
// state
@@ -63,23 +65,20 @@
/**
* Provides support for the resolution of location resolver instances.
*/
- public DefaultLayoutRegistry( LayoutRegistryModel model )
+ public DefaultLayoutRegistry( LayoutRegistryModel model, Logger logger )
throws RemoteException
{
+ super();
+
m_model = model;
- m_logger = model.getLogger();
+ m_logger = logger;
model.addLayoutRegistryListener( this );
}

- protected void finalize()
- {
- m_model.removeLayoutRegistryListener( this );
- }
-
//
------------------------------------------------------------------------
// LayoutRegistry
//
------------------------------------------------------------------------

- public Layout getLayout( final String id ) throws TransitException
+ public Layout getLayout( final String id ) throws IOException
{
LayoutModel model = m_model.getLayoutModel( id );
return getLayout( model );
@@ -90,7 +89,7 @@
* @param model the location resolver model
* @return the resolver
*/
- protected Layout getLayout( LayoutModel model ) throws TransitException
+ protected Layout getLayout( LayoutModel model ) throws IOException
{
String id = model.getID();
String classname = model.getClassname();
@@ -123,7 +122,7 @@
}
}

- protected Layout loadLayout( LayoutModel model ) throws TransitException
+ protected Layout loadLayout( LayoutModel model ) throws IOException
{
Class clazz = loadLayoutClass( model );
Repository loader = Transit.getInstance().getRepository();
@@ -140,7 +139,7 @@
}
}

- protected Class loadLayoutClass( LayoutModel model ) throws
TransitException
+ protected Class loadLayoutClass( LayoutModel model ) throws IOException
{
URI uri = model.getCodeBaseURI();
Class clazz = (Class) m_plugins.get( uri );
@@ -188,16 +187,15 @@
* Notify all listeners of the addition of a content model.
* @param event the registry event
*/
- public void layoutAdded( LayoutRegistryEvent event )
+ public void layoutAdded( LayoutRegistryEvent event ) throws
RemoteException
{
- // TODO: cache the plugin class
}

/**
* Notify all listeners of the removal of a content model.
* @param event the registry event
*/
- public void layoutRemoved( LayoutRegistryEvent event )
+ public void layoutRemoved( LayoutRegistryEvent event ) throws
RemoteException
{
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultResourceHost.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultResourceHost.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/DefaultResourceHost.java
Fri Jun 17 05:54:23 2005
@@ -24,13 +24,11 @@
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
-
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.MalformedURLException;
@@ -38,12 +36,11 @@
import java.net.URLConnection;
import java.net.UnknownHostException;
import java.net.PasswordAuthentication;
-
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
-
import java.security.cert.X509Certificate;
-
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -75,7 +72,8 @@
* realm/domain authentication. It may be introduced in the future.
* </p>
*/
-public class DefaultResourceHost implements ResourceHost, HostListener,
Handler
+public class DefaultResourceHost extends UnicastRemoteObject
+ implements ResourceHost, HostListener, Handler
{
//
------------------------------------------------------------------------
// state
@@ -87,7 +85,6 @@
private HashSet m_knownGroups = new HashSet();

/**
- * locks.
* The key is the Artifact one wants to lock against, and the value is an
* anonymously lock object.
*/
@@ -104,6 +101,15 @@

private HostModel m_model;

+ private Logger m_logger;
+
+ private int m_priority;
+
+ private URL m_base;
+
+ private boolean m_enabled;
+ private boolean m_trusted;
+
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
@@ -115,11 +121,18 @@
* @param registry the host layout registry
* @exception UnknownHostException if the supplied base url references
an unknown host
*/
- public DefaultResourceHost( HostModel model, LayoutRegistry registry )
+ public DefaultResourceHost( HostModel model, LayoutRegistry registry,
Logger logger )
throws UnknownHostException, IOException
{
+ super();
+
m_model = model;
+ m_priority = model.getPriority();
+ m_base = model.getBaseURL();
+ m_trusted = model.getTrusted();
+ m_enabled = model.getEnabled();
m_registry = registry;
+ m_logger = logger;
m_layout = registry.getLayout( model.getLayoutModel().getID() );
model.addHostListener( this );
m_connections = ConnectionCache.getInstance();
@@ -139,7 +152,16 @@
*/
public void dispose()
{
- m_model.removeHostListener( this );
+ try
+ {
+ m_model.removeHostListener( this );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while disposing of resource
host.";
+ m_logger.error( error, e );
+ }
}

//
------------------------------------------------------------------------
@@ -150,7 +172,7 @@
* Notify a consumer of an aggregated set of changes.
* @param event the host change event
*/
- public void hostChanged( HostChangeEvent event )
+ public void hostChanged( HostChangeEvent event ) throws RemoteException
{
synchronized( this )
{
@@ -160,6 +182,9 @@
}
try
{
+ m_base = event.getBaseURL();
+ m_enabled = event.getEnabled();
+ m_trusted = event.getTrusted();
setupAuthenticator();
String[] groups = setupGroups();
resetGroups( groups );
@@ -168,7 +193,7 @@
{
final String error =
"Could not complete host update due to a internal error.";
- m_model.getLogger().error( error, e );
+ getLogger().error( error, e );
}
}
}
@@ -177,7 +202,7 @@
* Notify a consumer of a change to the enabled state.
* @param event the host event
*/
- public void nameChanged( HostNameEvent event )
+ public void nameChanged( HostNameEvent event ) throws RemoteException
{
// not used by the runtime
}
@@ -186,19 +211,21 @@
* Notify a consumer of a change to the host priority.
* @param event the host event
*/
- public void priorityChanged( HostPriorityEvent event )
+ public void priorityChanged( HostPriorityEvent event ) throws
RemoteException
{
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "setting priority to " + event.getPriority()
);
}
+ int priority = event.getPriority();
+ m_priority = priority;
}

/**
* Notify a consumer of a change to the assigned resolver.
* @param event the resolver id change event
*/
- public void layoutChanged( HostLayoutEvent event )
+ public void layoutChanged( HostLayoutEvent event ) throws RemoteException
{
synchronized( m_layout )
{
@@ -230,7 +257,7 @@
*/
public String getHostName()
{
- return m_model.getBaseURL().getHost();
+ return m_base.getHost();
}

/**
@@ -240,7 +267,7 @@
*/
public URL getURL()
{
- return m_model.getBaseURL();
+ return m_base;
}

/**
@@ -249,7 +276,7 @@
*/
public int getPriority()
{
- return m_model.getPriority();
+ return m_priority;
}

/** Downloads the given artifact to the directory indicated.
@@ -346,7 +373,7 @@
*/
public boolean isEnabled()
{
- return m_model.getEnabled();
+ return m_enabled;
}

/** Returns true if the ResourceHost is considered trusted.
@@ -355,7 +382,7 @@
*/
public boolean isTrusted()
{
- return m_model.getTrusted();
+ return m_trusted;
}

/** Returns the layout assigned to the host.
@@ -397,7 +424,7 @@
}
}

- private void setupAuthenticator()
+ private void setupAuthenticator() throws RemoteException
{
RequestIdentifier id = m_model.getRequestIdentifier();
PasswordAuthentication auth = m_model.getAuthentication();
@@ -560,7 +587,7 @@

private Logger getLogger()
{
- return m_model.getLogger();
+ return m_logger;
}

//
------------------------------------------------------------------------

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/EclipseLayout.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/EclipseLayout.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/runtime/EclipseLayout.java
Fri Jun 17 05:54:23 2005
@@ -29,7 +29,7 @@
* Example;
<code>artifact:jar:eclipse/plugins/eclipse-osgi-runtime/core#3.1.0</code>
* would return the path
<code>eclipse/plugins/eclipse-osgi-runtime-3.1.0/core.jar</code>.
*/
-public class EclipseLayout
+public class EclipseLayout extends AbstractLayout
implements Layout
{
/**
@@ -76,4 +76,5 @@
{
return artifact.getName() + "." + artifact.getType();
}
+
}

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
Fri Jun 17 05:54:23 2005
@@ -118,6 +118,11 @@
public URI getURI( String key ) throws BuilderException
{
Preferences prefs = getPreferences();
+ return getURI( prefs, key );
+ }
+
+ public URI getURI( Preferences prefs, String key ) throws
BuilderException
+ {
String path = prefs.get( key, null );
try
{
@@ -167,6 +172,11 @@
public URL getURL( String key ) throws BuilderException
{
Preferences prefs = getPreferences();
+ return getURL( prefs, key );
+ }
+
+ public URL getURL( Preferences prefs, String key ) throws
BuilderException
+ {
String path = prefs.get( key, null );
try
{

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
Fri Jun 17 05:54:23 2005
@@ -20,6 +20,7 @@
import java.net.URL;
import java.net.URI;
import java.net.MalformedURLException;
+import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Date;
import java.util.prefs.Preferences;
@@ -79,6 +80,12 @@
"Unable to construct cache management due to conflicting host
identifies.";
throw new BuilderException( error, e );
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct cache model due to a remote exception.";
+ throw new BuilderException( error, e );
+ }
}

//
------------------------------------------------------------------------
@@ -173,6 +180,12 @@
"Unable to construct cache storage unit due unknown layout
key.";
throw new BuilderException( error, e );
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct cache storage unit due a remote
exception.";
+ throw new BuilderException( error, e );
+ }
}

private HostModel[] createHostModels()

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
Fri Jun 17 05:54:23 2005
@@ -30,13 +30,13 @@
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-abstract class CodeBaseStorageUnit extends AbstractStorageUnit implements
CodeBaseHome
+public abstract class CodeBaseStorageUnit extends AbstractStorageUnit
implements CodeBaseHome
{
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

- CodeBaseStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ public CodeBaseStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
{
super( prefs, logger, creation, policy );
}

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
Fri Jun 17 05:54:23 2005
@@ -17,18 +17,24 @@
package net.dpml.transit.unit;

import java.net.URI;
+import java.net.URL;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

+import net.dpml.transit.Transit;
+import net.dpml.transit.artifact.Artifact;
+import net.dpml.transit.home.ContentHome;
import net.dpml.transit.home.ContentRegistryHome;
import net.dpml.transit.model.DefaultContentRegistryModel;
import net.dpml.transit.model.ContentRegistryModel;
import net.dpml.transit.model.ContentModel;
import net.dpml.transit.model.DuplicateKeyException;
import net.dpml.transit.model.Logger;
+import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.Plugin;

/**
* The LayoutRegistryHelper class provides support for the crreating of a
@@ -49,28 +55,46 @@
// ContentRegistryHome
//
------------------------------------------------------------------------

- public ContentModel createContentModel( String id ) throws
BuilderException
+ public ContentModel createContentModel( String id, String title, URI uri
)
{
Preferences prefs = getPreferences();
Preferences p = prefs.node( id );
- Logger logger = getLogger().getChildLogger( id );
- Date creation = getCreationDate();
- boolean policy = getStoragePolicy();
- ContentStorageUnit home = new ContentStorageUnit( p, logger,
creation, policy );
- return home.createContentModel();
+ p.put( "title", title );
+ p.put( "uri", uri.toASCIIString() );
+ return createContentModel( id );
}

- public ContentModel createContentModel( String id, String title, URI uri
)
+ public ContentModel createContentModel( String id ) throws
BuilderException
{
Preferences prefs = getPreferences();
Preferences p = prefs.node( id );
Logger logger = getLogger().getChildLogger( id );
Date creation = getCreationDate();
boolean policy = getStoragePolicy();
- p.put( "title", title );
- p.put( "uri", uri.toASCIIString() );
- ContentStorageUnit home = new ContentStorageUnit( p, logger,
creation, policy );
- return home.createContentModel();
+ return createContentModel( p, logger, creation, policy );
+ }
+
+ public ContentModel[] createContentModels()
+ {
+ Preferences prefs = getPreferences();
+ try
+ {
+ ArrayList list = new ArrayList();
+ String[] names = prefs.childrenNames();
+ for( int i=0; i<names.length; i++ )
+ {
+ String name = names[i];
+ ContentModel manager = createContentModel( name );
+ list.add( manager );
+ }
+ return (ContentModel[]) list.toArray( new ContentModel[0] );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Unexpected error while constructing content registry
manager.";
+ throw new BuilderException( error, e );
+ }
}

//
------------------------------------------------------------------------
@@ -86,17 +110,8 @@

try
{
- ArrayList list = new ArrayList();
- String[] names = prefs.childrenNames();
- for( int i=0; i<names.length; i++ )
- {
- String name = names[i];
- ContentModel manager = createContentModel( name );
- list.add( manager );
- }
- ContentModel[] managers = (ContentModel[]) list.toArray( new
ContentModel[0] );
URI uri = getCodeBaseURI();
- return new DefaultContentRegistryModel( logger, creation, this,
uri, managers );
+ return new DefaultContentRegistryModel( logger, creation, this,
uri );
}
catch( Exception e )
{
@@ -105,4 +120,66 @@
throw new BuilderException( error, e );
}
}
+
+ private ContentModel createContentModel(
+ Preferences prefs, Logger logger, Date creation, boolean policy )
+ throws BuilderException
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(
Transit.class.getClassLoader() );
+ Repository repository = Transit.getInstance().getRepository();
+ URI uri = getURI( prefs, "uri" );
+ String classname = getPluginClassname( uri );
+ String storageClassname = classname + "StorageUnit";
+ ClassLoader classloader = getPluginClassLoader( uri );
+ try
+ {
+ Class c = classloader.loadClass( storageClassname );
+ Object[] args = new Object[]{ prefs, logger, creation, new
Boolean( policy ) };
+ ContentHome home = (ContentHome) repository.instantiate( c,
args );
+ return home.getContentModel();
+ }
+ catch( ClassNotFoundException e )
+ {
+ ContentStorageUnit home =
+ new ContentStorageUnit( prefs, logger, creation, policy );
+ return home.createContentModel();
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Error occured while attempting to load a custom content
home."
+ + "\nClassname: " + classname
+ + "\nURI: " + uri;
+ throw new BuilderException( error, e );
+ }
+ }
+ catch( Exception ue )
+ {
+ final String error =
+ "Internal error while attempting to construct a content
model.";
+ throw new BuilderException( error, ue );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( cl );
+ }
+ }
+
+ private String getPluginClassname( URI uri ) throws Exception
+ {
+ Artifact artifact = Artifact.createArtifact( uri );
+ URL url = artifact.toURL();
+ Plugin plugin = (Plugin) url.getContent( new Class[]{ Plugin.class }
);
+ return plugin.getClassname();
+ }
+
+ private ClassLoader getPluginClassLoader( URI uri ) throws Exception
+ {
+ Artifact artifact = Artifact.createArtifact( uri );
+ URL url = artifact.toURL();
+ return (ClassLoader) url.getContent( new Class[]{ ClassLoader.class
} );
+ }
}

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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,7 @@

import java.net.URI;
import java.net.MalformedURLException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -33,21 +34,29 @@
* The ContentSorageUnit class is responsible for the setup of initial
factory
* default preference settings.
*/
-class ContentStorageUnit extends CodeBaseStorageUnit implements ContentHome,
Removable
+public class ContentStorageUnit extends CodeBaseStorageUnit implements
ContentHome, Removable
{
+ private ContentModel m_model;
+
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

- ContentStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ protected ContentStorageUnit( Preferences prefs, Logger logger, Date
creation, boolean policy )
{
super( prefs, logger, creation, policy );
+ m_model = createContentModel();
}

//
------------------------------------------------------------------------
- // LayoutHome
+ // ContentHome
//
------------------------------------------------------------------------

+ public ContentModel getContentModel()
+ {
+ return m_model;
+ }
+
public void setTitle( String title )
{
Preferences prefs = getPreferences();
@@ -74,15 +83,36 @@
// impl
//
------------------------------------------------------------------------

- ContentModel createContentModel()
+ protected ContentModel createContentModel()
{
Preferences prefs = getPreferences();
Logger logger = getLogger();
Date creation = getCreationDate();
URI uri = getCodeBaseURI();
- String type = prefs.name();
- String title = prefs.get( "title", type );
- return new DefaultContentModel( logger, creation, this, uri, type,
title );
+ String type = getType();
+ String title = getTitle();
+ try
+ {
+ return new DefaultContentModel( logger, creation, this, uri,
type, title );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct content model due to a remote exception.";
+ throw new BuilderException( error, e );
+ }
+ }
+
+ protected String getType()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.name();
+ }
+
+ protected String getTitle()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.get( "title", prefs.name() );
}
}


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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
import java.net.URI;
import java.net.URL;
import java.net.MalformedURLException;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -106,8 +107,17 @@
}
else
{
- String id = layout.getID();
- setValue( "layout", id );
+ try
+ {
+ String id = layout.getID();
+ setValue( "layout", id );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception when requesting the host
layout identifier.";
+ throw new BuilderException( error, e );
+ }
}
}

@@ -133,6 +143,20 @@

HostModel createHostModel( LayoutRegistryModel registry )
{
+ try
+ {
+ return createHostModelInstance( registry );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct host model due to a remote exception.";
+ throw new BuilderException( error, e );
+ }
+ }
+
+ private HostModel createHostModelInstance( LayoutRegistryModel registry
) throws RemoteException
+ {
Preferences prefs = getPreferences();
Logger logger = getLogger();
Date creation = getCreationDate();
@@ -180,6 +204,12 @@
"Unable to construct host storage unit due unknown host layout
key.";
throw new BuilderException( error, e );
}
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct host storage unit due to a remote
exception.";
+ throw new BuilderException( error, e );
+ }
}

private URL getBase( )
@@ -254,30 +284,6 @@
}
}

- private void store( HostModel model )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- synchronized( prefs )
- {
- URL base = model.getBaseURL();
- URL index = model.getIndexURL();
- boolean trusted = model.getTrusted();
- boolean enabled = model.getEnabled();
- LayoutModel layout = model.getLayoutModel();
- PasswordAuthentication auth = model.getAuthentication();
- URI uri = model.getCodeBaseURI();
-
- setCodeBaseURI( uri );
- setURL( "base", base );
- setURL( "index", index );
- setTrusted( trusted );
- setEnabled( enabled );
- setLayoutModel( layout );
- setAuthentication( auth );
- }
- }
-
private void setTrusted( boolean trusted )
{
Preferences prefs = getPreferences();

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
import java.net.URL;
import java.net.URI;
import java.net.MalformedURLException;
+import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -55,7 +56,17 @@

URI uri = getCodeBaseURI();
LayoutModel[] layouts = createLayoutModels();
- m_manager = new DefaultLayoutRegistryModel( logger, creation, this,
uri, layouts );
+
+ try
+ {
+ m_manager = new DefaultLayoutRegistryModel( logger, creation,
this, uri, layouts );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct layout registry model due to a remote
exception.";
+ throw new BuilderException( error, e );
+ }
}

//
------------------------------------------------------------------------

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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,7 @@

import java.net.URL;
import java.net.URI;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -88,6 +89,21 @@
LayoutModel createLayoutModel()
throws BuilderException
{
+ try
+ {
+ return createLayoutModelInstance();
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct layout model due to a remote exception.";
+ throw new BuilderException( error, e );
+ }
+ }
+
+ private LayoutModel createLayoutModelInstance()
+ throws BuilderException, RemoteException
+ {
Preferences prefs = getPreferences();
Logger logger = getLogger();
Date creation = getCreationDate();

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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
import java.net.URL;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
+import java.rmi.RemoteException;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
import java.util.Date;
@@ -112,7 +113,17 @@
URL host = getURL( "host" );
String[] excludes = getExcludes();
PasswordAuthentication auth = getAuthentication();
- return new DefaultProxyModel( logger, creation, this, host, auth,
excludes );
+
+ try
+ {
+ return new DefaultProxyModel( logger, creation, this, host,
auth, excludes );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct proxy model due to a remote exception.";
+ throw new BuilderException( error, 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
Fri Jun 17 05:54:23 2005
@@ -19,6 +19,7 @@
import java.net.URI;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
+import java.rmi.RemoteException;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
import java.util.Date;
@@ -55,7 +56,17 @@
Logger logger = getLogger();
Date creation = getCreationDate();
URI uri = getCodeBaseURI();
- return new DefaultRepositoryModel( logger, creation, this, uri );
+
+ try
+ {
+ return new DefaultRepositoryModel( logger, creation, this, uri );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unable to construct repository model due to a remote
exception.";
+ throw new BuilderException( error, 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
Fri Jun 17 05:54:23 2005
@@ -18,6 +18,8 @@

import java.net.URL;
import java.net.MalformedURLException;
+import java.rmi.registry.Registry;
+import java.rmi.activation.ActivationSystem;
import java.util.Date;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -28,6 +30,7 @@

import net.dpml.transit.adapter.LoggingAdapter;
import net.dpml.transit.home.TransitHome;
+import net.dpml.transit.model.Connection;
import net.dpml.transit.model.DefaultTransitModel;
import net.dpml.transit.model.DisposalListener;
import net.dpml.transit.model.DisposalEvent;
@@ -48,8 +51,11 @@
// static
//
------------------------------------------------------------------------

- private static Preferences DEFAULT_PREFS_NODE =
- Preferences.userNodeForPackage( Transit.class );
+ private static final Logger DEFAULT_LOGGER = new LoggingAdapter();
+ private static final Preferences ROOT_PREFS =
+ Preferences.userNodeForPackage( Transit.class ).node( "profiles" );
+ private static final String DEFAULT_PROFILE_NAME = "default";
+ private static final String PROFILE_KEY = "dpml.transit.profile";

//
------------------------------------------------------------------------
// state
@@ -61,13 +67,7 @@
private boolean m_readonly = false;
private boolean m_factoryPolicy = true;
private boolean m_purgePolicy = false;
- private String m_profile = "default";
-
- private ProxyStorageUnit m_proxyUnit;
- private RepositoryStorageUnit m_repositoryUnit;
- private CacheStorageUnit m_cacheUnit;
- private LayoutRegistryStorageUnit m_layoutUnit;
- private ContentRegistryStorageUnit m_contentUnit;
+ private String m_profile;

//
------------------------------------------------------------------------
// constructor
@@ -96,6 +96,15 @@
return !isReadOnly();
}

+ /**
+ * Return the home identifier.
+ * @return the home id
+ */
+ public String getID()
+ {
+ return getPreferences().absolutePath();
+ }
+
//
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -192,11 +201,25 @@
}
}

- init( creation );
- ProxyModel proxy = m_proxyUnit.createProxyModel();
- RepositoryModel repository =
m_repositoryUnit.createRepositoryModel();
- CacheModel cache = m_cacheUnit.getCacheModel();
- ContentRegistryModel content =
m_contentUnit.createContentRegistryModel();
+ //
+ // setup the storage homes for the proxy, cache, content handler and
+ // repository sub-systems (layout and hosts are handled within the
+ // cache system setup)
+ //
+
+ ProxyStorageUnit proxyUnit = createProxyUnit( creation );
+ CacheStorageUnit cacheUnit = createCacheUnit( creation );
+ ContentRegistryStorageUnit contentUnit = createContentRegistryUnit(
creation );
+ RepositoryStorageUnit repositoryUnit = createRepositoryUnit(
creation );
+
+ ProxyModel proxy = proxyUnit.createProxyModel();
+ RepositoryModel repository = repositoryUnit.createRepositoryModel();
+ CacheModel cache = cacheUnit.getCacheModel();
+ ContentRegistryModel content =
contentUnit.createContentRegistryModel();
+
+ //
+ // put the model together
+ //

try
{
@@ -206,23 +229,11 @@
catch( Throwable e )
{
final String error =
- "An error occured during construction of the transit manager.";
+ "An error occured during construction of the transit model.";
throw new BuilderException( error, e );
}
}

- private void init( Date creation )
- {
- //
- // create the sub-systems
- //
-
- m_proxyUnit = createProxyUnit( creation );
- m_cacheUnit = createCacheUnit( creation );
- m_contentUnit = createContentRegistryUnit( creation );
- m_repositoryUnit = createRepositoryUnit( creation );
- }
-
private ProxyStorageUnit createProxyUnit( Date creation ) throws
BuilderException
{
try
@@ -279,8 +290,8 @@
try
{
boolean policy = getStoragePolicy();
- Logger logger = getLogger().getChildLogger( "layout" );
- Preferences prefs = getPreferences().node( "layout" );
+ Logger logger = getLogger().getChildLogger( "content" );
+ Preferences prefs = getPreferences().node( "content" );
return new ContentRegistryStorageUnit( prefs, logger, creation,
policy );
}
catch( Throwable e )
@@ -330,12 +341,15 @@

private String getProfileName()
{
- return m_profile;
+ if( null == m_profile )
+ {
+ return System.getProperty( PROFILE_KEY, DEFAULT_PROFILE_NAME );
+ }
+ else
+ {
+ return m_profile;
+ }
}
-
- private static final Logger DEFAULT_LOGGER = new LoggingAdapter();
- private static final Preferences ROOT_PREFS =
- Preferences.userNodeForPackage( Transit.class ).node( "profiles" );
}



Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
Fri Jun 17 05:54:23 2005
@@ -22,6 +22,7 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.PasswordAuthentication;
+import java.rmi.RemoteException;
import java.util.Date;
import java.util.prefs.Preferences;
import java.net.URL;
@@ -82,10 +83,18 @@
{
public void proxyChanged( ProxyEvent event )
{
- event.getProxyModel().removeProxyListener( this );
- String[] result = event.getExcludes();
- assertNotNull( "excludes-not-null", result );
- assertEquals( "excludes", 2, result.length );
+ try
+ {
+ event.getProxyModel().removeProxyListener( this );
+ String[] result = event.getExcludes();
+ assertNotNull( "excludes-not-null", result );
+ assertEquals( "excludes", 2, result.length );
+ }
+ catch( RemoteException e )
+ {
+ fail( e.toString() );
+ }
+
}
}

@@ -98,13 +107,20 @@
}
public void proxyChanged( ProxyEvent event )
{
- event.getProxyModel().removeProxyListener( this );
- PasswordAuthentication auth = event.getPasswordAuthentication();
- assertNotNull( "auth", auth );
- assertEquals( "username", m_auth.getUserName(),
auth.getUserName() );
- assertEquals( "password",
- new String( m_auth.getPassword() ),
- new String( auth.getPassword() ) );
+ try
+ {
+ event.getProxyModel().removeProxyListener( this );
+ PasswordAuthentication auth =
event.getPasswordAuthentication();
+ assertNotNull( "auth", auth );
+ assertEquals( "username", m_auth.getUserName(),
auth.getUserName() );
+ assertEquals( "password",
+ new String( m_auth.getPassword() ),
+ new String( auth.getPassword() ) );
+ }
+ catch( RemoteException e )
+ {
+ fail( e.toString() );
+ }
}
}
}



  • svn commit: r2865 - in development/main: depot/console depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs depot/prefs/src/main/net/dpml/depot/prefs depot/station depot/station/src/main/net/dpml/depot/station depot/test/mexico metro/composition/content/src/main/net/dpml/composition/content metro/composition/control/src/main/net/dpml/composition/control metro/composition/part metro/composition/part/src/main/net/dpml/composition/part metro/parts/src/main/net/dpml/parts/control transit/core/handler transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/artifact transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/network transit/core/handler/src/main/net/dpml/transit/repository transit/core/handler/src/main/net/dpml/transit/runtime transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/test/net/dpml/transit/manager, mcconnell, 06/17/2005

Archive powered by MHonArc 2.6.24.

Top of Page