Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
# keytool -genkey -alias AliasChallengeResponse -keystore myKey.jceks -keypass "YourPassWord" -storepass "YourPassWord" -storetype JCEKS

 

Currently the alias option from keytool is hard coded and it is used in CryptoUtil class located at: floodlight/src/main/java/org/sdnplatform/sync/internal/util/CryptoUtil.java

...

And as well as start your store with global scope (which means sync syncing remote updates):

Code Block
languagejava
try {
	this.syncService.registerStore("NameOfMyStore", Scope.GLOBAL);
	this.storeFT = this.syncService.getStoreClient("NameOfMyStore",
					String.class,
					String.class);
	this.storeFT.addStoreListener(this);
} catch (SyncException e) {
	throw new FloodlightModuleException("Error while setting up sync service", e);
}

...

Code Block
languagejava
try {
	this.storeFT.get("Key Y").getValue().toString();
} catch (SyncException e) {
	e.printStackTrace();
}

 

 

And finally, if you want monitor your store, it is necessary implement the interface IStoreListener<String>.
In this case our store has the string String type.
In the example below we are just showing the remote sync events.
But you can uncomment the code and see local and remote updates from your sync store.

Code Block
@Override

...


public void keysModified(Iterator<String> keys,

...

 org.sdnplatform.sync.IStoreListener.UpdateType type)

...

 {

	while(keys.hasNext()){

...


		String k = keys.next();

...


		try {

...


			/*
			logger.debug("keysModified: Key:{}, Value:{}, Type: {}",

...

 
					new Object[]

...

 {
							k, 
							storeFT.get(k).getValue().toString(),

...

 
							type.name()

...


						}
					);
			*/
			if(type.name().equals("REMOTE")){

...


				String info = storeFT.get(k).getValue();

...


				logger.debug("REMOTE: Key:{}, Value:{}", k, value);

...


			}
		} catch (SyncException e)

...

 {
			e.printStackTrace();

...


		}
	}
}




Follow the complete code. The code below is part of FT class from simpleFT package.
The class uses an RPCListener to monitor RPC connections among the cluster and inform all synced nodes
from connections and disconnections from nodes.

...