Skip to content

Commit

Permalink
Added iDatabaseName to dropDatabase and existsDatabase
Browse files Browse the repository at this point in the history
  • Loading branch information
alonsod86 committed Jul 29, 2015
1 parent 763842f commit 705d720
Showing 1 changed file with 32 additions and 4 deletions.
Expand Up @@ -228,15 +228,17 @@ public synchronized boolean existsDatabase() throws IOException {
*
* @return true if exists, otherwise false
* @throws IOException
* @param iDatabaseName
* The database name
* @param storageType
* Storage type between "plocal" or "memory".
*/
public synchronized boolean existsDatabase(final String storageType) throws IOException {
public synchronized boolean existsDatabase(final String iDatabaseName, final String storageType) throws IOException {

try {
final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_EXIST);
try {
network.writeString(storage.getName());
network.writeString(iDatabaseName);
network.writeString(storageType);
} finally {
storage.endRequest(network);
Expand All @@ -254,6 +256,18 @@ public synchronized boolean existsDatabase(final String storageType) throws IOEx
throw new OStorageException("Error on checking existence of the remote storage: " + storage.getName(), e);
}
}

/**
* Checks if a database exists in the remote server.
*
* @return true if exists, otherwise false
* @throws IOException
* @param storageType
* Storage type between "plocal" or "memory".
*/
public synchronized boolean existsDatabase(final String storageType) throws IOException {
return existsDatabase(storage.getName(), storageType);
}

/**
* Deprecated. Use dropDatabase() instead.
Expand All @@ -274,10 +288,12 @@ public OServerAdmin deleteDatabase(final String storageType) throws IOException
*
* @return The instance itself. Useful to execute method in chain
* @throws IOException
* @param iDatabaseName
* The database name
* @param storageType
* Storage type between "plocal" or "memory".
*/
public synchronized OServerAdmin dropDatabase(final String storageType) throws IOException {
public synchronized OServerAdmin dropDatabase(final String iDatabaseName, final String storageType) throws IOException {

boolean retry = true;

Expand All @@ -286,7 +302,7 @@ public synchronized OServerAdmin dropDatabase(final String storageType) throws I

final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_DROP);
try {
network.writeString(storage.getName());
network.writeString(iDatabaseName);
network.writeString(storageType);
} finally {
storage.endRequest(network);
Expand All @@ -313,6 +329,18 @@ public synchronized OServerAdmin dropDatabase(final String storageType) throws I
return this;
}

/**
* Drops a database from a remote server instance.
*
* @return The instance itself. Useful to execute method in chain
* @throws IOException
* @param storageType
* Storage type between "plocal" or "memory".
*/
public synchronized OServerAdmin dropDatabase(final String storageType) throws IOException {
return dropDatabase(storage.getName(), storageType);
}

/**
* Freezes the database by locking it in exclusive mode.
*
Expand Down

0 comments on commit 705d720

Please sign in to comment.