checkout command doesn't work -> please help
"Michael Seeboerger" <[email protected]> Wed, 18 Jun 2008 18:22:09 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.javacvs.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi there,
I've tried to get the javacvs netbeans library running. The commit works fine, but I have some problems with the check out command. I want to check out all files from a module. My code is listed below. The class CVSConnection is doing the connection to the cvs server, LogCSVListener listen to events. I got the following error from LogCVSListener:
unrecognized request `'
org.netbeans.lib.cvsclient.event.TerminationEvent[source=org.netbeans.lib.cvsclient.response.ErrorResponse@174cc1f]
org.netbeans.lib.cvsclient.event.TerminationEvent[source=org.netbeans.lib.cvsclient.response.OKResponse@1050e1f]
So here is my code - > is anything wrong?? Please help, because I cannot find any other sample code.
Thanks in advance
Michael
-----
package org.seebi.cvs;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import org.netbeans.lib.cvsclient.CVSRoot;
import org.netbeans.lib.cvsclient.Client;
import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
import org.netbeans.lib.cvsclient.command.CommandAbortedException;
import org.netbeans.lib.cvsclient.command.CommandException;
import org.netbeans.lib.cvsclient.command.GlobalOptions;
import org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand;
import org.netbeans.lib.cvsclient.command.commit.CommitBuilder;
import org.netbeans.lib.cvsclient.command.commit.CommitCommand;
import org.netbeans.lib.cvsclient.command.update.UpdateBuilder;
import org.netbeans.lib.cvsclient.command.update.UpdateCommand;
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
import org.netbeans.lib.cvsclient.connection.ConnectionFactory;
import org.netbeans.lib.cvsclient.connection.PServerConnection;
import org.netbeans.lib.cvsclient.connection.StandardScrambler;
public class CVSConnection {
String encryptedPassword = StandardScrambler.getInstance().scramble("my_password");
public CVSConnection() {
}
public void checkoutFromCVS() throws ExecutionException{
PServerConnection c = null;
try {
String encryptedPassword = StandardScrambler.getInstance().scramble("MY_PASSWORD");
CVSRoot root = CVSRoot.parse(":pserver:[email protected]:/tools");
c = (PServerConnection)ConnectionFactory.getConnection(root);
c.setEncodedPassword(encryptedPassword);
c.open();
Client client = new Client(c, new StandardAdminHandler());
GlobalOptions options = new GlobalOptions();
options.setCVSRoot(":pserver:[email protected]:/tools");
client.ensureConnection();
client.getEventManager().addCVSListener(new LogCVSListener());
CheckoutCommand checkout = new CheckoutCommand(true,"mytool/today");
client.setLocalPath("C:\\TEMP");
client.getEventManager().addCVSListener(new LogCVSListener());
client.executeCommand(checkout,options);
System.out.println("End");
} catch (CommandAbortedException e) {
System.out.println(e);
} catch (AuthenticationException e) {
System.out.println(e);
}catch (CommandException e) {
System.out.println(e);
} finally {
if(null != c) {
try {
c.close();
} catch (IOException e) {
System.out.println(e);
}
}
}
}
}
----
package org.seebi.cvs;
import org.netbeans.lib.cvsclient.event.CVSListener;
import org.netbeans.lib.cvsclient.event.FileAddedEvent;
import org.netbeans.lib.cvsclient.event.FileInfoEvent;
import org.netbeans.lib.cvsclient.event.FileRemovedEvent;
import org.netbeans.lib.cvsclient.event.FileUpdatedEvent;
import org.netbeans.lib.cvsclient.event.MessageEvent;
import org.netbeans.lib.cvsclient.event.ModuleExpansionEvent;
import org.netbeans.lib.cvsclient.event.TerminationEvent;
public class LogCVSListener implements CVSListener {
public LogCVSListener() {
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#messageSent(org.netbeans.lib.cvsclient.event.MessageEvent)
*/
public void messageSent(MessageEvent e) {
if (e.isError()) {
System.out.println(e.getMessage());
} else {
System.out.println(e.getMessage());
}
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#messageSent(org.netbeans.lib.cvsclient.event.BinaryMessageEvent)
*/
public void messageSent(Object e) {
System.out.println(e);
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#fileAdded(org.netbeans.lib.cvsclient.event.FileAddedEvent)
*/
public void fileAdded(FileAddedEvent e) {
System.out.println(e);
}
/* (non-Javadoc)
* @see org.netbeans.lib.cvsclient.event.CVSListener#fileToRemove(org.netbeans.lib.cvsclient.event.FileToRemoveEvent)
*/
public void fileToRemove(Object e) {
System.out.println(e);
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#fileRemoved(org.netbeans.lib.cvsclient.event.FileRemovedEvent)
*/
public void fileRemoved(FileRemovedEvent e) {
System.out.println(e);
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#fileUpdated(org.netbeans.lib.cvsclient.event.FileUpdatedEvent)
*/
public void fileUpdated(FileUpdatedEvent e) {
System.out.println(e);
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#fileInfoGenerated(org.netbeans.lib.cvsclient.event.FileInfoEvent)
*/
public void fileInfoGenerated(FileInfoEvent e) {
System.out.println(e);
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#commandTerminated(org.netbeans.lib.cvsclient.event.TerminationEvent)
*/
public void commandTerminated(TerminationEvent e) {
if (e.isError()) {
System.out.println(e);
} else {
System.out.println(e);
}
}
public void moduleExpanded(ModuleExpansionEvent e) {
System.out.println(e);
}
/*
* (non-Javadoc)
*
* @see org.netbeans.lib.cvsclient.event.CVSListener#moduleExpanded(org.netbeans.lib.cvsclient.event.ModuleExpansionEvent)
*/
}
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger