This commit is contained in:
kimchy 2010-03-29 11:03:36 +03:00
parent 651cd78456
commit a5dc0fcf9a
2 changed files with 46 additions and 0 deletions

View File

@ -27,30 +27,50 @@ import org.elasticsearch.util.component.LifecycleComponent;
import java.util.Collection;
/**
* A base class for a plugin.
*
* @author kimchy (shay.banon)
*/
public abstract class AbstractPlugin implements Plugin {
/**
* Defaults to return an empty list.
*/
@Override public Collection<Class<? extends Module>> modules() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override public Collection<Class<? extends LifecycleComponent>> services() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override public Collection<Class<? extends Module>> indexModules() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override public Collection<Class<? extends CloseableComponent>> indexServices() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override public Collection<Class<? extends Module>> shardModules() {
return ImmutableList.of();
}
/**
* Defaults to return an empty list.
*/
@Override public Collection<Class<? extends CloseableComponent>> shardServices() {
return ImmutableList.of();
}

View File

@ -26,23 +26,49 @@ import org.elasticsearch.util.component.LifecycleComponent;
import java.util.Collection;
/**
* An extension point allowing to plug in custom functionality.
*
* @author kimchy (shay.banon)
*/
public interface Plugin {
/**
* The name of the plugin.
*/
String name();
/**
* The description of the plugin.
*/
String description();
/**
* Server level modules.
*/
Collection<Class<? extends Module>> modules();
/**
* Server level services that will be automatically started/stopped/closed.
*/
Collection<Class<? extends LifecycleComponent>> services();
/**
* Per index modules.
*/
Collection<Class<? extends Module>> indexModules();
/**
* Per index services that will be automatically closed.
*/
Collection<Class<? extends CloseableComponent>> indexServices();
/**
* Per index shard module.
*/
Collection<Class<? extends Module>> shardModules();
/**
* Per index shard service that will be automatically closed.
*/
Collection<Class<? extends CloseableComponent>> shardServices();
}