Class SqlPlatform

java.lang.Object
com.codename1.db.sql.SqlPlatform

public abstract class SqlPlatform extends Object

What the wire clients need from the target they run on: a socket, random bytes, and the exceptions a caller catches.

The backend and an application each install one before the first connection; the wire clients never name either side's classes, which is what lets one copy of them serve both.

  • Constructor Details

    • SqlPlatform

      public SqlPlatform()
  • Method Details

    • install

      public static void install(SqlPlatform platform)
      Makes platform the one every connection opened from now on uses.
    • get

      public static SqlPlatform get()

      The installed platform.

      Throws
      • IllegalStateException: when none is installed, which is a defect in the target, not something a caller recovers from
    • connect

      public abstract SqlSocket connect(String host, int port, int timeoutMillis) throws IOException
      Opens a plain TCP connection.
      Throws:
      IOException
    • randomBytes

      public abstract byte[] randomBytes(int length) throws IOException
      length bytes from a cryptographically secure source.
      Throws:
      IOException
    • concurrencyFailure

      public IOException concurrencyFailure(String message)
      The exception for a transaction that can be run again.
    • integrityViolation

      public IOException integrityViolation(String message)
      The exception for a write a constraint refused.
    • withMessage

      public IOException withMessage(IOException failure, String message)
      failure again with message, keeping what kind of failure it is.
    • pbkdf2

      public byte[] pbkdf2(String digest, byte[] password, byte[] salt, int iterations, int length) throws IOException
      PBKDF2 over HMAC with digest, Hash.SHA256 or Hash.SHA512.
      Throws:
      IOException