Subversion Repositories XServices

Rev

Blame | Last modification | View Log | Download | RSS feed

package net.brutex.xservices.util;

import java.io.PrintStream;

import org.netbeans.lib.cvsclient.command.FileInfoContainer;
import org.netbeans.lib.cvsclient.command.log.LogInformation;
import org.netbeans.lib.cvsclient.event.BinaryMessageEvent;
import org.netbeans.lib.cvsclient.event.CVSAdapter;
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.FileToRemoveEvent;
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 abstract class BasicCVSListener implements CVSListener
{
    /**
     * 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)
    {
        String line = e.getMessage();
        PrintStream stream = e.isError() ? System.err
                                         : System.out;

        if (e.isTagged())
        {
            String message = e.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: " + message);
            }
        }
        else
        {
            //stream.println("Message: " + line);
        }
    }

        @Override
        public void commandTerminated(TerminationEvent arg0) {
                
        }

        @Override
        public void fileAdded(FileAddedEvent arg0) {
                
                
        }

        @Override
        public void fileInfoGenerated(FileInfoEvent arg0) {
                FileInfoContainer info = arg0.getInfoContainer();
                LogInformation info2 = (LogInformation) info;
                System.out.println(info2.getRepositoryFilename());
                System.out.println(info2.getDescription());
                
        }

        @Override
        public void fileRemoved(FileRemovedEvent arg0) {
                // TODO Auto-generated method stub
                
        }

        @Override
        public void fileToRemove(FileToRemoveEvent arg0) {
                // TODO Auto-generated method stub
                
        }

        @Override
        public void fileUpdated(FileUpdatedEvent arg0) {
                // TODO Auto-generated method stub
                
        }

        @Override
        public void messageSent(BinaryMessageEvent arg0) {
                // TODO Auto-generated method stub
                
        }

        @Override
        public void moduleExpanded(ModuleExpansionEvent arg0) {
                // TODO Auto-generated method stub
                
        }
}