|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.rapidminer.tools.OperatorService
public class OperatorService
This class maintains all registered operators in the current context.
There exists a listener concept that will alert all listeners, if new operators are added
or removed.
It provides convenience methods for creating new Operator
s. See the description of
the createOperator(Class)
method. Please mind that Operator
s that are
built from an OperationFactory
cannot be constructed with this method. Please use createOperator(String)
method instead,
that can be passed the Operator
's key.
This class also reads the xml definitions of the RapidMiner Core and Extension operators. These descriptions are entries in a XML file like OperatorsCore.xml.
Nested Class Summary | |
---|---|
static interface |
OperatorService.OperatorServiceListener
The interface for all Listener to the OperatorService . |
Field Summary | |
---|---|
static java.lang.String |
RAPID_MINER_CORE_NAMESPACE
|
static java.lang.String |
RAPID_MINER_CORE_PREFIX
|
Constructor Summary | |
---|---|
OperatorService()
|
Method Summary | ||
---|---|---|
static void |
addOperatorCreationHook(OperatorCreationHook operatorCreationHook)
This method adds an OperatorCreationHook that will be informed whenever an Operator instance is created. |
|
static void |
addOperatorServiceListener(OperatorService.OperatorServiceListener listener)
This method can be used to add an listener to the OperatorService that is informed whenever the set of available operators changes. |
|
static
|
createOperator(java.lang.Class<T> clazz)
Use this method to create an operator from an operator class. |
|
static Operator |
createOperator(OperatorDescription description)
Use this method to create an operator of a given description object. |
|
static Operator |
createOperator(java.lang.String typeName)
Use this method to create an operator from the given class name (from operator description file operators.xml, not from the Java class name). |
|
static GroupTree |
getGroups()
Returns the group hierarchy of all operators. |
|
static java.lang.Class<? extends IOObject> |
getIOObjectClass(java.lang.String name)
Returns the class for the short name of an IO object. |
|
static java.util.Set<java.lang.String> |
getIOObjectsNames()
Returns a sorted set of all short IO object names. |
|
static OperatorDescription |
getOperatorDescription(java.lang.String key)
Returns the operator description for a given key from the operators.xml file, e.g. |
|
static OperatorDescription[] |
getOperatorDescriptions(java.lang.Class clazz)
Returns the operator descriptions for the operators which uses the given class. |
|
static java.util.Set<java.lang.String> |
getOperatorKeys()
Returns a collection of all operator keys. |
|
static java.util.Set<java.lang.String> |
getOperatorNames()
Deprecated. |
|
static java.lang.String |
getReplacementForDeprecatedClass(java.lang.String deprecatedKey)
Returns a replacement if the given operator class is deprecated, and null otherwise. |
|
static void |
init()
|
|
static void |
invokeCreationHooks(Operator operator)
This method must be called by each OperatorDescription.createOperatorInstance() call. |
|
static void |
registerIOObjects(java.util.Collection<java.lang.Class<? extends IOObject>> objects)
Checks if the given classes are already registered and adds them if not. |
|
static void |
registerOperator(OperatorDescription description)
Deprecated. |
|
static void |
registerOperator(OperatorDescription description,
OperatorDocBundle bundle)
Registers the given operator description. |
|
static void |
registerOperators(java.lang.String name,
java.io.InputStream operatorsXML,
java.lang.ClassLoader classLoader)
Registers all operators from a given XML input stream. |
|
static void |
registerOperators(java.lang.String name,
java.io.InputStream operatorsXML,
java.lang.ClassLoader classLoader,
Plugin provider)
|
|
static void |
registerOperators(java.net.URL operatorsXML,
java.lang.ClassLoader classLoader,
Plugin plugin)
|
|
static void |
setAdditionalOperatorDescriptors(java.lang.String... files)
Specifies a list of files to be loaded as operator descriptors. |
|
static void |
unregisterOperator(OperatorDescription description)
This method can be used to dynamically remove Operators from the number of defined operators. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String RAPID_MINER_CORE_PREFIX
public static final java.lang.String RAPID_MINER_CORE_NAMESPACE
Constructor Detail |
---|
public OperatorService()
Method Detail |
---|
public static void init()
public static void registerOperators(java.net.URL operatorsXML, java.lang.ClassLoader classLoader, Plugin plugin)
public static void registerOperators(java.lang.String name, java.io.InputStream operatorsXML, java.lang.ClassLoader classLoader)
public static void registerOperators(java.lang.String name, java.io.InputStream operatorsXML, java.lang.ClassLoader classLoader, Plugin provider)
@Deprecated public static void registerOperator(OperatorDescription description) throws OperatorCreationException
#registerOperator(OperatorDescription, OperatorDocBundle))
,
but without an OperatorDocBundle
groups will not have a name or icon. This method remains for
compatibility of older extensions.
OperatorCreationException
public static void registerOperator(OperatorDescription description, OperatorDocBundle bundle) throws OperatorCreationException
OperatorDescription
,
the group icon will be set here.
bundle
- might be null. If existing will be used for GroupCreation / Icon settings
OperatorCreationException
public static void unregisterOperator(OperatorDescription description)
public static void registerIOObjects(java.util.Collection<java.lang.Class<? extends IOObject>> objects)
public static java.util.Set<java.lang.String> getIOObjectsNames()
public static java.lang.Class<? extends IOObject> getIOObjectClass(java.lang.String name)
@Deprecated public static java.util.Set<java.lang.String> getOperatorNames()
getOperatorKeys()
instead.
public static java.util.Set<java.lang.String> getOperatorKeys()
public static GroupTree getGroups()
OperatorService
in order
to receive registration or unregistration eventsevents
public static OperatorDescription[] getOperatorDescriptions(java.lang.Class clazz)
public static OperatorDescription getOperatorDescription(java.lang.String key)
public static Operator createOperator(java.lang.String typeName) throws OperatorCreationException
createOperator(Class)
which can be checked during compile time.
This is, however, not possible for some generic operators like the Weka
operators. In that case, you have to use this method with the argument
from the operators.xml file, e.g. createOperator("J48") for a J48 decision tree learner.
OperatorCreationException
public static Operator createOperator(OperatorDescription description) throws OperatorCreationException
OperatorCreationException
public static <T extends Operator> T createOperator(java.lang.Class<T> clazz) throws OperatorCreationException
Use this method to create an operator from an operator class. This is the only method which ensures operator existence checks during compile time (and not during runtime) and the usage of this method is therefore the recommended way for operator creation.
It is, however, not possible to create some generic operators with this method (this mainly applies to the Weka operators). Please
use the method createOperator(String)
for those generic operators.
If you try to create a generic operator with this method, the OperatorDescription will not be unique for the given class and an OperatorCreationException is thrown.
Please note that is is not necessary to cast the operator to the desired class.
TODO: can we remove the suppress warning here?
OperatorCreationException
public static java.lang.String getReplacementForDeprecatedClass(java.lang.String deprecatedKey)
public static void setAdditionalOperatorDescriptors(java.lang.String... files)
public static void addOperatorCreationHook(OperatorCreationHook operatorCreationHook)
OperatorCreationHook
that will be informed whenever an Operator
instance is created.
public static void invokeCreationHooks(Operator operator)
OperatorDescription.createOperatorInstance()
call.
It is used for example for statistics purpose.
public static void addOperatorServiceListener(OperatorService.OperatorServiceListener listener)
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |