Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2817 - in development/main/depot: console/src/main/net/dpml/depot console/src/main/net/dpml/depot/profile station/src/main/net/dpml/depot/station

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: r2817 - in development/main/depot: console/src/main/net/dpml/depot console/src/main/net/dpml/depot/profile station/src/main/net/dpml/depot/station
  • Date: Thu, 09 Jun 2005 11:45:46 -0400

Author: mcconnell AT dpml.net
Date: Thu Jun 9 11:45:44 2005
New Revision: 2817

Added:

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

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

development/main/depot/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
Modified:
development/main/depot/console/src/main/net/dpml/depot/Main.java

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

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

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

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

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

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

development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfileStorage.java
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.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
Log:
more on activation profiles

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 Thu
Jun 9 11:45:44 2005
@@ -48,7 +48,8 @@
import net.dpml.depot.lang.DPML;
import net.dpml.depot.lang.DepotClassLoader;
import net.dpml.depot.profile.Profile;
-import net.dpml.depot.profile.Profile.Connection;
+import net.dpml.depot.profile.ApplicationProfile;
+import net.dpml.depot.profile.ApplicationProfile.Connection;
import net.dpml.depot.profile.PluginProfile;
import net.dpml.depot.profile.BootstrapProfile;
import net.dpml.depot.profile.DepotManager;
@@ -115,7 +116,7 @@
DepotStorage store = new DepotStorage( prefs, logger, creation,
false );
DepotManager manager = store.getDepotManager();
String target = getTargetProfile( args );
- Profile profile = getApplicationProfile( manager, target );
+ ApplicationProfile profile = getApplicationProfile( manager,
target );
termination = profile.getCommandPolicy();
for( int i=0; i < args.length; i++ )
{
@@ -307,7 +308,7 @@
}
}

- private static Profile getApplicationProfile( DepotManager manager,
String target )
+ private static ApplicationProfile getApplicationProfile( DepotManager
manager, String target )
{
try
{

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/AbstractPluginProfileStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/AbstractPluginProfileStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/AbstractPluginProfileStorage.java
Thu Jun 9 11:45:44 2005
@@ -30,8 +30,6 @@
import net.dpml.transit.management.ModificationEvent;
import net.dpml.transit.builder.AbstractStorageUnit;

-import net.dpml.depot.profile.Profile.Connection;
-
/**
* A ProfileHome maintains a persistent application profile.
*/
@@ -104,6 +102,4 @@
throw new ProfileException( error );
}
}
-
- protected abstract void store( PluginProfile profile );
}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfile.java
Thu Jun 9 11:45:44 2005
@@ -0,0 +1,99 @@
+/*
+ * 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.util.Properties;
+import java.util.Date;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.manager.DefaultManager;
+import net.dpml.transit.management.Home;
+
+/**
+ * A ProfileModel maintains information about the configuration
+ * of an application profile.
+ */
+public class ApplicationProfile extends Profile
+{
+ private boolean m_command;
+ private Connection m_connection;
+
+ public ApplicationProfile(
+ Logger logger, Date creation, Home home, String id, String title,
+ Properties properties, boolean command, Connection connection )
+ {
+ super( logger, creation, home, id, title, properties );
+
+ m_connection = connection;
+ m_command = command;
+ }
+
+ public boolean getCommandPolicy()
+ {
+ return m_command;
+ }
+
+ public void setCommandPolicy( boolean policy )
+ {
+ m_command = policy;
+ }
+
+ public Connection getConnection()
+ {
+ return m_connection;
+ }
+
+ public void setConnection( Connection connection )
+ {
+ m_connection = connection;
+ }
+
+ public static class Connection
+ {
+ private String m_host;
+ private int m_port;
+
+ public Connection( String host, int port )
+ {
+ m_host = host;
+ m_port = port;
+ }
+
+ public String getHost()
+ {
+ return m_host;
+ }
+
+ public void setHost( String host )
+ {
+ m_host = host;
+ }
+
+ public int getPort()
+ {
+ return m_port;
+ }
+
+ public void setPort( int port )
+ {
+ m_port = port;
+ }
+ }
+}

Added:
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfileStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ApplicationProfileStorage.java
Thu Jun 9 11:45:44 2005
@@ -0,0 +1,81 @@
+/*
+ * 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.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.management.Home;
+import net.dpml.transit.management.ModificationEvent;
+import net.dpml.transit.builder.AbstractStorageUnit;
+
+import net.dpml.depot.profile.ApplicationProfile.Connection;
+
+/**
+ * A ProfileHome maintains a persistent application profile.
+ */
+public abstract class ApplicationProfileStorage extends
AbstractPluginProfileStorage
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public ApplicationProfileStorage(
+ Preferences prefs, Logger logger, Date creation, boolean policy )
+ throws ProfileException
+ {
+ super( prefs, logger, creation, policy );
+ }
+
+ protected boolean getCommandPolicy()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "command", false );
+ }
+
+ protected Connection getConnection() throws ProfileException
+ {
+ 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 );
+ return new Connection( host, port );
+ }
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Cannot construct a connection due to non-availability of the
preferences store.";
+ throw new ProfileException( error, e );
+ }
+ }
+}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfile.java
Thu Jun 9 11:45:44 2005
@@ -30,10 +30,11 @@
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class BootstrapProfile extends Profile
+public class BootstrapProfile extends ApplicationProfile
{
private String m_classname;
private String[] m_classpath;
+ private boolean m_command;

public BootstrapProfile(
Logger logger, Date creation, Home home, String id, String title,

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfileStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfileStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/BootstrapProfileStorage.java
Thu Jun 9 11:45:44 2005
@@ -30,12 +30,12 @@
import net.dpml.transit.management.ModificationEvent;
import net.dpml.transit.builder.AbstractStorageUnit;

-import net.dpml.depot.profile.Profile.Connection;
+import net.dpml.depot.profile.ApplicationProfile.Connection;

/**
* A ProfileHome maintains a persistent application profile.
*/
-public class BootstrapProfileStorage extends ProfileStorage
+public class BootstrapProfileStorage extends ApplicationProfileStorage
{
//
------------------------------------------------------------------------
// state
@@ -107,7 +107,7 @@
// utils
//
------------------------------------------------------------------------

- protected Profile getProfile()
+ protected BootstrapProfile getBootstrapProfile()
{
return m_profile;
}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotManager.java
Thu Jun 9 11:45:44 2005
@@ -33,9 +33,9 @@
*/
public class DepotManager extends DefaultManager
{
- private Profile[] m_profiles;
+ private ApplicationProfile[] m_profiles;

- public DepotManager( Logger logger, Date creation, Home home, Profile[]
profiles )
+ public DepotManager( Logger logger, Date creation, Home home,
ApplicationProfile[] profiles )
throws NullPointerException
{
super( logger, creation, home );
@@ -43,17 +43,17 @@
m_profiles = profiles;
}

- public Profile[] getProfiles()
+ public ApplicationProfile[] getProfiles()
{
return m_profiles;
}

- public Profile getProfile( String key ) throws UnknownKeyException
+ public ApplicationProfile getProfile( String key ) throws
UnknownKeyException
{
- Profile[] profiles = getProfiles();
+ ApplicationProfile[] profiles = getProfiles();
for( int i=0; i<profiles.length; i++ )
{
- Profile profile = profiles[i];
+ ApplicationProfile profile = profiles[i];
if( key.equals( profile.getID() ) )
{
return profile;
@@ -61,5 +61,4 @@
}
throw new UnknownKeyException( key );
}
-
}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
Thu Jun 9 11:45:44 2005
@@ -51,7 +51,7 @@
{
super( prefs, logger, creation, policy );

- Profile[] profiles = getProfiles();
+ ApplicationProfile[] profiles = getApplicationProfiles();
m_depot = new DepotManager( logger, creation, this, profiles );
}

@@ -90,7 +90,7 @@
return m_depot;
}

- private Profile[] getProfiles() throws ProfileException
+ private ApplicationProfile[] getApplicationProfiles() throws
ProfileException
{
try
{
@@ -102,11 +102,11 @@
{
Preferences prefs = getPreferences().node( "profiles" );
String[] names = prefs.childrenNames();
- Profile[] profiles = new Profile[ names.length ];
+ ApplicationProfile[] profiles = new ApplicationProfile[
names.length ];
for( int i=0; i<names.length; i++ )
{
String id = names[i];
- Profile profile = createProfile( id );
+ ApplicationProfile profile = createApplicationProfile(
id );
profiles[i] = profile;
}
return profiles;
@@ -120,23 +120,23 @@
}
}

- private Profile createProfile( String id ) throws ProfileException
+ private ApplicationProfile createApplicationProfile( String id ) throws
ProfileException
{
Preferences prefs = getPreferences().node( "profiles" ).node( id );
Logger logger = getLogger().getChildLogger( id );
boolean policy = getStoragePolicy();
Date creation = getCreationDate();
String path = prefs.get( "plugin", null );
- ProfileStorage store = null;
if( null != path )
{
- store = new PluginProfileStorage( prefs, logger, creation,
policy );
+ PluginProfileStorage store = new PluginProfileStorage( prefs,
logger, creation, policy );
+ return store.getPluginProfile();
}
else
{
- store = new BootstrapProfileStorage( prefs, logger, creation,
policy );
+ BootstrapProfileStorage store = new BootstrapProfileStorage(
prefs, logger, creation, policy );
+ return store.getBootstrapProfile();
}
- return store.getProfile();
}

private void store( DepotManager manager )
@@ -144,15 +144,15 @@
throw new UnsupportedOperationException( "store/1" );
}

- private Profile[] createBootstrapProfiles() throws ProfileException
+ private ApplicationProfile[] createBootstrapProfiles() throws
ProfileException
{
- Profile prefs = createPrefsProfile();
- Profile station = createStationProfile();
- Profile test = createTestProfile();
- return new Profile[]{ prefs, station, test };
+ ApplicationProfile prefs = createPrefsProfile();
+ ApplicationProfile station = createStationProfile();
+ ApplicationProfile test = createTestProfile();
+ return new ApplicationProfile[]{ prefs, station, test };
}

- private Profile createPrefsProfile() throws ProfileException
+ private ApplicationProfile createPrefsProfile() throws ProfileException
{
String id = "prefs";
Date creation = getCreationDate();
@@ -163,11 +163,11 @@
prefs.put( "title", "Depot Preferences" );
prefs.node( "classpath" ).put( "dpml-depot-prefs",
"${dpml.data}/lib/@DEPOT-PREFS-LIB@" );
prefs.putBoolean( "command", false );
- ProfileStorage store = new BootstrapProfileStorage( prefs, logger,
creation, policy );
- return store.getProfile();
+ BootstrapProfileStorage store = new BootstrapProfileStorage( prefs,
logger, creation, policy );
+ return store.getBootstrapProfile();
}

- private Profile createStationProfile() throws ProfileException
+ private ApplicationProfile createStationProfile() throws ProfileException
{
String id = "station";
Date creation = getCreationDate();
@@ -178,11 +178,11 @@
prefs.put( "title", "Depot Station" );
prefs.putBoolean( "command", false );
prefs.node( "connection" );
- ProfileStorage store = new PluginProfileStorage( prefs, logger,
creation, policy );
- return store.getProfile();
+ PluginProfileStorage store = new PluginProfileStorage( prefs,
logger, creation, policy );
+ return store.getPluginProfile();
}

- private Profile createTestProfile() throws ProfileException
+ private ApplicationProfile createTestProfile() throws ProfileException
{
String id = "test";
Date creation = getCreationDate();
@@ -192,8 +192,8 @@
prefs.put( "plugin", "@TEST-PLUGIN-URI@" );
prefs.put( "title", "Depot Station Test" );
prefs.putBoolean( "command", true );
- ProfileStorage store = new PluginProfileStorage( prefs, logger,
creation, policy );
- return store.getProfile();
+ PluginProfileStorage store = new PluginProfileStorage( prefs,
logger, creation, policy );
+ return store.getPluginProfile();
}

}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfile.java
Thu Jun 9 11:45:44 2005
@@ -29,7 +29,7 @@
* A ProfileModel maintains information about the configuration
* of an application profile.
*/
-public class PluginProfile extends Profile
+public class PluginProfile extends ApplicationProfile
{
private URI m_uri;

@@ -38,7 +38,6 @@
Properties properties, boolean command, Connection connection, URI uri
)
{
super( logger, creation, home, id, title, properties, command,
connection );
-
m_uri = uri;
}


Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfileStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfileStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/PluginProfileStorage.java
Thu Jun 9 11:45:44 2005
@@ -30,12 +30,12 @@
import net.dpml.transit.management.ModificationEvent;
import net.dpml.transit.builder.AbstractStorageUnit;

-import net.dpml.depot.profile.Profile.Connection;
+import net.dpml.depot.profile.ApplicationProfile.Connection;

/**
* A ProfileHome maintains a persistent application profile.
*/
-public class PluginProfileStorage extends AbstractPluginProfileStorage
+public class PluginProfileStorage extends ApplicationProfileStorage
{
//
------------------------------------------------------------------------
// state
@@ -94,11 +94,6 @@
// utils
//
------------------------------------------------------------------------

- protected Profile getProfile()
- {
- return getPluginProfile();
- }
-
protected PluginProfile getPluginProfile()
{
return m_profile;

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/Profile.java
Thu Jun 9 11:45:44 2005
@@ -35,21 +35,15 @@
private final String m_id;
private String m_title;
private Properties m_properties;
- private Connection m_connection;
- private boolean m_command;

public Profile(
- Logger logger, Date creation, Home home, String id, String title,
- Properties properties, boolean command, Connection connection )
- throws NullPointerException
+ Logger logger, Date creation, Home home, String id, String title,
Properties properties )
{
super( logger, creation, home );

m_id = id;
m_title = title;
m_properties = properties;
- m_connection = connection;
- m_command = command;
}

public String getID()
@@ -67,16 +61,6 @@
m_title = title;
}

- public boolean getCommandPolicy()
- {
- return m_command;
- }
-
- public void setCommandPolicy( boolean policy )
- {
- m_command = policy;
- }
-
public Properties getSystemProperties()
{
return m_properties;
@@ -86,46 +70,4 @@
{
m_properties = properties;
}
-
- public Connection getConnection()
- {
- return m_connection;
- }
-
- public void setConnection( Connection connection )
- {
- m_connection = connection;
- }
-
- public static class Connection
- {
- private String m_host;
- private int m_port;
-
- public Connection( String host, int port )
- {
- m_host = host;
- m_port = port;
- }
-
- public String getHost()
- {
- return m_host;
- }
-
- public void setHost( String host )
- {
- m_host = host;
- }
-
- public int getPort()
- {
- return m_port;
- }
-
- public void setPort( int port )
- {
- m_port = port;
- }
- }
}

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/ProfileStorage.java
Thu Jun 9 11:45:44 2005
@@ -30,8 +30,6 @@
import net.dpml.transit.management.ModificationEvent;
import net.dpml.transit.builder.AbstractStorageUnit;

-import net.dpml.depot.profile.Profile.Connection;
-
/**
* A ProfileHome maintains a persistent application profile.
*/
@@ -78,8 +76,6 @@
// utils
//
------------------------------------------------------------------------

- protected abstract Profile getProfile();
-
protected String getID()
{
return getPreferences().name();
@@ -91,12 +87,6 @@
return getPreferences().get( "title", id );
}

- protected boolean getCommandPolicy()
- {
- Preferences prefs = getPreferences();
- return prefs.getBoolean( "command", false );
- }
-
protected Properties getProperties() throws ProfileException
{
Properties properties = new Properties();
@@ -123,55 +113,6 @@
}
}

- protected Connection getConnection() throws ProfileException
- {
- 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 );
- return new Connection( host, port );
- }
- }
- catch( BackingStoreException e )
- {
- final String error =
- "Cannot construct a connection due to non-availability of the
preferences store.";
- throw new ProfileException( error, e );
- }
- }
-
- /*
- private String[] getClasspath() throws ProfileException
- {
- Preferences prefs = getPreferences().node( "classpath" );
- try
- {
- String[] keys = prefs.keys();
- String[] values = new String[ keys.length ];
- for( int i=0; i<keys.length; i++ )
- {
- String key = keys[i];
- values[i] = prefs.get( key, null );
- }
- return values;
- }
- catch( BackingStoreException e )
- {
- final String error =
- "Cannot construct a classpath due to non-availability of the
preferences store.";
- throw new ProfileException( error, e );
- }
- }
- */
-
protected void store( Profile profile )
{
throw new UnsupportedOperationException( "store/1" );

Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupProfile.java
Thu Jun 9 11:45:44 2005
@@ -30,32 +30,27 @@
import net.dpml.transit.management.Home;

import net.dpml.depot.profile.ProfileException;
-import net.dpml.depot.profile.PluginProfile;

/**
* A ActivationProfile maintains information about the configuration
* of an activation profile.
*/
-public class ActivationGroupProfile extends PluginProfile
+public class ActivationGroupProfile extends CodeBaseProfile
{
- private String m_classname;
+ private CodeBaseProfile[] m_profiles;

public ActivationGroupProfile(
Logger logger, Date creation, Home home, String id, String title,
- Properties properties, URI uri, String classname )
+ Properties properties, URI uri, String classname, CodeBaseProfile[]
profiles )
throws ProfileException
{
- super( logger, creation, home, id, title, properties, false, null,
uri );
+ super( logger, creation, home, id, title, properties, uri, classname
);
+
+ m_profiles = profiles;
}

- public String getClassname()
+ public CodeBaseProfile[] getCodeBaseProfiles()
{
- return m_classname;
+ return m_profiles;
}
-
- public void setClassname( String classname )
- {
- m_classname = classname;
- }
-
}

Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationGroupStorage.java
Thu Jun 9 11:45:44 2005
@@ -31,15 +31,12 @@
import net.dpml.transit.management.ModificationEvent;
import net.dpml.transit.builder.AbstractStorageUnit;

-import net.dpml.depot.profile.Profile.Connection;
-import net.dpml.depot.profile.PluginProfile;
import net.dpml.depot.profile.ProfileException;
-import net.dpml.depot.profile.PluginProfileStorage;

/**
* A ProfileHome maintains a persistent application profile.
*/
-public class ActivationGroupStorage extends PluginProfileStorage
+public class ActivationGroupStorage extends CodeBaseStorage
{
//
------------------------------------------------------------------------
// state
@@ -52,20 +49,68 @@
//
------------------------------------------------------------------------

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

- String id = prefs.name();
- String title = prefs.get( "title", id );
+ String id = getID();
+ String title = getTitle();
Properties properties = getProperties();
- URI uri = getPluginURI();
- String classname = getActivationGroupClassname();
+ URI uri = getCodeBaseURI();
+ String classname = getClassname();
+ CodeBaseProfile[] profiles = getCodeBaseProfiles();

m_profile =
new ActivationGroupProfile(
- logger, creation, this, id, title, properties, uri, classname );
+ logger, creation, this, id, title, properties, uri, classname,
profiles );
+ }
+
+ protected CodeBaseProfile[] getCodeBaseProfiles()
+ throws ProfileException
+ {
+ Logger logger = getLogger();
+ Date creation = getCreationDate();
+ boolean policy = getStoragePolicy();
+ Preferences prefs = getPreferences().node( "entries" );
+ return getCodeBaseProfiles( prefs, logger, creation, policy );
+ }
+
+ protected static CodeBaseProfile[] getCodeBaseProfiles(
+ Preferences prefs, Logger logger, Date creation, boolean policy )
+ throws ProfileException
+ {
+ try
+ {
+ String[] names = prefs.childrenNames();
+ CodeBaseProfile[] profiles = new CodeBaseProfile[ names.length ];
+ for( int i=0; i<names.length; i++ )
+ {
+ String id = names[i];
+ Preferences p = prefs.node( id );
+ Logger log = logger.getChildLogger( id );
+ if( true == p.getBoolean( "group", false ) )
+ {
+ ActivationGroupStorage store =
+ new ActivationGroupStorage( p, log, creation, policy );
+ CodeBaseProfile profile =
store.getActivationGroupProfile();
+ profiles[i] = profile;
+ }
+ else
+ {
+ ActivationStorage store =
+ new ActivationStorage( p, log, creation, policy );
+ CodeBaseProfile profile = store.getActivationProfile();
+ profiles[i] = profile;
+ }
+ }
+ return profiles;
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Internal error while resolving a persistent activation
group.";
+ throw new ProfileException( error, e );
+ }
}

//
------------------------------------------------------------------------
@@ -103,22 +148,6 @@
return m_profile;
}

- protected String getActivationGroupClassname() throws ProfileException
- {
- Preferences prefs = getPreferences();
- String classname = prefs.get( "classname", null );
- if( null == classname )
- {
- final String error =
- "Activation group profile does not declare the target
classname.";
- throw new ProfileException( error );
- }
- else
- {
- return classname;
- }
- }
-
private void store( ActivationGroupProfile profile )
{
super.store( profile );

Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationProfile.java
Thu Jun 9 11:45:44 2005
@@ -35,30 +35,18 @@
* A ActivationProfile maintains information about the configuration
* of an activation profile.
*/
-public class ActivationProfile extends PluginProfile
+public class ActivationProfile extends CodeBaseProfile
{
- private String m_classname;
private boolean m_restart;
- private ActivationDesc m_descriptor;

public ActivationProfile(
Logger logger, Date creation, Home home, String id, String title,
Properties properties, URI uri, String classname, boolean restart )
throws ProfileException
{
- super( logger, creation, home, id, title, properties, false, null,
uri );
- m_classname = classname;
- m_restart = restart;
- }
+ super( logger, creation, home, id, title, properties, uri, classname
);

- public String getClassname()
- {
- return m_classname;
- }
-
- public void setClassname( String classname )
- {
- m_classname = classname;
+ m_restart = restart;
}

public boolean getRestartPolicy()

Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
Thu Jun 9 11:45:44 2005
@@ -31,15 +31,14 @@
import net.dpml.transit.management.ModificationEvent;
import net.dpml.transit.builder.AbstractStorageUnit;

-import net.dpml.depot.profile.Profile.Connection;
import net.dpml.depot.profile.PluginProfile;
import net.dpml.depot.profile.ProfileException;
-import net.dpml.depot.profile.PluginProfileStorage;
+import net.dpml.depot.profile.ProfileStorage;

/**
* A ProfileHome maintains a persistent application profile.
*/
-public class ActivationStorage extends PluginProfileStorage
+public class ActivationStorage extends CodeBaseStorage
{
//
------------------------------------------------------------------------
// state
@@ -56,11 +55,11 @@
{
super( prefs, logger, creation, policy );

- String id = prefs.name();
- String title = prefs.get( "title", id );
+ String id = getID();
+ String title = getTitle();
Properties properties = getProperties();
- URI uri = getPluginURI();
- String classname = getActivationClassname();
+ URI uri = getCodeBaseURI();
+ String classname = getClassname();
boolean restart = getRestartPolicy();

m_profile =
@@ -74,6 +73,12 @@
return m_profile;
}

+ protected boolean getRestartPolicy()
+ {
+ Preferences prefs = getPreferences();
+ return prefs.getBoolean( "restart", true );
+ }
+
//
------------------------------------------------------------------------
// ModificationListener
//
------------------------------------------------------------------------
@@ -104,28 +109,6 @@
// utils
//
------------------------------------------------------------------------

- protected boolean getRestartPolicy()
- {
- Preferences prefs = getPreferences();
- return prefs.getBoolean( "restart", true );
- }
-
- protected String getActivationClassname() throws ProfileException
- {
- Preferences prefs = getPreferences();
- String classname = prefs.get( "classname", null );
- if( null == classname )
- {
- final String error =
- "Activation profile does not declare the target classname.";
- throw new ProfileException( error );
- }
- else
- {
- return classname;
- }
- }
-
private void store( ActivationProfile profile )
{
super.store( profile );

Added:
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseProfile.java
Thu Jun 9 11:45:44 2005
@@ -0,0 +1,75 @@
+/*
+ * 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.station;
+
+import java.net.URI;
+import java.util.Date;
+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.management.Home;
+
+import net.dpml.depot.profile.Profile;
+import net.dpml.depot.profile.ProfileException;
+
+/**
+ * A ActivationProfile maintains information about the configuration
+ * of an activation profile.
+ */
+public abstract class CodeBaseProfile extends Profile
+{
+ private String m_classname;
+ private URI m_uri;
+
+ public CodeBaseProfile(
+ Logger logger, Date creation, Home home, String id, String title,
+ Properties properties, URI uri, String classname )
+ throws ProfileException
+ {
+ super( logger, creation, home, id, title, properties );
+
+ m_uri = uri;
+ m_classname = classname;
+ }
+
+ public String getClassname()
+ {
+ return m_classname;
+ }
+
+ public void setClassname( String classname )
+ {
+ m_classname = classname;
+ }
+
+ public URI getCodeBaseURI()
+ {
+ return m_uri;
+ }
+
+ public void setCodeBaseURI( URI uri )
+ {
+ m_uri = uri;
+ }
+
+}

Added:
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/station/src/main/net/dpml/depot/station/CodeBaseStorage.java
Thu Jun 9 11:45:44 2005
@@ -0,0 +1,95 @@
+/*
+ * 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.station;
+
+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 java.rmi.activation.ActivationGroupID;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.management.Home;
+import net.dpml.transit.management.ModificationEvent;
+import net.dpml.transit.builder.AbstractStorageUnit;
+
+import net.dpml.depot.profile.PluginProfile;
+import net.dpml.depot.profile.ProfileException;
+import net.dpml.depot.profile.ProfileStorage;
+
+/**
+ * A ProfileHome maintains a persistent application profile.
+ */
+public abstract class CodeBaseStorage extends ProfileStorage
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public CodeBaseStorage(
+ Preferences prefs, Logger logger, Date creation, boolean policy )
throws ProfileException
+ {
+ super( prefs, logger, creation, policy );
+ }
+
+ protected URI getCodeBaseURI() throws ProfileException
+ {
+ Preferences prefs = getPreferences();
+ String path = prefs.get( "uri", null );
+ if( null != path )
+ {
+ try
+ {
+ return new URI( path );
+ }
+ catch( URISyntaxException e )
+ {
+ final String error =
+ "Activation profile contains an invaid uri value."
+ + "\nURI: " + path;
+ throw new ProfileException( error, e );
+ }
+ }
+ else
+ {
+ final String error =
+ "Activation profile does not declare a codesource uri
attribute."
+ + "\nPreferences: " + prefs;
+ throw new ProfileException( error );
+ }
+ }
+
+ protected String getClassname() throws ProfileException
+ {
+ Preferences prefs = getPreferences();
+ String classname = prefs.get( "classname", null );
+ if( null == classname )
+ {
+ final String error =
+ "Activation profile does not declare the target classname.";
+ throw new ProfileException( error );
+ }
+ else
+ {
+ return classname;
+ }
+ }
+}

Added:
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
==============================================================================
--- (empty file)
+++
development/main/depot/station/src/main/net/dpml/depot/station/StationProfile.java
Thu Jun 9 11:45:44 2005
@@ -0,0 +1,60 @@
+/*
+ * 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.station;
+
+import java.net.URI;
+import java.util.Properties;
+import java.util.Date;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.model.UnknownKeyException;
+import net.dpml.transit.manager.DefaultManager;
+import net.dpml.transit.management.Home;
+
+import net.dpml.depot.profile.ProfileException;
+
+/**
+ * A ProfileModel maintains information about the configuration
+ * of an application profile.
+ */
+public class StationProfile extends DefaultManager
+{
+ private Properties m_properties;
+ private CodeBaseProfile[] m_profiles;
+
+ public StationProfile(
+ Logger logger, Date creation, Home home, Properties properties,
CodeBaseProfile[] profiles )
+ {
+ super( logger, creation, home );
+
+ m_properties = properties;
+ m_profiles = profiles;
+ }
+
+ public Properties getProperties()
+ {
+ return m_properties;
+ }
+
+ public CodeBaseProfile[] getCodeBaseProfiles()
+ {
+ return m_profiles;
+ }
+
+}

Added:
development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
==============================================================================
--- (empty file)
+++
development/main/depot/station/src/main/net/dpml/depot/station/StationStorage.java
Thu Jun 9 11:45:44 2005
@@ -0,0 +1,137 @@
+/*
+ * 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.station;
+
+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 java.rmi.activation.ActivationGroupID;
+
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.management.Home;
+import net.dpml.transit.management.ModificationEvent;
+import net.dpml.transit.builder.AbstractStorageUnit;
+
+import net.dpml.depot.profile.ProfileException;
+import net.dpml.transit.builder.AbstractStorageUnit;
+
+/**
+ * A ProfileHome maintains a persistent application profile.
+ */
+public class StationStorage extends AbstractStorageUnit implements Home
+{
+ //
------------------------------------------------------------------------
+ // state
+ //
------------------------------------------------------------------------
+
+ private final StationProfile m_profile;
+
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public StationStorage(
+ Preferences prefs, Logger logger, Date creation, boolean policy )
throws ProfileException
+ {
+ super( prefs, logger, creation, policy );
+
+ Properties properties = getProperties();
+ CodeBaseProfile[] profiles = getCodeBaseProfiles();
+ m_profile = new StationProfile( logger, creation, this, properties,
profiles );
+ }
+
+ protected CodeBaseProfile[] getCodeBaseProfiles()
+ throws ProfileException
+ {
+ Logger logger = getLogger();
+ Date creation = getCreationDate();
+ boolean policy = getStoragePolicy();
+ Preferences prefs = getPreferences().node( "entries" );
+ return ActivationGroupStorage.getCodeBaseProfiles( prefs, logger,
creation, policy );
+ }
+
+ protected Properties getProperties() throws ProfileException
+ {
+ Properties properties = new Properties();
+ Preferences prefs = getPreferences().node( "properties" );
+ try
+ {
+ String[] keys = prefs.keys();
+ for( int i=0; i<keys.length; i++ )
+ {
+ String key = keys[i];
+ String value = prefs.get( key, null );
+ if( null != value )
+ {
+ properties.setProperty( key, value );
+ }
+ }
+ return properties;
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Internal error while resolving persistent application
properties.";
+ throw new ProfileException( error, e );
+ }
+ }
+
+ //
------------------------------------------------------------------------
+ // ModificationListener
+ //
------------------------------------------------------------------------
+
+ /**
+ * Notify a listener of a change to the manager modification date.
+ * @param event the modification event
+ */
+ public void modified( ModificationEvent event )
+ {
+ if( getStoragePolicy() )
+ {
+ try
+ {
+ StationProfile manager = (StationProfile) event.getManager();
+ Date date = new Date();
+ store( manager );
+ manager.setCreationDate( date );
+ }
+ catch( Throwable e )
+ {
+ getLogger().error( "storage failure", e );
+ }
+ }
+ }
+
+ //
------------------------------------------------------------------------
+ // utils
+ //
------------------------------------------------------------------------
+
+ public StationProfile getStationProfile()
+ {
+ return m_profile;
+ }
+
+ private void store( StationProfile profile )
+ {
+ throw new UnsupportedOperationException( "store/1" );
+ }
+}



  • svn commit: r2817 - in development/main/depot: console/src/main/net/dpml/depot console/src/main/net/dpml/depot/profile station/src/main/net/dpml/depot/station, mcconnell, 06/09/2005

Archive powered by MHonArc 2.6.24.

Top of Page