Support for setting RunScriptOnNode.Factory

- Set default RunScriptOnNode.Factory impl using @ImplementedBy,
  rather than hardcoding the binding
This commit is contained in:
Aled Sage 2012-11-04 21:47:20 +00:00
parent 9212d4ff26
commit 3f3037c729
2 changed files with 3 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import org.jclouds.scriptbuilder.domain.Statement;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.inject.ImplementedBy;
/**
* Separates out how one implements the ability to run a script on a node.
@ -36,6 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture;
@Beta
public interface RunScriptOnNode extends Callable<ExecResponse> {
@ImplementedBy(org.jclouds.compute.config.BaseComputeServiceContextModule.RunScriptOnNodeFactoryImpl.class)
public interface Factory {
RunScriptOnNode create(NodeMetadata node, Statement script, RunScriptOptions options);

View File

@ -104,8 +104,6 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
install(new PersistNodeCredentialsModule());
bind(RunScriptOnNode.Factory.class).to(RunScriptOnNodeFactoryImpl.class);
install(new FactoryModuleBuilder().implement(new TypeLiteral<Callable<Void>>() {
}, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.class)
.implement(new TypeLiteral<Function<AtomicReference<NodeMetadata>, Void>>() {
@ -124,7 +122,7 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
}
@Singleton
static class RunScriptOnNodeFactoryImpl implements RunScriptOnNode.Factory {
public static class RunScriptOnNodeFactoryImpl implements RunScriptOnNode.Factory {
static interface Factory {