Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0000751: Add new extension point called INodeIdCreator that replaces …
…INodeIdGenerator and gets the remote address and host passed to it
- Loading branch information
Showing
12 changed files
with
143 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
symmetric-core/src/main/java/org/jumpmind/symmetric/config/INodeIdCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jumpmind.symmetric.config; | ||
|
||
import org.jumpmind.extension.IExtensionPoint; | ||
import org.jumpmind.symmetric.model.Node; | ||
import org.jumpmind.symmetric.util.DefaultNodeIdCreator; | ||
|
||
/** | ||
* An {@link IExtensionPoint} that allows SymmetricDS users to implement their | ||
* own algorithms for how node_ids and passwords are generated or selected | ||
* during registration. There may be only one node creator per SymmetricDS instance. | ||
* </p> | ||
* The default implementation of this is the {@link DefaultNodeIdCreator} | ||
*/ | ||
public interface INodeIdCreator extends IExtensionPoint { | ||
|
||
/** | ||
* Based on the node parameters passed in generate an expected node id. This | ||
* is used in an attempt to match a registration request with an open registration. | ||
*/ | ||
public String selectNodeId(Node node, String remoteHost, String remoteAddress); | ||
|
||
/** | ||
* Based on the node parameters passed in generate a brand new node id. | ||
*/ | ||
public String generateNodeId(Node node, String remoteHost, String remoteAddress); | ||
|
||
/** | ||
* Generate a password to use when opening registration | ||
*/ | ||
public String generatePassword(Node node); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
symmetric-core/src/main/java/org/jumpmind/symmetric/config/NodeIdCreatorAdaptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jumpmind.symmetric.config; | ||
|
||
import org.jumpmind.symmetric.model.Node; | ||
import org.jumpmind.symmetric.service.INodeService; | ||
|
||
public class NodeIdCreatorAdaptor implements INodeIdCreator { | ||
|
||
private INodeService nodeService; | ||
private INodeIdGenerator nodeIdGenerator; | ||
|
||
public NodeIdCreatorAdaptor(INodeIdGenerator generator, INodeService nodeService) { | ||
this.nodeIdGenerator = generator; | ||
this.nodeService = nodeService; | ||
} | ||
|
||
public String selectNodeId(Node node, String remoteHost, String remoteAddress) { | ||
return nodeIdGenerator.selectNodeId(nodeService, node); | ||
} | ||
|
||
public String generateNodeId(Node node, String remoteHost, String remoteAddress) { | ||
return nodeIdGenerator.generateNodeId(nodeService, node); | ||
} | ||
|
||
public String generatePassword(Node node) { | ||
return nodeIdGenerator.generatePassword(nodeService, node); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.