Beispiel #1
0
 /** @param version The version to set. */
 public void setVersion() {
   this.version = ApplicationInfo.getInstance().getReleaseNumber();
 }
 /** @param teiidVersion */
 public void setTeiidVersion(ITeiidServerVersion teiidVersion) {
   this.teiidVersion = teiidVersion;
   ApplicationInfo.getInstance().setTeiidVersion(teiidVersion);
 }
Beispiel #3
0
/** Represents the information needed in a socket connection handshake */
public class Handshake implements Externalizable {

  private static final long serialVersionUID = 7839271224736355515L;

  private String version = ApplicationInfo.getInstance().getReleaseNumber();
  private byte[] publicKey;
  private AuthenticationType authType = AuthenticationType.USERPASSWORD;

  public Handshake() {}

  Handshake(String version) {
    this.version = version;
  }

  /** @return Returns the version. */
  public String getVersion() {
    if (this.version != null) {
      // normalize to allow for more increments
      StringBuilder builder = new StringBuilder();
      List<String> parts = StringUtil.split(this.version, "."); // $NON-NLS-1$
      for (int i = 0; i < parts.size(); i++) {
        if (i > 0) {
          builder.append('.');
        }
        String part = parts.get(i);
        if (part.length() < 2 && Character.isDigit(part.charAt(0))) {
          builder.append('0');
        }
        builder.append(part);
      }
      return builder.toString();
    }
    return this.version;
  }

  /** @param version The version to set. */
  public void setVersion() {
    this.version = ApplicationInfo.getInstance().getReleaseNumber();
  }

  /** @return Returns the key. */
  public byte[] getPublicKey() {
    return this.publicKey;
  }

  /** @param key The key to set. */
  public void setPublicKey(byte[] key) {
    this.publicKey = key;
  }

  public AuthenticationType getAuthType() {
    return authType;
  }

  public void setAuthType(AuthenticationType authType) {
    this.authType = authType;
  }

  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    version = (String) in.readObject();
    publicKey = (byte[]) in.readObject();
    try {
      authType = AuthenticationType.values()[in.readByte()];
    } catch (EOFException e) {

    }
  }

  @Override
  public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(version);
    out.writeObject(publicKey);
    out.writeByte(authType.ordinal());
  }
}