Author: handyande Date: Mon Feb 26 12:11:37 2007 New Revision: 511984 URL: http://svn.apache.org/viewvc?view=rev&rev=511984 Log: Import a cleaner version of continuum-rpc-client, this makes more sense to the user with a clear definition of ProjectSummary vs. Project. See the main ContinuumClient class for the clean api, other classes have the same API as before (where possible)...
Added: maven/sandbox/trunk/continuum/continuum-client/ (with props) maven/sandbox/trunk/continuum/continuum-client/pom.xml maven/sandbox/trunk/continuum/continuum-client/src/ maven/sandbox/trunk/continuum/continuum-client/src/main/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ClientException.java maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ContinuumClient.java maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ProjectsReader.java - copied, changed from r511586, maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/SampleClient.java maven/sandbox/trunk/continuum/continuum-client/src/main/mdo/ maven/sandbox/trunk/continuum/continuum-client/src/main/mdo/continuum-client.xml Propchange: maven/sandbox/trunk/continuum/continuum-client/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Feb 26 12:11:37 2007 @@ -0,0 +1,14 @@ +target +*~ +.*.swp +*.log +*.patch +*.diff +*.ipr +*.iws +*.iml +.classpath +.project +.settings +.wtpmodules +cobertura.ser Added: maven/sandbox/trunk/continuum/continuum-client/pom.xml URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-client/pom.xml?view=auto&rev=511984 ============================================================================== --- maven/sandbox/trunk/continuum/continuum-client/pom.xml (added) +++ maven/sandbox/trunk/continuum/continuum-client/pom.xml Mon Feb 26 12:11:37 2007 @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <artifactId>continuum-parent</artifactId> + <groupId>org.apache.maven.continuum</groupId> + <version>1.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>continuum-client</artifactId> + <name>Continuum remote client</name> + <description>Client code for accessing Apache Continuum servers</description> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.modello</groupId> + <artifactId>modello-maven-plugin</artifactId> + <executions> + <execution> + <id>modello-continuum</id> + <goals> + <goal>java</goal> + </goals> + <configuration> + <model>src/main/mdo/continuum-client.xml</model> + </configuration> + </execution> + </executions> + <configuration> + <version>1.1.0</version> + <packageWithVersion>false</packageWithVersion> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <configuration> + <mainClass>org.apache.maven.continuum.client.SampleClient</mainClass> + <arguments> + <argument>${xmlRpcUrl}</argument> + </arguments> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>xmlrpc</groupId> + <artifactId>xmlrpc</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.0.2</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>2.0.2</version> + </dependency> + </dependencies> +</project> Added: maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ClientException.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ClientException.java?view=auto&rev=511984 ============================================================================== --- maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ClientException.java (added) +++ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ClientException.java Mon Feb 26 12:11:37 2007 @@ -0,0 +1,25 @@ +package org.apache.maven.continuum.client; + +/** + * A wrapper for the specific protocol exceptions that may be encountered. + * + * @author Andrew Williams + */ +public class ClientException + extends Exception +{ + public ClientException( String message ) + { + super( message ); + } + + public ClientException( Throwable cause ) + { + super( cause ); + } + + public ClientException( String message, Throwable cause ) + { + super( message, cause ); + } +} Added: maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ContinuumClient.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ContinuumClient.java?view=auto&rev=511984 ============================================================================== --- maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ContinuumClient.java (added) +++ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ContinuumClient.java Mon Feb 26 12:11:37 2007 @@ -0,0 +1,132 @@ +package org.apache.maven.continuum.client; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.continuum.client.project.ContinuumProjectState; +import org.apache.maven.continuum.client.ProjectsReader; +import org.apache.maven.continuum.client.ClientException; +import org.apache.maven.continuum.client.project.Project; +import org.apache.maven.continuum.client.project.ProjectSummary; + +import java.util.Hashtable; +import java.net.URL; + +/** + * A clean class for accessing the Continuum server. + * Contains a few utility methods for clients too. + * + * @author Andrew Williams + */ +public class ContinuumClient +{ + private static Hashtable statusMap; + + private ProjectsReader source; + + static + { + statusMap = new Hashtable(); + statusMap.put( new Integer( ContinuumProjectState.NEW ), "New" ); + statusMap.put( new Integer( ContinuumProjectState.CHECKEDOUT ), "New" ); + statusMap.put( new Integer( ContinuumProjectState.OK ), "OK" ); + statusMap.put( new Integer( ContinuumProjectState.FAILED ), "Failed" ); + statusMap.put( new Integer( ContinuumProjectState.ERROR ), "Error" ); + statusMap.put( new Integer( ContinuumProjectState.BUILDING ), "Building" ); + statusMap.put( new Integer( ContinuumProjectState.CHECKING_OUT ), "Checking out" ); + statusMap.put( new Integer( ContinuumProjectState.UPDATING ), "Updating" ); + statusMap.put( new Integer( ContinuumProjectState.WARNING ), "Warning" ); + } + + /** + * Get the textual representation (in English) of a status code. + * + * @param status The status code to look up. + * @return The title of the status code. + */ + public static String getStatusMessage( int status ) + { + Integer statusInt = new Integer( status ); + + if ( statusMap.containsKey( statusInt ) ) + { + return (String) statusMap.get( new Integer( status ) ); + } + + return "Unknown"; + } + + public ContinuumClient( URL serverUrl ) + { + source = new ProjectsReader( serverUrl ); + } + + /** + * Get a list of the configured projects from the connected XMLRPC server. + * Note that the returned project objects are not fully populated. To get all the project information one must + * call <code>getProject( id )</code>. + * + * @return A list of project objects containing summary information about each project on the server. + * @throws ClientException + * @see #getProject(int) + */ + public ProjectSummary[] getProjects() + throws ClientException + { + try + { + return source.readProjects(); + } + catch ( Exception e ) + { + throw new ClientException( e ); + } + } + + /** + * Get a project with a complete set of information retrieved from the XMLRPC server. + * + * @param id The id of the project to look up. + * @return The project object populated with all information available from the server. + * @throws ClientException + */ + public Project getProject( int id ) + throws ClientException + { + try + { + Project ret = new Project(); + + ret.setId( id ); + source.refreshProject( ret ); + + return ret; + } + catch ( Exception e ) + { + throw new ClientException( e ); + } + } + + public Project getProject( ProjectSummary summary ) + throws ClientException + { + return getProject( summary.getId() ); + } +} Copied: maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ProjectsReader.java (from r511586, maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java) URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ProjectsReader.java?view=diff&rev=511984&p1=maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java&r1=511586&p2=maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ProjectsReader.java&r2=511984 ============================================================================== --- maven/continuum/trunk/continuum-rpc-client/src/main/java/org/apache/maven/continuum/rpc/ProjectsReader.java (original) +++ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/ProjectsReader.java Mon Feb 26 12:11:37 2007 @@ -1,4 +1,4 @@ -package org.apache.maven.continuum.rpc; +package org.apache.maven.continuum.client; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,14 +19,13 @@ * under the License. */ -import org.apache.maven.continuum.model.project.BuildDefinition; -import org.apache.maven.continuum.model.project.BuildResult; -import org.apache.maven.continuum.model.project.Profile; -import org.apache.maven.continuum.model.project.Project; -import org.apache.maven.continuum.model.project.ProjectDependency; -import org.apache.maven.continuum.model.project.ProjectDeveloper; -import org.apache.maven.continuum.model.project.Schedule; -import org.apache.maven.continuum.model.scm.ScmResult; +import org.apache.maven.continuum.client.project.BuildDefinition; +import org.apache.maven.continuum.client.project.Profile; +import org.apache.maven.continuum.client.project.Project; +import org.apache.maven.continuum.client.project.ProjectDependency; +import org.apache.maven.continuum.client.project.ProjectDeveloper; +import org.apache.maven.continuum.client.project.Schedule; +import org.apache.maven.continuum.client.project.ProjectSummary; import org.apache.xmlrpc.XmlRpcClient; import org.apache.xmlrpc.XmlRpcException; @@ -51,6 +50,8 @@ /** * Creates a new instance of ProjectsReader + * + * @param serverUrl the URL of the XMLRPC server we wish to query. */ public ProjectsReader( URL serverUrl ) { @@ -62,7 +63,17 @@ executorMap.put( "maven2", "MavenTwo" ); } - public Project[] readProjects() + /** + * Get a list of the configured projects from the connected XMLRPC server. + * Note that the returned project objects are not fully populated. To get all the project information one must + * call <code>refreshProject( project )</code>. + * + * @return A list of project objects containing summary information about each project on the server. + * @throws XmlRpcException + * @throws IOException + * @see #refreshProject(Project) + */ + public ProjectSummary[] readProjects() throws XmlRpcException, IOException { XmlRpcClient client = new XmlRpcClient( server ); @@ -76,7 +87,7 @@ while ( it.hasNext() ) { Hashtable proj = (Hashtable) it.next(); - set.add( populateProject( proj, new Project() ) ); + set.add( populateProjectSummary( proj, new ProjectSummary() ) ); } } else if ( obj instanceof XmlRpcException ) @@ -84,9 +95,17 @@ throw (XmlRpcException) obj; } - return (Project[]) set.toArray( new Project[set.size()] ); + return (ProjectSummary[]) set.toArray( new ProjectSummary[set.size()] ); } + /** + * Populate a project with a complete set of information retrieved from the XMLRPC server. + * Note that the Project object must already have it's id set (by calling <code>setId(int)</code>). + * + * @param proj The project to populate (it must have at least the id set). + * @throws XmlRpcException + * @throws IOException + */ public void refreshProject( Project proj ) throws XmlRpcException, IOException { @@ -198,7 +217,7 @@ } } - private Project populateProject( Hashtable hashtable, Project instance ) + private ProjectSummary populateProjectSummary( Hashtable hashtable, ProjectSummary instance ) { instance.setArtifactId( (String) hashtable.get( "artifactId" ) ); instance.setGroupId( (String) hashtable.get( "groupId" ) ); @@ -217,7 +236,41 @@ instance.setState( Integer.parseInt( (String) hashtable.get( "state" ) ) ); instance.setOldState( Integer.parseInt( (String) hashtable.get( "oldState" ) ) ); instance.setBuildNumber( Integer.parseInt( (String) hashtable.get( "buildNumber" ) ) ); + Vector deps = (Vector) hashtable.get( "dependencies" ); + if ( deps != null ) + { + Iterator it = deps.iterator(); + List vals = new ArrayList(); + while ( it.hasNext() ) + { + Hashtable dep = (Hashtable) it.next(); + ProjectDependency dependency = new ProjectDependency(); + dependency.setArtifactId( (String) dep.get( "artifactId" ) ); + dependency.setGroupId( (String) dep.get( "groupId" ) ); + dependency.setVersion( (String) dep.get( "version" ) ); + vals.add( dependency ); + } + instance.setDependencies( vals ); + } + Hashtable par = (Hashtable) hashtable.get( "parent" ); + if ( par != null ) + { + ProjectDependency parent = new ProjectDependency(); + parent.setArtifactId( (String) par.get( "artifactId" ) ); + parent.setGroupId( (String) par.get( "groupId" ) ); + parent.setVersion( (String) par.get( "version" ) ); + instance.setParent( parent ); + } + + return instance; + } + + private Project populateProject( Hashtable hashtable, Project instance ) + { + populateProjectSummary( hashtable, instance ); + Vector buildDefinitions = (Vector) hashtable.get( "buildDefinitions" ); + if ( buildDefinitions != null ) { Iterator it = buildDefinitions.iterator(); @@ -255,54 +308,6 @@ } instance.setBuildDefinitions( defs ); } - Vector buildRes = (Vector) hashtable.get( "buildResults" ); - if ( buildRes != null ) - { - Iterator it = buildRes.iterator(); - List results = new ArrayList(); - while ( it.hasNext() ) - { - Hashtable res = (Hashtable) it.next(); - BuildResult result = new BuildResult(); - result.setBuildNumber( Integer.parseInt( (String) res.get( "buildNumber" ) ) ); - result.setEndTime( Long.parseLong( (String) res.get( "endTime" ) ) ); - result.setError( (String) res.get( "error" ) ); - result.setExitCode( Integer.parseInt( (String) res.get( "exitCode" ) ) ); - result.setId( Integer.parseInt( (String) res.get( "id" ) ) ); -//TODO result.setScmResult(); - result.setStartTime( Long.parseLong( (String) res.get( "startTime" ) ) ); - result.setState( Integer.parseInt( (String) res.get( "state" ) ) ); - result.setSuccess( Boolean.getBoolean( (String) res.get( "success" ) ) ); - result.setTrigger( Integer.parseInt( (String) res.get( "trigger" ) ) ); - results.add( result ); - } - instance.setBuildResults( results ); - } - Vector deps = (Vector) hashtable.get( "dependencies" ); - if ( deps != null ) - { - Iterator it = deps.iterator(); - List vals = new ArrayList(); - while ( it.hasNext() ) - { - Hashtable dep = (Hashtable) it.next(); - ProjectDependency dependency = new ProjectDependency(); - dependency.setArtifactId( (String) dep.get( "artifactId" ) ); - dependency.setGroupId( (String) dep.get( "groupId" ) ); - dependency.setVersion( (String) dep.get( "version" ) ); - vals.add( dependency ); - } - instance.setDependencies( vals ); - } - Hashtable par = (Hashtable) hashtable.get( "parent" ); - if ( par != null ) - { - ProjectDependency parent = new ProjectDependency(); - parent.setArtifactId( (String) par.get( "artifactId" ) ); - parent.setGroupId( (String) par.get( "groupId" ) ); - parent.setVersion( (String) par.get( "version" ) ); - instance.setParent( parent ); - } Vector devs = (Vector) hashtable.get( "developers" ); if ( devs != null ) { @@ -334,19 +339,6 @@ // } // instance.setNotifiers(vals); // } - Hashtable checkout = (Hashtable) hashtable.get( "checkoutResult" ); - if ( checkout != null ) - { - ScmResult res = new ScmResult(); - res.setSuccess( Boolean.getBoolean( (String) checkout.get( "success" ) ) ); - res.setCommandLine( (String) checkout.get( "commandLine" ) ); -//TODO res.setChanges(); - res.setCommandOutput( (String) checkout.get( "commandOutput" ) ); - res.setException( (String) checkout.get( "exception" ) ); - res.setProviderMessage( (String) checkout.get( "providerMessage" ) ); - instance.setCheckoutResult( res ); - - } return instance; } Added: maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/SampleClient.java URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/SampleClient.java?view=auto&rev=511984 ============================================================================== --- maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/SampleClient.java (added) +++ maven/sandbox/trunk/continuum/continuum-client/src/main/java/org/apache/maven/continuum/client/SampleClient.java Mon Feb 26 12:11:37 2007 @@ -0,0 +1,89 @@ +package org.apache.maven.continuum.client; + +import org.apache.maven.continuum.client.project.Project; +import org.apache.maven.continuum.client.project.ProjectSummary; + +import java.net.URL; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class SampleClient +{ + + public static void main( String[] args ) + throws Exception + { + String address = "http://localhost:8000/continuum"; + + if ( args.length > 0 && args[0] != null && args[0].length() > 0 ) + { + address = args[0]; + } + + System.out.println( "Connecting to: " + address ); + + ContinuumClient client = new ContinuumClient( new URL( address ) ); + + ProjectSummary[] projects = null; + + try + { + System.out.println( "******************************" ); + System.out.println( "Projects list" ); + System.out.println( "******************************" ); + + projects = client.getProjects(); + + for ( int i = 0; i < projects.length; i++ ) + { + System.out.println( projects[i] + " - Name=" + projects[i].getName() ); + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + if ( projects != null && projects.length > 0 ) + { + + System.out.println( "******************************" ); + System.out.println( "Project detail" ); + System.out.println( "******************************" ); + + for ( int i = 0; i < projects.length; i++ ) + { + try + { + Project project = client.getProject( projects[i] ); + + System.out.println( "Name for project " + project.getId() + " : " + project.getName() ); + + System.out.println( "State: " + ContinuumClient.getStatusMessage( project.getState() ) ); + + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + } + } +} Added: maven/sandbox/trunk/continuum/continuum-client/src/main/mdo/continuum-client.xml URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/continuum/continuum-client/src/main/mdo/continuum-client.xml?view=auto&rev=511984 ============================================================================== --- maven/sandbox/trunk/continuum/continuum-client/src/main/mdo/continuum-client.xml (added) +++ maven/sandbox/trunk/continuum/continuum-client/src/main/mdo/continuum-client.xml Mon Feb 26 12:11:37 2007 @@ -0,0 +1,963 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<model> + <id>continuum-client</id> + <name>Continuum Client</name> + <description>Continuum's remote client object model.</description> + <defaults> + <default> + <key>package</key> + <value>org.apache.maven.continuum.client.project</value> + </default> + </defaults> + + <classes> + <class> + <name>ProjectGroup</name> + <version>1.1.0+</version> + <fields> + <field> + <name>id</name> + <version>1.1.0+</version> + <required>true</required> + <type>int</type> + <identifier>true</identifier> + </field> + <field> + <name>groupId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>description</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>projects</name> + <version>1.1.0+</version> + <association> + <type>Project</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> + <name>notifiers</name> + <version>1.1.0+</version> + <association> + <type>ProjectNotifier</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> + <name>buildDefinitions</name> + <version>1.1.0+</version> + <association> + <type>BuildDefinition</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> + <name>ProjectSummary</name> + <version>1.1.0+</version> + <fields> + <field> + <name>id</name> + <required>true</required> + <identifier>true</identifier> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>groupId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>artifactId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>executorId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>description</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>url</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>scmUrl</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>scmTag</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>scmUsername</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>scmPassword</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>scmUseCache</name> + <version>1.1.0+</version> + <type>boolean</type> + </field> + <field> + <name>version</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <!-- TODO: should these 3 just be queried from the builds list? --> + <field> + <name>state</name> + <version>1.1.0+</version> + <type>int</type> + <defaultValue>1</defaultValue> + </field> + <field> + <name>oldState</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <!-- TODO: maybe buildresult itself? --> + <field> + <name>latestBuildId</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>buildNumber</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>workingDirectory</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>parent</name> + <version>1.1.0+</version> + <association> + <type>ProjectDependency</type> + </association> + </field> + <field> + <name>dependencies</name> + <version>1.1.0+</version> + <association> + <type>ProjectDependency</type> + <multiplicity>*</multiplicity> + </association> + </field> + <!-- TODO, this is not exported over XMLRPC yet --> + <field> + <name>projectGroup</name> + <version>1.1.0+</version> + <required>true</required> + <association xml.reference="true"> + <type>ProjectGroup</type> + </association> + </field> + </fields> + </class> + + <class> + <name>Project</name> + <version>1.1.0+</version> + <superClass>ProjectSummary</superClass> + <fields> + <field> + <name>developers</name> + <version>1.1.0+</version> + <association> + <type>ProjectDeveloper</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> + <name>notifiers</name> + <version>1.1.0+</version> + <association> + <type>ProjectNotifier</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> + <name>buildDefinitions</name> + <version>1.1.0+</version> + <association> + <type>BuildDefinition</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> + <name>ProjectNotifier</name> + <version>1.1.0+</version> + <description> + Configures one method for notifying users/developers when a build breaks. + </description> + <fields> + <field> + <name>id</name> + <required>true</required> + <identifier>true</identifier> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>type</name> + <version>1.1.0+</version> + <defaultValue>mail</defaultValue> + <type>String</type> + <description>The mechanism used to deliver notifications.</description> + </field> + <field> + <name>from</name> + <version>1.1.0+</version> + <type>int</type> + <description>The origin of the notifier (pom or user).</description> + </field> + <field> + <name>enabled</name> + <version>1.1.0+</version> + <defaultValue>true</defaultValue> + <type>boolean</type> + </field> + <field> + <name>recipientType</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>sendOnSuccess</name> + <version>1.1.0+</version> + <type>boolean</type> + <defaultValue>true</defaultValue> + </field> + <field> + <name>sendOnFailure</name> + <version>1.1.0+</version> + <type>boolean</type> + <defaultValue>true</defaultValue> + </field> + <field> + <name>sendOnError</name> + <version>1.1.0+</version> + <type>boolean</type> + <defaultValue>true</defaultValue> + </field> + <field> + <name>sendOnWarning</name> + <version>1.1.0+</version> + <type>boolean</type> + <defaultValue>true</defaultValue> + </field> + <field> + <name>configuration</name> + <version>1.1.0+</version> + <description>Extended configuration specific to this notifier goes here.</description> + <type>Map</type> + <association xml.mapStyle="inline"> + <type>String</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.1.0+</version> + <code><![CDATA[ + + public static final int FROM_PROJECT = 1; + + public static final int FROM_USER = 2; + + public boolean isFromProject() + { + return from == FROM_PROJECT; + } + + public boolean isFromUser() + { + return from == FROM_USER; + } + ]]></code> + </codeSegment> + </codeSegments> + </class> + + <class> + <name>ProjectDeveloper</name> + <version>1.1.0+</version> + <fields> + <field> + <name>scmId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>email</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>continuumId</name> + <version>1.1.0+</version> + <type>int</type> + </field> + </fields> + </class> + + <class> + <name>ProjectDependency</name> + <version>1.1.0+</version> + <fields> + <field> + <name>groupId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>artifactId</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>version</name> + <version>1.1.0+</version> + <type>String</type> + </field> + </fields> + </class> + + <class> + <name>BuildResult</name> + <version>1.1.0+</version> + <description><![CDATA[ + This class is a single continuum build. + ]]></description> + <fields> + <field> + <name>project</name> + <version>1.1.0+</version> + <!-- required>true</required --> + <association xml.reference="true"> + <type>Project</type> + </association> + </field> + <field> + <name>id</name> + <version>1.1.0+</version> + <type>int</type> + <identifier>true</identifier> + </field> + <field> + <name>buildNumber</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>state</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>trigger</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>startTime</name> + <version>1.1.0+</version> + <!-- TODO: Because JPOX persists as UTC and pulls back using the local time, we have to take over --> + <type>long</type> + </field> + <field> + <name>endTime</name> + <version>1.1.0+</version> + <!-- TODO: Because JPOX persists as UTC and pulls back using the local time, we have to take over --> + <type>long</type> + </field> + <field> + <name>error</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>success</name> + <version>1.1.0+</version> + <type>boolean</type> + </field> + <field> + <name>exitCode</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>scmResult</name> + <version>1.1.0+</version> + <association> + <type>ScmResult</type> + </association> + </field> + <field> + <name>testResult</name> + <version>1.1.0+</version> + <association> + <type>TestResult</type> + </association> + </field> + <field> + <name>modifiedDependencies</name> + <version>1.1.0+</version> + <association> + <type>ProjectDependency</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> + <name>ScmResult</name> + <packageName>org.apache.maven.continuum.client.scm</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>success</name> + <version>1.1.0+</version> + <type>boolean</type> + </field> + <field> + <name>commandLine</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>providerMessage</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>commandOutput</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>exception</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>changes</name> + <version>1.1.0+</version> + <association> + <type>ChangeSet</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> + <name>ChangeSet</name> + <packageName>org.apache.maven.continuum.client.scm</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>id</name> + <version>1.1.0+</version> + <type>String</type> + <identity>true</identity> + </field> + <field> + <name>author</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field stash.maxSize="8192"> + <name>comment</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>date</name> + <version>1.1.0+</version> + <!-- TODO: Because JPOX persists as UTC and pulls back using the local time, we have to take over --> + <type>long</type> + </field> + <field> + <name>files</name> + <version>1.1.0+</version> + <association> + <type>ChangeFile</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.1.0+</version> + <code><![CDATA[ + /** + * @return Returns string representation of the changeset + */ + public String toString() + { + String result = author + "\n" + date + "\n"; + + if ( files != null ) + { + for ( java.util.Iterator i = files.iterator(); i.hasNext(); ) + { + ChangeFile file = (ChangeFile) i.next(); + + result += file + "\n"; + } + } + + result += comment; + + return result; + } + + /** + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals( Object obj ) + { + if ( obj instanceof ChangeSet ) + { + ChangeSet changeSet = (ChangeSet) obj; + + if ( toString().equals( changeSet.toString() ) ) + { + return true; + } + } + + return false; + } + + public java.util.Date getDateAsDate() + { + if ( date > 0 ) + { + return new java.util.Date( date ); + } + + return null; + } + ]]></code> + </codeSegment> + </codeSegments> + </class> + + <class> + <name>ChangeFile</name> + <packageName>org.apache.maven.continuum.client.scm</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>revision</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>status</name> + <version>1.1.0+</version> + <type>String</type> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.1.0+</version> + <code><![CDATA[ + /** + * Provide a version of the object as a string for debugging purposes + * + * @return a [EMAIL PROTECTED] String}made up of the properties of the object + */ + public String toString() + { + StringBuffer buffer = new StringBuffer( getName() ); + + if ( getRevision() != null ) + { + buffer.append( ", " ).append( getRevision() ); + } + + return buffer.toString(); + } + ]]></code> + </codeSegment> + </codeSegments> + </class> + + <class> + <name>TestResult</name> + <packageName>org.apache.maven.continuum.client.test</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>testCount</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>failureCount</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>totalTime</name> + <version>1.1.0+</version> + <type>long</type> + </field> + <field> + <name>suiteResults</name> + <version>1.1.0+</version> + <association> + <type>SuiteResult</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> + <name>SuiteResult</name> + <packageName>org.apache.maven.continuum.client.test</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>testCount</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>failureCount</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>totalTime</name> + <version>1.1.0+</version> + <type>long</type> + </field> + <field> + <name>failures</name> + <version>1.1.0+</version> + <association> + <type>TestCaseFailure</type> + <multiplicity>*</multiplicity> + </association> + </field> + </fields> + </class> + + <class> + <name>TestCaseFailure</name> + <packageName>org.apache.maven.continuum.client.test</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>exception</name> + <version>1.1.0+</version> + <type>String</type> + </field> + </fields> + </class> + + <class> + <name>BuildDefinition</name> + <version>1.1.0+</version> + <fields> + <field> + <name>id</name> + <required>true</required> + <identifier>true</identifier> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>defaultForProject</name> + <version>1.1.0+</version> + <type>boolean</type> + <defaultValue>false</defaultValue> + </field> + <field> + <name>goals</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>arguments</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>buildFile</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>buildFresh</name> + <version>1.1.0+</version> + <type>boolean</type> + <defaultValue>false</defaultValue> + <description> + true if the build is to be smoked and checked back out from the scm each build + </description> + </field> + <field> + <name>schedule</name> + <version>1.1.0+</version> + <association xml.reference="true"> + <type>Schedule</type> + </association> + </field> + <field> + <name>profile</name> + <version>1.1.0+</version> + <association xml.reference="true"> + <type>Profile</type> + </association> + </field> + <field> + <name>latestBuildId</name> + <version>1.1.0+</version> + <type>int</type> + <defaultValue>0</defaultValue> + </field> + </fields> + </class> + + <class> + <name>Schedule</name> + <version>1.1.0+</version> + <description><![CDATA[ + Schedule for a project. + ]]></description> + <fields> + <field> + <name>id</name> + <identifier>true</identifier> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>active</name> + <version>1.1.0+</version> + <type>boolean</type> + </field> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>description</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>delay</name> + <description><![CDATA[ + Delay in seconds. + ]]></description> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>maxJobExecutionTime</name> + <description> + Maximum execution time of a job in seconds before it's + terminated. + </description> + <version>1.1.0+</version> + <type>int</type> + <defaultValue>3600</defaultValue> + </field> + <field> + <name>cronExpression</name> + <version>1.1.0+</version> + <type>String</type> + </field> + </fields> + </class> + + <class> + <name>Profile</name> + <version>1.1.0+</version> + <fields> + <field> + <name>id</name> + <identifier>true</identifier> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>active</name> + <version>1.1.0+</version> + <type>boolean</type> + </field> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>description</name> + <version>1.1.0+</version> + <type>String</type> + </field> + <field> + <name>scmMode</name> + <version>1.1.0+</version> + <type>int</type> + </field> + <field> + <name>buildWithoutChanges</name> + <version>1.1.0+</version> + <type>boolean</type> + </field> + </fields> + </class> + + <!-- TODO: this isn't really appropriate to generate with Modello --> + <class> + <name>ContinuumProjectState</name> + <packageName>org.apache.maven.continuum.client.project</packageName> + <version>1.1.0+</version> + <fields> + <field> + <name>name</name> + <version>1.1.0+</version> + <type>String</type> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.1.0+</version> + <code><![CDATA[ + public final static int NEW = 1; + public final static int OK = 2; + public final static int FAILED = 3; + public final static int ERROR = 4; + public final static int BUILDING = 6; + public final static int CHECKING_OUT = 7; + public final static int UPDATING = 8; + public final static int WARNING = 9; + public final static int CHECKEDOUT = 10; + + // TODO: maybe move these to another class + public static final int TRIGGER_FORCED = 1; + + // TODO: remove + public static final int TRIGGER_SCHEDULED = 0; + + public static final int TRIGGER_UNKNOWN = TRIGGER_SCHEDULED; + + public String getI18nKey() + { + return "org.apache.maven.continuum.project.state." + name; + } + + public boolean equals( Object object ) + { + if ( !( object instanceof ContinuumProjectState ) ) + { + return false; + } + + ContinuumProjectState other = (ContinuumProjectState) object; + + return name.equals( other.name ); + } + + public int hashCode() + { + return name.hashCode(); + } + + public String toString() + { + return name; + } + ]]></code> + </codeSegment> + </codeSegments> + </class> + </classes> +</model>