public class FileServer extends CommonItem
File
should be associated with a file
server if authentication is required to access the file.Modifier and Type | Field and Description |
---|---|
static int |
FINGERPRINT_LENGTH
The length of the SSH fingerprint that can be stored in the database.
|
static Pattern |
FINGERPRINT_PATTERN
Pattern that matches a SSH fingerprint: 16 pairs of hexadecimal numbers separated with colon.
|
static int |
MAX_CERTIFICATE_LENGTH
The maximum length of the server certificate that can be stored in the database.
|
static int |
MAX_CONNECTION_MANAGER_FACTORY_LENGTH
The maximum length of the connection manager factory id that can be stored in
the database.
|
static int |
MAX_HOST_LENGTH
The maximum length of the host name:port that can be stored in
the database.
|
static int |
MAX_PASSWORD_LENGTH
The maximum length of the password that can be stored in the database.
|
static int |
MAX_ROOT_PATH_LENGTH
The maximum length of the root path that can be stored in the database.
|
static int |
MAX_USERNAME_LENGTH
The maximum length of the username that can be stored in the database.
|
static Item |
TYPE
The type of item represented by this class.
|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
Constructor and Description |
---|
FileServer(FileServerData data) |
Modifier and Type | Method and Description |
---|---|
static FileServer |
getById(DbControl dc,
int id)
Get a
FileServer item when you know the ID. |
byte[] |
getClientCertificate()
Get the client certificate that BASE should use to authenticate with the server
when connecting with https.
|
String |
getClientCertificatePassword()
Get the password that is needed to unlock the client
certificate.
|
X509Certificate |
getClientX509Certificate()
Get the X.509 certificate for the client.
|
String |
getConnectionManagerFactoryId()
Get the ID of the connection manager factory that should be
used to access file contents and metadata.
|
(package private) FileServerData |
getData()
Get the
BasicData object that holds all data for this item. |
ItemQuery<File> |
getFiles()
Get a query returning all files that has been registered with this
server.
|
String |
getHost()
Get the name:port of the host that should override the host:port
in the file url for files using this file server.
|
static FileServer |
getNew(DbControl dc)
Create a new
FileServer item. |
String |
getPassword()
Get the password that is used when authenticating with the file
server.
|
static ItemQuery<FileServer> |
getQuery()
Get a new query object for this class.
|
String |
getRootPath() |
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.
|
X509Certificate |
getServerX509Certificate()
Get the X.509 certificate for the server.
|
String |
getSshFingerprint() |
org.apache.http.conn.ssl.SSLConnectionSocketFactory |
getSSLSocketFactory2()
Get a socket factory that can be used to create SSL connections to the given
server.
|
Item |
getType()
Get the type of item represented by the object.
|
String |
getUsername()
Get the username that is required to authenticate with the file
server.
|
Set<ItemProxy> |
getUsingItems()
Get all files registered with this server.
|
boolean |
hasPassword()
Is a password set or not?
|
boolean |
isUsed()
Checks if there are files registered with this server.
|
void |
setClientCertificate(byte[] certificate)
Set the client certificate that BASE should use to authenticate with the server
when connecting with https.
|
void |
setClientCertificatePassword(String password)
Set the password that is needed to unlock the client
certificate.
|
void |
setConnectionManagerFactoryId(String factoryId)
Set the ID of the connection manager factory.
|
void |
setHost(String host)
Set the host:port that should overrride the host:port
specified in file urls.
|
void |
setPassword(String password)
Set the password to use when authenticating with the file server.
|
void |
setRootPath(String rootPath)
Set the root path that should be added to all URI:s when used with this file
server.
|
void |
setServerCertificate(byte[] certificate)
Set the public server certificate so that BASE can trust https connections to
the server.
|
void |
setSshFingerprint(String fingerprint)
Set the SSH fingerprint for the server.
|
void |
setUsername(String username)
Set the username that is required to authenticate with the file
server.
|
getDescription, getName, getRemovedBy, isRemoved, setDescription, setName, setRemoved
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey
getOwner, isOwner, setOwner, takeOwnership
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId, getVersion
checkPermission, getPermissions, hasPermission
getOwner, isOwner, setOwner, takeOwnership
public static final Item TYPE
Item.FILESERVER
,
getType()
public static final Pattern FINGERPRINT_PATTERN
public static final int MAX_CONNECTION_MANAGER_FACTORY_LENGTH
public static final int MAX_HOST_LENGTH
setHost(String)
,
Constant Field Valuespublic static final int MAX_USERNAME_LENGTH
setUsername(String)
,
Constant Field Valuespublic static final int MAX_PASSWORD_LENGTH
setPassword(String)
,
Constant Field Valuespublic static final int MAX_ROOT_PATH_LENGTH
setRootPath(String)
,
Constant Field Valuespublic static final int FINGERPRINT_LENGTH
setSshFingerprint(String)
,
Constant Field Valuespublic static final int MAX_CERTIFICATE_LENGTH
FileServer(FileServerData data)
public static FileServer getNew(DbControl dc) throws BaseException
FileServer
item.dc
- The DbControl
which will be used for
permission checking and database accessFileServer
itemBaseException
- If there is an errorpublic static FileServer getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
FileServer
item when you know the ID.dc
- The DbControl
which will be used for
permission checking and database access.id
- The ID of the item to loadFileServer
itemItemNotFoundException
- If an item with the specified
ID is not foundPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permission to the itemBaseException
- If there is another errorpublic static ItemQuery<FileServer> getQuery()
ItemQuery
objectFileServerData getData()
BasicItem
BasicData
object that holds all data for this item.getData
in class CommonItem
public Item getType()
Identifiable
Item
enumeration.public boolean isUsed() throws BaseException
isUsed
in class BasicItem
BaseException
- If there is another errorBasicItem.getUsingItems()
public Set<ItemProxy> getUsingItems()
getUsingItems
in class BasicItem
BasicItem.addUsingItems(Set, Item, org.hibernate.Query)
public String getConnectionManagerFactoryId()
public void setConnectionManagerFactoryId(String factoryId) throws PermissionDeniedException, InvalidDataException
factoryId
- The new ID of the factory, null if using auto-detectionPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the ID is longer than MAX_CONNECTION_MANAGER_FACTORY_LENGTH
public String getHost()
public void setHost(String host) throws PermissionDeniedException, InvalidDataException
host
- The host:port or null to not overridePermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the host is longer than MAX_HOST_LENGTH
or
is an invalid host name + portpublic String getUsername()
public void setUsername(String username) throws PermissionDeniedException, InvalidDataException
username
- The new username, null if not authentication is requiredPermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the username is longer than MAX_USERNAME_LENGTH
public String getPassword()
hasPassword()
public boolean hasPassword()
public void setPassword(String password) throws PermissionDeniedException, InvalidDataException
password
- The new password (can be null)PermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the password is longer than MAX_PASSWORD_LENGTH
public byte[] getServerCertificate()
getServerX509Certificate()
public void setServerCertificate(byte[] certificate)
getServerCertificate()
for more information. The certificate
must be a X.509 certificate in either binary or base64-encoded DER format.certificate
- The server certificate or null if no certificate is requiredpublic X509Certificate getServerX509Certificate()
public byte[] getClientCertificate()
getClientX509Certificate()
to get
the public information from the certificate.getClientX509Certificate()
public void setClientCertificate(byte[] certificate)
certificate
- The client certificate or null if no certificate is requiredpublic X509Certificate getClientX509Certificate()
public String getClientCertificatePassword()
public void setClientCertificatePassword(String password) throws PermissionDeniedException, InvalidDataException
password
- The new password (can be null)PermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the password is longer than MAX_PASSWORD_LENGTH
public String getRootPath()
setRootPath(String)
public void setRootPath(String rootPath)
rootPath
- The root path or null to not use any root pathpublic String getSshFingerprint()
setSshFingerprint(String)
public void setSshFingerprint(String fingerprint)
fingerprint
- The fingerprint or null to not use fingerprintpublic org.apache.http.conn.ssl.SSLConnectionSocketFactory getSSLSocketFactory2()