Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 79248 invoked from network); 13 Jun 2002 05:19:08 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 13 Jun 2002 05:19:08 -0000 Received: (qmail 10901 invoked by uid 97); 13 Jun 2002 05:19:16 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 10873 invoked by uid 97); 13 Jun 2002 05:19:16 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 10860 invoked by uid 97); 13 Jun 2002 05:19:15 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 13 Jun 2002 05:19:00 -0000 Message-ID: <20020613051900.41852.qmail@icarus.apache.org> From: donaldp@apache.org To: jakarta-ant-myrmidon-cvs@apache.org Subject: cvs commit: jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework ExecuteTarget.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N donaldp 2002/06/12 22:19:00 Modified: ant1compat/src/java/org/apache/tools/ant/taskdefs Ant.java antlib/src/java/org/apache/antlib/project AntTask.java container/src/java/org/apache/myrmidon/components/embeddor DefaultEmbeddor.java container/src/test/org/apache/myrmidon/components/embeddor/test DefaultEmbeddorTest.java container/src/java/org/apache/myrmidon/interfaces EmbeddedAnt.java container/src/java/org/apache/myrmidon/interfaces/embeddor Embeddor.java framework/src/java/org/apache/myrmidon/framework ExecuteTarget.java Log: Add support so that embeddors can load projects (or construct them manually) and then pass them into creation of ExecutionFrame. In the future this will allow GUIs/etc to create own models (or get myrmidon to load them and then use them outside ant) and pass them in when needing to perform execution. Revision Changes Path 1.4 +11 -1 jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/taskdefs/Ant.java Index: Ant.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/taskdefs/Ant.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Ant.java 23 Apr 2002 02:07:14 -0000 1.3 +++ Ant.java 13 Jun 2002 05:18:59 -0000 1.4 @@ -55,9 +55,11 @@ package org.apache.tools.ant.taskdefs; import java.io.File; +import java.net.MalformedURLException; import org.apache.avalon.excalibur.io.FileUtil; import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.ExecuteTarget; +import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor; import org.apache.tools.ant.util.FileUtils; /** @@ -142,6 +144,14 @@ } final File file = FileUtil.resolveFile( dir, antFile ); - exe.setProjectFile( file, null ); + try + { + final String uri = file.toURL().toExternalForm(); + exe.setProject( new ProjectDescriptor( uri ) ); + } + catch( MalformedURLException mue ) + { + throw new TaskException( mue.getMessage(), mue ); + } } } 1.2 +11 -1 jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/AntTask.java Index: AntTask.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/AntTask.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AntTask.java 3 May 2002 10:34:02 -0000 1.1 +++ AntTask.java 13 Jun 2002 05:18:59 -0000 1.2 @@ -8,8 +8,10 @@ package org.apache.antlib.project; import java.io.File; +import java.net.MalformedURLException; import org.apache.myrmidon.framework.ExecuteTarget; import org.apache.myrmidon.api.TaskException; +import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor; /** * Executes a target in a named build file. @@ -68,6 +70,14 @@ m_file = getContext().resolveFile( DEFAULT_BUILD_FILE ); } - exe.setProjectFile( m_file, m_type ); + try + { + final String uri = m_file.toURL().toExternalForm(); + exe.setProject( new ProjectDescriptor( uri, m_type ) ); + } + catch( MalformedURLException mue ) + { + throw new TaskException( mue.getMessage(), mue ); + } } } 1.94 +5 -2 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java Index: DefaultEmbeddor.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v retrieving revision 1.93 retrieving revision 1.94 diff -u -r1.93 -r1.94 --- DefaultEmbeddor.java 13 Jun 2002 03:52:32 -0000 1.93 +++ DefaultEmbeddor.java 13 Jun 2002 05:18:59 -0000 1.94 @@ -117,9 +117,12 @@ /** * Creates an execution frame. */ - public ExecutionFrame createExecutionFrame( final Map properties ) + public ExecutionFrame createExecutionFrame( final Map properties, + final Project[] projects ) throws Exception { + //TODO: Handle projects parameters + // setup a service manager that creates the project services final ServiceManager projServiceManager = (ServiceManager)createService( ServiceManager.class, 1.35 +2 -2 jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java Index: DefaultEmbeddorTest.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/embeddor/test/DefaultEmbeddorTest.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- DefaultEmbeddorTest.java 13 Jun 2002 03:52:32 -0000 1.34 +++ DefaultEmbeddorTest.java 13 Jun 2002 05:18:59 -0000 1.35 @@ -128,7 +128,7 @@ final Project project = embeddor.createProject( descriptor ); // Build the workspace - final ExecutionFrame frame = embeddor.createExecutionFrame( new HashMap() ); + final ExecutionFrame frame = embeddor.createExecutionFrame( new HashMap(), null ); // Install a listener final LogMessageTracker listener = new LogMessageTracker(); 1.28 +2 -2 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java Index: EmbeddedAnt.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- EmbeddedAnt.java 13 Jun 2002 04:24:40 -0000 1.27 +++ EmbeddedAnt.java 13 Jun 2002 05:18:59 -0000 1.28 @@ -152,7 +152,7 @@ final ProjectDescriptor project = prepareProjectDescriptor(); final ExecutionFrame frame = - embeddor.createExecutionFrame( m_workspaceProperties ); + embeddor.createExecutionFrame( m_workspaceProperties, null ); prepareListeners( embeddor, frame ); //execute the project 1.26 +16 -2 jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java Index: Embeddor.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/embeddor/Embeddor.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Embeddor.java 13 Jun 2002 03:52:32 -0000 1.25 +++ Embeddor.java 13 Jun 2002 05:19:00 -0000 1.26 @@ -48,16 +48,30 @@ /** * Creates an {@link ExecutionFrame} that can be used to execute projects. + * Note that the set of {@link Project} objects allows the model object used + * by GUI to be the same model as used by the engine. * * @param properties The properties to define in the frame. These * are added to the properties in the embeddor's * root execution frame. + * @param projects The projects that have been already been loaded by + * caller and that should be used when frame is used + * to execute project. * @return the ExecutionFrame * @throws Exception If the frame could not be created. */ - ExecutionFrame createExecutionFrame( Map properties ) + ExecutionFrame createExecutionFrame( Map properties, Project[] projects ) throws Exception; + /** + * Execute a target in a project in specified frame. + * If target is null then the default target in project will be executed. + * + * @param frame the frame in which to execute project + * @param project the descriptor point to project + * @param target the target in project to execute (May be null). + * @throws TaskException if error executing target + */ void execute( ExecutionFrame frame, ProjectDescriptor project, String target ) 1.22 +2 -23 jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/ExecuteTarget.java Index: ExecuteTarget.java =================================================================== RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/ExecuteTarget.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ExecuteTarget.java 13 Jun 2002 04:01:04 -0000 1.21 +++ ExecuteTarget.java 13 Jun 2002 05:19:00 -0000 1.22 @@ -7,8 +7,6 @@ */ package org.apache.myrmidon.framework; -import java.io.File; -import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; import org.apache.avalon.excalibur.i18n.ResourceManager; @@ -64,25 +62,6 @@ } /** - * Sets the project file to execute. - */ - public void setProjectFile( final File projectFile, - final String projectType ) - throws TaskException - { - try - { - final String uri = projectFile.toURL().toExternalForm(); - m_project = - new ProjectDescriptor( uri, projectType ); - } - catch( final MalformedURLException mue ) - { - throw new TaskException( mue.getMessage(), mue ); - } - } - - /** * Returns the parameters for executing the target. This map can be * modified. */ @@ -103,7 +82,7 @@ try { // TODO - need to be able to inherit services (TypeManager specifically) - final ExecutionFrame frame = embeddor.createExecutionFrame( properties ); + final ExecutionFrame frame = embeddor.createExecutionFrame( properties, null ); embeddor.execute( frame, m_project, m_target ); } catch( final Exception e ) -- To unsubscribe, e-mail: For additional commands, e-mail: