com.cloudtran.replicator.link
Class AbstractLinkInitializer

java.lang.Object
  extended by com.cloudtran.replicator.link.AbstractLinkInitializer
All Implemented Interfaces:
LinkInitializer
Direct Known Subclasses:
LoopbackInitializer

public abstract class AbstractLinkInitializer
extends Object
implements LinkInitializer

Abstract implementation of LinkInitializer. This implements the initialize( isServer, String[] ) method and then calls the initialize( InetAddress[] ) method.


Constructor Summary
AbstractLinkInitializer()
           
 
Method Summary
 List<LinkProvider> initialize(boolean thisEndIsServer, String remoteDataCenterName, int port, String[] remoteAddressStrings)
          Given an array of addressStrings, create a Link for each string, and return the array of Links.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.cloudtran.replicator.link.LinkInitializer
initialize
 

Constructor Detail

AbstractLinkInitializer

public AbstractLinkInitializer()
Method Detail

initialize

public List<LinkProvider> initialize(boolean thisEndIsServer,
                                     String remoteDataCenterName,
                                     int port,
                                     String[] remoteAddressStrings)
Description copied from interface: LinkInitializer
Given an array of addressStrings, create a Link for each string, and return the array of Links.

The Links returned must implement the chosen protocol for the LinkProvider.

Normally, user implementations of LinkInitializer can extend {link AbstractLinkInitializer} and use its implementation of this method, leaving only the InetSocketAddress version of this initialize() to be implemented.

Specified by:
initialize in interface LinkInitializer
Parameters:
thisEndIsServer - tells the mode for this connection. thisEndIsServer means, set up a server connection on this link. Otherwise, set up a client connection.
remoteDataCenterName - the name of the remote data center, which appears in the config property after "ct.replicator.in/outbound.". For example, "ct.replicator.inbound.East=..." turns into remoteDataCenterName="East".
port - The port number to listen on (for server connections) or to connect to (for client connections).
remoteAddressStrings - the list of IP (w.x.y.z) or hostname (myserver.mycorp.com) addresses from the config string for the link, broken apart by commas (',') and trimmed (leading and trailing whitespace removed).
Returns:
This method should return if the links can be configured; otherwise, it should not proceed - it should exit the main process.