Package org.drools.core.rule
Class JavaDialectRuntimeData
- java.lang.Object
-
- org.drools.core.rule.JavaDialectRuntimeData
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,DialectRuntimeData
public class JavaDialectRuntimeData extends Object implements DialectRuntimeData, Externalizable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JavaDialectRuntimeData.PackageClassLoader
This is an Internal Drools Class
-
Constructor Summary
Constructors Constructor Description JavaDialectRuntimeData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DialectRuntimeData
clone(DialectRuntimeRegistry registry, ClassLoader rootClassLoader)
DialectRuntimeData
clone(DialectRuntimeRegistry registry, ClassLoader rootClassLoader, boolean excludeClasses)
byte[]
getBytecode(String resourceName)
byte[]
getClassDefinition(String className)
ClassLoader
getClassLoader()
ClassLoader
getRootClassLoader()
Map<String,byte[]>
getStore()
boolean
isDirty()
void
merge(DialectRuntimeRegistry registry, DialectRuntimeData newData)
void
merge(DialectRuntimeRegistry registry, DialectRuntimeData newData, boolean excludeClasses)
void
onAdd(DialectRuntimeRegistry registry, ClassLoader rootClassLoader)
void
onBeforeExecute()
void
onRemove()
void
putAllClassDefinitions(Map classDefinitions)
void
putAllInvokers(Map<String,Wireable> invokers)
void
putClassDefinition(String className, byte[] classDef)
void
putInvoker(String className, Wireable invoker)
byte[]
read(String resourceName)
void
readExternal(ObjectInput stream)
Handles the read serialization of the PackageCompilationData.void
reload()
This class drops the classLoader and reloads it.boolean
remove(String resourceName)
void
removeClassDefinition(String className)
void
removeFunction(KnowledgePackageImpl pkg, Function function)
void
removeInvoker(String className)
void
removeRule(KnowledgePackageImpl pkg, RuleImpl rule)
void
setDirty(boolean dirty)
String
toString()
void
write(String resourceName, byte[] clazzData)
void
writeExternal(ObjectOutput stream)
Handles the write serialization of the PackageCompilationData.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.rule.DialectRuntimeData
compile, resetParserConfiguration
-
-
-
-
Method Detail
-
writeExternal
public void writeExternal(ObjectOutput stream) throws IOException
Handles the write serialization of the PackageCompilationData. Patterns in Rules may reference generated data which cannot be serialized by default methods. The PackageCompilationData holds a reference to the generated bytecode. The generated bytecode must be restored before any Rules.- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput stream) throws IOException, ClassNotFoundException
Handles the read serialization of the PackageCompilationData. Patterns in Rules may reference generated data which cannot be serialized by default methods. The PackageCompilationData holds a reference to the generated bytecode; which must be restored before any Rules. A custom ObjectInputStream, able to resolve classes against the bytecode, is used to restore the Rules.- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
onAdd
public void onAdd(DialectRuntimeRegistry registry, ClassLoader rootClassLoader)
- Specified by:
onAdd
in interfaceDialectRuntimeData
-
onRemove
public void onRemove()
- Specified by:
onRemove
in interfaceDialectRuntimeData
-
onBeforeExecute
public void onBeforeExecute()
- Specified by:
onBeforeExecute
in interfaceDialectRuntimeData
-
clone
public DialectRuntimeData clone(DialectRuntimeRegistry registry, ClassLoader rootClassLoader)
- Specified by:
clone
in interfaceDialectRuntimeData
-
clone
public DialectRuntimeData clone(DialectRuntimeRegistry registry, ClassLoader rootClassLoader, boolean excludeClasses)
- Specified by:
clone
in interfaceDialectRuntimeData
-
merge
public void merge(DialectRuntimeRegistry registry, DialectRuntimeData newData)
- Specified by:
merge
in interfaceDialectRuntimeData
-
merge
public void merge(DialectRuntimeRegistry registry, DialectRuntimeData newData, boolean excludeClasses)
- Specified by:
merge
in interfaceDialectRuntimeData
-
isDirty
public boolean isDirty()
- Specified by:
isDirty
in interfaceDialectRuntimeData
-
setDirty
public void setDirty(boolean dirty)
- Specified by:
setDirty
in interfaceDialectRuntimeData
-
getBytecode
public byte[] getBytecode(String resourceName)
-
getClassLoader
public ClassLoader getClassLoader()
-
getRootClassLoader
public ClassLoader getRootClassLoader()
-
removeRule
public void removeRule(KnowledgePackageImpl pkg, RuleImpl rule)
- Specified by:
removeRule
in interfaceDialectRuntimeData
-
removeFunction
public void removeFunction(KnowledgePackageImpl pkg, Function function)
- Specified by:
removeFunction
in interfaceDialectRuntimeData
-
read
public byte[] read(String resourceName)
-
write
public void write(String resourceName, byte[] clazzData)
-
remove
public boolean remove(String resourceName)
-
reload
public void reload()
This class drops the classLoader and reloads it. During this process it must re-wire all the invokeables.- Specified by:
reload
in interfaceDialectRuntimeData
-
removeInvoker
public void removeInvoker(String className)
-
putClassDefinition
public void putClassDefinition(String className, byte[] classDef)
-
putAllClassDefinitions
public void putAllClassDefinitions(Map classDefinitions)
-
getClassDefinition
public byte[] getClassDefinition(String className)
-
removeClassDefinition
public void removeClassDefinition(String className)
-
-