org.jumpmind.symmetric
Class SymmetricEngine

java.lang.Object
  extended by org.jumpmind.symmetric.SymmetricEngine

public class SymmetricEngine
extends java.lang.Object

This is the preferred way to create, configure, start and manage an instance of Symmetric. The engine will bootstrap the symmetric.xml Spring context.

The Symmetric instance is configured by properties configuration files. By default the engine will look for and override existing properties with ones found in the properties files. Symmetric looks for: symmetric.properties in the classpath (it will use the first one it finds), and then for a symmetric.properties found in the user.home system property location. Next, if provided, in the constructor of the SymmetricEngine, it will locate and use the properties file passed to the engine.

When the engine is ready to be started, the start() method should be called. It should only be called once.


Field Summary
protected static org.apache.commons.logging.Log logger
           
 
Constructor Summary
  SymmetricEngine()
          Create a symmetric node
protected SymmetricEngine(org.springframework.context.ApplicationContext ctx)
          Pass in the Spring context to be used.
  SymmetricEngine(java.lang.String... overridePropertiesResources)
           
 
Method Summary
static SymmetricEngine findEngineByName(java.lang.String name)
           
static SymmetricEngine findEngineByUrl(java.lang.String url)
          Locate a SymmetricEngine in the same JVM
 org.springframework.context.ApplicationContext getApplicationContext()
          Expose access to the Spring context.
 java.lang.String getEngineName()
           
 java.util.Properties getProperties()
          Get a list of configured properties for Symmetric.
 void heartbeat()
          Push a copy of the node onto the push queue so the symmetric node 'checks' in with it's root node.
 boolean isRegistered()
          Check to see if this node has been registered.
 boolean isStarted()
          Check to see if this node has been started.
 boolean isStarting()
          Check to see if this node is starting.
 void openRegistration(java.lang.String groupId, java.lang.String externalId)
          Open up registration for node to attach.
 void pull()
          This can be called if the pull job has not been enabled.
 void purge()
          This can be called to do a purge.
 void push()
          This can be called if the push job has not been enabled.
 java.lang.String reloadNode(java.lang.String nodeId)
          Queue up an initial load or a reload to a node.
 void reOpenRegistration(java.lang.String nodeId)
           
 java.lang.String sendSQL(java.lang.String nodeId, java.lang.String tableName, java.lang.String sql)
           
 void setup()
          Will setup the symmetric tables, if not already setup and if the engine is configured to do so.
 void start()
          Must be called to start symmetric.
 void stop()
           
 void syncTriggers()
          Call this to resync triggers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.commons.logging.Log logger
Constructor Detail

SymmetricEngine

public SymmetricEngine(java.lang.String... overridePropertiesResources)

SymmetricEngine

public SymmetricEngine()
Create a symmetric node


SymmetricEngine

protected SymmetricEngine(org.springframework.context.ApplicationContext ctx)
Pass in the Spring context to be used. This had better include the Spring configuration for required Symmetric services.

Parameters:
ctx - A Spring framework context
Method Detail

stop

public void stop()

getProperties

public java.util.Properties getProperties()
Get a list of configured properties for Symmetric. Read-only.


getEngineName

public java.lang.String getEngineName()

setup

public void setup()
Will setup the symmetric tables, if not already setup and if the engine is configured to do so.


start

public void start()
Must be called to start symmetric.


reloadNode

public java.lang.String reloadNode(java.lang.String nodeId)
Queue up an initial load or a reload to a node.


sendSQL

public java.lang.String sendSQL(java.lang.String nodeId,
                                java.lang.String tableName,
                                java.lang.String sql)

push

public void push()
This can be called if the push job has not been enabled. It will perform a push the same way the PushJob would have.

See Also:
IPushService.pushData()

syncTriggers

public void syncTriggers()
Call this to resync triggers

See Also:
IBootstrapService.syncTriggers()

pull

public void pull()
This can be called if the pull job has not been enabled. It will perform a pull the same way the PullJob would have.

See Also:
IPullService.pullData()

purge

public void purge()
This can be called to do a purge. It may be called only if the PurgeJob has not been enabled.

See Also:
IPurgeService.purge()

heartbeat

public void heartbeat()
Push a copy of the node onto the push queue so the symmetric node 'checks' in with it's root node.

See Also:
IBootstrapService.heartbeat()

openRegistration

public void openRegistration(java.lang.String groupId,
                             java.lang.String externalId)
Open up registration for node to attach.

See Also:
IRegistrationService.openRegistration(String, String)

reOpenRegistration

public void reOpenRegistration(java.lang.String nodeId)

isRegistered

public boolean isRegistered()
Check to see if this node has been registered.

Returns:
true if the node is registered

isStarted

public boolean isStarted()
Check to see if this node has been started.

Returns:
true if the node is started

isStarting

public boolean isStarting()
Check to see if this node is starting.

Returns:
true if the node is starting

getApplicationContext

public org.springframework.context.ApplicationContext getApplicationContext()
Expose access to the Spring context. This is for advanced use only.

Returns:

findEngineByUrl

public static SymmetricEngine findEngineByUrl(java.lang.String url)
Locate a SymmetricEngine in the same JVM


findEngineByName

public static SymmetricEngine findEngineByName(java.lang.String name)


Copyright © 2007-2008. All Rights Reserved.