diff options
author | Björn Hagemeister | 2014-10-16 16:21:10 +0200 |
---|---|---|
committer | Björn Hagemeister | 2014-10-16 16:21:10 +0200 |
commit | f10fb29b9668b2a1063d8c947e166a8db9fd5070 (patch) | |
tree | d3ae9c5a58ec54cf9f669c76f79e53fb13e87a33 | |
parent | Implemented --submitkey command line option. (diff) | |
download | satellite-daemon-f10fb29b9668b2a1063d8c947e166a8db9fd5070.tar.gz satellite-daemon-f10fb29b9668b2a1063d8c947e166a8db9fd5070.tar.xz satellite-daemon-f10fb29b9668b2a1063d8c947e166a8db9fd5070.zip |
Implemented --updateAddress command line option.
3 files changed, 51 insertions, 2 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/App.java b/src/main/java/org/openslx/satellitedaemon/App.java index 3a81f56..e6e119a 100644 --- a/src/main/java/org/openslx/satellitedaemon/App.java +++ b/src/main/java/org/openslx/satellitedaemon/App.java @@ -142,8 +142,7 @@ public class App private static boolean updateAddress( String ipAddress ) { - // TODO. - return false; + return Identity.updateAddress( ipAddress ); } private static boolean tryLoadIdentity() diff --git a/src/main/java/org/openslx/satellitedaemon/Identity.java b/src/main/java/org/openslx/satellitedaemon/Identity.java index e95cf99..947d90a 100644 --- a/src/main/java/org/openslx/satellitedaemon/Identity.java +++ b/src/main/java/org/openslx/satellitedaemon/Identity.java @@ -174,6 +174,12 @@ public class Identity return writeIdToFile( organizationName, modulus, privateExp, publicExp ); } + /** + * Submit new satellite - ipAddress to master with organizationId, ipAddress + * and key - information. + * @param ipAddress + * @return true, if successful. + */ public static boolean submitKey( String ipAddress ) { RSAPublicKey pubKey = (RSAPublicKey)getPublicKey(); @@ -191,6 +197,16 @@ public class Identity pubKey.getModulus().toString(), pubKey.getPublicExponent().toString() ); } + + /** + * Update already existing satellite - ipAddress in master - Db. + * @param ipAddress + * @return true, if successful. + */ + public static boolean updateAddress( String ipAddress ) + { + return ThriftConnection.updateSatelliteAddress( ipAddress ); + } /** * Write given organization name, modulus, public and private exponent to diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java index 723da9b..0502768 100644 --- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java +++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java @@ -255,6 +255,11 @@ public class ThriftConnection return newClient; } + /** + * Publish new user to master-server, which insert it to his db. + * @param userInfo + * @return true, if successful. + */ public static boolean publishUser( UserInfo userInfo ) { ImageServer.Client theClient = null; @@ -273,6 +278,15 @@ public class ThriftConnection return false; } + /** + * Register new, by master unknown satellite - server with organizationId, + * ipAddress and key - information. + * @param organizationId + * @param ipAddress + * @param modulus + * @param exponent + * @return true, if successful. + */ public static boolean registerSatellite( String organizationId, String ipAddress, String modulus, String exponent ) { ImageServer.Client theClient = null; @@ -285,4 +299,24 @@ public class ThriftConnection return false; } } + + /** + * Update in master - DB existing satellite - ipAddress. + * @param ipAddress + * @return true, if successful. + */ + public static boolean updateSatelliteAddress(String ipAddress) { + ImageServer.Client theClient = null; + theClient = getConnection(); + if ( theClient == null) { + log.error( "Client was null!" ); + return false; + } + try { + return theClient.updateSatelliteAddress( sSD.sessionId, ipAddress ); + } catch ( TException e ) { + log.error( "TException", e ); + return false; + } + } } |