org.codehaus.mojo.mrm.plugin
Class FileSystemServer

java.lang.Object
  extended by org.codehaus.mojo.mrm.plugin.FileSystemServer

public class FileSystemServer
extends Object

A file system server.


Constructor Summary
FileSystemServer(String name, int port, org.codehaus.mojo.mrm.api.FileSystem fileSystem)
          Creates a new file system server that will serve a FileSystem over HTTP on the specified port.
 
Method Summary
 void ensureStarted()
          Ensures that the file system server is started (if already starting, will block until started, otherwise starts the file system server and blocks until started)
 void finish()
          Signal the file system server to shut down.
 int getPort()
          Gets the port that the file system server is/will server on.
 String getUrl()
          Gets the root url that the file system server is/will server on.
 boolean isFinished()
          Returns true if and only if the file system server is finished.
 boolean isStarted()
          Returns true if and only if the file system server is started.
 void waitForFinished()
          Blocks until the file system server has actually shut down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemServer

public FileSystemServer(String name,
                        int port,
                        org.codehaus.mojo.mrm.api.FileSystem fileSystem)
Creates a new file system server that will serve a FileSystem over HTTP on the specified port.

Parameters:
name - The name of the file system server thread.
port - The port to server on or 0 to pick a random, but available, port.
fileSystem - the file system to serve.
Method Detail

ensureStarted

public void ensureStarted()
                   throws org.apache.maven.plugin.MojoExecutionException
Ensures that the file system server is started (if already starting, will block until started, otherwise starts the file system server and blocks until started)

Throws:
org.apache.maven.plugin.MojoExecutionException - if the file system server could not be started.

isFinished

public boolean isFinished()
Returns true if and only if the file system server is finished.

Returns:
true if and only if the file system server is finished.

isStarted

public boolean isStarted()
Returns true if and only if the file system server is started.

Returns:
true if and only if the file system server is started.

finish

public void finish()
Signal the file system server to shut down.


waitForFinished

public void waitForFinished()
                     throws InterruptedException
Blocks until the file system server has actually shut down.

Throws:
InterruptedException - if interrupted.
IllegalStateException - if called before a call to finish().

getPort

public int getPort()
Gets the port that the file system server is/will server on.

Returns:
the port that the file system server is/will server on.

getUrl

public String getUrl()
Gets the root url that the file system server is/will server on.

Returns:
the root url that the file system server is/will server on.


Copyright © 2009-2011 Codehaus. All Rights Reserved.