org.fosstrak.llrp.client
Class RepositoryFactory

java.lang.Object
  extended by org.fosstrak.llrp.client.RepositoryFactory

public class RepositoryFactory
extends java.lang.Object

helper class to instantiate the repository.

Author:
sawielan

Field Summary
static java.lang.String ARG_DB_CLASSNAME
          class name in the arguments table.
static java.lang.String ARG_JDBC_STRING
          JDBC string in the arguments table.
static java.lang.String ARG_LOG_RO_ACCESS_REPORT
          parameter whether to log RO_ACCESS_REPORT.
static java.lang.String ARG_PASSWRD
          password in the arguments table.
static java.lang.String ARG_USERNAME
          user-name in the arguments table.
static java.lang.String ARG_WIPE_DB
          parameter whether to wipe DB in the arguments table.
static java.lang.String ARG_WIPE_RO_ACCESS_REPORTS_DB
          parameter whether to wipe RO_ACCESS_REPORTS DB in the arguments table.
 
Constructor Summary
RepositoryFactory()
           
 
Method Summary
static Repository create(java.util.Map<java.lang.String,java.lang.String> args)
          create a new repository with the configuration parameters provided via the parameters hash map.
static Repository create(java.util.Properties properties)
          create a new repository and read the configuration from a Properties data structure.
static java.util.Map<java.lang.String,java.lang.String> createMap(java.lang.String[][] keyValue)
          helper to create a hash-map with key-value pairs. just provide a 2D array, with pairs of (key, value).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARG_USERNAME

public static final java.lang.String ARG_USERNAME
user-name in the arguments table.

See Also:
Constant Field Values

ARG_PASSWRD

public static final java.lang.String ARG_PASSWRD
password in the arguments table.

See Also:
Constant Field Values

ARG_JDBC_STRING

public static final java.lang.String ARG_JDBC_STRING
JDBC string in the arguments table.

See Also:
Constant Field Values

ARG_WIPE_DB

public static final java.lang.String ARG_WIPE_DB
parameter whether to wipe DB in the arguments table.

See Also:
Constant Field Values

ARG_LOG_RO_ACCESS_REPORT

public static final java.lang.String ARG_LOG_RO_ACCESS_REPORT
parameter whether to log RO_ACCESS_REPORT.

See Also:
Constant Field Values

ARG_WIPE_RO_ACCESS_REPORTS_DB

public static final java.lang.String ARG_WIPE_RO_ACCESS_REPORTS_DB
parameter whether to wipe RO_ACCESS_REPORTS DB in the arguments table.

See Also:
Constant Field Values

ARG_DB_CLASSNAME

public static final java.lang.String ARG_DB_CLASSNAME
class name in the arguments table.

See Also:
Constant Field Values
Constructor Detail

RepositoryFactory

public RepositoryFactory()
Method Detail

createMap

public static java.util.Map<java.lang.String,java.lang.String> createMap(java.lang.String[][] keyValue)
helper to create a hash-map with key-value pairs. just provide a 2D array, with pairs of (key, value).

Example:

Map<String,String> m = createMap(new String[][] {
    {key1, value1},
    {key2, value2},
    {key3, value3}
  }

Parameters:
keyValue - the key values 2D array.
Returns:
a hash-map mapping the 2D array in a hash-table.

create

public static Repository create(java.util.Properties properties)
                         throws java.lang.InstantiationException,
                                LLRPRuntimeException,
                                java.lang.IllegalAccessException,
                                java.lang.ClassNotFoundException
create a new repository and read the configuration from a Properties data structure.

Parameters:
properties - the properties where to obtain the configuration from.
Returns:
an instance of a Repository.
Throws:
java.lang.InstantiationException - when no instantiation was possible.
java.lang.IllegalAccessException - access to class was denied.
java.lang.ClassNotFoundException - when the class is not existing.
LLRPRuntimeException - when something other went wrong.

create

public static Repository create(java.util.Map<java.lang.String,java.lang.String> args)
                         throws java.lang.InstantiationException,
                                LLRPRuntimeException,
                                java.lang.IllegalAccessException,
                                java.lang.ClassNotFoundException
create a new repository with the configuration parameters provided via the parameters hash map.

Parameters:
args - a hash-map providing the parameters.
Returns:
an instance of a Repository.
Throws:
java.lang.InstantiationException - when no instantiation was possible.
java.lang.IllegalAccessException - access to class was denied.
java.lang.ClassNotFoundException - when the class is not existing.
LLRPRuntimeException - when something other went wrong.


Copyright © 2009. All Rights Reserved.