[CVS spice] Changed to work to interfaces.
mauro-yCVjj/[email protected] 17 Jun 2004 22:26:54 -0000
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in spice/components/alchemist/src/java/org/codehaus/spice/alchemist/instrument on MAIN
InstrumentAlchemist.java +4 -5 1.1 -> 1.2
DNAInstrumentManager.java +49 -46 1.1 -> 1.2
+53 -51
2 modified files
Changed to work to interfaces.
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/instrument
InstrumentAlchemist.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- InstrumentAlchemist.java 13 Jun 2004 13:35:13 -0000 1.1
+++ InstrumentAlchemist.java 17 Jun 2004 22:26:53 -0000 1.2
@@ -6,23 +6,22 @@
package org.codehaus.spice.alchemist.instrument;
import org.apache.excalibur.instrument.InstrumentManager;
-import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
/**
* Utility class containing methods to transform Instrument objects.
*
* @author Mauro Talevi
- * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:13 $
+ * @version $Revision: 1.2 $ $Date: 2004/06/17 22:26:53 $
*/
public class InstrumentAlchemist
{
/**
- * Convert Excalibur DefaultInstrumentManager to use DNA lifecycle methods
+ * Convert Excalibur InstrumentManager to use DNA lifecycle methods
*
- * @param manager the Excalibur DefaultInstrumentManager
+ * @param manager the Excalibur InstrumentManager
* @return An InstrumentManager object
*/
- public static InstrumentManager toDNAInstrumentManager( final DefaultInstrumentManager manager )
+ public static InstrumentManager toDNAInstrumentManager( final InstrumentManager manager )
{
return new DNAInstrumentManager(manager);
}
----------
spice/components/alchemist/src/java/org/codehaus/spice/alchemist/instrument
DNAInstrumentManager.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- DNAInstrumentManager.java 13 Jun 2004 13:35:14 -0000 1.1
+++ DNAInstrumentManager.java 17 Jun 2004 22:26:53 -0000 1.2
@@ -1,96 +1,99 @@
/*
- * Copyright (C) The Loom Group. All rights reserved.
- *
- * This software is published under the terms of the Loom
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
+ * Copyright (C) The Spice Group. All rights reserved. This software is
+ * published under the terms of the Spice Software License version 1.1, a copy
+ * of which has been included with this distribution in the LICENSE.txt file.
*/
package org.codehaus.spice.alchemist.instrument;
import org.apache.excalibur.instrument.InstrumentManager;
import org.apache.excalibur.instrument.Instrumentable;
-import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
import org.codehaus.dna.Active;
import org.codehaus.dna.Configurable;
import org.codehaus.dna.Configuration;
import org.codehaus.dna.ConfigurationException;
import org.codehaus.dna.LogEnabled;
import org.codehaus.dna.Logger;
+import org.codehaus.spice.alchemist.activity.ActivityAlchemist;
import org.codehaus.spice.alchemist.configuration.ConfigurationAlchemist;
import org.codehaus.spice.alchemist.logger.LoggerAlchemist;
-
/**
- * DNA facade for the Excalibur <code>DefaultInstrumentManager</code>
- *
+ * DNA facade for the Excalibur <code>InstrumentManager</code>.
+ * It assumes the InstrumentManager honours the Avalon lifecycle methods
+ * and attempts to honour the DNA lifecycle methods via the appropriate
+ * Alchemist.
+ *
* @author Johan Sjoberg
* @author Mauro Talevi
- * @version $Revision: 1.1 $ $Date: 2004/06/13 13:35:14 $
+ * @version $Revision: 1.2 $ $Date: 2004/06/17 22:26:53 $
*/
-public class DNAInstrumentManager
- implements InstrumentManager, LogEnabled, Configurable, Active
-{
-
- /** The Excalibur DefaultInstrumentManager */
- private final DefaultInstrumentManager _manager;
-
+public class DNAInstrumentManager implements InstrumentManager, LogEnabled,
+ Configurable, Active {
+
+ /** The Excalibur InstrumentManager */
+ private final InstrumentManager _manager;
+
/**
* Create a DNAInstrumentManager
- *
- * @param manager the Excalibur DefaultInstrumentManager
+ *
+ * @param manager the Excalibur InstrumentManager
*/
- public DNAInstrumentManager( final DefaultInstrumentManager manager )
- {
+ public DNAInstrumentManager( final InstrumentManager manager ) {
_manager = manager;
}
/**
* @see LogEnabled#enableLogging(Logger)
*/
- public void enableLogging( Logger logger )
- {
- _manager.enableLogging( LoggerAlchemist.toAvalonLogger( logger ) );
- }
-
+ public void enableLogging( Logger logger ) {
+ if ( LoggerAlchemist.isAvalonLogEnabled( _manager ) ) {
+ LoggerAlchemist.toAvalonLogEnabled( _manager ).enableLogging(
+ LoggerAlchemist.toAvalonLogger( logger ) );
+ }
+ }
/**
* @see Configurable#configure(Configuration)
*/
- public void configure( Configuration configuration ) throws ConfigurationException
- {
- try
- {
- _manager.configure( ConfigurationAlchemist.toAvalonConfiguration( configuration ) );
- }
- catch( Exception e )
- {
+ public void configure( Configuration configuration )
+ throws ConfigurationException {
+ try {
+ ConfigurationAlchemist.toAvalonConfigurable( _manager )
+ .configure( ConfigurationAlchemist
+ .toAvalonConfiguration( configuration ) );
+ } catch ( Exception e ) {
throw new ConfigurationException( e.getMessage(), e );
}
}
-
/**
* @see org.codehaus.dna.Active#initialize()
*/
- public void initialize() throws Exception
- {
- _manager.initialize();
+ public void initialize() throws Exception {
+ try {
+ ActivityAlchemist.toAvalonInitializable( _manager ).initialize();
+ } catch ( IllegalArgumentException e ){
+ // _manager is not Avalon Initialisable
+ }
}
-
/**
* @see org.codehaus.dna.Active#dispose()
*/
- public void dispose()
- {
- _manager.dispose();
+ public void dispose() {
+ try {
+ ActivityAlchemist.toAvalonDisposable( _manager ).dispose();
+ } catch ( IllegalArgumentException e ){
+ // _manager is not Avalon Disposable
+ }
}
-
/**
- * @see org.apache.excalibur.instrument.InstrumentManager#registerInstrumentable(org.apache.excalibur.instrument.Instrumentable, java.lang.String)
+ * @see org.apache.excalibur.instrument.InstrumentManager#registerInstrumentable(org.apache.excalibur.instrument.Instrumentable,
+ * java.lang.String)
*/
- public void registerInstrumentable( Instrumentable arg0, String arg1 ) throws Exception {
+ public void registerInstrumentable( Instrumentable arg0, String arg1 )
+ throws Exception {
_manager.registerInstrumentable( arg0, arg1 );
}
-}
+}
\ No newline at end of file
CVSspam 0.2.8