flux
Class Factory

java.lang.Object
  extended by flux.Factory

public abstract class Factory
extends java.lang.Object

Makes engines, looks up remote engines, and creates other useful objects.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Field Summary
static int INFINITY
          Used by engine wrappers to imply that retries will be attempted until the expiration time is exceeded.
 
Constructor Summary
Factory()
           
 
Method Summary
static java.lang.String getVersion()
          Returns version information for this Flux release.
abstract  Engine lookupEngine(java.lang.String host)
          Looks up a remote engine at the specified host.
abstract  Engine lookupEngine(java.lang.String host, int port)
          Looks up a remote engine at the specified host and port.
abstract  Engine lookupEngine(java.lang.String host, int port, boolean ssl)
          Looks up a remote engine at the specified host.
abstract  java.lang.String makeEncryptedPassword(java.lang.String password)
          Returns the supplied clear-text password in encrypted format.
abstract  Engine makeEngine()
          Creates an engine with a default, non-clusterable Derby database.
abstract  Engine makeEngine(Configuration configuration)
          Creates an engine using the supplied configuration.
abstract  Engine makeEngine(java.lang.String configurationFile)
          Creates an engine using the supplied configuration file; if the engine is later restarted with a new configuration, the configuration file specified here will be overwritten with the new configuration.
static Factory makeInstance()
          Makes a new Factory.
abstract  Engine makeJ2seEngine(DatabaseType databaseType, java.lang.String driver, java.lang.String url, java.lang.String username, java.lang.String password, int maxConnections, java.lang.String tablePrefix)
          Creates an engine using database connection information from a JDBC driver.
abstract  Engine makeJ2seRemoteEngine(DatabaseType databaseType, java.lang.String driver, java.lang.String url, java.lang.String username, java.lang.String password, int maxConnections, java.lang.String tablePrefix, java.lang.String host, int port)
          Creates an remote engine using database connection information from a JDBC driver.
abstract  JmxFactory makeJmxFactory()
          Makes a new JmxFactory, which is responsible for creating Flux JMX MBeans, which are used for managing Flux engines from JMX management consoles.
abstract  Engine makeRemoteEngine()
          Creates an remote engine with a default in-memory database.
abstract  RuntimeConfigurationFactory makeRuntimeConfigurationFactory()
          Makes a new RuntimeConfigurationFactory, which is responsible for creating runtime configuration nodes and other runtime configuration objects.
abstract  Engine wrapEngine(Engine engine, int count, java.lang.String delayTimeExpression, java.lang.String expirationTimeExpression)
          Wraps an existing engine with an engine that retries failed client calls.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITY

public static final int INFINITY
Used by engine wrappers to imply that retries will be attempted until the expiration time is exceeded.

See Also:
wrapEngine(flux.Engine, int, java.lang.String, java.lang.String), Constant Field Values
Constructor Detail

Factory

public Factory()
Method Detail

makeInstance

public static Factory makeInstance()
Makes a new Factory.

Returns:
A freshly made Factory.

getVersion

public static java.lang.String getVersion()
Returns version information for this Flux release.

Returns:
Version information for this Flux release.

lookupEngine

public abstract Engine lookupEngine(java.lang.String host)
                             throws EngineException
Looks up a remote engine at the specified host. The default port and default ssl configuration are used.

Parameters:
host - The remote computer to contact.
Returns:
A reference to a remote engine.
Throws:
EngineException - If a system error occurs.
EngineCommunicationException - If a networking error occurs.

lookupEngine

public abstract Engine lookupEngine(java.lang.String host,
                                    int port)
                             throws EngineException
Looks up a remote engine at the specified host and port. The default ssl configuration is used.

Parameters:
host - Indicates the computer where an engine resides.
port - The TCP/IP port to use when connecting to an engine server.
Returns:
A reference to a remote engine.
Throws:
EngineException - If a system error occurs.
EngineCommunicationException - If a networking error occurs.

lookupEngine

public abstract Engine lookupEngine(java.lang.String host,
                                    int port,
                                    boolean ssl)
                             throws EngineException
Looks up a remote engine at the specified host.

Parameters:
host - Indicates the computer where an engine resides.
port - The TCP/IP port to use when connecting to an engine server.
ssl - Indicates whether SSL is enabled on the remote server.
Returns:
A reference to a remote engine.
Throws:
EngineException - If a system error occurs.
EngineCommunicationException - If a networking error occurs.

makeEncryptedPassword

public abstract java.lang.String makeEncryptedPassword(java.lang.String password)
                                                throws EngineException
Returns the supplied clear-text password in encrypted format.

Parameters:
password - The password to encrypt.
Returns:
The supplied password in encrypted format.
Throws:
EngineException - If a system error occurs.

makeEngine

public abstract Engine makeEngine()
                           throws EngineException
Creates an engine with a default, non-clusterable Derby database. This method is handy for simple situations, examples, and prototypes. To store engine information in an enterprise-class database, use another method to make an engine.

Returns:
A freshly made engine.
Throws:
EngineException - If a system error occurs.

makeEngine

public abstract Engine makeEngine(Configuration configuration)
                           throws EngineException
Creates an engine using the supplied configuration.

Parameters:
configuration - A specification of how to make an engine.
Returns:
A freshly made engine.
Throws:
EngineException - If a system error occurs.

makeEngine

public abstract Engine makeEngine(java.lang.String configurationFile)
                           throws EngineException
Creates an engine using the supplied configuration file; if the engine is later restarted with a new configuration, the configuration file specified here will be overwritten with the new configuration.

Parameters:
configurationFile - Filename to an engine configuration file.
Returns:
A freshly made engine created from the specified properties configuration file.
Throws:
EngineException - If a system error occurs.

makeJ2seEngine

public abstract Engine makeJ2seEngine(DatabaseType databaseType,
                                      java.lang.String driver,
                                      java.lang.String url,
                                      java.lang.String username,
                                      java.lang.String password,
                                      int maxConnections,
                                      java.lang.String tablePrefix)
                               throws EngineException
Creates an engine using database connection information from a JDBC driver. The engine uses database connections obtained using the JDBC driver for persisting engine information.

Parameters:
databaseType - The kind of database that will be used.
driver - The JDBC driver.
url - The database URL.
username - The username to connect to the database as.
password - The username's password.
maxConnections - The maximum number of connections to create to the database.
tablePrefix - A string that is prepended to database tables used by the engine.
Returns:
A freshly made Engine.
Throws:
EngineException - If a system error occurs.

makeJ2seRemoteEngine

public abstract Engine makeJ2seRemoteEngine(DatabaseType databaseType,
                                            java.lang.String driver,
                                            java.lang.String url,
                                            java.lang.String username,
                                            java.lang.String password,
                                            int maxConnections,
                                            java.lang.String tablePrefix,
                                            java.lang.String host,
                                            int port)
                                     throws EngineException
Creates an remote engine using database connection information from a JDBC driver. The engine uses database connections obtained using the JDBC driver for persisting engine information.

Parameters:
databaseType - The kind of database that will be used.
driver - The JDBC driver.
url - The database URL.
username - The username to connect to the database as.
password - The username's password.
maxConnections - The maximum number of connections to create to the database.
tablePrefix - A string that is prepended to database tables used by the engine.
host - Indicates the computer where an engine resides.
port - The TCP/IP port to use when connecting to an engine server.
Returns:
A freshly made Engine.
Throws:
EngineException - If a system error occurs.

makeJmxFactory

public abstract JmxFactory makeJmxFactory()
                                   throws EngineException
Makes a new JmxFactory, which is responsible for creating Flux JMX MBeans, which are used for managing Flux engines from JMX management consoles.

Returns:
A freshly made JmxFactory.
Throws:
EngineException - If a system error occurs.

makeRemoteEngine

public abstract Engine makeRemoteEngine()
                                 throws EngineException
Creates an remote engine with a default in-memory database. This method is handy for simple situations, examples, and prototypes. To persist engine information to a real database, use another method to make an engine.

Returns:
A freshly made Engine.
Throws:
EngineException - If a system error occurs.

makeRuntimeConfigurationFactory

public abstract RuntimeConfigurationFactory makeRuntimeConfigurationFactory()
Makes a new RuntimeConfigurationFactory, which is responsible for creating runtime configuration nodes and other runtime configuration objects.

Returns:
A freshly made RuntimeConfigurationFactory.

wrapEngine

public abstract Engine wrapEngine(Engine engine,
                                  int count,
                                  java.lang.String delayTimeExpression,
                                  java.lang.String expirationTimeExpression)
Wraps an existing engine with an engine that retries failed client calls.

Parameters:
engine - The existing engine.
count - The maximum number of times to retry a failed client call before giving up. May be INFINITY, in which case the expiration time expression may not be null. Must be greater than 0.
delayTimeExpression - The time to wait before retrying a failed client call. If null, defaults to 200 milliseconds.
expirationTimeExpression - The maximum amount of time that may pass before giving up. If null, implies that there is no expiration. Keep in mind, however, that the wrapper engine may still give up if the count is exceeded.
Returns:
The wrapped engine.
See Also:
INFINITY


© 2014 Flux Corporation. All rights reserved.