notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2820 - in development/main/depot: . console/src/main/net/dpml/depot console/src/main/net/dpml/depot/logging console/src/main/net/dpml/depot/profile station/src/main/net/dpml/depot/station test test/brazil test/brazil/src test/brazil/src/main/net/dpml/depot test/brazil/src/main/net/dpml/test test/mexico test/mexico/src test/mexico/src/main test/mexico/src/main/net test/mexico/src/main/net/dpml test/mexico/src/main/net/dpml/test test/mexico/src/main/net/dpml/test/mexico test/src
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2820 - in development/main/depot: . console/src/main/net/dpml/depot console/src/main/net/dpml/depot/logging console/src/main/net/dpml/depot/profile station/src/main/net/dpml/depot/station test test/brazil test/brazil/src test/brazil/src/main/net/dpml/depot test/brazil/src/main/net/dpml/test test/mexico test/mexico/src test/mexico/src/main test/mexico/src/main/net test/mexico/src/main/net/dpml test/mexico/src/main/net/dpml/test test/mexico/src/main/net/dpml/test/mexico test/src
- Date: Fri, 10 Jun 2005 11:24:09 -0400
Author: mcconnell AT dpml.net
Date: Fri Jun 10 11:24:09 2005
New Revision: 2820
Added:
development/main/depot/test/brazil/ (props changed)
development/main/depot/test/brazil/build.xml
- copied unchanged from r2740, development/main/depot/test/build.xml
development/main/depot/test/brazil/src/
- copied from r2740, development/main/depot/test/src/
development/main/depot/test/brazil/src/main/net/dpml/test/
development/main/depot/test/brazil/src/main/net/dpml/test/Client.java
development/main/depot/test/mexico/ (props changed)
development/main/depot/test/mexico/build.xml
development/main/depot/test/mexico/src/
development/main/depot/test/mexico/src/main/
development/main/depot/test/mexico/src/main/net/
development/main/depot/test/mexico/src/main/net/dpml/
development/main/depot/test/mexico/src/main/net/dpml/test/
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/ClientListener.java
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Event.java
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Listener.java
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Server.java
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Service.java
Removed:
development/main/depot/test/brazil/src/main/net/dpml/depot/
development/main/depot/test/build.xml
development/main/depot/test/src/
Modified:
development/main/depot/console/src/main/net/dpml/depot/Main.java
development/main/depot/console/src/main/net/dpml/depot/logging/ConfigurationHandler.java
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
development/main/depot/index.xml
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
Log:
reshuffle tests
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 Fri
Jun 10 11:24:09 2005
@@ -64,6 +64,12 @@
*/
public final class Main
{
+ public static void start( final String[] args )
+ throws Exception
+ {
+ Main.main( new String[]{ "-profile", "station" } );
+ }
+
public static void main( final String[] args )
throws Exception
{
@@ -142,8 +148,9 @@
TransitHome home = new TransitStorageUnit();
TransitManager model = home.create();
Transit transit = Transit.getInstance( model );
+ Logger log = logger.getChildLogger( target );
Repository loader = transit.getRepository();
- Object object = loader.getPlugin( system, uri, new
Object[]{ args, model } );
+ Object object = loader.getPlugin( system, uri, new
Object[]{ args, model, log } );
if( registry != null )
{
String id = profile.getID();
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
Fri Jun 10 11:24:09 2005
@@ -45,12 +45,21 @@
Properties properties = new Properties();
properties.setProperty(
"handlers",
- "java.util.logging.ConsoleHandler" );
+ "java.util.logging.FileHandler, java.util.logging.ConsoleHandler"
);
properties.setProperty(
"java.util.logging.ConsoleHandler.formatter",
"net.dpml.depot.logging.StandardFormatter" );
//
+ // set the file handler properties
+ //
+
+ properties.setProperty( "java.util.logging.FileHandler.pattern",
"%h/java%u.log" );
+ properties.setProperty( "java.util.logging.FileHandler.limit",
"50000" );
+ properties.setProperty( "java.util.logging.FileHandler.count", "1" );
+ properties.setProperty( "java.util.logging.FileHandler.formatter",
"java.util.logging.XMLFormatter" );
+
+ //
// set the default level by setting the root logger level
//
Modified:
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/profile/DepotStorage.java
Fri Jun 10 11:24:09 2005
@@ -195,5 +195,4 @@
PluginProfileStorage store = new PluginProfileStorage( prefs,
logger, creation, policy );
return store.getPluginProfile();
}
-
}
Modified: development/main/depot/index.xml
==============================================================================
--- development/main/depot/index.xml (original)
+++ development/main/depot/index.xml Fri Jun 10 11:24:09 2005
@@ -64,9 +64,9 @@
</dependencies>
</project>
- <project basedir="test">
+ <project basedir="test/brazil">
<info>
- <group>dpml/depot</group>
+ <group>dpml/test</group>
<name>dpml-depot-test</name>
<types>
<type>jar</type>
@@ -74,8 +74,18 @@
</types>
</info>
<dependencies>
- <include key="dpml-depot-station"/>
+ <include key="dpml-test-mexico"/>
</dependencies>
</project>
+ <project basedir="test/mexico">
+ <info>
+ <group>dpml/test</group>
+ <name>dpml-test-mexico</name>
+ <types>
+ <type>jar</type>
+ </types>
+ </info>
+ </project>
+
</index>
Modified:
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
==============================================================================
---
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
(original)
+++
development/main/depot/station/src/main/net/dpml/depot/station/ActivationStorage.java
Fri Jun 10 11:24:09 2005
@@ -62,6 +62,7 @@
String classname = getClassname();
boolean restart = getRestartPolicy();
+ logger.debug( "Creating activation profile: " + id );
m_profile =
new ActivationProfile(
logger, creation, this, id, title, properties,
Added: development/main/depot/test/brazil/src/main/net/dpml/test/Client.java
==============================================================================
--- (empty file)
+++ development/main/depot/test/brazil/src/main/net/dpml/test/Client.java
Fri Jun 10 11:24:09 2005
@@ -0,0 +1,41 @@
+
+package net.dpml.test;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.dpml.test.mexico.Server;
+import net.dpml.test.mexico.Listener;
+import net.dpml.test.mexico.Event;
+import net.dpml.test.mexico.ClientListener;
+
+public class Client
+{
+ private Logger m_logger = Logger.getLogger( "brazil" );
+
+ public Client( )
+ {
+ try
+ {
+ Registry reg = LocateRegistry.getRegistry();
+ Server server = (Server) reg.lookup( "mexico" );
+ ClientListener listener = new ClientListener();
+ server.addListener( listener );
+ server.info();
+ server.removeListener( listener );
+ }
+ catch( Throwable e )
+ {
+ getLogger().log( Level.SEVERE, "woops", e );
+ }
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+}
Added: development/main/depot/test/mexico/build.xml
==============================================================================
--- (empty file)
+++ development/main/depot/test/mexico/build.xml Fri Jun 10 11:24:09
2005
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="dpml-test-mexico" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core" >
+
+ <transit:import uri="artifact:template:dpml/magic/standard"/>
+
+ <target name="build" depends="standard.build">
+ <rmic base="${basedir}/target/classes" includes="**/Server.class"/>
+ <rmic base="${basedir}/target/classes"
includes="**/ClientListener.class"/>
+ </target>
+
+</project>
Added:
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/ClientListener.java
==============================================================================
--- (empty file)
+++
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/ClientListener.java
Fri Jun 10 11:24:09 2005
@@ -0,0 +1,30 @@
+
+package net.dpml.test.mexico;
+
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class ClientListener extends UnicastRemoteObject implements Listener
+{
+ private Logger m_logger = Logger.getLogger( "depot.station.client" );
+
+ public ClientListener() throws RemoteException
+ {
+ super();
+ }
+
+ public void notify( Event event )
+ {
+ getLogger().log( Level.INFO, "count: " + event.getCount() );
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+
+}
Added:
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Event.java
==============================================================================
--- (empty file)
+++
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Event.java
Fri Jun 10 11:24:09 2005
@@ -0,0 +1,20 @@
+
+package net.dpml.test.mexico;
+
+import java.util.EventObject;
+
+public class Event extends EventObject
+{
+ private int m_count;
+
+ public Event( Object source, int count )
+ {
+ super( source );
+ m_count = count;
+ }
+
+ public int getCount()
+ {
+ return m_count;
+ }
+}
Added:
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Listener.java
==============================================================================
--- (empty file)
+++
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Listener.java
Fri Jun 10 11:24:09 2005
@@ -0,0 +1,11 @@
+
+package net.dpml.test.mexico;
+
+import java.util.EventListener;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Listener extends EventListener, Remote
+{
+ void notify( Event event ) throws RemoteException;
+}
Added:
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Server.java
==============================================================================
--- (empty file)
+++
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Server.java
Fri Jun 10 11:24:09 2005
@@ -0,0 +1,70 @@
+
+package net.dpml.test.mexico;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.MarshalledObject;
+import java.rmi.server.UnicastRemoteObject;
+import java.rmi.activation.Activatable;
+import java.rmi.activation.ActivationID;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.LinkedList;
+import java.util.prefs.Preferences;
+
+public class Server extends Activatable implements Service
+{
+ private int m_count = 0;
+ private final Logger m_logger = Logger.getLogger( "mexico" );
+ private LinkedList m_listeners = new LinkedList();
+
+ public Server( ActivationID id, MarshalledObject data ) throws
RemoteException
+ {
+ super( id, 0 );
+ Preferences prefs = Preferences.userNodeForPackage( Server.class );
+ m_count = prefs.getInt( "count", 0 );
+ }
+
+ public Object info() throws RemoteException
+ {
+ int count = m_count;
+ getLogger().info( "# " + count );
+ postEvent( count );
+ m_count++;
+ return "" + count;
+ }
+
+ public void addListener( Listener listener )
+ {
+ m_listeners.add( listener );
+ }
+
+ public void removeListener( Listener listener )
+ {
+ m_listeners.remove( listener );
+ }
+
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+
+ private void postEvent( int count )
+ {
+ Event event = new Event( this, count );
+ Listener[] listeners = (Listener[]) m_listeners.toArray( new
Listener[0] );
+ for( int i=0; i<listeners.length; i++ )
+ {
+ Listener listener = listeners[i];
+ try
+ {
+ listener.notify( event );
+ }
+ catch( Throwable e )
+ {
+ getLogger().log( Level.SEVERE, e.getMessage(), e.getCause()
);
+ }
+ }
+ }
+}
Added:
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Service.java
==============================================================================
--- (empty file)
+++
development/main/depot/test/mexico/src/main/net/dpml/test/mexico/Service.java
Fri Jun 10 11:24:09 2005
@@ -0,0 +1,14 @@
+
+package net.dpml.test.mexico;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Service extends Remote
+{
+ public Object info() throws RemoteException;
+
+ public void addListener( Listener listener ) throws RemoteException;
+
+ public void removeListener( Listener listener ) throws RemoteException;
+}
- svn commit: r2820 - in development/main/depot: . console/src/main/net/dpml/depot console/src/main/net/dpml/depot/logging console/src/main/net/dpml/depot/profile station/src/main/net/dpml/depot/station test test/brazil test/brazil/src test/brazil/src/main/net/dpml/depot test/brazil/src/main/net/dpml/test test/mexico test/mexico/src test/mexico/src/main test/mexico/src/main/net test/mexico/src/main/net/dpml test/mexico/src/main/net/dpml/test test/mexico/src/main/net/dpml/test/mexico test/src, mcconnell, 06/10/2005
Archive powered by MHonArc 2.6.24.