You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Erik Meade <em...@geekfarm.org> on 2000/06/01 07:37:42 UTC

[PATCH]? Jcvs taskdef

I noticed this comment in Cvs taskdef:

	// XXX: we should use JCVS (www.ice.com/JCVS) instead of command line
	// execution so that we don't rely on having native CVS stuff around (SM)

So took a stab at it and started a Jcvs taskdef, which uses Tim's com.ice.cvsc
package.  ( http://www.gjt.org/servlets/JCVSlet/zip/ice/com/ice/cvsc/cvsc.zip )

I've included a patch to add the Jcvs taskdef to the defaults.properties as 
well as
the Jcvs.java file.

Jcvs is backwards compatible with Cvs, except for the "-r" option. ( Because I
didn't implement it, not because it is unimplementable ).

This is my first time so please be gentle :)
Erik Meade


--- defaults.properties.orig    Thu Jun 01 00:19:50 2000
+++ defaults.properties Wed May 31 19:09:24 2000
@@ -29,6 +29,7 @@
  filter=org.apache.tools.ant.taskdefs.Filter
  fixcrlf=org.apache.tools.ant.taskdefs.FixCRLF
  rename=org.apache.tools.ant.taskdefs.Rename
+jcvs=org.apache.tools.ant.taskdefs.Jcvs

  # optional tasks
  script=org.apache.tools.ant.taskdefs.optional.Script


/*
  * The Apache Software License, Version 1.1
  *
  * Copyright (c) 1999 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution, if
  *    any, must include the following acknowlegement:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowlegement may appear in the software itself,
  *    if and wherever such third-party acknowlegements normally appear.
  *
  * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  *    Foundation" must not be used to endorse or promote products derived
  *    from this software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache"
  *    nor may "Apache" appear in their names without prior written
  *    permission of the Apache Group.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation.  For more
  * information on the Apache Software Foundation, please see
  * <http://www.apache.org/>.
  */

package org.apache.tools.ant.taskdefs;

import com.ice.cvsc.*;
import java.io.File;
import org.apache.tools.ant.BuildException;

/**
  *
  *
  * @author emeade@geekfarm.org
  */

public class Jcvs extends Exec implements CVSUserInterface {

	String userName;
	String password = "anoncvs";
	String hostName;
	String repository;
	String rootDirectory;
	String localDirectory;
	String tempDirectory;

     boolean isPServer = true;
     int connMethod = CVSRequest.METHOD_INETD;
     int cvsPort = 2401;

     public void execute() throws BuildException {
		if (tempDirectory == null) {
			tempDirectory = System.getProperty("java.io.tmpdir");
		}

		if (localDirectory == null) {
			localDirectory = ".";
		}

		CVSRequest request = new CVSRequest();
		boolean parsed = request.parseControlString(":co:N:ANP:deou:");

		CVSEntryVector entries = new CVSEntryVector();

		CVSArgumentVector arguments = new CVSArgumentVector();
		arguments.appendArgument(repository);

		CVSClient client = new CVSClient(hostName, cvsPort );
		CVSProject project = new CVSProject(client);
		project.setUserName(userName);
		project.setTempDirectory(tempDirectory);
		project.setRepository(repository);
		project.setRootDirectory(rootDirectory);
		project.setLocalRootDirectory(localDirectory);
		project.setPServer(isPServer);
		project.setConnectionMethod(connMethod);
		project.setPassword(CVSScramble.scramblePassword( password, 'A' ));
		project.establishRootEntry(rootDirectory);

		request.setPServer(isPServer);
		request.setUserName(userName);
		request.setPassword(project.getPassword());
		request.setConnectionMethod(connMethod);
		request.setPort(cvsPort);
		request.setHostName(hostName);
		request.setRepository(repository);
		request.setRootDirectory(rootDirectory);
		request.setRootRepository(rootDirectory);
		request.setLocalDirectory(localDirectory);
		request.responseHandler = project;
		request.traceRequest = CVSProject.overTraceRequest;
		request.traceResponse = CVSProject.overTraceResponse;
		request.traceTCPData = CVSProject.overTraceTCP;
		request.traceProcessing = CVSProject.overTraceProcessing;
		request.setEntries(entries);
		request.appendArguments(arguments);
		request.setUserInterface(this);

		CVSResponse response = client.processCVSRequest(request);
		response.deleteTempFiles();
   	}

     public void setDest(String dest) {
		setDir(dest);
     }

     public void setHostName(String hostName) {
		this.hostName = hostName;
     }

     public void setLocalDir(String localDir) {
		this.localDirectory = localDir;
     }

     public void setPassword(String password) {
		this.password = password;
     }

	public void setPort(int port) {
		cvsPort = port;
	}

     public void setRepository(String repository) {
		this.repository = repository;
     }

     public void setRootDir(String rootDir) {
		rootDirectory = rootDir;
     }

     public void setTempDir(String tempDir) {
		tempDirectory = tempDir;
     }

     public void setUserName(String userName) {
		this.userName = userName;
     }

	// For backward compatabitly with Cvs.
     public void setCvsRoot(String root) {
		// XXX: handle non isPServer
		if (root.startsWith(":pserver:")) {
			isPServer = true;
			// strip off the :pserver:
			root = root.substring(9);
		}

		int atIndex = root.indexOf("@");
		int cvsrootIndex = root.indexOf(":");

		userName = root.substring(0, atIndex);
		hostName = root.substring(atIndex + 1, cvsrootIndex);
		rootDirectory = root.substring(cvsrootIndex + 1);
     }

     public void setPackage(String p) {
		repository = p;
     }

	// XXX: Need to handle this in the Jcvs way
     public void setTag(String p) {
         // Check if not real tag => set it to null
         if (p != null) {
             if (p.trim().equals(""))
                 p = null;
         }
//        this.tag = p;
     }

	//
	// CVS USER INTERFACE METHODS
	//

	public void uiDisplayProgressMsg( String message ) {
		System.out.println("[exec] " + message);
	}

	public void	uiDisplayProgramError( String error ) {
		System.out.println("[error] " + error);
	}

	public void uiDisplayResponse( CVSResponse response ) {
	}

	//
	// END OF CVS USER INTERFACE METHODS
	//

}


RE: [PATCH]? Jcvs taskdef

Posted by Erik Meade <em...@geekfarm.org>.
I don't feel that this is as backward compatible as I
mentioned at first.  A spec I need is currently
unavailable, so until I can see the spec please keep
this in mind.

Thanks,
Erik

At 03:57 PM 6/1/2000 -0500, you wrote:
>Good stuff, let me do this again:
>
>I noticed this comment in Cvs taskdef:
>         // XXX: we should use JCVS (www.ice.com/JCVS) instead of command line
>         // execution so that we don't rely on having native CVS stuff 
> around (SM)
>
>So took a stab at it and started a optional Jcvs taskdef, which uses Tim's
>com.ice.cvsc package.
>( http://www.gjt.org/servlets/JCVSlet/zip/ice/com/ice/cvsc/cvsc.zip )
>
>I've included a two patchs.  One to add the Jcvs taskdef to the 
>defaults.properties.
>( as an optional taskdef ).  Another to update the build.xml ( to check 
>for the
>existence of the com.ice.cvsc. classes ) as well as  the Jcvs.java file.
>
>Jcvs is backwards compatible with Cvs, except for the "-r" option. ( Because I
>didn't implement it, not because it is unimplementable ).
>
>Thanks to Conor and Glen for the feedback!
>Erik Meade
>
>
>--- build.xml.orig      Thu Jun 01 14:58:34 2000
>+++ build.xml   Thu Jun 01 14:58:14 2000
>@@ -37,6 +37,7 @@
>    <target name="check_for_optional_packages">
>      <available property="bsf.present" classname="com.ibm.bsf.BSFManager" />
>      <available property="netrexx.present" classname="netrexx.lang.Rexx" />
>+    <available property="cvsc.present" classname="com.ice.cvsc.CVSProject" />
>    </target>
>
>    <!-- 
> =================================================================== -->
>@@ -60,6 +61,7 @@
>             optimize="on" >
>        <exclude name="**/Script.java" unless="bsf.present" />
>        <exclude name="**/NetRexxC.java" unless="netrexx.present" />
>+      <exclude name="**/Jcvs.java" unless="cvsc.present" />
>      </javac>
>
>      <copydir src="${src.dir}" dest="${build.classes}">
>
>
>
>--- defaults.properties.orig    Thu Jun 01 00:19:50 2000
>+++ defaults.properties Thu Jun 01 14:50:36 2000
>@@ -34,6 +34,7 @@
>  script=org.apache.tools.ant.taskdefs.optional.Script
>  netrexxc=org.apache.tools.ant.taskdefs.optional.NetRexxC
>  renameext=org.apache.tools.ant.taskdefs.optional.RenameExtensions
>+jcvs=org.apache.tools.ant.taskdefs.Jcvs
>
>  # deprecated ant tasks (kept for back compatibility)
>  javadoc2=org.apache.tools.ant.taskdefs.Javadoc
>
>
>/*
>  * The Apache Software License, Version 1.1
>  *
>  * Copyright (c) 1999 The Apache Software Foundation.  All rights
>  * reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions
>  * are met:
>  *
>  * 1. Redistributions of source code must retain the above copyright
>  *    notice, this list of conditions and the following disclaimer.
>  *
>  * 2. Redistributions in binary form must reproduce the above copyright
>  *    notice, this list of conditions and the following disclaimer in
>  *    the documentation and/or other materials provided with the
>  *    distribution.
>  *
>  * 3. The end-user documentation included with the redistribution, if
>  *    any, must include the following acknowlegement:
>  *       "This product includes software developed by the
>  *        Apache Software Foundation (http://www.apache.org/)."
>  *    Alternately, this acknowlegement may appear in the software itself,
>  *    if and wherever such third-party acknowlegements normally appear.
>  *
>  * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
>  *    Foundation" must not be used to endorse or promote products derived
>  *    from this software without prior written permission. For written
>  *    permission, please contact apache@apache.org.
>  *
>  * 5. Products derived from this software may not be called "Apache"
>  *    nor may "Apache" appear in their names without prior written
>  *    permission of the Apache Group.
>  *
>  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>  * SUCH DAMAGE.
>  * ====================================================================
>  *
>  * This software consists of voluntary contributions made by many
>  * individuals on behalf of the Apache Software Foundation.  For more
>  * information on the Apache Software Foundation, please see
>  * <http://www.apache.org/>.
>  */
>
>package org.apache.tools.ant.optional.taskdefs;
>
>import com.ice.cvsc.*;
>import java.io.File;
>import org.apache.tools.ant.BuildException;
>import org.apache.tools.ant.taskdefs.Exec;
>
>/**
>  *
>  *
>  * @author emeade@geekfarm.org
>  */
>
>public class Jcvs extends Exec implements CVSUserInterface {
>
>         String userName;
>         String password = "anoncvs";
>         String hostName;
>         String repository;
>         String rootDirectory;
>         String localDirectory;
>         String tempDirectory;
>
>     boolean isPServer = true;
>     int connMethod = CVSRequest.METHOD_INETD;
>     int cvsPort = 2401;
>
>     public void execute() throws BuildException {
>                 if (tempDirectory == null) {
>                         tempDirectory = System.getProperty("java.io.tmpdir");
>                 }
>
>                 if (localDirectory == null) {
>                         localDirectory = ".";
>                 }
>
>                 CVSRequest request = new CVSRequest();
>                 boolean parsed = 
> request.parseControlString(":co:N:ANP:deou:");
>
>                 CVSEntryVector entries = new CVSEntryVector();
>
>                 CVSArgumentVector arguments = new CVSArgumentVector();
>                 arguments.appendArgument(repository);
>
>                 CVSClient client = new CVSClient(hostName, cvsPort );
>                 CVSProject project = new CVSProject(client);
>                 project.setUserName(userName);
>                 project.setTempDirectory(tempDirectory);
>                 project.setRepository(repository);
>                 project.setRootDirectory(rootDirectory);
>                 project.setLocalRootDirectory(localDirectory);
>                 project.setPServer(isPServer);
>                 project.setConnectionMethod(connMethod);
>                 project.setPassword(CVSScramble.scramblePassword( 
> password, 'A' ));
>                 project.establishRootEntry(rootDirectory);
>
>                 request.setPServer(isPServer);
>                 request.setUserName(userName);
>                 request.setPassword(project.getPassword());
>                 request.setConnectionMethod(connMethod);
>                 request.setPort(cvsPort);
>                 request.setHostName(hostName);
>                 request.setRepository(repository);
>                 request.setRootDirectory(rootDirectory);
>                 request.setRootRepository(rootDirectory);
>                 request.setLocalDirectory(localDirectory);
>                 request.responseHandler = project;
>                 request.traceRequest = CVSProject.overTraceRequest;
>                 request.traceResponse = CVSProject.overTraceResponse;
>                 request.traceTCPData = CVSProject.overTraceTCP;
>                 request.traceProcessing = CVSProject.overTraceProcessing;
>                 request.setEntries(entries);
>                 request.appendArguments(arguments);
>                 request.setUserInterface(this);
>
>                 CVSResponse response = client.processCVSRequest(request);
>                 response.deleteTempFiles();
>         }
>
>     public void setDest(String dest) {
>                 setDir(dest);
>     }
>
>     public void setHostName(String hostName) {
>                 this.hostName = hostName;
>     }
>
>     public void setLocalDir(String localDir) {
>                 this.localDirectory = localDir;
>     }
>
>     public void setPassword(String password) {
>                 this.password = password;
>     }
>
>         public void setPort(int port) {
>                 cvsPort = port;
>         }
>
>     public void setRepository(String repository) {
>                 this.repository = repository;
>     }
>
>     public void setRootDir(String rootDir) {
>                 rootDirectory = rootDir;
>     }
>
>     public void setTempDir(String tempDir) {
>                 tempDirectory = tempDir;
>     }
>
>     public void setUserName(String userName) {
>                 this.userName = userName;
>     }
>
>         // For backward compatabitly with Cvs.
>     public void setCvsRoot(String root) {
>                 // XXX: handle non isPServer
>                 if (root.startsWith(":pserver:")) {
>                         isPServer = true;
>                         // strip off the :pserver:
>                         root = root.substring(9);
>                 }
>
>                 int atIndex = root.indexOf("@");
>                 int cvsrootIndex = root.indexOf(":");
>
>                 userName = root.substring(0, atIndex);
>                 hostName = root.substring(atIndex + 1, cvsrootIndex);
>                 rootDirectory = root.substring(cvsrootIndex + 1);
>     }
>
>     public void setPackage(String p) {
>                 repository = p;
>     }
>
>         // XXX: Need to handle this in the Jcvs way
>     public void setTag(String p) {
>         // Check if not real tag => set it to null
>         if (p != null) {
>             if (p.trim().equals(""))
>                 p = null;
>         }
>//        this.tag = p;
>     }
>
>         //
>         // CVS USER INTERFACE METHODS
>         //
>
>         public void uiDisplayProgressMsg( String message ) {
>                 project.log( message, "jcvs", project.MSG_VERBOSE );
>         }
>
>         public void     uiDisplayProgramError( String error ) {
>         project.log( error, "jvcs:error", project.MSG_ERR );
>     }
>
>         public void uiDisplayResponse( CVSResponse response ) {
>         }
>
>         //
>         // END OF CVS USER INTERFACE METHODS
>         //
>
>}


RE: [PATCH]? Jcvs taskdef

Posted by Erik Meade <em...@geekfarm.org>.
Good stuff, let me do this again:

I noticed this comment in Cvs taskdef:
         // XXX: we should use JCVS (www.ice.com/JCVS) instead of command line
         // execution so that we don't rely on having native CVS stuff 
around (SM)

So took a stab at it and started a optional Jcvs taskdef, which uses Tim's
com.ice.cvsc package.
( http://www.gjt.org/servlets/JCVSlet/zip/ice/com/ice/cvsc/cvsc.zip )

I've included a two patchs.  One to add the Jcvs taskdef to the 
defaults.properties.
( as an optional taskdef ).  Another to update the build.xml ( to check for 
the
existence of the com.ice.cvsc. classes ) as well as  the Jcvs.java file.

Jcvs is backwards compatible with Cvs, except for the "-r" option. ( Because I
didn't implement it, not because it is unimplementable ).

Thanks to Conor and Glen for the feedback!
Erik Meade


--- build.xml.orig      Thu Jun 01 14:58:34 2000
+++ build.xml   Thu Jun 01 14:58:14 2000
@@ -37,6 +37,7 @@
    <target name="check_for_optional_packages">
      <available property="bsf.present" classname="com.ibm.bsf.BSFManager" />
      <available property="netrexx.present" classname="netrexx.lang.Rexx" />
+    <available property="cvsc.present" classname="com.ice.cvsc.CVSProject" />
    </target>

    <!-- 
=================================================================== -->
@@ -60,6 +61,7 @@
             optimize="on" >
        <exclude name="**/Script.java" unless="bsf.present" />
        <exclude name="**/NetRexxC.java" unless="netrexx.present" />
+      <exclude name="**/Jcvs.java" unless="cvsc.present" />
      </javac>

      <copydir src="${src.dir}" dest="${build.classes}">



--- defaults.properties.orig    Thu Jun 01 00:19:50 2000
+++ defaults.properties Thu Jun 01 14:50:36 2000
@@ -34,6 +34,7 @@
  script=org.apache.tools.ant.taskdefs.optional.Script
  netrexxc=org.apache.tools.ant.taskdefs.optional.NetRexxC
  renameext=org.apache.tools.ant.taskdefs.optional.RenameExtensions
+jcvs=org.apache.tools.ant.taskdefs.Jcvs

  # deprecated ant tasks (kept for back compatibility)
  javadoc2=org.apache.tools.ant.taskdefs.Javadoc


/*
  * The Apache Software License, Version 1.1
  *
  * Copyright (c) 1999 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
  *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution, if
  *    any, must include the following acknowlegement:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowlegement may appear in the software itself,
  *    if and wherever such third-party acknowlegements normally appear.
  *
  * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
  *    Foundation" must not be used to endorse or promote products derived
  *    from this software without prior written permission. For written
  *    permission, please contact apache@apache.org.
  *
  * 5. Products derived from this software may not be called "Apache"
  *    nor may "Apache" appear in their names without prior written
  *    permission of the Apache Group.
  *
  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * ====================================================================
  *
  * This software consists of voluntary contributions made by many
  * individuals on behalf of the Apache Software Foundation.  For more
  * information on the Apache Software Foundation, please see
  * <http://www.apache.org/>.
  */

package org.apache.tools.ant.optional.taskdefs;

import com.ice.cvsc.*;
import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Exec;

/**
  *
  *
  * @author emeade@geekfarm.org
  */

public class Jcvs extends Exec implements CVSUserInterface {

         String userName;
         String password = "anoncvs";
         String hostName;
         String repository;
         String rootDirectory;
         String localDirectory;
         String tempDirectory;

     boolean isPServer = true;
     int connMethod = CVSRequest.METHOD_INETD;
     int cvsPort = 2401;

     public void execute() throws BuildException {
                 if (tempDirectory == null) {
                         tempDirectory = System.getProperty("java.io.tmpdir");
                 }

                 if (localDirectory == null) {
                         localDirectory = ".";
                 }

                 CVSRequest request = new CVSRequest();
                 boolean parsed = 
request.parseControlString(":co:N:ANP:deou:");

                 CVSEntryVector entries = new CVSEntryVector();

                 CVSArgumentVector arguments = new CVSArgumentVector();
                 arguments.appendArgument(repository);

                 CVSClient client = new CVSClient(hostName, cvsPort );
                 CVSProject project = new CVSProject(client);
                 project.setUserName(userName);
                 project.setTempDirectory(tempDirectory);
                 project.setRepository(repository);
                 project.setRootDirectory(rootDirectory);
                 project.setLocalRootDirectory(localDirectory);
                 project.setPServer(isPServer);
                 project.setConnectionMethod(connMethod);
                 project.setPassword(CVSScramble.scramblePassword( 
password, 'A' ));
                 project.establishRootEntry(rootDirectory);

                 request.setPServer(isPServer);
                 request.setUserName(userName);
                 request.setPassword(project.getPassword());
                 request.setConnectionMethod(connMethod);
                 request.setPort(cvsPort);
                 request.setHostName(hostName);
                 request.setRepository(repository);
                 request.setRootDirectory(rootDirectory);
                 request.setRootRepository(rootDirectory);
                 request.setLocalDirectory(localDirectory);
                 request.responseHandler = project;
                 request.traceRequest = CVSProject.overTraceRequest;
                 request.traceResponse = CVSProject.overTraceResponse;
                 request.traceTCPData = CVSProject.overTraceTCP;
                 request.traceProcessing = CVSProject.overTraceProcessing;
                 request.setEntries(entries);
                 request.appendArguments(arguments);
                 request.setUserInterface(this);

                 CVSResponse response = client.processCVSRequest(request);
                 response.deleteTempFiles();
         }

     public void setDest(String dest) {
                 setDir(dest);
     }

     public void setHostName(String hostName) {
                 this.hostName = hostName;
     }

     public void setLocalDir(String localDir) {
                 this.localDirectory = localDir;
     }

     public void setPassword(String password) {
                 this.password = password;
     }

         public void setPort(int port) {
                 cvsPort = port;
         }

     public void setRepository(String repository) {
                 this.repository = repository;
     }

     public void setRootDir(String rootDir) {
                 rootDirectory = rootDir;
     }

     public void setTempDir(String tempDir) {
                 tempDirectory = tempDir;
     }

     public void setUserName(String userName) {
                 this.userName = userName;
     }

         // For backward compatabitly with Cvs.
     public void setCvsRoot(String root) {
                 // XXX: handle non isPServer
                 if (root.startsWith(":pserver:")) {
                         isPServer = true;
                         // strip off the :pserver:
                         root = root.substring(9);
                 }

                 int atIndex = root.indexOf("@");
                 int cvsrootIndex = root.indexOf(":");

                 userName = root.substring(0, atIndex);
                 hostName = root.substring(atIndex + 1, cvsrootIndex);
                 rootDirectory = root.substring(cvsrootIndex + 1);
     }

     public void setPackage(String p) {
                 repository = p;
     }

         // XXX: Need to handle this in the Jcvs way
     public void setTag(String p) {
         // Check if not real tag => set it to null
         if (p != null) {
             if (p.trim().equals(""))
                 p = null;
         }
//        this.tag = p;
     }

         //
         // CVS USER INTERFACE METHODS
         //

         public void uiDisplayProgressMsg( String message ) {
                 project.log( message, "jcvs", project.MSG_VERBOSE );
         }

         public void     uiDisplayProgramError( String error ) {
         project.log( error, "jvcs:error", project.MSG_ERR );
     }

         public void uiDisplayResponse( CVSResponse response ) {
         }

         //
         // END OF CVS USER INTERFACE METHODS
         //

}


Re: [PATCH]? Jcvs taskdef

Posted by Erik Meade <em...@geekfarm.org>.
At 01:14 AM 6/18/2000 -0700, you wrote:
>on 6/5/00 6:18 AM, Stefan Bodewig at bodewig@bost.de wrote:
>
> > I didn't look too close at Tim's cvsc package, the links to the jCVS
> > Home Page at GJT are broken (point to www.ice.com/java/jcvs) so I
> > couldn't find an overview document. So please correct me if I'm wrong
> > Erik.
> >
> > Am I right that it only supports the pserver protocoll? If this was
> > true the limitation would be far to strong IMHO. Some of our internal
> > projects use :local: and others use :ext: over SSH and I guess most
> > distributed projects follow the SSH route.
> >
> > Furthermore cvsc cannot be shipped with Ant because GPL and the Apache
> > license are not compatible AFAIK.
>
>As somebody pointed out earlier, this would be best handled by having this
>as a "contrib" task -- or a task that is available outside of the Ant
>distribution.
>
>.duncan

Ah, good. :)

http://www.gjt.org/javadoc/com/ice/cvsc/CVSRequestSpec.html

has not come up yet, but in light of this good news I went off and
found another email for Tim.  So perhaps it will be available soon.

Thank-you,
Erik





Re: [PATCH]? Jcvs taskdef

Posted by James Duncan Davidson <ja...@eng.sun.com>.
on 6/5/00 6:18 AM, Stefan Bodewig at bodewig@bost.de wrote:

> I didn't look too close at Tim's cvsc package, the links to the jCVS
> Home Page at GJT are broken (point to www.ice.com/java/jcvs) so I
> couldn't find an overview document. So please correct me if I'm wrong
> Erik.
> 
> Am I right that it only supports the pserver protocoll? If this was
> true the limitation would be far to strong IMHO. Some of our internal
> projects use :local: and others use :ext: over SSH and I guess most
> distributed projects follow the SSH route.
> 
> Furthermore cvsc cannot be shipped with Ant because GPL and the Apache
> license are not compatible AFAIK.

As somebody pointed out earlier, this would be best handled by having this
as a "contrib" task -- or a task that is available outside of the Ant
distribution.

.duncan


Re: Jcvs taskdef

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "EM" == Erik Meade <em...@geekfarm.org> writes:

 EM> I am also getting some bounced email from emailing Tim about
 EM> getting the link to the spec fixed.

Seems like ICE Engineering was in the course of switching
domains. Found something at trustice.com while ice.com now is a
jeweler formerly known as buyjewel.com. Strange.

 EM> To be honest I am not sure if only the pserver protocol is
 EM> supported.

I didn't learn anything new by browsing the pages I found but "the CVS
client server protocol" sounds like pserver.

 EM> I'll keep my eyes open and see if anything else that I can work
 EM> on comes along.

Oh, I'm sure there are a lot of places to work on, just judging from
the discrepancy between core/spec.html and what Ant currently does. 

It just sometimes feels like there are more people contributing than
the project (read commiters) can handle in the limited time they
have. Shouldn't stop you or me or anybody else I hope.

Stefan

Re: Jcvs taskdef

Posted by Erik Meade <em...@geekfarm.org>.
At 03:18 PM 6/5/2000 +0200, Stefan wrote:
>Hi,
>
>I didn't look too close at Tim's cvsc package, the links to the jCVS
>Home Page at GJT are broken (point to www.ice.com/java/jcvs) so I
>couldn't find an overview document. So please correct me if I'm wrong
>Erik.

Nope, not wrong at all, I am also getting some bounced email from
emailing Tim about getting the link to the spec fixed.  I doubt I am
willing to reverse engineer the spec.

>Am I right that it only supports the pserver protocoll? If this was
>true the limitation would be far to strong IMHO. Some of our internal
>projects use :local: and others use :ext: over SSH and I guess most
>distributed projects follow the SSH route.

To be honest I am not sure if only the pserver protocol is supported.
If so, like you mentioned, it will not be nearly as useful.

>Furthermore cvsc cannot be shipped with Ant because GPL and the Apache
>license are not compatible AFAIK.
>Stefan

Ya, I'll keep my eyes open and see if anything else that I can work on
comes along.
Erik


Re: [PATCH]? Jcvs taskdef

Posted by Stefan Bodewig <bo...@bost.de>.
Hi,

I didn't look too close at Tim's cvsc package, the links to the jCVS
Home Page at GJT are broken (point to www.ice.com/java/jcvs) so I
couldn't find an overview document. So please correct me if I'm wrong
Erik.

Am I right that it only supports the pserver protocoll? If this was
true the limitation would be far to strong IMHO. Some of our internal
projects use :local: and others use :ext: over SSH and I guess most
distributed projects follow the SSH route.

Furthermore cvsc cannot be shipped with Ant because GPL and the Apache
license are not compatible AFAIK.

Stefan

RE: [PATCH]? Jcvs taskdef

Posted by Conor MacNeill <co...@m64.com>.
Erik,

I haven't looked in detail at your proposal but I think it would be best
implemented as an optional task. This way it gets compiled into ant only if
the user has the com.ice.cvsc.* classes in their classpath. As you have
provided it, I think ant would fail to build unless these classes are
present.

Cheers
Conor

> -----Original Message-----
> From: Erik Meade [mailto:emeade@geekfarm.org]
> Sent: Thursday, 1 June 2000 15:38
> To: ant-dev@jakarta.apache.org
> Subject: [PATCH]? Jcvs taskdef
>
>
> I noticed this comment in Cvs taskdef:
>
> 	// XXX: we should use JCVS (www.ice.com/JCVS) instead of
> command line
> 	// execution so that we don't rely on having native CVS
> stuff around (SM)
>
> So took a stab at it and started a Jcvs taskdef, which uses Tim's
> com.ice.cvsc
> package.

> http://www.gjt.org/servlets/JCVSlet/zip/ice/com/ice/cvsc/cvsc.zip )
>
> I've included a patch to add the Jcvs taskdef to the
> defaults.properties as
> well as
> the Jcvs.java file.
>
> Jcvs is backwards compatible with Cvs, except for the "-r"
> option. ( Because I
> didn't implement it, not because it is unimplementable ).
>
> This is my first time so please be gentle :)
> Erik Meade
>
>
> --- defaults.properties.orig    Thu Jun 01 00:19:50 2000
> +++ defaults.properties Wed May 31 19:09:24 2000
> @@ -29,6 +29,7 @@
>   filter=org.apache.tools.ant.taskdefs.Filter
>   fixcrlf=org.apache.tools.ant.taskdefs.FixCRLF
>   rename=org.apache.tools.ant.taskdefs.Rename
> +jcvs=org.apache.tools.ant.taskdefs.Jcvs
>
>   # optional tasks
>   script=org.apache.tools.ant.taskdefs.optional.Script
>
>
> /*
>   * The Apache Software License, Version 1.1
>   *
>   * Copyright (c) 1999 The Apache Software Foundation.  All rights
>   * reserved.
>   *
>   * Redistribution and use in source and binary forms, with or without
>   * modification, are permitted provided that the following conditions
>   * are met:
>   *
>   * 1. Redistributions of source code must retain the above copyright
>   *    notice, this list of conditions and the following disclaimer.
>   *
>   * 2. Redistributions in binary form must reproduce the above copyright
>   *    notice, this list of conditions and the following disclaimer in
>   *    the documentation and/or other materials provided with the
>   *    distribution.
>   *
>   * 3. The end-user documentation included with the redistribution, if
>   *    any, must include the following acknowlegement:
>   *       "This product includes software developed by the
>   *        Apache Software Foundation (http://www.apache.org/)."
>   *    Alternately, this acknowlegement may appear in the software itself,
>   *    if and wherever such third-party acknowlegements normally appear.
>   *
>   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
>   *    Foundation" must not be used to endorse or promote products derived
>   *    from this software without prior written permission. For written
>   *    permission, please contact apache@apache.org.
>   *
>   * 5. Products derived from this software may not be called "Apache"
>   *    nor may "Apache" appear in their names without prior written
>   *    permission of the Apache Group.
>   *
>   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>   * SUCH DAMAGE.
>   * ====================================================================
>   *
>   * This software consists of voluntary contributions made by many
>   * individuals on behalf of the Apache Software Foundation.  For more
>   * information on the Apache Software Foundation, please see
>   * <http://www.apache.org/>.
>   */
>
> package org.apache.tools.ant.taskdefs;
>
> import com.ice.cvsc.*;
> import java.io.File;
> import org.apache.tools.ant.BuildException;
>
> /**
>   *
>   *
>   * @author emeade@geekfarm.org
>   */
>
> public class Jcvs extends Exec implements CVSUserInterface {
>
> 	String userName;
> 	String password = "anoncvs";
> 	String hostName;
> 	String repository;
> 	String rootDirectory;
> 	String localDirectory;
> 	String tempDirectory;
>
>      boolean isPServer = true;
>      int connMethod = CVSRequest.METHOD_INETD;
>      int cvsPort = 2401;
>
>      public void execute() throws BuildException {
> 		if (tempDirectory == null) {
> 			tempDirectory =
> System.getProperty("java.io.tmpdir");
> 		}
>
> 		if (localDirectory == null) {
> 			localDirectory = ".";
> 		}
>
> 		CVSRequest request = new CVSRequest();
> 		boolean parsed =
> request.parseControlString(":co:N:ANP:deou:");
>
> 		CVSEntryVector entries = new CVSEntryVector();
>
> 		CVSArgumentVector arguments = new CVSArgumentVector();
> 		arguments.appendArgument(repository);
>
> 		CVSClient client = new CVSClient(hostName, cvsPort );
> 		CVSProject project = new CVSProject(client);
> 		project.setUserName(userName);
> 		project.setTempDirectory(tempDirectory);
> 		project.setRepository(repository);
> 		project.setRootDirectory(rootDirectory);
> 		project.setLocalRootDirectory(localDirectory);
> 		project.setPServer(isPServer);
> 		project.setConnectionMethod(connMethod);
>
ject.setPassword(CVSScramble.scramblePassword( 
> password, 'A' ));
> 		project.establishRootEntry(rootDirectory);
> 
> 		request.setPServer(isPServer);
> 		request.setUserName(userName);
> 		request.setPassword(project.getPassword());
> 		request.setConnectionMethod(connMethod);
> 		request.setPort(cvsPort);
> 		request.setHostName(hostName);
> 		request.setRepository(repository);
> 		request.setRootDirectory(rootDirectory);
> 		request.setRootRepository(rootDirectory);
> 		request.setLocalDirectory(localDirectory);
> 		request.responseHandler = project;
> 		request.traceRequest = CVSProject.overTraceRequest;
> 		request.traceResponse = CVSProject.overTraceResponse;
> 		request.traceTCPData = CVSProject.overTraceTCP;
> 		request.traceProcessing = CVSProject.overTraceProcessing;
> 		request.setEntries(entries);
> 		request.appendArguments(arguments);
> 		request.setUserInterface(this);
> 
> 		CVSResponse response = client.processCVSRequest(request);
> 		response.deleteTempFiles();
>    	}
> 
>      public void setDest(String dest) {
> 		setDir(dest);
>      }
> 
>      public void setHostName(String hostName) {
> 		this.hostName = hostName;
>      }
> 
>      public void setLocalDir(String localDir) {
> 		this.localDirectory = localDir;
>      }
> 
>      public void setPassword(String password) {
> 		this.password = password;
>      }
> 
> 	public void setPort(int port) {
> 		cvsPort = port;
> 	}
> 
>      public void setRepository(String repository) {
> 		this.repository = repository;
>      }
> 
>      public void setRootDir(String rootDir) {
> 		rootDirectory = rootDir;
>      }
> 
>      public void setTempDir(String tempDir) {
> 		tempDirectory = tempDir;
>      }
> 
>      public void setUserName(String userName) {
> 		this.userName = userName;
>      }
> 
> 	// For backward compatabitly with Cvs.
>      public void setCvsRoot(String root) {
> 		// XXX: handle non isPServer
> 		if (root.startsWith(":pserver:")) {
> 			isPServer = true;
> 			// strip off the :pserver:
> 			root = root.substring(9);
> 		}
> 
> 		int atIndex = root.indexOf("@");
> 		int cvsrootIndex = root.indexOf(":");
> 
> 		userN
ame = root.substring(0, atIndex);
> 		hostName = root.substring(atIndex + 1, cvsrootIndex);
> 		rootDirectory = root.substring(cvsrootIndex + 1);
>      }
>
>      public void setPackage(String p) {
> 		repository = p;
>      }
>
> 	// XXX: Need to handle this in the Jcvs way
>      public void setTag(String p) {
>          // Check if not real tag => set it to null
>          if (p != null) {
>              if (p.trim().equals(""))
>                  p = null;
>          }
> //        this.tag = p;
>      }
>
> 	//
> 	// CVS USER INTERFACE METHODS
> 	//
>
> 	public void uiDisplayProgressMsg( String message ) {
> 		System.out.println("[exec] " + message);
> 	}
>
> 	public void	uiDisplayProgramError( String error ) {
> 		System.out.println("[error] " + error);
> 	}
>
> 	public void uiDisplayResponse( CVSResponse response ) {
> 	}
>
> 	//
> 	// END OF CVS USER INTERFACE METHODS
> 	//
>
> }
>
>