Document ComponentProvider interface.

This commit is contained in:
Josh Suereth 2013-12-12 09:51:58 -05:00
parent 0c62483e74
commit cfe14444b8
2 changed files with 49 additions and 1 deletions

View File

@ -2,6 +2,11 @@ package xsbti;
import java.io.File;
/**
* This represents an interface that can generate applications.
*
* An application is somethign which will run and return an exit value.
*/
public interface AppProvider
{
/** Returns the ScalaProvider that this AppProvider will use. */
@ -34,5 +39,8 @@ public interface AppProvider
/** The classpath from which the main class is loaded, excluding Scala jars.*/
public File[] mainClasspath();
/** Returns a mechanism you can use to install/find/resolve components.
* A component is just a related group of files.
*/
public ComponentProvider components();
}

View File

@ -2,12 +2,52 @@ package xsbti;
import java.io.File;
/**
* A service to locate, install and modify "Components".
*
* A component is essentially a directory and a set of files attached to a unique string id.
*/
public interface ComponentProvider
{
/**
* @param id The component's id string.
* @return
* The "working directory" or base directory for the component. You should perform temporary work here for the component.
*/
public File componentLocation(String id);
/**
* Grab the current component definition.
*
* @param componentID The component's id string.
* @return
* The set of files attached to this component.
*/
public File[] component(String componentID);
/**
* This will define a new component using the files passed in.
*
* Note: The component will copy/move the files into a cache location. You should not use them directly, but
* look them up using the `component` method.
*
* @param componentID The component's id string
* @param components The set of files which defines the component.
*
* @throws BootException if the component is already defined.
*/
public void defineComponent(String componentID, File[] components);
/**
* Modify an existing component by adding files to it.
*
* @param componentID The component's id string
* @param components The set of new files to add to the component.
* @return true if any files were copied and false otherwise.
*
*/
public boolean addToComponent(String componentID, File[] components);
// null if locking disabled
/**
* @return The lockfile you should use to ensure your component cache does not become corrupted.
* May return null if there is no lockfile for this provider.
*/
public File lockFile();
}