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-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel Target.java
Date Sun, 05 May 2002 21:18:06 GMT
donaldp     02/05/05 14:18:06

  Modified:    container/src/java/org/apache/myrmidon/components/workspace
                        DefaultWorkspace.java
               container/src/java/org/apache/myrmidon/interfaces/oldmodel
                        Target.java
  Log:
  Use task to do Typelib deployment.
  
  Revision  Changes    Path
  1.55      +41 -54    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java
  
  Index: DefaultWorkspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/workspace/DefaultWorkspace.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- DefaultWorkspace.java	5 May 2002 13:57:00 -0000	1.54
  +++ DefaultWorkspace.java	5 May 2002 21:18:05 -0000	1.55
  @@ -16,13 +16,10 @@
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.interfaces.deployer.Deployer;
  -import org.apache.myrmidon.interfaces.deployer.TypeLibraryDeployer;
   import org.apache.myrmidon.interfaces.event.TaskEventManager;
   import org.apache.myrmidon.interfaces.executor.ExecutionContainer;
   import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
   import org.apache.myrmidon.interfaces.executor.Executor;
  -import org.apache.myrmidon.interfaces.library.Library;
  -import org.apache.myrmidon.interfaces.library.TypeLibraryManager;
   import org.apache.myrmidon.interfaces.oldmodel.Dependency;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.oldmodel.Target;
  @@ -36,7 +33,7 @@
    * This is the default implementation of Workspace.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.54 $ $Date: 2002/05/05 13:57:00 $
  + * @version $Revision: 1.55 $ $Date: 2002/05/05 21:18:05 $
    */
   public class DefaultWorkspace
       extends AbstractLogEnabled
  @@ -52,7 +49,6 @@
   
       private Executor m_executor;
       private TypeManager m_typeManager;
  -    private Deployer m_deployer;
   
       /** A map from Project object -> ProjectEntry for that project. */
       private HashMap m_entries = new HashMap();
  @@ -92,7 +88,6 @@
           m_eventManager = (TaskEventManager)serviceManager.lookup( TaskEventManager.ROLE
);
           m_typeManager = (TypeManager)serviceManager.lookup( TypeManager.ROLE );
           m_executor = (Executor)serviceManager.lookup( Executor.ROLE );
  -        m_deployer = (Deployer)serviceManager.lookup( Deployer.ROLE );
       }
   
       /**
  @@ -111,46 +106,6 @@
           executeTarget( entry, target );
       }
   
  -    private void deployTypeLib( final TypeLibraryManager typeLibraryManager,
  -                                final Deployer deployer,
  -                                final Project project )
  -        throws Exception
  -    {
  -        final TypeLib[] typeLibs = project.getTypeLibs();
  -
  -        for( int i = 0; i < typeLibs.length; i++ )
  -        {
  -            final TypeLib typeLib = typeLibs[ i ];
  -            deployTypeLib( typeLibraryManager, deployer, typeLib );
  -        }
  -    }
  -
  -    private void deployTypeLib( final TypeLibraryManager typeLibraryManager,
  -                                final Deployer deployer,
  -                                final TypeLib typeLib )
  -        throws Exception
  -    {
  -        try
  -        {
  -            final Library library = typeLibraryManager.getTypeLibrary( typeLib.getLibrary()
);
  -            final TypeLibraryDeployer typeDeployer = deployer.createDeployer( library );
  -            if( null == typeLib.getRole() )
  -            {
  -                // Deploy everything in the typelib
  -                typeDeployer.deployAll();
  -            }
  -            else
  -            {
  -                // Deploy the specified type
  -                typeDeployer.deployType( typeLib.getRole(), typeLib.getName() );
  -            }
  -        }
  -        catch( final Exception e )
  -        {
  -            final String message = REZ.getString( "no-deploy.error", typeLib.getLibrary()
);
  -            throw new TaskException( message, e );
  -        }
  -    }
   
       /**
        * Creates an execution frame for a project.
  @@ -179,7 +134,10 @@
   
           //We need to create a new deployer so that it deploys
           //to project specific TypeManager
  -        final Deployer deployer = m_deployer.createChildDeployer( serviceManager );
  +        final Deployer parentDeployer =
  +            (Deployer)frame.getServiceManager().lookup( Deployer.ROLE );
  +        final Deployer deployer =
  +            parentDeployer.createChildDeployer( serviceManager );
           serviceManager.put( Deployer.ROLE, deployer );
   
           //We need to place projects and ProjectManager
  @@ -197,11 +155,6 @@
            */
           serviceManager.put( ExecutionFrame.ROLE, frame );
   
  -        // Deploy the imported typelibs
  -        final TypeLibraryManager typeLibraryManager =
  -            (TypeLibraryManager)m_frame.getServiceManager().lookup( TypeLibraryManager.ROLE
);
  -        deployTypeLib( typeLibraryManager, deployer, project );
  -
           return frame;
       }
   
  @@ -216,6 +169,7 @@
               {
                   final ExecutionFrame frame = createExecutionFrame( project );
                   entry = new ProjectEntry( project, frame );
  +                executeTypeLibs( entry );
                   m_entries.put( project, entry );
               }
               catch( Exception e )
  @@ -336,6 +290,40 @@
       }
   
       /**
  +     * Processes a typelib declaration.
  +     *
  +     * @param entry the project to execute the target in.
  +     */
  +    private void executeTypeLibs( final ProjectEntry entry )
  +        throws TaskException
  +    {
  +        final TypeLib[] typeLibs = entry.getProject().getTypeLibs();
  +        for( int i = 0; i < typeLibs.length; i++ )
  +        {
  +            final TypeLib typeLib = typeLibs[ i ];
  +            executeTypeLib( entry, typeLib );
  +        }
  +    }
  +
  +    /**
  +     * Processes a typelib declaration.
  +     *
  +     * @param entry the project to execute the target in.
  +     */
  +    private void executeTypeLib( final ProjectEntry entry,
  +                                 final TypeLib typeLib )
  +        throws TaskException
  +    {
  +        final ModelElement typelibModel =
  +            new ModelElement( "typelib", "myFile:?:?" );
  +        typelibModel.setAttribute( "library", typeLib.getLibrary() );
  +        typelibModel.setAttribute( "name", typeLib.getName() );
  +        typelibModel.setAttribute( "role", typeLib.getRole() );
  +
  +        m_executor.execute( typelibModel, entry.getFrame() );
  +    }
  +
  +    /**
        * Executes a target.  Does not check whether the target has been
        * executed already, and does not check that its dependencies have been
        * executed.
  @@ -350,8 +338,7 @@
           throws TaskException
       {
           final ModelElement targetModel =
  -            new ModelElement( "target",
  -                              target.getLocation() );
  +            new ModelElement( "target", "myFile:?:?" );
           targetModel.setAttribute( "name", name );
   
           final String depends = buildDepends( target.getDependencies() );
  
  
  
  1.3       +1 -11     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Target.java
  
  Index: Target.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Target.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Target.java	5 May 2002 13:57:00 -0000	1.2
  +++ Target.java	5 May 2002 21:18:06 -0000	1.3
  @@ -14,7 +14,7 @@
    * Targets in build file.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.2 $ $Date: 2002/05/05 13:57:00 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/05 21:18:06 $
    */
   public class Target
   {
  @@ -41,16 +41,6 @@
                   m_dependencies.add( dependencies[ i ] );
               }
           }
  -    }
  -
  -    /**
  -     * Return location in build file.
  -     *
  -     * @return the location in build file
  -     */
  -    public String getLocation()
  -    {
  -        return "Target.getLocation() not implemented yet";
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message