com.aragost.javahg.internals
Class Server

java.lang.Object
  extended by com.aragost.javahg.internals.Server

public class Server
extends Object

Java class representing a Mercurial commandserver


Constructor Summary
Server(String hgBin, Charset encoding)
          Create a new Server object
 
Method Summary
 void cloneMercurialRepository(File directory, String hgrcPath, String cloneUrl)
          Convenience method to clone a mercurial repository in a directory.
protected  void finalize()
           
 CodingErrorAction getErrorAction()
           
 String getStartupStderr()
           
 int getStderrBufferSize()
           
 void initMecurialRepository(File directory)
          Convenience method to initialize a mercurial repository in a directory.
 boolean isEnablePendingChangesets()
           
 CharsetDecoder newDecoder()
           
 CharsetEncoder newEncoder()
           
 OutputChannelInputStream runCommand(List<String> cmdLine, AbstractCommand command)
          Run the specified command and return a stream with the content of the output channel.
 void sendLine(String answer)
           
 void setEnablePendingChangesets(boolean enablePendingChangesets)
           
 void setErrorAction(CodingErrorAction errorAction)
           
 void setStderrBufferSize(int stderrBufferSize)
          Set the buffer size for stderr from Mercurial server process.
 String start(File directory, String hgrcPath, List<String> extraArguments, Map<String,String> env, Runnable supervisor)
          Start the server in the specified directory.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Server

public Server(String hgBin,
              Charset encoding)
Create a new Server object

Parameters:
hgBin - the Mercurial binary to use
Method Detail

getErrorAction

public CodingErrorAction getErrorAction()

setErrorAction

public void setErrorAction(CodingErrorAction errorAction)

getStderrBufferSize

public int getStderrBufferSize()

getStartupStderr

public String getStartupStderr()

setEnablePendingChangesets

public void setEnablePendingChangesets(boolean enablePendingChangesets)

isEnablePendingChangesets

public boolean isEnablePendingChangesets()

setStderrBufferSize

public void setStderrBufferSize(int stderrBufferSize)
Set the buffer size for stderr from Mercurial server process.

There is probably no reason to set this, but it is here to facilitate testcases for buffer overflow.

Parameters:
stderrBufferSize -

newDecoder

public CharsetDecoder newDecoder()
Returns:
a new CharsetDecoder instance for this server.

newEncoder

public CharsetEncoder newEncoder()
Returns:
a new CharsetEncoder instance for this server.

start

public String start(File directory,
                    String hgrcPath,
                    List<String> extraArguments,
                    Map<String,String> env,
                    Runnable supervisor)
Start the server in the specified directory. The directory is must be the root directory of a Mercurial repository.

Parameters:
directory - The directory of to start the command server in
hgrcPath - The path to the hgrc config file to use. May be null
extraArguments - Additional argument to start the command server with. Eg extensions to enable
env - Optional map of environment variables to set when starting the command server.
supervisor - Optional function to be executed periodically by the error stream thread. May be null
Returns:
The hello message from the server

runCommand

public OutputChannelInputStream runCommand(List<String> cmdLine,
                                           AbstractCommand command)
                                    throws IOException
Run the specified command and return a stream with the content of the output channel.

The client must empty the return stream. The server will not accept other commands until all out is read.

Parameters:
cmdLine -
command -
Returns:
the standard output from the command.
Throws:
IOException

initMecurialRepository

public void initMecurialRepository(File directory)
Convenience method to initialize a mercurial repository in a directory.

This method is not using any commandserver functionality

Parameters:
directory -

cloneMercurialRepository

public void cloneMercurialRepository(File directory,
                                     String hgrcPath,
                                     String cloneUrl)
Convenience method to clone a mercurial repository in a directory.

This method is not using any commandserver functionality

Parameters:
directory -
hgrcPath -
cloneUrl -

toString

public String toString()
Overrides:
toString in class Object

sendLine

public void sendLine(String answer)

finalize

protected void finalize()
Overrides:
finalize in class Object


Copyright © 2011-2013 aragost Trifork ag. All Rights Reserved.