ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/manifest core-ant-descriptor.xml runtime-ant-descriptor.xml
Date Wed, 27 Jun 2001 01:50:40 GMT
donaldp     01/06/26 18:50:40

  Modified:    proposal/myrmidon/src/make sample.ant
               proposal/myrmidon/src/manifest core-ant-descriptor.xml
                        runtime-ant-descriptor.xml
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/libs/core
                        Property.java
               proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime
                        AntCall.java Import.java
  Removed:     proposal/myrmidon/src/java/org/apache/ant/modules/basic
                        AntCall.java Property.java
               proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime
                        ImportTask.java
  Log:
  Rearranged location for final tasks still left in ant namespace.
  
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/core/Property.java
  
  Index: Property.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.myrmidon.libs.core;
  
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.myrmidon.api.TaskContext;
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.components.type.TypeException;
  import org.apache.myrmidon.components.type.TypeFactory;
  import org.apache.myrmidon.components.type.TypeManager;
  import org.apache.myrmidon.framework.AbstractContainerTask;
  import org.apache.myrmidon.framework.DataType;
  
  /**
   * This is the property "task" to declare a binding of a datatype to a name.
   *
   * TODO: Determine final format of property task.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class Property
      extends AbstractContainerTask
      implements Configurable
  {
      private String              m_name;
      private Object              m_value;
      private boolean             m_localScope     = true;
      private TypeFactory         m_factory;
  
      public void compose( final ComponentManager componentManager )
          throws ComponentException
      {
          super.compose( componentManager );
  
          final TypeManager typeManager = (TypeManager)componentManager.lookup( TypeManager.ROLE
);
          try { m_factory = typeManager.getFactory( DataType.ROLE ); }
          catch( final TypeException te )
          {
              throw new ComponentException( "Unable to retrieve factory from TypeManager",
te );
          }
      }
  
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
          final String[] attributes = configuration.getAttributeNames();
          for( int i = 0; i < attributes.length; i++ )
          {
              final String name = attributes[ i ];
              final String value = configuration.getAttribute( name );
              configure( this, name, value );
          }
  
          final Configuration[] children = configuration.getChildren();
          for( int i = 0; i < children.length; i++ )
          {
              try
              {
                  final DataType value = (DataType)m_factory.create( children[ i ].getName()
);
                  configure( value, children[ i ] );
                  setValue( value );
              }
              catch( final Exception e )
              {
                  throw new ConfigurationException( "Unable to set datatype", e );
              }
          }
      }
  
      public void setName( final String name )
      {
          m_name = name;
      }
  
      public void setValue( final Object value )
          throws TaskException
      {
          if( null != m_value )
          {
              throw new TaskException( "Value can not be set multiple times" );
          }
  
          m_value = value;
      }
  
      public void setLocalScope( final boolean localScope )
      {
          m_localScope = localScope;
      }
  
      public void execute()
          throws TaskException
      {
          if( null == m_name )
          {
              throw new TaskException( "Name must be specified" );
          }
  
          if( null == m_value )
          {
              throw new TaskException( "Value must be specified" );
          }
  
          if( m_localScope )
          {
              getContext().setProperty( m_name, m_value );
          }
          else
          {
              getContext().setProperty( m_name, m_value, TaskContext.PARENT );
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/AntCall.java
  
  Index: AntCall.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.myrmidon.libs.runtime;
  
  import java.util.ArrayList;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.DefaultTaskContext;
  import org.apache.myrmidon.api.TaskContext;
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.components.manager.ProjectManager;
  import org.apache.myrmidon.components.model.Project;
  
  /**
   * TODO: Determine if low cost antcalls are needed.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class AntCall
      extends AbstractTask
      implements Composable
  {
      private ProjectManager        m_projectManager;
      private Project               m_project;
      private String                m_target;
      private ArrayList             m_properties     = new ArrayList();
      private TaskContext           m_childContext;
      private ComponentManager      m_componentManager;
  
      public void contextualize( final Context context )
      {
          super.contextualize( context );
          m_childContext = new DefaultTaskContext( getContext() );
      }
  
      public void compose( final ComponentManager componentManager )
          throws ComponentException
      {
          m_componentManager = componentManager;
          m_projectManager = (ProjectManager)componentManager.lookup( ProjectManager.ROLE
);
          m_project = (Project)componentManager.lookup( Project.ROLE );
      }
  
      public void setTarget( final String target )
      {
          m_target = target;
      }
  /*
      public Property createParam()
          throws Exception
      {
          final Property property = new Property();
          property.setLogger( getLogger() );
          property.contextualize( m_childContext );
          property.compose( m_componentManager );
          m_properties.add( property );
          return property;
      }
  */
      public void execute()
          throws TaskException
      {
          if( null == m_target )
          {
              throw new TaskException( "Target attribute must be specified" );
          }
  
  /*
          final int size = m_properties.size();
          for( int i = 0; i < size; i++ )
          {
              final Property property = (Property)m_properties.get( i );
              property.execute();
          }
  */
          getLogger().info( "Calling target " + m_target );
  
          //This calls startProject() which is probably not wanted???
          //TODO: FIXME when scoping is decided
          //m_projectManager.executeProject( m_project, m_target );
          getLogger().warn( "ANTCALL NOT IMPLEMENTED - waiting for " +
                            "scope rules to be decided" );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/libs/runtime/Import.java
  
  Index: Import.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.myrmidon.libs.runtime;
  
  import java.io.File;
  import java.net.MalformedURLException;
  import java.net.URL;
  import org.apache.avalon.framework.component.ComponentException;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.Composable;
  import org.apache.myrmidon.api.AbstractTask;
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.components.deployer.Deployer;
  import org.apache.myrmidon.components.deployer.DeploymentException;
  
  /**
   * Task to import a tasklib.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class Import
      extends AbstractTask
      implements Composable
  {
      private File        m_lib;
      private Deployer    m_deployer;
  
      public void compose( final ComponentManager componentManager )
          throws ComponentException
      {
          m_deployer = (Deployer)componentManager.lookup( Deployer.ROLE );
      }
  
      public void setLib( final File lib )
      {
          m_lib = lib;
      }
  
      public void execute()
          throws TaskException
      {
          if( null == m_lib )
          {
              throw new TaskException( "Must specify lib parameter" );
          }
  
          try
          {
              m_deployer.deploy( m_lib );
          }
          catch( final DeploymentException de )
          {
              throw new TaskException( "Error importing tasklib", de );
          }
      }
  }
  
  
  
  1.10      +5 -2      jakarta-ant/proposal/myrmidon/src/make/sample.ant
  
  Index: sample.ant
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/make/sample.ant,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- sample.ant	2001/06/16 03:37:20	1.9
  +++ sample.ant	2001/06/27 01:50:38	1.10
  @@ -39,23 +39,26 @@
     <target name="typedef-test">
       <typedef name="echo2" 
                type="task" 
  -             classname="org.apache.ant.modules.basic.Echo" 
  +             classname="org.apache.myrmidon.libs.core.Echo" 
                lib="../../dist/lib/core.atl" />
   
       <echo2 message="Luke to Echo base. Can you hear me?"/>
     </target>
   
     <target name="converterdef-test">
  -    <converterdef classname="org.apache.ant.modules.basic.StringToClassConverter"
  +    <converterdef classname="org.apache.myrmidon.libs.core.StringToClassConverter"
                     source-type="java.lang.String"
                     destination-type="java.lang.Class"
                     lib="../../dist/lib/core.atl" />
     </target> 
   
     <target name="ant-call-test">
  +    <!-- test elided until we decide scope and necessity of ant-call -->
  +<!--
       <ant-call target="ant-call-test-target">
         <param name="blah" value="blah-value" />
       </ant-call>
  +-->
     </target>
   
     <target name="ant-call-test-target">
  
  
  
  1.5       +1 -2      jakarta-ant/proposal/myrmidon/src/manifest/core-ant-descriptor.xml
  
  Index: core-ant-descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/manifest/core-ant-descriptor.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- core-ant-descriptor.xml	2001/06/17 01:36:56	1.4
  +++ core-ant-descriptor.xml	2001/06/27 01:50:39	1.5
  @@ -4,8 +4,7 @@
   
       <!-- basic tasks/datatypes/coverters required in most environments -->
       <task name="echo" classname="org.apache.myrmidon.libs.core.Echo" />
  -    <task name="property" classname="org.apache.ant.modules.basic.Property" />
  -    <task name="ant-call" classname="org.apache.ant.modules.basic.AntCall" />
  +    <task name="property" classname="org.apache.myrmidon.libs.core.Property" />
   
     </types>
     
  
  
  
  1.3       +2 -1      jakarta-ant/proposal/myrmidon/src/manifest/runtime-ant-descriptor.xml
  
  Index: runtime-ant-descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/manifest/runtime-ant-descriptor.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- runtime-ant-descriptor.xml	2001/06/17 00:49:37	1.2
  +++ runtime-ant-descriptor.xml	2001/06/27 01:50:39	1.3
  @@ -6,7 +6,8 @@
       <task name="facility" classname="org.apache.myrmidon.libs.runtime.Facility" />
       <task name="typedef" classname="org.apache.myrmidon.libs.runtime.TypeDef" />
       <task name="converterdef" classname="org.apache.myrmidon.libs.runtime.ConverterDef"
/>
  -    <task name="import" classname="org.apache.myrmidon.libs.runtime.ImportTask" />
  +    <task name="import" classname="org.apache.myrmidon.libs.runtime.Import" />
  +    <task name="ant-call" classname="org.apache.myrmidon.libs.runtime.AntCall" />
   
     </types>
   
  
  
  

Mime
View raw message