edu.isi.pegasus.planner.client
public class RCClient extends org.griphyn.vdl.toolkit.Toolkit
edu.isi.pegasus.planner.catalog.replica.ReplicaCatalog,
ReplicaCatalogEntry,
JDBCRC| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_CHUNK_FACTOR
The default chunk factor that is used for biting off chunks of large
files.
|
private static String |
LFN_DOES_NOT_EXIST_MSG
The message for LFN's not found.
|
private boolean |
m_batch
Indication of batch mode.
|
private int |
m_chunk_factor
The number of lines that are to be parsed for chunking up large input
files.
|
private String |
m_conf_property_file
Reference to the property file passed using the --conf option
|
private org.apache.log4j.Logger |
m_log
Our own logger.
|
protected PegasusProperties |
m_pegasus_props
The object holding all the properties pertaining to Pegasus.
|
private Map |
m_prefs
Maintains instance-local settings on user preferences.
|
private ReplicaCatalog |
m_rc
Maintains the interface to the replica catalog implementation.
|
private LogManager |
m_rls_logger
Logger for RLS implementation for the time being.
|
private static org.apache.log4j.Logger |
m_root
Keeps track of log4j's root logger as singleton.
|
private int |
m_total_lines_succ_worked
The total number of lines on which the client has successfully worked on
till yet.
|
private int |
m_total_lines_worked
The total number of lines on which the client has worked on till yet.
|
| Constructor and Description |
|---|
RCClient(String appName)
ctor: Constructs a new instance of the commandline interface to replica
catalogs.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
close()
Frees resources taken by the instance of the replica catalog.
|
(package private) void |
connect(PegasusProperties properties)
Connects the interface with the replica catalog implementation.
|
private void |
determineChunkFactor()
Sets the chunk factor for chunking up large input files.
|
private void |
doSet(org.apache.log4j.Level level) |
Object |
enter(String key,
String value)
Adds a preference to the instance preferences settings.
|
private String |
escape(String s)
Escapes quotes and backslashes by backslashing them.
|
protected gnu.getopt.LongOpt[] |
generateValidOptions()
Creates a set of GNU long options.
|
private void |
initialize(String[] opts,
char confChar)
Initialize the RCClient object
|
private void |
lfnDoesNotExist(String lfn)
Writes out a message about LFN not existing.
|
static void |
log(org.apache.log4j.Level level,
String msg)
Logs messages from main() method.
|
private String |
lookupConfProperty(String[] opts,
char confChar)
Looks up for the conf property in the command line arguments passed to the RCClient
|
static void |
main(String[] args)
Manipulate entries in a given replica catalog implementation.
|
private String |
noquote(String s)
Removes a pair of outer quotes, which are optional.
|
void |
parse(String filename)
Consumes commands that control the replica management.
|
void |
parse(String filename,
String command)
Consumes commands that control the replica management.
|
void |
setLevel(int level)
Sets a logging level.
|
private void |
show(String lfn,
ReplicaCatalogEntry rce)
Preliminary implementation of output method.
|
void |
showHelp()
Prints internal command help.
|
void |
showUsage()
Prints the usage string on stdout.
|
private String |
unescape(String s)
Unescapes previously backslashed characters.
|
int |
work(List words)
Works on the command contained within one line.
|
int |
work(List lines,
String command)
Works on the command contained within chunk of lines.
|
private static final String LFN_DOES_NOT_EXIST_MSG
private static final int DEFAULT_CHUNK_FACTOR
private ReplicaCatalog m_rc
private Map m_prefs
private static org.apache.log4j.Logger m_root
private LogManager m_rls_logger
private int m_chunk_factor
private int m_total_lines_worked
private int m_total_lines_succ_worked
private boolean m_batch
protected PegasusProperties m_pegasus_props
private String m_conf_property_file
private org.apache.log4j.Logger m_log
public RCClient(String appName)
appName - is the name of to print in usage records.public void setLevel(int level)
level - is the new level to achieve.public static void log(org.apache.log4j.Level level,
String msg)
level - is the log4j level to generate the log message formsg - is the message itself.Category.log(Priority, Object )private void doSet(org.apache.log4j.Level level)
public Object enter(String key, String value)
key - is a key into the preference map.value - is the new value to add.private void initialize(String[] opts, char confChar)
opts - the command line argument passed by the userconfChar - the short option corresponding the conf property.public void showUsage()
showUsage in class org.griphyn.vdl.toolkit.Toolkitprotected gnu.getopt.LongOpt[] generateValidOptions()
void connect(PegasusProperties properties) throws ClassNotFoundException, IOException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, MissingResourceException
ClassNotFoundException - if the schema for the database cannot be loaded. You might
want to check your CLASSPATH, too.NoSuchMethodException - if the schema's constructor interface does not comply with
the database driver API.InstantiationException - if the schema class is an abstract class instead of a
concrete implementation.IllegalAccessException - if the constructor for the schema class it not publicly
accessible to this package.InvocationTargetException - if the constructor of the schema throws an exception while
being dynamically loaded.IOExceptionMissingResourceExceptionChimeraPropertiesvoid close()
private String escape(String s)
s - is the string to escapeunescape(String )private String unescape(String s)
s - is the string to escapeescape(String )private String noquote(String s)
s - is a string which may start and end in quotesprivate void lfnDoesNotExist(String lfn)
lfn - the lfn.private void show(String lfn, ReplicaCatalogEntry rce)
lfn - is the logical filename to showrce - is the replica catalog entry to show. It contains at minimum
the physical filename, and may contain any number of key-value
pairs.public void showHelp()
public int work(List lines, String command)
lines - is a list of lines with each line being a list of words that
is split appropriatelycommand - the command to be invoked.public int work(List words)
words - is a list of the arguments, split appropriatelypublic void parse(String filename) throws IOException
filename - is the file to read from. If null, use stdin.IOExceptionpublic void parse(String filename, String command) throws IOException
filename - is the file to read from.command - is the command that needs to be applied to the file contentsIOExceptionprivate String lookupConfProperty(String[] opts, char confChar)
opts - command line argumentsconfChar - short char corresponding to the conf propertypublic static void main(String[] args)
args - are the commandline arguments.private void determineChunkFactor()