Class RegistrationService
java.lang.Object
org.jumpmind.symmetric.service.impl.AbstractService
org.jumpmind.symmetric.service.impl.RegistrationService
- All Implemented Interfaces:
IRegistrationService
,IService
- See Also:
-
Field Summary
Fields inherited from class org.jumpmind.symmetric.service.impl.AbstractService
log, parameterService, platform, sqlTemplate, sqlTemplateDirty, symmetricDialect, tablePrefix
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
attemptToRegisterWithServer
(int maxNumberOfAttempts) Client method which attempts to register with the registration.url to pull configuration if the node has not already been registered.protected boolean
checkRegistrationSuccessful
(boolean registered, int maxNumberOfAttempts) boolean
protected void
extractConfiguration
(OutputStream out, Node registeredNode) getRedirectionUrlFor
(String externalId) getRegistrationRequests
(boolean includeNodesWithOpenRegistrations, boolean includeRejects) boolean
boolean
boolean
boolean
isRegistrationOpen
(String nodeGroupId, String externalId) boolean
loadRegistrationBatch
(Node node, InputStream is, OutputStream os) When server pushes to client asking to register it, the client loads the configuration batch and returns an acknowledgementvoid
markNodeAsRegistered
(String nodeId) Mark the passed in node as registered in node_securityprotected void
markNodeAsRegistrationPending
(String nodeId) openRegistration
(String nodeGroup, String externalId) Open registration for a single new node given a node group (f.e., "STORE") and external ID (f.e., "00001").openRegistration
(String nodeGroup, String externalId, String remoteHost, String remoteAddress) openRegistration
(String nodeGroup, String externalId, String syncUrl, Date notBefore, Date notAfter) openRegistration
(Node node) protected String
protected Node
processRegistration
(Node nodePriorToRegistration, String remoteHost, String remoteAddress, String userId, String password, boolean isRequestedRegistration) boolean
registerNode
(Node preRegisteredNode, OutputStream out, boolean isRequestedRegistration) Register a node for the given group name and external id if the registration is open.boolean
registerNode
(Node nodePriorToRegistration, String remoteHost, String remoteAddress, OutputStream out, String userId, String password, boolean isRequestedRegistration) Register a node for the given group name and external id if the registration is open.registerPullOnlyNode
(String externalId, String nodeGroupId, String databaseType, String databaseVersion, String databaseName) Register a "Pull Only" node.registerWithClient
(Node remote, IOutgoingWithResponseTransport transport) Server method which attempts to register using the registration URL of a client node using a push to send configuration.boolean
Client method which attempts to register with the registration.url to pull configuration if the node has not already been registered.void
reOpenRegistration
(String nodeId) Re-open registration for a single node that already exists in the database.void
reOpenRegistration
(String nodeId, boolean forceNewPassword) protected void
reOpenRegistration
(String nodeId, String remoteHost, String remoteAddress, Date notBefore, Date notAfter, boolean forceNewPassword) void
void
saveRegistrationRedirect
(String externalIdToRedirect, String nodeIdToRedirectTo) Add an entry to the registation_redirect table so that if a node tries to register here.void
void
setAllowClientRegistration
(boolean enabled) boolean
When server pushes to client asking to register it, the client responds with its registration request propertiesMethods inherited from class org.jumpmind.symmetric.service.impl.AbstractService
assertNotNull, buildBatchOrderBy, buildBatchParams, buildBatchWhere, buildBatchWhereFromFilter, close, createSqlReplacementTokens, getJdbcTemplate, getParameterService, getSql, getSymmetricDialect, getTablePrefix, getTargetDialect, getTargetPlatform, getTargetPlatform, isCalledFromSymmetricAdminTool, isSet, isStreamClosedByClient, isSymmetricTable, logOnce, maxDate, readAcks, sendAck, setSqlMap, synchronize, toNodeIds, toNodeIds
-
Constructor Details
-
RegistrationService
-
-
Method Details
-
registerPullOnlyNode
public Node registerPullOnlyNode(String externalId, String nodeGroupId, String databaseType, String databaseVersion, String databaseName) throws IOException Description copied from interface:IRegistrationService
Register a "Pull Only" node. This type of node has no Symmetric configuration and can only be used to PULL data from another node. It can never track changes or push data to other nodes. When a node of this type is registered, it must complete all symmetric client functionality by itself including issue the pull, acknowledging batches, etc.- Specified by:
registerPullOnlyNode
in interfaceIRegistrationService
- Throws:
IOException
-
registerNode
public boolean registerNode(Node preRegisteredNode, OutputStream out, boolean isRequestedRegistration) throws IOException Description copied from interface:IRegistrationService
Register a node for the given group name and external id if the registration is open.- Specified by:
registerNode
in interfaceIRegistrationService
isRequestedRegistration
- An indicator that registration has been requested by the remote client- Throws:
IOException
-
extractConfiguration
-
processRegistration
protected Node processRegistration(Node nodePriorToRegistration, String remoteHost, String remoteAddress, String userId, String password, boolean isRequestedRegistration) throws IOException - Throws:
IOException
-
registerNode
public boolean registerNode(Node nodePriorToRegistration, String remoteHost, String remoteAddress, OutputStream out, String userId, String password, boolean isRequestedRegistration) throws IOException Description copied from interface:IRegistrationService
Register a node for the given group name and external id if the registration is open.- Specified by:
registerNode
in interfaceIRegistrationService
isRequestedRegistration
- An indicator that registration has been requested by the remote client- Throws:
IOException
- See Also:
-
getRegistrationRequests
public List<RegistrationRequest> getRegistrationRequests(boolean includeNodesWithOpenRegistrations, boolean includeRejects) - Specified by:
getRegistrationRequests
in interfaceIRegistrationService
-
deleteRegistrationRequest
- Specified by:
deleteRegistrationRequest
in interfaceIRegistrationService
-
saveRegistrationRequest
- Specified by:
saveRegistrationRequest
in interfaceIRegistrationService
-
getRedirectionUrlFor
- Specified by:
getRedirectionUrlFor
in interfaceIRegistrationService
-
saveRegistrationRedirect
Description copied from interface:IRegistrationService
Add an entry to the registation_redirect table so that if a node tries to register here. It will be redirected to the correct node.- Specified by:
saveRegistrationRedirect
in interfaceIRegistrationService
-
markNodeAsRegistered
Description copied from interface:IRegistrationService
Mark the passed in node as registered in node_security- Specified by:
markNodeAsRegistered
in interfaceIRegistrationService
- Parameters:
nodeId
- is the node that has just finished 'successfully' registering- See Also:
-
IRegistrationService#markNodeAsRegistered(Node)
-
markNodeAsRegistrationPending
-
isRegisteredWithServer
public boolean isRegisteredWithServer()- Specified by:
isRegisteredWithServer
in interfaceIRegistrationService
-
registerWithServer
public boolean registerWithServer()Description copied from interface:IRegistrationService
Client method which attempts to register with the registration.url to pull configuration if the node has not already been registered. If the registration server cannot be reach this method will continue to try with random sleep periods up to one minute up until the registration succeeds or the maximum number of attempts has been reached. Returns true if we had to register with server and was successful. Returns false if we did not have to register.- Specified by:
registerWithServer
in interfaceIRegistrationService
- See Also:
-
attemptToRegisterWithServer
public boolean attemptToRegisterWithServer(int maxNumberOfAttempts) Description copied from interface:IRegistrationService
Client method which attempts to register with the registration.url to pull configuration if the node has not already been registered. Returns true if registered successfully- Specified by:
attemptToRegisterWithServer
in interfaceIRegistrationService
-
checkRegistrationSuccessful
protected boolean checkRegistrationSuccessful(boolean registered, int maxNumberOfAttempts) -
registerWithClient
public List<OutgoingBatch> registerWithClient(Node remote, IOutgoingWithResponseTransport transport) Description copied from interface:IRegistrationService
Server method which attempts to register using the registration URL of a client node using a push to send configuration. Returns configuration batch sent with its status.- Specified by:
registerWithClient
in interfaceIRegistrationService
-
writeRegistrationProperties
Description copied from interface:IRegistrationService
When server pushes to client asking to register it, the client responds with its registration request properties- Specified by:
writeRegistrationProperties
in interfaceIRegistrationService
-
loadRegistrationBatch
Description copied from interface:IRegistrationService
When server pushes to client asking to register it, the client loads the configuration batch and returns an acknowledgement- Specified by:
loadRegistrationBatch
in interfaceIRegistrationService
-
reOpenRegistration
Description copied from interface:IRegistrationService
Re-open registration for a single node that already exists in the database. A new password is generated and the registration_enabled flag is turned on. The next node to try registering for this node group and external ID will be given this information.- Specified by:
reOpenRegistration
in interfaceIRegistrationService
- See Also:
-
reOpenRegistration
- Specified by:
reOpenRegistration
in interfaceIRegistrationService
-
reOpenRegistration
-
openRegistration
Description copied from interface:IRegistrationService
Open registration for a single new node given a node group (f.e., "STORE") and external ID (f.e., "00001"). The unique node ID and password are generated and stored in the node and node_security tables with the registration_enabled flag turned on. The next node to try registering for this node group and external ID will be given this information.- Specified by:
openRegistration
in interfaceIRegistrationService
- Returns:
- The nodeId of the registered node
- See Also:
-
openRegistration
public String openRegistration(String nodeGroup, String externalId, String syncUrl, Date notBefore, Date notAfter) - Specified by:
openRegistration
in interfaceIRegistrationService
-
openRegistration
public String openRegistration(String nodeGroup, String externalId, String remoteHost, String remoteAddress) - Specified by:
openRegistration
in interfaceIRegistrationService
-
openRegistration
- Specified by:
openRegistration
in interfaceIRegistrationService
-
openRegistration
-
isAutoRegistration
public boolean isAutoRegistration()- Specified by:
isAutoRegistration
in interfaceIRegistrationService
-
isRegistrationOpen
- Specified by:
isRegistrationOpen
in interfaceIRegistrationService
-
isRegistrationOpen
public boolean isRegistrationOpen()- Specified by:
isRegistrationOpen
in interfaceIRegistrationService
-
requestNodeCopy
public void requestNodeCopy()- Specified by:
requestNodeCopy
in interfaceIRegistrationService
-
setAllowClientRegistration
public void setAllowClientRegistration(boolean enabled) - Specified by:
setAllowClientRegistration
in interfaceIRegistrationService
-