public final class Server
extends java.lang.Object
Server
object allows you to connect to a remote server and administer or work with it.Modifier and Type | Class and Description |
---|---|
static class |
Server.CatalogInfo
This immutable class holds information about a catalog at the server.
|
Modifier and Type | Method and Description |
---|---|
int |
addExistingCatalog(GUID selector,
java.lang.String dbSpec)
Add an existing catalog to the Cumulus server.
|
int |
addNewCatalog(GUID selector,
java.lang.String dbSpec)
Create a new catalog and add it to the Cumulus server.
|
int |
addNewCatalog(GUID selector,
java.lang.String dbSpec,
java.lang.String catalogTemplate)
Create a new catalog from the given template and add it to the Cumulus server.
|
void |
changePassword(java.lang.String oldPassword,
java.lang.String newPassword)
Changes the current user password.
|
static void |
changePassword(java.lang.String server,
java.lang.String user,
java.lang.String oldPassword,
java.lang.String newPassword)
Changes a user password.
|
boolean |
equals(java.lang.Object o)
Compares this server to the specified object.
|
int |
findCatalogID(JPack catalogReference)
Fidn a catalog at the server by providing the catalog reference data and return the catalog ID.
|
int |
findCatalogID(java.lang.String catalogName)
Find a catalog by name at the server.
|
int |
findCatalogIDByLocation(java.lang.String catalogLocation)
Fidn a catalog at the server by providing the catalog location string and return the catalog ID.
|
java.util.List<java.lang.String> |
findCollections(java.lang.String queryString,
java.util.List<SortFieldDescriptor> sortFields,
java.util.Locale locale)
Perform a search on all available collections and return a list of internal collection names.
|
static java.util.Set<java.net.SocketAddress> |
findServer(int timeout)
Return a set of
SocketAddress instances that represent the currently running Cumulus server. |
ItemCollection |
getAllVocabulariesItemCollection()
Returns an
ItemCollection containing all items of the $Vocabulary catalog. |
java.util.Map<java.lang.String,java.lang.String> |
getBaseWebURLs()
Get a list of all configured web publishing URLs for this server.
|
java.util.Set<java.util.Properties.BaseWebURL> |
getBaseWebURLsProperties()
Get a list of all configured web publishing URLs for this server.
|
java.lang.String |
getCatalogDescription(int catalogID,
int languageID)
Return the user readable description for the given catalog.
|
java.lang.String |
getCatalogDisplayName(int catalogID,
int languageID)
Return the user readable display name for the given catalog.
|
java.util.Set<java.lang.Integer> |
getCatalogIDs(boolean sharedOnly,
boolean publishedToInternetOnly)
Get the IDs of all catalogs that are accessible to the current user.
|
Server.CatalogInfo |
getCatalogInfo(int catalogID)
Get Information about a given catalog at the server.
|
Server.CatalogInfo |
getCatalogInfo(int catalogID,
int languageID)
Get Information about a given catalog at the server.
|
java.util.Set<java.lang.String> |
getCollectionNames()
Get the names of all server-side collections.
|
CumulusSession |
getCumulusSession()
Returns the current
CumulusSession object |
java.lang.Object |
getParent()
Returns the parent object of this server.
|
java.lang.String |
getServerAddress()
Returns the address of the machine this
Server is located at. |
int |
getServerVersion()
Returns the product version of this
Server . |
ServerStatistics |
getStatistics()
Get a statistic about the server.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isAlive()
Check whether the server is still active and is processing requests.
|
MultiCategoryItemCollection |
newMultiCategoryItemCollection()
Create a new
MultiCategoryItemCollection for the given table. |
MultiItemCollection |
newMultiItemCollection(java.lang.String tableName)
Create a new
MultiItemCollection for the given table. |
MultiRecordItemCollection |
newMultiRecordItemCollection()
Create a new
MultiRecordItemCollection for the given table. |
ItemCollection |
newStatisticsItemCollection(java.lang.String query,
java.util.Locale locale)
Create a new
ItemCollection and fill it with the items found by the given query. |
Catalog |
openCatalog(int catalogID)
Open a catalog of the server.
|
static Server |
openConnection(boolean bWriteAccess,
java.lang.String server,
java.lang.String user,
java.lang.String password)
Connects to a Cumulus server using the default licensing.
|
static Server |
openConnection(java.lang.String sSerialNumber,
boolean bWriteAccess,
java.lang.String server,
java.lang.String user,
java.lang.String password)
Connects to a Cumulus server using a custom serial number.
|
static Server |
openConnectionAs(boolean bWriteAccess,
java.lang.String server,
java.lang.String userToRunAs,
java.lang.String user,
java.lang.String password)
Connects to a Cumulus server using the default licensing and allows to take the identity of another user.
|
static Server |
openConnectionAs(java.lang.String sSerialNumber,
boolean bWriteAccess,
java.lang.String server,
java.lang.String userToRunAs,
java.lang.String user,
java.lang.String password)
Connects to a Cumulus server using a custom serial number taking identity of a specified user.
|
MultiRecordItemCollection |
openMultiRecordItemCollection(java.lang.String collectionSetName)
Open a server-side collection into a newly created
MultiRecordItemCollection . |
void |
removeCatalog(int catalogID,
int timeout,
java.lang.String message)
Remove a catalog from the Cumulus server.
|
byte[] |
sendServerModuleMessage(java.lang.String module,
byte[] inData)
Sends a message with parameters to a server plug-in module (Administrator only).
|
void |
setSharing(int catalogID,
boolean shared,
boolean publishedToInternet)
Enable or disable sharing this catalog to other users.
|
public static Server openConnection(boolean bWriteAccess, java.lang.String server, java.lang.String user, java.lang.String password) throws LoginFailedException, PasswordExpiredException, ServerNotFoundException, CumulusException
bWriteAccess
the Cumulus server needs a valid runtime serial
number in order to allow connecting: bWriteAccess
= false
).bWriteAccess
= true
).// Connect to server "serverIP", default port as guest (read-only access) Server myServer = Server.openConnection(false, "serverIP", null, null); or // Connect to server "serverIP", port 3245 as user "John" // with password "abcdefg" (read-write access) Server myServer = Server.openConnection(true, "serverIP:3245", "John", "abcdefg");
bWriteAccess
- use true
if you may modify a catalog from this server (read-write access). Use false
otherwise (read-only access).server
- the Cumulus server's address. If you want to deviate from the last TCP port number used, you can add a special server port
number, separated by a colon ":".user
- the user name (use an empty string or null to connect as guest).password
- the user password (use an empty string or null to connect as guest).CumulusException
- if the connection to the server cannot be established.LoginFailedException
- for a invalid combination of user name and passwordPasswordExpiredException
- when the password has expired and need to be changedServerNotFoundException
- when no server is available at the given addresspublic static Server openConnectionAs(boolean bWriteAccess, java.lang.String server, java.lang.String userToRunAs, java.lang.String user, java.lang.String password) throws LoginFailedException, PasswordExpiredException, ServerNotFoundException, CumulusException
bWriteAccess
the Cumulus server needs a valid runtime serial number in order to allow connecting: bWriteAccess
= false
).bWriteAccess
= true
).// Connect to server "serverIP", default port, taking identity of user peter, but authenticating as user mary Server myServer = Server.openConnectionAs (false, "serverIP", "peter", "mary", "mary's password");
bWriteAccess
- use true
if you may modify a catalog from this server (read-write access). Use false
otherwise (read-only access).server
- the Cumulus server's address. If you want to deviate from the last TCP port number used, you can add a special server port
number, separated by a colon ":".userToRunAs
- the user you want to run asuser
- the user name of the user with the permission to run as some other user.password
- the user password.CumulusException
- if the connection to the server cannot be established.LoginFailedException
- for a invalid combination of user name and passwordPasswordExpiredException
- when the password has expired and need to be changedServerNotFoundException
- when no server is available at the given addresspublic static Server openConnection(java.lang.String sSerialNumber, boolean bWriteAccess, java.lang.String server, java.lang.String user, java.lang.String password) throws LoginFailedException, ServerNotFoundException, PasswordExpiredException, CumulusException
openConnection()
method to use the default
runtime serial numbers.sSerialNumber
- the serial number to use for connecting. You can use the standard Cumulus.READ_ONLY_SERIAL_NUMBER
or Cumulus.READ_WRITE_SERIAL_NUMBER
or provide a custom serial number. The Cumulus server needs a valid corresponding serial number to
allow connecting.bWriteAccess
- use true
if you may modify a catalog from this server. Use false
otherwise.server
- the Cumulus server's address. If you want to deviate from the last TCP port number used, you can add a special server port
number, separated by a colon ":".user
- the user name (use an empty string or null to connect as guest).password
- the user password (use an empty string or null to connect as guest).CumulusException
- if the connection to the server cannot be established.LoginFailedException
- for a invalid combination of user name and passwordPasswordExpiredException
- when the password has expired and need to be changedServerNotFoundException
- when no server is available at the given addressopenConnection(boolean, String, String, String)
,
Cumulus.READ_ONLY_SERIAL_NUMBER
,
Cumulus.READ_WRITE_SERIAL_NUMBER
public static Server openConnectionAs(java.lang.String sSerialNumber, boolean bWriteAccess, java.lang.String server, java.lang.String userToRunAs, java.lang.String user, java.lang.String password) throws LoginFailedException, ServerNotFoundException, PasswordExpiredException, CumulusException
openConnection()
method to use the default runtime serial numbers.sSerialNumber
- the serial number to use for connecting. You can use the standard Cumulus.READ_ONLY_SERIAL_NUMBER
or Cumulus.READ_WRITE_SERIAL_NUMBER
or provide a custom serial number. The Cumulus server needs a valid corresponding serial number to
allow connecting.bWriteAccess
- use true
if you may modify a catalog from this server. Use false
otherwise.server
- the Cumulus server's address. If you want to deviate from the last TCP port number used, you can add a special server port
number, separated by a colon ":".userToRunAs
- the user you want to run asuser
- the user namepassword
- the user passwordCumulusException
- if the connection to the server cannot be established.LoginFailedException
- for a invalid combination of user name and passwordPasswordExpiredException
- when the password has expired and need to be changedServerNotFoundException
- when no server is available at the given addressopenConnection(boolean, String, String, String)
,
Cumulus.READ_ONLY_SERIAL_NUMBER
,
Cumulus.READ_WRITE_SERIAL_NUMBER
public CumulusSession getCumulusSession()
CumulusSession
objectCumulusSession
object.public java.lang.String getServerAddress()
Server
is located at.Server
instancepublic int getServerVersion()
Server
.public boolean isAlive()
true
if the server is still active, false
otherwise.public java.util.Set<java.lang.Integer> getCatalogIDs(boolean sharedOnly, boolean publishedToInternetOnly)
sharedOnly
- Only return IDs of shared catalogs. For a non admin user this flag has no effect as he is allowed to access only shared
catalogs anyway.publishedToInternetOnly
- Only return IDs of catalogs that are published to the Internet.public Server.CatalogInfo getCatalogInfo(int catalogID) throws CumulusException
catalogID
- The ID of the requested catalogCumulusException
- in case of an errorpublic Server.CatalogInfo getCatalogInfo(int catalogID, int languageID) throws CumulusException
catalogID
- The ID of the requested catalogCumulusException
- in case of an errorpublic java.lang.String getCatalogDescription(int catalogID, int languageID) throws CumulusException
catalogID
- The ID of the requested cataloglanguageID
- The language in which to return the description.CumulusException
- in case of an errorpublic java.lang.String getCatalogDisplayName(int catalogID, int languageID) throws CumulusException
catalogID
- The ID of the requested cataloglanguageID
- The language in which to return the display name.CumulusException
- in case of an errorpublic void setSharing(int catalogID, boolean shared, boolean publishedToInternet) throws PermissionDeniedException, CumulusException
catalogID
- The ID of the requested catalogshared
- Flag indicating whether to enable or disable sharing.publishedToInternet
- Flag indicating whether to enable or disable publishing this catalog to the Internet.CumulusException
- in case of an errorPermissionDeniedException
public int findCatalogID(java.lang.String catalogName) throws CumulusException
catalogName
- The name of the catalog to findCumulusException
- if the catalog can not be foundpublic int findCatalogID(JPack catalogReference) throws CumulusException
catalogReference
- the reference package for the requested catalogCumulusException
- if the catalog can not be foundCatalog.getCatalogReference()
public int findCatalogIDByLocation(java.lang.String catalogLocation)
catalogLocation
- The catalog location. This is the file path on the Cumulus server system.Catalog.getLocation()
public Catalog openCatalog(int catalogID)
findCatalogID(String)
to get
the catalog ID.catalogID
- The ID of the catalog at the server. This ID uniquely identifies a catalog at the server but can change after a server restart.findCatalogID(String)
,
findCatalogID(com.canto.cumulus.utils.JPack)
,
findCatalogIDByLocation(String)
public MultiItemCollection newMultiItemCollection(java.lang.String tableName) throws CumulusException
MultiItemCollection
for the given table. You should close the collection using MultiItemCollection.close()
when you are done
with it to release all resources and connections to the server. The MultiItemCollection
returned is bound to this server and table so you can
only add ItemCollections that belong to the same server and table inside a catalog.tableName
- The name of the table to create a MultiItemCollection for. You can pass one the predefined table names Cumulus.TABLE_NAME_ASSET_RECORDS
or Cumulus.TABLE_NAME_CATEGORIES
or the name of the table for a table field in one of these
tables.MultiItemCollection
CumulusException
- in case of an errornewMultiRecordItemCollection()
,
newMultiCategoryItemCollection()
public MultiRecordItemCollection newMultiRecordItemCollection()
MultiRecordItemCollection
for the given table. You should close the collection using MultiItemCollection.close()
when
you are done with it to release all resources and connections to the server. The MultiRecordItemCollection
returned is bound to this server so
you can only add RecordItemCollections that belong to the same server.MultiRecordItemCollection
CumulusException
- in case of an errorpublic MultiCategoryItemCollection newMultiCategoryItemCollection()
MultiCategoryItemCollection
for the given table. You should close the collection using MultiItemCollection.close()
when you are done with it to release all resources and connections to the server. The MultiCategoryItemCollection
returned is bound to this
server so you can only add CategoryItemCollections that belong to the same server.MultiCategoryItemCollection
CumulusException
- in case of an errorpublic void changePassword(java.lang.String oldPassword, java.lang.String newPassword) throws CumulusException
oldPassword
- the user old password.newPassword
- the user new password.CumulusException
- if the password cannot be changed.public static void changePassword(java.lang.String server, java.lang.String user, java.lang.String oldPassword, java.lang.String newPassword) throws CumulusException
server
- the server name.user
- the user name.oldPassword
- the users old password.newPassword
- the users new password.CumulusException
- if the password cannot be changed.public byte[] sendServerModuleMessage(java.lang.String module, byte[] inData) throws CumulusException
module
- the name or GUID
as String
of the server module.inData
- the message data to send to the module.CumulusException
- if the message cannot be sent.public int addNewCatalog(GUID selector, java.lang.String dbSpec) throws CumulusException
selector
- The GUID of the database engine module at the server. Pass GUID.UID_SELECTOR_CUE
for the Cumulus Database engine.dbSpec
- The location string for the catalog. For the Cumulus database engine pass the path to the catalog file at the server system.CumulusException
- on erroropenCatalog(int)
public int addNewCatalog(GUID selector, java.lang.String dbSpec, java.lang.String catalogTemplate) throws CumulusException
selector
- The GUID of the database engine module at the server. Pass GUID.UID_SELECTOR_CUE
for the Cumulus Database engine.dbSpec
- The location string for the catalog. For the Cumulus database engine pass the path to the catalog file at the server system.catalogTemplate
- the template to use for the new catalogCumulusException
- on erroropenCatalog(int)
public int addExistingCatalog(GUID selector, java.lang.String dbSpec) throws CumulusException
selector
- The GUID of the database engine module at the server. Pass GUID.UID_SELECTOR_CUE
for the Cumulus Database engine.dbSpec
- The location string for the catalog. For the Cumulus database engine pass the path to the catalog file at the server system.CumulusException
- on errorpublic void removeCatalog(int catalogID, int timeout, java.lang.String message) throws CumulusException
catalogID
- The ID of the catalog at the server.timeout
- The number of seconds to wait until all clients have closed their catalog connections.message
- The message being displayed at each client that has this catalog open.CumulusException
- on errorpublic java.util.Map<java.lang.String,java.lang.String> getBaseWebURLs()
public ServerStatistics getStatistics()
public java.util.Set<java.util.Properties.BaseWebURL> getBaseWebURLsProperties()
public java.lang.Object getParent()
CumulusSession
to which this server belongs.public boolean equals(java.lang.Object o)
true
if and only if the argument is not null
and is a Server
object
that represents the same server as this object.equals
in class java.lang.Object
o
- the object to comparetrue
if the servers are equal; false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
public MultiRecordItemCollection openMultiRecordItemCollection(java.lang.String collectionSetName) throws CumulusException
MultiRecordItemCollection
.collectionSetName
- The name of the collection at the server.MultiRecordItemCollection
containing all record items of the collection.CumulusException
- in case of an errorgetCollectionNames()
public java.util.Set<java.lang.String> getCollectionNames()
openMultiRecordItemCollection(String)
public static java.util.Set<java.net.SocketAddress> findServer(int timeout)
SocketAddress
instances that represent the currently running Cumulus server.timeout
- the time in milliseconds to wait for answersSocketAddress
instancespublic java.util.List<java.lang.String> findCollections(java.lang.String queryString, java.util.List<SortFieldDescriptor> sortFields, java.util.Locale locale)
queryString
- A query string containing, Pass null
sortFields
- The fields to sort by including whether to sort ascending or descending.public ItemCollection getAllVocabulariesItemCollection()
ItemCollection
containing all items of the $Vocabulary catalog. This collection can't be used to search for items. Instead it can be
used to access all vocabulary items.public ItemCollection newStatisticsItemCollection(java.lang.String query, java.util.Locale locale) throws QueryParserException, InvalidArgumentException, CumulusException
ItemCollection
and fill it with the items found by the given query.query
- The query string to execute to fill in the collection. An empty or null
string returns an empty collection.locale
- The locale to use for parsing the query stringItemCollection
InvalidArgumentException
- on error finding values specified in the query stringCumulusException
- on other errorsQueryParserException
- on errors parsing the query stringwww.canto.com
Canto, the Canto logo, the Cumulus logo, and Cumulus are registered trademarks of Canto GmbH, registered in the U.S. and other countries.