You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by le...@apache.org on 2005/11/26 04:43:14 UTC
svn commit: r349071 -
/excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java
Author: leif
Date: Fri Nov 25 19:43:12 2005
New Revision: 349071
URL: http://svn.apache.org/viewcvs?rev=349071&view=rev
Log:
Fix a problem were instrument state files from the very first instrument versions could not be loaded correctly. This problem was added in the dev code and has not been released.
Modified:
excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java
Modified: excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java
URL: http://svn.apache.org/viewcvs/excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java?rev=349071&r1=349070&r2=349071&view=diff
==============================================================================
--- excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java (original)
+++ excalibur/trunk/containerkit/instrument/mgr-impl/src/java/org/apache/excalibur/instrument/manager/impl/DefaultInstrumentManagerImpl.java Fri Nov 25 19:43:12 2005
@@ -56,6 +56,7 @@
import org.apache.excalibur.instrument.manager.InstrumentableDescriptor;
import org.apache.excalibur.instrument.manager.InstrumentDescriptor;
import org.apache.excalibur.instrument.manager.InstrumentSampleDescriptor;
+import org.apache.excalibur.instrument.manager.InstrumentSampleUtils;
import org.apache.excalibur.instrument.manager.NoSuchInstrumentException;
import org.apache.excalibur.instrument.manager.NoSuchInstrumentSampleException;
import org.apache.excalibur.instrument.manager.NoSuchInstrumentableException;
@@ -1001,6 +1002,12 @@
public void loadStateFromConfiguration( Configuration state )
throws ConfigurationException
{
+ loadStateFromConfiguration( state, null );
+ }
+
+ private void loadStateFromConfiguration( Configuration state, String parentName )
+ throws ConfigurationException
+ {
// When loading state, the only thing that we are really interrested in are the samples.
// Don't bother looking anything up until one is found. Doing it this way is also
// critical to make name translations work correctly.
@@ -1011,12 +1018,14 @@
Configuration[] instrumentableConfs = state.getChildren( "instrumentable" );
for( int i = 0; i < instrumentableConfs.length; i++ )
{
- loadStateFromConfiguration( instrumentableConfs[i] );
+ loadStateFromConfiguration(
+ instrumentableConfs[i], instrumentableConfs[i].getAttribute( "name", null ) );
}
Configuration[] instrumentConfs = state.getChildren( "instrument" );
for( int i = 0; i < instrumentConfs.length; i++ )
{
- loadStateFromConfiguration( instrumentConfs[i] );
+ loadStateFromConfiguration(
+ instrumentConfs[i], instrumentConfs[i].getAttribute( "name", null ) );
}
// Look for any samples.
@@ -1026,7 +1035,27 @@
Configuration sampleConf = sampleConfs[i];
// Obtain and translate the sample name.
- String sampleName = getTranslatedName( sampleConf.getAttribute( "name" ) );
+ String sampleName = sampleConf.getAttribute( "name", null );
+ if ( sampleName == null )
+ {
+ // The sample name was missing. This can happen for very old state files.
+ // Build the name.
+ if ( parentName == null )
+ {
+ throw new ConfigurationException(
+ "Unable to resolve sample name.", sampleConf );
+ }
+
+ int sampleType = InstrumentSampleUtils.resolveInstrumentSampleType(
+ sampleConf.getAttribute( "type" ) );
+ long sampleInterval = sampleConf.getAttributeAsLong( "interval" );
+ int sampleSize = sampleConf.getAttributeAsInteger( "size" );
+
+ sampleName = InstrumentSampleUtils.generateFullInstrumentSampleName(
+ parentName, sampleType, sampleInterval, sampleSize );
+ }
+ // Translate the resulting name.
+ sampleName = getTranslatedName( sampleName );
// Before we do anything, decide how we want to handle the sample.
long now = System.currentTimeMillis();
---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org