com.backendless.hive.HiveManagement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-common Show documentation
Show all versions of java-sdk-common Show documentation
Provides access to Backendless API
The newest version!
package com.backendless.hive;
import com.backendless.Invoker;
import com.backendless.async.callback.BackendlessCallback;
import com.backendless.core.responder.AdaptingResponder;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
public final class HiveManagement
{
public final static String HIVE_SERVICE_ALIAS = "com.backendless.services.hive.HiveService";
private static final HiveManagement HIVE_MANAGEMENT = new HiveManagement();
public static HiveManagement getInstance()
{
return HIVE_MANAGEMENT;
}
HiveManagement()
{}
public CompletableFuture> getNames()
{
return makeRemoteCall( "getHiveNames", new AdaptingResponder<>( Set.class ) )
.thenApply( set -> (Set)set );
}
public CompletableFuture create( String name )
{
return makeRemoteCall( "addHive", name );
}
public CompletableFuture rename( String name, String newName )
{
return makeRemoteCall( "renameHive", name, newName );
}
public CompletableFuture delete( String name )
{
return makeRemoteCall( "deleteHive", new AdaptingResponder<>( Long.class ), name );
}
public CompletableFuture deleteAll()
{
return makeRemoteCall( "deleteAllHives", new AdaptingResponder<>( Long.class ) );
}
public CompletableFuture keys( String name, StoreType storeType, String filterPattern, String cursor, int pageSize )
{
return makeRemoteCall( "retrieveHiveKeys", name, storeType, filterPattern, cursor, pageSize );
}
private CompletableFuture makeRemoteCall( String methodName, Object... args )
{
return makeRemoteCall( methodName, null, args );
}
private CompletableFuture makeRemoteCall( String methodName, AdaptingResponder adaptingResponder, Object... args )
{
CompletableFuture futureResult = new CompletableFuture<>();
Invoker.invokeAsync( HIVE_SERVICE_ALIAS, methodName, args, new BackendlessCallback()
{
@Override
public void handleResponse( T response )
{
futureResult.complete( response );
}
}, adaptingResponder );
return futureResult;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy