notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2830 - in development/main: depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs/src/main/net/dpml/depot/prefs depot/station/src/main/net/dpml/depot/station metro/composition/content/src/main/net/dpml/composition/content transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/manager transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/test/net/dpml/transit/manager
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2830 - in development/main: depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs/src/main/net/dpml/depot/prefs depot/station/src/main/net/dpml/depot/station metro/composition/content/src/main/net/dpml/composition/content transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/manager transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/test/net/dpml/transit/manager
- Date: Mon, 13 Jun 2005 01:29:24 -0400
Author: mcconnell AT dpml.net
Date: Mon Jun 13 01:29:22 2005
New Revision: 2830
Added:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
- copied, changed from r2828,
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultDisposablePluginModel.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitModel.java
- copied, changed from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/model/Disposable.java
development/main/transit/core/handler/src/main/net/dpml/transit/unit/PluginStorageUnit.java
Removed:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryManager.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitManager.java
Modified:
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/BootstrapProfile.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/src/main/net/dpml/depot/prefs/Main.java
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
development/main/metro/composition/content/src/main/net/dpml/composition/content/CompositionContentHandlerRegistry.java
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/CacheHome.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/Home.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/HostHome.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutHome.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/PluginHome.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/ProxyHome.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/TransitHome.java
development/main/transit/core/handler/src/main/net/dpml/transit/manager/package.html
development/main/transit/core/handler/src/main/net/dpml/transit/model/CacheModel.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/HostModel.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/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/ModelReferenceException.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/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
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
Log:
Restructure the stroage system to be a pasive object that implements the home
persistence service (and inprove class naming).
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 Mon
Jun 13 01:29:22 2005
@@ -52,7 +52,7 @@
import net.dpml.depot.profile.ApplicationProfile.Connection;
import net.dpml.depot.profile.PluginProfile;
import net.dpml.depot.profile.BootstrapProfile;
-import net.dpml.depot.profile.DepotManager;
+import net.dpml.depot.profile.DepotModel;
import net.dpml.depot.profile.DepotStorage;
@@ -210,7 +210,7 @@
Date creation = new Date();
Preferences prefs = getRootPreferences();
DepotStorage store = new DepotStorage( prefs, logger, creation,
false );
- DepotManager manager = store.getDepotManager();
+ DepotModel manager = store.getDepotModel();
ApplicationProfile profile = getApplicationProfile( manager,
target );
termination = profile.getCommandPolicy();
for( int i=0; i < args.length; i++ )
@@ -413,7 +413,7 @@
}
}
- private static ApplicationProfile getApplicationProfile( DepotManager
manager, String target )
+ private static ApplicationProfile getApplicationProfile( DepotModel
manager, String target )
{
try
{
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
Mon Jun 13 01:29:22 2005
@@ -23,7 +23,6 @@
import java.util.Date;
import net.dpml.transit.model.Logger;
-import net.dpml.transit.manager.DefaultManager;
import net.dpml.transit.home.Home;
/**
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfile.java
Mon Jun 13 01:29:22 2005
@@ -23,7 +23,7 @@
import java.util.Properties;
import net.dpml.transit.model.Logger;
-import net.dpml.transit.manager.DefaultManager;
+import net.dpml.transit.manager.DefaultModel;
import net.dpml.transit.home.Home;
/**
Copied:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
(from r2828,
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java)
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
Mon Jun 13 01:29:22 2005
@@ -26,17 +26,17 @@
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.ModificationEvent;
import net.dpml.transit.model.UnknownKeyException;
-import net.dpml.transit.manager.DefaultManager;
+import net.dpml.transit.manager.DefaultModel;
/**
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class DepotManager extends DefaultManager
+public class DepotModel extends DefaultModel
{
private ApplicationProfile[] m_profiles;
- public DepotManager( Logger logger, Date creation, Home home,
ApplicationProfile[] profiles )
+ public DepotModel( Logger logger, Date creation, Home home,
ApplicationProfile[] profiles )
throws NullPointerException
{
super( logger, creation, home );
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
Mon Jun 13 01:29:22 2005
@@ -39,7 +39,7 @@
// state
//
------------------------------------------------------------------------
- private DepotManager m_depot;
+ private DepotModel m_depot;
//
------------------------------------------------------------------------
// constructor
@@ -52,40 +52,14 @@
super( prefs, logger, creation, policy );
ApplicationProfile[] profiles = getApplicationProfiles();
- m_depot = new DepotManager( logger, creation, this, profiles );
- }
-
- //
------------------------------------------------------------------------
- // ModificationListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- if( getStoragePolicy() )
- {
- try
- {
- DepotManager manager = (DepotManager) event.getModel();
- Date date = new Date();
- store( manager );
- manager.setCreationDate( date );
- }
- catch( Throwable e )
- {
- getLogger().error( "storage failure", e );
- }
- }
+ m_depot = new DepotModel( logger, creation, this, profiles );
}
//
------------------------------------------------------------------------
// utils
//
------------------------------------------------------------------------
- public DepotManager getDepotManager()
+ public DepotModel getDepotModel()
{
return m_depot;
}
@@ -139,11 +113,6 @@
}
}
- private void store( DepotManager manager )
- {
- throw new UnsupportedOperationException( "store/1" );
- }
-
private ApplicationProfile[] createBootstrapProfiles() throws
ProfileException
{
ApplicationProfile prefs = createPrefsProfile();
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
Mon Jun 13 01:29:22 2005
@@ -25,13 +25,13 @@
import net.dpml.transit.home.Home;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.ModificationEvent;
-import net.dpml.transit.manager.DefaultManager;
+import net.dpml.transit.manager.DefaultModel;
/**
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class Profile extends DefaultManager
+public class Profile extends DefaultModel
{
private final String m_id;
private String m_title;
Modified: development/main/depot/prefs/src/main/net/dpml/depot/prefs/Main.java
==============================================================================
--- development/main/depot/prefs/src/main/net/dpml/depot/prefs/Main.java
(original)
+++ development/main/depot/prefs/src/main/net/dpml/depot/prefs/Main.java
Mon Jun 13 01:29:22 2005
@@ -70,7 +70,6 @@
try
{
TransitHome home = new TransitStorageUnit();
- home.setPersistOnModification( true );
home.setLogger( logger );
TransitModel model = home.create();
Transit.getInstance( model );
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
Mon Jun 13 01:29:22 2005
@@ -24,7 +24,7 @@
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.UnknownKeyException;
-import net.dpml.transit.manager.DefaultManager;
+import net.dpml.transit.manager.DefaultModel;
import net.dpml.transit.home.Home;
import net.dpml.depot.profile.ProfileException;
@@ -33,7 +33,7 @@
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class StationProfile extends DefaultManager
+public class StationProfile extends DefaultModel
{
private Properties m_properties;
private CodeBaseProfile[] m_profiles;
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
Mon Jun 13 01:29:22 2005
@@ -30,7 +30,6 @@
import net.dpml.transit.model.DuplicateKeyException;
import net.dpml.transit.model.UnknownKeyException;
import net.dpml.transit.content.DefaultContentRegistry;
-import net.dpml.transit.manager.DefaultContentManager;
/**
* A registry of descriptions of plugable content handlers. This
implementation
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
Mon Jun 13 01:29:22 2005
@@ -44,7 +44,7 @@
import net.dpml.transit.home.TransitHome;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.manager.DefaultTransitManager;
+import net.dpml.transit.manager.DefaultTransitModel;
import net.dpml.transit.unit.TransitStorageUnit;
/**
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultCacheHandler.java
Mon Jun 13 01:29:22 2005
@@ -111,7 +111,6 @@
* configuration model and cache layout resolver.
*
* @param model the cache system confiuguration model
- * @param resolver the local cache layout resolver
*/
public DefaultCacheHandler( CacheModel model ) throws TransitException
{
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/cache/DefaultResourceHost.java
Mon Jun 13 01:29:22 2005
@@ -115,7 +115,7 @@
* Constructor for a resource host using a supplied host configuration.
*
* @param model the host model
- * @param layout the host layout strategy
+ * @param registry the host layout registry
* @exception UnknownHostException if the supplied base url references
an unknown host
*/
public DefaultResourceHost( HostModel model, LayoutRegistry registry )
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/CacheHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/CacheHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/CacheHome.java
Mon Jun 13 01:29:22 2005
@@ -18,6 +18,8 @@
package net.dpml.transit.home;
+import java.io.File;
+
import net.dpml.transit.model.HostModel;
/**
@@ -27,5 +29,7 @@
*/
public interface CacheHome extends PluginHome
{
+ void setCacheDirectory( File cache );
+
HostModel createHostModel( String id );
}
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
Mon Jun 13 01:29:22 2005
@@ -23,6 +23,9 @@
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public interface ContentHome extends PluginHome
+public interface ContentHome extends PluginHome
{
+ void setTitle( String title );
+
+ void destroy();
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/Home.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/Home.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/Home.java
Mon Jun 13 01:29:22 2005
@@ -26,6 +26,8 @@
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public interface Home extends ModificationListener, DisposalListener
+public interface Home
{
+ boolean isReadOnly();
+ boolean isMutable();
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/HostHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/HostHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/HostHome.java
Mon Jun 13 01:29:22 2005
@@ -18,11 +18,28 @@
package net.dpml.transit.home;
+import java.net.URL;
+import java.net.PasswordAuthentication;
+
+import net.dpml.transit.model.LayoutModel;
+
/**
* The ProxyManager is an interface implemented by proxy managers.
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public interface HostHome extends PluginHome
+public interface HostHome extends PluginHome
{
+ void setHostSettings(
+ URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
+ PasswordAuthentication auth, String scheme, String prompt );
+
+ void setName( String name );
+
+ void setPriority( int priority );
+
+ void setLayoutModel( LayoutModel layout );
+
+ void destroy();
+
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutHome.java
Mon Jun 13 01:29:22 2005
@@ -23,6 +23,11 @@
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public interface LayoutHome extends PluginHome
+public interface LayoutHome extends PluginHome
{
+ void setTitle( String title );
+
+ void setClassname( String classname );
+
+ void destroy();
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/PluginHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/PluginHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/PluginHome.java
Mon Jun 13 01:29:22 2005
@@ -18,6 +18,8 @@
package net.dpml.transit.home;
+import java.net.URI;
+
/**
* The ProxyManager is an interface implemented by proxy managers.
*
@@ -25,4 +27,7 @@
*/
public interface PluginHome extends Home
{
+ URI getPluginURI();
+
+ void setPluginURI( URI uri );
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/home/ProxyHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/ProxyHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/home/ProxyHome.java
Mon Jun 13 01:29:22 2005
@@ -18,6 +18,9 @@
package net.dpml.transit.home;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+
/**
* The ProxyManager is an interface implemented by proxy managers.
*
@@ -25,4 +28,11 @@
*/
public interface ProxyHome extends Home
{
+ void setHost( URL host );
+
+ void setExcludes( String[] excludes );
+
+ void setAuthentication( PasswordAuthentication auth );
+
+ void saveProxySettings( URL host, PasswordAuthentication auth, String[]
excludes );
}
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
Mon Jun 13 01:29:22 2005
@@ -38,7 +38,7 @@
void setAuthority( URL authority );
- void setPersistOnModification( boolean policy );
+ void setReadOnly();
void useFactoryInitialization( boolean policy );
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultCacheModel.java
Mon Jun 13 01:29:22 2005
@@ -77,7 +77,7 @@
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: StandardTransitDirector.java 2480 2005-05-10 04:44:32Z
mcconnell AT dpml.net $
*/
-public class DefaultCacheManager extends DefaultPluginManager
+public class DefaultCacheModel extends DefaultDisposablePluginModel
implements CacheModel, DisposalListener
{
//
------------------------------------------------------------------------
@@ -98,7 +98,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultCacheManager(
+ public DefaultCacheModel(
Logger logger, Date creation, CacheHome home,
URI uri, File cache, HostModel[] hosts, LayoutModel layout,
LayoutRegistryModel registry )
throws DuplicateKeyException
@@ -199,9 +199,14 @@
getLogger().debug( "updating cache: " + cache );
}
m_cache = cache;
+
+ if( m_home.isMutable() )
+ {
+ m_home.setCacheDirectory( cache );
+ }
+
if( notify )
{
- setModified();
CacheDirectoryChangeEvent event = new
CacheDirectoryChangeEvent( this, m_cache );
enqueueEvent( event );
}
@@ -277,13 +282,13 @@
}
}
- public void removeHostModel( HostModel manager )
+ public void removeHostModel( HostModel model )
{
synchronized( m_lock )
{
- manager.dispose();
- m_list.remove( manager );
- HostRemovedEvent event = new HostRemovedEvent( this, manager );
+ model.dispose();
+ m_list.remove( model );
+ HostRemovedEvent event = new HostRemovedEvent( this, model );
enqueueEvent( event );
}
}
@@ -316,15 +321,19 @@
}
//
------------------------------------------------------------------------
- // internal
+ // Disposable
//
------------------------------------------------------------------------
- protected void destroy()
+ public void dispose()
{
+ super.dispose();
m_layout.removeDisposalListener( this );
- super.destroy();
}
+ //
------------------------------------------------------------------------
+ // internal
+ //
------------------------------------------------------------------------
+
public void processEvent( EventObject event )
{
if( event instanceof HostNodeEvent )
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentModel.java
Mon Jun 13 01:29:22 2005
@@ -38,12 +38,13 @@
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public class DefaultContentManager extends DefaultPluginManager implements
ContentModel
+public class DefaultContentModel extends DefaultDisposablePluginModel
implements ContentModel
{
//----------------------------------------------------------------------
// state
//----------------------------------------------------------------------
+ private final ContentHome m_home;
private final String m_type;
private String m_title;
@@ -52,13 +53,14 @@
// constructor
//----------------------------------------------------------------------
- public DefaultContentManager(
+ public DefaultContentModel(
Logger logger, Date creation, ContentHome home,
URI uri, String type, String title )
{
super( logger, creation, home, uri );
m_type = type;
m_title = title;
+ m_home = home;
}
//----------------------------------------------------------------------
@@ -101,21 +103,32 @@
super.removeListener( listener );
}
- //
------------------------------------------------------------------------
- // ContentManager
- //
------------------------------------------------------------------------
-
public void setTitle( String title )
{
synchronized( m_lock )
{
m_title = title;
+
+ if( m_home.isMutable() )
+ {
+ m_home .setTitle( title );
+ }
+
ContentEvent event = new ContentEvent( this );
super.enqueueEvent( event );
- setModified();
}
}
+ //----------------------------------------------------------------------
+ // Disposable
+ //----------------------------------------------------------------------
+
+ public void dispose()
+ {
+ super.dispose();
+ m_home.destroy();
+ }
+
//
------------------------------------------------------------------------
// internal
//
------------------------------------------------------------------------
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultContentRegistryModel.java
Mon Jun 13 01:29:22 2005
@@ -27,6 +27,7 @@
import java.util.EventObject;
import java.util.EventListener;
+import net.dpml.transit.home.ContentRegistryHome;
import net.dpml.transit.model.ContentModel;
import net.dpml.transit.model.ContentRegistryListener;
import net.dpml.transit.model.ContentRegistryEvent;
@@ -37,8 +38,6 @@
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.DuplicateKeyException;
import net.dpml.transit.model.UnknownKeyException;
-
-import net.dpml.transit.home.ContentRegistryHome;
import net.dpml.transit.model.ContentRegistryModel;
import net.dpml.transit.model.ContentModel;
import net.dpml.transit.model.ModelReferenceException;
@@ -52,8 +51,8 @@
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: StandardTransitDirector.java 2480 2005-05-10 04:44:32Z
mcconnell AT dpml.net $
*/
-public class DefaultContentRegistryManager extends DefaultPluginManager
- implements ContentRegistryModel, ModificationListener
+public class DefaultContentRegistryModel extends DefaultPluginModel
+ implements ContentRegistryModel
{
//
------------------------------------------------------------------------
// state
@@ -67,7 +66,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultContentRegistryManager(
+ public DefaultContentRegistryModel(
Logger logger, Date creation, ContentRegistryHome home,
URI uri, ContentModel[] managers ) throws DuplicateKeyException
{
@@ -81,20 +80,6 @@
}
//
------------------------------------------------------------------------
- // ModificationListener (listen to modification to hosts)
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- //ModificationEvent e = new ModificationEvent( this, event );
- //enqueueEvent( e );
- }
-
- //
------------------------------------------------------------------------
// ContentRegistryModel
//
------------------------------------------------------------------------
@@ -157,26 +142,23 @@
catch( UnknownKeyException e )
{
m_list.add( manager );
- manager.addModificationListener( this );
if( notify )
{
ContentAddedEvent event = new ContentAddedEvent ( this,
manager );
enqueueEvent( event );
- setModified();
}
}
}
}
- public void removeContentModel( ContentModel manager )
+ public void removeContentModel( ContentModel model )
{
synchronized( m_lock )
{
- m_list.remove( manager );
- manager.removeModificationListener( this );
- ContentRemovedEvent event = new ContentRemovedEvent( this,
manager );
+ model.dispose();
+ m_list.remove( model );
+ ContentRemovedEvent event = new ContentRemovedEvent( this, model
);
super.enqueueEvent( event );
- setModified();
}
}
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultDisposablePluginModel.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultDisposablePluginModel.java
Mon Jun 13 01:29:22 2005
@@ -0,0 +1,136 @@
+/*
+ * 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.manager;
+
+import java.net.URI;
+import java.util.Date;
+import java.util.EventObject;
+import java.util.EventListener;
+import java.util.prefs.PreferenceChangeListener;
+import java.util.prefs.PreferenceChangeEvent;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.model.Disposable;
+import net.dpml.transit.model.DisposalListener;
+import net.dpml.transit.model.DisposalEvent;
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.PluginModel;
+import net.dpml.transit.home.PluginHome;
+
+/**
+ * @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
+ */
+public abstract class DefaultDisposablePluginModel extends
DefaultPluginModel implements Disposable
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public DefaultDisposablePluginModel( Logger logger, Date creation,
PluginHome home, URI uri )
+ {
+ super( logger, creation, home, uri );
+ }
+
+ //----------------------------------------------------------------------
+ // Disposable
+ //----------------------------------------------------------------------
+
+ /**
+ * Add a disposal listener to the model.
+ * @param listener the listener to add
+ */
+ public void addDisposalListener( DisposalListener listener )
+ {
+ super.addListener( listener );
+ }
+
+ /**
+ * Remove a disposal listener from the model.
+ * @param listener the listener to remove
+ */
+ public void removeDisposalListener( DisposalListener listener )
+ {
+ super.removeListener( listener );
+ }
+
+ public void dispose()
+ {
+ VetoableDisposalEvent veto = new VetoableDisposalEvent( this );
+ enqueueEvent( veto, false );
+ DisposalEvent disposal = new DisposalEvent( this );
+ enqueueEvent( disposal, false );
+ }
+
+ //----------------------------------------------------------------------
+ // impl
+ //----------------------------------------------------------------------
+
+ protected void processEvent( EventObject event )
+ {
+ if( event instanceof DisposalEvent )
+ {
+ processDisposalEvent( (DisposalEvent) event );
+ }
+ else
+ {
+ super.processEvent( event );
+ }
+ }
+
+ private void processDisposalEvent( DisposalEvent eventObject )
+ {
+ DisposalEvent event = (DisposalEvent) eventObject;
+ EventListener[] listeners = listeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ EventListener listener = listeners[i];
+ if( listener instanceof DisposalListener )
+ {
+ DisposalListener pl = (DisposalListener) listener;
+ if( event instanceof VetoableDisposalEvent )
+ {
+ pl.disposing( event );
+ }
+ else
+ {
+ try
+ {
+ pl.disposed( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Disposal listener notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ }
+ }
+ }
+
+ private static class VetoableDisposalEvent extends DisposalEvent
+ {
+ public VetoableDisposalEvent( PluginModel source )
+ {
+ super( source );
+ }
+ }
+}
+
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultHostModel.java
Mon Jun 13 01:29:22 2005
@@ -62,9 +62,10 @@
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public class DefaultHostManager extends DefaultPluginManager
+public class DefaultHostModel extends DefaultDisposablePluginModel
implements HostModel, DisposalListener
{
+ private final HostHome m_home;
private final String m_id;
private String m_name;
@@ -84,7 +85,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultHostManager(
+ public DefaultHostModel(
Logger logger, Date creation, HostHome home,
String id, Strategy strategy, URL base, URL index,
String name, boolean trusted, boolean enabled, int priority,
LayoutModel layout,
@@ -92,6 +93,7 @@
{
super( logger, creation, home, null );
+ m_home = home;
m_id = id;
m_name = name;
m_trusted = trusted;
@@ -117,6 +119,17 @@
}
}
+ //----------------------------------------------------------------------
+ // Disposable
+ //----------------------------------------------------------------------
+
+ public void dispose()
+ {
+ super.dispose();
+ m_layout.removeDisposalListener( this );
+ m_home.destroy();
+ }
+
//
------------------------------------------------------------------------
// DisposalListener (listen to modification to the assigned layout)
//
------------------------------------------------------------------------
@@ -156,6 +169,8 @@
{
synchronized( m_lock )
{
+ setLayoutModel( layout );
+
m_base = base;
m_index = index;
m_enabled = enabled;
@@ -163,11 +178,16 @@
m_layout = layout;
m_authentication = auth;
m_identifier = getRequestIdentifier( base, scheme, prompt );
+
+ if( m_home.isMutable() )
+ {
+ m_home.setHostSettings( base, index, enabled, trusted,
layout, auth, scheme, prompt );
+ }
+
HostChangeEvent e =
new HostChangeEvent(
this, base, index, m_identifier, auth, enabled, trusted );
enqueueEvent( e );
- setLayoutModel( layout );
}
}
@@ -176,7 +196,12 @@
synchronized( m_lock )
{
m_name = name;
- setModified();
+
+ if( m_home.isMutable() )
+ {
+ m_home.setName( name );
+ }
+
HostNameEvent e = new HostNameEvent( this, m_name );
enqueueEvent( e );
}
@@ -187,7 +212,12 @@
synchronized( m_lock )
{
m_priority = priority;
- setModified();
+
+ if( m_home.isMutable() )
+ {
+ m_home.setPriority( priority );
+ }
+
HostPriorityEvent e = new HostPriorityEvent( this, m_priority );
enqueueEvent( e );
}
@@ -202,26 +232,36 @@
{
synchronized( m_lock )
{
- if( isBootstrap() )
- {
- if( null != layout.getPluginURI() )
- {
- final String error =
- "Illegal attempt to assign a plugin based layout to a
bootstrap host."
- + "\nHost ID: " + getID()
- + "\nLayout ID: " + layout.getID();
- throw new BootstrapException( error );
- }
- }
+ checkLayout( layout );
m_layout.removeDisposalListener( this );
layout.addDisposalListener( this );
m_layout = layout;
- setModified();
+
+ if( m_home.isMutable() )
+ {
+ m_home.setLayoutModel( layout );
+ }
+
HostLayoutEvent e = new HostLayoutEvent( this, m_layout );
enqueueEvent( e );
}
}
+ private void checkLayout( LayoutModel layout ) throws BootstrapException
+ {
+ if( isBootstrap() )
+ {
+ if( null != layout.getPluginURI() )
+ {
+ final String error =
+ "Illegal attempt to assign a plugin based layout to a
bootstrap host."
+ + "\nHost ID: " + getID()
+ + "\nLayout ID: " + layout.getID();
+ throw new BootstrapException( error );
+ }
+ }
+ }
+
//----------------------------------------------------------------------
// Comparable
//----------------------------------------------------------------------
@@ -403,12 +443,6 @@
}
}
- protected void destroy()
- {
- m_layout.removeDisposalListener( this );
- super.destroy();
- }
-
protected void processEvent( EventObject event )
{
if( event instanceof HostChangeEvent )
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutModel.java
Mon Jun 13 01:29:22 2005
@@ -32,9 +32,9 @@
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.ModificationListener;
import net.dpml.transit.model.ModificationEvent;
-import net.dpml.transit.manager.DefaultManager.Strategy;
-import net.dpml.transit.manager.DefaultManager.Plugin;
-import net.dpml.transit.manager.DefaultManager.Local;
+import net.dpml.transit.manager.DefaultModel.Strategy;
+import net.dpml.transit.manager.DefaultModel.Plugin;
+import net.dpml.transit.manager.DefaultModel.Local;
/**
* Default implementation of a content manager that maintains an active
@@ -43,7 +43,7 @@
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: HostManager.java 2480 2005-05-10 04:44:32Z
mcconnell AT dpml.net $
*/
-public class DefaultLayoutManager extends DefaultPluginManager implements
LayoutModel
+public class DefaultLayoutModel extends DefaultDisposablePluginModel
implements LayoutModel
{
//----------------------------------------------------------------------
// state
@@ -52,6 +52,7 @@
private final String m_id;
private final String m_classname;
private final boolean m_bootstrap;
+ private final LayoutHome m_home;
private String m_title;
@@ -59,7 +60,7 @@
// constructor
//----------------------------------------------------------------------
- public DefaultLayoutManager(
+ public DefaultLayoutModel(
final Logger logger, Date creation, final LayoutHome home,
final String id, Strategy strategy, final String title )
{
@@ -67,6 +68,7 @@
m_id = id;
m_title = title;
+ m_home = home;
if( strategy instanceof Plugin )
{
@@ -92,9 +94,14 @@
synchronized( m_lock )
{
m_title = title;
+
+ if( m_home.isMutable() )
+ {
+ m_home.setTitle( title );
+ }
+
LayoutEvent event = new LayoutEvent( this );
super.enqueueEvent( event );
- setModified();
}
}
@@ -158,6 +165,16 @@
super.removeListener( listener );
}
+ //----------------------------------------------------------------------
+ // Disposable
+ //----------------------------------------------------------------------
+
+ public void dispose()
+ {
+ super.dispose();
+ m_home.destroy();
+ }
+
//
------------------------------------------------------------------------
// Object
//
------------------------------------------------------------------------
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultLayoutRegistryModel.java
Mon Jun 13 01:29:22 2005
@@ -54,7 +54,7 @@
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: StandardTransitDirector.java 2480 2005-05-10 04:44:32Z
mcconnell AT dpml.net $
*/
-public class DefaultLayoutRegistryManager extends DefaultPluginManager
+public class DefaultLayoutRegistryModel extends DefaultPluginModel
implements LayoutRegistryModel
{
//
------------------------------------------------------------------------
@@ -69,7 +69,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultLayoutRegistryManager(
+ public DefaultLayoutRegistryModel(
Logger logger, Date creation, LayoutRegistryHome home, URI uri,
LayoutModel[] managers )
throws DuplicateKeyException
{
@@ -133,7 +133,6 @@
{
LayoutAddedEvent event = new LayoutAddedEvent( this,
manager );
enqueueEvent( event );
- setModified();
}
}
}
@@ -172,21 +171,20 @@
}
}
- public void removeLayoutModel( LayoutModel manager ) throws
ModelReferenceException
+ public void removeLayoutModel( LayoutModel model ) throws
ModelReferenceException
{
synchronized( m_lock )
{
try
{
- manager.dispose();
- m_list.remove( manager );
- LayoutRemovedEvent event = new LayoutRemovedEvent( this,
manager );
+ model.dispose();
+ m_list.remove( model );
+ LayoutRemovedEvent event = new LayoutRemovedEvent( this,
model );
enqueueEvent( event );
- setModified();
}
catch( VetoDisposalException e )
{
- throw new ModelReferenceException( this, manager );
+ throw new ModelReferenceException( this, model );
}
}
}
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultModel.java
Mon Jun 13 01:29:22 2005
@@ -41,7 +41,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 DefaultManager implements Model
+public abstract class DefaultModel implements Model
{
//
------------------------------------------------------------------------
// state
@@ -75,7 +75,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultManager( Logger logger, Date creation, Home home )
+ public DefaultModel( Logger logger, Date creation, Home home )
throws NullPointerException
{
if( null == logger )
@@ -85,11 +85,6 @@
m_logger = logger;
m_creation = creation;
m_home = home;
- if( null != home )
- {
- addModificationListener( home );
- addDisposalListener( home );
- }
}
//
------------------------------------------------------------------------
@@ -146,49 +141,10 @@
}
}
- public void addModificationListener( ModificationListener listener )
- {
- addListener( listener );
- }
-
- public void removeModificationListener( ModificationListener listener )
- {
- removeListener( listener );
- }
-
- public void addDisposalListener( DisposalListener listener )
- {
- addListener( listener );
- }
-
- public void removeDisposalListener( DisposalListener listener )
- {
- removeListener( listener );
- }
-
- public void dispose() throws VetoDisposalException
- {
- m_modification = new Date();
- VetoableDisposalEvent veto = new VetoableDisposalEvent( this );
- enqueueEvent( veto, false );
- DisposalEvent disposal = new DisposalEvent( this );
- enqueueEvent( disposal, false );
- destroy();
- }
-
//
------------------------------------------------------------------------
- // DefaultManager
+ // DefaultModel
//
------------------------------------------------------------------------
- protected void destroy()
- {
- if( null != m_home )
- {
- removeModificationListener( m_home );
- removeDisposalListener( m_home );
- }
- }
-
protected Home getHome()
{
return m_home;
@@ -226,36 +182,6 @@
}
}
}
- else if( eventObject instanceof DisposalEvent )
- {
- DisposalEvent event = (DisposalEvent) eventObject;
- EventListener[] listeners = listeners();
- for( int i=0; i<listeners.length; i++ )
- {
- EventListener listener = listeners[i];
- if( listener instanceof DisposalListener )
- {
- DisposalListener pl = (DisposalListener) listener;
- if( event instanceof VetoableDisposalEvent )
- {
- pl.disposing( event );
- }
- else
- {
- try
- {
- pl.disposed( event );
- }
- catch( Throwable e )
- {
- final String error =
- "Disposal listener notification error.";
- getLogger().error( error, e );
- }
- }
- }
- }
- }
else
{
final String error =
@@ -366,9 +292,9 @@
}
Object source = event.getSource();
- if( source instanceof DefaultManager )
+ if( source instanceof DefaultModel )
{
- DefaultManager producer = (DefaultManager) source;
+ DefaultModel producer = (DefaultModel) source;
try
{
producer.processEvent( event );
@@ -386,7 +312,7 @@
{
final String error =
"Event source is not an instance of "
- + DefaultManager.class.getName();
+ + DefaultModel.class.getName();
throw new IllegalStateException( error );
}
}
@@ -499,12 +425,4 @@
}
}
- private static class VetoableDisposalEvent extends DisposalEvent
- {
- public VetoableDisposalEvent( Model source )
- {
- super( source );
- }
- }
-
}
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultPluginModel.java
Mon Jun 13 01:29:22 2005
@@ -44,26 +44,28 @@
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: StandardTransitDirector.java 2480 2005-05-10 04:44:32Z
mcconnell AT dpml.net $
*/
-public abstract class DefaultPluginManager extends DefaultManager implements
PluginModel
+public abstract class DefaultPluginModel extends DefaultModel implements
PluginModel
{
//
------------------------------------------------------------------------
// state
//
------------------------------------------------------------------------
private URI m_uri;
+ private PluginHome m_home;
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------
- public DefaultPluginManager( Logger logger, Date creation, PluginHome
home, URI uri )
+ public DefaultPluginModel( Logger logger, Date creation, PluginHome
home, URI uri )
{
super( logger, creation, home );
m_uri = uri;
+ m_home = home;
}
//
------------------------------------------------------------------------
- // PluginManager
+ // PluginModel
//
------------------------------------------------------------------------
/**
@@ -84,19 +86,18 @@
synchronized( m_lock )
{
m_uri = uri;
+ if( m_home.isMutable() )
+ {
+ m_home.setPluginURI( uri );
+ }
if( notify )
{
- setModified();
PluginChangeEvent e = new PluginChangeEvent( this, m_uri );
super.enqueueEvent( e );
}
}
}
- //
------------------------------------------------------------------------
- // PluginModel
- //
------------------------------------------------------------------------
-
/**
* Return the plugin uri.
* @return the plugin uri
@@ -131,6 +132,11 @@
// internals
//
------------------------------------------------------------------------
+ protected PluginHome getPluginHome()
+ {
+ return m_home;
+ }
+
protected void processEvent( EventObject eventObject )
{
if( eventObject instanceof PluginChangeEvent )
@@ -144,7 +150,7 @@
}
}
- protected void processPluginChangeEvent( PluginChangeEvent event )
+ private void processPluginChangeEvent( PluginChangeEvent event )
{
EventListener[] listeners = super.listeners();
for( int i=0; i<listeners.length; i++ )
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultProxyModel.java
Mon Jun 13 01:29:22 2005
@@ -44,12 +44,14 @@
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: StandardTransitDirector.java 2480 2005-05-10 04:44:32Z
mcconnell AT dpml.net $
*/
-public class DefaultProxyManager extends DefaultManager implements ProxyModel
+public class DefaultProxyModel extends DefaultModel implements ProxyModel
{
//
------------------------------------------------------------------------
// state
//
------------------------------------------------------------------------
+ private final ProxyHome m_home;
+
private URL m_host;
private PasswordAuthentication m_authentication;
private String[] m_excludes;
@@ -58,7 +60,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultProxyManager(
+ public DefaultProxyModel(
Logger logger, Date creation, ProxyHome home,
URL host, PasswordAuthentication auth, String[] excludes )
throws NullPointerException
@@ -67,6 +69,7 @@
m_host = host;
m_authentication = auth;
m_excludes = excludes;
+ m_home = home;
}
//
------------------------------------------------------------------------
@@ -80,11 +83,16 @@
m_host = host;
m_authentication = auth;
m_excludes = excludes;
+
+ if( m_home.isMutable() )
+ {
+ m_home.saveProxySettings( host, auth, excludes );
+ }
+
RequestIdentifier request = getRequestIdentifier( m_host );
ProxyEvent event =
new ProxyEvent( this, request, m_authentication, m_excludes );
super.enqueueEvent( event );
- setModified();
}
}
@@ -93,11 +101,16 @@
synchronized( m_lock )
{
m_host = host;
+
+ if( m_home.isMutable() )
+ {
+ m_home.setHost( host );
+ }
+
RequestIdentifier request = getRequestIdentifier( m_host );
ProxyEvent event =
new ProxyEvent( this, request, m_authentication, m_excludes );
super.enqueueEvent( event );
- setModified();
}
}
@@ -106,11 +119,16 @@
synchronized( m_lock )
{
m_excludes = excludes;
+
+ if( m_home.isMutable() )
+ {
+ m_home.setExcludes( excludes );
+ }
+
RequestIdentifier request = getRequestIdentifier( m_host );
ProxyEvent event =
new ProxyEvent( this, request, m_authentication, m_excludes );
super.enqueueEvent( event );
- setModified();
}
}
@@ -119,11 +137,16 @@
synchronized( m_lock )
{
m_authentication = auth;
+
+ if( m_home.isMutable() )
+ {
+ m_home.setAuthentication( auth );
+ }
+
RequestIdentifier request = getRequestIdentifier( m_host );
ProxyEvent event =
new ProxyEvent( this, request, m_authentication, m_excludes );
super.enqueueEvent( event );
- setModified();
}
}
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultRepositoryModel.java
Mon Jun 13 01:29:22 2005
@@ -27,13 +27,13 @@
import net.dpml.transit.model.Logger;
/**
- * Default implementation of a pluggable repository manager.
+ * Default implementation of a pluggable repository model.
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public class DefaultRepositoryManager extends DefaultPluginManager
implements RepositoryModel
+public class DefaultRepositoryModel extends DefaultPluginModel implements
RepositoryModel
{
- public DefaultRepositoryManager( Logger logger, Date creation,
RepositoryHome home, URI uri )
+ public DefaultRepositoryModel( Logger logger, Date creation,
RepositoryHome home, URI uri )
{
super( logger, creation, home, uri );
}
Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitModel.java
(from r2828,
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitManager.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitManager.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/DefaultTransitModel.java
Mon Jun 13 01:29:22 2005
@@ -38,7 +38,7 @@
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
-public class DefaultTransitManager extends DefaultManager implements
TransitModel
+public class DefaultTransitModel extends DefaultModel implements TransitModel
{
//
------------------------------------------------------------------------
// state
@@ -53,7 +53,7 @@
// constructor
//
------------------------------------------------------------------------
- public DefaultTransitManager(
+ public DefaultTransitModel(
Logger logger, Date creation, TransitHome home, CacheModel cache,
ContentRegistryModel content, RepositoryModel repository,
ProxyModel proxy )
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/manager/package.html
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/manager/package.html
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/manager/package.html
Mon Jun 13 01:29:22 2005
@@ -2,8 +2,8 @@
<body>
<p>
The manager package contains a set of classes that provide the
implementation of an active
-configuration model based on java.util.prefs.Preferences. The <a
href="TransitManager.html">
-TransitManager</a> class defines the root of the configuration model from
which <a href="CacheManager.html">CacheManager</a>, <a
href="RegistryManager.html">RegistryManager</a> and <a
href="RepositoryManager.html">RepositoryManager</a> instances handle the
respective management roles.
+configuration model. The <a href="TransitModel.html">
+TransitModel</a> class defines the root of the configuration model from
which <a href="CacheModel.html">CacheModel</a>, <a
href="ContentRegistryModel.html">ContentRegistryModel</a>, <a
href="LayoutRegistryModel.html">LayoyutRegistryModel</a>, <a
href="RepositoryModel.html">RepositoryModel</a> <a
href="ProxyModel.html">ProxyModel</a> classes handle the respective
sub-system concerns.
</p>.
</body>
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
Mon Jun 13 01:29:22 2005
@@ -26,7 +26,7 @@
* cache subsystem. Instances of CacheModel shall be supplied to cache
handler
* implementations as constructor arguments.
*/
-public interface CacheModel extends PluginModel
+public interface CacheModel extends PluginModel, Disposable
{
static final String CACHE_LOCATION_KEY = "dpml.transit.cache.location";
static final String CACHE_CLASS_KEY = "dpml.transit.cache.class";
@@ -99,7 +99,7 @@
/**
* Remove a host from the cache model.
- * @param the host model to remove
+ * @param model the host model to remove
*/
void removeHostModel( HostModel model );
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
Mon Jun 13 01:29:22 2005
@@ -25,7 +25,7 @@
* of a content handler. Instances of ContentModel are used as
* constructor arguments to content handler plugins.
*/
-public interface ContentModel extends PluginModel
+public interface ContentModel extends PluginModel, Disposable
{
/**
* Return the immutable content type identifier.
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/model/Disposable.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/Disposable.java
Mon Jun 13 01:29:22 2005
@@ -0,0 +1,32 @@
+/*
+ * 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.transit.model;
+
+/**
+ * The abstract model interface.
+ */
+public interface Disposable
+{
+ void addDisposalListener( DisposalListener listener );
+
+ void removeDisposalListener( DisposalListener listener );
+
+ void dispose();
+
+}
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
Mon Jun 13 01:29:22 2005
@@ -33,7 +33,7 @@
* synchronization via change events raised by implementations of this
* interface.
*/
-public interface HostModel extends PluginModel, Comparable
+public interface HostModel extends PluginModel, Comparable, Disposable
{
/**
* Return an immutable host identifier. The host identifier shall be
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
Mon Jun 13 01:29:22 2005
@@ -24,7 +24,7 @@
* A LayoutModel maintains information about the configuration
* of a location resolver.
*/
-public interface LayoutModel extends PluginModel
+public interface LayoutModel extends PluginModel, Disposable
{
/**
* Return the immutable resolver identifier.
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
Mon Jun 13 01:29:22 2005
@@ -54,21 +54,21 @@
/**
* Add a new layout model to the registry.
- * @param the layout model identity
+ * @param id the layout model identity
* @exception DuplicateKeyException if a layout model of the same id
already exists
*/
void addLayoutModel( String id ) throws DuplicateKeyException;
/**
* Add a new layout model to the registry.
- * @param the layout model
+ * @param model the layout model
* @exception DuplicateKeyException if a layout model of the same id
already exists
*/
void addLayoutModel( LayoutModel model ) throws DuplicateKeyException;
/**
* Remove a layout model from the registry.
- * @param the layout model to be removed
+ * @param model the layout model to be removed
* @exception ModelReferenceException if the layout is in use
*/
void removeLayoutModel( LayoutModel model ) throws
ModelReferenceException;
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
Mon Jun 13 01:29:22 2005
@@ -31,12 +31,6 @@
*/
Logger getLogger();
- void addDisposalListener( DisposalListener listener );
-
- void removeDisposalListener( DisposalListener listener );
-
- void dispose();
-
Date getCreationDate();
Date getModificationDate();
@@ -45,8 +39,4 @@
boolean isModified();
- void addModificationListener( ModificationListener listener );
-
- void removeModificationListener( ModificationListener listener );
-
}
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/ModelReferenceException.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/ModelReferenceException.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/ModelReferenceException.java
Mon Jun 13 01:29:22 2005
@@ -32,8 +32,8 @@
/**
* Construct a new <code>ModelReferenceException</code> instance.
*
- * @param target the target model
- * @param consumers the consumer models
+ * @param source the source model
+ * @param layout the layout model
*/
public ModelReferenceException( final Model source, final LayoutModel
layout )
{
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
Mon Jun 13 01:29:22 2005
@@ -21,6 +21,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.MalformedURLException;
+import java.security.AccessControlException;
import java.util.Date;
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;
@@ -36,7 +37,7 @@
/**
* Abstract base class providing a framework for preferences based
persistance.
*/
-public abstract class AbstractStorageUnit implements ModificationListener,
DisposalListener
+public abstract class AbstractStorageUnit
{
//
------------------------------------------------------------------------
// state
@@ -63,6 +64,16 @@
// constructor
//
------------------------------------------------------------------------
+ public boolean isReadOnly()
+ {
+ return !m_policy;
+ }
+
+ public boolean isMutable()
+ {
+ return m_policy;
+ }
+
public boolean getStoragePolicy()
{
return m_policy;
@@ -84,39 +95,28 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- }
-
- //
------------------------------------------------------------------------
- // DisposalListener
+ // impl
//
------------------------------------------------------------------------
- /**
- * Notify the listener of the disposal of a manager.
- */
- public void disposing( DisposalEvent event ) throws VetoDisposalException
+ protected void checkAccess()
{
+ if( false == getStoragePolicy() )
+ {
+ final String error =
+ "Store access is denied (readonly): "
+ + getPreferences();
+ throw new AccessControlException( error );
+ }
}
- /**
- * Notify the listener of the disposal of a manager.
- */
- public void disposed( DisposalEvent event )
+ protected void setModified()
{
+ checkAccess();
+ Date modified = new Date();
+ long time = modified.getTime();
+ getPreferences().putLong( "modified", time );
}
- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
public URI getURI( String key ) throws BuilderException
{
Preferences prefs = getPreferences();
@@ -154,6 +154,7 @@
public void setURI( String key, URI uri )
{
+ checkAccess();
if( null == uri )
{
getPreferences().remove( key );
@@ -202,6 +203,7 @@
public void setURL( String key, URL url )
{
+ checkAccess();
if( null == url )
{
getPreferences().remove( key );
@@ -221,5 +223,19 @@
}
}
}
+
+ protected void setValue( String key, String value )
+ {
+ checkAccess();
+ Preferences prefs = getPreferences();
+ if( null == value )
+ {
+ prefs.remove( key );
+ }
+ else
+ {
+ prefs.put( key, value );
+ }
+ }
}
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
Mon Jun 13 01:29:22 2005
@@ -26,7 +26,7 @@
import java.util.prefs.BackingStoreException;
import net.dpml.transit.home.CacheHome;
-import net.dpml.transit.manager.DefaultCacheManager;
+import net.dpml.transit.manager.DefaultCacheModel;
import net.dpml.transit.model.CacheModel;
import net.dpml.transit.model.ContentRegistryModel;
import net.dpml.transit.model.LayoutModel;
@@ -45,7 +45,7 @@
* The LayoutRegistryHelper class provides support for the crreating of a
* ContentRegistryModel based on a supplied preferences node.
*/
-class CacheStorageUnit extends AbstractStorageUnit implements CacheHome
+class CacheStorageUnit extends PluginStorageUnit implements CacheHome
{
//
------------------------------------------------------------------------
// constructor
@@ -72,7 +72,7 @@
URI uri = getURI( "uri" );
try
{
- m_manager = new DefaultCacheManager(
+ m_manager = new DefaultCacheModel(
logger, creation, this, uri, cache, hosts, layout, m_registry
);
}
catch( DuplicateKeyException e )
@@ -87,6 +87,28 @@
// CacheHome
//
------------------------------------------------------------------------
+ /**
+ * Update the preferences cache location attribute with the value of
+ * the supplied file. If the file argument is null the cache location
+ * will be set to "cache" otherwise the string form of the file will
+ * be assigned as the cache directory value.
+ *
+ * @param file the cache directory
+ */
+ public void setCacheDirectory( File file )
+ {
+ Preferences prefs = getPreferences();
+ if( null == file )
+ {
+ setValue( "location", null );
+ }
+ else
+ {
+ String path = file.toString();
+ setValue( "location", path );
+ }
+ }
+
public HostModel createHostModel( String id ) throws BuilderException
{
if( null == m_registry )
@@ -103,33 +125,6 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- if( getStoragePolicy() )
- {
- try
- {
- CacheModel manager = (CacheModel) event.getModel();
- Date date = new Date();
- store( manager );
- manager.setCreationDate( date );
- }
- catch( Throwable e )
- {
- // TODO: propergate the error up to the HCI
- getLogger().error( "storage failure", e );
- }
- }
- }
-
- //
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -209,43 +204,6 @@
return new File( cache );
}
- private void store( CacheModel manager )
- {
- Preferences prefs = getPreferences();
- Logger logger = getLogger();
- Date creation = getCreationDate();
-
- File cache = manager.getCacheDirectory();
- setCacheDirectory( cache );
-
- URI uri = manager.getPluginURI();
- setURI( "uri", uri );
-
- // TODO: think about hosts
- }
-
- /**
- * Update the preferences cache location attribute with the value of
- * the supplied file. If the file argument is null the cache location
- * will be set to "cache" otherwise the string form of the file will
- * be assigned as the cache directory value.
- *
- * @param file the cache directory
- */
- public void setCacheDirectory( File file )
- {
- Preferences prefs = getPreferences();
- if( null == file )
- {
- prefs.remove( "location" );
- }
- else
- {
- String path = file.toString();
- prefs.put( "location", path );
- }
- }
-
private Preferences getHostsNodePreferences()
{
Preferences prefs = getPreferences();
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
Mon Jun 13 01:29:22 2005
@@ -24,7 +24,7 @@
import java.util.prefs.BackingStoreException;
import net.dpml.transit.home.ContentRegistryHome;
-import net.dpml.transit.manager.DefaultContentRegistryManager;
+import net.dpml.transit.manager.DefaultContentRegistryModel;
import net.dpml.transit.model.ContentRegistryModel;
import net.dpml.transit.model.ContentModel;
import net.dpml.transit.model.ModificationEvent;
@@ -35,7 +35,7 @@
* The LayoutRegistryHelper class provides support for the crreating of a
* ContentRegistryModel based on a supplied preferences node.
*/
-class ContentRegistryStorageUnit extends AbstractStorageUnit implements
ContentRegistryHome
+class ContentRegistryStorageUnit extends PluginStorageUnit implements
ContentRegistryHome
{
//
------------------------------------------------------------------------
// constructor
@@ -75,32 +75,6 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- if( getStoragePolicy() )
- {
- try
- {
- ContentRegistryModel manager = (ContentRegistryModel)
event.getModel();
- store( manager );
- Date date = new Date();
- manager.setCreationDate( date );
- }
- catch( Throwable e )
- {
- getLogger().error( "storage modification failure", e );
- }
- }
- }
-
- //
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -122,8 +96,8 @@
list.add( manager );
}
ContentModel[] managers = (ContentModel[]) list.toArray( new
ContentModel[0] );
- URI uri = getURI( "uri" );
- return new DefaultContentRegistryManager( logger, creation,
this, uri, managers );
+ URI uri = getPluginURI();
+ return new DefaultContentRegistryModel( logger, creation, this,
uri, managers );
}
catch( Exception e )
{
@@ -132,16 +106,4 @@
throw new BuilderException( error, e );
}
}
-
- private void store( ContentRegistryModel model )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- URI uri = model.getPluginURI();
- synchronized( prefs )
- {
- setURI( "uri", uri );
- getLogger().warn( "TODO implementation pending!! " );
- }
- }
}
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
Mon Jun 13 01:29:22 2005
@@ -23,18 +23,17 @@
import java.util.prefs.BackingStoreException;
import net.dpml.transit.home.ContentHome;
-import net.dpml.transit.manager.DefaultContentManager;
+import net.dpml.transit.manager.DefaultContentModel;
import net.dpml.transit.model.ContentModel;
import net.dpml.transit.model.ModificationEvent;
import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.DisposalEvent;
import net.dpml.transit.model.Logger;
/**
* The ContentSorageUnit class is responsible for the setup of initial
factory
* default preference settings.
*/
-class ContentStorageUnit extends AbstractStorageUnit implements ContentHome
+class ContentStorageUnit extends PluginStorageUnit implements ContentHome
{
//
------------------------------------------------------------------------
// constructor
@@ -46,39 +45,16 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
+ // LayoutHome
//
------------------------------------------------------------------------
- /**
- * Notify a listener of a change to the model modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
+ public void setTitle( String title )
{
- if( getStoragePolicy() )
- {
- try
- {
- ContentModel model = (ContentModel) event.getModel();
- store( model );
- Date date = new Date();
- model.setCreationDate( date );
- }
- catch( Throwable e )
- {
- getLogger().error( "storage modification failure", e );
- }
- }
+ Preferences prefs = getPreferences();
+ setValue( "title", title );
}
- //
------------------------------------------------------------------------
- // DisposalListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify the listener of the disposal of a model.
- */
- public void disposed( DisposalEvent event )
+ public void destroy()
{
try
{
@@ -89,7 +65,6 @@
getLogger().error( "storage removal failure", e );
}
}
-
//
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -99,36 +74,10 @@
Preferences prefs = getPreferences();
Logger logger = getLogger();
Date creation = getCreationDate();
- URI uri = getURI( "uri" );
+ URI uri = getPluginURI();
String type = prefs.name();
String title = prefs.get( "title", type );
- return new DefaultContentManager( logger, creation, this, uri, type,
title );
+ return new DefaultContentModel( logger, creation, this, uri, type,
title );
}
-
- private void store( ContentModel model )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- URI uri = model.getPluginURI();
- String title = model.getTitle();
- synchronized( prefs )
- {
- setURI( "uri", uri );
- setTitle( title );
- }
- }
-
- private void setTitle( String title )
- {
- if( null == title )
- {
- getPreferences().remove( "title" );
- }
- else
- {
- getPreferences().put( "title", title );
- }
- }
-
}
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
Mon Jun 13 01:29:22 2005
@@ -24,9 +24,9 @@
import java.util.prefs.BackingStoreException;
import java.net.PasswordAuthentication;
-import net.dpml.transit.manager.DefaultManager.Local;
-import net.dpml.transit.manager.DefaultManager.Plugin;
-import net.dpml.transit.manager.DefaultHostManager;
+import net.dpml.transit.manager.DefaultModel.Local;
+import net.dpml.transit.manager.DefaultModel.Plugin;
+import net.dpml.transit.manager.DefaultHostModel;
import net.dpml.transit.home.HostHome;
import net.dpml.transit.model.HostModel;
import net.dpml.transit.model.ModificationEvent;
@@ -36,13 +36,14 @@
import net.dpml.transit.model.Model;
import net.dpml.transit.model.UnknownKeyException;
import net.dpml.transit.model.DisposalEvent;
+import net.dpml.transit.model.DisposalListener;
import net.dpml.transit.model.Model;
/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class HostStorageUnit extends AbstractStorageUnit implements HostHome
+class HostStorageUnit extends PluginStorageUnit implements HostHome
{
//
------------------------------------------------------------------------
// state
@@ -63,39 +64,55 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
+ // HostHome
//
------------------------------------------------------------------------
- /**
- * Notify a listener of a change to the model modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
+ public void setHostSettings(
+ URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
+ PasswordAuthentication auth, String scheme, String prompt )
{
- if( getStoragePolicy() )
+ Preferences prefs = getPreferences();
+ synchronized( prefs )
{
- try
- {
- HostModel model = (HostModel) event.getModel();
- store( model );
- Date date = new Date();
- model.setCreationDate( date );
- }
- catch( Throwable e )
- {
- getLogger().error( "storage modification failure", e );
- }
+ setURL( "base", base );
+ setURL( "index", index );
+ setTrusted( trusted );
+ setEnabled( enabled );
+ setLayoutModel( layout );
+ setAuthentication( auth );
+ setValue( "scheme", scheme );
+ setValue( "prompt", prompt );
}
}
- //
------------------------------------------------------------------------
- // DisposalListener
- //
------------------------------------------------------------------------
+ public void setName( String name )
+ {
+ setValue( "name", name );
+ }
- /**
- * Notify the listener of the disposal of a model.
- */
- public void disposed( DisposalEvent event )
+ public void setPriority( int priority )
+ {
+ Preferences prefs = getPreferences();
+ synchronized( prefs )
+ {
+ prefs.putInt( "priority", priority );
+ }
+ }
+
+ public void setLayoutModel( LayoutModel layout )
+ {
+ if( null == layout )
+ {
+ setValue( "layout", null );
+ }
+ else
+ {
+ String id = layout.getID();
+ setValue( "layout", id );
+ }
+ }
+
+ public void destroy()
{
try
{
@@ -132,7 +149,7 @@
String prompt = prefs.get( "prompt", "" );
if( bootstrap )
{
- return new DefaultHostManager(
+ return new DefaultHostModel(
logger, creation, this, id,
new Local( DEFAULT_HOST_CLASSNAME, bootstrap ),
base, index, name, trusted, enabled, priority,
@@ -140,8 +157,8 @@
}
else
{
- URI uri = getURI( "uri" );
- return new DefaultHostManager(
+ URI uri = getPluginURI();
+ return new DefaultHostModel(
logger, creation, this, id,
new Plugin( uri ), base, index, name, trusted,
enabled, priority, layout, auth, scheme, prompt );
@@ -246,7 +263,9 @@
boolean enabled = model.getEnabled();
LayoutModel layout = model.getLayoutModel();
PasswordAuthentication auth = model.getAuthentication();
-
+ URI uri = model.getPluginURI();
+
+ setPluginURI( uri );
setURL( "base", base );
setURL( "index", index );
setTrusted( trusted );
@@ -268,20 +287,6 @@
prefs.putBoolean( "enabled", enabled );
}
- private void setLayoutModel( LayoutModel layout )
- {
- Preferences prefs = getPreferences();
- if( null == layout )
- {
- prefs.remove( "layout" );
- }
- else
- {
- String id = layout.getID();
- prefs.put( "layout", id );
- }
- }
-
/**
* Set the host authentication.
* @param auth the password authentication to use for host sign-on
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
Mon Jun 13 01:29:22 2005
@@ -26,7 +26,7 @@
import net.dpml.transit.home.LayoutHome;
import net.dpml.transit.home.LayoutRegistryHome;
-import net.dpml.transit.manager.DefaultLayoutRegistryManager;
+import net.dpml.transit.manager.DefaultLayoutRegistryModel;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.LayoutModel;
import net.dpml.transit.model.LayoutRegistryModel;
@@ -37,7 +37,7 @@
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class LayoutRegistryStorageUnit extends AbstractStorageUnit implements
LayoutRegistryHome
+class LayoutRegistryStorageUnit extends PluginStorageUnit implements
LayoutRegistryHome
{
//
------------------------------------------------------------------------
// state
@@ -54,9 +54,9 @@
{
super( prefs, logger, creation, policy );
- URI uri = getURI( "uri" );
+ URI uri = getPluginURI();
LayoutModel[] layouts = createLayoutModels();
- m_manager = new DefaultLayoutRegistryManager( logger, creation,
this, uri, layouts );
+ m_manager = new DefaultLayoutRegistryModel( logger, creation, this,
uri, layouts );
}
//
------------------------------------------------------------------------
@@ -75,32 +75,6 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- if( getStoragePolicy() )
- {
- try
- {
- LayoutRegistryModel manager = (LayoutRegistryModel)
event.getModel();
- store( manager );
- Date date = new Date();
- manager.setCreationDate( date );
- }
- catch( Throwable e )
- {
- getLogger().error( "storage modification failure", e );
- }
- }
- }
-
- //
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -131,16 +105,4 @@
throw new BuilderException( error, e );
}
}
-
- private void store( LayoutRegistryModel manager )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- URI uri = manager.getPluginURI();
- synchronized( prefs )
- {
- setURI( "uri", uri );
- getLogger().warn( "TODO implementation pending!! " );
- }
- }
}
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
Mon Jun 13 01:29:22 2005
@@ -23,12 +23,13 @@
import java.util.prefs.BackingStoreException;
import net.dpml.transit.home.LayoutHome;
-import net.dpml.transit.manager.DefaultManager.Plugin;
-import net.dpml.transit.manager.DefaultManager.Local;
-import net.dpml.transit.manager.DefaultLayoutManager;
+import net.dpml.transit.manager.DefaultModel.Plugin;
+import net.dpml.transit.manager.DefaultModel.Local;
+import net.dpml.transit.manager.DefaultLayoutModel;
import net.dpml.transit.model.LayoutModel;
import net.dpml.transit.model.ModificationEvent;
import net.dpml.transit.model.DisposalEvent;
+import net.dpml.transit.model.DisposalListener;
import net.dpml.transit.model.LayoutModel;
import net.dpml.transit.model.Logger;
@@ -36,7 +37,7 @@
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class LayoutStorageUnit extends AbstractStorageUnit implements LayoutHome
+class LayoutStorageUnit extends PluginStorageUnit implements LayoutHome
{
//
------------------------------------------------------------------------
// constructor
@@ -48,51 +49,29 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
+ // LayoutHome
//
------------------------------------------------------------------------
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
+ public void setTitle( String title )
{
- if( getStoragePolicy() )
- {
- try
- {
- LayoutModel manager = (LayoutModel) event.getModel();
- store( manager );
- Date date = new Date();
- manager.setCreationDate( date );
- }
- catch( Throwable e )
- {
- getLogger().error( "storage modification failure", e );
- }
- }
+ Preferences prefs = getPreferences();
+ setValue( "title", title );
}
- //
------------------------------------------------------------------------
- // DisposalListener
- //
------------------------------------------------------------------------
+ public void setClassname( String classname )
+ {
+ setValue( "classname", classname );
+ }
- /**
- * Notify the listener of the disposal of a manager.
- */
- public void disposed( DisposalEvent event )
+ public void destroy()
{
- LayoutModel model = (LayoutModel) event.getModel();
- if( false == model.isBootstrap() )
+ try
{
- try
- {
- getPreferences().removeNode();
- }
- catch( BackingStoreException e )
- {
- getLogger().error( "storage deletion failure", e );
- }
+ getPreferences().removeNode();
+ }
+ catch( BackingStoreException e )
+ {
+ getLogger().error( "storage removal failure", e );
}
}
@@ -106,14 +85,13 @@
Preferences prefs = getPreferences();
Logger logger = getLogger();
Date creation = getCreationDate();
- URI uri = getURI( "uri" );
+ URI uri = getPluginURI();
String id = prefs.name();
String title = prefs.get( "title", id );
- DefaultLayoutManager manager = null;
if( null != uri )
{
Plugin plugin = new Plugin( uri );
- return new DefaultLayoutManager( logger, creation, this, id,
plugin, title );
+ return new DefaultLayoutModel( logger, creation, this, id,
plugin, title );
}
else
{
@@ -121,54 +99,15 @@
if( null != classname )
{
Local local = new Local( classname, false );
- return new DefaultLayoutManager( logger, creation, this, id,
local, title );
+ return new DefaultLayoutModel( logger, creation, this, id,
local, title );
}
else
{
Local local = new Local(
"net.dpml.transit.layout.ClassicLayout", false );
- return new DefaultLayoutManager( logger, creation, this, id,
local, title );
+ return new DefaultLayoutModel( logger, creation, this, id,
local, title );
}
}
}
-
- private void store( LayoutModel manager )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- URI uri = manager.getPluginURI();
- String classname = manager.getClassname();
- String title = manager.getTitle();
- synchronized( prefs )
- {
- setURI( "uri", uri );
- setClassname( classname );
- setTitle( title );
- }
- }
-
- private void setClassname( String classname )
- {
- if( null == classname )
- {
- getPreferences().remove( "classname" );
- }
- else
- {
- getPreferences().put( "classname", classname );
- }
- }
-
- private void setTitle( String title )
- {
- if( null == title )
- {
- getPreferences().remove( "title" );
- }
- else
- {
- getPreferences().put( "title", title );
- }
- }
}
Added:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/PluginStorageUnit.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/PluginStorageUnit.java
Mon Jun 13 01:29:22 2005
@@ -0,0 +1,63 @@
+/*
+ * 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.transit.unit;
+
+import java.net.URI;
+import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
+import java.util.prefs.Preferences;
+import java.util.prefs.BackingStoreException;
+import java.util.Date;
+
+import net.dpml.transit.home.PluginHome;
+import net.dpml.transit.model.RepositoryModel;
+import net.dpml.transit.model.ModificationListener;
+import net.dpml.transit.model.ModificationEvent;
+import net.dpml.transit.model.Logger;
+
+/**
+ * The LayoutHelper class is responsible for the setup of initial factory
+ * default preference settings.
+ */
+abstract class PluginStorageUnit extends AbstractStorageUnit implements
PluginHome
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ PluginStorageUnit( Preferences prefs, Logger logger, Date creation,
boolean policy )
+ {
+ super( prefs, logger, creation, policy );
+ }
+
+ //
------------------------------------------------------------------------
+ // PluginHome
+ //
------------------------------------------------------------------------
+
+ public URI getPluginURI()
+ {
+ return getURI( "uri" );
+ }
+
+ public void setPluginURI( URI uri )
+ {
+ setURI( "uri", uri );
+ }
+
+}
+
+
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
Mon Jun 13 01:29:22 2005
@@ -24,7 +24,7 @@
import java.util.Date;
import net.dpml.transit.home.ProxyHome;
-import net.dpml.transit.manager.DefaultProxyManager;
+import net.dpml.transit.manager.DefaultProxyModel;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.ProxyModel;
import net.dpml.transit.model.ModificationListener;
@@ -46,32 +46,61 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
+ // ProxyHome
//
------------------------------------------------------------------------
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
+ public void setHost( URL host )
{
- if( getStoragePolicy() )
+ checkAccess();
+ Preferences prefs = getPreferences();
+ synchronized( prefs )
{
- try
+ if( null == host )
{
- ProxyModel manager = (ProxyModel) event.getModel();
- Date date = new Date();
- store( manager );
- manager.setCreationDate( date );
+ prefs.remove( "host" );
+ prefs.remove( "scheme" );
+ prefs.remove( "prompt" );
}
- catch( Throwable e )
+ else
{
- // TODO: propergate the error up to the HCI
- getLogger().error( "storage failure", e );
+ setURL( "host", host );
+ prefs.put( "scheme", "" );
+ prefs.put( "prompt", "" );
}
}
}
+ public void setAuthentication( PasswordAuthentication auth )
+ throws BuilderException
+ {
+ Preferences prefs = getPreferences();
+ if( null == auth )
+ {
+ prefs.putByteArray( "authentication", new byte[0] );
+ }
+ else
+ {
+ byte[] bytes = CredentialsHelper.exportCredentials( auth );
+ prefs.putByteArray( "authentication", bytes );
+ }
+ }
+
+ public void setExcludes( String[] excludes )
+ {
+ // TODO:
+ }
+
+ public void saveProxySettings( URL host, PasswordAuthentication auth,
String[] excludes )
+ {
+ Preferences prefs = getPreferences();
+ synchronized( prefs )
+ {
+ setHost( host );
+ setAuthentication( auth );
+ setExcludes( excludes );
+ }
+ }
+
//
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -85,9 +114,10 @@
URL host = getURL( "host" );
String[] excludes = getExcludes();
PasswordAuthentication auth = getAuthentication();
- return new DefaultProxyManager( logger, creation, this, host, auth,
excludes );
+ return new DefaultProxyModel( logger, creation, this, host, auth,
excludes );
}
+
private PasswordAuthentication getAuthentication()
throws BuilderException
{
@@ -119,51 +149,6 @@
}
}
- private void store( ProxyModel manager )
- {
- Preferences prefs = getPreferences();
- URL url = manager.getHost();
- PasswordAuthentication auth = manager.getAuthentication();
- synchronized( prefs )
- {
- setProxyHost( url );
- setProxyAuthentication( auth );
- }
-
- // TODO: excludes
- }
-
- private void setProxyHost( URL host )
- {
- Preferences prefs = getPreferences();
- if( null == host )
- {
- prefs.remove( "host" );
- prefs.remove( "scheme" );
- prefs.remove( "prompt" );
- }
- else
- {
- setURL( "host", host );
- prefs.put( "scheme", "" );
- prefs.put( "prompt", "" );
- }
- }
-
- private void setProxyAuthentication( PasswordAuthentication auth )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- if( null == auth )
- {
- prefs.putByteArray( "authentication", new byte[0] );
- }
- else
- {
- byte[] bytes = CredentialsHelper.exportCredentials( auth );
- prefs.putByteArray( "authentication", bytes );
- }
- }
}
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
Mon Jun 13 01:29:22 2005
@@ -27,14 +27,14 @@
import net.dpml.transit.model.RepositoryModel;
import net.dpml.transit.model.ModificationListener;
import net.dpml.transit.model.ModificationEvent;
-import net.dpml.transit.manager.DefaultRepositoryManager;
+import net.dpml.transit.manager.DefaultRepositoryModel;
import net.dpml.transit.model.Logger;
/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class RepositoryStorageUnit extends AbstractStorageUnit implements
RepositoryHome
+class RepositoryStorageUnit extends PluginStorageUnit implements
RepositoryHome
{
//
------------------------------------------------------------------------
// constructor
@@ -46,33 +46,6 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
- {
- if( getStoragePolicy() )
- {
- try
- {
- RepositoryModel manager = (RepositoryModel) event.getModel();
- Date date = new Date();
- store( manager );
- manager.setCreationDate( date );
- }
- catch( Throwable e )
- {
- // TODO: propergate the error up to the HCI
- getLogger().error( "storage failure", e );
- }
- }
- }
-
- //
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------
@@ -82,19 +55,8 @@
Preferences prefs = getPreferences();
Logger logger = getLogger();
Date creation = getCreationDate();
- URI uri = getURI( "uri" );
- return new DefaultRepositoryManager( logger, creation, this, uri );
- }
-
- public void store( RepositoryModel manager )
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- URI uri = manager.getPluginURI();
- synchronized( prefs )
- {
- setURI( "uri", uri );
- }
+ URI uri = getPluginURI();
+ return new DefaultRepositoryModel( logger, creation, this, uri );
}
}
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
Mon Jun 13 01:29:22 2005
@@ -40,7 +40,7 @@
import net.dpml.transit.model.RepositoryModel;
import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.manager.DefaultTransitManager;
+import net.dpml.transit.manager.DefaultTransitModel;
/**
@@ -62,7 +62,7 @@
private Logger m_logger;
private Preferences m_prefs;
private URL m_authority;
- private boolean m_savePolicy = false;
+ private boolean m_readonly = false;
private boolean m_factoryPolicy = true;
private boolean m_purgePolicy = false;
private String m_profile = "default";
@@ -87,33 +87,17 @@
}
//
------------------------------------------------------------------------
- // ModificationListener
+ // Home
//
------------------------------------------------------------------------
- /**
- * Notify a listener of a change to the manager modification date.
- * @param event the modification event
- */
- public void modified( ModificationEvent event )
+ public boolean isReadOnly()
{
+ return m_readonly;
}
- //
------------------------------------------------------------------------
- // DisposalListener
- //
------------------------------------------------------------------------
-
- /**
- * Notify the listener of the disposal of a manager.
- */
- public void disposing( DisposalEvent event ) throws VetoDisposalException
- {
- }
-
- /**
- * Notify the listener of the disposal of a manager.
- */
- public void disposed( DisposalEvent event )
+ public boolean isMutable()
{
+ return !isReadOnly();
}
//
------------------------------------------------------------------------
@@ -144,9 +128,9 @@
}
}
- public void setPersistOnModification( boolean policy )
+ public void setReadOnly()
{
- m_savePolicy = policy;
+ m_readonly = true;
}
public void useFactoryInitialization( boolean policy )
@@ -220,7 +204,7 @@
try
{
- return new DefaultTransitManager(
+ return new DefaultTransitModel(
logger, creation, this, cache, content, repository, proxy );
}
catch( Throwable e )
@@ -345,7 +329,7 @@
private boolean getStoragePolicy()
{
- return m_savePolicy;
+ return !m_readonly;
}
private String getProfileName()
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
Mon Jun 13 01:29:22 2005
@@ -34,7 +34,6 @@
import net.dpml.transit.model.ProxyEvent;
import net.dpml.transit.model.ProxyListener;
import net.dpml.transit.model.Logger;
-import net.dpml.transit.manager.DefaultProxyManager;
import net.dpml.transit.model.ProxyModel;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.unit.TransitStorageUnit;
@@ -53,9 +52,9 @@
m_data = new File( path );
System.setProperty( "dpml.data", path );
Preferences prefs =
- Preferences.userNodeForPackage( Transit.class ).node( "test"
).node( "proxy-manager-test" );
+ Preferences.userNodeForPackage( Transit.class ).node( "test"
).node( "proxy-test" );
TransitHome home = new TransitStorageUnit( prefs );
- home.clearBeforeInitialization( true );
+ home.setReadOnly();
m_model = home.create();
}
@@ -108,13 +107,5 @@
new String( auth.getPassword() ) );
}
}
-
- static
- {
- System.setProperty(
- "java.util.logging.config.class",
- "net.dpml.transit.util.ConfigurationHandler" );
- }
-
}
Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
Mon Jun 13 01:29:22 2005
@@ -46,7 +46,7 @@
String path = "target/test/data";
m_data = new File( path );
System.setProperty( "dpml.data", path );
- Preferences prefs = Preferences.userNodeForPackage( Transit.class
).node( "test" );
+ Preferences prefs = Preferences.userNodeForPackage( Transit.class
).node( "test" ).node( "transitm" );
TransitHome home = new TransitStorageUnit( prefs );
home.clearBeforeInitialization( true );
m_model = home.create();
- svn commit: r2830 - in development/main: depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs/src/main/net/dpml/depot/prefs depot/station/src/main/net/dpml/depot/station metro/composition/content/src/main/net/dpml/composition/content transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/cache transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/manager transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/test/net/dpml/transit/manager, mcconnell, 06/13/2005
Archive powered by MHonArc 2.6.24.