java.lang.Object org.nlogo.workspace.ExtensionManager
public class ExtensionManager
Constructor Summary | |
---|---|
ExtensionManager(AbstractWorkspace workspace)
|
Method Summary | |
---|---|
void |
addToLibraryPath(Object classManager,
String directory)
|
boolean |
anyExtensionsLoaded()
Returns true if any extensions have been imported in the current model, false otherwise. |
void |
clearAll()
|
String |
dumpExtensionPrimitives()
Returns a String describing all the loaded extensions. |
String |
dumpExtensions()
Returns a String describing all the loaded extensions. |
void |
exportWorld(PrintWriter writer)
|
void |
finishFullCompilation()
Instructs any extensions which haven't been re-imported during the current compile to shut down. |
List<String> |
getExtensionNames()
|
File |
getFile(String path)
|
String |
getFullPath(String path)
|
List<String> |
getJarPaths()
|
String |
getSource(String filename)
|
void |
importExtension(String extName,
ErrorSource errors)
Loads the extension contained in the jar at jarPath. |
void |
importExtensionData(String name,
List<String[]> data,
ImportErrorHandler handler)
|
boolean |
isExtensionName(String name)
|
ExtensionObject |
readExtensionObject(String extName,
String typeName,
String value)
|
Object |
readFromString(String source)
|
Primitive |
replaceIdentifier(String name)
Returns the identifier "name" by its imported implementation, if any, or null, if not. |
void |
reset()
Instructs any loaded extensions to unload. |
String |
resolvePath(String path)
|
String |
resolvePathAsURL(String path)
|
Object |
retrieveObject()
Returns the stored object. |
void |
startFullCompilation()
During compilation, we reach the extensions [ ... ] block. |
void |
storeObject(Object obj)
Stores an object for the extension that can be retrieved in runOnce if the extension is loaded again. |
AbstractWorkspace |
workspace()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtensionManager(AbstractWorkspace workspace)
Method Detail |
---|
public AbstractWorkspace workspace()
public boolean anyExtensionsLoaded()
ExtensionManager
anyExtensionsLoaded
in interface ExtensionManager
public String getSource(String filename) throws IOException
getSource
in interface ExtensionManager
IOException
public File getFile(String path) throws ExtensionException
getFile
in interface ExtensionManager
ExtensionException
public void storeObject(Object obj)
ExtensionManager
storeObject
in interface ExtensionManager
obj
- the object to be storedpublic Object retrieveObject()
ExtensionManager
retrieveObject
in interface ExtensionManager
public void importExtension(String extName, ErrorSource errors) throws CompilerException
ExtensionManager
importExtension
in interface ExtensionManager
extName
- the path to the extension jar. May be relative to the
current model directory.errors
- the ErrorSource to use when a CompilerException needs
to be thrown.
CompilerException
public void addToLibraryPath(Object classManager, String directory)
addToLibraryPath
in interface ExtensionManager
public String resolvePath(String path)
resolvePath
in interface ExtensionManager
public String resolvePathAsURL(String path)
resolvePathAsURL
in interface ExtensionManager
public String getFullPath(String path) throws ExtensionException
ExtensionException
public Object readFromString(String source) throws CompilerException
readFromString
in interface ExtensionManager
CompilerException
public void clearAll()
public ExtensionObject readExtensionObject(String extName, String typeName, String value) throws CompilerException
readExtensionObject
in interface ExtensionManager
CompilerException
public Primitive replaceIdentifier(String name)
ExtensionManager
replaceIdentifier
in interface ExtensionManager
public String dumpExtensions()
dumpExtensions
in interface ExtensionManager
public List<String> getJarPaths()
getJarPaths
in interface ExtensionManager
public List<String> getExtensionNames()
getExtensionNames
in interface ExtensionManager
public String dumpExtensionPrimitives()
dumpExtensionPrimitives
in interface ExtensionManager
public void reset()
ExtensionManager
reset
in interface ExtensionManager
public void startFullCompilation()
ExtensionManager
startFullCompilation
in interface ExtensionManager
public void finishFullCompilation()
ExtensionManager
finishFullCompilation
in interface ExtensionManager
public void exportWorld(PrintWriter writer)
public void importExtensionData(String name, List<String[]> data, ImportErrorHandler handler) throws ExtensionException
ExtensionException
public boolean isExtensionName(String name)