public class CodeExtension extends Extension
Title: CASA Agent Infrastructure
Copyright: Copyright (c) 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group, Department of Computer Science, University of Calgary
Defines a java-code jar extension. The class specified by the descriptor'sATTR_MAINCLASS
is simply loaded into memory.
Attributes in jar manifest file:
Extension#ATTR_MAINCLASS
- . Defaults to the value Main-Class in the manifest main section.
Extension.ATTR_EXTENSIONNAME
- . Defaults to name (only) of the value of Extension#ATTR_MAINCLASS
.
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_MAINCLASS
This attribute contains the fully-qualified class name of the class containing the main(String[]) method implementing this extension.
|
ATTR_AGENTTYPE, ATTR_AUTOLOAD, ATTR_DOC, ATTR_EXTENSIONNAME, ATTR_FRAMETYPE, descriptor, TYPE_CODE, TYPE_LISPSCRIPT, TYPE_TAB
Constructor and Description |
---|
CodeExtension(ExtensionDescriptor d)
Loads the class specified by the descriptor's
ATTR_MAINCLASS . |
Modifier and Type | Method and Description |
---|---|
protected String |
getNameFromMainClass()
Utility method to obtain the non-fully-qualified class name from the value of the #ATTR_MAINCLASS attribute.
|
(package private) void |
load(AbstractInternalFrame frame,
AbstractProcess agent)
This method is a no-op because CodeExtensions are automatically loaded at instantiation.
|
protected void |
loadIf()
Loads the class specified in by
Extension.descriptor .get(ATTR_MAINCLASS ) by
adding the source file to the classpath. |
(package private) int |
validate()
insures the
Extension#ATTR_MAINCLASS exists by defaulting to the valie of Main-Class in the main section. |
compareTo, toString, validateBool, validateClass, validateString
public static final String ATTR_MAINCLASS
public CodeExtension(ExtensionDescriptor d)
ATTR_MAINCLASS
. Specifically,
Loads the class specified in by Extension.descriptor
.get(ATTR_MAINCLASS
) by
adding the source file to the classpath. If the descriptor
contains the key
Extension.ATTR_AUTOLOAD
then the class ATTR_MAINCLASS
will be actually
loaded into memory, causing any static initialization to occur for that class.d
- protected void loadIf()
Extension.descriptor
.get(ATTR_MAINCLASS
) by
adding the source file to the classpath. If the descriptor
contains the key
Extension.ATTR_AUTOLOAD
then the class ATTR_MAINCLASS
will be actually
loaded into memory, causing any static initialization to occur for that class.
This method is called from the constructor so subclasses can override this behaviour.int validate() throws InvalidParameterException
Extension#ATTR_MAINCLASS
exists by defaulting to the valie of Main-Class in the main section. If we cannot
default in this way an exception is thrown.
validate
in class Extension
InvalidParameterException
- if a fatal error happens.void load(AbstractInternalFrame frame, AbstractProcess agent)
protected String getNameFromMainClass()