org.nlogo.workspace
Class ExtensionManager

java.lang.Object
  extended by org.nlogo.workspace.ExtensionManager
All Implemented Interfaces:
ExtensionManager

public class ExtensionManager
extends Object
implements org.nlogo.compiler.ExtensionManager, ExtensionManager


Constructor Summary
ExtensionManager(AbstractWorkspace workspace)
           
 
Method Summary
 void addConfigurable(Configurable c)
           
 boolean anyExtensionsLoaded()
          Returns true if any extensions have been imported in the current model, false otherwise.
 void cleanUp()
          Instructs any extensions which haven't been re-imported during the current compile to shut down.
 String dumpExtensionPrimitives()
          Returns a String describing all the loaded extensions.
 String dumpExtensions()
          Returns a String describing all the loaded extensions.
 String getAddendum()
           
 String getExternalFileSource(String filename)
           
 void importExtension(String extName, org.nlogo.compiler.ErrorSource errors)
          Loads the extension contained in the jar at jarPath.
 void initializeHubNet()
          Intializes the HubNetManager, this method should be called if the extension intends to use HubNet.
 String[] listExtensions()
           
 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.
 void reset()
          Instructs any loaded extensions to unload.
 String resolvePath(String path)
           
 String resolvePathAsURL(String path)
           
 Object retrieveObject()
          Returns the stored object.
 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

ExtensionManager

public ExtensionManager(AbstractWorkspace workspace)
Method Detail

workspace

public AbstractWorkspace workspace()

anyExtensionsLoaded

public boolean anyExtensionsLoaded()
Description copied from interface: org.nlogo.compiler.ExtensionManager
Returns true if any extensions have been imported in the current model, false otherwise.


getAddendum

public String getAddendum()

getExternalFileSource

public String getExternalFileSource(String filename)
                             throws IOException
Throws:
IOException

storeObject

public void storeObject(Object obj)
Description copied from interface: ExtensionManager
Stores an object for the extension that can be retrieved in runOnce if the extension is loaded again. This is useful if the extension has initialization it needs to perform that should only happen once, even if the extension is loaded multiple times.

Specified by:
storeObject in interface ExtensionManager
Parameters:
obj - the object to be stored

retrieveObject

public Object retrieveObject()
Description copied from interface: ExtensionManager
Returns the stored object.

Specified by:
retrieveObject in interface ExtensionManager
Returns:
the stored object

importExtension

public void importExtension(String extName,
                            org.nlogo.compiler.ErrorSource errors)
                     throws CompilerException
Description copied from interface: org.nlogo.compiler.ExtensionManager
Loads the extension contained in the jar at jarPath.

Parameters:
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.
Throws:
CompilerException

addConfigurable

public void addConfigurable(Configurable c)

initializeHubNet

public void initializeHubNet()
Description copied from interface: ExtensionManager
Intializes the HubNetManager, this method should be called if the extension intends to use HubNet.

Specified by:
initializeHubNet in interface ExtensionManager

resolvePath

public String resolvePath(String path)

resolvePathAsURL

public String resolvePathAsURL(String path)

readFromString

public Object readFromString(String source)
Specified by:
readFromString in interface ExtensionManager

readExtensionObject

public ExtensionObject readExtensionObject(String extName,
                                           String typeName,
                                           String value)
Specified by:
readExtensionObject in interface ExtensionManager

replaceIdentifier

public Primitive replaceIdentifier(String name)
Description copied from interface: org.nlogo.compiler.ExtensionManager
Returns the identifier "name" by its imported implementation, if any. If name is not imported primitive, returns null.


listExtensions

public String[] listExtensions()

dumpExtensions

public String dumpExtensions()
Returns a String describing all the loaded extensions.


dumpExtensionPrimitives

public String dumpExtensionPrimitives()
Returns a String describing all the loaded extensions.


reset

public void reset()
Description copied from interface: org.nlogo.compiler.ExtensionManager
Instructs any loaded extensions to unload. Should be called previous to a new model load.


cleanUp

public void cleanUp()
Description copied from interface: org.nlogo.compiler.ExtensionManager
Instructs any extensions which haven't been re-imported during the current compile to shut down. Should be called during each full re-compile.