Browse Source

Remove scoping for the time being as it wasn't really being used

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271634 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
c54524cf25
2 changed files with 1 additions and 71 deletions
  1. +0
    -29
      proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
  2. +1
    -42
      proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java

+ 0
- 29
proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java View File

@@ -8,7 +8,6 @@
package org.apache.myrmidon.api;

import java.io.File;
import org.apache.avalon.framework.Enum;

/**
* This interface represents the <em>Context</em> in which Task is executed.
@@ -22,12 +21,6 @@ import org.apache.avalon.framework.Enum;
public interface TaskContext
extends Context
{
//these values are used when setting properties to indicate the scope at
//which properties are set
ScopeEnum CURRENT = new ScopeEnum( "Current" );
ScopeEnum PARENT = new ScopeEnum( "Parent" );
ScopeEnum TOP_LEVEL = new ScopeEnum( "TopLevel" );

//these are the names of properties that every TaskContext must contain
String BASE_DIRECTORY = "myrmidon.base.directory";
String NAME = "myrmidon.task.name";
@@ -81,16 +74,6 @@ public interface TaskContext
void setProperty( String name, Object value )
throws TaskException;

/**
* Set property value.
*
* @param name the name of property
* @param value the value of property
* @param scope the scope at which to set property
*/
void setProperty( String name, Object value, ScopeEnum scope )
throws TaskException;

/**
* Create a Child Context.
* This allows separate hierarchly contexts to be easily constructed.
@@ -101,17 +84,5 @@ public interface TaskContext
*/
TaskContext createSubContext( String name )
throws TaskException;

/**
* Safe wrapper class for Scope enums.
*/
public final class ScopeEnum
extends Enum
{
ScopeEnum( final String name )
{
super( name );
}
}
}


+ 1
- 42
proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java View File

@@ -227,50 +227,9 @@ public class DefaultTaskContext
*/
public void setProperty( final String name, final Object value )
throws TaskException
{
setProperty( name, value, CURRENT );
}

/**
* Set property value.
*/
public void setProperty( final String name, final Object value, final ScopeEnum scope )
throws TaskException
{
checkPropertyValid( name, value );

if( CURRENT == scope )
{
m_contextData.put( name, value );
}
else if( PARENT == scope )
{
if( null == m_parent )
{
final String message = REZ.getString( "no-parent.error" );
throw new TaskException( message );
}
else
{
m_parent.setProperty( name, value );
}
}
else if( TOP_LEVEL == scope )
{
DefaultTaskContext context = this;

while( null != context.m_parent )
{
context = (DefaultTaskContext)context.m_parent;
}

context.m_contextData.put( name, value );
}
else
{
final String message = REZ.getString( "bad-scope.error", scope );
throw new IllegalStateException( message );
}
m_contextData.put( name, value );
}

/**


Loading…
Cancel
Save