Class 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.
    • 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
      void close()
      Close the sequencer.
      void createSequence​(java.lang.String driveId, java.lang.String authId)
      Create a sequence.
      NonceSequence getSequence​(java.lang.String driveId)
      Get a sequence by drive ID.
      void initializeSequence​(java.lang.String driveId, java.lang.String authId, byte[] startNonce, byte[] maxNonce)
      Initialize the sequence.
      static boolean isServiceAdmin​(java.lang.String pipeName)
      Check if this is a service running as local admin.
      byte[] nextNonce​(java.lang.String driveId)
      Get the next nonce
      void revokeSequence​(java.lang.String driveId)
      Revoke a sequence by drive ID.
      void setMaxNonce​(java.lang.String driveId, java.lang.String authId, byte[] maxNonce)
      Set the max nonce this sequence can produce.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WinClientSequencer

        public WinClientSequencer​(java.lang.String pipeName)
                           throws java.lang.Exception
        Instanticate a sequencer.
        Parameters:
        pipeName - The name of the pipe to use see Salmon WinService.
        Throws:
        java.lang.Exception - If there is a problem with accessing the pipe.
    • 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:
        createSequence in interface INonceSequencer
        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:
        getSequence in interface INonceSequencer
        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:
        initializeSequence in interface INonceSequencer
        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:
        nextNonce in interface INonceSequencer
        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:
        revokeSequence in interface INonceSequencer
        Parameters:
        driveId - The drive Id
      • setMaxNonce

        public void setMaxNonce​(java.lang.String driveId,
                                java.lang.String authId,
                                byte[] maxNonce)
                         throws java.io.IOException
        Set the max nonce this sequence can produce.
        Specified by:
        setMaxNonce in interface INonceSequencer
        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:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface INonceSequencer