Once you've spent some time with IConsoleFacet you may find it has several shortcomings. These are addressed in IAdvancedConsoleFacet which does everything that IConsoleFacet does, plus a bit more.
Before we go into the details of IAdvancedConsoleFacet we should own up to a small fib. Previously we said that when the launcher connects to a service it looks for an IConsoleFacet and uses that as its console interface. Actually, this isn't strictly true. What it really does is look for an IAdvancedConsoleFacet, and if it that's not there looks for an IConsoleFacet instead, and if it find that then it wraps it up as its more advanced sibling and uses that.
Now, here's what IAdvancedConsoleFacet gives us extra:
public interface IAdvancedConsoleFacet extends IRemote
{
/** When there is a problem decoding an application-specific property.
*/
public class DecodeException extends Exception
{
public DecodeException(String msg)
{
super(msg);
}
public DecodeException() {}
}
/**
* Fetch the list of supported commands.
*/
public CommandDescription[] getCommands();
/** Execute a command.
* @param command The command name.
* @param arguments All the Property arguments needed to invoke the
* command.
* @param stdin Some input stream from which the command might like
* to read bytes. This parameter must not be null; at least create
* an IInputStream with no data.
* @param stdout Some output stream though which the command can return
* bytes. This parameter must not be <tt>null</tt> although
* it is of course allowed to throw the bytes away if it wishes.
* @return An array of return values from the command.
* @throws CommandException If anything goes wrong executing the
* command.
*/
public Property[] execCommand(CommandDescription command, Property[] arguments,
IInputStream stdin, IOutputStream stdout) throws CommandException;
/** Decode an application-specific property from a string.
* See this interface's description for an example of this.
* @param type The application-specific type given on the launcher
* (or other) command line.
* @param encoded The string sequence given on the command line, which
* this interface needs to interpret.
* @return The string, decoded to become a property.
* @throws DecodeException If the encoded string cannot be interpretted.
*/
public Property decode(String type, String encoded) throws DecodeException;
/** Get a list of application-specific types which can be decoded
* with this console interface.
* @return Each element of the returned array is a string which could
* be the <tt>type</tt> parameter of the <tt>decode()</tt> method
* of this interface.
*/
public String[] getDecoders();
}
Finally the advanced console facet has the expected useful tools. Have a look at...
Nik Silver 2002-03-09