|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object PIRL.Conductor.Maestro.Profile
public class Profile
A Profile contains Theater and Conductor definitions.
A Profile completely specifies the Conductor instances running, or
to be run, on a set of Theaters. A Profile may take the form of a
Configuration
that can be read
from
or written
to and file.
A Theater definition is a list of one to three entries:
The Theater location is a required entry in the definition. It must always be the first entry in the definition.
The Conductor name is not required in the definition. It may be the second or third entry in the definition. A Theater definition witout a Conductor name is a "discovery" definition: A connection is to be made to the Theater and whatever Conductors are running there are to be discovered. However, a Theater definition must not have a Conductor name if it occurs within a Conductor definition, in which case the Conductor name is implicitly the name of the Conductor definition.
The Count is not required in the definition, but must not be present if no Conductor name is present, unless the Theater definition occurs within a Conductor definition. It may be the second or third entry in the definition. The default Count is 1.
A Profile may contain zero or more Theater definitions. In a Profile Configuration the Theater definitions are always contained in an Assignment Parameter named "Theaters" with an Array Value that is a list of one or more Theater locations, or a list of one or more Theater definition Array Values. : a single multi-entry Theater definition must be contained in in an Array to distinguish it from a list of Theater locations; this results in doubled parentheses (or curly braces) around the single definition.
Each Theater definition in the Profile is guaranteed to have a unique combination of Theater location and Conductor name values. In a user supplied Profile Configuration file, however, a Theater location and Conductor name combination may occur in more than one Theater definition. The Count of each duplicate location/name combination is added to the Count of the initial definition. That is, Theater definitions read from Configuration files are accumulated into a consolidated list of unique definitions.
If a Conductor Theater definition with only a location entry is duplicated, the duplicates are ignored. However, a definition with the same location but that also contains a Conductor name causes the location-only definition to be ignored.
A Theaters parameter in a user supplied Profile Configuration file may occur at the top level of the file or within Conductor definitions. A Theater definition within a Conductor definition must not contain a Conductor name since this is implicitly the name of the containing Conductor definition.
Example Profile Configuration Theater definitions:
# Single Theater location.
Theaters = host
Theaters = host:1234
Theaters = (host)
# Multiple Theater locations.
Theaters = (host_1, host_2, host_3, host_3:1234)
# Single Theater definition.
Theaters = ((host, name, 1))
Theaters = ((host, name))
# Multiple Theater definitions.
Theaters = ((host_1, name), (host_2, name, 2), (host_3, name_3, 3))
Theaters =
(
host_1:1234,
(host_2:1234, name),
(host_3:1234, name_3, 3)
)
A Conductor definition is an Aggregate (Group or Object) Parameter that specifies the command line arguments used to instantiate a Conductor at a Theater location. The name of the Aggregate is the Conductor name used in a Theater definition. All Parameter Aggregates in a Profile Configuration are taken to be Conductor definitions. The parameters contained in a Conductor definition are all Assignments with String values (except the Theaters parameter) and are all optional:
If this parameter is not present it will be provided with the value being the Conductor definition name.
If this parameter is not present the instantiated Conductor will use its default Configuration source, which is expected to be the "Conductor.conf" pathname.
If this parameter is not present the instantiated Conductor will use the first entry in the Configuration Server parameter list.
If this parameter is not present the instantiated Conductor will use the Catalog prefix of the Pipeline (catalog.pipeline) if present; otherwise it will use the value of the "Catalog" name from the Configuration Server parameter group, or the default "Catalog" parameter in the Configuration.
A Profile may contain zero or more Conductor definitions. It is not necessary that all Conductor definitions be referenced by a Conductor name in a Theater definition. Any Conductor name in a Theater definition for which a Conductor definition has not been provided will be satisfied by a generic Conductor definition as if an emtpy group with the Conductor name had been provided.
All Conductor definitions will be unique; Conductor definitions with the same definition parameters must have different names. N.B.: A Profile Configuration file should contain only one Conductor definition Group (or Object) having a given name because when the Configuration is ingested Groups with the same name will have their parameter contents coalesced into a single Group; duplicate parameters names that are encountered will result in an exception being thrown.
Example Profile Configuration Conductor definitions:
# A generic Conductor definition.
Group = name
End_Group
# Simple Conductor definitions.
Group = name
Pipeline = pipeline
End_Group
Group = name_1
Pipeline = pipeline
Configuration = config_pathname_1
End_Group
Group = name_2
Pipeline = pipeline_2
Configuration = config_pathname_2
End_Group
# Complete Conductor definition.
Group = name
Pipeline = pipeline
Configuration = /an/absolute/pathname
Server = server_name
Catalog = catalog_name
End_Group
# Conductor definition with Theater definitions.
Group = pipeline
Theaters = ((host_1), (host2, 2), (host_3, 3))
Configuration = http://config.host/pathname/to/file
End_Group
A Profile Configuration may be managed as separate files by taking advantage of the "@Include" capability of a Configuration. For example, sets of "standard" Conductor definitions may be maintained in files separate from various files that contain Theater definitions and "@Include" one or more of the standard Conductor definition sets:
# Theater definitions.
Theaters =
(
# Using standard Conductor definitions.
(host_1, standard_1),
(host_2, standard_2),
# Using special processing Conductor definitions.
(host_1, special_1),
(host_2, special_2)
# Custom Conductor definitions.
(host_1, custom_1),
# Local Conductor definition.
(host_2, local, 3)
)
# Standard Conductor definitions.
@Include = /Conductor/definitions/repository/Standard.defs
# Special processing Conductor definitions.
@Include = /Conductor/definitions/repository/Special_Processing.defs
# Custom Conductor definitions.
@Include = Custom_Conductor.defs
# Local Conductor definition.
Group = local
Configuration = /an/absolute/pathname
End_Group
In this example the included files may have many Conductor definitions, most of which are not used in any particular Theaters Theater definitions list.
"@Include" may also be used to provide common parts of various Coductor definitions by putting it inside the appropriate Conductor definitions.
Profiles are used by the Kapellmeister
application.
Field Summary | |
---|---|
static int |
CONDUCTOR_COUNT_INDEX
The index of the Conductor count Integer in a theater definition Vector. |
static int |
CONDUCTOR_NAME_INDEX
The index of the Conductor name String or Conductor_Definition in a theater definition Vector. |
static String |
ID
Class identification name with source code version and date. |
static String |
NO_CONDUCTOR_DEFINITION
Theater Conductor name entry when no Conductor_Definition is provided. |
static String |
PIPELINE_PARAMETER_NAME
The name of the Conductor definition parameter that specifies the pipeline to be processed. |
static String |
PROFILE_NAME
The name of a Profile Configuration . |
static int |
THEATER_DEFINITION_SIZE
The size of a complete Theater definition Vector. |
static int |
THEATER_LOCATION_INDEX
The index of the Theater location String in a theater definition Vector. |
static String |
THEATERS_PARAMETER_NAME
The Profile Configuration parameter name for a list of Theater definitions. |
Constructor Summary | |
---|---|
Profile()
Construct an empty Profile. |
|
Profile(List<List<Object>> theater_definitions,
List<Conductor_Definition> conductor_definitions)
Construct a Profile from Theater and Conductor definitions. |
|
Profile(String source)
Construct a Profile from a source Configuration file. |
Method Summary | |
---|---|
Profile |
Add_Conductor_Definition(Message message)
Adds a Conductor definition from a Message. |
Profile |
Add_Conductor_Definitions(List<Conductor_Definition> conductor_definitions)
Add Conductor_Definitions to the Profile. |
Profile |
Add_Theater_Definition(List<Object> theater_definition)
Add a Theater definition to the Profile. |
Profile |
Add_Theater_Definition(String theater_location)
Add a general Theater definition. |
Profile |
Add_Theater_Definitions(List<List<Object>> theater_definitions)
Add a list of Theater definitions to the Profile. |
Profile |
Add(List<List<Object>> theater_definitions,
List<Conductor_Definition> conductor_definitions)
Adds Theater and Conductor definitions to the Profile. |
Profile |
Add(String theater_location,
Message conductor_definition)
Add a Conductor_Definition associated with a Theater Location. |
Vector<Vector<Object>> |
Canonical_Theater_Definitions()
Get the canonical Theater definitions list. |
Profile |
Clear_Conductor_Definitions()
Clears the Conductor_Definitions Vector. |
Profile |
Clear_Theater_Definitions()
Clear the Theater definitions list. |
static int |
Conductor_Definition_Index(List<Conductor_Definition> conductor_definitions,
String conductor_name)
Get a Conductor_Definition index from a list of Conductor_Definition objects using its name. |
Conductor_Definition |
Conductor_Definition(String conductor_name)
Get the Conductor_Definition for a Conductor name. |
Vector<Conductor_Definition> |
Conductor_Definitions()
Get the list of Conductor_Definitions. |
Configuration |
Configuration()
Get the Profile as a Configuration. |
boolean |
Contains_Conductor_Definition(Message message)
Test if this Profile contains a Conductor_Definition matching a Message. |
boolean |
Contains_Theater_Definition(String theater_location)
Test if any Theater definition for a location is present in this Profile. |
int |
Next_Theater_Index(String theater_location,
int index)
Get the Profile index of the next Theater definition for a Theater location starting after a given index. |
Profile |
Read(Configuration configuration)
Read Theater and Conductor definitions from a Configuration. |
Profile |
Read(String source)
Read Theater and Conductor definitions from a Configuration source file. |
void |
Remove_Conductor_Definition(int index)
Removes a definition from the Conductor_Definitions Vector based on the index. |
Conductor_Definition |
Remove_Conductor_Definition(String conductor_name)
Remove a Conductor_Definition by name. |
Vector<Object> |
Remove_Theater_Definition(int index)
Removes a Theater definition at a Theater_Definitions() index. |
Vector<Object> |
Remove_Theater_Definition(String theater_location,
String conductor_name)
Remove a Theater definition from the Profile for a Theater location and Conductor name. |
static int |
Theater_Definition_Index(List theater_definitions,
String theater_location,
String conductor_name)
Get the index of a Theater definition for a Theater location and Conductor name in a Vector of Theater definitions. |
Vector<Object> |
Theater_Definition(int index)
Get a Theater definition at its Profile index. |
Vector<Object> |
Theater_Definition(String theater_location,
String conductor_name)
Get the Theater definition for a Theater location and Conductor name. |
Vector<Vector<Object>> |
Theater_Definitions()
Get the list of Theater definitions. |
String |
toString()
Get a PVL description of the Profile. |
int |
Total_Conductor_Definitions()
Get the number of Conductor_Definitions in the Profile. |
int |
Total_Theater_Definitions()
Get the number of Theater definitions in the Profile. |
Configuration |
Unprocessed_Source_Parameters()
Get unprocessed Configuration parameters. |
static void |
Validate_Theater_Definition(List<Object> theater_definition)
Validate a Theater definition. |
static void |
Validate_Theater_Definitions(List<List<Object>> theater_definitions)
Validate a Theater definitions list. |
Profile |
Write(OutputStream output_stream)
Write the Profile to an OutputStream. |
Profile |
Write(String pathname)
Write the Profile to a Configuration file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
public static final String PROFILE_NAME
Configuration
.
public static final String THEATERS_PARAMETER_NAME
public static final int THEATER_DEFINITION_SIZE
public static final int THEATER_LOCATION_INDEX
public static final int CONDUCTOR_NAME_INDEX
public static final int CONDUCTOR_COUNT_INDEX
public static final String NO_CONDUCTOR_DEFINITION
public static final String PIPELINE_PARAMETER_NAME
Constructor Detail |
---|
public Profile(String source) throws Configuration_Exception, PVL_Exception
Any parameters remaining after the source has been read
will be held in the unprocessed source Configuration
.
source
- A Configuration source String. This may be a file
pathname or a URL.
Configuration_Exception
- If there was a problem with the source
Configuration syntax.
PVL_Exception
public Profile(List<List<Object>> theater_definitions, List<Conductor_Definition> conductor_definitions) throws IllegalArgumentException
theater_definitions
- A List of Theater definitions.conductor_definitions
- A List of Conductor_Definitions.
IllegalArgumentException
- If there was a problem creating the
Profile.Add(List, List)
public Profile()
Method Detail |
---|
public Profile Read(String source) throws Configuration_Exception
Theater and Conductor definitions found in the Configuration are added to the definitions currently in this Profile.
source
- A Configuration source String. This may be a file
pathname or a URL.
Configuration_Exception
- If the source can not be found or parsed
as valid PVL or the contents do not conform to valid Profile
syntax.Read(Configuration)
public Profile Read(Configuration configuration) throws Configuration_Exception
Theater and Conductor definitions found in the Configuration are
added to the definitions currently in this Profile. Only THEATERS_PARAMETER_NAME
Assignment parameters are used as Theater
definitions. All Aggregate parameters are taken to be Conductor
definitions.
N.B.: The Theater and Conductor definitions found in the
Configuration are removed from the Configuration leaving only the
unprocessed source parameters
in the original Configuration.
configuration
- A Configuration. If null nothing is done.
Configuration_Exception
- If the Configuration Theater or
Conductor definition contents do not conform to valid Profile
syntax.public Configuration Unprocessed_Source_Parameters()
read
. This
will be null if there were no unprocessed parameters.public Profile Write(String pathname) throws Configuration_Exception, IOException
Configuration
file.
If the Profile is empty nothing is written.
pathname
- The file pathname String. If null or empty
nothing is done.
Configuration_Exception
- If there was a problem creating a
Configuration for this Profile.
IOException
- If there was a problem writing the file.Write(OutputStream)
public Profile Write(OutputStream output_stream) throws Configuration_Exception, IOException
A configuration
is created from the current
Profile contents and this is written
to the OutputStream.
If the Profile is empty nothing is written.
output_stream
- An OutputStream where the Profile Configuration
is to be written. If null nothing is done.
Configuration_Exception
- If there was a problem creating a
Configuration for this Profile.
IOException
- If there was a problem writing the file.public Configuration Configuration() throws Configuration_Exception
Name
of the Configuration will
be the PROFILE_NAME
.
Configuration_Exception
- If there was a problem creating the
Configurationpublic String toString()
The current contents of the Profile are converted to a Configuration
from which a PVL description
is obtained.
toString
in class Object
Configuration
description
could not be generated.public Profile Add(List<List<Object>> theater_definitions, List<Conductor_Definition> conductor_definitions) throws IllegalArgumentException
theater_definitions
- A List of Theater definitions.conductor_definitions
- A List of Conductor_Definitions.
IllegalArgumentException
- If the arguments are not one
List of valid Theater definitions and one List of valid
Conductor_Definitions.public Profile Add(String theater_location, Message conductor_definition) throws IllegalArgumentException
The Theater definition will have as a Conductor name the
Conductor name
obtained from the Conductor definition, and it will have a Conductor
count of 1.
theater_location
- A Theater location String. If null or
empty nothing is done.conductor_definition
- A Conductor definition Message. If null
nothing is done.
IllegalArgumentException
- If the Conductor definition
conflicts with an existing definition.Add_Theater_Definition(String)
,
Add_Conductor_Definition(Message)
public Profile Add_Theater_Definitions(List<List<Object>> theater_definitions) throws IllegalArgumentException
theater_definitions
- A List containing Theater definitions. If
null or empty nothing is done.
IllegalArgumentException
- If any Theater definition in the
theater_definitions is not valid
.Add_Theater_Definition(List)
public Profile Add_Theater_Definition(List<Object> theater_definition) throws IllegalArgumentException
The theater definition is first validated
. It is then copied and
added to the Profile.
theater_definition
- A List containing a Theater definition.
If null or empty nothing is done.
IllegalArgumentException
- If the theater_definition is not
valid.public Profile Add_Theater_Definition(String theater_location)
A general Theater definition has a Theater location but no Conductor name (this will be null) or count (this will be zero).
Adding a general Theater definition for a location that already has a Theater definition in the Profile will have no effect; a general definition does not override a specific definition.
theater_location
- A Theater location String. If this is null
or empty nothing will be done.
public static void Validate_Theater_Definition(List<Object> theater_definition) throws IllegalArgumentException
A valid Theater definition Vector contains three entries:
host[:port]
The host may be a hostname, short or fully qualified, or IP address. The optional port is the system port number used to connect to the Stage_Manager.
Conductor_Definition
in the Profile.
This may be null to indicate that the Conductors on the Theater are
to be used as-is ("discovered").
theater_definition
- A List containing a Theater definition.
IllegalArgumentException
- If the theater_definition is invalid.public static void Validate_Theater_Definitions(List<List<Object>> theater_definitions) throws IllegalArgumentException
theater_definitions
- The List that is to be validated. If null
or empty nothing is validated.
IllegalArgumentException
- If a theater_definitions entry
is invalid.Validate_Theater_Definition(List)
public Vector<Object> Theater_Definition(int index)
index
- A Profile Theater definition index.
public int Next_Theater_Index(String theater_location, int index)
Starting at the Profile index immediately following the specified index, the index of the next Theater definition for the specified location is returned.
theater_location
- A Theater location String.index
- The Profile index after which the search for the
next Theater definition for the the location will begin.
If less than zero the search begins with the first definition.
Theater_Definition(int)
public Vector<Vector<Object>> Theater_Definitions()
public Vector<Object> Theater_Definition(String theater_location, String conductor_name)
theater_location
- A Theater location String. If null, null
is returned.conductor_name
- A Conductor name. If null, null is
returned.
public Vector<Vector<Object>> Canonical_Theater_Definitions()
N.B.: The CONDUCTOR_NAME_INDEX
entry in the
definition Vector will be the full Conductor_Definition, not just its
name. This will be null if the definition for the Theater does not
specify any Conductors.
public boolean Contains_Theater_Definition(String theater_location)
theater_location
- A Theater location String. If null or empty
false is returned.
public static int Theater_Definition_Index(List theater_definitions, String theater_location, String conductor_name)
theater_definitions
- A Vector of Theater definitions. If null
or empty -1 is returned. N.B.: This must be a
valid Theater definitions
list
.theater_location
- A Theater location String. If null or
empty -1 is returned.conductor_name
- A Conductor name String. May be null.
public int Total_Theater_Definitions()
public Vector<Object> Remove_Theater_Definition(String theater_location, String conductor_name)
theater_location
- A Theater location String. If null or
empty null will be returned.conductor_name
- A Conductor name String. May be null.
public Vector<Object> Remove_Theater_Definition(int index)
Theater_Definitions()
index.
index
- The index of a Theater definition in this Profile.
public Profile Clear_Theater_Definitions()
public Profile Add_Conductor_Definitions(List<Conductor_Definition> conductor_definitions) throws IllegalArgumentException
conductor_definitions
- A List of Conductor_Definitions.
IllegalArgumentException
- If a definition conflicts with an
existing definition of the same name.Add_Conductor_Definition(Message)
public Profile Add_Conductor_Definition(Message message) throws IllegalArgumentException
message
- A Message containing a Conductor definition to be
added to this Profile.
IllegalArgumentException
- If the Message does not contain a
valid Conductor definition or contains a conflicting definition
with a definition of the same name already in the Profile.public boolean Contains_Conductor_Definition(Message message)
Each Conductor_Definition contained in this Profile is compared
against the contents of the Message for a matching definition
. N.B.:
The name of the Message does not need to match the name of a
Conductor_Definition, only the contents must logically match.
message
- A Message. If null false is returned.
public Vector<Conductor_Definition> Conductor_Definitions()
public static int Conductor_Definition_Index(List<Conductor_Definition> conductor_definitions, String conductor_name)
conductor_definitions
- A List of Conductor_Definition objects.conductor_name
- The Conductor_Definition name.
public Conductor_Definition Conductor_Definition(String conductor_name)
conductor_name
- A Conductor_Definition name String. If null,
null is returned.
public int Total_Conductor_Definitions()
public Conductor_Definition Remove_Conductor_Definition(String conductor_name)
conductor_name
- A Conductor name.
public void Remove_Conductor_Definition(int index)
public Profile Clear_Conductor_Definitions()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |