Loading kinetic-client/src/main/java/com/seagate/kinetic/admin/impl/DefaultAdminClient.java +1 −49 Original line number Diff line number Diff line Loading @@ -424,55 +424,7 @@ public class DefaultAdminClient implements KineticAdminClient { } //@Override public void _setup(byte[] pin, byte[] setPin, long newClusterVersion, boolean secureErase) throws KineticException { KineticMessage km = MessageFactory.createKineticMessageWithBuilder(); Command.Builder commandBuilder = (Command.Builder) km.getCommand(); Setup.Builder setup = commandBuilder.getBodyBuilder() .getSetupBuilder(); // // if (pin != null && pin.length > 0) { // setup.setPin(ByteString.copyFrom(pin)); // } // // if (setPin != null && setPin.length > 0) { // setup.setSetPin(ByteString.copyFrom(setPin)); // } // // setup.setInstantSecureErase(secureErase); if (0 > newClusterVersion) { throw new KineticException( "Parameter invalid: new cluster version less than 0."); } setup.setNewClusterVersion(newClusterVersion); KineticMessage kmresp = configureSetupPolicy(km); if (kmresp.getCommand().getHeader().getMessageType() != MessageType.SETUP_RESPONSE) { throw new KineticException("received wrong message type."); } if (kmresp.getCommand().getStatus().getCode() == Status.StatusCode.NOT_AUTHORIZED) { throw new KineticException("Authorized Exception: " + kmresp.getCommand().getStatus().getCode() + ": " + kmresp.getCommand().getStatus().getStatusMessage()); } if (kmresp.getCommand().getStatus().getCode() != Status.StatusCode.SUCCESS) { throw new KineticException("Unknown Error: " + kmresp.getCommand().getStatus().getCode() + ": " + kmresp.getCommand().getStatus().getStatusMessage()); } } @Override public void setClusterVersion (long newClusterVersion) throws KineticException { KineticMessage km = MessageFactory.createKineticMessageWithBuilder(); Loading kinetic-client/src/main/java/kinetic/admin/KineticAdminClient.java +9 −1 Original line number Diff line number Diff line Loading @@ -179,6 +179,14 @@ public interface KineticAdminClient { */ public void instantErase(byte[] pin) throws KineticException; /** * Set cluster version with the specified version. * * @param newClusterVersion * @throws KineticException */ public void setClusterVersion (long newClusterVersion) throws KineticException; /** * Close the connection and release all resources allocated by this * instance. Loading kinetic-simulator/src/main/java/com/seagate/kinetic/simulator/internal/PinOperationHandler.java +7 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import com.seagate.kinetic.proto.Kinetic.Command.PinOperation.PinOpType; import com.seagate.kinetic.proto.Kinetic.Command.MessageType; import com.seagate.kinetic.proto.Kinetic.Command.Setup; import com.seagate.kinetic.proto.Kinetic.Command.Status.StatusCode; import com.seagate.kinetic.proto.Kinetic.Message.AuthType; import com.seagate.kinetic.proto.Kinetic.Message; import com.seagate.kinetic.simulator.persist.Store; /** Loading @@ -51,6 +53,10 @@ public abstract class PinOperationHandler { // remove set up in if erase db boolean removeSetup = false; Message.Builder messageBuilder = (Message.Builder) respond.getMessage(); // set pin auth messageBuilder.setAuthType(AuthType.PINAUTH); Command.Builder commandBuilder = (Command.Builder) respond.getCommand(); // set reply type Loading kinetic-simulator/src/main/java/com/seagate/kinetic/simulator/internal/SimulatorEngine.java +9 −9 Original line number Diff line number Diff line Loading @@ -102,8 +102,6 @@ public class SimulatorEngine implements MessageService { private Long clusterVersion = null; private byte[] pin = null; private final boolean isHttp = Boolean.getBoolean("kinetic.io.http"); private final boolean isHttps = Boolean.getBoolean("kinetic.io.https"); Loading Loading @@ -204,7 +202,7 @@ public class SimulatorEngine implements MessageService { } SetupInfo setupInfo = SetupHandler.loadSetup(kineticHome); clusterVersion = setupInfo.getClusterVersion(); pin = setupInfo.getPin(); //pin = setupInfo.getPin(); // initialize db store this.initStore(); Loading Loading @@ -470,7 +468,7 @@ public class SimulatorEngine implements MessageService { kmresp, store, kineticHome); if (setupInfo != null) { this.clusterVersion = setupInfo.getClusterVersion(); this.pin = setupInfo.getPin(); //this.pin = setupInfo.getPin(); } } } else if (kmreq.getCommand().getBody().hasGetLog()) { Loading Loading @@ -512,11 +510,13 @@ public class SimulatorEngine implements MessageService { // get command byte[] byte[] commandByte = commandByteString.toByteArray(); // require Hmac calculation ? if (key != null) { //calculate hmac ByteString hmac = Hmac.calc(commandByte, key); //set hmac messageBuilder.getHmacAuthBuilder().setHmac(hmac); } // set identity messageBuilder.getHmacAuthBuilder().setIdentity(userId); Loading Loading
kinetic-client/src/main/java/com/seagate/kinetic/admin/impl/DefaultAdminClient.java +1 −49 Original line number Diff line number Diff line Loading @@ -424,55 +424,7 @@ public class DefaultAdminClient implements KineticAdminClient { } //@Override public void _setup(byte[] pin, byte[] setPin, long newClusterVersion, boolean secureErase) throws KineticException { KineticMessage km = MessageFactory.createKineticMessageWithBuilder(); Command.Builder commandBuilder = (Command.Builder) km.getCommand(); Setup.Builder setup = commandBuilder.getBodyBuilder() .getSetupBuilder(); // // if (pin != null && pin.length > 0) { // setup.setPin(ByteString.copyFrom(pin)); // } // // if (setPin != null && setPin.length > 0) { // setup.setSetPin(ByteString.copyFrom(setPin)); // } // // setup.setInstantSecureErase(secureErase); if (0 > newClusterVersion) { throw new KineticException( "Parameter invalid: new cluster version less than 0."); } setup.setNewClusterVersion(newClusterVersion); KineticMessage kmresp = configureSetupPolicy(km); if (kmresp.getCommand().getHeader().getMessageType() != MessageType.SETUP_RESPONSE) { throw new KineticException("received wrong message type."); } if (kmresp.getCommand().getStatus().getCode() == Status.StatusCode.NOT_AUTHORIZED) { throw new KineticException("Authorized Exception: " + kmresp.getCommand().getStatus().getCode() + ": " + kmresp.getCommand().getStatus().getStatusMessage()); } if (kmresp.getCommand().getStatus().getCode() != Status.StatusCode.SUCCESS) { throw new KineticException("Unknown Error: " + kmresp.getCommand().getStatus().getCode() + ": " + kmresp.getCommand().getStatus().getStatusMessage()); } } @Override public void setClusterVersion (long newClusterVersion) throws KineticException { KineticMessage km = MessageFactory.createKineticMessageWithBuilder(); Loading
kinetic-client/src/main/java/kinetic/admin/KineticAdminClient.java +9 −1 Original line number Diff line number Diff line Loading @@ -179,6 +179,14 @@ public interface KineticAdminClient { */ public void instantErase(byte[] pin) throws KineticException; /** * Set cluster version with the specified version. * * @param newClusterVersion * @throws KineticException */ public void setClusterVersion (long newClusterVersion) throws KineticException; /** * Close the connection and release all resources allocated by this * instance. Loading
kinetic-simulator/src/main/java/com/seagate/kinetic/simulator/internal/PinOperationHandler.java +7 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,8 @@ import com.seagate.kinetic.proto.Kinetic.Command.PinOperation.PinOpType; import com.seagate.kinetic.proto.Kinetic.Command.MessageType; import com.seagate.kinetic.proto.Kinetic.Command.Setup; import com.seagate.kinetic.proto.Kinetic.Command.Status.StatusCode; import com.seagate.kinetic.proto.Kinetic.Message.AuthType; import com.seagate.kinetic.proto.Kinetic.Message; import com.seagate.kinetic.simulator.persist.Store; /** Loading @@ -51,6 +53,10 @@ public abstract class PinOperationHandler { // remove set up in if erase db boolean removeSetup = false; Message.Builder messageBuilder = (Message.Builder) respond.getMessage(); // set pin auth messageBuilder.setAuthType(AuthType.PINAUTH); Command.Builder commandBuilder = (Command.Builder) respond.getCommand(); // set reply type Loading
kinetic-simulator/src/main/java/com/seagate/kinetic/simulator/internal/SimulatorEngine.java +9 −9 Original line number Diff line number Diff line Loading @@ -102,8 +102,6 @@ public class SimulatorEngine implements MessageService { private Long clusterVersion = null; private byte[] pin = null; private final boolean isHttp = Boolean.getBoolean("kinetic.io.http"); private final boolean isHttps = Boolean.getBoolean("kinetic.io.https"); Loading Loading @@ -204,7 +202,7 @@ public class SimulatorEngine implements MessageService { } SetupInfo setupInfo = SetupHandler.loadSetup(kineticHome); clusterVersion = setupInfo.getClusterVersion(); pin = setupInfo.getPin(); //pin = setupInfo.getPin(); // initialize db store this.initStore(); Loading Loading @@ -470,7 +468,7 @@ public class SimulatorEngine implements MessageService { kmresp, store, kineticHome); if (setupInfo != null) { this.clusterVersion = setupInfo.getClusterVersion(); this.pin = setupInfo.getPin(); //this.pin = setupInfo.getPin(); } } } else if (kmreq.getCommand().getBody().hasGetLog()) { Loading Loading @@ -512,11 +510,13 @@ public class SimulatorEngine implements MessageService { // get command byte[] byte[] commandByte = commandByteString.toByteArray(); // require Hmac calculation ? if (key != null) { //calculate hmac ByteString hmac = Hmac.calc(commandByte, key); //set hmac messageBuilder.getHmacAuthBuilder().setHmac(hmac); } // set identity messageBuilder.getHmacAuthBuilder().setIdentity(userId); Loading