Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2520 - in development/main/depot: console console/src/main/net/dpml/depot/console console/src/main/net/dpml/depot/logging console/src/main/net/dpml/depot/logging/nodes content/src/main/net/dpml/depot/content station/src/main/net/dpml/depot/prefs

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: r2520 - in development/main/depot: console console/src/main/net/dpml/depot/console console/src/main/net/dpml/depot/logging console/src/main/net/dpml/depot/logging/nodes content/src/main/net/dpml/depot/content station/src/main/net/dpml/depot/prefs
  • Date: Thu, 12 May 2005 08:32:27 +0000

Author: mcconnell AT dpml.net
Date: Thu May 12 08:32:25 2005
New Revision: 2520

Added:

development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryInstaller.java
Modified:
development/main/depot/console/build.xml
development/main/depot/console/src/main/net/dpml/depot/console/Main.java

development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java

development/main/depot/console/src/main/net/dpml/depot/logging/ExceptionHelper.java

development/main/depot/console/src/main/net/dpml/depot/logging/LoggingManager.java

development/main/depot/console/src/main/net/dpml/depot/logging/StandardFormatter.java

development/main/depot/console/src/main/net/dpml/depot/logging/nodes/Nodes.java

development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerDescriptor.java

development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistry.java

development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryControlPanel.java

development/main/depot/station/src/main/net/dpml/depot/prefs/ContentHandlerControllerPanel.java
development/main/depot/station/src/main/net/dpml/depot/prefs/Main.java
Log:
Putting in place logging configuration independently of Transit.

Modified: development/main/depot/console/build.xml
==============================================================================
--- development/main/depot/console/build.xml (original)
+++ development/main/depot/console/build.xml Thu May 12 08:32:25 2005
@@ -9,6 +9,7 @@
<target name="init" depends="standard.init">
<property name="depot.w32.main"
value="dpml\depot\jars\dpml-depot-console-${project.version}.jar"/>
<filter token="DEPOT-PATH-FOR-WINDOWS" value="${depot.w32.main}" />
+
</target>

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

Modified:
development/main/depot/console/src/main/net/dpml/depot/console/Main.java
==============================================================================
--- development/main/depot/console/src/main/net/dpml/depot/console/Main.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/console/Main.java
Thu May 12 08:32:25 2005
@@ -22,6 +22,7 @@
import java.io.IOException;
import java.util.Properties;
import java.util.prefs.Preferences;
+import java.util.prefs.BackingStoreException;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.StringTokenizer;
@@ -161,12 +162,38 @@
else
{
Class c = classloader.loadClass( classname );
- loadClass( c, args );
+ setup( profile.node( "properties" ) );
+ deploy( c, args );
}
}
else
{
- System.err.println( "# bad system classloader: " +
system.getClass().getName() );
+ final String error =
+ "The Depot CLI handler must be invoked with the
\"java.system.class.loader\" "
+ + "system property with the value of \""
+ + DepotClassLoader.class.getName()
+ + "\".";
+ System.err.println( "DEPOT: Bad system classloader: " +
system.getClass().getName() );
+ System.err.println( error );
+ }
+ }
+ }
+
+ /**
+ * Setup the system properties for the target.
+ * @param prefs the profile's system properties preferences node
+ */
+ private static void setup( Preferences prefs ) throws
BackingStoreException
+ {
+ 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 )
+ {
+System.out.println( "setting: " + key + " = " + value );
+ System.setProperty( key, value );
}
}
}
@@ -184,7 +211,7 @@
}
}

- private static void loadClass( Class c, String[] args ) throws Exception
+ private static void deploy( Class c, String[] args ) throws Exception
{
try
{

Modified:
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
Thu May 12 08:32:25 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.transit.logging;
+package net.dpml.depot.logging;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -26,7 +26,7 @@
import java.util.logging.Level;
import java.util.prefs.Preferences;

-import net.dpml.transit.logging.nodes.Nodes;
+import net.dpml.depot.logging.nodes.Nodes;

/**
* Utility class used to establish the logging configuration. The contents
of

Modified:
development/main/depot/console/src/main/net/dpml/depot/logging/ExceptionHelper.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/logging/ExceptionHelper.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/logging/ExceptionHelper.java
Thu May 12 08:32:25 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 Stephen J. McConnell.
+ * Copyright 2004-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.
@@ -16,15 +16,13 @@
* limitations under the License.
*/

-package net.dpml.transit.util;
+package net.dpml.depot.logging;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.util.StringTokenizer;

-import net.dpml.lang.NullArgumentException;
-
/**
* General utilities supporting the packaging of exception messages.
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
@@ -255,14 +253,14 @@
* Get a causal exception using reflection.
* @param exception the exception
* @return the causal exception
- * @exception NullArgumentException if the exception argument is null.
+ * @exception NullPointerException if the exception argument is null.
*/
private static Throwable getCause( Throwable exception )
- throws NullArgumentException
+ throws NullPointerException
{
if( exception == null )
{
- throw new NullArgumentException( "exception" );
+ throw new NullPointerException( "exception" );
}

try

Modified:
development/main/depot/console/src/main/net/dpml/depot/logging/LoggingManager.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/logging/LoggingManager.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/logging/LoggingManager.java
Thu May 12 08:32:25 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.transit.logging;
+package net.dpml.depot.logging;

import java.util.logging.LogManager;


Modified:
development/main/depot/console/src/main/net/dpml/depot/logging/StandardFormatter.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/logging/StandardFormatter.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/logging/StandardFormatter.java
Thu May 12 08:32:25 2005
@@ -16,12 +16,11 @@
* limitations under the License.
*/

-package net.dpml.transit.logging;
+package net.dpml.depot.logging;

import java.util.logging.Formatter;
import java.util.logging.LogRecord;

-import net.dpml.transit.util.ExceptionHelper;

/**
* Logging message formatter that includes the category in the logging
statement.

Modified:
development/main/depot/console/src/main/net/dpml/depot/logging/nodes/Nodes.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/logging/nodes/Nodes.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/logging/nodes/Nodes.java
Thu May 12 08:32:25 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.transit.logging.nodes;
+package net.dpml.depot.logging.nodes;

/**
* An empty class that serves as the access point for preferences related to

Modified:
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerDescriptor.java
==============================================================================
---
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerDescriptor.java
(original)
+++
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerDescriptor.java
Thu May 12 08:32:25 2005
@@ -1,5 +1,6 @@
/*
- * Copyright 2004 Niclas Hedhman
+ * 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

Modified:
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistry.java
==============================================================================
---
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistry.java
(original)
+++
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistry.java
Thu May 12 08:32:25 2005
@@ -1,5 +1,6 @@
/*
- * Copyright 2004 Niclas Hedhman
+ * 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
@@ -46,23 +47,6 @@
public class DepotContentHandlerRegistry extends
DefaultContentHandlerRegistry
{
//
------------------------------------------------------------------------
- // static
- //
------------------------------------------------------------------------
-
- // The following static operations is here simply to setup an example
content
- // handler plugin declaration that we can use for testing. This will be
- // removed once a proper installation strategy is established for
content
- // handler plugins.
-
- static
- {
- Preferences prefs = Preferences.userNodeForPackage(
ContentHandlerRegistry.class );
- Preferences p = prefs.node( "part" );
- p.put( "title", "Part Content Handler" );
- p.put( "uri",
"artifact:plugin:dpml/tools/dpml-composition-unit#SNAPSHOT" );
- }
-
- //
------------------------------------------------------------------------
// state
//
------------------------------------------------------------------------


Modified:
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryControlPanel.java
==============================================================================
---
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryControlPanel.java
(original)
+++
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryControlPanel.java
Thu May 12 08:32:25 2005
@@ -1,5 +1,6 @@
/*
- * Copyright 2004 Niclas Hedhman
+ * 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

Added:
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryInstaller.java
==============================================================================
--- (empty file)
+++
development/main/depot/content/src/main/net/dpml/depot/content/DepotContentHandlerRegistryInstaller.java
Thu May 12 08:32:25 2005
@@ -0,0 +1,39 @@
+/*
+ * 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.content;
+
+import java.util.prefs.Preferences;
+
+import net.dpml.transit.content.ContentHandlerRegistry;
+
+/**
+ * A registry of descriptions of plugable content handlers. This
implementation
+ * maps user defined preferences to instance of ContentHandlerDescriptor.
+ */
+public class DepotContentHandlerRegistryInstaller
+{
+ public DepotContentHandlerRegistryInstaller()
+ {
+ System.out.println( "#INSTALLING " +
DepotContentHandlerRegistryInstaller.class.getName() );
+ Preferences prefs = Preferences.systemNodeForPackage(
ContentHandlerRegistry.class );
+ Preferences p = prefs.node( "part" );
+ p.put( "title", "Part Content Handler" );
+ p.put( "uri",
"artifact:plugin:dpml/tools/dpml-composition-unit#SNAPSHOT" );
+ }
+}

Modified:
development/main/depot/station/src/main/net/dpml/depot/prefs/ContentHandlerControllerPanel.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/prefs/ContentHandlerControllerPanel.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/prefs/ContentHandlerControllerPanel.java
Thu May 12 08:32:25 2005
@@ -35,6 +35,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;

import java.io.File;
import java.io.IOException;
@@ -95,7 +97,7 @@
private JTextField m_base;
private JButton m_ok;
private JButton m_revert;
- private JButton m_settings;
+ private SettingsAction m_settings;

private Preferences m_preferences;

@@ -115,7 +117,7 @@
setLayout( new BorderLayout() );
setBackground( Color.white );

- m_ok = new JButton( new OKAction( "OK" ) );
+ m_ok = new JButton( new OKAction( "Install" ) );
m_revert = new JButton( new RevertAction( "Undo" ) );
m_preferences.addPreferenceChangeListener( this );

@@ -172,8 +174,9 @@
);
settingsPanel.setBackground( Color.white );
settingsPanel.setLayout( new BorderLayout() );
- m_settings = new JButton( new SettingsAction( "Controller
Settings", m_parent ) );
- settingsPanel.add( m_settings, BorderLayout.EAST );
+ m_settings = new SettingsAction( "Controller Settings",
m_parent );
+ JButton settings = new JButton( m_settings );
+ settingsPanel.add( settings, BorderLayout.EAST );
panel.add( settingsPanel );
}
holder.add( panel, BorderLayout.NORTH );
@@ -220,7 +223,7 @@
String artifact = getControllerFieldTextFromPreferences();
PropertyChangeEvent e =
new PropertyChangeEvent(
- m_base, "base", artifact, m_base.getText() );
+ m_base, "base", null, m_base.getText() );
m_propertyChangeSupport.firePropertyChange( e );
}

@@ -240,6 +243,14 @@
boolean flag = ( false == artifact.equals( m_base.getText() ) );
m_ok.setEnabled( flag );
m_revert.setEnabled( flag );
+ if( !flag )
+ {
+ m_settings.setup();
+ }
+ else
+ {
+ m_settings.setEnabled( false );
+ }
}

private String getControllerFieldTextFromPreferences()
@@ -255,7 +266,10 @@
public void preferenceChange( PreferenceChangeEvent event )
{
String artifact = getControllerFieldTextFromPreferences();
- m_base.setText( artifact );
+ if( false == m_base.getText().equals( artifact ) )
+ {
+ m_base.setText( artifact );
+ }
}

private class CloseAction extends AbstractAction
@@ -273,11 +287,18 @@

private class SettingsAction extends AbstractAction
{
+ private Dialog m_parent;
private Dialog m_dialog;

SettingsAction( String name, Dialog parent )
{
super( name );
+ m_parent = parent;
+ setup();
+ }
+
+ public void setup()
+ {
String controllerPath = getControllerPathFromPreferences();
if( null == controllerPath )
{
@@ -291,7 +312,7 @@
String classname = getControllerClassname( uri );
String controlClassname = classname + "ControlPanel";
ClassLoader classloader = getControllerClassLoader( uri
);
- m_dialog = createControlPanel( classloader,
controlClassname, parent );
+ m_dialog = createControlPanel( classloader,
controlClassname, m_parent );
m_dialog.setModal( true );
setEnabled( true );
}
@@ -387,18 +408,21 @@
if( "".equals( text ) )
{
m_preferences.remove( "uri" );
- m_parent.hide();
+ //m_parent.hide();
}
else
{
boolean validated = validateControllerSpec( m_parent,
text );
if( validated )
{
- m_parent.hide();
+ //m_parent.hide();
m_preferences.put( "uri", text );
}
}
}
+ m_ok.setEnabled( false );
+ m_revert.setEnabled( false );
+ m_settings.setup();
}
}

@@ -484,16 +508,38 @@
JOptionPane.showMessageDialog( component, message, title,
JOptionPane.ERROR_MESSAGE );
return false;
}
- if( ContentHandlerRegistry.class.isAssignableFrom( c ) )
- {
- return true;
- }
- else
+ if( false == ContentHandlerRegistry.class.isAssignableFrom( c ) )
{
final String title = "Controller URI Error";
final String message = "Plugin class does not implement " +
ContentHandlerRegistry.class.getName() + ".";
JOptionPane.showMessageDialog( component, message, title,
JOptionPane.ERROR_MESSAGE );
return false;
}
+ else
+ {
+ //
+ // check for an installer class
+ //
+
+ String installer = c.getName() + "Installer";
+ try
+ {
+ Class install = c.getClassLoader().loadClass( installer );
+System.out.println( "#INSTALLING --> " + install );
+ install.newInstance();
+ return true;
+ }
+ catch( ClassNotFoundException e )
+ {
+ return true;
+ }
+ catch( Throwable e )
+ {
+ final String title = "Controller URI Error";
+ final String message = "Plugin class install error in " +
installer + ".";
+ JOptionPane.showMessageDialog( component, message, title,
JOptionPane.ERROR_MESSAGE );
+ return false;
+ }
+ }
}
}

Modified:
development/main/depot/station/src/main/net/dpml/depot/prefs/Main.java
==============================================================================
--- development/main/depot/station/src/main/net/dpml/depot/prefs/Main.java
(original)
+++ development/main/depot/station/src/main/net/dpml/depot/prefs/Main.java
Thu May 12 08:32:25 2005
@@ -46,8 +46,7 @@
System.setProperty( "java.util.logging.config.class",
"net.dpml.transit.logging.ConfigurationHandler" );

Logger logger = Logger.getLogger( "depot" );
-
-
+ logger.info( "Welcome to Depot" );

//
// check if a prefs reset has been requested



  • svn commit: r2520 - in development/main/depot: console console/src/main/net/dpml/depot/console console/src/main/net/dpml/depot/logging console/src/main/net/dpml/depot/logging/nodes content/src/main/net/dpml/depot/content station/src/main/net/dpml/depot/prefs, mcconnell, 05/12/2005

Archive powered by MHonArc 2.6.24.

Top of Page