How to list modules through a FileInfoEvent on CVSNT
Gunnerhell Alexander <[email protected]> Mon, 29 Mar 2004 16:27:33 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.javacvs.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I've read the posts about listing modules. However my prototype code doesn't
produce any results (no errors either).
Now I suspect that CVSNT doesn't support the commands "cvs co -s" and "cvs
co -c". When I try those commands from the DOS client there's no response
whatsoever from the server. However "cvs ls" works fine:
C:\>cvs ls
Listing modules on server
CVSDummyProj
CVSDummyProj2
CVSROOT
C:\>cvs checkout -s
C:\>cvs checkout -c
C:\>
This is on CVSNT 2.0.15 (client and server reported as one version).
Here's some code-snippets:
the listeners:
public class FileInfoListener extends CVSAdapter
{
public void fileInfoGenerated(FileInfoEvent e)
{
System.out.println("fileInfo event received");
PrintStream stream=new PrintStream(System.out);
ModuleListInformation info=(ModuleListInformation)
e.getInfoContainer();
stream.println(info.getModuleName());
}
}
public class BasicListener extends CVSAdapter
{
/**
* Stores a tagged line
*/
private final StringBuffer taggedLine = new StringBuffer();
/**
* Called when the server wants to send a message to be
displayed to
* the user. The message is only for information purposes and
clients
* can choose to ignore these messages if they wish.
* @param e the event
*/
public void messageSent(MessageEvent e)
{
System.out.println("message event received");
String line = e.getMessage();
PrintStream stream = e.isError() ? System.err
:
System.out;
if (e.isTagged())
{
String message =
MessageEvent.parseTaggedMessage(taggedLine, line);
// if we get back a non-null line, we have something
// to output. Otherwise, there is more to come and we
// should do nothing yet.
if (message != null)
{
stream.println(message);
}
}
else
{
stream.println(line);
}
}
the testclient code:
//setup connection
globOpt = new GlobalOptions();
globOpt.setCVSRoot(cVSRoot);
globOpt.setUseGzip(false);
cvsRP = new CVSRootParser(cVSRoot);
pSrvCon = new PServerConnection();
pSrvCon.setUserName(cvsRP.user);
pSrvCon.setEncodedPassword(
StandardScrambler.getInstance().scramble(pwd));
pSrvCon.setHostName(cvsRP.host);
pSrvCon.setRepository(cvsRP.repository);
try
{
pSrvCon.open();
}
catch (AuthenticationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
//setup client controller
client = new Client(pSrvCon, new StandardAdminHandler());
client.setLocalPath(localPath);
//setup listeners
client.getEventManager().addCVSListener(new BasicListener());
client.getEventManager().addCVSListener(new FileInfoListener());
//setup a co list command
CheckoutCommand listCmd=new CheckoutCommand();
listCmd.setShowModulesWithStatus(true);
try
{
client.executeCommand(listCmd,globOpt);
}
and the output:
message event received
Server is not supporting gzip-file-contents request
What is wrong? Is it my code or the CVSNT server??? If it is my code, I'd
appreciate all comments on how to solve this.
Best Regards
Alexander