Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2926 - in development/main: depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs/src/main/net/dpml/depot/prefs depot/prefs/src/main/net/dpml/depot/prefs/images 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/link 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/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: r2926 - in development/main: depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs/src/main/net/dpml/depot/prefs depot/prefs/src/main/net/dpml/depot/prefs/images 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/link 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/test/net/dpml/transit/manager transit/core/handler/src/test/net/dpml/transit/test transit/core/tools/src/main/net/dpml/transit/tools
  • Date: Mon, 27 Jun 2005 06:53:18 -0400

Author: mcconnell AT dpml.net
Date: Mon Jun 27 06:53:17 2005
New Revision: 2926

Added:

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

development/main/depot/prefs/src/main/net/dpml/depot/prefs/GroupsListModel.java
- copied, changed from r2917,
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ServerRegistryTableModel.java
development/main/depot/prefs/src/main/net/dpml/depot/prefs/GroupsPanel.java

development/main/depot/prefs/src/main/net/dpml/depot/prefs/images/process.png
(contents, props changed)

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

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

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

development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageHome.java
Removed:

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

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

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

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ServerRegistryTableModel.java
Modified:
development/main/depot/console/src/main/net/dpml/depot/Main.java

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

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

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

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

development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicPanel.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/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/link/LinkURLConnection.java

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

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

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

development/main/transit/core/handler/src/main/net/dpml/transit/unit/package.html

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/AuthorityTestCase.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:
Addition of a preferences implementation suitable for transitent applications
using java.util.Properties as an in-memory storage model, and updates to the
Depot prefs implementation to improve handling of information related to
activation groups.

Modified: development/main/depot/console/src/main/net/dpml/depot/Main.java
==============================================================================
--- development/main/depot/console/src/main/net/dpml/depot/Main.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/Main.java Mon
Jun 27 06:53:17 2005
@@ -49,9 +49,8 @@
import net.dpml.transit.model.Connection;
import net.dpml.transit.model.UnknownKeyException;
import net.dpml.transit.model.TransitModel;
+import net.dpml.transit.model.DefaultTransitModel;
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;
@@ -86,33 +85,6 @@
System.exit( 0 );
}

- private static boolean isFlagPresent( String[] args, String flag )
- {
- for( int i=0; i < args.length; i++ )
- {
- String arg = args[i];
- if( arg.equals( flag ) )
- {
- return true;
- }
- }
- return false;
- }
-
- private static String[] consolidate( String [] args, String argument )
- {
- ArrayList list = new ArrayList();
- for( int i=0; i < args.length; i++ )
- {
- String arg = args[i];
- if( false == arg.equals( argument ) )
- {
- list.add( arg );
- }
- }
- return (String[]) list.toArray( new String[0] );
- }
-
public static void main( String[] args )
throws Exception
{
@@ -150,7 +122,12 @@
System.setProperty( "dpml.logging.level", "FINE" );
}

-
+ boolean metal = isFlagPresent( args, "-metal" );
+ if( metal )
+ {
+ args = consolidate( args, "-metal" );
+ System.setProperty( "dpml.depot.metal", "true" );
+ }

for( int i=0; i < args.length; i++ )
{
@@ -606,7 +583,7 @@

if( false == resolve )
{
- return createTransitModel( args, logger );
+ return new DefaultTransitModel( logger );
}

logger.info( "resolving transit model" );
@@ -618,21 +595,14 @@
}
catch( ConnectException e )
{
- return createTransitModel( args, logger );
+ return new DefaultTransitModel( logger );
}
catch( NotBoundException e )
{
- return createTransitModel( args, logger );
+ return new DefaultTransitModel( logger );
}
}

- private static TransitModel createTransitModel( String[] args, Logger
logger ) throws Exception
- {
- logger.info( "creating new transit model" );
- TransitHome home = new TransitStorageUnit();
- return home.create();
- }
-

//--------------------------------------------------------------------------
// static utilities for setup of logging manager and root prefs

//--------------------------------------------------------------------------
@@ -654,5 +624,33 @@
private static Logger LOGGER = null;
private static final Preferences ROOT_PREFS =
Preferences.userNodeForPackage( Main.class );
+
+ private static boolean isFlagPresent( String[] args, String flag )
+ {
+ for( int i=0; i < args.length; i++ )
+ {
+ String arg = args[i];
+ if( arg.equals( flag ) )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static String[] consolidate( String [] args, String argument )
+ {
+ ArrayList list = new ArrayList();
+ for( int i=0; i < args.length; i++ )
+ {
+ String arg = args[i];
+ if( false == arg.equals( argument ) )
+ {
+ list.add( arg );
+ }
+ }
+ return (String[]) list.toArray( new String[0] );
+ }
+
}


Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DefaultDepotProfile.java
Mon Jun 27 06:53:17 2005
@@ -70,6 +70,16 @@
}
}

+ public int getApplicationProfileCount() throws RemoteException
+ {
+ return m_list.size();
+ }
+
+ public int getActivationGroupProfileCount() throws RemoteException
+ {
+ return m_groups.size();
+ }
+
public void addApplicationProfile( ApplicationProfile profile )
throws DuplicateKeyException, RemoteException
{

Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotProfile.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotProfile.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotProfile.java
Mon Jun 27 06:53:17 2005
@@ -29,6 +29,10 @@
*/
public interface DepotProfile extends Model
{
+ int getApplicationProfileCount() throws RemoteException;
+
+ int getActivationGroupProfileCount() throws RemoteException;
+
ApplicationProfile[] getApplicationProfiles() throws RemoteException;

ApplicationProfile getApplicationProfile( String key ) throws
UnknownKeyException, RemoteException;

Added:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ActivationGroupPanel.java
==============================================================================
--- (empty file)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ActivationGroupPanel.java
Mon Jun 27 06:53:17 2005
@@ -0,0 +1,271 @@
+/*
+ * Copyright 2004 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.prefs;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Window;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.rmi.RemoteException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.AbstractAction;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+import net.dpml.depot.profile.DepotProfile;
+import net.dpml.depot.profile.ActivationProfile;
+import net.dpml.depot.profile.ActivationGroupProfile;
+
+import net.dpml.transit.model.DuplicateKeyException;
+import net.dpml.transit.model.UnknownKeyException;
+
+/**
+ * Runnable plugin that handles DPML environment setup.
+ *
+ * @author <a href="mailto:mcconnell AT osm.net";>OSM</a>
+ */
+class ActivationGroupPanel extends ClassicPanel implements
PropertyChangeListener
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private final Window m_parent;
+
+ private ClassicTable m_table;
+ private EditAction m_editAction;
+ private JButton m_edit;
+ private JButton m_delete;
+ private String m_selection;
+
+ private ActivationGroupProfile m_model;
+ private ActivationGroupTableModel m_tableModel;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ public ActivationGroupPanel( Window parent, ActivationGroupProfile model
) throws Exception
+ {
+ super();
+
+ m_model = model;
+ m_parent = parent;
+
+ m_editAction = new EditAction( "Edit" );
+ m_edit = new JButton( m_editAction );
+ m_delete = new JButton( new DeleteAction( "Delete" ) );
+
+ JLabel label =
+ IconHelper.createImageIconJLabel(
+ getClass().getClassLoader(), MISC_IMG_PATH,
+ "Artifact", "System Properties." );
+ label.setBorder( new EmptyBorder( 0, 5, 0, 0 ) );
+ //ControllerAction controller = new ControllerAction( "Controller" );
+ getHeader().addEntry( label, "JVM Properties", new JButton(
"Properties" ) );
+
+ JPanel panel = new JPanel();
+ panel.setLayout( new BorderLayout() );
+ TitledBorder tb =
+ new TitledBorder(
+ new EmptyBorder( 0,0,0,0 ), "Group", TitledBorder.LEFT,
TitledBorder.TOP );
+ panel.setBorder( new CompoundBorder( tb, border5 ) );
+ getBody().add( panel );
+
+ TableColumnModel columns = createProfilesColumnModel();
+ m_tableModel = new ActivationGroupTableModel( model );
+ m_table = new ClassicTable( m_tableModel, columns );
+ m_table.addPropertyChangeListener( this );
+ m_table.setShowVerticalLines( false );
+ m_table.setShowHorizontalLines( false );
+
+ JButton[] buttons = new JButton[ 3 ];
+ buttons[0] = new JButton( new AddAction( "Add" ) );
+ buttons[1] = m_edit;
+ buttons[2] = m_delete;
+
+ getBody().addScrollingEntry( m_table, "Activation Profiles", buttons
);
+ }
+
+ public void dispose()
+ {
+ m_table.removePropertyChangeListener( this );
+ m_tableModel.dispose();
+ }
+
+ //--------------------------------------------------------------
+ // PropertyChangelistener
+ //--------------------------------------------------------------
+
+ /**
+ * handle property change events raised by the table model.
+ */
+ public void propertyChange( PropertyChangeEvent event )
+ {
+ if( "selection".equals( event.getPropertyName() ) )
+ {
+ m_selection = (String) event.getNewValue();
+ if( null != m_selection )
+ {
+ try
+ {
+ ActivationProfile profile =
m_model.getActivationProfile( m_selection );
+ m_edit.setEnabled( true );
+ m_delete.setEnabled( true );
+ getRootPane().setDefaultButton( m_edit );
+ }
+ catch( UnknownKeyException e )
+ {
+ m_edit.setEnabled( false );
+ m_delete.setEnabled( false );
+ }
+ catch( RemoteException e )
+ {
+ final String error =
+ "Unexpected remote exception while resolving selected
application profile.";
+ throw new RuntimeException( error, e );
+ }
+ }
+ else
+ {
+ m_edit.setEnabled( false );
+ m_delete.setEnabled( false );
+ }
+ }
+ else if( "doubleclick".equals( event.getPropertyName() ) )
+ {
+ m_editAction.editSelection( m_edit );
+ }
+ }
+
+ //--------------------------------------------------------------
+ // utilities
+ //--------------------------------------------------------------
+
+ /**
+ * Utility method to construct the hosts table column model.
+ * @return the table
+ */
+ private static TableColumnModel createProfilesColumnModel()
+ {
+ TableColumn iconColumn = new TableColumn( 0, 30, new
ClassicCellRenderer(), null );
+ iconColumn.setHeaderValue( "" );
+ iconColumn.setMaxWidth( 30 );
+ iconColumn.setMinWidth( 30 );
+ TableColumn typeColumn = new TableColumn( 1, 100, new
ClassicCellRenderer(), null );
+ typeColumn.setHeaderValue( "Profile" );
+ TableColumnModel model = new DefaultTableColumnModel();
+ model.addColumn( iconColumn );
+ model.addColumn( typeColumn );
+ return model;
+ }
+
+ private class AddAction extends EditAction
+ {
+ public AddAction( String name )
+ {
+ super( name );
+ setEnabled( true );
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ String id = JOptionPane.showInputDialog( m_parent, "Activation
Profile ID:" );
+ System.out.println( "Add to " + m_model );
+ }
+ }
+
+ private class EditAction extends AbstractAction
+ {
+ public EditAction( String name )
+ {
+ super( name );
+ setEnabled( false );
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ editSelection( (Component) event.getSource() );
+ }
+
+ public void editSelection( Component source )
+ {
+ try
+ {
+ final String title = "Activation Profile: " + m_selection;
+ final Dimension size = new Dimension( 400, 380 );
+ ClassicDialog dialog = ClassicDialog.createDialog( m_parent,
title, size );
+ ActivationProfile profile = m_model.getActivationProfile(
m_selection );
+ ActivationProfilePanel panel = new ActivationProfilePanel(
dialog, profile );
+ dialog.getBody().add( panel );
+ dialog.setLocationRelativeTo( source );
+ dialog.setResizable( false );
+ dialog.setVisible(true);
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unexpected error while attempting to construct activation
profile dialog."
+ + "\nCODEBASE: "
+ +
getClass().getProtectionDomain().getCodeSource().getLocation().toString();
+ Logger logger = Logger.getLogger( "depot.prefs" );
+ logger.log( Level.SEVERE, error, e );
+ }
+ }
+ }
+
+ private class DeleteAction extends AbstractAction
+ {
+ public DeleteAction( String name )
+ {
+ super( name );
+ setEnabled( false );
+ }
+
+ public void actionPerformed( ActionEvent event )
+ {
+ System.out.println( "Delete: " + m_selection );
+ }
+ }
+
+ private static String MISC_IMG_PATH =
"net/dpml/depot/prefs/images/misc.png";
+
+ private static final EmptyBorder border = new EmptyBorder(1,5,1,3);
+
+}

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ActivationGroupTableModel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ActivationGroupTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ActivationGroupTableModel.java
Mon Jun 27 06:53:17 2005
@@ -61,7 +61,7 @@
*/
private static final Icon FEATURE_ICON =
IconHelper.createImageIcon(
- ServerRegistryTableModel.class.getClassLoader(), ICON_PATH,
"Features" );
+ ActivationGroupTableModel.class.getClassLoader(), ICON_PATH,
"Features" );

private final ActivationGroupProfile m_model;
private final RemoteListener m_listener;

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ApplicationProfilePanel.java
Mon Jun 27 06:53:17 2005
@@ -119,11 +119,6 @@
JPanel panel = new JPanel();
panel.setLayout( new BoxLayout( panel, BoxLayout.Y_AXIS ) );

- //
- // create a box layout for the host base url and groups button
- // TODO: action support for groups
- //
-
JPanel paths = new JPanel();
panel.add( paths );
paths.setLayout( new BorderLayout() );

Modified:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicPanel.java
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicPanel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ClassicPanel.java
Mon Jun 27 06:53:17 2005
@@ -174,7 +174,6 @@

public void addScrollingEntry( Component view, String title,
JButton[] buttons )
{
-
JPanel panel = new JPanel();
panel.setLayout( new BorderLayout() );

@@ -199,7 +198,7 @@
scroller.setViewportView( view );

panel.add( scroller );
-
+
JPanel controls = new JPanel();
controls.setBorder( new EmptyBorder( 10, 6, 0, 6 ) );
controls.setLayout( new FlowLayout( FlowLayout.RIGHT ) );

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
Mon Jun 27 06:53:17 2005
@@ -53,7 +53,7 @@
/**
* The default dialog width.
*/
- private static final int DEFAULT_DIALOG_WIDTH = 400;
+ private static final int DEFAULT_DIALOG_WIDTH = 550;

/**
* The default dialog height.
@@ -79,11 +79,14 @@
{
super();

- String os = System.getProperty( "os.name" ).toLowerCase();
- if( ( os.indexOf( "win" ) >= 0 ) || ( os.indexOf( "Mac OS" ) >= 0 ) )
+ if( null == System.getProperty( "dpml.depot.metal" ) )
{
- String classname = UIManager.getSystemLookAndFeelClassName();
- UIManager.setLookAndFeel( classname );
+ String os = System.getProperty( "os.name" ).toLowerCase();
+ if( ( os.indexOf( "win" ) >= 0 ) || ( os.indexOf( "Mac OS" ) >=
0 ) )
+ {
+ String classname = UIManager.getSystemLookAndFeelClassName();
+ UIManager.setLookAndFeel( classname );
+ }
}

setTitle( "DPML DepotProfile" );

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
Mon Jun 27 06:53:17 2005
@@ -85,7 +85,7 @@
private ContentRegistryModelPanel m_registryPanel;
private ProxyModelPanel m_proxyPanel;
private ApplicationsRegistryPanel m_depotPanel;
- private ServerRegistryPanel m_serverPanel;
+ private GroupsPanel m_groups;

private final Window m_window;
private final DepotProfile m_depot;
@@ -139,8 +139,8 @@
{
try
{
- m_serverPanel = new ServerRegistryPanel( m_window,
m_depot );
- tabbedPane.addTab( "Activation", m_serverPanel );
+ m_groups = new GroupsPanel( m_window, m_depot );
+ tabbedPane.addTab( "Activation", m_groups );
}
catch( Throwable e )
{
@@ -153,6 +153,7 @@
}
);

+
SwingUtilities.invokeLater(
new Runnable() {
public void run()
@@ -169,8 +170,8 @@
}
catch( Throwable e )
{
- final String error =
- "Unexpected during cache panel establishment.";
+ final String error =
+ "Unexpected during cache panel establishment.";
Logger logger = Logger.getLogger( "depot.prefs" );
logger.log( Level.SEVERE, error, e );
}

Copied:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/GroupsListModel.java
(from r2917,
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ServerRegistryTableModel.java)
==============================================================================
---
development/main/depot/prefs/src/main/net/dpml/depot/prefs/ServerRegistryTableModel.java
(original)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/GroupsListModel.java
Mon Jun 27 06:53:17 2005
@@ -20,7 +20,7 @@
import java.rmi.server.UnicastRemoteObject;

import javax.swing.Icon;
-import javax.swing.table.AbstractTableModel;
+import javax.swing.AbstractListModel;

import net.dpml.transit.Transit;
import net.dpml.depot.profile.DepotApplicationEvent;
@@ -31,39 +31,12 @@
/**
* Table model that maps table rows to child nodes of a supplied preferences
node.
*/
-public class ServerRegistryTableModel extends AbstractTableModel
+public class GroupsListModel extends AbstractListModel
{

//--------------------------------------------------------------------------
- // static
+ // state

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

- /**
- * Default small icon path.
- */
- private static final String ICON_PATH =
"net/dpml/depot/prefs/images/item.gif";
-
- /**
- * Constant row identifier for the icon.
- */
- public static final int ICON = 0;
-
- /**
- * Constant row identifier for the name.
- */
- public static final int VALUE = 1;
-
- /**
- * Number of columns.
- */
- private static final int COLUMN_COUNT = 2;
-
- /**
- * Default small icon.
- */
- private static final Icon FEATURE_ICON =
- IconHelper.createImageIcon(
- ServerRegistryTableModel.class.getClassLoader(), ICON_PATH,
"Features" );
-
private final DepotProfile m_model;
private final RemoteListener m_listener;

@@ -77,7 +50,7 @@
*
* @param model the registry of application profiles
*/
- public ServerRegistryTableModel( DepotProfile model ) throws Exception
+ public GroupsListModel( DepotProfile model ) throws Exception
{
super();
m_model = model;
@@ -129,7 +102,7 @@
*/
public void groupAdded( DepotGroupEvent event ) throws
RemoteException
{
- fireTableStructureChanged();
+ fireContentsChanged( this, -1, getSize() );
}

/**
@@ -138,33 +111,22 @@
*/
public void groupRemoved( DepotGroupEvent event ) throws
RemoteException
{
- fireTableStructureChanged();
+ fireContentsChanged( this, -1, getSize() );
}
}


//--------------------------------------------------------------------------
- // NodeTableModel
+ // ListModel

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

/**
- * Returns the number of model columns.
- * @return int the number of columns maintained by the model
+ * Returns the number of rows in the model.
*/
- public int getColumnCount()
- {
- return COLUMN_COUNT;
- }
-
- /**
- * Returns the number of rows in the model. The value returned is
- * equivilent to the number of elements in the list backing the model.
- * @return int the number of rows maintained by the model
- */
- public int getRowCount()
+ public int getSize()
{
try
{
- return m_model.getActivationGroupProfiles().length;
+ return m_model.getActivationGroupProfileCount();
}
catch( Throwable e )
{
@@ -173,39 +135,20 @@
}

/**
- * Returns the feature object at the request column and row combination.
- * If the col index is out of range the method returns the agent
corresponding
- * to the row identifier.
+ * Returns the activation profile at the requested index.
* @param row the row index
* @param col the column index
* @return Object
*/
- public Object getValueAt( int row, int col )
- {
- Object result = "";
- if( row > getRowCount() )
- {
- return result;
- }
-
- switch( col )
- {
- case ICON :
- return FEATURE_ICON;
- default:
- return getResolverAtRow( row );
- }
- }
-
- private String getResolverAtRow( int row )
+ public Object getElementAt( int index )
{
try
{
- return m_model.getActivationGroupProfiles()[ row ].getID();
+ return m_model.getActivationGroupProfiles()[ index ];
}
catch( Throwable e )
{
- return "";
+ return null;
}
}
}

Added:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/GroupsPanel.java
==============================================================================
--- (empty file)
+++
development/main/depot/prefs/src/main/net/dpml/depot/prefs/GroupsPanel.java
Mon Jun 27 06:53:17 2005
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2004 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.prefs;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Window;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.rmi.RemoteException;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.AbstractAction;
+import javax.swing.SwingConstants;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.JScrollPane;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.JSplitPane;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableModel;
+import javax.swing.ListSelectionModel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.ImageIcon;
+
+import net.dpml.depot.profile.DepotProfile;
+import net.dpml.depot.profile.ApplicationProfile;
+import net.dpml.depot.profile.ActivationGroupProfile;
+
+import net.dpml.transit.model.DuplicateKeyException;
+import net.dpml.transit.model.UnknownKeyException;
+
+/**
+ * Runnable plugin that handles DPML environment setup.
+ *
+ * @author <a href="mailto:mcconnell AT osm.net";>OSM</a>
+ */
+class GroupsPanel extends ClassicPanel implements ListSelectionListener
+{
+ //--------------------------------------------------------------
+ // state
+ //--------------------------------------------------------------
+
+ private final Window m_parent;
+
+
+ private DepotProfile m_model;
+ private GroupsListModel m_data;
+ private JList m_list;
+ private ActivationGroupProfile m_selection;
+ private JSplitPane m_splitPane;
+
+ //--------------------------------------------------------------
+ // constructor
+ //--------------------------------------------------------------
+
+ public GroupsPanel( Window parent, DepotProfile model ) throws Exception
+ {
+ super();
+
+ m_model = model;
+ m_parent = parent;
+
+ m_data = new GroupsListModel( model );
+ m_list = new JList( m_data );
+ m_list.setCellRenderer( new GroupCellRenderer() );
+ m_splitPane = new JSplitPane();
+ JScrollPane scroller = new JScrollPane();
+ scroller.getViewport().setBackground( Color.WHITE );
+ scroller.setViewportView( m_list );
+ m_splitPane.setLeftComponent( scroller );
+ if( model.getActivationGroupProfileCount() > 0 )
+ {
+ ActivationGroupProfile profile =
model.getActivationGroupProfiles()[0];
+ ActivationGroupPanel panel = new ActivationGroupPanel( m_parent,
profile );
+ m_list.setSelectedIndex( 0 );
+ m_splitPane.setRightComponent( panel );
+
+ }
+ m_splitPane.setDividerLocation( 100 );
+ m_list.getSelectionModel().addListSelectionListener( this );
+ getBody().add( m_splitPane );
+ }
+
+ public void dispose()
+ {
+ m_list.getSelectionModel().removeListSelectionListener( this );
+ m_data.dispose();
+ }
+
+
//--------------------------------------------------------------------------
+ // ListSelectionListener
+
//--------------------------------------------------------------------------
+
+ /**
+ * Listens to changes in the selected state of the table and
+ * propergates a <code>ContextEvent</code> referencing this table as
+ * the event's panel when the table selection changes.
+ * @param event a list selection event
+ */
+ public void valueChanged( ListSelectionEvent event )
+ {
+ if( !event.getValueIsAdjusting() )
+ {
+ ListSelectionModel model = m_list.getSelectionModel();
+ synchronized( model )
+ {
+ Object old = m_selection;
+ m_selection = (ActivationGroupProfile)
m_list.getSelectedValue();
+ if( null != m_selection )
+ {
+ try
+ {
+ ActivationGroupPanel panel =
+ new ActivationGroupPanel( m_parent, m_selection );
+ m_splitPane.setRightComponent( panel );
+ m_splitPane.setDividerLocation( 100 );
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ //--------------------------------------------------------------
+ // utilities
+ //--------------------------------------------------------------
+
+ private class GroupCellRenderer extends JLabel implements
ListCellRenderer
+ {
+ public Component getListCellRendererComponent(
+ JList list, Object object, int index, boolean selected, boolean
focus )
+ {
+ try
+ {
+ ActivationGroupProfile profile = (ActivationGroupProfile)
object;
+ setIcon( MISC_ICON );
+ setText( profile.getID() );
+ setHorizontalAlignment( SwingConstants.CENTER );
+ setVerticalTextPosition( JLabel.BOTTOM );
+ setHorizontalTextPosition( JLabel.CENTER );
+ setBorder( border );
+ if( selected )
+ {
+ if( focus )
+ {
+ setBackground( ENABLED_COLOR );
+ }
+ else
+ {
+ setBackground( DISABLED_COLOR );
+ }
+ }
+ return this;
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ return this;
+ }
+ }
+ }
+
+ private static String MISC_IMG_PATH =
"net/dpml/depot/prefs/images/process.png";
+ private ImageIcon MISC_ICON =
+ IconHelper.createImageIcon( GroupsPanel.class.getClassLoader(),
MISC_IMG_PATH, "" );
+ static EmptyBorder border = new EmptyBorder( 5, 5, 5, 5);
+ static final Color ENABLED_COLOR = new Color( 204, 204, 255 );
+ static final Color DISABLED_COLOR = new Color( 228, 228, 255 );
+}

Added:
development/main/depot/prefs/src/main/net/dpml/depot/prefs/images/process.png
==============================================================================
Binary file. No diff available.

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
Mon Jun 27 06:53:17 2005
@@ -33,8 +33,7 @@

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

/**
* Test URL content handling.
@@ -116,27 +115,26 @@
private final static String PLUS_TEST_PART = "@PLUS-TEST-PART@";
private final static String CONTENT_MANAGER_PLUGIN =
"@CONTENT-MANAGER-PLUGIN@";

- private static TransitModel MODEL = null;
- private static Transit TRANSIT = null;
+ private static Transit TRANSIT;

- static
+ static
{
System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
System.setProperty(
+ "java.util.prefs.PreferencesFactory",
+ "net.dpml.transit.unit.LocalPreferencesFactory" );
+ System.setProperty( "dpml.transit.profile", "url-testcase" );
+ 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 );
- Preferences prefs = Preferences.userNodeForPackage(
Transit.class ).node( "test" ).node( "urls" );
- TransitHome home = new TransitStorageUnit( prefs );
- home.clearBeforeInitialization( true );
- TransitModel MODEL = home.create();
- MODEL.getContentRegistryModel().setCodeBaseURI( uri );
- TRANSIT = Transit.getInstance( MODEL );
+ TransitModel model = new DefaultTransitModel();
+ model.getContentRegistryModel().setCodeBaseURI( uri );
+ TRANSIT = Transit.getInstance( model );
}
catch( Throwable e )
{

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/Transit.java
Mon Jun 27 06:53:17 2005
@@ -45,8 +45,6 @@
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;

/**
* The Transit class manages the establishment of a singleton transit
instance
@@ -152,8 +150,7 @@
{
try
{
- TransitHome home = new TransitStorageUnit();
- TransitModel model = home.create();
+ TransitModel model = new DefaultTransitModel();
return getInstance( model );
}
catch( IOException e )
@@ -289,6 +286,11 @@
}
}

+ public LinkManager getLinkManager()
+ {
+ return getTransitContext().getLinkManager();
+ }
+
/**
* Returns a reference to the repository monitor router. Client
application
* may use the router to add, remove or replace existing monitors.

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/link/LinkURLConnection.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/link/LinkURLConnection.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/link/LinkURLConnection.java
Mon Jun 27 06:53:17 2005
@@ -17,9 +17,6 @@

package net.dpml.transit.link;

-import net.dpml.transit.SecuredTransitContext;
-import net.dpml.transit.util.MimeTypeHandler;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -32,6 +29,10 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedAction;

+import net.dpml.transit.Transit;
+import net.dpml.transit.SecuredTransitContext;
+import net.dpml.transit.util.MimeTypeHandler;
+
/**
* link: URL protocol connection processor.
*/
@@ -67,7 +68,7 @@
return;
m_connected = true;

- m_linkManager = SecuredTransitContext.getInstance().getLinkManager();
+ m_linkManager = Transit.getInstance().getLinkManager();

try
{

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
Mon Jun 27 06:53:17 2005
@@ -19,13 +19,27 @@
package net.dpml.transit.model;

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

-import net.dpml.transit.store.TransitHome;
+import net.dpml.transit.TransitError;
+import net.dpml.transit.adapter.LoggingAdapter;
+import net.dpml.transit.model.DefaultProxyModel;
+import net.dpml.transit.model.DefaultLayoutRegistryModel;
+import net.dpml.transit.model.DefaultContentRegistryModel ;
+import net.dpml.transit.model.DefaultRepositoryModel ;
+import net.dpml.transit.model.LayoutRegistryModel;
+import net.dpml.transit.model.ContentRegistryModel ;
+import net.dpml.transit.model.RepositoryModel ;
+import net.dpml.transit.model.ProxyModel ;
+import net.dpml.transit.store.TransitStorage;
+import net.dpml.transit.store.CodeBaseStorage;
+import net.dpml.transit.store.LayoutRegistryHome;
+import net.dpml.transit.store.ContentRegistryHome;
+import net.dpml.transit.store.ProxyStorage;
+import net.dpml.transit.store.CacheHome;
+import net.dpml.transit.unit.TransitStorageUnit;

/**
- * The DefaultTransitManager class maintains an active configuration of the
+ * The DefaultTransitModel class maintains an active configuration of the
* Transit system.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
@@ -36,51 +50,125 @@
// state
//
------------------------------------------------------------------------

+ private final TransitStorage m_store;
+ private final ProxyModel m_proxy;
+ private final LayoutRegistryModel m_layouts;
private final CacheModel m_cache;
- private final ContentRegistryModel m_registry;
+ private final ContentRegistryModel m_content;
private final RepositoryModel m_repository;
- private final ProxyModel m_proxy;
- private final TransitHome m_home;

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

- public DefaultTransitModel(
- Logger logger, TransitHome home, CacheModel cache,
- ContentRegistryModel content, RepositoryModel repository,
- ProxyModel proxy ) throws RemoteException
+ public DefaultTransitModel() throws RemoteException
+ {
+ this( new LoggingAdapter( "transit" ) );
+ }
+
+ public DefaultTransitModel( Logger logger ) throws RemoteException
+ {
+ this( logger, new TransitStorageUnit() );
+ }
+
+ public DefaultTransitModel( Logger logger, TransitStorage store ) throws
RemoteException
{
super( logger );

- if( null == home )
+ if( null == store )
{
- throw new NullPointerException( "home" );
+ throw new NullPointerException( "store" );
}
- if( null == cache )
+ m_store = store;
+
+ m_proxy = createProxyModel();
+ m_layouts = createLayoutRegistryModel();
+ m_cache = createCacheModel( m_layouts );
+ m_content = createContentRegistryModel();
+ m_repository = createRepositoryModel();
+ }
+
+ private ProxyModel createProxyModel()
+ {
+ try
{
- throw new NullPointerException( "cache" );
+ ProxyStorage unit = m_store.getProxyStorage();
+ Logger logger = getLogger().getChildLogger( "proxy" );
+ return new DefaultProxyModel( logger, unit );
}
- if( null == content )
+ catch( Throwable e )
{
- throw new NullPointerException( "content" );
+ final String error =
+ "An error occured during construction of the proxy storage
unit.";
+ throw new TransitError( error, e );
}
- if( null == repository )
+ }
+
+ private LayoutRegistryModel createLayoutRegistryModel()
+ {
+ try
{
- throw new NullPointerException( "repository" );
+ Logger logger = getLogger().getChildLogger( "cache"
).getChildLogger( "layout" );
+ LayoutRegistryHome store = m_store.getLayoutRegistryHome();
+ return new DefaultLayoutRegistryModel( logger, store );
}
- if( null == proxy )
+ catch( Throwable e )
{
- throw new NullPointerException( "proxy" );
+ final String error =
+ "An error occured during construction of the layout storage
home.";
+ throw new TransitError( error, e );
}
+ }

- m_cache = cache;
- m_registry = content;
- m_repository = repository;
- m_proxy = proxy;
- m_home = home;
+ private CacheModel createCacheModel( LayoutRegistryModel layouts )
+ {
+ try
+ {
+ CacheHome store = m_store.getCacheHome();
+ Logger logger = getLogger().getChildLogger( "cache" );
+ return new DefaultCacheModel( logger, store, layouts );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "An error occured during construction of the cache storage
unit.";
+ throw new TransitError( error, e );
+ }
+ }
+
+ private ContentRegistryModel createContentRegistryModel()
+ {
+ try
+ {
+ ContentRegistryHome store = m_store.getContentRegistryHome();
+ 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
model.";
+ throw new TransitError( error, e );
+ }
}

+ private RepositoryModel createRepositoryModel()
+ {
+ try
+ {
+ CodeBaseStorage store = m_store.getRepositoryStorage();
+ 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 TransitError( error, e );
+ }
+ }
+
+
//
------------------------------------------------------------------------
// TransitMananger
//
------------------------------------------------------------------------
@@ -91,7 +179,7 @@
*/
public String getID()
{
- return m_home.getID();
+ return m_store.getID();
}

/**
@@ -119,7 +207,7 @@
*/
public ContentRegistryModel getContentRegistryModel()
{
- return m_registry;
+ return m_content;
}

/**
@@ -131,6 +219,5 @@
{
return m_repository;
}
-
}


Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitHome.java
Mon Jun 27 06:53:17 2005
@@ -18,11 +18,6 @@

package net.dpml.transit.store;

-import java.net.URL;
-
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.TransitModel;
-
/**
* The Home defines the persistent storage home for transit management
configurations.
*
@@ -30,22 +25,9 @@
*/
public interface TransitHome
{
- /**
- * Return the home identifier.
- * @return the home id
- */
- String getID();
-
- void setLogger( Logger logger );
-
- void setProfile( String profile );
-
- void setAuthority( URL authority );
-
- void useFactoryInitialization( boolean policy );
-
- void clearBeforeInitialization( boolean policy );
+ TransitStorage getDefaultTransitStorage();

- TransitModel create();
+ TransitStorage getTransitStorage( String id );

+ String[] getProfileNames();
}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitStorage.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/store/TransitStorage.java
Mon Jun 27 06:53:17 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 net.dpml.transit.model.Logger;
+import net.dpml.transit.model.TransitModel;
+
+/**
+ * The Home defines the persistent storage home for transit management
configurations.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public interface TransitStorage
+{
+ /**
+ * Return the Transit storage instance identifier.
+ * @return the transit persistent id
+ */
+ String getID();
+
+ /**
+ * Return the proxy strorage unit.
+ * @return the proxy storage
+ */
+ ProxyStorage getProxyStorage();
+
+ /**
+ * Return the cache strorage unit.
+ * @return the proxy storage
+ */
+ CacheHome getCacheHome();
+
+ /**
+ * Return the layout registry storage unit.
+ * @return the layout registry storage
+ */
+ LayoutRegistryHome getLayoutRegistryHome();
+
+ /**
+ * Return the content registry storage unit.
+ * @return the content registry storage
+ */
+ ContentRegistryHome getContentRegistryHome();
+
+ /**
+ * Return the repository codebase storage unit.
+ * @return the repository system storage
+ */
+ CodeBaseStorage getRepositoryStorage();
+
+}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/CacheStorageUnit.java
Mon Jun 27 06:53:17 2005
@@ -32,8 +32,10 @@
import net.dpml.transit.util.PropertyResolver;

/**
- * The LayoutRegistryHelper class provides support for the crreating of a
- * ContentRegistryModel based on a supplied preferences node.
+ * The CacheStorageUnit class maintains persistent information about a
+ * cache location, a cache layout strategy, and a set of associated host
+ * storage units. The class also provides support for creation and removal
+ * host storage units.
*/
class CacheStorageUnit extends CodeBaseStorageUnit implements CacheHome,
Removable
{

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LocalPreferences.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LocalPreferences.java
Mon Jun 27 06:53:17 2005
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.transit.unit;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.prefs.Preferences;
+import java.util.prefs.AbstractPreferences;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.PreferencesFactory;
+
+import net.dpml.transit.Transit;
+
+/**
+ * An implementation of Preferences based on java.util.Properties.
+ */
+public class LocalPreferences extends AbstractPreferences
+{
+ private final Properties m_properties;
+ private Hashtable m_table = new Hashtable();
+
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public LocalPreferences( LocalPreferences parent, String name )
+ {
+ super( parent, name );
+ m_properties = new Properties();
+ }
+
+ //
------------------------------------------------------------------------
+ // LocalPreferences
+ //
------------------------------------------------------------------------
+
+ protected void putSpi( String key, String value )
+ {
+ getProperties().setProperty( key, value );
+ }
+
+ protected String getSpi( String key )
+ {
+ return getProperties().getProperty( key );
+ }
+
+ protected void removeSpi( String key )
+ {
+ getProperties().remove( key );
+ }
+
+ protected void removeNodeSpi() throws BackingStoreException
+ {
+ LocalPreferences parent = (LocalPreferences) parent();
+ if( null != parent )
+ {
+ parent.removeNode( name() );
+ }
+ }
+
+ protected String[] keysSpi() throws BackingStoreException
+ {
+ return (String[]) m_properties.keySet().toArray( new String[0] );
+ }
+
+ protected String[] childrenNamesSpi() throws BackingStoreException
+ {
+ return (String[]) m_table.keySet().toArray( new String[0] );
+ }
+
+ protected AbstractPreferences childSpi( String name )
+ {
+ synchronized( m_table )
+ {
+ LocalPreferences prefs = (LocalPreferences) m_table.get( name );
+ if( null != prefs )
+ {
+ return prefs;
+ }
+ else
+ {
+ LocalPreferences p = new LocalPreferences( this, name );
+ m_table.put( name, p );
+ return p;
+ }
+ }
+ }
+
+ protected void syncSpi() throws BackingStoreException
+ {
+ }
+
+ protected void flushSpi() throws BackingStoreException
+ {
+ }
+
+ void removeNode( String name )
+ {
+ synchronized( m_table )
+ {
+ m_table.remove( name );
+ }
+ }
+
+ private Properties getProperties()
+ {
+ return m_properties;
+ }
+}

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LocalPreferencesFactory.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/LocalPreferencesFactory.java
Mon Jun 27 06:53:17 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.transit.unit;
+
+import java.io.File;
+import java.util.Properties;
+import java.util.prefs.Preferences;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.PreferencesFactory;
+
+import net.dpml.transit.Transit;
+import net.dpml.transit.TransitError;
+
+/**
+ * <p>A transient non-persistent implementation of the Preferences services.
This
+ * implementation holds preferences attribue values in memory using
Properties.
+ * The implementation is suitable for the construction of preferences that
for
+ * usage in nono-shared scenarios (such as testcases or short running
applications).
+ * The preference implementation is established via declaration of the
following
+ * system property prior to preferences usage:</p>
+ *
+ * <pre>
+ * System.setProperty(
+ * "java.util.prefs.PreferencesFactory",
+ * "net.dpml.transit.unit.LocalPreferencesFactory" );
+ * </pre>
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class LocalPreferencesFactory implements PreferencesFactory
+{
+ //
------------------------------------------------------------------------
+ // PreferencesFactory
+ //
------------------------------------------------------------------------
+
+ public Preferences systemRoot()
+ {
+ return new LocalPreferences( null, "" );
+ }
+
+ public Preferences userRoot()
+ {
+ return new LocalPreferences( null, "" );
+ }
+}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitPreferences.java
Mon Jun 27 06:53:17 2005
@@ -55,7 +55,7 @@
* The TransitInstaller class is responsible for the setup of initial factory
* default preference settings.
*/
-class TransitPreferences
+public class TransitPreferences
{

//--------------------------------------------------------------------------
// static

Added:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageHome.java
==============================================================================
--- (empty file)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageHome.java
Mon Jun 27 06:53:17 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2005 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.transit.unit;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.rmi.registry.Registry;
+import java.rmi.activation.ActivationSystem;
+import java.util.Date;
+import java.util.Properties;
+import java.util.prefs.Preferences;
+import java.util.prefs.BackingStoreException;
+
+import net.dpml.transit.Transit;
+import net.dpml.transit.TransitError;
+import net.dpml.transit.store.TransitHome;
+import net.dpml.transit.store.TransitStorage;
+
+/**
+ * The TransitStorageUnit is responsible for the construction of persistent
+ * storage units for all Transit subsystems.
+ */
+public class TransitStorageHome extends AbstractStorageUnit implements
TransitHome
+{
+ //
------------------------------------------------------------------------
+ // constructor
+ //
------------------------------------------------------------------------
+
+ public TransitStorageHome()
+ {
+ super( Preferences.userNodeForPackage( Transit.class ) );
+ }
+
+ //
------------------------------------------------------------------------
+ // TransitHome
+ //
------------------------------------------------------------------------
+
+ public TransitStorage getDefaultTransitStorage()
+ {
+ return new TransitStorageUnit();
+ }
+
+ public TransitStorage getTransitStorage( String id )
+ {
+ return new TransitStorageUnit( id );
+ }
+
+ public String[] getProfileNames()
+ {
+ try
+ {
+ return getProfilesNode().childrenNames();
+ }
+ catch( BackingStoreException e )
+ {
+ final String error =
+ "Preferences storage is unavailable.";
+ throw new TransitError( error, e );
+ }
+ }
+
+ //
------------------------------------------------------------------------
+ // impl
+ //
------------------------------------------------------------------------
+
+ private Preferences getProfilesNode()
+ {
+ return getPreferences().node( "profiles" );
+ }
+}

Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/TransitStorageUnit.java
Mon Jun 27 06:53:17 2005
@@ -28,52 +28,29 @@
import net.dpml.transit.Transit;
import net.dpml.transit.TransitError;
import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.model.Logger;
-import net.dpml.transit.model.Connection;
-import net.dpml.transit.model.DefaultTransitModel;
-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;
-import net.dpml.transit.model.ProxyModel;
-import net.dpml.transit.model.RepositoryModel;
-import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.model.VetoDisposalException;
-import net.dpml.transit.store.TransitHome;
+import net.dpml.transit.store.TransitStorage;
+import net.dpml.transit.store.ProxyStorage;
+import net.dpml.transit.store.CacheHome;
+import net.dpml.transit.store.LayoutRegistryHome;
+import net.dpml.transit.store.ContentRegistryHome;
+import net.dpml.transit.store.CodeBaseStorage;
import net.dpml.transit.util.PropertyResolver;

/**
- *
+ * The TransitStorageUnit is responsible for the construction of persistent
+ * storage units for all Transit subsystems.
*/
-public class TransitStorageUnit implements TransitHome
+public class TransitStorageUnit extends AbstractStorageUnit implements
TransitStorage
{
//
------------------------------------------------------------------------
- // static
- //
------------------------------------------------------------------------
-
- 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";
- private static final String PROFILE_KEY = "dpml.transit.profile";
- private static final String AUTHORITY_KEY = "dpml.transit.authority";
-
- //
------------------------------------------------------------------------
// state
//
------------------------------------------------------------------------

- private Logger m_logger;
- private Preferences m_prefs;
- private URL m_authority;
- private boolean m_readonly = false;
- private boolean m_factoryPolicy = true;
- private boolean m_purgePolicy = false;
- private String m_profile;
+ private final ProxyStorage m_proxy;
+ private final CacheHome m_cache;
+ private final LayoutRegistryHome m_layout;
+ private final ContentRegistryHome m_content;
+ private final RepositoryStorageUnit m_repository;

//
------------------------------------------------------------------------
// constructor
@@ -81,310 +58,159 @@

public TransitStorageUnit()
{
- String auth = System.getProperty( AUTHORITY_KEY, null );
- if( null != auth )
- {
- Properties properties = new Properties( System.getProperties() );
- properties.setProperty( Transit.HOME_KEY,
Transit.DPML_HOME.toString() );
- properties.setProperty( Transit.PREFS_KEY,
Transit.DPML_PREFS.toString() );
- properties.setProperty( Transit.DATA_KEY,
Transit.DPML_DATA.toString() );
- properties.setProperty( Transit.SYSTEM_KEY,
Transit.DPML_SYSTEM.toString() );
- String path = PropertyResolver.resolve( properties, auth );
- try
- {
- m_authority = new URL( path );
- m_purgePolicy = true;
- }
- catch( MalformedURLException e )
- {
- final String error =
- "Invaid authority url: " + path;
- throw new TransitError( error, e );
- }
- }
- }
-
- public TransitStorageUnit( Preferences prefs )
- {
- m_prefs = prefs;
- }
-
- //
------------------------------------------------------------------------
- // Home
- //
------------------------------------------------------------------------
-
- /**
- * Return the home identifier.
- * @return the home id
- */
- public String getID()
- {
- return getPreferences().absolutePath();
- }
-
- //
------------------------------------------------------------------------
- // impl
- //
------------------------------------------------------------------------
-
- public void setLogger( Logger logger )
- {
- if( null == m_logger )
- {
- m_logger = logger;
- }
- else
- {
- throw new IllegalStateException( "logger already set" );
- }
- }
-
- public void setAuthority( URL authority )
- {
- if( null == m_authority )
- {
- m_authority = authority;
- }
- else
- {
- throw new IllegalStateException( "authority already set" );
- }
+ this( getDefaultProfileName() );
}

- public void useFactoryInitialization( boolean policy )
+ public TransitStorageUnit( String profile )
{
- m_factoryPolicy = policy;
+ this( Preferences.userNodeForPackage( Transit.class ).node(
"profiles" ).node( profile ) );
}

- public void clearBeforeInitialization( boolean policy )
- {
- m_purgePolicy = policy;
- }
-
- public void setProfile( String profile )
+ public TransitStorageUnit( Preferences prefs )
{
- m_profile = profile;
- }
+ super( prefs );

- public TransitModel create()
- throws BuilderException
- {
- Logger logger = getLogger();
- Preferences prefs = getPreferences();
URL authority = getAuthority();
-
- if( m_purgePolicy )
+ if( null != authority )
{
- getLogger().debug( "Purging: " + prefs );
- try
- {
- String[] names = prefs.childrenNames();
- for( int i=0; i<names.length; i++ )
- {
- Preferences child = prefs.node( names[i] );
- child.removeNode();
- }
- prefs.clear();
- }
- catch( BackingStoreException e )
- {
- final String error =
- "Internal error while attempting to purge preferences.";
- throw new BuilderException( error, e );
- }
- }
-
- //
- // check for virgin prefs
- //
-
- if( null != m_authority )
- {
- getLogger().debug( "Initializing: " + prefs );
TransitPreferences.setupPreferences( prefs, authority );
}
- else if( m_factoryPolicy )
+ else
{
long install = prefs.getLong( "installation", -1 );
if( install < 0 )
{
- getLogger().debug( "Initializing: " + prefs );
TransitPreferences.setupFactoryPreferences( prefs );
}
}

- //
- // setup the storage homes for the proxy, cache, content handler and
- // repository sub-systems (layout and hosts are handled within the
- // cache system setup)
- //
-
- ProxyModel proxy = createProxyModel();
- CacheModel cache = createCacheModel();
- ContentRegistryModel content = createContentRegistryModel();
- RepositoryModel repository = createRepositoryModel();
-
- //
- // put the model together
- //
-
try
{
- return new DefaultTransitModel(
- logger, this, cache, content, repository, proxy );
+ Preferences proxy = getPreferences().node( "proxy" );
+ m_proxy = new ProxyStorageUnit( proxy );
+ Preferences cache = getPreferences().node( "cache" );
+ m_cache = new CacheStorageUnit( cache );
+ Preferences layout = getPreferences().node( "cache" ).node(
"layout" );
+ m_layout = new LayoutRegistryStorageUnit( layout );
+ Preferences content = getPreferences().node( "content" );
+ m_content = new ContentRegistryStorageUnit( prefs );
+ Preferences repo = getPreferences().node( "repository" );
+ m_repository = new RepositoryStorageUnit( repo );
}
catch( Throwable e )
{
final String error =
- "An error occured during construction of the transit model.";
- throw new BuilderException( error, e );
+ "Internal error occured whuile constructing a Transit storage
unit."
+ + "\nBacking store: " + prefs;
+ throw new TransitError( error, e );
}
}

- private ProxyModel createProxyModel() throws BuilderException
+ //
------------------------------------------------------------------------
+ // TransitStorage
+ //
------------------------------------------------------------------------
+
+ /**
+ * Return the Transit storage instance identifier.
+ * @return the transit persistent id
+ */
+ public String getID()
{
- try
- {
- Preferences prefs = getPreferences().node( "proxy" );
- ProxyStorageUnit unit = new ProxyStorageUnit( prefs );
- Logger logger = getLogger().getChildLogger( "proxy" );
- return new DefaultProxyModel( logger, unit );
- }
- catch( Throwable e )
- {
- final String error =
- "An error occured during construction of the proxy storage
unit.";
- throw new BuilderException( error, e );
- }
+ return getPreferences().name();
}

- private CacheModel createCacheModel() throws BuilderException
+ /**
+ * Return the proxy strorage unit.
+ * @return the proxy storage
+ */
+ public ProxyStorage getProxyStorage()
{
- try
- {
- 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 cache storage
unit.";
- throw new BuilderException( error, e );
- }
+ return m_proxy;
}

- private LayoutRegistryModel createLayoutRegistryModel()
- throws BuilderException
+ /**
+ * Return the cache strorage unit.
+ * @return the proxy storage
+ */
+ public CacheHome getCacheHome()
{
- Logger logger = getLogger().getChildLogger( "cache"
).getChildLogger( "layout" );
- Preferences prefs = getPreferences().node( "cache" ).node( "layout"
);
- try
- {
- LayoutRegistryStorageUnit store = new LayoutRegistryStorageUnit(
prefs );
- return new DefaultLayoutRegistryModel( logger, store );
- }
- catch( Throwable e )
- {
- final String error =
- "An error occured during construction of the layout storage
home.";
- throw new BuilderException( error, e );
- }
- }
+ return m_cache;
+ }

- private ContentRegistryModel createContentRegistryModel() throws
BuilderException
+ /**
+ * Return the layout registry storage unit.
+ * @return the layout registry storage
+ */
+ public LayoutRegistryHome getLayoutRegistryHome()
{
- try
- {
- Preferences prefs = getPreferences().node( "content" );
- 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
model.";
- throw new BuilderException( error, e );
- }
+ return m_layout;
}

+ /**
+ * Return the content registry storage unit.
+ * @return the content storage
+ */
+ public ContentRegistryHome getContentRegistryHome()
+ {
+ return m_content;
+ }

- private RepositoryModel createRepositoryModel() throws BuilderException
+ /**
+ * Return the repository storage unit.
+ * @return the repository storage
+ */
+ public CodeBaseStorage getRepositoryStorage()
{
- 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 );
- }
+ return m_repository;
}

- private Preferences getPreferences()
+ private static Preferences getPreferencesForProfile( String profile )
{
- String profile = getProfileName();
return getRootPreferences().node( profile );
}

- private Preferences getRootPreferences()
+ private static Preferences getRootPreferences()
{
- if( null == m_prefs )
- {
- return ROOT_PREFS;
- }
- else
- {
- return m_prefs;
- }
+ return Preferences.userNodeForPackage( Transit.class ).node(
"profiles" );
}

- private Logger getLogger()
+ private URL getAuthority()
{
- if( null == m_logger )
+ String auth = System.getProperty( AUTHORITY_KEY, null );
+ if( null != auth )
{
- return getDefaultLogger();
+ Properties properties = new Properties( System.getProperties() );
+ properties.setProperty( Transit.HOME_KEY,
Transit.DPML_HOME.toString() );
+ properties.setProperty( Transit.PREFS_KEY,
Transit.DPML_PREFS.toString() );
+ properties.setProperty( Transit.DATA_KEY,
Transit.DPML_DATA.toString() );
+ properties.setProperty( Transit.SYSTEM_KEY,
Transit.DPML_SYSTEM.toString() );
+ String path = PropertyResolver.resolve( properties, auth );
+ try
+ {
+ return new URL( path );
+ }
+ catch( MalformedURLException e )
+ {
+ final String error =
+ "Invaid authority url: " + path;
+ throw new TransitError( error, e );
+ }
}
- return m_logger;
- }
-
- private static Logger getDefaultLogger()
- {
- if( null == DEFAULT_LOGGER )
+ else
{
- DEFAULT_LOGGER = new LoggingAdapter();
+ return null;
}
- return DEFAULT_LOGGER;
}

- private URL getAuthority()
+ private static String getDefaultProfileName()
{
- return m_authority;
+ return System.getProperty( PROFILE_KEY, DEFAULT_PROFILE_NAME );
}

- private boolean getStoragePolicy()
- {
- return !m_readonly;
- }
+ private static final String DEFAULT_PROFILE_NAME = "default";
+ private static final String PROFILE_KEY = "dpml.transit.profile";
+ private static final String AUTHORITY_KEY = "dpml.transit.authority";

- private String getProfileName()
- {
- if( null == m_profile )
- {
- return System.getProperty( PROFILE_KEY, DEFAULT_PROFILE_NAME );
- }
- else
- {
- return m_profile;
- }
- }
}



Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/unit/package.html
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/unit/package.html
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/unit/package.html
Mon Jun 27 06:53:17 2005
@@ -1,8 +1,14 @@

<body>
<p>
-The builder package contains a set of storage units for Transit
configurations
-based on the Java Preferences package.
-</p>.
+The Unit package contains storage unit implementations backed by the
java.util.prefs package. The class TransitStorageUnit represents the root
storage unit that is supplied as a constuctor argument when creating a new
TransitModel. TransitStorageUnit agregates a set of subsidiary storage units
representing the persistent storage models of the different Transit
sub-systems.
+</p>
+<ol>
+ <li>ProxyStorageUnit maintains infomration about proxy settings.</li>
+ <li>LayoutRegistryStorageUnit maintains information about a set of
LayoutStorage strategies used for the cache layout and remote host
layouts.</li>
+ <li>ContentRegistryStorageUnit maintains the available set of
ContentStorage units for plugin content handlers which is ultimately used
when dealing with URL.getContent() operations.</li>
+ <li>CacheStorageUnit maintains information about a cache directory and a
set of HostStorageUnit instances each representing the persistent state of a
remote host configuration.
+</ol>
+
</body>


Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/manager/ProxyManagerTestCase.java
Mon Jun 27 06:53:17 2005
@@ -36,26 +36,29 @@
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;
+import net.dpml.transit.model.DefaultTransitModel;

/**
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
public class ProxyManagerTestCase extends TestCase
{
+ static
+ {
+ System.setProperty( "dpml.data", "target/test/data" );
+ System.setProperty(
+ "java.util.prefs.PreferencesFactory",
+ "net.dpml.transit.unit.LocalPreferencesFactory" );
+ System.setProperty( "dpml.transit.profile", "test-proxy" );
+ }
+
private TransitModel m_model;
private File m_data;

public void setUp() throws Exception
{
- String path = "target/test/data";
- m_data = new File( path );
- System.setProperty( "dpml.data", path );
- Preferences prefs =
- Preferences.userNodeForPackage( Transit.class ).node( "test"
).node( "proxy-test" );
- TransitHome home = new TransitStorageUnit( prefs );
- m_model = home.create();
+ m_data = new File( System.getProperty( "dpml.data" ) );
+ m_model = new DefaultTransitModel();
}

public void testProxyAuthenticationListener() throws Exception

Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/manager/TransitManagerTestCase.java
Mon Jun 27 06:53:17 2005
@@ -21,35 +21,33 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.util.Date;
-import java.util.prefs.Preferences;

import junit.framework.TestCase;

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

/**
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
*/
public class TransitManagerTestCase extends TestCase
{
+ static
+ {
+ System.setProperty( "dpml.data", "target/test/data" );
+ System.setProperty(
+ "java.util.prefs.PreferencesFactory",
+ "net.dpml.transit.unit.LocalPreferencesFactory" );
+ System.setProperty( "dpml.transit.profile", "test-cache" );
+ }
+
private TransitModel m_model;
private File m_data;

public void setUp() throws Exception
{
- String path = "target/test/data";
- m_data = new File( path );
- System.setProperty( "dpml.data", path );
- Preferences prefs = Preferences.userNodeForPackage( Transit.class
).node( "test" ).node( "transitm" );
- TransitHome home = new TransitStorageUnit( prefs );
- home.clearBeforeInitialization( true );
- m_model = home.create();
+ m_data = new File( System.getProperty( "dpml.data" ) );
+ m_model = new DefaultTransitModel();
}

public void testCacheDirectory() throws Exception

Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/test/AuthorityTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/test/AuthorityTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/test/AuthorityTestCase.java
Mon Jun 27 06:53:17 2005
@@ -32,12 +32,6 @@

import junit.framework.TestCase;

-import net.dpml.transit.Transit;
-import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.store.TransitHome;
-import net.dpml.transit.unit.TransitStorageUnit;
-
/**
* URL Handler TestCase for Offline operations.
*
@@ -46,17 +40,16 @@
*/
public class AuthorityTestCase extends TestCase
{
- private static Transit TRANSIT = null;
-
- protected void setUp() throws Exception
+ static
{
System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
System.setProperty( "dpml.transit.authority",
"file:${dpml.prefs}/transit/authority" );
System.setProperty( "dpml.transit.profile", "test-authority" );
- TRANSIT = Transit.getInstance();
+ System.setProperty(
+ "java.util.prefs.PreferencesFactory",
"net.dpml.transit.unit.LocalPreferencesFactory" );
}

- public void testNothing() throws Exception
+ public void testURIResolution() throws Exception
{
URL url = new URL( "artifact:jar:junit/junit#3.8.1" );
url.getContent();

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
Mon Jun 27 06:53:17 2005
@@ -28,13 +28,8 @@

import junit.framework.TestCase;

-import net.dpml.transit.Transit;
import net.dpml.transit.artifact.ArtifactNotFoundException;
-import net.dpml.transit.adapter.LoggingAdapter;
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;

/**
@@ -44,26 +39,27 @@
*/
public class LinkTestCase extends TestCase
{
- private static Transit TRANSIT;
+ static
+ {
+ System.setProperty(
+ "java.util.prefs.PreferencesFactory",
+ "net.dpml.transit.unit.LocalPreferencesFactory" );
+ System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
+ System.setProperty( "dpml.transit.profile", "test-link" );
+ try
+ {
+ String authority = new File( "target/test" ).toURL().toString();
+ System.setProperty( "dpml.transit.authority", authority );
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ }
+ }

protected void setUp() throws Exception
{
new File( "target/test/cache" ).delete();
- if( null == TRANSIT )
- {
- System.setProperty( "java.protocol.handler.pkgs",
"net.dpml.transit" );
- Preferences prefs =
- Preferences.userNodeForPackage( Transit.class
).node("test").node( "link-test" );
- URL authority = new File( "target/test" ).toURL();
- Logger logger = Logger.getLogger( "test" );
- //logger.setLevel( Level.parse( "FINE" ) );
- LoggingAdapter adapter = new LoggingAdapter( logger );
- TransitHome home = new TransitStorageUnit( prefs );
- home.clearBeforeInitialization( true );
- home.setAuthority( authority );
- TransitModel model = home.create();
- TRANSIT = Transit.getInstance( model );
- }
}

/**

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
Mon Jun 27 06:53:17 2005
@@ -33,12 +33,6 @@

import junit.framework.TestCase;

-import net.dpml.transit.Transit;
-import net.dpml.transit.adapter.LoggingAdapter;
-import net.dpml.transit.store.TransitHome;
-import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.unit.TransitStorageUnit;
-
/**
* URL Handler TestCase for Offline operations.
*
@@ -47,27 +41,27 @@
*/
public class OfflineTestCase extends TestCase
{
- private static Transit TRANSIT;
+ static
+ {
+ System.setProperty(
+ "java.util.prefs.PreferencesFactory",
+ "net.dpml.transit.unit.LocalPreferencesFactory" );
+ System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
+ System.setProperty( "dpml.transit.profile", "test-offline" );
+ try
+ {
+ String authority = new File( "target/test" ).toURL().toString();
+ System.setProperty( "dpml.transit.authority", authority );
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ }
+ }

protected void setUp() throws Exception
{
new File( "target/test/cache" ).delete();
- if( null == TRANSIT )
- {
- System.setProperty( "java.protocol.handler.pkgs",
"net.dpml.transit" );
- Preferences prefs =
- Preferences.userNodeForPackage( Transit.class
).node("test").node( "offline-test" );
- URL authority = new File( "target/test" ).toURL();
- Logger logger = Logger.getLogger( "test" );
- //logger.setLevel( Level.parse( "FINE" ) );
- LoggingAdapter adapter = new LoggingAdapter( logger );
- TransitHome home = new TransitStorageUnit( prefs );
- home.clearBeforeInitialization( true );
- home.setAuthority( authority );
- home.setLogger( adapter );
- TransitModel model = home.create();
- TRANSIT = Transit.getInstance( model );
- }
}

public void testDownloadNoVersion()

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
Mon Jun 27 06:53:17 2005
@@ -31,11 +31,6 @@

import junit.framework.TestCase;

-import net.dpml.transit.Transit;
-import net.dpml.transit.model.TransitModel;
-import net.dpml.transit.store.TransitHome;
-import net.dpml.transit.unit.TransitStorageUnit;
-
/**
* URL Handler TestCase for Offline operations.
*
@@ -44,19 +39,13 @@
*/
public class OnlineTestCase extends TestCase
{
- private static Transit TRANSIT = null;
-
- protected void setUp() throws Exception
+ static
{
- if( null == TRANSIT )
- {
- Preferences prefs =
- Preferences.userNodeForPackage( Transit.class
).node("test").node( "online-test" );
- TransitHome home = new TransitStorageUnit( prefs );
- home.clearBeforeInitialization( true );
- TransitModel model = home.create();
- TRANSIT = Transit.getInstance( model );
- }
+ System.setProperty(
+ "java.util.prefs.PreferencesFactory",
+ "net.dpml.transit.unit.LocalPreferencesFactory" );
+ System.setProperty( "java.protocol.handler.pkgs", "net.dpml.transit"
);
+ System.setProperty( "dpml.transit.profile", "test-online" );
}

public void testStackedJarUrl() throws Exception

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
Mon Jun 27 06:53:17 2005
@@ -31,8 +31,7 @@
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;
+import net.dpml.transit.model.DefaultTransitModel;

/**
* Ant task that provides support for the import of build file templates
@@ -53,10 +52,8 @@
setTaskName( "import" );
try
{
- TransitHome home = new TransitStorageUnit();
Logger logger = new AntAdapter( this );
- home.setLogger( logger );
- TransitModel model = home.create();
+ TransitModel model = new DefaultTransitModel( logger );
Transit.getInstance( model );
}
catch( TransitAlreadyInitializedException e )



  • svn commit: r2926 - in development/main: depot/console/src/main/net/dpml/depot depot/console/src/main/net/dpml/depot/profile depot/prefs/src/main/net/dpml/depot/prefs depot/prefs/src/main/net/dpml/depot/prefs/images 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/link 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/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/27/2005

Archive powered by MHonArc 2.6.24.

Top of Page