geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r332409 - in /geronimo/gbuild/trunk: pom.xml src/main/java/org/apache/geronimo/gbuild/App.java src/main/java/org/apache/geronimo/gbuild/agent/DistrubutedBuildController.java src/main/resources/META-INF/
Date Fri, 11 Nov 2005 00:42:58 GMT
Author: dblevins
Date: Thu Nov 10 16:42:55 2005
New Revision: 332409

URL: http://svn.apache.org/viewcvs?rev=332409&view=rev
Log:
Moved to m2.

Removed:
    geronimo/gbuild/trunk/src/main/resources/META-INF/
Modified:
    geronimo/gbuild/trunk/pom.xml
    geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/App.java
    geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/agent/DistrubutedBuildController.java

Modified: geronimo/gbuild/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/pom.xml?rev=332409&r1=332408&r2=332409&view=diff
==============================================================================
--- geronimo/gbuild/trunk/pom.xml (original)
+++ geronimo/gbuild/trunk/pom.xml Thu Nov 10 16:42:55 2005
@@ -7,6 +7,42 @@
   <version>1.0-SNAPSHOT</version>
   <name>Maven Quick Start Archetype</name>
   <url>http://maven.apache.org</url>
+  <build>
+      <plugins>
+	<plugin>
+	  <groupId>org.codehaus.plexus</groupId>
+	  <artifactId>plexus-maven-plugin</artifactId>
+	  <version>1.1</version>
+	  <executions>
+	    <execution>
+	      <goals>
+		<goal>descriptor</goal>
+	      </goals>
+	    </execution>
+	  </executions>
+	</plugin>
+      </plugins>
+  </build>   
+  <repositories>
+    <repository>
+      <releases>
+	<enabled>false</enabled>
+      </releases>
+      <id>snapshots</id>
+      <name>Maven Snapshot Development Repository</name>
+      <url>http://snapshots.maven.codehaus.org/maven2</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <releases>
+	<enabled>false</enabled>
+      </releases>
+      <id>snapshots</id>
+      <name>Maven Central Plugins Development Repository</name>
+      <url>http://snapshots.maven.codehaus.org/maven2</url>
+    </pluginRepository>
+  </pluginRepositories>
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.continuum</groupId>

Modified: geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/App.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/App.java?rev=332409&r1=332408&r2=332409&view=diff
==============================================================================
--- geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/App.java (original)
+++ geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/App.java Thu Nov 10 16:42:55
2005
@@ -26,8 +26,22 @@
 
         thread(new HelloWorldProducer(), false);
         thread(new HelloWorldConsumer(), false);
+        Thread.sleep(2000);
         thread(new HelloWorldProducer(), false);
         thread(new HelloWorldConsumer(), false);
+        Thread.sleep(2000);
+        thread(new HelloWorldProducer(), false);
+        thread(new HelloWorldConsumer(), false);
+        Thread.sleep(2000);
+        thread(new HelloWorldProducer(), false);
+        thread(new HelloWorldConsumer(), false);
+        Thread.sleep(2000);
+        thread(new HelloWorldProducer(), false);
+        thread(new HelloWorldConsumer(), false);
+        thread(new HelloWorldProducer(), false);
+        Thread.sleep(2000);
+        thread(new HelloWorldConsumer(), false);
+        Thread.sleep(2000);
     }
 
     public static void thread(Runnable runnable, boolean daemon) {

Modified: geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/agent/DistrubutedBuildController.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/agent/DistrubutedBuildController.java?rev=332409&r1=332408&r2=332409&view=diff
==============================================================================
--- geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/agent/DistrubutedBuildController.java
(original)
+++ geronimo/gbuild/trunk/src/main/java/org/apache/geronimo/gbuild/agent/DistrubutedBuildController.java
Thu Nov 10 16:42:55 2005
@@ -16,19 +16,10 @@
  */
 package org.apache.geronimo.gbuild.agent;
 
-import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.model.project.BuildResult;
-import org.apache.maven.continuum.model.scm.ScmResult;
-import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.apache.maven.continuum.core.action.AbstractContinuumAction;
-import org.apache.maven.continuum.scm.ContinuumScmException;
-import org.apache.maven.continuum.utils.ContinuumUtils;
-import org.apache.maven.continuum.project.ContinuumProjectState;
-
 import org.apache.maven.continuum.core.action.AbstractContinuumAction;
+import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.scm.ScmResult;
 import org.apache.maven.continuum.notification.ContinuumNotificationDispatcher;
 import org.apache.maven.continuum.project.ContinuumProjectState;
@@ -41,8 +32,8 @@
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.util.Map;
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @version $Rev$ $Date$
@@ -69,9 +60,8 @@
      */
     private WorkingDirectoryService workingDirectoryService;
 
-    
-    public void build( Project project, BuildDefinition buildDefinition, int trigger )
-    {
+
+    public void build(Project project, BuildDefinition buildDefinition, int trigger) {
 
         long startTime = System.currentTimeMillis();
 
@@ -91,203 +81,173 @@
         // methods, even in a case of failure.
         // ----------------------------------------------------------------------
 
-        try
-        {
-            notifierDispatcher.buildStarted( project );
+        try {
+            notifierDispatcher.buildStarted(project);
 
             Map actionContext = new HashMap();
 
-            actionContext.put( AbstractDistributedContinuumAction.KEY_PROJECT, project );
+            actionContext.put(AbstractDistributedContinuumAction.KEY_PROJECT, project);
 
-            actionContext.put( AbstractDistributedContinuumAction.KEY_BUILD_DEFINITION, buildDefinition
);
+            actionContext.put(AbstractDistributedContinuumAction.KEY_BUILD_DEFINITION, buildDefinition);
 
-            actionContext.put( AbstractContinuumAction.KEY_TRIGGER, new Integer( trigger
) );
+            actionContext.put(AbstractContinuumAction.KEY_TRIGGER, new Integer(trigger));
 
             ScmResult scmResult = null;
 
-            try
-            {
-                actionManager.lookup( "check-working-directory" ).execute( actionContext
);
-
-                boolean workingDirectoryExists = AbstractContinuumAction.getBoolean( actionContext,
-                                                                                     AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS
);
-
-                if ( workingDirectoryExists )
-                {
-                    actionManager.lookup( "update-working-directory-from-scm" ).execute(
actionContext );
+            try {
+                actionManager.lookup("check-working-directory").execute(actionContext);
 
-                    scmResult = AbstractContinuumAction.getUpdateScmResult( actionContext,
null );
-                }
-                else
-                {
-                    actionContext.put( AbstractContinuumAction.KEY_WORKING_DIRECTORY,
-                                       workingDirectoryService.getWorkingDirectory( project
).getAbsolutePath() );
+                boolean workingDirectoryExists = AbstractContinuumAction.getBoolean(actionContext,
+                        AbstractContinuumAction.KEY_WORKING_DIRECTORY_EXISTS);
+
+                if (workingDirectoryExists) {
+                    actionManager.lookup("update-working-directory-from-scm").execute(actionContext);
 
-                    actionManager.lookup( "checkout-project" ).execute( actionContext );
+                    scmResult = AbstractContinuumAction.getUpdateScmResult(actionContext,
null);
+                } else {
+                    actionContext.put(AbstractContinuumAction.KEY_WORKING_DIRECTORY,
+                            workingDirectoryService.getWorkingDirectory(project).getAbsolutePath());
 
-                    scmResult = AbstractContinuumAction.getCheckoutResult( actionContext,
null );
+                    actionManager.lookup("checkout-project").execute(actionContext);
+
+                    scmResult = AbstractContinuumAction.getCheckoutResult(actionContext,
null);
                 }
 
                 // ----------------------------------------------------------------------
                 // Check to see if there was a error while checking out/updating the project
                 // ----------------------------------------------------------------------
 
-                if ( scmResult == null || !scmResult.isSuccess() )
-                {
+                if (scmResult == null || !scmResult.isSuccess()) {
                     // scmResult must be converted before sotring it because jpox modify
value of all fields to null
-                    String error = convertScmResultToError( scmResult );
+                    String error = convertScmResultToError(scmResult);
 
-                    build = makeAndStoreBuildResult( project, scmResult, startTime, trigger
);
+                    build = makeAndStoreBuildResult(project, scmResult, startTime, trigger);
 
-                    build.setError( error );
+                    build.setError(error);
 
-                    store.updateBuildResult( build );
+                    store.updateBuildResult(build);
 
-                    build = store.getBuildResult( build.getId() );
+                    build = store.getBuildResult(build.getId());
 
-                    project.setState( build.getState() );
+                    project.setState(build.getState());
 
-                    store.updateProject( project );
+                    store.updateProject(project);
 
                     return;
                 }
 
-                actionContext.put( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, scmResult
);
+                actionContext.put(AbstractContinuumAction.KEY_UPDATE_SCM_RESULT, scmResult);
 
-                scmResult = (ScmResult) actionContext.get( AbstractContinuumAction.KEY_UPDATE_SCM_RESULT
);
+                scmResult = (ScmResult) actionContext.get(AbstractContinuumAction.KEY_UPDATE_SCM_RESULT);
 
-                actionManager.lookup( "update-project-from-working-directory" ).execute(
actionContext );
+                actionManager.lookup("update-project-from-working-directory").execute(actionContext);
 
-                actionManager.lookup( "execute-builder" ).execute( actionContext );
+                actionManager.lookup("execute-builder").execute(actionContext);
 
-                String s = (String) actionContext.get( AbstractContinuumAction.KEY_BUILD_ID
);
+                String s = (String) actionContext.get(AbstractContinuumAction.KEY_BUILD_ID);
 
-                if ( s != null )
-                {
-                    build = store.getBuildResult( Integer.valueOf( s ).intValue() );
+                if (s != null) {
+                    build = store.getBuildResult(Integer.valueOf(s).intValue());
                 }
             }
-            catch ( Throwable e )
-            {
-                getLogger().error( "Error while building project.", e );
-
-                String s = (String) actionContext.get( AbstractContinuumAction.KEY_BUILD_ID
);
-
-                if ( s != null )
-                {
-                    build = store.getBuildResult( Integer.valueOf( s ).intValue() );
-                }
-                else
-                {
-                    build = makeAndStoreBuildResult( project, scmResult, startTime, trigger
);
+            catch (Throwable e) {
+                getLogger().error("Error while building project.", e);
+
+                String s = (String) actionContext.get(AbstractContinuumAction.KEY_BUILD_ID);
+
+                if (s != null) {
+                    build = store.getBuildResult(Integer.valueOf(s).intValue());
+                } else {
+                    build = makeAndStoreBuildResult(project, scmResult, startTime, trigger);
                 }
 
                 // This can happen if the "update project from scm" action fails
 
                 String error = null;
 
-                if ( e instanceof ContinuumScmException )
-                {
+                if (e instanceof ContinuumScmException) {
                     ContinuumScmException ex = (ContinuumScmException) e;
 
                     ScmResult result = ex.getResult();
 
-                    if ( result != null )
-                    {
-                        error = convertScmResultToError( result );
+                    if (result != null) {
+                        error = convertScmResultToError(result);
                     }
 
                 }
-                if ( error == null )
-                {
-                    error = ContinuumUtils.throwableToString( e );
+                if (error == null) {
+                    error = ContinuumUtils.throwableToString(e);
                 }
 
-                build.setError( error );
+                build.setError(error);
 
-                store.updateBuildResult( build );
+                store.updateBuildResult(build);
 
-                build = store.getBuildResult( build.getId() );
+                build = store.getBuildResult(build.getId());
 
-                project.setState( build.getState() );
+                project.setState(build.getState());
 
-                store.updateProject( project );
+                store.updateProject(project);
             }
         }
-        catch ( Exception ex )
-        {
-            if ( !Thread.interrupted() )
-            {
-                getLogger().error( "Internal error while building the project.", ex );
+        catch (Exception ex) {
+            if (!Thread.interrupted()) {
+                getLogger().error("Internal error while building the project.", ex);
             }
         }
-        finally
-        {
-            try
-            {
-                project = store.getProject( project.getId() );
+        finally {
+            try {
+                project = store.getProject(project.getId());
             }
-            catch ( ContinuumStoreException ex )
-            {
-                getLogger().error( "Internal error while building the project.", ex );
+            catch (ContinuumStoreException ex) {
+                getLogger().error("Internal error while building the project.", ex);
             }
 
-            if ( project.getState() != ContinuumProjectState.NEW &&
-                 project.getState() != ContinuumProjectState.OK &&
-                 project.getState() != ContinuumProjectState.FAILED &&
-                 project.getState() != ContinuumProjectState.ERROR )
-            {
-                try
-                {
-                    project.setState( ContinuumProjectState.ERROR );
+            if (project.getState() != ContinuumProjectState.NEW &&
+                    project.getState() != ContinuumProjectState.OK &&
+                    project.getState() != ContinuumProjectState.FAILED &&
+                    project.getState() != ContinuumProjectState.ERROR) {
+                try {
+                    project.setState(ContinuumProjectState.ERROR);
 
-                    store.updateProject( project );
+                    store.updateProject(project);
                 }
-                catch ( ContinuumStoreException e )
-                {
-                    getLogger().error( "Internal error while storing the project.", e );
+                catch (ContinuumStoreException e) {
+                    getLogger().error("Internal error while storing the project.", e);
                 }
             }
 
-            notifierDispatcher.buildComplete( project, build );
+            notifierDispatcher.buildComplete(project, build);
         }
     }
 
-    private String convertScmResultToError( ScmResult result )
-    {
+    private String convertScmResultToError(ScmResult result) {
         String error = "";
 
-        if ( result == null )
-        {
+        if (result == null) {
             error = "Scm result is null.";
-        }
-        else
-        {
-            if ( result.getCommandLine() != null )
-            {
-                error = "Command line: " + StringUtils.clean( result.getCommandLine() ) +
-                    System.getProperty( "line.separator" );
+        } else {
+            if (result.getCommandLine() != null) {
+                error = "Command line: " + StringUtils.clean(result.getCommandLine()) +
+                        System.getProperty("line.separator");
             }
 
-            if ( result.getProviderMessage() != null )
-            {
-                error = "Provider message: " + StringUtils.clean( result.getProviderMessage()
) +
-                    System.getProperty( "line.separator" );
+            if (result.getProviderMessage() != null) {
+                error = "Provider message: " + StringUtils.clean(result.getProviderMessage())
+
+                        System.getProperty("line.separator");
             }
 
-            if ( result.getCommandOutput() != null )
-            {
-                error += "Command output: " + System.getProperty( "line.separator" );
+            if (result.getCommandOutput() != null) {
+                error += "Command output: " + System.getProperty("line.separator");
                 error += "-------------------------------------------------------------------------------"
+
-                    System.getProperty( "line.separator" );
-                error += StringUtils.clean( result.getCommandOutput() ) + System.getProperty(
"line.separator" );
+                        System.getProperty("line.separator");
+                error += StringUtils.clean(result.getCommandOutput()) + System.getProperty("line.separator");
                 error += "-------------------------------------------------------------------------------"
+
-                    System.getProperty( "line.separator" );
+                        System.getProperty("line.separator");
             }
 
-            if ( result.getException() != null )
-            {
-                error += "Exception:" + System.getProperty( "line.separator" );
+            if (result.getException() != null) {
+                error += "Exception:" + System.getProperty("line.separator");
                 error += result.getException();
             }
         }
@@ -299,24 +259,23 @@
     //
     // ----------------------------------------------------------------------
 
-    private BuildResult makeAndStoreBuildResult( Project project, ScmResult scmResult, long
startTime, int trigger )
-        throws ContinuumStoreException
-    {
+    private BuildResult makeAndStoreBuildResult(Project project, ScmResult scmResult, long
startTime, int trigger)
+            throws ContinuumStoreException {
         BuildResult build = new BuildResult();
 
-        build.setState( ContinuumProjectState.ERROR );
+        build.setState(ContinuumProjectState.ERROR);
 
-        build.setTrigger( trigger );
+        build.setTrigger(trigger);
 
-        build.setStartTime( startTime );
+        build.setStartTime(startTime);
 
-        build.setEndTime( System.currentTimeMillis() );
+        build.setEndTime(System.currentTimeMillis());
 
-        build.setScmResult( scmResult );
+        build.setScmResult(scmResult);
 
-        store.addBuildResult( project, build );
+        store.addBuildResult(project, build);
 
-        return store.getBuildResult( build.getId() );
+        return store.getBuildResult(build.getId());
     }
 
 }



Mime
View raw message