| 1 |
package org.astrogrid.samp.hub; |
| 2 |
|
| 3 |
import java.io.IOException; |
| 4 |
import java.util.List; |
| 5 |
|
| 6 |
/** |
| 7 |
* Factory to produce hub profiles of a particular type. |
| 8 |
* Used with the command-line invocation of the hub. |
| 9 |
* |
| 10 |
* @author Mark Taylor |
| 11 |
* @since 31 Jan 2011 |
| 12 |
*/ |
| 13 |
public interface HubProfileFactory { |
| 14 |
|
| 15 |
/** |
| 16 |
* Returns the name used to identify this profile. |
| 17 |
* |
| 18 |
* @return short name |
| 19 |
*/ |
| 20 |
String getName(); |
| 21 |
|
| 22 |
/** |
| 23 |
* Returns an array of strings, each describing one command-line flag |
| 24 |
* which will be consumed by the <code>createProfile</code> method. |
| 25 |
* |
| 26 |
* @return array of plain-text strings suitable for use as part of |
| 27 |
* a usage message |
| 28 |
*/ |
| 29 |
String[] getFlagsUsage(); |
| 30 |
|
| 31 |
/** |
| 32 |
* Creates a HubProfile perhaps configured using a supplied list |
| 33 |
* of flags. Any flags which match those described by the |
| 34 |
* {@link #getFlagsUsage} command are used for configuration of the |
| 35 |
* returned hub, and must be removed from the <code>flagList</code> list. |
| 36 |
* Unrecognised flags should be ignored and left in the list. |
| 37 |
* Flags which are recognised but badly formed should raise a |
| 38 |
* RuntimeException with a helpful message. |
| 39 |
* |
| 40 |
* @param flagList mutable list of Strings giving command-ilne flags, |
| 41 |
* some of which may be intended for configuring a profile |
| 42 |
* @return new profile |
| 43 |
*/ |
| 44 |
HubProfile createHubProfile( List flagList ) throws IOException; |
| 45 |
|
| 46 |
/** |
| 47 |
* Returns a HubProfile subclass with a no-arg constructor which, |
| 48 |
* when invoked, will produce a basic instance of the HubProfile |
| 49 |
* represented by this factory. The instance thus produced will |
| 50 |
* typically be similar to that produced by invoking |
| 51 |
* {@link #createHubProfile} with an empty flag list. |
| 52 |
* |
| 53 |
* @return HubProfile subclass with a public no-arg constructor |
| 54 |
*/ |
| 55 |
Class getHubProfileClass(); |
| 56 |
} |