Search in sources :

Example 6 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class RequestProcessor method openConnection.

// Utils ==================================================================
private IConnectionStreams openConnection() throws CommandException, AuthenticationException {
    clientEnvironment.getConnection().open(streamLogger);
    ConnectionStreams connectionStreams = new ConnectionStreams(clientEnvironment.getConnection(), streamLogger, clientEnvironment.getCharset());
    boolean exception = true;
    try {
        updateValidRequests(connectionStreams);
        sendRequest(new RootRequest(clientEnvironment.getConnection().getRepository()), connectionStreams);
        sendSetRequests(globalOptions, connectionStreams);
        // Handle gzip-compression
        if (globalOptions.isUseGzip() && isValidRequest(GzipStreamRequest.REQUEST)) {
            sendRequest(new GzipStreamRequest(), connectionStreams);
            connectionStreams.setGzipped();
        }
        //TODO: set variables
        sendRequest(new ValidResponsesRequest(), connectionStreams);
        sendRequest(new UseUnchangedRequest(), connectionStreams);
        sendGlobalOptionRequests(globalOptions, connectionStreams);
        if (System.getProperty(OS_NAME_PROPERTY).startsWith(WINDOWS_PREFIX) && isValidRequest(CASE_REQUEST)) {
            sendRequest(new CaseRequest(), connectionStreams);
        }
        exception = false;
        return connectionStreams;
    } catch (IOException ex) {
        BugLog.getInstance().showException(ex);
        throw new IOCommandException(ex);
    } finally {
        if (exception) {
            connectionStreams.close();
        }
    }
}
Also used : IOException(java.io.IOException) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 7 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class WatchersCommand method execute.

// Implemented ============================================================
/**
	 * Executes this command.
	 *
	 * @param requestProcessor the client services object that provides any necessary
	 *               services to this command, including the ability to actually
	 *               process all the requests
	 */
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.WATCHERS, clientEnvironment);
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
}
Also used : ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 8 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class RemoveCommand method execute.

// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventSender, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.REMOVE, clientEnvironment);
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final ICvsListener parser = new RemoveParser(eventSender, clientEnvironment.getCvsFileSystem());
    parser.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
    } finally {
        parser.unregisterListeners(listenerRegistry);
    }
}
Also used : ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 9 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class StatusCommand method execute.

/**
	 * Execute a command
	 * @param requestProcessor the client services object that provides any necessary
	 * services to this command, including the ability to actually process
	 * all the requests.
	 */
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventSender, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.STATUS, clientEnvironment);
    requests.addArgumentRequest(includeTags, "-v");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final IRequestsProgressHandler requestsProgressHandler = new FileStateRequestsProgressHandler(new RangeProgressViewer(progressViewer, 0.0, 0.5), cvsFiles);
    final ICvsListener responseProgressHandler = new FileInfoAndMessageResponseProgressHandler(new RangeProgressViewer(progressViewer, 0.5, 1.0), cvsFiles, EXAM_DIR);
    final ICvsListener statusMessageParser = new StatusMessageParser(eventSender, getFileObjects(), clientEnvironment.getCvsFileSystem());
    final ICvsListener listener = new DualListener(statusMessageParser, responseProgressHandler);
    listener.registerListeners(listenerRegistry);
    try {
        return requestProcessor.processRequests(requests, requestsProgressHandler);
    } finally {
        listener.unregisterListeners(listenerRegistry);
    }
}
Also used : FileInfoAndMessageResponseProgressHandler(org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler) RangeProgressViewer(org.netbeans.lib.cvsclient.progress.RangeProgressViewer) FileStateRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) IRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException) DualListener(org.netbeans.lib.cvsclient.event.DualListener)

Example 10 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class AdminCommand method execute.

public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    BugLog.getInstance().assertTrue(isSetLock() || isResetLock(), "Nothing specified");
    final ICvsFiles cvsFiles;
    try {
        cvsFiles = scanFileSystem(clientEnvironment);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    final Requests requests = new Requests(CommandRequest.ADMIN, clientEnvironment);
    requests.addArgumentRequest(isSetLock(), "-l");
    requests.addArgumentRequest(isResetLock(), "-u");
    addFileRequests(cvsFiles, requests, clientEnvironment);
    requests.addLocalPathDirectoryRequest();
    addArgumentRequests(requests);
    final IRequestsProgressHandler requestsProgressHandler = FileStateRequestsProgressHandler.create(progressViewer, cvsFiles);
    return requestProcessor.processRequests(requests, requestsProgressHandler);
}
Also used : ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) IRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Aggregations

IOException (java.io.IOException)12 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)12 Requests (org.netbeans.lib.cvsclient.request.Requests)10 ICvsFiles (org.netbeans.lib.cvsclient.command.ICvsFiles)8 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)7 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)4 DualListener (org.netbeans.lib.cvsclient.event.DualListener)3 RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)3 FileInfoAndMessageResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler)3 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)3 DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)2 CommandException (org.netbeans.lib.cvsclient.command.CommandException)1 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)1 AbstractFileObject (org.netbeans.lib.cvsclient.file.AbstractFileObject)1 DirectoryRequest (org.netbeans.lib.cvsclient.request.DirectoryRequest)1