3.2.4: 2013-12-06

net.sf.basedb.util.uri
Class ConnectionParameters

java.lang.Object
  extended by net.sf.basedb.util.uri.ConnectionParameters

public class ConnectionParameters
extends Object

Connection parameters, such as username/password, that may be needed to connect to a server.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-04-28 12:59:18 +0200 (Thu, 28 Apr 2011) $

Field Summary
private  byte[] clientCertificate
           
private  String clientCertificatePassword
           
private  String factoryId
           
private  String host
           
private  String password
           
private  byte[] serverCertificate
           
private  String username
           
 
Constructor Summary
ConnectionParameters()
          Create a new empty parameters object.
 
Method Summary
 URI changeHost(URI uri)
          If the connection parameters include a specific host:port a new URI is created were the host:port is replaced.
static ConnectionParameters create(FileServerData fileServer)
          Create a parameters object using information from the FileServer object.
 byte[] getClientCertificate()
          Get the client certificate that BASE should use to authenticate with the server when connecting using SSL.
 String getClientCertificatePassword()
          Get the password that is needed to unlock the client certificate.
 String getConnectionManagerFactoryId()
          Get the connection manager factory that we should use to access the file, or null to use auto-detection.
 String getHost()
          Get the host:port that should override the host:port specified by the file URI.
 String getPassword()
          Get the password that should be used to authenticate the user.
 byte[] getServerCertificate()
          Get the public server certificate that indicates that we should only trust the server if it can present a certificate that matches this.
 String getUsername()
          Get the username that should be used to authenticate the user.
 void setClientCertificate(byte[] certificate)
           
 void setClientCertificatePassword(String password)
           
 void setConnectionManagerFactoryId(String factoryId)
           
 void setHost(String host)
           
 void setPassword(String password)
           
 void setServerCertificate(byte[] certificate)
           
 void setUsername(String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factoryId

private String factoryId

host

private String host

username

private String username

password

private String password

serverCertificate

private byte[] serverCertificate

clientCertificate

private byte[] clientCertificate

clientCertificatePassword

private String clientCertificatePassword
Constructor Detail

ConnectionParameters

public ConnectionParameters()
Create a new empty parameters object.

Method Detail

create

public static ConnectionParameters create(FileServerData fileServer)
Create a parameters object using information from the FileServer object.


getConnectionManagerFactoryId

public String getConnectionManagerFactoryId()
Get the connection manager factory that we should use to access the file, or null to use auto-detection.


setConnectionManagerFactoryId

public void setConnectionManagerFactoryId(String factoryId)

getHost

public String getHost()
Get the host:port that should override the host:port specified by the file URI.


setHost

public void setHost(String host)

getUsername

public String getUsername()
Get the username that should be used to authenticate the user.


setUsername

public void setUsername(String username)

getPassword

public String getPassword()
Get the password that should be used to authenticate the user.


setPassword

public void setPassword(String password)

getServerCertificate

public byte[] getServerCertificate()
Get the public server certificate that indicates that we should only trust the server if it can present a certificate that matches this. This property is typically only needed when using SSL to access servers that has a self-signed certificate. Servers which has a certificate signed by a trusted certification authority should be automatically trusted by BASE without this property. The certificate is a X.509 certificate in either binary or base64-encoded DER format.

Returns:
A byte array with the certificate or null if no certificate has been set
See Also:
FileServer.getServerCertificate()

setServerCertificate

public void setServerCertificate(byte[] certificate)

getClientCertificate

public byte[] getClientCertificate()
Get the client certificate that BASE should use to authenticate with the server when connecting using SSL. This property is typically needed when the server requires clients to authenticate themselves using a certificate. The certificate must be a PKCS #12 certificate in binary format, and it should contain only one certificate.

Returns:
A byte array with the certificate or null if no certificate has been set
See Also:
FileServer.getClientCertificate()

setClientCertificate

public void setClientCertificate(byte[] certificate)

getClientCertificatePassword

public String getClientCertificatePassword()
Get the password that is needed to unlock the client certificate.

Returns:
The password (which may be null)

setClientCertificatePassword

public void setClientCertificatePassword(String password)

changeHost

public URI changeHost(URI uri)
If the connection parameters include a specific host:port a new URI is created were the host:port is replaced. Otherwise the original URI is returned unmodified.

Parameters:
uri - The URI to change
Returns:
The new URI

3.2.4: 2013-12-06