Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1940 - in development/main/metro: . activation/providers/metro/src/main/net/dpml/activation/metro configuration/impl/src/main/net/dpml/configuration/impl context/impl/src/main/net/dpml/context/impl logging/api/src/main/net/dpml/logging logging/criteria/src/main/net/dpml/logging/criteria logging/spi/src/main/net/dpml/logging/provider meta/api/src/main/net/dpml/meta/info service/api/src/main/net/dpml/service system/impl/src/main/net/dpml/system/impl system/spi/src/main/net/dpml/system unit/src/main/net/dpml/metro/unit

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1940 - in development/main/metro: . activation/providers/metro/src/main/net/dpml/activation/metro configuration/impl/src/main/net/dpml/configuration/impl context/impl/src/main/net/dpml/context/impl logging/api/src/main/net/dpml/logging logging/criteria/src/main/net/dpml/logging/criteria logging/spi/src/main/net/dpml/logging/provider meta/api/src/main/net/dpml/meta/info service/api/src/main/net/dpml/service system/impl/src/main/net/dpml/system/impl system/spi/src/main/net/dpml/system unit/src/main/net/dpml/metro/unit
  • Date: Fri, 04 Mar 2005 06:31:16 +0100

Author: niclas
Date: Fri Mar 4 06:31:13 2005
New Revision: 1940

Added:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestContext.java
(contents, props changed)
development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
(contents, props changed)

development/main/metro/unit/src/main/net/dpml/metro/unit/TestServiceManager.java
(contents, props changed)
Removed:

development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/ConsoleLogger.java
Modified:

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultAppliance.java

development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java

development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfigurationBuilder.java

development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
development/main/metro/index.xml
development/main/metro/logging/api/src/main/net/dpml/logging/Logger.java

development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/DefaultLoggingCriteria.java

development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/LoggerParameter.java

development/main/metro/logging/spi/src/main/net/dpml/logging/provider/ConsoleLogger.java

development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingCriteria.java

development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingFactory.java

development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingManager.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java

development/main/metro/service/api/src/main/net/dpml/service/ServiceUnknownException.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java

development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
development/main/metro/unit/src/main/net/dpml/metro/unit/package.html
Log:
o Added TestContext, TestServiceManager and TestLogger to the metro/unit
package.
o Removed one of the two ConsoleLoggers.
o Some formatting and start changing the mailto: href in @author tags to
www.dpml.net instead.

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultAppliance.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultAppliance.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultAppliance.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,17 @@
-/*
+/*
* 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
- *
+ * 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.
*/
@@ -44,7 +44,7 @@
//-------------------------------------------------------------------

private static final Resources REZ =
- ResourceManager.getPackageResources(
+ ResourceManager.getPackageResources(
DefaultAppliance.class );

//-------------------------------------------------------------------
@@ -65,7 +65,7 @@
// constructor
//-------------------------------------------------------------------

- public DefaultAppliance(
+ public DefaultAppliance(
ComponentModel model, LifestyleManager lifestyle )
{
super( model );
@@ -79,7 +79,7 @@
//-------------------------------------------------------------------

/**
- * Commission the appliance.
+ * Commission the appliance.
*
* @exception Exception if a commissioning error occurs
*/
@@ -87,7 +87,10 @@
{
synchronized( m_commissioned )
{
- if( m_commissioned.isEnabled() ) return;
+ if( m_commissioned.isEnabled() )
+ {
+ return;
+ }

try
{
@@ -104,14 +107,17 @@
}

/**
- * Decommission the appliance. Once an appliance is
+ * Decommission the appliance. Once an appliance is
* decommissioned it may be re-commissioned.
*/
public void decommission()
{
synchronized( m_commissioned )
{
- if( !m_commissioned.isEnabled() ) return;
+ if( !m_commissioned.isEnabled() )
+ {
+ return;
+ }
m_lifestyle.decommission();
m_commissioned.setEnabled( false );
}
@@ -138,13 +144,13 @@
if( getComponentModel().getType().getInfo().
getAttribute( "urn:activation:proxy", "true" ).equals( "false"
) )
{
- final String message =
+ final String message =
"Component type references the deprecated
'urn:activation:proxy' key."
+ " Please update to the key '" + ComponentModel.PROXY_KEY +
"'.";
getLogger().warn( message );
return resolve( false );
}
- else
+ else
{
return resolve( getComponentModel().getProxyPolicy() );
}
@@ -156,18 +162,18 @@
{
if( m_delay > 0 )
{
- final String error =
- REZ.getString(
- "appliance.error.resolve.transient",
+ final String error =
+ REZ.getString(
+ "appliance.error.resolve.transient",
this.toString(),
"" + m_delay );
throw new TransientRuntimeException( error, m_delay );
}
else if( !m_commissioned.isEnabled() )
{
- final String error =
- REZ.getString(
- "appliance.error.resolve.non-commission-state",
+ final String error =
+ REZ.getString(
+ "appliance.error.resolve.non-commission-state",
this.toString() );
throw new IllegalStateException( error );
}
@@ -180,19 +186,19 @@
{
ComponentModel model = getComponentModel();
Logger logger = model.getLogger().getChildLogger( "proxy" );
- ApplianceInvocationHandler handler =
+ ApplianceInvocationHandler handler =
new ApplianceInvocationHandler( this, logger, m_secure );

try
{
- return Proxy.newProxyInstance(
+ return Proxy.newProxyInstance(
model.getDeploymentClass().getClassLoader(),
model.getInterfaces(),
handler );
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Proxy establishment failure in appliance: " + this;
throw new ApplianceException( error, e );
}
@@ -210,7 +216,7 @@
if( !m_commissioned.isEnabled() ) return;
if( Proxy.isProxyClass( instance.getClass() ) )
{
- ApplianceInvocationHandler handler =
+ ApplianceInvocationHandler handler =
(ApplianceInvocationHandler) Proxy.getInvocationHandler(
instance );
handler.release();
}

Modified:
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
==============================================================================
---
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
(original)
+++
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfiguration.java
Fri Mar 4 06:31:13 2005
@@ -27,7 +27,7 @@
/**
* This is the default <code>Configuration</code> implementation.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class DefaultConfiguration
@@ -119,7 +119,8 @@
* @throws ConfigurationException if an error occurs
* @since 4.1
*/
- public String getNamespace() throws ConfigurationException
+ public String getNamespace()
+ throws ConfigurationException
{
if( null != m_namespace )
{
@@ -140,7 +141,8 @@
* @throws ConfigurationException if prefix is not present
(<code>null</code>).
* @since 4.1
*/
- protected String getPrefix() throws ConfigurationException
+ protected String getPrefix()
+ throws ConfigurationException
{
if( null != m_prefix )
{
@@ -189,7 +191,8 @@
* @return a <code>String</code> value
* @throws ConfigurationException If the value is not present.
*/
- public String getValue() throws ConfigurationException
+ public String getValue()
+ throws ConfigurationException
{
if( null != m_value )
{

Modified:
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfigurationBuilder.java
==============================================================================
---
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfigurationBuilder.java
(original)
+++
development/main/metro/configuration/impl/src/main/net/dpml/configuration/impl/DefaultConfigurationBuilder.java
Fri Mar 4 06:31:13 2005
@@ -5,9 +5,9 @@
* 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.
@@ -67,7 +67,7 @@
* in that case the whitespace is left intact.
* </p>
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class DefaultConfigurationBuilder
@@ -218,7 +218,7 @@
* @throws IOException if an I/O error occurs
* @throws ConfigurationException if an error occurs
*/
- public Configuration build( final InputStream inputStream,
+ public Configuration build( final InputStream inputStream,
final String systemId )
throws SAXException, IOException, ConfigurationException
{
@@ -261,10 +261,10 @@
}

/**
- * Sets the <code>EntityResolver</code> to
+ * Sets the <code>EntityResolver</code> to
* be used by parser. Useful when dealing with xml
* files that reference external entities.
- *
+ *
* @param resolver implementation of <code>EntityResolver</code>
*/
public void setEntityResolver( final EntityResolver resolver )

Modified:
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
==============================================================================
---
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
(original)
+++
development/main/metro/context/impl/src/main/net/dpml/context/impl/DefaultContext.java
Fri Mar 4 06:31:13 2005
@@ -29,7 +29,7 @@
* Default implementation of Context.
* This implementation is a static hierarchial store.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class DefaultContext

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Fri Mar 4 06:31:13 2005
@@ -274,8 +274,11 @@
</info>
<dependencies>
<include key="dpml-composition-spi"/>
+ <include key="dpml-context-api"/>
+ <include key="dpml-context-impl"/>
<include key="dpml-util-exception"/>
<include key="dpml-composition-impl" build="false"/>
+ <include key="dpml-service-api"/>
<include key="dpml-system-impl" build="false"/>
<include key="junit"/>
</dependencies>

Modified:
development/main/metro/logging/api/src/main/net/dpml/logging/Logger.java
==============================================================================
--- development/main/metro/logging/api/src/main/net/dpml/logging/Logger.java
(original)
+++ development/main/metro/logging/api/src/main/net/dpml/logging/Logger.java
Fri Mar 4 06:31:13 2005
@@ -1,13 +1,13 @@
/*
* 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.
@@ -21,7 +21,7 @@
* It offers a simplified interface that follows IOC patterns
* and a simplified priority/level/severity abstraction.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface Logger

Modified:
development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/DefaultLoggingCriteria.java
==============================================================================
---
development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/DefaultLoggingCriteria.java
(original)
+++
development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/DefaultLoggingCriteria.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
+ * Copyright 2005 Niclas Hedhman.
*
* 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
- *
+ * 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.
*/
@@ -23,17 +24,21 @@

import net.dpml.criteria.Criteria;
import net.dpml.criteria.Parameter;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
import net.dpml.logging.Logger;
+
+import net.dpml.logging.provider.ConsoleLogger;
import net.dpml.logging.provider.LoggingCriteria;
import net.dpml.logging.provider.LoggingRuntimeException;

/**
- * DefaultLoggingCriteria is a class holding the values supplied by a user
+ * DefaultLoggingCriteria is a class holding the values supplied by a user
* for application to a LoggingManager factory.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class DefaultLoggingCriteria extends Criteria implements
LoggingCriteria
@@ -42,7 +47,7 @@
// static
//--------------------------------------------------------------
/* Not used
- private static final String[] KEYS =
+ private static final String[] KEYS =
new String[]{
LOGGING_CONFIGURATION_KEY,
LOGGING_BASEDIR_KEY,
@@ -60,22 +65,22 @@
private static Parameter[] buildParameters()
{
return new Parameter[] {
- new ConfigurationParameter(
+ new ConfigurationParameter(
LOGGING_CONFIGURATION_KEY ),
- new Parameter(
- LOGGING_BASEDIR_KEY,
- File.class,
+ new Parameter(
+ LOGGING_BASEDIR_KEY,
+ File.class,
new File( System.getProperty( "user.dir" ) ) ),
- new Parameter(
- LOGGING_DEBUG_KEY,
- Boolean.class,
+ new Parameter(
+ LOGGING_DEBUG_KEY,
+ Boolean.class,
new Boolean( false ) ),
- new LoggerParameter(
- LOGGING_BOOTSTRAP_KEY,
+ new LoggerParameter(
+ LOGGING_BOOTSTRAP_KEY,
new ConsoleLogger( ConsoleLogger.LEVEL_WARN ) ),
- new Parameter(
- LOGGING_INTERVAL_KEY,
- Long.class,
+ new Parameter(
+ LOGGING_INTERVAL_KEY,
+ Long.class,
new Long( -1 ) )
};
}
@@ -151,7 +156,7 @@
}

/**
- * Returns debug policy. If TRUE all logging channels will be
+ * Returns debug policy. If TRUE all logging channels will be
* set to debug level.
*
* @return the debug policy
@@ -159,7 +164,7 @@
public boolean isDebugEnabled()
{
Boolean value = (Boolean) get( LOGGING_DEBUG_KEY );
- if( null != value )
+ if( null != value )
return value.booleanValue();
return false;
}
@@ -178,11 +183,11 @@
public long getUpdateInterval()
{
Long value = (Long) get( LOGGING_INTERVAL_KEY );
- if( null != value )
+ if( null != value )
return value.longValue();
return -1;
}
-
+
private static File getCanonicalForm( File file )
{
try
@@ -191,9 +196,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "criteria.artifact.cononical.error",
+ final String error =
+ REZ.getString(
+ "criteria.artifact.cononical.error",
file.toString() );
throw new LoggingRuntimeException( error, e );
}

Modified:
development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/LoggerParameter.java
==============================================================================
---
development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/LoggerParameter.java
(original)
+++
development/main/metro/logging/criteria/src/main/net/dpml/logging/criteria/LoggerParameter.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
+ * Copyright 2005 Niclas Hedhman.
*
* 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
- *
+ * 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.
*/
@@ -19,6 +20,7 @@
package net.dpml.logging.criteria;

import net.dpml.logging.Logger;
+import net.dpml.logging.provider.ConsoleLogger;

import net.dpml.criteria.Parameter;
import net.dpml.criteria.CriteriaException;
@@ -26,10 +28,10 @@
import net.dpml.i18n.Resources;

/**
- * A parameter descriptor that supports transformation of a
+ * A parameter descriptor that supports transformation of a
* a string to a Logger instance.
- *
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class LoggerParameter extends Parameter
@@ -49,7 +51,7 @@

/**
* Creation of a new logger parameter. The parameter support
- * convertion of strings in the form "debug", "info", "warn",
+ * convertion of strings in the form "debug", "info", "warn",
* "error", "fatal" and "none" to an equivalent logger.
*
* @param key the parameter key
@@ -65,7 +67,7 @@
* @param value the value to resolve
* @exception CriteriaException if an error occurs
*/
- public Object resolve( Object value )
+ public Object resolve( Object value )
throws CriteriaException
{
if( value == null )
@@ -104,9 +106,9 @@
return new ConsoleLogger( ConsoleLogger.LEVEL_DISABLED );
}
}
- final String error =
- REZ.getString(
- "parameter.unknown",
+ final String error =
+ REZ.getString(
+ "parameter.unknown",
value.getClass().getName(), Logger.class.getName() );
throw new CriteriaException( error );
}

Modified:
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/ConsoleLogger.java
==============================================================================
---
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/ConsoleLogger.java
(original)
+++
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/ConsoleLogger.java
Fri Mar 4 06:31:13 2005
@@ -4,9 +4,9 @@
* 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.
@@ -22,7 +22,7 @@
* This is mainly for the cases when you have a utility that
* does not have a logger to supply.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public final class ConsoleLogger

Modified:
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingCriteria.java
==============================================================================
---
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingCriteria.java
(original)
+++
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingCriteria.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,17 @@
-/*
+/*
* 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
- *
+ * 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.
*/
@@ -25,14 +25,14 @@
import net.dpml.logging.Logger;

/**
- * LoggingCriteria is convinience interface that extends Map with
+ * LoggingCriteria is convinience interface that extends Map with
* a set of operations that enable easy manipulation of the logging
* system parameters.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public interface LoggingCriteria extends Map
+public interface LoggingCriteria extends Map
{
//--------------------------------------------------------------
// criteria keys
@@ -41,22 +41,22 @@
/**
* The logging configuration key.
*/
- String LOGGING_CONFIGURATION_KEY =
+ String LOGGING_CONFIGURATION_KEY =
"metro.logging.configuration";

/**
* The logging system bootstrap logger key.
*/
- String LOGGING_BOOTSTRAP_KEY =
+ String LOGGING_BOOTSTRAP_KEY =
"metro.logging.bootstrap";

/**
- * The key of a the criteria argument that declares the base
+ * The key of a the criteria argument that declares the base
* directory to be used for persistent content. For example,
- * logging file should be created in the directory
+ * logging file should be created in the directory
* assigned to this key.
*/
- String LOGGING_BASEDIR_KEY =
+ String LOGGING_BASEDIR_KEY =
"metro.logging.basedir";

/**
@@ -64,13 +64,13 @@
* Logging subsystems that supports changes on-the-fly, will
* be passed this argument.
*/
- String LOGGING_INTERVAL_KEY =
+ String LOGGING_INTERVAL_KEY =
"metro.logging.update";

/**
* Debug mode.
*/
- String LOGGING_DEBUG_KEY =
+ String LOGGING_DEBUG_KEY =
"metro.logging.debug";

/**
@@ -110,7 +110,7 @@
File getBaseDirectory();

/**
- * Returns debug policy. If TRUE all logging channels will be
+ * Returns debug policy. If TRUE all logging channels will be
* set to debug level.
*
* @return the debug policy
@@ -123,9 +123,9 @@
*/
URL getLoggingConfiguration();

- /**
+ /**
* Returns the logging configuration update interval.
*/
long getUpdateInterval();
-
+
}

Modified:
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingFactory.java
==============================================================================
---
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingFactory.java
(original)
+++
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingFactory.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,17 @@
-/*
+/*
* 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
- *
+ * 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.
*/
@@ -24,7 +24,7 @@
/**
* Convinience interface to construct a logging manager.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface LoggingFactory extends Factory
@@ -32,7 +32,7 @@
/**
* Return of map containing the default parameters.
*
- * @return the default parameters
+ * @return the default parameters
*/
LoggingCriteria createDefaultLoggingCriteria();

@@ -42,6 +42,6 @@
* @param criteria the logging system factory criteria
* @exception LoggingException is a logging system creation error occurs
*/
- LoggingManager createLoggingManager( LoggingCriteria criteria )
+ LoggingManager createLoggingManager( LoggingCriteria criteria )
throws LoggingException;
}

Modified:
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingManager.java
==============================================================================
---
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingManager.java
(original)
+++
development/main/metro/logging/spi/src/main/net/dpml/logging/provider/LoggingManager.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,17 @@
-/*
+/*
* 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
- *
+ * 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.
*/
@@ -23,7 +23,7 @@

/**
* A <code>LoggerManager</code> that supports the management of a logging
hierarchy.
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface LoggingManager

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
Fri Mar 4 06:31:13 2005
@@ -38,7 +38,7 @@
* attributes that can be used to store extra information
* about Context requirements.</p>
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class ContextDescriptor extends Descriptor

Modified:
development/main/metro/service/api/src/main/net/dpml/service/ServiceUnknownException.java
==============================================================================
---
development/main/metro/service/api/src/main/net/dpml/service/ServiceUnknownException.java
(original)
+++
development/main/metro/service/api/src/main/net/dpml/service/ServiceUnknownException.java
Fri Mar 4 06:31:13 2005
@@ -1,17 +1,17 @@
-/*
+/*
* 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
- *
+ * 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.
*/
@@ -22,7 +22,7 @@
* Exception to indicate that a service defintioon is unknown within
* the scope of a service manager.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public final class ServiceUnknownException

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
Fri Mar 4 06:31:13 2005
@@ -83,7 +83,7 @@
* repository, working and temporary directories, and system level flags and
* services supporting the deployment of plugins.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class DefaultSystemContextFactory implements Factory,
SystemContextFactory

Modified:
development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
==============================================================================
---
development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
(original)
+++
development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
Fri Mar 4 06:31:13 2005
@@ -31,7 +31,7 @@
/**
* The controller class manages the deployment of a set of plugins.
*
- * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id: SystemContext.java 364 2004-11-04 15:16:12Z mcconnell $
*/
public interface SystemContext extends Context

Added:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestContext.java
==============================================================================
--- (empty file)
+++ development/main/metro/unit/src/main/net/dpml/metro/unit/TestContext.java
Fri Mar 4 06:31:13 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2005 Niclas Hedhman
+ *
+ * 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.metro.unit;
+
+import java.io.File;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import net.dpml.context.ContextException;
+import net.dpml.context.impl.DefaultContext;
+
+import net.dpml.meta.info.ContextDescriptor;
+
+/** A Context class that can be used for simple Unittesting.
+ * <p>
+ * The context will contain all standard Metro context entries, and
+ * it is possible to pass additional/overridden entries in one of the
+ * constructors.
+ * </p>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id: LoggerParameter.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class TestContext extends DefaultContext
+{
+ public TestContext()
+ {
+ put( ContextDescriptor.NAME_KEY, "unit-test" );
+
+ String partition = "/application/test";
+ put( ContextDescriptor.PARTITION_KEY, partition );
+
+ String dir = System.getProperty( "project.dir" );
+ File homedir = new File( dir );
+ put( ContextDescriptor.DIR_KEY, homedir );
+
+ File tempdir = new File( homedir, "$temp$" );
+ tempdir.mkdirs();
+ put( ContextDescriptor.TEMP_KEY, tempdir );
+
+ ClassLoader classloader = getClass().getClassLoader();
+ put( ContextDescriptor.CLASSLOADER_KEY, classloader );
+ }
+
+ public TestContext( Map customEntries )
+ {
+ this();
+ Iterator iterator = customEntries.entrySet().iterator();
+
+ while( iterator.hasNext() )
+ {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ put( entry.getKey(), entry.getValue() );
+ }
+ }
+}
\ No newline at end of file

Added:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
==============================================================================
--- (empty file)
+++ development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
Fri Mar 4 06:31:13 2005
@@ -0,0 +1,286 @@
+/*
+ * Copyright 2005 Niclas Hedhman
+ *
+ * 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.metro.unit;
+
+import java.util.Map;
+
+import net.dpml.context.ContextException;
+import net.dpml.context.impl.DefaultContext;
+
+import net.dpml.logging.Logger;
+
+/**
+ * Logger sending everything to the standard output streams.
+ * This is mainly for the cases when you have a utility that
+ * does not have a logger to supply.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id: ConsoleLogger.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class TestLogger
+ implements Logger
+{
+ /** Typecode for debugging messages. */
+ public static final int LEVEL_DEBUG = 0;
+
+ /** Typecode for informational messages. */
+ public static final int LEVEL_INFO = 1;
+
+ /** Typecode for warning messages. */
+ public static final int LEVEL_WARN = 2;
+
+ /** Typecode for error messages. */
+ public static final int LEVEL_ERROR = 3;
+
+ /** Typecode for fatal error messages. */
+ public static final int LEVEL_FATAL = 4;
+
+ /** Typecode for disabled log levels. */
+ public static final int LEVEL_DISABLED = 5;
+
+ private final int m_logLevel;
+
+ /**
+ * Creates a new ConsoleLogger with the priority set to DEBUG.
+ */
+ public TestLogger()
+ {
+ this( LEVEL_DEBUG );
+ }
+
+ /**
+ * Creates a new ConsoleLogger.
+ * @param logLevel log level typecode
+ */
+ public TestLogger( final int logLevel )
+ {
+ m_logLevel = logLevel;
+ }
+
+ /**
+ * Logs a debugging message.
+ *
+ * @param message a <code>String</code> value
+ */
+ public void debug( final String message )
+ {
+ debug( message, null );
+ }
+
+ /**
+ * Logs a debugging message and an exception.
+ *
+ * @param message a <code>String</code> value
+ * @param throwable a <code>Throwable</code> value
+ */
+ public void debug( final String message, final Throwable throwable )
+ {
+ if( m_logLevel <= LEVEL_DEBUG )
+ {
+ System.out.print( "[DEBUG] " );
+ System.out.println( message );
+
+ if( null != throwable )
+ {
+ throwable.printStackTrace( System.out );
+ }
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if debug-level logging is enabled, false
otherwise.
+ *
+ * @return <code>true</code> if debug-level logging
+ */
+ public boolean isDebugEnabled()
+ {
+ return m_logLevel <= LEVEL_DEBUG;
+ }
+
+ /**
+ * Logs an informational message.
+ *
+ * @param message a <code>String</code> value
+ */
+ public void info( final String message )
+ {
+ info( message, null );
+ }
+
+ /**
+ * Logs an informational message and an exception.
+ *
+ * @param message a <code>String</code> value
+ * @param throwable a <code>Throwable</code> value
+ */
+ public void info( final String message, final Throwable throwable )
+ {
+ if( m_logLevel <= LEVEL_INFO )
+ {
+ System.out.print( "[INFO] " );
+ System.out.println( message );
+
+ if( null != throwable )
+ {
+ throwable.printStackTrace( System.out );
+ }
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if info-level logging is enabled, false
otherwise.
+ *
+ * @return <code>true</code> if info-level logging is enabled
+ */
+ public boolean isInfoEnabled()
+ {
+ return m_logLevel <= LEVEL_INFO;
+ }
+
+ /**
+ * Logs a warning message.
+ *
+ * @param message a <code>String</code> value
+ */
+ public void warn( final String message )
+ {
+ warn( message, null );
+ }
+
+ /**
+ * Logs a warning message and an exception.
+ *
+ * @param message a <code>String</code> value
+ * @param throwable a <code>Throwable</code> value
+ */
+ public void warn( final String message, final Throwable throwable )
+ {
+ if( m_logLevel <= LEVEL_WARN )
+ {
+ System.out.print( "[WARNING] " );
+ System.out.println( message );
+
+ if( null != throwable )
+ {
+ throwable.printStackTrace( System.out );
+ }
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if warn-level logging is enabled, false
otherwise.
+ *
+ * @return <code>true</code> if warn-level logging is enabled
+ */
+ public boolean isWarnEnabled()
+ {
+ return m_logLevel <= LEVEL_WARN;
+ }
+
+ /**
+ * Logs an error message.
+ *
+ * @param message a <code>String</code> value
+ */
+ public void error( final String message )
+ {
+ error( message, null );
+ }
+
+ /**
+ * Logs an error message and an exception.
+ *
+ * @param message a <code>String</code> value
+ * @param throwable a <code>Throwable</code> value
+ */
+ public void error( final String message, final Throwable throwable )
+ {
+ if( m_logLevel <= LEVEL_ERROR )
+ {
+ System.out.print( "[ERROR] " );
+ System.out.println( message );
+
+ if( null != throwable )
+ {
+ throwable.printStackTrace( System.out );
+ }
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if error-level logging is enabled, false
otherwise.
+ *
+ * @return <code>true</code> if error-level logging is enabled
+ */
+ public boolean isErrorEnabled()
+ {
+ return m_logLevel <= LEVEL_ERROR;
+ }
+
+ /**
+ * Logs a fatal error message.
+ *
+ * @param message a <code>String</code> value
+ */
+ public void fatalError( final String message )
+ {
+ fatalError( message, null );
+ }
+
+ /**
+ * Logs a fatal error message and an exception.
+ *
+ * @param message a <code>String</code> value
+ * @param throwable a <code>Throwable</code> value
+ */
+ public void fatalError( final String message, final Throwable throwable )
+ {
+ if( m_logLevel <= LEVEL_FATAL )
+ {
+ System.out.print( "[FATAL ERROR] " );
+ System.out.println( message );
+
+ if( null != throwable )
+ {
+ throwable.printStackTrace( System.out );
+ }
+ }
+ }
+
+ /**
+ * Returns <code>true</code> if fatal-level logging is enabled, false
otherwise.
+ *
+ * @return <code>true</code> if fatal-level logging is enabled
+ */
+ public boolean isFatalErrorEnabled()
+ {
+ return m_logLevel <= LEVEL_FATAL;
+ }
+
+ /**
+ * Just returns this logger (<code>ConsoleLogger</code> is not
hierarchical).
+ *
+ * @param name ignored
+ * @return this logger
+ */
+ public Logger getChildLogger( final String name )
+ {
+ return this;
+ }
+}
\ No newline at end of file

Added:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestServiceManager.java
==============================================================================
--- (empty file)
+++
development/main/metro/unit/src/main/net/dpml/metro/unit/TestServiceManager.java
Fri Mar 4 06:31:13 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005 Niclas Hedhman
+ *
+ * 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.metro.unit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import net.dpml.service.ServiceException;
+import net.dpml.service.ServiceManager;
+import net.dpml.service.ServiceUnknownException;
+
+/** This is a ServiceManager intended for unit testing.
+ * <p>
+ * The ServiceManager is populated through a Map in the constructor.
+ * </p>
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id: LoggerParameter.java 259 2004-10-30 07:24:40Z mcconnell $
+ */
+public class TestServiceManager
+ implements ServiceManager
+{
+ private HashMap m_dependencies;
+
+ public TestServiceManager( Map dependencies )
+ {
+ m_dependencies = new HashMap( dependencies );
+ }
+
+ /**
+ * Get the <code>Object</code> associated with the given key.
+ *
+ * @param key The lookup key of the <code>Object</code> to retrieve.
+ * @return an <code>Object</code> value
+ * @throws ServiceException if an error occurs
+ */
+ public Object lookup( String key )
+ throws ServiceException
+ {
+ Object obj = m_dependencies.get( key );
+ if( obj == null )
+ throw new ServiceUnknownException( key, "Not included in this
service manager." );
+ return obj;
+ }
+
+ /**
+ * Check to see if a <code>Object</code> exists for a key.
+ *
+ * @param key a string identifying the key to check.
+ * @return True if the object exists, False if it does not.
+ */
+ public boolean hasService( String key )
+ {
+ Object obj = m_dependencies.get( key );
+ return obj != null;
+ }
+
+ /**
+ * Return the <code>Object</code> when you are finished with it.
+ * @param object The <code>Object</code> we are releasing, may also be
+ * a <code>null</code> reference
+ */
+ public void release( Object object )
+ {
+ }
+}
\ No newline at end of file

Modified:
development/main/metro/unit/src/main/net/dpml/metro/unit/package.html
==============================================================================
--- development/main/metro/unit/src/main/net/dpml/metro/unit/package.html
(original)
+++ development/main/metro/unit/src/main/net/dpml/metro/unit/package.html
Fri Mar 4 06:31:13 2005
@@ -1,6 +1,6 @@

<body>
<p>
-Metro utility testcase helper class.
+Metro utility testcase helper classes.
</p>
</body>



  • svn commit: r1940 - in development/main/metro: . activation/providers/metro/src/main/net/dpml/activation/metro configuration/impl/src/main/net/dpml/configuration/impl context/impl/src/main/net/dpml/context/impl logging/api/src/main/net/dpml/logging logging/criteria/src/main/net/dpml/logging/criteria logging/spi/src/main/net/dpml/logging/provider meta/api/src/main/net/dpml/meta/info service/api/src/main/net/dpml/service system/impl/src/main/net/dpml/system/impl system/spi/src/main/net/dpml/system unit/src/main/net/dpml/metro/unit, niclas, 03/04/2005

Archive powered by MHonArc 2.6.24.

Top of Page