donaldp 01/04/18 05:35:09
Added: src/java/org/apache/avalon/context Context.java
Contextualizable.java DefaultContext.java
Recontextualizable.java Resolvable.java
Log:
Migrate context related cut to context sub-package
Revision Changes Path
1.1 jakarta-avalon/src/java/org/apache/avalon/context/Context.java
Index: Context.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.context;
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Federico Barbieri</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
*/
public interface Context
{
Object get( Object key );
}
1.1
jakarta-avalon/src/java/org/apache/avalon/context/Contextualizable.java
Index: Contextualizable.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.context;
/**
* This inteface should be implemented by classes that need
* a Context to work. Context contains runtime generated object
* provided by the parent to this class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Federico Barbieri</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
*/
public interface Contextualizable
{
/**
* Pass the Context to the contextualizable class. This method
* is always called after the constructor and, if present,
* after configure but before any other method.
*
*/
void contextualize( Context context );
}
1.1
jakarta-avalon/src/java/org/apache/avalon/context/DefaultContext.java
Index: DefaultContext.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.context;
import java.util.Hashtable;
import java.util.Map;
/**
* Default implementation of Context.
* This implementation is a static hierarchial store.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Federico Barbieri</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class DefaultContext
implements Context
{
protected final Map m_contextData;
protected final Context m_parent;
public DefaultContext( final Map contextData, final Context parent )
{
m_parent = parent;
m_contextData = contextData;
}
public DefaultContext( final Map contextData )
{
this( contextData, null );
}
public DefaultContext( final Context parent )
{
this( new Hashtable(), parent );
}
public DefaultContext()
{
this( (Context)null );
}
public Object get( final Object key )
{
final Object data = m_contextData.get( key );
if( null == m_parent || null != data )
{
return data;
}
return m_parent.get( key );
}
public void put( final Object key, final Object value )
{
m_contextData.put( key, value );
}
}
1.1
jakarta-avalon/src/java/org/apache/avalon/context/Recontextualizable.java
Index: Recontextualizable.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.context;
/**
* Extends composer to allow recontextualizing.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public interface Recontextualizable
extends Contextualizable
{
void recontextualizable( Context context ) ;
}
1.1
jakarta-avalon/src/java/org/apache/avalon/context/Resolvable.java
Index: Resolvable.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.context;
/**
* This interface is used to indicate objects that need to be
* resolved in some particular context.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public interface Resolvable
{
/**
* Resolve a object to a value.
*
* @param context the contextwith respect which to resolve
* @return the resolved object
*/
Object resolve( Context context );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]