org.jumpmind.symmetric.service.impl
Class NodeService

java.lang.Object
  extended by org.jumpmind.symmetric.service.impl.NodeService
All Implemented Interfaces:
INodeService

public class NodeService
extends java.lang.Object
implements INodeService


Field Summary
protected  org.springframework.jdbc.core.JdbcTemplate jdbcTemplate
           
protected  IParameterService parameterService
           
 
Constructor Summary
NodeService()
           
 
Method Summary
 Node findIdentity()
           
 Node findIdentity(boolean useCache)
           
 Node findNode(java.lang.String id)
          Lookup a node in the database, which contains information for syncing with it.
 Node findNodeByExternalId(java.lang.String nodeGroupId, java.lang.String externalId)
           
 NodeSecurity findNodeSecurity(java.lang.String id)
          Lookup a node_security in the database, which contains private information used to authenticate.
 NodeSecurity findNodeSecurity(java.lang.String id, boolean createIfNotFound)
           
 java.util.List<Node> findNodesToPull()
           
 java.util.List<Node> findNodesToPushTo()
           
 java.util.List<Node> findSourceNodesFor(DataEventAction eventAction)
           
 java.util.List<Node> findTargetNodesFor(DataEventAction eventAction)
           
 void flushNodeAuthorizedCache()
           
 java.lang.String generateNodeId(java.lang.String nodeGroupId, java.lang.String externalId)
          Generate the next node ID that is available.
 java.lang.String generatePassword()
          Generate a secure random password for a node.
protected
<T> T
getFirstEntry(java.util.List<T> list)
           
protected  org.springframework.jdbc.core.simple.SimpleJdbcTemplate getSimpleTemplate()
           
 java.lang.String getSql(java.lang.String key)
           
 void ignoreNodeChannelForExternalId(boolean enabled, java.lang.String channelId, java.lang.String nodeGroupId, java.lang.String externalId)
           
 void insertNodeSecurity(java.lang.String id)
           
 boolean isExternalIdRegistered(java.lang.String nodeGroupId, java.lang.String externalId)
           
 boolean isNodeAuthorized(java.lang.String id, java.lang.String password)
          Check that the given node and password match in the node_security table.
 boolean isRegistrationEnabled(java.lang.String nodeId)
           
 boolean setInitialLoadEnabled(java.lang.String nodeId, boolean initialLoadEnabled)
           
 void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbc)
           
 void setParameterService(IParameterService parameterService)
           
 void setSql(java.util.Map<java.lang.String,java.lang.String> sql)
           
protected  java.sql.SQLException unwrapSqlException(java.lang.Throwable e)
           
 boolean updateNode(Node node)
           
 boolean updateNodeSecurity(NodeSecurity security)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameterService

protected IParameterService parameterService

jdbcTemplate

protected org.springframework.jdbc.core.JdbcTemplate jdbcTemplate
Constructor Detail

NodeService

public NodeService()
Method Detail

findNode

public Node findNode(java.lang.String id)
Lookup a node in the database, which contains information for syncing with it.

Specified by:
findNode in interface INodeService

findNodeByExternalId

public Node findNodeByExternalId(java.lang.String nodeGroupId,
                                 java.lang.String externalId)
Specified by:
findNodeByExternalId in interface INodeService

ignoreNodeChannelForExternalId

public void ignoreNodeChannelForExternalId(boolean enabled,
                                           java.lang.String channelId,
                                           java.lang.String nodeGroupId,
                                           java.lang.String externalId)
Specified by:
ignoreNodeChannelForExternalId in interface INodeService

isRegistrationEnabled

public boolean isRegistrationEnabled(java.lang.String nodeId)
Specified by:
isRegistrationEnabled in interface INodeService

findNodeSecurity

public NodeSecurity findNodeSecurity(java.lang.String id)
Lookup a node_security in the database, which contains private information used to authenticate.

Specified by:
findNodeSecurity in interface INodeService

findNodeSecurity

public NodeSecurity findNodeSecurity(java.lang.String id,
                                     boolean createIfNotFound)

insertNodeSecurity

public void insertNodeSecurity(java.lang.String id)

updateNode

public boolean updateNode(Node node)
Specified by:
updateNode in interface INodeService

getFirstEntry

protected <T> T getFirstEntry(java.util.List<T> list)

isNodeAuthorized

public boolean isNodeAuthorized(java.lang.String id,
                                java.lang.String password)
Check that the given node and password match in the node_security table. A node must authenticate before it's allowed to sync data.

Specified by:
isNodeAuthorized in interface INodeService

flushNodeAuthorizedCache

public void flushNodeAuthorizedCache()
Specified by:
flushNodeAuthorizedCache in interface INodeService

findIdentity

public Node findIdentity()
Specified by:
findIdentity in interface INodeService

findIdentity

public Node findIdentity(boolean useCache)
Specified by:
findIdentity in interface INodeService

findNodesToPull

public java.util.List<Node> findNodesToPull()
Specified by:
findNodesToPull in interface INodeService

findNodesToPushTo

public java.util.List<Node> findNodesToPushTo()
Specified by:
findNodesToPushTo in interface INodeService

findSourceNodesFor

public java.util.List<Node> findSourceNodesFor(DataEventAction eventAction)
Specified by:
findSourceNodesFor in interface INodeService

findTargetNodesFor

public java.util.List<Node> findTargetNodesFor(DataEventAction eventAction)
Specified by:
findTargetNodesFor in interface INodeService

updateNodeSecurity

public boolean updateNodeSecurity(NodeSecurity security)
Specified by:
updateNodeSecurity in interface INodeService

setInitialLoadEnabled

public boolean setInitialLoadEnabled(java.lang.String nodeId,
                                     boolean initialLoadEnabled)
Specified by:
setInitialLoadEnabled in interface INodeService

generatePassword

public java.lang.String generatePassword()
Generate a secure random password for a node.

Specified by:
generatePassword in interface INodeService

generateNodeId

public java.lang.String generateNodeId(java.lang.String nodeGroupId,
                                       java.lang.String externalId)
Generate the next node ID that is available. Try to use the domain ID as the node ID.

Specified by:
generateNodeId in interface INodeService

isExternalIdRegistered

public boolean isExternalIdRegistered(java.lang.String nodeGroupId,
                                      java.lang.String externalId)
Specified by:
isExternalIdRegistered in interface INodeService

setJdbcTemplate

public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbc)

getSimpleTemplate

protected org.springframework.jdbc.core.simple.SimpleJdbcTemplate getSimpleTemplate()

unwrapSqlException

protected java.sql.SQLException unwrapSqlException(java.lang.Throwable e)

setSql

public void setSql(java.util.Map<java.lang.String,java.lang.String> sql)

getSql

public java.lang.String getSql(java.lang.String key)

setParameterService

public void setParameterService(IParameterService parameterService)


Copyright © 2007-2008. All Rights Reserved.