Package com.mku.win.salmon.sequencer
Class WinClientSequencer
- java.lang.Object
-
- com.mku.win.salmon.sequencer.WinClientSequencer
-
- All Implemented Interfaces:
INonceSequencer,java.io.Closeable,java.lang.AutoCloseable
public class WinClientSequencer extends java.lang.Object implements INonceSequencer, java.io.Closeable
Nonce sequencer for use with the salmon windows service.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWinClientSequencer.RequestTypeRequest type.
-
Constructor Summary
Constructors Constructor Description WinClientSequencer(java.lang.String pipeName)Instanticate a sequencer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the sequencer.voidcreateSequence(java.lang.String driveId, java.lang.String authId)Create a sequence.NonceSequencegetSequence(java.lang.String driveId)Get a sequence by drive ID.voidinitializeSequence(java.lang.String driveId, java.lang.String authId, byte[] startNonce, byte[] maxNonce)Initialize the sequence.static booleanisServiceAdmin(java.lang.String pipeName)Check if this is a service running as local admin.byte[]nextNonce(java.lang.String driveId)Get the next noncevoidrevokeSequence(java.lang.String driveId)Revoke a sequence by drive ID.voidsetMaxNonce(java.lang.String driveId, java.lang.String authId, byte[] maxNonce)Set the max nonce this sequence can produce.
-
-
-
Method Detail
-
isServiceAdmin
public static boolean isServiceAdmin(java.lang.String pipeName)
Check if this is a service running as local admin.- Parameters:
pipeName- The pipe name.- Returns:
- True if running as local admin.
-
createSequence
public void createSequence(java.lang.String driveId, java.lang.String authId)Create a sequence.- Specified by:
createSequencein interfaceINonceSequencer- Parameters:
driveId- The drive ID.authId- The authorization ID of the drive.
-
getSequence
public NonceSequence getSequence(java.lang.String driveId)
Get a sequence by drive ID.- Specified by:
getSequencein interfaceINonceSequencer- Parameters:
driveId- The drive ID.- Returns:
- The sequence.
-
initializeSequence
public void initializeSequence(java.lang.String driveId, java.lang.String authId, byte[] startNonce, byte[] maxNonce)Initialize the sequence.- Specified by:
initializeSequencein interfaceINonceSequencer- Parameters:
driveId- The drive ID.authId- The auth ID of the device for the drive.startNonce- The starting nonce.maxNonce- The maximum nonce.
-
nextNonce
public byte[] nextNonce(java.lang.String driveId)
Get the next nonce- Specified by:
nextNoncein interfaceINonceSequencer- Parameters:
driveId- The drive ID.- Returns:
- The byte array with the next nonce.
-
revokeSequence
public void revokeSequence(java.lang.String driveId)
Revoke a sequence by drive ID.- Specified by:
revokeSequencein interfaceINonceSequencer- Parameters:
driveId- The drive Id
-
setMaxNonce
public void setMaxNonce(java.lang.String driveId, java.lang.String authId, byte[] maxNonce) throws java.io.IOExceptionSet the max nonce this sequence can produce.- Specified by:
setMaxNoncein interfaceINonceSequencer- Parameters:
driveId- The drive ID.authId- The auth ID of the device for the drive.maxNonce- The maximum nonce.- Throws:
java.io.IOException- If there was a problem with the sequencer.
-
close
public void close()
Close the sequencer.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceINonceSequencer
-
-