Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2900 - in development/main: depot/console depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/console/src/main/net/dpml/depot/store depot/console/src/main/net/dpml/depot/unit depot/prefs/src/main/net/dpml/depot/prefs depot/station/src/main/net/dpml/depot/station metro/main/src/main/net/dpml/metro/model test/unit/plus/src/test/net/dpml/test/acme/plus transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/store transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/main/net/dpml/transit/util transit/core/handler/src/test/net/dpml/transit/manager transit/core/handler/src/test/net/dpml/transit/test transit/core/tools/src/main/net/dpml/transit/tools

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2900 - in development/main: depot/console depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/console/src/main/net/dpml/depot/store depot/console/src/main/net/dpml/depot/unit depot/prefs/src/main/net/dpml/depot/prefs depot/station/src/main/net/dpml/depot/station metro/main/src/main/net/dpml/metro/model test/unit/plus/src/test/net/dpml/test/acme/plus transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/store transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/main/net/dpml/transit/util transit/core/handler/src/test/net/dpml/transit/manager transit/core/handler/src/test/net/dpml/transit/test transit/core/tools/src/main/net/dpml/transit/tools
  • Date: Wed, 22 Jun 2005 15:10:16 -0400

Author: mcconnell AT dpml.net
Date: Wed Jun 22 15:10:15 2005
New Revision: 2900

Added:

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

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

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

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

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

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

development/main/depot/console/src/main/net/dpml/depot/profile/DefaultActivationProfile.java
development/main/depot/console/src/main/net/dpml/depot/profile/Depot.java
- copied, changed from r2897,
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java

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

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

development/main/depot/console/src/main/net/dpml/depot/profile/DepotProfile.java
- copied, changed from r2898,
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
development/main/depot/console/src/main/net/dpml/depot/store/

development/main/depot/console/src/main/net/dpml/depot/store/ActivationGroupStorage.java

development/main/depot/console/src/main/net/dpml/depot/store/ActivationStorage.java

development/main/depot/console/src/main/net/dpml/depot/store/ApplicationStorage.java
development/main/depot/console/src/main/net/dpml/depot/store/DepotHome.java

development/main/depot/console/src/main/net/dpml/depot/store/ProfileStorage.java
development/main/depot/console/src/main/net/dpml/depot/unit/

development/main/depot/console/src/main/net/dpml/depot/unit/ActivationGroupStorageUnit.java

development/main/depot/console/src/main/net/dpml/depot/unit/ActivationStorageUnit.java

development/main/depot/console/src/main/net/dpml/depot/unit/ApplicationStorageUnit.java

development/main/depot/console/src/main/net/dpml/depot/unit/DepotStorageUnit.java

development/main/depot/console/src/main/net/dpml/depot/unit/ProfileStorageUnit.java

development/main/depot/station/src/main/net/dpml/depot/station/DepotStation.java
development/main/depot/station/src/main/net/dpml/depot/station/Station.java
development/main/transit/core/handler/src/main/net/dpml/transit/store/
- copied from r2897,
development/main/transit/core/handler/src/main/net/dpml/transit/home/

development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheHome.java
- copied, changed from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/CacheHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/CodeBaseStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/ContentRegistryHome.java
- copied, changed from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/ContentStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutRegistryHome.java
- copied, changed from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutRegistryHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/LocalStrategy.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/PluginStrategy.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/ProxyStorage.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/Removable.java
- copied, changed from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/Removable.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/StorageRuntimeException.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/Strategy.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
- copied, changed from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/TransitHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/package.html
- copied unchanged from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/package.html

development/main/transit/core/handler/src/main/net/dpml/transit/util/ConfigurationHandler.java

development/main/transit/core/handler/src/main/net/dpml/transit/util/StandardFormatter.java
Removed:

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

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

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

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

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

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

development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java

development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java

development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java

development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java

development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java

development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java

development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java

development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
development/main/transit/core/handler/src/main/net/dpml/transit/home/

development/main/transit/core/handler/src/main/net/dpml/transit/store/CodeBaseHome.java

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

development/main/transit/core/handler/src/main/net/dpml/transit/store/Home.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/HostHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/ProxyHome.java

development/main/transit/core/handler/src/main/net/dpml/transit/store/RepositoryHome.java
Modified:
development/main/depot/console/build.xml
development/main/depot/console/src/main/net/dpml/depot/Main.java

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

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

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

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

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

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

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

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

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

development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java

development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/URLTestCase.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java

development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java

development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java

development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java

development/main/transit/core/handler/src/test/net/dpml/transit/test/ArtifactTestCase.java

development/main/transit/core/handler/src/test/net/dpml/transit/test/LinkTestCase.java

development/main/transit/core/handler/src/test/net/dpml/transit/test/OfflineTestCase.java

development/main/transit/core/handler/src/test/net/dpml/transit/test/OnlineTestCase.java

development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
Log:
Improving structure and consistency.

Modified: development/main/depot/console/build.xml
==============================================================================
--- development/main/depot/console/build.xml (original)
+++ development/main/depot/console/build.xml Wed Jun 22 15:10:15 2005
@@ -28,8 +28,11 @@
<target name="build" depends="standard.build">
<rmic base="${basedir}/target/classes">
<include name="**/DefaultProfile.class"/>
+ <include name="**/DefaultProfile.class"/>
<include name="**/DefaultApplicationProfile.class"/>
- <include name="**/DefaultDepotModel.class"/>
+ <include name="**/DefaultActivationProfile.class"/>
+ <include name="**/DefaultActivationGroupProfile.class"/>
+ <include name="**/DepotProfile.class"/>
</rmic>
</target>


Modified: development/main/depot/console/src/main/net/dpml/depot/Main.java
==============================================================================
--- development/main/depot/console/src/main/net/dpml/depot/Main.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/Main.java Wed
Jun 22 15:10:15 2005
@@ -45,21 +45,23 @@
import net.dpml.transit.TransitException;
import net.dpml.transit.adapter.LoggingAdapter;
import net.dpml.transit.artifact.Artifact;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.Connection;
import net.dpml.transit.model.UnknownKeyException;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.repository.Repository;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;

import net.dpml.depot.lang.DPML;
import net.dpml.depot.lang.DepotClassLoader;
import net.dpml.depot.profile.ApplicationProfile;
import net.dpml.depot.profile.DefaultApplicationProfile;
-import net.dpml.depot.profile.DepotModel;
-import net.dpml.depot.profile.DepotStorage;
+import net.dpml.depot.profile.Depot;
+import net.dpml.depot.profile.DepotProfile;
import net.dpml.depot.profile.Profile;
+import net.dpml.depot.store.DepotHome;
+import net.dpml.depot.unit.DepotStorageUnit;

/**
* CLI hander for the depot package.
@@ -117,7 +119,7 @@
long start = new Date().getTime();
System.setSecurityManager(new RMISecurityManager());
boolean termination = false;
- System.setProperty( "dpml.system.group", "depot" );
+ System.setProperty( "dpml.logging.category", "depot" );

boolean help = isFlagPresent( args, "-help" );
if( help )
@@ -155,7 +157,7 @@
String arg = args[i];
if( arg.equals( "-station" ) )
{
- System.setProperty( "dpml.system.group", "station" );
+ System.setProperty( "dpml.logging.category", "station" );
break;
}
}
@@ -193,8 +195,8 @@

Logger logger = getLogger();
Preferences prefs = getRootPreferences();
- DepotStorage store = new DepotStorage( prefs, logger, false );
- DepotModel manager = store.getDepotModel();
+ DepotHome store = new DepotStorageUnit( prefs );
+ Depot manager = new DepotProfile( logger, store );

//
// check for the prefs or station option
@@ -245,6 +247,7 @@
break;
}
}
+
Properties properties = profile.getSystemProperties();
applySystemProperties( properties );
ClassLoader system = getSystemClassLoader();
@@ -313,7 +316,7 @@
}

private static Object resolveTargetObject(
- ClassLoader parent, URI uri, String[] args, DepotModel manager,
TransitModel model,
+ ClassLoader parent, URI uri, String[] args, Depot manager,
TransitModel model,
Logger logger, ApplicationProfile profile )
throws Exception
{
@@ -360,7 +363,7 @@
boolean command = false;
Properties args = new Properties();
return new DefaultApplicationProfile(
- log, id, title, null, command, null, uri, args );
+ log, id, title, null, command, null, uri, true, args );
}

private static ApplicationProfile createStationProfile( Logger logger )
throws Exception
@@ -374,7 +377,7 @@
Connection connection = new Connection();
Properties args = new Properties();
return new DefaultApplicationProfile(
- log, id, title, null, command, connection, uri, args );
+ log, id, title, null, command, connection, uri, true, args );
}

public static Registry getRegistry( Connection connection, boolean
create )
@@ -420,7 +423,7 @@
return registry;
}

- private static ApplicationProfile getApplicationProfile( DepotModel
manager, String target )
+ private static ApplicationProfile getApplicationProfile( Depot manager,
String target )
throws Exception
{
return manager.getApplicationProfile( target );
@@ -639,7 +642,7 @@
System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
System.setProperty( "java.util.logging.manager",
"net.dpml.depot.logging.LoggingManager" );
System.setProperty( "java.util.logging.manager.altclassloader",
"net.dpml.depot.logging.LoggingManager" );
- System.setProperty( "java.util.logging.config.class",
"net.dpml.depot.logging.ConfigurationHandler" );
+ System.setProperty( "java.util.logging.config.class",
"net.dpml.transit.util.ConfigurationHandler" );
System.setProperty( "java.rmi.server.RMIClassLoaderSpi",
"net.dpml.depot.lang.DepotRMIClassLoaderSpi" );
System.setProperty( Transit.SYSTEM_KEY,
Transit.DPML_SYSTEM.getAbsolutePath() );
System.setProperty( Transit.HOME_KEY,
Transit.DPML_HOME.getAbsolutePath() );

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationGroupEvent.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationGroupEvent.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,47 @@
+/*
+ * 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.depot.profile;
+
+import java.util.EventObject;
+
+/**
+ * An event pertaining to the addition or removal of an activation profile
+ * from or to an activation group profile.
+ */
+public class ActivationGroupEvent extends EventObject
+{
+ ActivationProfile m_profile;
+
+ public ActivationGroupEvent( ActivationGroupProfile group,
ActivationProfile profile )
+ {
+ super( group );
+ m_profile = profile;
+ }
+
+ public ActivationGroupProfile getActivationGroupProfile()
+ {
+ return (ActivationGroupProfile) super.getSource();
+ }
+
+ public ActivationProfile getActivationProfile()
+ {
+ return m_profile;
+ }
+
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationGroupListener.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationGroupListener.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.profile;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.EventListener;
+
+/**
+ * A ActivationGroupListener is implemented by objects that whish
+ * to be information about the addition or removal of activation profiles
+ * from or to a target activation group model.
+ */
+public interface ActivationGroupListener extends EventListener, Remote
+{
+ /**
+ * Notify the listener of the addition of a new activation profile.
+ * @param event the activation group event
+ */
+ void profileAdded( ActivationGroupEvent event ) throws RemoteException;
+
+ /**
+ * Notify a listener of the removal of an activation profile.
+ * @param event the activation group event
+ */
+ void profileRemoved( ActivationGroupEvent event ) throws RemoteException;
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationGroupProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationGroupProfile.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.profile;
+
+import java.rmi.RemoteException;
+
+import net.dpml.transit.model.DuplicateKeyException;
+import net.dpml.transit.model.UnknownKeyException;
+
+
+/**
+ * A ActivationProfile maintains information about the configuration
+ * of an activation profile.
+ */
+public interface ActivationGroupProfile extends Profile
+{
+ ActivationProfile[] getActivationProfiles() throws RemoteException;
+
+ ActivationProfile getActivationProfile( String key ) throws
UnknownKeyException, RemoteException;
+
+ void addActivationProfile( ActivationProfile profile ) throws
DuplicateKeyException, RemoteException;
+
+ void removeActivationProfile( ActivationProfile profile ) throws
RemoteException;
+
+ void addActivationGroupListener( ActivationGroupListener listener )
throws RemoteException;
+
+ void removeActivationGroupListener( ActivationGroupListener listener )
throws RemoteException;
+
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ActivationProfile.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.profile;
+
+import java.rmi.RemoteException;
+
+/**
+ * An ActivationProfile exposes information about the configuration
+ * of an activation profile.
+ */
+public interface ActivationProfile extends Profile
+{
+ String getClassname() throws RemoteException;
+
+ void setClassname( String classname ) throws RemoteException;
+
+ boolean getRestartPolicy() throws RemoteException;
+
+ void setResartPolicy( boolean policy ) throws RemoteException;
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/Application.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/Application.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.profile;
+
+import java.net.URI;
+import java.rmi.RemoteException;
+import java.util.Properties;
+import java.util.Date;
+
+import net.dpml.transit.model.Connection;
+
+/**
+ * The Application interface describes a model of an application deployment
+ * plan.
+ */
+public interface Application extends Profile
+{
+ boolean isEnabled() throws RemoteException;
+
+ void setEnabled( boolean value ) throws RemoteException;
+
+ boolean getCommandPolicy() throws RemoteException;
+
+ void setCommandPolicy( boolean policy ) throws RemoteException;
+
+ Connection getConnection() throws RemoteException;
+
+ void setConnection( Connection connection ) throws RemoteException;
+
+}
+

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
Wed Jun 22 15:10:15 2005
@@ -24,11 +24,10 @@
import java.util.Date;

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

/**
- * A ProfileModel maintains information about the configuration
- * of an application profile.
+ * The ApplicationProfile interface describes a model of an application
deployment
+ * plan.
*/
public interface ApplicationProfile extends Profile
{
@@ -46,3 +45,4 @@

}

+

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultActivationGroupProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultActivationGroupProfile.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,222 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.profile;
+
+import java.net.URI;
+import java.rmi.RemoteException;
+import java.util.EventObject;
+import java.util.EventListener;
+import java.util.Collections;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Properties;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroupDesc;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.DuplicateKeyException;
+import net.dpml.transit.model.UnknownKeyException;
+
+import net.dpml.depot.store.ActivationStorage;
+import net.dpml.depot.store.ActivationGroupStorage;
+
+/**
+ * A ActivationProfile maintains information about the configuration
+ * of an activation profile.
+ */
+public class DefaultActivationGroupProfile extends DefaultProfile implements
ActivationGroupProfile
+{
+ private final ActivationGroupStorage m_store;
+
+ private final List m_list = Collections.synchronizedList( new
LinkedList() );
+
+ public DefaultActivationGroupProfile( Logger logger,
ActivationGroupStorage home )
+ throws RemoteException, DuplicateKeyException
+ {
+ super( logger, home );
+
+ m_store = home;
+
+ ActivationStorage[] stores = home.getInitialActivationStorageArray();
+ for( int i=0; i<stores.length; i++ )
+ {
+ ActivationStorage store = stores[i];
+ addActivationProfile( store, false );
+ }
+ }
+
+ public ActivationProfile[] getActivationProfiles()
+ {
+ synchronized( m_lock )
+ {
+ return (ActivationProfile[]) m_list.toArray( new
ActivationProfile[0] );
+ }
+ }
+
+ public ActivationProfile getActivationProfile( String key ) throws
UnknownKeyException, RemoteException
+ {
+ ActivationProfile[] profiles = getActivationProfiles();
+ for( int i=0; i<profiles.length; i++ )
+ {
+ ActivationProfile profile = profiles[i];
+ if( key.equals( profile.getID() ) )
+ {
+ return profile;
+ }
+ }
+ throw new UnknownKeyException( key );
+ }
+
+ public void addActivationProfile( ActivationProfile profile )
+ throws DuplicateKeyException, RemoteException
+ {
+ addActivationProfile( profile, true );
+ }
+
+ public void removeActivationProfile( ActivationProfile profile ) throws
RemoteException
+ {
+ synchronized( m_lock )
+ {
+ profile.dispose();
+ m_list.remove( profile );
+ ProfileRemovedEvent event = new ProfileRemovedEvent( this,
profile );
+ super.enqueueEvent( event );
+ }
+ }
+
+ /**
+ * Add a depot content change listener.
+ * @param listener the registry change listener to add
+ */
+ public void addActivationGroupListener( ActivationGroupListener listener
) throws RemoteException
+ {
+ super.addListener( listener );
+ }
+
+ /**
+ * Remove a depot content change listener.
+ * @param listener the registry change listener to remove
+ */
+ public void removeActivationGroupListener( ActivationGroupListener
listener ) throws RemoteException
+ {
+ super.removeListener( listener );
+ }
+
+ protected void processEvent( EventObject event )
+ {
+ if( event instanceof ActivationGroupEvent )
+ {
+ processActivationGroupEvent( (ActivationGroupEvent) event );
+ }
+ else
+ {
+ super.processEvent( event );
+ }
+ }
+
+ private void processActivationGroupEvent( ActivationGroupEvent event )
+ {
+ EventListener[] listeners = super.listeners();
+ for( int i=0; i<listeners.length; i++ )
+ {
+ EventListener listener = listeners[i];
+ if( listener instanceof ActivationGroupListener )
+ {
+ ActivationGroupListener rl = (ActivationGroupListener)
listener;
+ if( event instanceof ProfileAddedEvent )
+ {
+ try
+ {
+ rl.profileAdded( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "ActivationGroupListener profile addition
notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ else if( event instanceof ProfileRemovedEvent )
+ {
+ try
+ {
+ rl.profileRemoved( event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "ActivationGroupListener profile removal
notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ }
+ }
+ }
+
+ private void addActivationProfile( ActivationProfile profile, boolean
notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ synchronized( m_lock )
+ {
+ String key = profile.getID();
+ try
+ {
+ ActivationProfile current = getActivationProfile( key );
+ throw new DuplicateKeyException( key );
+ }
+ catch( UnknownKeyException e )
+ {
+ m_list.add( profile );
+ if( notify )
+ {
+ ProfileAddedEvent event = new ProfileAddedEvent( this,
profile );
+ enqueueEvent( event );
+ }
+ }
+ }
+ }
+
+ private void addActivationProfile( ActivationStorage store, boolean
notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ String id = store.getID();
+ Logger logger = getLogger().getChildLogger( id );
+ ActivationProfile profile = new DefaultActivationProfile( logger,
store );
+ addActivationProfile( profile, notify );
+ }
+
+ static class ProfileAddedEvent extends ActivationGroupEvent
+ {
+ public ProfileAddedEvent( ActivationGroupProfile source,
ActivationProfile profile )
+ {
+ super( source, profile );
+ }
+ }
+
+ static class ProfileRemovedEvent extends ActivationGroupEvent
+ {
+ public ProfileRemovedEvent( ActivationGroupProfile source,
ActivationProfile profile )
+ {
+ super( source, profile );
+ }
+ }
+
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultActivationProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultActivationProfile.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.profile;
+
+import java.net.URI;
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Properties;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationException;
+
+import net.dpml.transit.model.Logger;
+
+import net.dpml.depot.store.ActivationStorage;
+
+/**
+ * The DefaultActivationProfile profile class is the default implementation
+ * of the activation profile model.
+ */
+public class DefaultActivationProfile extends DefaultProfile implements
ActivationProfile
+{
+ private final ActivationStorage m_home;
+
+ private boolean m_restart;
+ private String m_classname;
+
+ public DefaultActivationProfile( Logger logger, ActivationStorage home )
+ throws RemoteException
+ {
+ super( logger, home );
+
+ m_home = home;
+ m_restart = home.getRestartPolicy();
+ m_classname = home.getClassname();
+ }
+
+ public String getClassname() throws RemoteException
+ {
+ return m_classname;
+ }
+
+ public void setClassname( String classname ) throws RemoteException
+ {
+ m_classname = classname;
+ }
+
+ public boolean getRestartPolicy() throws RemoteException
+ {
+ return m_restart;
+ }
+
+ public void setResartPolicy( boolean policy ) throws RemoteException
+ {
+ m_restart = policy;
+ }
+}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultApplicationProfile.java
Wed Jun 22 15:10:15 2005
@@ -23,43 +23,51 @@
import java.util.Properties;
import java.util.Date;

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

+import net.dpml.depot.store.ApplicationStorage;
+
/**
* A DefaultApplicationProfile maintains information about the configuration
* of an application profile.
*/
public class DefaultApplicationProfile extends DefaultProfile implements
ApplicationProfile
{
+ private final ApplicationStorage m_store;
+
private boolean m_enabled;
- private boolean m_command;
private Connection m_connection;
+ private boolean m_command;
private Properties m_params;

public DefaultApplicationProfile(
Logger logger, String id, String title,
- Properties properties, boolean command, Connection connection, URI
uri, Properties args )
- throws RemoteException
- {
- this( logger, null, id, title, properties, command, connection, uri,
true, args );
- }
-
- public DefaultApplicationProfile(
- Logger logger, ProfileHome home, String id, String title,
Properties properties, boolean command, Connection connection, URI
uri,
boolean enabled, Properties params )
throws RemoteException
{
- super( logger, home, id, title, properties, uri );
+ super( logger, id, title, properties, uri );

+ m_store = null;
m_enabled = enabled;
m_connection = connection;
m_command = command;
m_params = params;
}

+ public DefaultApplicationProfile( Logger logger, ApplicationStorage
store )
+ throws RemoteException
+ {
+ super( logger, store );
+
+ m_store = store;
+ m_enabled = store.getEnabled();
+ m_connection = store.getConnection();
+ m_command = store.getCommandPolicy();
+ m_params = store.getProperties();
+ }
+
//----------------------------------------------------------------------
// impl
//----------------------------------------------------------------------
@@ -104,3 +112,5 @@
m_params = args;
}
}
+
+

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultProfile.java
Wed Jun 22 15:10:15 2005
@@ -29,28 +29,39 @@
import net.dpml.transit.model.DisposableCodeBaseModel;
import net.dpml.transit.model.Disposable;

+import net.dpml.depot.store.ProfileStorage;
+
/**
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
public class DefaultProfile extends DisposableCodeBaseModel implements
Profile
{
- private final ProfileHome m_home;
+ private final ProfileStorage m_home;
private final String m_id;

private String m_title;
private Properties m_properties;

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

m_id = id;
m_title = title;
m_properties = properties;
- m_home = home;
+ m_home = null;
+ }
+
+ public DefaultProfile( Logger logger, ProfileStorage store ) throws
RemoteException
+ {
+ super( logger, store );
+
+ m_home = store;
+ m_id = store.getID();
+ m_title = store.getTitle();
+ m_properties = store.getSystemProperties();
}

public String getID() throws RemoteException

Copied:
development/main/depot/console/src/main/net/dpml/depot/profile/Depot.java
(from r2897,
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java)
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotModel.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/profile/Depot.java
Wed Jun 22 15:10:15 2005
@@ -25,20 +25,10 @@
import net.dpml.transit.model.UnknownKeyException;

/**
- * A ProfileModel maintains information about the configuration
- * of an application profile.
+ *
*/
-public interface DepotModel extends Model
+public interface Depot extends Model
{
- void addApplicationProfile( ApplicationProfile profile )
- throws DuplicateKeyException, RemoteException;
-
- void removeApplicationProfile( ApplicationProfile profile ) throws
RemoteException;
-
- ApplicationProfile[] getApplicationProfiles() throws RemoteException;
-
- ApplicationProfile getApplicationProfile( String key ) throws
UnknownKeyException, RemoteException;
-
/**
* Add a depot content change listener.
* @param listener the registry change listener to add
@@ -50,4 +40,24 @@
* @param listener the registry change listener to remove
*/
void removeDepotListener( DepotListener listener ) throws
RemoteException;
+
+ void addApplicationProfile( ApplicationProfile profile )
+ throws DuplicateKeyException, RemoteException;
+
+ void removeApplicationProfile( ApplicationProfile profile ) throws
RemoteException;
+
+ ApplicationProfile[] getApplicationProfiles() throws RemoteException;
+
+ ApplicationProfile getApplicationProfile( String key ) throws
UnknownKeyException, RemoteException;
+
+ void addActivationGroupProfile( ActivationGroupProfile profile )
+ throws DuplicateKeyException, RemoteException;
+
+ void removeActivationGroupProfile( ActivationGroupProfile profile )
throws RemoteException;
+
+ ActivationGroupProfile[] getActivationGroupProfiles() throws
RemoteException;
+
+ ActivationGroupProfile getActivationGroupProfile( String key ) throws
UnknownKeyException, RemoteException;
+
+
}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotApplicationEvent.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotApplicationEvent.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,40 @@
+/*
+ * 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.depot.profile;
+
+import java.util.EventObject;
+
+/**
+ * An event pertaining to the Depot collection of application profiles.
+ */
+public class DepotApplicationEvent extends DepotEvent
+{
+ ApplicationProfile m_profile;
+
+ public DepotApplicationEvent( Depot model, ApplicationProfile profile )
+ {
+ super( model );
+ m_profile = profile;
+ }
+
+ public ApplicationProfile getApplicationProfile()
+ {
+ return m_profile;
+ }
+}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotEvent.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotEvent.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotEvent.java
Wed Jun 22 15:10:15 2005
@@ -21,25 +21,17 @@
import java.util.EventObject;

/**
- * An event pertaining to the Depot collection of application profiles.
+ * An event pertaining to the Depot profile collection.
*/
-public class DepotEvent extends EventObject
+public abstract class DepotEvent extends EventObject
{
- ApplicationProfile m_profile;
-
- public DepotEvent( DepotModel model, ApplicationProfile profile )
+ public DepotEvent( Depot model )
{
super( model );
- m_profile = profile;
- }
-
- public ApplicationProfile getApplicationProfile()
- {
- return m_profile;
}

- public DepotModel getDepotModel()
+ public Depot getDepotModel()
{
- return (DepotModel) super.getSource();
+ return (Depot) super.getSource();
}
}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotGroupEvent.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotGroupEvent.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,41 @@
+/*
+ * 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.depot.profile;
+
+import java.util.EventObject;
+
+/**
+ * An event pertaining to the Depot collection of application profiles.
+ */
+public class DepotGroupEvent extends DepotEvent
+{
+ ActivationGroupProfile m_profile;
+
+ public DepotGroupEvent( Depot model, ActivationGroupProfile profile )
+ {
+ super( model );
+ m_profile = profile;
+ }
+
+ public ActivationGroupProfile getActivationGroupProfile()
+ {
+ return m_profile;
+ }
+
+}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotListener.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotListener.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotListener.java
Wed Jun 22 15:10:15 2005
@@ -32,11 +32,24 @@
* Notify the listener of the addition of a new application profile.
* @param event the depot event
*/
- void profileAdded( DepotEvent event ) throws RemoteException;
+ void profileAdded( DepotApplicationEvent event ) throws RemoteException;

/**
* Notify a listener of the removal of an application profile.
* @param event the depot event
*/
- void profileRemoved( DepotEvent event ) throws RemoteException;
+ void profileRemoved( DepotApplicationEvent event ) throws
RemoteException;
+
+ /**
+ * Notify the listener of the addition of a new activation group profile.
+ * @param event the depot event
+ */
+ void groupAdded( DepotGroupEvent event ) throws RemoteException;
+
+ /**
+ * Notify a listener of the removal of an application group profile.
+ * @param event the depot event
+ */
+ void groupRemoved( DepotGroupEvent event ) throws RemoteException;
+
}

Copied:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotProfile.java
(from r2898,
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java)
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotModel.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotProfile.java
Wed Jun 22 15:10:15 2005
@@ -28,43 +28,46 @@
import java.util.EventObject;
import java.util.EventListener;

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

+import net.dpml.depot.store.DepotHome;
+import net.dpml.depot.store.ApplicationStorage;
+import net.dpml.depot.store.ActivationGroupStorage;
+
/**
- * A ProfileModel maintains information about the configuration
- * of an application profile.
+ * Implements of the DepotModel within which a set of application profiles
+ * are maintained.
*/
-public class DefaultDepotModel extends DefaultModel implements DepotModel
+public class DepotProfile extends DefaultModel implements Depot
{
- private final Home m_home;
+ private final DepotHome m_home;

private final List m_list = Collections.synchronizedList( new
LinkedList() );
+ private final List m_groups = Collections.synchronizedList( new
LinkedList() );

- public DefaultDepotModel( Logger logger, Home home, ApplicationProfile[]
profiles )
- throws NullPointerException, ProfileException, RemoteException
+ public DepotProfile( Logger logger, DepotHome home )
+ throws NullPointerException, DuplicateKeyException, RemoteException
{
- super( logger );
+ super( logger );

- m_home = home;
+ m_home = home;

- for( int i=0; i<profiles.length; i++ )
- {
- ApplicationProfile profile = profiles[i];
- try
- {
- addApplicationProfile( profile, false );
- }
- catch( DuplicateKeyException e )
- {
- final String error =
- "Cannot construct depot profile due to a duplicate
application key.";
- throw new ProfileException( error, e );
- }
- }
+ ApplicationStorage[] stores =
home.getInitialApplicationStorageArray();
+ for( int i=0; i<stores.length; i++ )
+ {
+ ApplicationStorage store = stores[i];
+ addApplicationProfile( store, false );
+ }
+
+ ActivationGroupStorage[] groups =
home.getInitialActivationGroupStorageArray();
+ for( int i=0; i<groups.length; i++ )
+ {
+ ActivationGroupStorage group = groups[i];
+ addActivationGroupProfile( group, false );
+ }
}

public void addApplicationProfile( ApplicationProfile profile )
@@ -106,6 +109,47 @@
throw new UnknownKeyException( key );
}

+ public void addActivationGroupProfile( ActivationGroupProfile profile )
+ throws DuplicateKeyException, RemoteException
+ {
+ addActivationGroupProfile( profile, true );
+ }
+
+ public void removeActivationGroupProfile( ActivationGroupProfile profile
) throws RemoteException
+ {
+ synchronized( m_lock )
+ {
+ profile.dispose();
+ m_groups.remove( profile );
+ GroupRemovedEvent event = new GroupRemovedEvent( this, profile );
+ super.enqueueEvent( event );
+ }
+ }
+
+ public ActivationGroupProfile[] getActivationGroupProfiles() throws
RemoteException
+ {
+ synchronized( m_lock )
+ {
+ return (ActivationGroupProfile[]) m_groups.toArray( new
ActivationGroupProfile[0] );
+ }
+ }
+
+ public ActivationGroupProfile getActivationGroupProfile( String key )
+ throws UnknownKeyException, RemoteException
+ {
+ ActivationGroupProfile[] profiles = getActivationGroupProfiles();
+ for( int i=0; i<profiles.length; i++ )
+ {
+ ActivationGroupProfile profile = profiles[i];
+ if( key.equals( profile.getID() ) )
+ {
+ return profile;
+ }
+ }
+ throw new UnknownKeyException( key );
+ }
+
+
/**
* Add a depot content change listener.
* @param listener the registry change listener to add
@@ -126,7 +170,7 @@

protected void processEvent( EventObject event )
{
- if( event instanceof DepotEvent )
+ if( event instanceof DepotApplicationEvent )
{
processDepotEvent( (DepotEvent) event );
}
@@ -136,6 +180,15 @@
}
}

+ private void addApplicationProfile( ApplicationStorage store, boolean
notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ String id = store.getID();
+ Logger logger = getLogger().getChildLogger( id );
+ ApplicationProfile profile = new DefaultApplicationProfile( logger,
store );
+ addApplicationProfile( profile, notify );
+ }
+
private void addApplicationProfile( ApplicationProfile profile, boolean
notify )
throws DuplicateKeyException, RemoteException
{
@@ -159,6 +212,38 @@
}
}

+ private void addActivationGroupProfile( ActivationGroupStorage store,
boolean notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ String id = store.getID();
+ Logger logger = getLogger().getChildLogger( id );
+ ActivationGroupProfile profile = new DefaultActivationGroupProfile(
logger, store );
+ addActivationGroupProfile( profile, notify );
+ }
+
+ private void addActivationGroupProfile( ActivationGroupProfile profile,
boolean notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ synchronized( m_lock )
+ {
+ String key = profile.getID();
+ try
+ {
+ ActivationGroupProfile current = getActivationGroupProfile(
key );
+ throw new DuplicateKeyException( key );
+ }
+ catch( UnknownKeyException e )
+ {
+ m_groups.add( profile );
+ if( notify )
+ {
+ GroupAddedEvent event = new GroupAddedEvent( this,
profile );
+ enqueueEvent( event );
+ }
+ }
+ }
+ }
+
private void processDepotEvent( DepotEvent event )
{
EventListener[] listeners = super.listeners();
@@ -172,7 +257,7 @@
{
try
{
- rl.profileAdded( event );
+ rl.profileAdded( (DepotApplicationEvent) event );
}
catch( Throwable e )
{
@@ -185,7 +270,7 @@
{
try
{
- rl.profileRemoved( event );
+ rl.profileRemoved( (DepotApplicationEvent) event );
}
catch( Throwable e )
{
@@ -194,21 +279,63 @@
getLogger().error( error, e );
}
}
+ else if( event instanceof GroupAddedEvent )
+ {
+ try
+ {
+ rl.groupAdded( (DepotGroupEvent) event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "DepotListener group addition notification error.";
+ getLogger().error( error, e );
+ }
+ }
+ else if( event instanceof GroupRemovedEvent )
+ {
+ try
+ {
+ rl.groupRemoved( (DepotGroupEvent) event );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "DepotListener group removal notification error.";
+ getLogger().error( error, e );
+ }
+ }
}
}
}

- static class ProfileAddedEvent extends DepotEvent
+ static class ProfileAddedEvent extends DepotApplicationEvent
+ {
+ public ProfileAddedEvent( Depot source, ApplicationProfile profile )
+ {
+ super( source, profile );
+ }
+ }
+
+ static class ProfileRemovedEvent extends DepotApplicationEvent
+ {
+ public ProfileRemovedEvent( Depot source, ApplicationProfile profile
)
+ {
+ super( source, profile );
+ }
+ }
+
+ static class GroupAddedEvent extends DepotGroupEvent
{
- public ProfileAddedEvent( DepotModel source, ApplicationProfile
profile )
+ public GroupAddedEvent( Depot source, ActivationGroupProfile profile
)
{
super( source, profile );
}
}

- static class ProfileRemovedEvent extends DepotEvent
+ static class GroupRemovedEvent extends DepotGroupEvent
{
- public ProfileRemovedEvent( DepotModel source, ApplicationProfile
profile )
+ public GroupRemovedEvent( Depot source, ActivationGroupProfile
profile )
{
super( source, profile );
}

Added:
development/main/depot/console/src/main/net/dpml/depot/store/ActivationGroupStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/store/ActivationGroupStorage.java
Wed Jun 22 15:10:15 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.depot.store;
+
+import net.dpml.transit.model.Connection;
+
+import net.dpml.depot.store.ActivationGroupStorage;
+
+/**
+ */
+public interface ActivationGroupStorage extends ProfileStorage
+{
+ ActivationStorage[] getInitialActivationStorageArray();
+
+ boolean getEnabled();
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/store/ActivationStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/store/ActivationStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.store;
+
+/**
+ */
+public interface ActivationStorage extends ProfileStorage
+{
+ String getClassname();
+
+ void setClassname( String classname );
+
+ boolean getRestartPolicy();
+
+ void setRestartPolicy( boolean policy );
+
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/store/ApplicationStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/store/ApplicationStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.store;
+
+import java.util.Properties;
+
+import net.dpml.transit.model.Connection;
+
+/**
+ *
+ */
+public interface ApplicationStorage extends ProfileStorage
+{
+ boolean getEnabled();
+
+ boolean getCommandPolicy();
+
+ Connection getConnection();
+
+ Properties getProperties();
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/store/DepotHome.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/store/DepotHome.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.store;
+
+/**
+ * A DepotStorage maintains persistent records of application profiles.
+ */
+public interface DepotHome
+{
+ ApplicationStorage[] getInitialApplicationStorageArray();
+
+ ApplicationStorage getApplicationStorage( String id );
+
+ ActivationGroupStorage[] getInitialActivationGroupStorageArray();
+
+ ActivationGroupStorage getActivationGroupStorage( String id );
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/store/ProfileStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/store/ProfileStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.store;
+
+import java.util.Properties;
+
+import net.dpml.transit.store.CodeBaseStorage;
+import net.dpml.transit.store.Removable;
+
+/**
+ * A ProfileHome maintains a persistent application profile.
+ */
+public interface ProfileStorage extends CodeBaseStorage, Removable
+{
+ //
------------------------------------------------------------------------
+ // utils
+ //
------------------------------------------------------------------------
+
+ String getID();
+
+ String getTitle();
+
+ Properties getSystemProperties();
+
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/unit/ActivationGroupStorageUnit.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/unit/ActivationGroupStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.unit;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Properties;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;
+import net.dpml.transit.store.StorageRuntimeException;
+
+import net.dpml.depot.store.ActivationGroupStorage;
+import net.dpml.depot.store.ActivationStorage;
+
+/**
+ * An ApplicationStorageUnit maintains persistent information
+ * about an application profile.
+ */
+public class ActivationGroupStorageUnit extends ProfileStorageUnit
implements ActivationGroupStorage
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public ActivationGroupStorageUnit( Preferences prefs )
+ {
+ super( prefs );
+ }
+
+ //
------------------------------------------------------------------------
+ // ActivationGroupStorage
+ //
------------------------------------------------------------------------
+
+ public ActivationStorage[] getInitialActivationStorageArray()
+ {
+ try
+ {
+ Preferences prefs = getPreferences().node( "profiles" );
+ String[] names = prefs.childrenNames();
+ ActivationStorage[] stores = new ActivationStorage[ names.length
];
+ for( int i=0; i<names.length; i++ )
+ {
+ String id = names[i];
+ ActivationStorage store = getActivationStorage( id );
+ stores[i] = store;
+ }
+ return stores;
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Internal error while resolving activation profiles "
+ + "due to non-availability of the preferences store.";
+ throw new StorageRuntimeException( error, e );
+ }
+ }
+
+ public ActivationStorage getActivationStorage( String id )
+ {
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ return new ActivationStorageUnit( prefs );
+ }
+
+ public boolean getEnabled()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "enabled", true );
+ }
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/unit/ActivationStorageUnit.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/unit/ActivationStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.unit;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Properties;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;
+import net.dpml.transit.store.StorageRuntimeException;
+
+import net.dpml.depot.store.ActivationGroupStorage;
+import net.dpml.depot.store.ActivationStorage;
+
+/**
+ * An ApplicationStorageUnit maintains persistent information
+ * about an application profile.
+ */
+public class ActivationStorageUnit extends ProfileStorageUnit implements
ActivationStorage
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public ActivationStorageUnit( Preferences prefs )
+ {
+ super( prefs );
+ }
+
+ //
------------------------------------------------------------------------
+ // ActivationStorage
+ //
------------------------------------------------------------------------
+
+ public ActivationStorage getActivationStorage( String id )
+ {
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ return new ActivationStorageUnit( prefs );
+ }
+
+ public boolean getEnabled()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "enabled", true );
+ }
+
+ public boolean getRestartPolicy()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "restart", true );
+ }
+
+ public void setRestartPolicy( boolean policy )
+ {
+ Preferences prefs = getPreferences();
+ prefs.putBoolean( "restart", policy );
+ }
+
+ public String getClassname()
+ {
+ return getValue( "classname", null );
+ }
+
+ public void setClassname( String classname )
+ {
+ setValue( "classname", classname );
+ }
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/unit/ApplicationStorageUnit.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/unit/ApplicationStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.unit;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Properties;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.Connection;
+import net.dpml.transit.store.StorageRuntimeException;
+
+import net.dpml.depot.store.ApplicationStorage;
+
+/**
+ * An ApplicationStorageUnit maintains persistent information
+ * about an application profile.
+ */
+public class ApplicationStorageUnit extends ProfileStorageUnit implements
ApplicationStorage
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public ApplicationStorageUnit( Preferences prefs )
+ {
+ super( prefs );
+ }
+
+ //
------------------------------------------------------------------------
+ // ApplicationStorage
+ //
------------------------------------------------------------------------
+
+ public boolean getEnabled()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "enabled", true );
+ }
+
+ public boolean getCommandPolicy()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "command", false );
+ }
+
+ public Connection getConnection()
+ {
+ Preferences root = getPreferences();
+ try
+ {
+ if( false == root.nodeExists( "connection" ) )
+ {
+ return null;
+ }
+ else
+ {
+ Preferences prefs = root.node( "connection" );
+ String host = prefs.get( "host", null );
+ int port = prefs.getInt( "port", 1099 );
+ boolean optional = prefs.getBoolean( "optional", true );
+ boolean enabled = prefs.getBoolean( "enabled", true );
+ return new Connection( host, port, optional, enabled );
+ }
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Cannot construct a connection due to non-availability of the
preferences store.";
+ throw new StorageRuntimeException( error, e );
+ }
+ }
+
+ public Properties getProperties()
+ {
+ Preferences prefs = getPreferences().node( "properties" );
+ return getProperties( prefs );
+ }
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/unit/DepotStorageUnit.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/unit/DepotStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.unit;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Properties;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.store.StorageRuntimeException;
+import net.dpml.transit.unit.AbstractStorageUnit;
+
+import net.dpml.depot.store.DepotHome;
+import net.dpml.depot.store.ApplicationStorage;
+import net.dpml.depot.store.ActivationGroupStorage;
+
+/**
+ * A DepotStorage maintains persistent records of application profiles.
+ */
+public class DepotStorageUnit extends AbstractStorageUnit implements
DepotHome
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public DepotStorageUnit( Preferences prefs )
+ {
+ super( prefs );
+
+ setupTestProfile();
+ setupMexicoProfile();
+ setupMetroProfile();
+ setupHttpProfile();
+ }
+
+ //
------------------------------------------------------------------------
+ // DepotStorage
+ //
------------------------------------------------------------------------
+
+ public ActivationGroupStorage[] getInitialActivationGroupStorageArray()
+ {
+ try
+ {
+ Preferences prefs = getPreferences().node( "groups" );
+ String[] names = prefs.childrenNames();
+ ActivationGroupStorage[] stores = new ActivationGroupStorage[
names.length ];
+ for( int i=0; i<names.length; i++ )
+ {
+ String id = names[i];
+ ActivationGroupStorage store = getActivationGroupStorage( id
);
+ stores[i] = store;
+ }
+ return stores;
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Internal error while resolving group due to non-availability
of the preferences store.";
+ throw new StorageRuntimeException( error, e );
+ }
+ }
+
+ public ActivationGroupStorage getActivationGroupStorage( String id )
+ {
+ Preferences prefs = getPreferences().node( "groups" ).node( id );
+ return new ActivationGroupStorageUnit( prefs );
+ }
+
+ public ApplicationStorage[] getInitialApplicationStorageArray()
+ {
+ try
+ {
+ Preferences prefs = getPreferences().node( "profiles" );
+ String[] names = prefs.childrenNames();
+ ApplicationStorage[] stores = new ApplicationStorage[
names.length ];
+ for( int i=0; i<names.length; i++ )
+ {
+ String id = names[i];
+ ApplicationStorage store = getApplicationStorage( id );
+ stores[i] = store;
+ }
+ return stores;
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Internal error while resolving profiles due to
non-availability of the preferences store.";
+ throw new StorageRuntimeException( error, e );
+ }
+ }
+
+ public ApplicationStorage getApplicationStorage( String id )
+ {
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ return new ApplicationStorageUnit( prefs );
+ }
+
+ private void setupTestProfile()
+ {
+ String id = "test";
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ prefs.put( "uri", "@TEST-PLUGIN-URI@" );
+ prefs.put( "title", "Depot Cient Test" );
+ prefs.putBoolean( "command", true );
+ }
+
+ private void setupMexicoProfile()
+ {
+ String id = "mexico";
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ prefs.put( "uri",
"artifact:plugin:dpml/test/dpml-test-mexico#SNAPSHOT" );
+ prefs.put( "title", "Depot Server Test" );
+ }
+
+ private void setupMetroProfile()
+ {
+ String id = "metro";
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ prefs.put( "uri",
"artifact:plugin:dpml/metro/dpml-metro-main#SNAPSHOT" );
+ prefs.put( "title", "Metro" );
+ }
+
+ private void setupHttpProfile()
+ {
+ String id = "http";
+ Preferences prefs = getPreferences().node( "profiles" ).node( id );
+ prefs.put( "uri",
"artifact:part:dpml/planet/http/dpml-http-demo#SNAPSHOT" );
+ prefs.put( "title", "HTTP Demo" );
+ }
+
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/unit/ProfileStorageUnit.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/unit/ProfileStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.depot.unit;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.Properties;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.store.Removable;
+import net.dpml.transit.store.StorageRuntimeException;
+import net.dpml.transit.unit.CodeBaseStorageUnit;
+
+import net.dpml.depot.store.ProfileStorage;
+
+/**
+ * A ProfileHome maintains a persistent application profile.
+ */
+public abstract class ProfileStorageUnit extends CodeBaseStorageUnit
implements ProfileStorage
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public ProfileStorageUnit( Preferences prefs )
+ {
+ super( prefs );
+ }
+
+ //
------------------------------------------------------------------------
+ // ProfileStorage
+ //
------------------------------------------------------------------------
+
+ public String getID()
+ {
+ return getPreferences().name();
+ }
+
+ public String getTitle()
+ {
+ String id = getID();
+ return getPreferences().get( "title", id );
+ }
+
+ public Properties getSystemProperties()
+ {
+ Preferences prefs = getPreferences().node( "system" );
+ return getProperties( prefs );
+ }
+
+ //
------------------------------------------------------------------------
+ // Removable
+ //
------------------------------------------------------------------------
+
+ public void remove()
+ {
+ try
+ {
+ getPreferences().removeNode();
+ }
+ catch( BackingStoreException e )
+ {
+ throw new StorageRuntimeException( "storage removal failure", e
);
+ }
+ }
+}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotModelPanel.java
Wed Jun 22 15:10:15 2005
@@ -48,7 +48,7 @@
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;

-import net.dpml.depot.profile.DepotModel;
+import net.dpml.depot.profile.Depot;
import net.dpml.depot.profile.ApplicationProfile;

import net.dpml.transit.model.DuplicateKeyException;
@@ -73,14 +73,14 @@
private JButton m_delete;
private String m_selection;

- private DepotModel m_model;
+ private Depot m_model;
private DepotTableModel m_tableModel;

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

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


Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesFrame.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesFrame.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesFrame.java
Wed Jun 22 15:10:15 2005
@@ -38,7 +38,7 @@
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;

-import net.dpml.depot.profile.DepotModel;
+import net.dpml.depot.profile.Depot;

import net.dpml.transit.Transit;
import net.dpml.transit.model.TransitModel;
@@ -75,7 +75,7 @@
*/
private static final int ZERO = 0;

- public DepotPreferencesFrame( TransitModel model, DepotModel depot )
throws Exception
+ public DepotPreferencesFrame( TransitModel model, Depot depot ) throws
Exception
{
super();


Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotPreferencesPanel.java
Wed Jun 22 15:10:15 2005
@@ -48,7 +48,7 @@
import net.dpml.transit.model.ContentRegistryModel;
import net.dpml.transit.model.ProxyModel;

-import net.dpml.depot.profile.DepotModel;
+import net.dpml.depot.profile.Depot;

/**
* Panel that presents the default preferences for DPML applications
including
@@ -87,10 +87,10 @@
private DepotModelPanel m_depotPanel;

private final Window m_window;
- private final DepotModel m_depot;
+ private final Depot m_depot;

public DepotPreferencesPanel(
- Window window, final TransitModel model, final DepotModel depot )
throws Exception
+ Window window, final TransitModel model, final Depot depot ) throws
Exception
{
super( new BorderLayout() );


Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/DepotTableModel.java
Wed Jun 22 15:10:15 2005
@@ -23,9 +23,10 @@
import javax.swing.table.AbstractTableModel;

import net.dpml.transit.Transit;
-import net.dpml.depot.profile.DepotEvent;
+import net.dpml.depot.profile.DepotApplicationEvent;
+import net.dpml.depot.profile.DepotGroupEvent;
import net.dpml.depot.profile.DepotListener;
-import net.dpml.depot.profile.DepotModel;
+import net.dpml.depot.profile.Depot;

/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
@@ -63,7 +64,7 @@
IconHelper.createImageIcon(
DepotTableModel.class.getClassLoader(), ICON_PATH, "Features" );

- private final DepotModel m_model;
+ private final Depot m_model;
private final RemoteListener m_listener;


//--------------------------------------------------------------------------
@@ -76,7 +77,7 @@
*
* @param model the registry of application profiles
*/
- public DepotTableModel( DepotModel model ) throws Exception
+ public DepotTableModel( Depot model ) throws Exception
{
super();
m_model = model;
@@ -110,7 +111,7 @@
* Notify all listeners of the addition of an application profile.
* @param event the depot event
*/
- public void profileAdded( DepotEvent event ) throws RemoteException
+ public void profileAdded( DepotApplicationEvent event ) throws
RemoteException
{
fireTableStructureChanged();
}
@@ -119,10 +120,27 @@
* Notify all listeners of the removal of an application profile.
* @param event the depot event
*/
- public void profileRemoved( DepotEvent event ) throws RemoteException
+ public void profileRemoved( DepotApplicationEvent event ) throws
RemoteException
{
fireTableStructureChanged();
}
+
+ /**
+ * Notify all listeners of the addition of an application profile.
+ * @param event the depot event
+ */
+ public void groupAdded( DepotGroupEvent event ) throws
RemoteException
+ {
+ }
+
+ /**
+ * Notify all listeners of the removal of an application profile.
+ * @param event the depot event
+ */
+ public void groupRemoved( DepotGroupEvent event ) throws
RemoteException
+ {
+ }
+
}


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

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/HostModelPanel.java
Wed Jun 22 15:10:15 2005
@@ -621,7 +621,8 @@
LayoutModel layout = (LayoutModel) m_strategy.getSelectedItem();
try
{
- m_model.update( base, null, enabled, trusted, layout,
m_auth, "", "" );
+ String key = layout.getID();
+ m_model.update( base, null, enabled, trusted, key, m_auth,
"", "" );
}
catch( Exception e )
{

Added:
development/main/depot/station/src/main/net/dpml/depot/station/DepotStation.java
==============================================================================
--- (empty file)
+++
development/main/depot/station/src/main/net/dpml/depot/station/DepotStation.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,206 @@
+
+package net.dpml.depot.station;
+
+import java.rmi.Remote;
+import java.rmi.Naming;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.rmi.ServerException;
+import java.rmi.MarshalledObject;
+import java.rmi.NotBoundException;
+import java.rmi.AccessException;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationGroup;
+import java.rmi.activation.ActivationGroupDesc;
+import java.rmi.activation.ActivationGroupDesc.CommandEnvironment;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.Activatable;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+import java.util.Hashtable;
+import java.util.prefs.Preferences;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.model.Connection;
+
+import net.dpml.depot.profile.Depot;
+import net.dpml.depot.profile.ProfileException;
+import net.dpml.depot.profile.ActivationProfile;
+import net.dpml.depot.profile.ActivationGroupProfile;
+
+public class DepotStation extends UnicastRemoteObject implements Station
+{
+ private int m_count = 0;
+ private final Logger m_logger;
+ private Hashtable m_table = new Hashtable();
+
+ private Depot m_model;
+
+ private ActivationGroupID m_rootID;
+
+ public DepotStation( Logger logger, Depot model ) throws RemoteException
+ {
+ super();
+
+ m_model = model;
+ m_logger = logger;
+
+ //
+ // startup the general registry
+ //
+
+ int port = Registry.REGISTRY_PORT;
+ Connection connection = new Connection( null, port, true, true );
+ Registry registry = getRegistry( connection );
+
+ // get groups and initiate deployment
+
+ ActivationGroupProfile[] profiles =
m_model.getActivationGroupProfiles();
+ for( int i=0; i<profiles.length; i++ )
+ {
+ ActivationGroupProfile profile = profiles[i];
+ ActivationGroupID id = deployActivationGroupProfile( profile );
+ m_table.put( profile, id );
+ }
+ }
+
+ private ActivationGroupID deployActivationGroupProfile(
ActivationGroupProfile group )
+ throws RemoteException
+ {
+ String gid = group.getID();
+ ActivationGroupID id = null;
+ try
+ {
+ ActivationGroupDesc desc = createActivationGroupDesc( group );
+ id = ActivationGroup.getSystem().registerGroup( desc );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while attempting to register an activation
group.";
+ throw new ServerException( error, e );
+ }
+
+ ActivationProfile[] profiles = group.getActivationProfiles();
+ for( int i=0; i<profiles.length; i++ )
+ {
+ ActivationProfile profile = profiles[i];
+ String aid = profile.getID();
+ try
+ {
+ registerActivatable( id, profile );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "An error occured while attempt to deploy an activation
profile."
+ + "\nGroup Profile: " + gid
+ + "\nActivatable Profile: " + aid;
+ getLogger().error( error, e );
+ }
+ }
+
+ return id;
+ }
+
+ private ActivationGroupDesc createActivationGroupDesc(
ActivationGroupProfile profile )
+ throws RemoteException
+ {
+ String id = profile.getID();
+ try
+ {
+ String[] args = new String[0];
+ Properties properties = profile.getSystemProperties();
+ CommandEnvironment environment = new CommandEnvironment( null,
args ) ;
+ return new ActivationGroupDesc( properties, environment );
+ }
+ catch( Exception e )
+ {
+ final String error =
+ "Internal error while attempting to construct an activation
group descriptor."
+ + "\nGroup ID: " + id;
+ throw new ServerException( error, e );
+ }
+ }
+
+ private void registerActivatable(
+ ActivationGroupID group, ActivationProfile profile )
+ throws RemoteException
+ {
+ String id = profile.getID();
+ String location = profile.getCodeBaseURI().toASCIIString();
+ String classname = profile.getClassname();
+ MarshalledObject data = null;
+
+ final String message =
+ "Deploying activation profile: " + id
+ + "\nCode Source: " + location
+ + "\nClassname: " + classname;
+ getLogger().info( message );
+
+ try
+ {
+ ActivationDesc desc = new ActivationDesc( group, classname,
location, data );
+ Remote remote = Activatable.register( desc );
+ getLogger().info( "Registered: " + id + " (" +
remote.getClass().getName() + ")" );
+ Naming.rebind( id, remote );
+ getLogger().info( "binding complete" );
+ }
+ catch( Exception e )
+ {
+ getLogger().error( "error attempting to bind stub", e );
+ final String error =
+ "Registration error due to " + e.toString();
+ throw new ServerException( error, e );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Registration failed due to " + e.toString();
+ Exception exception = new Exception( error, e );
+ throw new ServerException( error, exception );
+ }
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+
+ public Registry getRegistry( Connection connection ) throws
RemoteException
+ {
+ if( null == connection )
+ {
+ return null;
+ }
+ else
+ {
+ String host = connection.getHost();
+ int port = connection.getPort();
+
+ if( ( null == host ) || ( "localhost".equals( host ) ) )
+ {
+ try
+ {
+ Registry registry = LocateRegistry.createRegistry( port
);
+ getLogger().debug( "created local registry on port " +
port );
+ return registry;
+ }
+ catch( RemoteException e )
+ {
+ Registry registry = LocateRegistry.getRegistry( port );
+ getLogger().debug( "using local registry on port " +
port );
+ return registry;
+ }
+ }
+ else
+ {
+ return LocateRegistry.getRegistry( host, port );
+ }
+ }
+ }
+}

Added:
development/main/depot/station/src/main/net/dpml/depot/station/Station.java
==============================================================================
--- (empty file)
+++
development/main/depot/station/src/main/net/dpml/depot/station/Station.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,9 @@
+
+package net.dpml.depot.station;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Station extends Remote
+{
+}

Modified:
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java
==============================================================================
---
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java
(original)
+++
development/main/metro/main/src/main/net/dpml/metro/model/MetroHelper.java
Wed Jun 22 15:10:15 2005
@@ -56,6 +56,12 @@
// constructor
//------------------------------------------------------------------

+ public MetroHelper() throws Exception
+ {
+ ContentStorageUnit store = new ContentStorageUnit( prefs, logger,
policy );
+ DefaultContentModel model = new DefaultContentModel( store );
+ }
+
public MetroHelper( ContentModel model ) throws Exception
{
if( null == model )

Modified:
development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/URLTestCase.java
==============================================================================
---
development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/URLTestCase.java
(original)
+++
development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/URLTestCase.java
Wed Jun 22 15:10:15 2005
@@ -119,10 +119,15 @@
private static TransitModel MODEL = null;
private static Transit TRANSIT = null;

- static
+ static
{
System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
- System.setProperty( "java.util.logging.config.class",
"net.dpml.depot.logging.ConfigurationHandler" );
+ System.setProperty(
+ "java.util.logging.config.class",
+ System.getProperty(
+ "java.util.logging.config.class",
+ "net.dpml.transit.util.ConfigurationHandler" ) );
+
try
{
URI uri = new URI( CONTENT_MANAGER_PLUGIN );

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
Wed Jun 22 15:10:15 2005
@@ -35,7 +35,6 @@
import java.io.PrintWriter;

import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.monitors.Monitor;
import net.dpml.transit.monitors.RepositoryMonitorRouter;
import net.dpml.transit.monitors.CacheMonitorRouter;
@@ -43,10 +42,10 @@
import net.dpml.transit.link.LinkManager;
import net.dpml.transit.model.Connection;
import net.dpml.transit.model.DefaultTransitModel;
-import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;

/**

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
Wed Jun 22 15:10:15 2005
@@ -88,8 +88,9 @@
* Add a new host model to the cache model.
* @param id the host identifier
* @exception DuplicateKeyException if a host of the same identifier
already exists
+ * @exception UnknownKeyException if a host references an unknown layout
key
*/
- void addHostModel( String id ) throws DuplicateKeyException,
RemoteException;
+ void addHostModel( String id ) throws DuplicateKeyException,
UnknownKeyException, RemoteException;

/**
* Add a new host model to the cache model.

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCacheModel.java
Wed Jun 22 15:10:15 2005
@@ -43,7 +43,8 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitError;
-import net.dpml.transit.home.CacheHome;
+import net.dpml.transit.store.CacheHome;
+import net.dpml.transit.store.HostStorage;
import net.dpml.transit.util.PropertyResolver;

/**
@@ -77,28 +78,30 @@
//
------------------------------------------------------------------------

public DefaultCacheModel(
- Logger logger, CacheHome home,
- URI uri, File cache, HostModel[] hosts, LayoutModel layout,
LayoutRegistryModel registry )
- throws DuplicateKeyException, RemoteException
+ Logger logger, CacheHome home, LayoutRegistryModel registry )
+ throws DuplicateKeyException, RemoteException, UnknownKeyException
{
- super( logger, home, uri );
- if( null == cache )
- {
- throw new NullPointerException( "cache" );
- }
+ super( logger, home );
if( null == registry )
{
throw new NullPointerException( "registry" );
}
+
m_home = home;
- m_layout = layout;
m_registry = registry;
- setCacheDirectory( cache, false );
+
+ String key = home.getLayoutModelKey();
+ m_layout = registry.getLayoutModel( key );
m_layout.addDisposalListener( this );
+
+ File cache = home.getCacheDirectory();
+ setCacheDirectory( cache, false );
+
+ HostStorage[] hosts = home.getInitialHosts();
m_sortedHosts = sortHosts();
for( int i=0; i<hosts.length; i++ )
{
- HostModel host = hosts[i];
+ HostStorage host = hosts[i];
addHostModel( host, false );
}
}
@@ -178,12 +181,7 @@
getLogger().debug( "updating cache: " + cache );
}
m_cache = cache;
-
- if( m_home.isMutable() )
- {
- m_home.setCacheDirectory( cache );
- }
-
+ m_home.setCacheDirectory( cache );
if( notify )
{
CacheDirectoryChangeEvent event = new
CacheDirectoryChangeEvent( this, m_cache );
@@ -227,15 +225,25 @@
}
}

- public void addHostModel( String id ) throws DuplicateKeyException,
RemoteException
+ public void addHostModel( String id ) throws DuplicateKeyException,
UnknownKeyException, RemoteException
+ {
+ HostStorage store = m_home.getHostStorage( id );
+ addHostModel( store, true );
+ }
+
+ public void addHostModel( HostStorage store, boolean notify )
+ throws DuplicateKeyException, UnknownKeyException, RemoteException
{
- HostModel manager = m_home.createHostModel( id );
- addHostModel( manager );
+ String id = store.getID();
+ Logger logger = getLogger().getChildLogger( id );
+ LayoutRegistryModel registry = getLayoutRegistryModel();
+ HostModel model = new DefaultHostModel( logger, store, registry );
+ addHostModel( model, notify );
}

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

public void addHostModel( HostModel manager, boolean notify ) throws
DuplicateKeyException, RemoteException

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultCodeBaseModel.java
Wed Jun 22 15:10:15 2005
@@ -28,7 +28,7 @@
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;

-import net.dpml.transit.home.CodeBaseHome;
+import net.dpml.transit.store.CodeBaseStorage;

/**
* An abstract plugin manager is an implementation that monitors
configuration changes
@@ -45,7 +45,7 @@
// state
//
------------------------------------------------------------------------

- private final CodeBaseHome m_home;
+ private final CodeBaseStorage m_home;

private URI m_uri;

@@ -53,12 +53,24 @@
// constructor
//
------------------------------------------------------------------------

- public DefaultCodeBaseModel( Logger logger, CodeBaseHome home, URI uri )
+ public DefaultCodeBaseModel( Logger logger, URI uri )
throws RemoteException
{
super( logger );
m_uri = uri;
+ m_home = null;
+ }
+
+ public DefaultCodeBaseModel( Logger logger, CodeBaseStorage home )
+ throws RemoteException
+ {
+ super( logger );
+ if( null == home )
+ {
+ throw new NullPointerException( "home" );
+ }
m_home = home;
+ m_uri = home.getCodeBaseURI();
}

//
------------------------------------------------------------------------
@@ -83,7 +95,7 @@
synchronized( m_lock )
{
m_uri = uri;
- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setCodeBaseURI( uri );
}
@@ -129,7 +141,7 @@
// internals
//
------------------------------------------------------------------------

- protected CodeBaseHome getCodeBaseHome()
+ protected CodeBaseStorage getCodeBaseStorage()
{
return m_home;
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentModel.java
Wed Jun 22 15:10:15 2005
@@ -25,8 +25,8 @@
import java.util.Date;
import java.util.Properties;

-import net.dpml.transit.home.ContentHome;
-import net.dpml.transit.home.Removable;
+import net.dpml.transit.store.ContentStorage;
+import net.dpml.transit.store.Removable;

/**
* Default implementation of a content manager that maintains an active
@@ -40,7 +40,7 @@
// state
//----------------------------------------------------------------------

- private final ContentHome m_home;
+ private final ContentStorage m_home;
private final String m_type;
private final Properties m_properties;

@@ -51,16 +51,28 @@
//----------------------------------------------------------------------

public DefaultContentModel(
- Logger logger, ContentHome home,
- URI uri, String type, String title, Properties properties ) throws
RemoteException
+ Logger logger, URI uri, String type, String title, Properties
properties ) throws RemoteException
{
- super( logger, home, uri );
+ super( logger, uri );
+
+ m_home = null;
+
m_type = type;
m_title = title;
- m_home = home;
m_properties = properties;
}

+ public DefaultContentModel( Logger logger, ContentStorage home ) throws
RemoteException
+ {
+ super( logger, home );
+
+ m_home = home;
+
+ m_type = home.getType();
+ m_title = home.getTitle();
+ m_properties = home.getProperties();
+ }
+
//----------------------------------------------------------------------
// ContentModel
//----------------------------------------------------------------------
@@ -89,7 +101,7 @@
{
m_title = title;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setTitle( title );
}
@@ -114,7 +126,7 @@
synchronized( m_lock )
{
Object result = m_properties.setProperty( key, value );
- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setProperty( key, value );
}
@@ -128,7 +140,7 @@
synchronized( m_lock )
{
Object result = m_properties.remove( key );
- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.removeProperty( key );
}
@@ -162,7 +174,7 @@
public void dispose() throws RemoteException
{
super.dispose();
- if( m_home.isMutable() && ( m_home instanceof Removable ) )
+ if( null != m_home && ( m_home instanceof Removable ) )
{
Removable store = (Removable) m_home;
store.remove();

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultContentRegistryModel.java
Wed Jun 22 15:10:15 2005
@@ -29,7 +29,8 @@
import java.util.EventObject;
import java.util.EventListener;

-import net.dpml.transit.home.ContentRegistryHome;
+import net.dpml.transit.store.ContentStorage;
+import net.dpml.transit.store.ContentRegistryHome;

/**
* Default implementation of a content handler registry manager that
maitains
@@ -53,15 +54,20 @@
// constructor
//
------------------------------------------------------------------------

- public DefaultContentRegistryModel(
- Logger logger, ContentRegistryHome home, URI uri, ContentModel[]
models )
+ public DefaultContentRegistryModel( Logger logger, ContentRegistryHome
home )
throws DuplicateKeyException, RemoteException
{
- super( logger, home, uri );
+ super( logger, home );
+
m_home = home;
- for( int i=0; i<models.length; i++ )
+
+ ContentStorage[] stores = home.getInitialContentStores();
+ for( int i=0; i<stores.length; i++ )
{
- ContentModel model = models[i];
+ ContentStorage store = stores[i];
+ String id = store.getType();
+ Logger log = logger.getChildLogger( id );
+ ContentModel model = new DefaultContentModel( log, store );
addContentModel( model, false );
}
}
@@ -101,15 +107,19 @@

public void addContentModel( String type ) throws DuplicateKeyException,
RemoteException
{
- ContentModel manager = m_home.createContentModel( type );
- addContentModel( manager );
+ ContentStorage store = m_home.createContentStorage( type );
+ Logger logger = getLogger().getChildLogger( type );
+ DefaultContentModel model = new DefaultContentModel( logger, store );
+ addContentModel( model );
}

public void addContentModel( String type, String title, URI uri )
throws DuplicateKeyException, RemoteException
{
- ContentModel manager = m_home.createContentModel( type, title, uri );
- addContentModel( manager );
+ ContentStorage store = m_home.createContentStorage( type, title, uri
);
+ Logger logger = getLogger().getChildLogger( type );
+ DefaultContentModel model = new DefaultContentModel( logger, store );
+ addContentModel( model );
}

public void addContentModel( ContentModel manager )

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultHostModel.java
Wed Jun 22 15:10:15 2005
@@ -31,8 +31,11 @@
import java.net.UnknownHostException;
import java.net.PasswordAuthentication;

-import net.dpml.transit.home.HostHome;
-import net.dpml.transit.home.Removable;
+import net.dpml.transit.store.HostStorage;
+import net.dpml.transit.store.Removable;
+import net.dpml.transit.store.Strategy;
+import net.dpml.transit.store.PluginStrategy;
+import net.dpml.transit.store.LocalStrategy;

import net.dpml.transit.network.RequestIdentifier;

@@ -48,7 +51,8 @@
public class DefaultHostModel extends DisposableCodeBaseModel
implements HostModel, DisposalListener, Comparable
{
- private final HostHome m_home;
+ private final HostStorage m_home;
+ private final LayoutRegistryModel m_registry;
private final String m_id;

private String m_name;
@@ -69,36 +73,66 @@
//
------------------------------------------------------------------------

public DefaultHostModel(
- Logger logger, HostHome home,
- String id, Strategy strategy, URL base, URL index,
- String name, boolean trusted, boolean enabled, int priority,
LayoutModel layout,
- PasswordAuthentication auth, String scheme, String prompt )
- throws RemoteException
+ Logger logger, LayoutRegistryModel registry, URI uri, String id, URL
base, URL index,
+ String name, boolean trusted, boolean enabled, int priority, String
layout,
+ PasswordAuthentication auth, String scheme, String prompt, boolean
bootstrap )
+ throws RemoteException, UnknownKeyException
{
- super( logger, home, null );
+ super( logger, uri );
+
+ m_home = null;
+ m_registry = registry;

- m_home = home;
m_id = id;
m_name = name;
m_trusted = trusted;
m_enabled = enabled;
m_priority = priority;
- m_layout = layout;
+ m_layout = registry.getLayoutModel( layout );
m_base = base;
m_index = index;
m_authentication = auth;

m_layout.addDisposalListener( this );
m_identifier = getRequestIdentifier( base, scheme, prompt );
- if( strategy instanceof Plugin )
+ m_bootstrap = bootstrap;
+ }
+
+ public DefaultHostModel( Logger logger, HostStorage home,
LayoutRegistryModel registry )
+ throws RemoteException, UnknownKeyException
+ {
+ super( logger, home );
+
+ m_home = home;
+ m_registry = registry;
+
+ m_id = home.getID();
+ m_name = home.getName();
+ m_trusted = home.getTrusted();
+ m_enabled = home.getEnabled();
+ m_priority = home.getPriority();
+ m_base = home.getBaseURL();
+ m_index = home.getIndexURL( m_base );
+ m_authentication = home.getAuthentication();
+
+ String key = home.getLayoutModelKey();
+ m_layout = registry.getLayoutModel( key );
+ m_layout.addDisposalListener( this );
+
+ String scheme = home.getScheme();
+ String prompt = home.getPrompt();
+ m_identifier = getRequestIdentifier( m_base, scheme, prompt );
+
+ Strategy strategy = home.getStrategy();
+ if( strategy instanceof PluginStrategy )
{
- Plugin plugin = (Plugin) strategy;
+ PluginStrategy plugin = (PluginStrategy) strategy;
setCodeBaseURI( plugin.getURI(), false );
m_bootstrap = false;
}
else
{
- Local local = (Local) strategy;
+ LocalStrategy local = (LocalStrategy) strategy;
m_bootstrap = local.isBootstrap();
}
}
@@ -111,7 +145,7 @@
{
super.dispose();
m_layout.removeDisposalListener( this );
- if( m_home.isMutable() && ( m_home instanceof Removable ) )
+ if( ( null != m_home ) && ( m_home instanceof Removable ) )
{
Removable store = (Removable) m_home;
store.remove();
@@ -152,22 +186,23 @@
//----------------------------------------------------------------------

public void update(
- URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
- PasswordAuthentication auth, String scheme, String prompt ) throws
BootstrapException, RemoteException
+ URL base, URL index, boolean enabled, boolean trusted, String layout,
+ PasswordAuthentication auth, String scheme, String prompt )
+ throws BootstrapException, UnknownKeyException, RemoteException
{
synchronized( m_lock )
{
- setLayoutModel( layout );
+ LayoutModel layoutModel = m_registry.getLayoutModel( layout );
+ setLayoutModel( layoutModel );

m_base = base;
m_index = index;
m_enabled = enabled;
m_trusted = trusted;
- m_layout = layout;
m_authentication = auth;
m_identifier = getRequestIdentifier( base, scheme, prompt );

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setHostSettings( base, index, enabled, trusted,
layout, auth, scheme, prompt );
}
@@ -185,7 +220,7 @@
{
m_name = name;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setName( name );
}
@@ -201,7 +236,7 @@
{
m_priority = priority;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setPriority( priority );
}
@@ -225,9 +260,10 @@
layout.addDisposalListener( this );
m_layout = layout;

- if( m_home.isMutable() )
+ if( null != m_home )
{
- m_home.setLayoutModel( layout );
+ String id = layout.getID();
+ m_home.setLayoutModelKey( id );
}

HostLayoutEvent e = new HostLayoutEvent( this, m_layout );

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutModel.java
Wed Jun 22 15:10:15 2005
@@ -24,8 +24,11 @@
import java.util.EventListener;
import java.util.Date;

-import net.dpml.transit.home.LayoutHome;
-import net.dpml.transit.home.Removable;
+import net.dpml.transit.store.LayoutStorage;
+import net.dpml.transit.store.Removable;
+import net.dpml.transit.store.LocalStrategy;
+import net.dpml.transit.store.PluginStrategy;
+import net.dpml.transit.store.Strategy;

/**
* Default implementation of a content manager that maintains an active
@@ -43,7 +46,7 @@
private final String m_id;
private final String m_classname;
private final boolean m_bootstrap;
- private final LayoutHome m_home;
+ private final LayoutStorage m_home;

private String m_title;

@@ -52,26 +55,50 @@
//----------------------------------------------------------------------

public DefaultLayoutModel(
- final Logger logger, final LayoutHome home,
- final String id, Strategy strategy, final String title )
+ final Logger logger, final String id, Strategy strategy, final String
title )
throws RemoteException
{
- super( logger, home, null );
+ super( logger, (URI) null );
+
+ m_home = null;

m_id = id;
m_title = title;
+ if( strategy instanceof PluginStrategy )
+ {
+ PluginStrategy plugin = (PluginStrategy) strategy;
+ setCodeBaseURI( plugin.getURI() );
+ m_classname = null;
+ m_bootstrap = false;
+ }
+ else
+ {
+ LocalStrategy local = (LocalStrategy) strategy;
+ m_classname = local.getClassname();
+ m_bootstrap = local.isBootstrap();
+ }
+ }
+
+ public DefaultLayoutModel( final Logger logger, final LayoutStorage home
)
+ throws RemoteException
+ {
+ super( logger, home );
+
m_home = home;

- if( strategy instanceof Plugin )
+ m_id = home.getID();
+ m_title = home.getTitle();
+ Strategy strategy = home.getStrategy();
+ if( strategy instanceof PluginStrategy )
{
- Plugin plugin = (Plugin) strategy;
+ PluginStrategy plugin = (PluginStrategy) strategy;
setCodeBaseURI( plugin.getURI() );
m_classname = null;
m_bootstrap = false;
}
else
{
- Local local = (Local) strategy;
+ LocalStrategy local = (LocalStrategy) strategy;
m_classname = local.getClassname();
m_bootstrap = local.isBootstrap();
}
@@ -87,7 +114,7 @@
{
m_title = title;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setTitle( title );
}
@@ -164,7 +191,7 @@
public void dispose() throws RemoteException
{
super.dispose();
- if( m_home.isMutable() && ( m_home instanceof Removable ) )
+ if( false == isBootstrap() && ( null != m_home ) && ( m_home
instanceof Removable ) )
{
Removable store = (Removable) m_home;
store.remove();
@@ -172,15 +199,6 @@
}

//
------------------------------------------------------------------------
- // Object
- //
------------------------------------------------------------------------
-
- public String toString()
- {
- return " " + m_title;
- }
-
- //
------------------------------------------------------------------------
// internal
//
------------------------------------------------------------------------


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultLayoutRegistryModel.java
Wed Jun 22 15:10:15 2005
@@ -32,7 +32,8 @@
import java.util.prefs.BackingStoreException;
import java.net.URI;

-import net.dpml.transit.home.LayoutRegistryHome;
+import net.dpml.transit.store.LayoutRegistryHome;
+import net.dpml.transit.store.LayoutStorage;

/**
* Default implementation of a layout subsystem that maitains
@@ -56,17 +57,18 @@
// constructor
//
------------------------------------------------------------------------

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

m_home = home;
- for( int i=0; i<managers.length; i++ )
+
+ LayoutStorage[] stores = home.getInitialLayoutStores();
+ for( int i=0; i<stores.length; i++ )
{
- LayoutModel manager = managers[i];
- addLayoutModel( manager, false );
+ LayoutStorage store = stores[i];
+ addLayoutModel( store, false );
}
}

@@ -94,8 +96,8 @@

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

public void addLayoutModel( LayoutModel manager ) throws
DuplicateKeyException, RemoteException
@@ -103,6 +105,15 @@
addLayoutModel( manager, true );
}

+ private void addLayoutModel( LayoutStorage store, boolean notify )
+ throws DuplicateKeyException, RemoteException
+ {
+ String id = store.getID();
+ Logger logger = getLogger().getChildLogger( id );
+ LayoutModel model = new DefaultLayoutModel( logger, store );
+ addLayoutModel( model, notify );
+ }
+
private void addLayoutModel( LayoutModel manager, boolean notify )
throws DuplicateKeyException, RemoteException
{

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultModel.java
Wed Jun 22 15:10:15 2005
@@ -30,7 +30,6 @@
import java.util.WeakHashMap;

import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.Home;

/**
* A abstract base class that established an event queue and handles event
dispatch
@@ -285,104 +284,6 @@
}
}

- public abstract static class Strategy implements Serializable
- {
- }
-
- public static class Local extends Strategy
- {
- private String m_classname;
- private boolean m_bootstrap;
-
- public Local( String classname, boolean bootstrap )
- {
- m_classname = classname;
- m_bootstrap = bootstrap;
- }
-
- public String getClassname()
- {
- return m_classname;
- }
-
- public boolean isBootstrap()
- {
- return m_bootstrap;
- }
-
- public boolean equals( Object other )
- {
- if( null == other )
- {
- return false;
- }
- else if( other instanceof Local )
- {
- Local local = (Local) other;
- if( false == m_classname.equals( local.getClassname() ) )
- {
- return false;
- }
- else if( isBootstrap() != local.isBootstrap() )
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- else
- {
- return false;
- }
- }
-
- public int hashCode()
- {
- int hash = new Boolean( m_bootstrap ).hashCode();
- hash ^= m_classname.hashCode();
- return hash;
- }
- }
-
- public static class Plugin extends Strategy
- {
- private URI m_uri;
-
- public Plugin( URI uri )
- {
- m_uri = uri;
- }
-
- public URI getURI()
- {
- return m_uri;
- }
-
- public boolean equals( Object other )
- {
- if( null == other )
- {
- return false;
- }
- if( other instanceof Plugin )
- {
- Plugin plugin = (Plugin) other;
- return m_uri.equals( plugin.getURI() );
- }
- else
- {
- return false;
- }
- }
-
- public int hashCode()
- {
- return m_uri.hashCode();
- }
- }
-
static Logger getLoggerForCategory( String name )
{
if( null == name )

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultProxyModel.java
Wed Jun 22 15:10:15 2005
@@ -27,7 +27,7 @@
import java.net.PasswordAuthentication;
import java.net.URL;

-import net.dpml.transit.home.ProxyHome;
+import net.dpml.transit.store.ProxyStorage;

import net.dpml.transit.network.RequestIdentifier;

@@ -44,7 +44,7 @@
// state
//
------------------------------------------------------------------------

- private final ProxyHome m_home;
+ private final ProxyStorage m_home;

private URL m_host;
private PasswordAuthentication m_authentication;
@@ -54,17 +54,27 @@
// constructor
//
------------------------------------------------------------------------

+ public DefaultProxyModel( Logger logger, ProxyStorage home )
+ throws NullPointerException, RemoteException
+ {
+ super( logger );
+
+ m_home = home;
+ m_host = home.getHost();
+ m_authentication = home.getAuthentication();
+ m_excludes = home.getExcludes();
+ }
+
public DefaultProxyModel(
- Logger logger, ProxyHome home,
- URL host, PasswordAuthentication auth, String[] excludes )
+ Logger logger, URL host, PasswordAuthentication auth, String[]
excludes )
throws NullPointerException, RemoteException
{
super( logger );

+ m_home = null;
m_host = host;
m_authentication = auth;
m_excludes = excludes;
- m_home = home;
}

//
------------------------------------------------------------------------
@@ -79,7 +89,7 @@
m_authentication = auth;
m_excludes = excludes;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.saveProxySettings( host, auth, excludes );
}
@@ -97,7 +107,7 @@
{
m_host = host;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setHost( host );
}
@@ -115,7 +125,7 @@
{
m_excludes = excludes;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setExcludes( excludes );
}
@@ -133,7 +143,7 @@
{
m_authentication = auth;

- if( m_home.isMutable() )
+ if( null != m_home )
{
m_home.setAuthentication( auth );
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultRepositoryModel.java
Wed Jun 22 15:10:15 2005
@@ -23,7 +23,7 @@
import java.util.EventObject;
import java.util.Date;

-import net.dpml.transit.home.RepositoryHome;
+import net.dpml.transit.store.CodeBaseStorage;

/**
* Default implementation of a pluggable repository model.
@@ -32,10 +32,10 @@
*/
public class DefaultRepositoryModel extends DisposableCodeBaseModel
implements RepositoryModel
{
- public DefaultRepositoryModel( Logger logger, RepositoryHome home, URI
uri )
+ public DefaultRepositoryModel( Logger logger, CodeBaseStorage home )
throws RemoteException
{
- super( logger, home, uri );
+ super( logger, home );
}
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DefaultTransitModel.java
Wed Jun 22 15:10:15 2005
@@ -22,7 +22,7 @@
import java.util.Date;
import java.util.EventObject;

-import net.dpml.transit.home.TransitHome;
+import net.dpml.transit.store.TransitHome;

/**
* The DefaultTransitManager class maintains an active configuration of the

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/model/DisposableCodeBaseModel.java
Wed Jun 22 15:10:15 2005
@@ -28,7 +28,7 @@
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;

-import net.dpml.transit.home.CodeBaseHome;
+import net.dpml.transit.store.CodeBaseStorage;

/**
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
@@ -39,10 +39,16 @@
// constructor
//
------------------------------------------------------------------------

- public DisposableCodeBaseModel( Logger logger, CodeBaseHome home, URI
uri )
+ public DisposableCodeBaseModel( Logger logger, URI uri )
throws RemoteException
{
- super( logger, home, uri );
+ super( logger, uri );
+ }
+
+ public DisposableCodeBaseModel( Logger logger, CodeBaseStorage home )
+ throws RemoteException
+ {
+ super( logger, home );
}

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

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
Wed Jun 22 15:10:15 2005
@@ -125,8 +125,9 @@
void setLayoutModel( LayoutModel layout ) throws BootstrapException,
RemoteException;

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

/**
* Add a host change listener to the director.

Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheHome.java
(from r2899,
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/store/CacheHome.java
Wed Jun 22 15:10:15 2005
@@ -16,20 +16,18 @@
* limitations under the License.
*/

-package net.dpml.transit.home;
+package net.dpml.transit.store;

import java.io.File;

-import net.dpml.transit.model.HostModel;
-
/**
- * The ProxyManager is an interface implemented by proxy managers.
+ *
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
-public interface CacheHome extends CodeBaseHome
+public interface CacheHome extends CacheStorage
{
- void setCacheDirectory( File cache );
+ HostStorage[] getInitialHosts();

- HostModel createHostModel( String id );
+ HostStorage getHostStorage( String id );
}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/CacheStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,41 @@
+/*
+ * 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.store;
+
+import java.io.File;
+
+/**
+ *
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface CacheStorage extends CodeBaseStorage
+{
+ /**
+ * Return the cache directory.
+ * @return the cache directory
+ */
+ File getCacheDirectory();
+
+ void setCacheDirectory( File cache );
+
+ String getLayoutModelKey();
+
+ void setLayoutModelKey( String key );
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/CodeBaseStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/CodeBaseStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,33 @@
+/*
+ * 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.store;
+
+import java.net.URI;
+
+/**
+ * The ProxyManager is an interface implemented by proxy managers.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface CodeBaseStorage
+{
+ URI getCodeBaseURI();
+
+ void setCodeBaseURI( URI uri );
+}

Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/store/ContentRegistryHome.java
(from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/ContentRegistryHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/ContentRegistryHome.java
Wed Jun 22 15:10:15 2005
@@ -16,23 +16,21 @@
* limitations under the License.
*/

-package net.dpml.transit.home;
-
-import net.dpml.transit.model.ContentModel;
+package net.dpml.transit.store;

import java.net.URI;

/**
- * The ProxyManager is an interface implemented by proxy managers.
+ *
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
-public interface ContentRegistryHome extends CodeBaseHome
+public interface ContentRegistryHome extends CodeBaseStorage
{
- ContentModel[] createContentModels();
+ ContentStorage[] getInitialContentStores();

- ContentModel createContentModel( String type );
+ ContentStorage createContentStorage( String type );

- ContentModel createContentModel( String type, String title, URI uri );
+ ContentStorage createContentStorage( String type, String title, URI uri
);

}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/ContentStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/ContentStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,41 @@
+/*
+ * 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.store;
+
+import java.util.Properties;
+
+/**
+ * The ProxyManager is an interface implemented by proxy managers.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface ContentStorage extends CodeBaseStorage
+{
+ String getType();
+
+ String getTitle();
+
+ Properties getProperties();
+
+ void setTitle( String title );
+
+ void setProperty( String key, String value );
+
+ void removeProperty( String key );
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/HostStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,69 @@
+/*
+ * 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.store;
+
+import java.net.URL;
+import java.net.PasswordAuthentication;
+
+import net.dpml.transit.model.LayoutModel;
+
+/**
+ *
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface HostStorage extends CodeBaseStorage
+{
+ String getID();
+
+ String getName();
+
+ boolean getBootstrap();
+
+ boolean getTrusted();
+
+ boolean getEnabled();
+
+ int getPriority();
+
+ String getLayoutModelKey();
+
+ URL getBaseURL();
+
+ URL getIndexURL( URL base );
+
+ PasswordAuthentication getAuthentication();
+
+ String getScheme();
+
+ String getPrompt();
+
+ Strategy getStrategy();
+
+ void setHostSettings(
+ URL base, URL index, boolean enabled, boolean trusted, String layout,
+ PasswordAuthentication auth, String scheme, String prompt );
+
+ void setName( String name );
+
+ void setPriority( int priority );
+
+ void setLayoutModelKey( String layout );
+
+}

Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutRegistryHome.java
(from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutRegistryHome.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/LayoutRegistryHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutRegistryHome.java
Wed Jun 22 15:10:15 2005
@@ -16,16 +16,16 @@
* limitations under the License.
*/

-package net.dpml.transit.home;
-
-import net.dpml.transit.model.LayoutModel;
+package net.dpml.transit.store;

/**
* The ProxyManager is an interface implemented by proxy managers.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
-public interface LayoutRegistryHome extends CodeBaseHome
+public interface LayoutRegistryHome extends CodeBaseStorage
{
- LayoutModel createLayoutModel( String id );
+ LayoutStorage[] getInitialLayoutStores();
+
+ LayoutStorage getLayoutStorage( String id );
}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/LayoutStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.transit.store;
+
+/**
+ *
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface LayoutStorage extends CodeBaseStorage
+{
+ String getID();
+
+ String getTitle();
+
+ void setTitle( String title );
+
+ Strategy getStrategy();
+
+ void setStrategy( Strategy strategy );
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/LocalStrategy.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/LocalStrategy.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,81 @@
+/*
+ * 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.store;
+
+/**
+ * Interface implemented by removable storage unit.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class LocalStrategy extends Strategy
+{
+ private String m_classname;
+ private boolean m_bootstrap;
+
+ public LocalStrategy( String classname, boolean bootstrap )
+ {
+ m_classname = classname;
+ m_bootstrap = bootstrap;
+ }
+
+ public String getClassname()
+ {
+ return m_classname;
+ }
+
+ public boolean isBootstrap()
+ {
+ return m_bootstrap;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( other instanceof LocalStrategy )
+ {
+ LocalStrategy local = (LocalStrategy) other;
+ if( false == m_classname.equals( local.getClassname() ) )
+ {
+ return false;
+ }
+ else if( isBootstrap() != local.isBootstrap() )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ int hash = new Boolean( m_bootstrap ).hashCode();
+ hash ^= m_classname.hashCode();
+ return hash;
+ }
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/PluginStrategy.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/PluginStrategy.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,63 @@
+/*
+ * 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.store;
+
+import java.net.URI;
+
+/**
+ * Interface implemented by removable storage unit.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class PluginStrategy extends Strategy
+{
+ private URI m_uri;
+
+ public PluginStrategy( URI uri )
+ {
+ m_uri = uri;
+ }
+
+ public URI getURI()
+ {
+ return m_uri;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ if( other instanceof PluginStrategy )
+ {
+ PluginStrategy plugin = (PluginStrategy) other;
+ return m_uri.equals( plugin.getURI() );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public int hashCode()
+ {
+ return m_uri.hashCode();
+ }
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/ProxyStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/ProxyStorage.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,45 @@
+/*
+ * 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.store;
+
+import java.net.PasswordAuthentication;
+import java.net.URL;
+
+/**
+ * Contract implemented by objects that provide persistent storage of
+ * Transit proxy settings.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface ProxyStorage
+{
+ URL getHost();
+
+ PasswordAuthentication getAuthentication();
+
+ String[] getExcludes();
+
+ void setHost( URL host );
+
+ void setExcludes( String[] excludes );
+
+ void setAuthentication( PasswordAuthentication auth );
+
+ void saveProxySettings( URL host, PasswordAuthentication auth, String[]
excludes );
+}

Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/store/Removable.java
(from r2899,
development/main/transit/core/handler/src/main/net/dpml/transit/home/Removable.java)
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/home/Removable.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/Removable.java
Wed Jun 22 15:10:15 2005
@@ -16,10 +16,10 @@
* limitations under the License.
*/

-package net.dpml.transit.home;
+package net.dpml.transit.store;

/**
- * Interface implemented by removable homes.
+ * Interface implemented by removable storage unit.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/StorageRuntimeException.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/StorageRuntimeException.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,49 @@
+/*
+ * 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.store;
+
+/**
+ * Exception related to a storage error.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class StorageRuntimeException extends RuntimeException
+{
+ /**
+ * Construct a new <code>StorageRuntimeException</code> instance.
+ *
+ * @param message the detailed error message
+ */
+ public StorageRuntimeException( String message )
+ {
+ this( message, null );
+ }
+
+ /**
+ * Construct a new <code>StorageRuntimeException</code> instance.
+ *
+ * @param message the detailed error message
+ * @param cause the causal exception
+ */
+ public StorageRuntimeException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+}
+

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/Strategy.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/Strategy.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,30 @@
+/*
+ * 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.store;
+
+import java.io.Serializable;
+
+/**
+ * Interface implemented by removable storage unit.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public abstract class Strategy implements Serializable
+{
+}

Copied:
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
(from r2899,
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/store/TransitHome.java
Wed Jun 22 15:10:15 2005
@@ -16,11 +16,9 @@
* limitations under the License.
*/

-package net.dpml.transit.home;
-
+package net.dpml.transit.store;

import java.net.URL;
-import java.util.prefs.Preferences;

import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
@@ -30,7 +28,7 @@
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
-public interface TransitHome extends Home
+public interface TransitHome
{
/**
* Return the home identifier.

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/AbstractStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -26,12 +26,6 @@
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

-import net.dpml.transit.model.DisposalEvent;
-import net.dpml.transit.model.DisposalListener;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.Model;
-import net.dpml.transit.model.VetoDisposalException;
-
/**
* Abstract base class providing a framework for preferences based
persistance.
*/
@@ -42,71 +36,32 @@
//
------------------------------------------------------------------------

private Preferences m_prefs;
- private boolean m_policy;
- private Logger m_logger;

//
------------------------------------------------------------------------
// constructors
//
------------------------------------------------------------------------

- public AbstractStorageUnit( Preferences prefs, Logger logger, boolean
policy )
+ public AbstractStorageUnit( Preferences prefs )
{
m_prefs = prefs;
- m_policy = policy;
- m_logger = logger;
- }
-
- //
------------------------------------------------------------------------
- // constructor
- //
------------------------------------------------------------------------
-
- public boolean isReadOnly()
- {
- return !m_policy;
- }
-
- public boolean isMutable()
- {
- return m_policy;
- }
-
- public boolean getStoragePolicy()
- {
- return m_policy;
- }
-
- public Preferences getPreferences()
- {
- return m_prefs;
- }
-
- public Logger getLogger()
- {
- return m_logger;
}

//
------------------------------------------------------------------------
// impl
//
------------------------------------------------------------------------

- protected void checkAccess()
+ protected Preferences getPreferences()
{
- if( false == getStoragePolicy() )
- {
- final String error =
- "Store access is denied (readonly): "
- + getPreferences();
- throw new AccessControlException( error );
- }
+ return m_prefs;
}

- public URI getURI( String key ) throws BuilderException
+ protected URI getURI( String key ) throws BuilderException
{
Preferences prefs = getPreferences();
return getURI( prefs, key );
}

- public URI getURI( Preferences prefs, String key ) throws
BuilderException
+ protected URI getURI( Preferences prefs, String key ) throws
BuilderException
{
String path = prefs.get( key, null );
try
@@ -140,9 +95,8 @@
}
}

- public void setURI( String key, URI uri )
+ protected void setURI( String key, URI uri )
{
- checkAccess();
if( null == uri )
{
getPreferences().remove( key );
@@ -154,13 +108,13 @@
}
}

- public URL getURL( String key ) throws BuilderException
+ protected URL getURL( String key ) throws BuilderException
{
Preferences prefs = getPreferences();
return getURL( prefs, key );
}

- public URL getURL( Preferences prefs, String key ) throws
BuilderException
+ protected URL getURL( Preferences prefs, String key ) throws
BuilderException
{
String path = prefs.get( key, null );
try
@@ -194,9 +148,8 @@
}
}

- public void setURL( String key, URL url )
+ protected void setURL( String key, URL url )
{
- checkAccess();
if( null == url )
{
getPreferences().remove( key );
@@ -219,7 +172,6 @@

protected void setValue( String key, String value )
{
- checkAccess();
Preferences prefs = getPreferences();
if( null == value )
{
@@ -230,5 +182,12 @@
prefs.put( key, value );
}
}
+
+ protected String getValue( String key, String value )
+ {
+ Preferences prefs = getPreferences();
+ return prefs.get( 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
Wed Jun 22 15:10:15 2005
@@ -26,18 +26,9 @@
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

-import net.dpml.transit.home.CacheHome;
-import net.dpml.transit.home.Removable;
-import net.dpml.transit.model.DefaultCacheModel;
-import net.dpml.transit.model.DuplicateKeyException;
-import net.dpml.transit.model.CacheModel;
-import net.dpml.transit.model.ContentRegistryModel;
-import net.dpml.transit.model.HostModel;
-import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.LayoutRegistryModel;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.UnknownKeyException;
-
+import net.dpml.transit.store.CacheHome;
+import net.dpml.transit.store.Removable;
+import net.dpml.transit.store.HostStorage;
import net.dpml.transit.util.PropertyResolver;

/**
@@ -50,42 +41,9 @@
// constructor
//
------------------------------------------------------------------------

- private CacheModel m_manager;
- private LayoutRegistryModel m_registry;
-
- //
------------------------------------------------------------------------
- // constructor
- //
------------------------------------------------------------------------
-
- CacheStorageUnit( Preferences prefs, Logger logger, boolean policy )
+ CacheStorageUnit( Preferences prefs )
{
- super( prefs, logger, policy );
-
- m_registry = createLayoutRegistryModel();
-
- String key = prefs.get( "layout", "classic" );
- LayoutModel layout = getLayoutModel( m_registry, key );
- File cache = getCacheDirectory();
- HostModel[] hosts = createHostModels();
-
- URI uri = getURI( "uri" );
- try
- {
- m_manager = new DefaultCacheModel(
- logger, this, uri, cache, hosts, layout, m_registry );
- }
- catch( DuplicateKeyException e )
- {
- final String error =
- "Unable to construct cache management due to conflicting host
identifies.";
- throw new BuilderException( error, e );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unable to construct cache model due to a remote exception.";
- throw new BuilderException( error, e );
- }
+ super( prefs );
}

//
------------------------------------------------------------------------
@@ -114,18 +72,20 @@
}
}

- public HostModel createHostModel( String id ) throws BuilderException
+ public HostStorage getHostStorage( String id ) throws BuilderException
{
- if( null == m_registry )
- {
- throw new IllegalStateException( "registry" );
- }
-
Preferences prefs = getHostsNodePreferences().node( id );
- Logger logger = getLogger().getChildLogger( id );
- boolean policy = getStoragePolicy();
- HostStorageUnit unit = new HostStorageUnit( prefs, logger, policy );
- return unit.createHostModel( m_registry );
+ return new HostStorageUnit( prefs );
+ }
+
+ public String getLayoutModelKey()
+ {
+ return getValue( "layout", "classic" );
+ }
+
+ public void setLayoutModelKey( String key )
+ {
+ setValue( "layout", key );
}

//
------------------------------------------------------------------------
@@ -141,52 +101,7 @@
// impl
//
------------------------------------------------------------------------

- CacheModel getCacheModel()
- {
- return m_manager;
- }
-
- private LayoutRegistryModel createLayoutRegistryModel()
- {
- Preferences prefs = getPreferences().node( "layout" );
- Logger logger = getLogger().getChildLogger( "layout" );
- boolean policy = getStoragePolicy();
-
- try
- {
- LayoutRegistryStorageUnit unit =
- new LayoutRegistryStorageUnit( prefs, logger, policy );
- return unit.getLayoutRegistryModel();
- }
- catch( DuplicateKeyException e )
- {
- final String error =
- "Unable to construct layout registry manager due to a
duplicate layout key.";
- throw new BuilderException( error, e );
- }
- }
-
- private LayoutModel getLayoutModel( LayoutRegistryModel registry, String
key )
- {
- try
- {
- return registry.getLayoutModel( key );
- }
- catch( UnknownKeyException e )
- {
- final String error =
- "Unable to construct cache storage unit due unknown layout
key.";
- throw new BuilderException( error, e );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unable to construct cache storage unit due a remote
exception.";
- throw new BuilderException( error, e );
- }
- }
-
- private HostModel[] createHostModels()
+ public HostStorage[] getInitialHosts()
{
Preferences prefs = getHostsNodePreferences();
try
@@ -196,10 +111,10 @@
for( int i=0; i<names.length; i++ )
{
String name = names[i];
- HostModel host = createHostModel( name );
+ HostStorage host = getHostStorage( name );
list.add( host );
}
- return (HostModel[]) list.toArray( new HostModel[0] );
+ return (HostStorage[]) list.toArray( new HostStorage[0] );
}
catch( Exception e )
{
@@ -214,7 +129,7 @@
* @param prefs the cache preferences
* @return the cache directory
*/
- private File getCacheDirectory()
+ public File getCacheDirectory()
{
Preferences prefs = getPreferences();
String path = prefs.get( "location", "cache" );

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CodeBaseStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -24,22 +24,21 @@
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

-import net.dpml.transit.home.CodeBaseHome;
-import net.dpml.transit.model.Logger;
+import net.dpml.transit.store.CodeBaseStorage;

/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-public abstract class CodeBaseStorageUnit extends AbstractStorageUnit
implements CodeBaseHome
+public abstract class CodeBaseStorageUnit extends AbstractStorageUnit
implements CodeBaseStorage
{
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

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

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

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentRegistryStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -24,15 +24,8 @@
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

-import net.dpml.transit.home.ContentHome;
-import net.dpml.transit.home.ContentRegistryHome;
-import net.dpml.transit.model.DefaultContentRegistryModel;
-import net.dpml.transit.model.ContentRegistryModel;
-import net.dpml.transit.model.ContentModel;
-import net.dpml.transit.model.DuplicateKeyException;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.repository.Repository;
-import net.dpml.transit.repository.Plugin;
+import net.dpml.transit.store.ContentRegistryHome;
+import net.dpml.transit.store.ContentStorage;

/**
* The LayoutRegistryHelper class provides support for the crreating of a
@@ -44,34 +37,32 @@
// constructor
//
------------------------------------------------------------------------

- ContentRegistryStorageUnit( Preferences prefs, Logger logger, boolean
policy )
+ ContentRegistryStorageUnit( Preferences prefs )
{
- super( prefs, logger, policy );
+ super( prefs );
}

//
------------------------------------------------------------------------
// ContentRegistryHome
//
------------------------------------------------------------------------

- public ContentModel createContentModel( String id, String title, URI uri
)
+ public ContentStorage createContentStorage( String id, String title, URI
uri )
{
Preferences prefs = getPreferences();
Preferences p = prefs.node( id );
p.put( "title", title );
p.put( "uri", uri.toASCIIString() );
- return createContentModel( id );
+ return createContentStorage( id );
}

- public ContentModel createContentModel( String id ) throws
BuilderException
+ public ContentStorage createContentStorage( String id ) throws
BuilderException
{
Preferences prefs = getPreferences();
Preferences p = prefs.node( id );
- Logger logger = getLogger().getChildLogger( id );
- boolean policy = getStoragePolicy();
- return createContentModel( p, logger, policy );
+ return new ContentStorageUnit( p );
}

- public ContentModel[] createContentModels()
+ public ContentStorage[] getInitialContentStores()
{
Preferences prefs = getPreferences();
try
@@ -81,10 +72,10 @@
for( int i=0; i<names.length; i++ )
{
String name = names[i];
- ContentModel manager = createContentModel( name );
+ ContentStorage manager = createContentStorage( name );
list.add( manager );
}
- return (ContentModel[]) list.toArray( new ContentModel[0] );
+ return (ContentStorage[]) list.toArray( new ContentStorage[0] );
}
catch( Exception e )
{
@@ -93,36 +84,4 @@
throw new BuilderException( error, e );
}
}
-
- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
- ContentRegistryModel createContentRegistryModel()
- {
- Preferences prefs = getPreferences();
- Logger logger = getLogger();
- boolean policy = getStoragePolicy();
-
- try
- {
- URI uri = getCodeBaseURI();
- ContentModel[] models = createContentModels();
- return new DefaultContentRegistryModel( logger, this, uri,
models );
- }
- catch( Exception e )
- {
- final String error =
- "Unexpected error while constructing content registry
manager.";
- throw new BuilderException( error, e );
- }
- }
-
- private ContentModel createContentModel(
- Preferences prefs, Logger logger, boolean policy )
- throws BuilderException
- {
- ContentStorageUnit store = new ContentStorageUnit( prefs, logger,
policy );
- return store.createContentModel();
- }
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ContentStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -24,40 +24,28 @@
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

-import net.dpml.transit.home.ContentHome;
-import net.dpml.transit.home.Removable;
-import net.dpml.transit.model.DefaultContentModel;
-import net.dpml.transit.model.ContentModel;
-import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.Logger;
+import net.dpml.transit.store.ContentStorage;
+import net.dpml.transit.store.Removable;

/**
* The ContentSorageUnit class is responsible for the setup of initial
factory
* default preference settings.
*/
-public class ContentStorageUnit extends CodeBaseStorageUnit implements
ContentHome, Removable
+public class ContentStorageUnit extends CodeBaseStorageUnit implements
ContentStorage, Removable
{
- private ContentModel m_model;
-
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

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

//
------------------------------------------------------------------------
- // ContentHome
+ // ContentStorage
//
------------------------------------------------------------------------

- public ContentModel getContentModel()
- {
- return m_model;
- }
-
public void setTitle( String title )
{
Preferences prefs = getPreferences();
@@ -76,62 +64,42 @@
removeProperty( prefs, key );
}

- protected Properties getProperties()
+ public Properties getProperties()
{
Preferences prefs = getPreferences().node( "properties" );
return getProperties( prefs );
}

- //
------------------------------------------------------------------------
- // Removable
- //
------------------------------------------------------------------------
+ public String getType()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.name();
+ }

- public void remove()
+ public String getTitle()
{
- try
- {
- getPreferences().removeNode();
- }
- catch( BackingStoreException e )
- {
- getLogger().error( "storage removal failure", e );
- }
+ Preferences prefs = getPreferences();
+ return prefs.get( "title", prefs.name() );
}

+
//
------------------------------------------------------------------------
- // impl
+ // Removable
//
------------------------------------------------------------------------

- protected ContentModel createContentModel()
+ public void remove()
{
- Preferences prefs = getPreferences();
- Logger logger = getLogger();
- URI uri = getCodeBaseURI();
- String type = getType();
- String title = getTitle();
- Properties properties = getProperties();
try
{
- return new DefaultContentModel( logger, this, uri, type, title,
properties );
+ getPreferences().removeNode();
}
- catch( RemoteException e )
+ catch( BackingStoreException e )
{
final String error =
- "Unable to construct content model due to a remote exception.";
+ "Stroage removal failure.";
throw new BuilderException( error, e );
}
}

- protected String getType()
- {
- Preferences prefs = getPreferences();
- return prefs.name();
- }
-
- protected String getTitle()
- {
- Preferences prefs = getPreferences();
- return prefs.get( "title", prefs.name() );
- }
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/HostStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -25,26 +25,18 @@
import java.util.prefs.BackingStoreException;
import java.net.PasswordAuthentication;

-import net.dpml.transit.home.HostHome;
-import net.dpml.transit.home.Removable;
-import net.dpml.transit.model.DefaultModel.Local;
-import net.dpml.transit.model.DefaultModel.Plugin;
-import net.dpml.transit.model.DefaultHostModel;
-import net.dpml.transit.model.DisposalEvent;
-import net.dpml.transit.model.DisposalListener;
-import net.dpml.transit.model.HostModel;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.LayoutRegistryModel;
-import net.dpml.transit.model.Model;
-import net.dpml.transit.model.UnknownKeyException;
import net.dpml.transit.runtime.DefaultResourceHost;
+import net.dpml.transit.store.HostStorage;
+import net.dpml.transit.store.Removable;
+import net.dpml.transit.store.Strategy;
+import net.dpml.transit.store.PluginStrategy;
+import net.dpml.transit.store.LocalStrategy;

/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class HostStorageUnit extends CodeBaseStorageUnit implements HostHome,
Removable
+class HostStorageUnit extends CodeBaseStorageUnit implements HostStorage,
Removable
{
//
------------------------------------------------------------------------
// state
@@ -52,23 +44,21 @@

private static final String DEFAULT_HOST_CLASSNAME =
DefaultResourceHost.class.getName();

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

- HostStorageUnit(
- Preferences prefs, Logger logger, boolean policy )
+ HostStorageUnit( Preferences prefs )
{
- super( prefs, logger, policy );
+ super( prefs );
}

//
------------------------------------------------------------------------
- // HostHome
+ // HostStorage
//
------------------------------------------------------------------------

public void setHostSettings(
- URL base, URL index, boolean enabled, boolean trusted, LayoutModel
layout,
+ URL base, URL index, boolean enabled, boolean trusted, String layout,
PasswordAuthentication auth, String scheme, String prompt )
{
Preferences prefs = getPreferences();
@@ -78,141 +68,82 @@
setURL( "index", index );
setTrusted( trusted );
setEnabled( enabled );
- setLayoutModel( layout );
+ setLayoutModelKey( layout );
setAuthentication( auth );
setValue( "scheme", scheme );
setValue( "prompt", prompt );
}
}

- public void setName( String name )
+
+ public String getID()
{
- setValue( "name", name );
+ Preferences prefs = getPreferences();
+ return prefs.name();
}

- public void setPriority( int priority )
+ public String getName()
{
- Preferences prefs = getPreferences();
- synchronized( prefs )
- {
- prefs.putInt( "priority", priority );
- }
+ String id = getID();
+ return getValue( "name", id );
}

- public void setLayoutModel( LayoutModel layout )
+ public String getScheme()
{
- if( null == layout )
- {
- setValue( "layout", null );
- }
- else
- {
- try
- {
- String id = layout.getID();
- setValue( "layout", id );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unexpected remote exception when requesting the host
layout identifier.";
- throw new BuilderException( error, e );
- }
- }
+ return getValue( "scheme", "" );
}

- //
------------------------------------------------------------------------
- // Removable
- //
------------------------------------------------------------------------
+ public String getPrompt()
+ {
+ return getValue( "prompt", "" );
+ }

- public void remove()
+ public boolean getBootstrap()
{
- try
- {
- getPreferences().removeNode();
- }
- catch( BackingStoreException e )
- {
- getLogger().error( "storage removal failure", e );
- }
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "bootstrap", false );
}

- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
+ public boolean getTrusted()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "trusted", false );
+ }

- HostModel createHostModel( LayoutRegistryModel registry )
+ public boolean getEnabled()
{
- try
- {
- return createHostModelInstance( registry );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unable to construct host model due to a remote exception.";
- throw new BuilderException( error, e );
- }
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "enabled", false );
}

- private HostModel createHostModelInstance( LayoutRegistryModel registry
) throws RemoteException
+ public int getPriority()
{
Preferences prefs = getPreferences();
- Logger logger = getLogger();
- String id = prefs.name();
- String name = prefs.get( "name", id );
-
- boolean bootstrap = prefs.getBoolean( "bootstrap", false );
- boolean trusted = prefs.getBoolean( "trusted", false );
- boolean enabled = prefs.getBoolean( "enabled", false );
- int priority = prefs.getInt( "priority", 600 );
- String layoutKey = prefs.get( "layout", "classic" );
- LayoutModel layout = getlayoutModel( registry, layoutKey );
- PasswordAuthentication auth = getAuthentication();
- URL base = getBase();
- URL index = getIndex( base );
- String scheme = prefs.get( "scheme", "" );
- String prompt = prefs.get( "prompt", "" );
- if( bootstrap )
- {
- return new DefaultHostModel(
- logger, this, id,
- new Local( DEFAULT_HOST_CLASSNAME, bootstrap ),
- base, index, name, trusted, enabled, priority,
- layout, auth, scheme, prompt );
- }
- else
- {
- URI uri = getCodeBaseURI();
- return new DefaultHostModel(
- logger, this, id,
- new Plugin( uri ), base, index, name, trusted,
- enabled, priority, layout, auth, scheme, prompt );
- }
+ return prefs.getInt( "priority", 600 );
}

- private LayoutModel getlayoutModel( LayoutRegistryModel registry, String
key )
+ public String getLayoutModelKey()
{
- try
- {
- return registry.getLayoutModel( key );
- }
- catch( UnknownKeyException e )
+ Preferences prefs = getPreferences();
+ return getValue( "layout", "classic" );
+ }
+
+ public Strategy getStrategy()
+ {
+ URI uri = getCodeBaseURI();
+ if( null != uri )
{
- final String error =
- "Unable to construct host storage unit due unknown host layout
key.";
- throw new BuilderException( error, e );
+ return new PluginStrategy( uri );
}
- catch( RemoteException e )
+ else
{
- final String error =
- "Unable to construct host storage unit due to a remote
exception.";
- throw new BuilderException( error, e );
+ Preferences prefs = getPreferences();
+ String classname = prefs.get( "classname",
DEFAULT_HOST_CLASSNAME );
+ return new LocalStrategy( classname, false );
}
}

- private URL getBase( )
- throws BuilderException
+ public URL getBaseURL() throws BuilderException
{
Preferences prefs = getPreferences();
String baseSpec = prefs.get( "base", "http://localhost"; );
@@ -241,7 +172,7 @@
}
}

- private PasswordAuthentication getAuthentication()
+ public PasswordAuthentication getAuthentication()
throws BuilderException
{
Preferences prefs = getPreferences();
@@ -256,7 +187,7 @@
}
}

- private URL getIndex( URL base ) throws BuilderException
+ public URL getIndexURL( URL base ) throws BuilderException
{
Preferences prefs = getPreferences();
if( null == base )
@@ -295,6 +226,32 @@
prefs.putBoolean( "enabled", enabled );
}

+ public void setName( String name )
+ {
+ setValue( "name", name );
+ }
+
+ public void setPriority( int priority )
+ {
+ Preferences prefs = getPreferences();
+ synchronized( prefs )
+ {
+ prefs.putInt( "priority", priority );
+ }
+ }
+
+ public void setLayoutModelKey( String layout )
+ {
+ if( null == layout )
+ {
+ setValue( "layout", null );
+ }
+ else
+ {
+ setValue( "layout", layout );
+ }
+ }
+
/**
* Set the host authentication.
* @param auth the password authentication to use for host sign-on
@@ -313,5 +270,21 @@
prefs.putByteArray( "authentication", bytes );
}
}
+
+ //
------------------------------------------------------------------------
+ // Removable
+ //
------------------------------------------------------------------------
+
+ public void remove()
+ {
+ try
+ {
+ getPreferences().removeNode();
+ }
+ catch( BackingStoreException e )
+ {
+ throw new BuilderException( "storage removal failure", e );
+ }
+ }
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutRegistryStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -25,13 +25,8 @@
import java.util.prefs.BackingStoreException;
import java.util.Date;

-import net.dpml.transit.home.LayoutHome;
-import net.dpml.transit.home.LayoutRegistryHome;
-import net.dpml.transit.model.DefaultLayoutRegistryModel;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.LayoutRegistryModel;
-import net.dpml.transit.model.DuplicateKeyException;
+import net.dpml.transit.store.LayoutRegistryHome;
+import net.dpml.transit.store.LayoutStorage;

/**
* The LayoutHelper class is responsible for the setup of initial factory
@@ -40,59 +35,19 @@
class LayoutRegistryStorageUnit extends CodeBaseStorageUnit implements
LayoutRegistryHome
{
//
------------------------------------------------------------------------
- // state
- //
------------------------------------------------------------------------
-
- private final LayoutRegistryModel m_manager;
-
- //
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

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

//
------------------------------------------------------------------------
// LayoutRegistryHome
//
------------------------------------------------------------------------

- public LayoutModel createLayoutModel( String id ) throws BuilderException
- {
- Preferences prefs = getPreferences();
- Preferences p = prefs.node( id );
- Logger logger = getLogger().getChildLogger( id );
- boolean policy = getStoragePolicy();
- LayoutStorageUnit unit = new LayoutStorageUnit( p, logger, policy );
- return unit.createLayoutModel();
- }
-
- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
- LayoutRegistryModel getLayoutRegistryModel()
- {
- return m_manager;
- }
-
- private LayoutModel[] createLayoutModels()
+ public LayoutStorage[] getInitialLayoutStores()
{
Preferences prefs = getPreferences();
try
@@ -102,10 +57,10 @@
for( int i=0; i<names.length; i++ )
{
String name = names[i];
- LayoutModel layout = createLayoutModel( name );
+ LayoutStorage layout = getLayoutStorage( name );
list.add( layout );
}
- return (LayoutModel[]) list.toArray( new LayoutModel[0] );
+ return (LayoutStorage[]) list.toArray( new LayoutStorage[0] );
}
catch( Exception e )
{
@@ -114,4 +69,10 @@
throw new BuilderException( error, e );
}
}
+
+ public LayoutStorage getLayoutStorage( String id ) throws
BuilderException
+ {
+ Preferences prefs = getPreferences().node( id );
+ return new LayoutStorageUnit( prefs );
+ }
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LayoutStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -23,124 +23,94 @@
import java.util.prefs.Preferences;
import java.util.prefs.BackingStoreException;

-import net.dpml.transit.home.LayoutHome;
-import net.dpml.transit.home.Removable;
-import net.dpml.transit.model.DefaultModel.Plugin;
-import net.dpml.transit.model.DefaultModel.Local;
-import net.dpml.transit.model.DefaultLayoutModel;
-import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.DisposalEvent;
-import net.dpml.transit.model.DisposalListener;
-import net.dpml.transit.model.LayoutModel;
-import net.dpml.transit.model.Logger;
import net.dpml.transit.runtime.ClassicLayout;
import net.dpml.transit.runtime.EclipseLayout;
+import net.dpml.transit.store.Strategy;
+import net.dpml.transit.store.LocalStrategy;
+import net.dpml.transit.store.PluginStrategy;
+import net.dpml.transit.store.LayoutStorage;
+import net.dpml.transit.store.Removable;

/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class LayoutStorageUnit extends CodeBaseStorageUnit implements LayoutHome,
Removable
+class LayoutStorageUnit extends CodeBaseStorageUnit implements
LayoutStorage, Removable
{
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

- LayoutStorageUnit( Preferences prefs, Logger logger, boolean policy )
+ LayoutStorageUnit( Preferences prefs )
{
- super( prefs, logger, policy );
+ super( prefs );
}

//
------------------------------------------------------------------------
- // LayoutHome
+ // LayoutStorage
//
------------------------------------------------------------------------

- public void setTitle( String title )
+ public String getID()
{
Preferences prefs = getPreferences();
- setValue( "title", title );
+ return prefs.name();
}

- public void setClassname( String classname )
+ public String getTitle()
{
- setValue( "classname", classname );
+ Preferences prefs = getPreferences();
+ String id = getID();
+ return prefs.get( "title", id );
}

- //
------------------------------------------------------------------------
- // Removable
- //
------------------------------------------------------------------------
+ public void setTitle( String title )
+ {
+ setValue( "title", title );
+ }

- public void remove()
+ public Strategy getStrategy()
{
- try
+ URI uri = getCodeBaseURI();
+ if( null != uri )
{
- getPreferences().removeNode();
+ return new PluginStrategy( uri );
}
- catch( BackingStoreException e )
+ else
{
- getLogger().error( "storage removal failure", e );
+ Preferences prefs = getPreferences();
+ String classname = prefs.get( "classname",
ClassicLayout.class.getName() );
+ return new LocalStrategy( classname, false );
}
}

- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
- LayoutModel createLayoutModel()
- throws BuilderException
+ public void setStrategy( Strategy strategy )
{
- try
+ if( strategy instanceof PluginStrategy )
{
- return createLayoutModelInstance();
+ PluginStrategy plugin = (PluginStrategy) strategy;
+ setCodeBaseURI( plugin.getURI() );
}
- catch( RemoteException e )
+ else
{
- final String error =
- "Unable to construct layout model due to a remote exception.";
- throw new BuilderException( error, e );
+ LocalStrategy local = (LocalStrategy) strategy;
+ String classname = local.getClassname();
+ setValue( "classname", classname );
}
}

- private LayoutModel createLayoutModelInstance()
- throws BuilderException, RemoteException
+ //
------------------------------------------------------------------------
+ // Removable
+ //
------------------------------------------------------------------------
+
+ public void remove()
{
- Preferences prefs = getPreferences();
- Logger logger = getLogger();
- URI uri = getCodeBaseURI();
- String id = prefs.name();
- String title = prefs.get( "title", id );
- if( null != uri )
+ try
{
- Plugin plugin = new Plugin( uri );
- return new DefaultLayoutModel( logger, this, id, plugin, title );
+ getPreferences().removeNode();
}
- else
+ catch( BackingStoreException e )
{
- String classname = prefs.get( "classname", null );
- if( null != classname )
- {
- // just temporarily
- if( "net.dpml.transit.layout.ClassicLayout".equals(
classname ) )
- {
- prefs.put( "classname", ClassicLayout.class.getName() );
- classname = ClassicLayout.class.getName();
- }
- // just temporarily
- else if( "net.dpml.transit.layout.EclipseLayout".equals(
classname ) )
- {
- prefs.put( "classname", EclipseLayout.class.getName() );
- classname = ClassicLayout.class.getName();
- }
-
- Local local = new Local( classname, false );
- return new DefaultLayoutModel( logger, this, id, local,
title );
- }
- else
- {
- classname = ClassicLayout.class.getName();
- Local local = new Local( classname, false );
- return new DefaultLayoutModel( logger, this, id, local,
title );
- }
+ throw new BuilderException( "storage removal failure", e );
}
}
}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/ProxyStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -24,33 +24,29 @@
import java.util.prefs.BackingStoreException;
import java.util.Date;

-import net.dpml.transit.home.ProxyHome;
-import net.dpml.transit.model.DefaultProxyModel;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.ProxyModel;
+import net.dpml.transit.store.ProxyStorage;

/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class ProxyStorageUnit extends AbstractStorageUnit implements ProxyHome
+class ProxyStorageUnit extends AbstractStorageUnit implements ProxyStorage
{
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

- ProxyStorageUnit( Preferences prefs, Logger logger, boolean policy )
+ ProxyStorageUnit( Preferences prefs )
{
- super( prefs, logger, policy );
+ super( prefs );
}

//
------------------------------------------------------------------------
- // ProxyHome
+ // ProxyStorage
//
------------------------------------------------------------------------

public void setHost( URL host )
{
- checkAccess();
Preferences prefs = getPreferences();
synchronized( prefs )
{
@@ -100,33 +96,12 @@
}
}

- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
- ProxyModel createProxyModel()
- throws BuilderException
+ public URL getHost()
{
- Preferences prefs = getPreferences();
- Logger logger = getLogger();
- URL host = getURL( "host" );
- String[] excludes = getExcludes();
- PasswordAuthentication auth = getAuthentication();
-
- try
- {
- return new DefaultProxyModel( logger, this, host, auth,
excludes );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unable to construct proxy model due to a remote exception.";
- throw new BuilderException( error, e );
- }
+ return getURL( "host" );
}

-
- private PasswordAuthentication getAuthentication()
+ public PasswordAuthentication getAuthentication()
throws BuilderException
{
Preferences prefs = getPreferences();
@@ -141,7 +116,7 @@
}
}

- private String[] getExcludes() throws BuilderException
+ public String[] getExcludes() throws BuilderException
{
try
{

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/RepositoryStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -24,48 +24,21 @@
import java.util.prefs.BackingStoreException;
import java.util.Date;

-import net.dpml.transit.home.Removable;
-import net.dpml.transit.home.RepositoryHome;
-import net.dpml.transit.model.RepositoryModel;
-import net.dpml.transit.model.DefaultRepositoryModel;
-import net.dpml.transit.model.Logger;
+import net.dpml.transit.store.CodeBaseStorage;

/**
* The LayoutHelper class is responsible for the setup of initial factory
* default preference settings.
*/
-class RepositoryStorageUnit extends CodeBaseStorageUnit implements
RepositoryHome
+class RepositoryStorageUnit extends CodeBaseStorageUnit implements
CodeBaseStorage
{
//
------------------------------------------------------------------------
// constructor
//
------------------------------------------------------------------------

- RepositoryStorageUnit( Preferences prefs, Logger logger, boolean policy )
+ RepositoryStorageUnit( Preferences prefs )
{
- super( prefs, logger, policy );
- }
-
- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
- RepositoryModel createRepositoryModel()
- throws BuilderException
- {
- Preferences prefs = getPreferences();
- Logger logger = getLogger();
- URI uri = getCodeBaseURI();
-
- try
- {
- return new DefaultRepositoryModel( logger, this, uri );
- }
- catch( RemoteException e )
- {
- final String error =
- "Unable to construct repository model due to a remote
exception.";
- throw new BuilderException( error, e );
- }
+ super( prefs );
}
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
Wed Jun 22 15:10:15 2005
@@ -29,11 +29,13 @@
import net.dpml.transit.model.Logger;

import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.model.Connection;
import net.dpml.transit.model.DefaultTransitModel;
-import net.dpml.transit.model.DisposalListener;
-import net.dpml.transit.model.DisposalEvent;
+import net.dpml.transit.model.DefaultProxyModel;
+import net.dpml.transit.model.DefaultCacheModel;
+import net.dpml.transit.model.DefaultContentRegistryModel;
+import net.dpml.transit.model.DefaultLayoutRegistryModel;
+import net.dpml.transit.model.DefaultRepositoryModel;
import net.dpml.transit.model.CacheModel;
import net.dpml.transit.model.ContentRegistryModel;
import net.dpml.transit.model.LayoutRegistryModel;
@@ -41,6 +43,7 @@
import net.dpml.transit.model.RepositoryModel;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.model.VetoDisposalException;
+import net.dpml.transit.store.TransitHome;

/**
*
@@ -51,7 +54,8 @@
// static
//
------------------------------------------------------------------------

- private static final Logger DEFAULT_LOGGER = new LoggingAdapter();
+ private static Logger DEFAULT_LOGGER;
+
private static final Preferences ROOT_PREFS =
Preferences.userNodeForPackage( Transit.class ).node( "profiles" );
private static final String DEFAULT_PROFILE_NAME = "default";
@@ -206,15 +210,10 @@
// cache system setup)
//

- ProxyStorageUnit proxyUnit = createProxyUnit();
- CacheStorageUnit cacheUnit = createCacheUnit();
- ContentRegistryStorageUnit contentUnit = createContentRegistryUnit();
- RepositoryStorageUnit repositoryUnit = createRepositoryUnit();
-
- ProxyModel proxy = proxyUnit.createProxyModel();
- RepositoryModel repository = repositoryUnit.createRepositoryModel();
- CacheModel cache = cacheUnit.getCacheModel();
- ContentRegistryModel content =
contentUnit.createContentRegistryModel();
+ ProxyModel proxy = createProxyModel();
+ CacheModel cache = createCacheModel();
+ ContentRegistryModel content = createContentRegistryModel();
+ RepositoryModel repository = createRepositoryModel();

//
// put the model together
@@ -233,14 +232,14 @@
}
}

- private ProxyStorageUnit createProxyUnit() throws BuilderException
+ private ProxyModel createProxyModel() throws BuilderException
{
try
{
- boolean policy = getStoragePolicy();
- Logger logger = getLogger().getChildLogger( "proxy" );
Preferences prefs = getPreferences().node( "proxy" );
- return new ProxyStorageUnit( prefs, logger, policy );
+ ProxyStorageUnit unit = new ProxyStorageUnit( prefs );
+ Logger logger = getLogger().getChildLogger( "proxy" );
+ return new DefaultProxyModel( logger, unit );
}
catch( Throwable e )
{
@@ -250,53 +249,73 @@
}
}

- private RepositoryStorageUnit createRepositoryUnit() throws
BuilderException
+ private CacheModel createCacheModel() throws BuilderException
{
try
{
- boolean policy = getStoragePolicy();
- Logger logger = getLogger().getChildLogger( "repository" );
- Preferences prefs = getPreferences().node( "repository" );
- return new RepositoryStorageUnit( prefs, logger, policy );
+ Preferences prefs = getPreferences().node( "cache" );
+ CacheStorageUnit store = new CacheStorageUnit( prefs );
+ LayoutRegistryModel layouts = createLayoutRegistryModel();
+ Logger logger = getLogger().getChildLogger( "cache" );
+ return new DefaultCacheModel( logger, store, layouts );
}
catch( Throwable e )
{
final String error =
- "An error occured during construction of the repository
storage unit.";
+ "An error occured during construction of the cache storage
unit.";
throw new BuilderException( error, e );
}
}

- private CacheStorageUnit createCacheUnit() throws BuilderException
+ private LayoutRegistryModel createLayoutRegistryModel()
+ throws BuilderException
{
+ Logger logger = getLogger().getChildLogger( "cache"
).getChildLogger( "layout" );
+ Preferences prefs = getPreferences().node( "cache" ).node( "layout"
);
try
{
- boolean policy = getStoragePolicy();
- Logger logger = getLogger().getChildLogger( "cache" );
- Preferences prefs = getPreferences().node( "cache" );
- return new CacheStorageUnit( prefs, logger, policy );
+ LayoutRegistryStorageUnit store = new LayoutRegistryStorageUnit(
prefs );
+ return new DefaultLayoutRegistryModel( logger, store );
}
catch( Throwable e )
{
final String error =
- "An error occured during construction of the cache storage
unit.";
+ "An error occured during construction of the layout storage
home.";
throw new BuilderException( error, e );
}
- }
+ }

- private ContentRegistryStorageUnit createContentRegistryUnit() throws
BuilderException
+ private ContentRegistryModel createContentRegistryModel() throws
BuilderException
{
try
{
- boolean policy = getStoragePolicy();
- Logger logger = getLogger().getChildLogger( "content" );
Preferences prefs = getPreferences().node( "content" );
- return new ContentRegistryStorageUnit( prefs, logger, policy );
+ ContentRegistryStorageUnit store = new
ContentRegistryStorageUnit( prefs );
+ Logger logger = getLogger().getChildLogger( "content" );
+ return new DefaultContentRegistryModel( logger, store );
}
catch( Throwable e )
{
final String error =
- "An error occured during construction of the content registry
storage unit.";
+ "An error occured during construction of the content registry
model.";
+ throw new BuilderException( error, e );
+ }
+ }
+
+
+ private RepositoryModel createRepositoryModel() throws BuilderException
+ {
+ try
+ {
+ Preferences prefs = getPreferences().node( "repository" );
+ RepositoryStorageUnit store = new RepositoryStorageUnit( prefs );
+ Logger logger = getLogger().getChildLogger( "repository" );
+ return new DefaultRepositoryModel( logger, store );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "An error occured during construction of the repository
model.";
throw new BuilderException( error, e );
}
}
@@ -323,11 +342,20 @@
{
if( null == m_logger )
{
- return DEFAULT_LOGGER;
+ return getDefaultLogger();
}
return m_logger;
}

+ private static Logger getDefaultLogger()
+ {
+ if( null == DEFAULT_LOGGER )
+ {
+ DEFAULT_LOGGER = new LoggingAdapter();
+ }
+ return DEFAULT_LOGGER;
+ }
+
private URL getAuthority()
{
return m_authority;

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/util/ConfigurationHandler.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/util/ConfigurationHandler.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,85 @@
+/*
+ * 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.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Properties;
+import java.util.logging.LogManager;
+
+/**
+ * Utility class used to establish the logging configuration. The contents
of
+ * this class are subject to radical change but that's largely academic
because
+ * this class does not expose any operations.
+ */
+public class ConfigurationHandler
+{
+ /**
+ * Creation of the logging controller.
+ */
+ public ConfigurationHandler()
+ {
+ String group = System.getProperty( "dpml.logging.category", "root" );
+ String level = System.getProperty( "dpml.logging.level", "INFO"
).toUpperCase();
+
+ Properties properties = new Properties();
+ properties.setProperty(
+ "handlers",
+ "java.util.logging.FileHandler, java.util.logging.ConsoleHandler"
);
+ properties.setProperty(
+ "java.util.logging.ConsoleHandler.formatter",
+ "net.dpml.depot.logging.StandardFormatter" );
+
+ //
+ // set the file handler properties
+ //
+
+ properties.setProperty( "java.util.logging.FileHandler.pattern",
"%h/" + group + "%u.log" );
+ properties.setProperty( "java.util.logging.FileHandler.limit",
"50000" );
+ properties.setProperty( "java.util.logging.FileHandler.count", "1" );
+ properties.setProperty(
+ "java.util.logging.FileHandler.formatter",
"net.dpml.transit.util.StandardFormatter" );
+
+ //
+ // set the default level by setting the root logger level
+ //
+
+ properties.setProperty( ".level", level );
+
+ //
+ // set the level that the console handler will handle
+ //
+
+ properties.setProperty( "java.util.logging.ConsoleHandler.level",
"FINEST" );
+
+ try
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ properties.store( out, "DPML Logging properties" );
+ byte[] bytes = out.toByteArray();
+ ByteArrayInputStream input = new ByteArrayInputStream( bytes );
+ LogManager manager = LogManager.getLogManager();
+ manager.readConfiguration( input );
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ }
+ }
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/util/StandardFormatter.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/util/StandardFormatter.java
Wed Jun 22 15:10:15 2005
@@ -0,0 +1,74 @@
+/*
+ * 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.util;
+
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+import net.dpml.transit.util.ExceptionHelper;
+
+/**
+ * Logging message formatter that includes the category in the logging
statement.
+ */
+public class StandardFormatter extends Formatter
+{
+ private String lineSeparator = System.getProperty( "line.separator");
+
+ /**
+ * Format a LogRecord using the classic style.
+ * @param record the log record to be formatted.
+ * @return a formatted log record
+ */
+ public synchronized String format( LogRecord record )
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ String header = getLogHeader( record );
+ buffer.append( header );
+ if( null != record.getLoggerName() )
+ {
+ buffer.append( "(" + record.getLoggerName() + "): " );
+ }
+ else
+ {
+ buffer.append( "() " );
+ }
+ String message = formatMessage( record );
+ buffer.append( message );
+ buffer.append( lineSeparator );
+ if( record.getThrown() != null )
+ {
+ boolean trace = record.getLevel().intValue() > 900;
+ Throwable cause = record.getThrown();
+ String error = ExceptionHelper.packException( cause, trace );
+ buffer.append( error );
+ }
+ return buffer.toString();
+ }
+
+ private String getLogHeader( LogRecord record )
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "[" );
+ buffer.append( record.getLevel().getLocalizedName() );
+ buffer.append( " " );
+ String tag = buffer.toString();
+ return tag.substring( 0, 8 ) + "] ";
+ }
+}

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
Wed Jun 22 15:10:15 2005
@@ -31,12 +31,12 @@

import net.dpml.transit.Transit;
import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.model.ProxyEvent;
import net.dpml.transit.model.ProxyListener;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.ProxyModel;
import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;

/**

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
Wed Jun 22 15:10:15 2005
@@ -28,9 +28,9 @@

import net.dpml.transit.Transit;
import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;

/**

Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/test/ArtifactTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/test/ArtifactTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/test/ArtifactTestCase.java
Wed Jun 22 15:10:15 2005
@@ -19,6 +19,7 @@
package net.dpml.transit.test;

import junit.framework.TestCase;
+
import net.dpml.transit.runtime.ClassicLayout;
import net.dpml.transit.runtime.Layout;
import net.dpml.transit.artifact.Artifact;

Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/test/LinkTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/test/LinkTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/test/LinkTestCase.java
Wed Jun 22 15:10:15 2005
@@ -31,9 +31,9 @@
import net.dpml.transit.Transit;
import net.dpml.transit.artifact.ArtifactNotFoundException;
import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.link.Link;
import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;
import net.dpml.transit.util.StreamUtils;


Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/test/OfflineTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/test/OfflineTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/test/OfflineTestCase.java
Wed Jun 22 15:10:15 2005
@@ -35,7 +35,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.home.TransitHome;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.model.TransitModel;
import net.dpml.transit.unit.TransitStorageUnit;


Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/test/OnlineTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/test/OnlineTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/test/OnlineTestCase.java
Wed Jun 22 15:10:15 2005
@@ -33,7 +33,7 @@

import net.dpml.transit.Transit;
import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.home.TransitHome;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;

/**

Modified:
development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
==============================================================================
---
development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
(original)
+++
development/main/transit/core/tools/src/main/net/dpml/transit/tools/ImportArtifactTask.java
Wed Jun 22 15:10:15 2005
@@ -28,10 +28,10 @@
import net.dpml.transit.Transit;
import net.dpml.transit.TransitAlreadyInitializedException;
import net.dpml.transit.artifact.Handler;
-import net.dpml.transit.home.TransitHome;
import net.dpml.transit.monitors.Monitor;
import net.dpml.transit.model.Logger;
import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.store.TransitHome;
import net.dpml.transit.unit.TransitStorageUnit;

/**



  • svn commit: r2900 - in development/main: depot/console depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/console/src/main/net/dpml/depot/store depot/console/src/main/net/dpml/depot/unit depot/prefs/src/main/net/dpml/depot/prefs depot/station/src/main/net/dpml/depot/station metro/main/src/main/net/dpml/metro/model test/unit/plus/src/test/net/dpml/test/acme/plus transit/core/handler/src/main/net/dpml/transit transit/core/handler/src/main/net/dpml/transit/home transit/core/handler/src/main/net/dpml/transit/model transit/core/handler/src/main/net/dpml/transit/store transit/core/handler/src/main/net/dpml/transit/unit transit/core/handler/src/main/net/dpml/transit/util transit/core/handler/src/test/net/dpml/transit/manager transit/core/handler/src/test/net/dpml/transit/test transit/core/tools/src/main/net/dpml/transit/tools, mcconnell, 06/22/2005

Archive powered by MHonArc 2.6.24.

Top of Page