public class ActorMetadata extends java.lang.Object implements java.io.Serializable
<entity name="Constant"> <property name="documentation" class="ptolemy.vergil.basic.KeplerDocumentationAttribute"> actor to provide constant input </property> <property name="entityId" class="org.kepler.moml.NamedObjId" value="urn:lsid:lsid.ecoinformatics.org:actor:101:1"/> <property name="class" value="org.kepler.actor.TestActor" class="ptolemy.kernel.util.StringAttribute"> <property name="id" value="urn:lsid:lsid.ecoinformatics.org:actor:1001:1" class="ptolemy.kernel.util.StringAttribute"/> </property> <property name="output" class="org.kepler.moml.PortProperty> <property name="direction" value="output" class="ptolemy.kernel.util.StringAttribute"/> <property name="dataType" value="unknown" class="ptolemy.kernel.util.StringAttribute"/> <property name="isMultiport" value="false" class="ptolemy.kernel.util.StringAttribute"/> </property> <property name="trigger" class="org.kepler.moml.PortProperty> <property name="direction" value="input" class="ptolemy.kernel.util.StringAttribute"/> <property name="dataType" value="unknown" class="ptolemy.kernel.util.StringAttribute"/> <property name="isMultiport" value="true" class="ptolemy.kernel.util.StringAttribute"/> </property> <property class="org.kepler.sms.SemanticType" name="semanticType" value="urn:lsid:lsid.ecoinformatics.org:onto:1:1#ConstantActor"/> <property class="org.kepler.moml.Dependency" name="dependency" value="urn:lsid:lsid.ecoinformatics.org:nativeLib:1:1"/> </entity>Note: As of 8/18/09, this class no longer includes graphical ammentities, such as icons in the moml. If you want graphical widgets for your actor, you must use org.kepler.gui.GraphicalActorMetadata.
Constructor and Description |
---|
ActorMetadata()
default constructor. this is for serialization only. do not use this.
|
ActorMetadata(java.io.InputStream moml)
Constructor.
|
ActorMetadata(NamedObj obj)
builds a new ActorMetadata object from an existing NamedObj
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute a)
add a generic attribute to this actorMetadata object.
|
void |
addDependency(java.lang.String id)
add the id of a dependency to the metadata
|
void |
addMetadataHandler(MetadataHandler handler)
this method allows other classes to add handlers to further process the
metadata produced by this class.
|
void |
addRelation(ComponentRelation r)
add a relation
|
void |
addSemanticType(java.lang.String name,
java.lang.String id)
add the id of a semantic type to the metadata
|
static NamedObj |
createInstance(java.lang.Class<?> newClass,
java.lang.Object[] arguments)
createInstance. creates an instance of a class object. taken from
ptolemy's MomlParser class. modified for this application.
|
NamedObj |
getActor()
return the actor this object was built from.
|
NamedObj |
getActorAsNamedObj(CompositeEntity container)
return this actor as a ComponentEntity
|
boolean |
getChanged()
get the changed flag. this is useful for keeping track of the state of
the actor metadata. this flag does not affect this class in any internal
way except for setting the flag.
|
java.lang.String |
getClassId()
return the id of the class
|
java.lang.String |
getClassName()
return the classname of the actor object. this will be the java type
classname no matter what kind of actor we are describing. for instance if
it is a java class, it will be a.b.c.ClassName where the file is stored
in a/b/c/ClassName.class.
|
java.util.Vector<java.lang.String> |
getDependencies()
return a vector of the ids of the semantic type reference
|
KeplerDocumentationAttribute |
getDocumentationAttribute() |
java.lang.String |
getId()
return the lsid of the actor class object
|
java.lang.String |
getInternalClassName()
return the internal class name of the actor object. for composites this
will be ptolemy.actor.TypedCompositeActor.
|
KeplerLSID |
getLSID()
returns the id of this object as a KeplerLSID
|
java.lang.String |
getName()
return the name of the actor
|
java.util.Hashtable<java.lang.String,java.lang.String> |
getSemanticTypeHash() |
java.util.Vector<java.lang.String> |
getSemanticTypes()
return a vector of the ids of the semantic type reference
|
protected ComponentEntity |
parseMoMLFile(java.lang.String className)
try to locate and parse a moml file as a class
|
void |
removeMetadataHandler(MetadataHandler handler)
remove a metadata handler
|
void |
removeSemanticType(java.lang.String id) |
protected java.io.File |
searchClasspath(java.lang.String className)
search the classpath for a specific class and return the file.
|
void |
setActor(NamedObj actor) |
void |
setChanged(boolean b)
set the changed flag. this is useful for keeping track of the state of
the actor metadata. this flag does not affect this class in any internal
way except for setting the flag.
|
void |
setClassId(java.lang.String id) |
void |
setDocumentationAttribute(KeplerDocumentationAttribute newda) |
void |
setId(java.lang.String id)
set the id
|
void |
setName(java.lang.String name)
set the name
|
java.lang.String |
toString()
return the moml xml representation of the actor.
|
java.lang.String |
toString(boolean addSuffixToSemanticTypeNames,
boolean includeAttributes,
boolean includePorts)
return the moml xml representation of the actor.
|
public ActorMetadata()
public ActorMetadata(java.io.InputStream moml) throws InvalidMetadataException
moml
- the xml metadataInvalidMetadataException
public ActorMetadata(NamedObj obj)
am
- the ActorMetadata to build this object from.public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getId()
public KeplerLSID getLSID() throws java.lang.Exception
java.lang.Exception
public KeplerDocumentationAttribute getDocumentationAttribute()
public void setDocumentationAttribute(KeplerDocumentationAttribute newda) throws IllegalActionException, NameDuplicationException, java.lang.CloneNotSupportedException
IllegalActionException
NameDuplicationException
java.lang.CloneNotSupportedException
public void setId(java.lang.String id)
public java.lang.String getClassName()
public java.lang.String getInternalClassName()
public java.lang.String getClassId()
public void setClassId(java.lang.String id)
public void addDependency(java.lang.String id)
id
- the id of the dependency to addpublic void addSemanticType(java.lang.String name, java.lang.String id)
id
- the id of the semantic type to addpublic java.util.Vector<java.lang.String> getSemanticTypes()
public java.util.Hashtable<java.lang.String,java.lang.String> getSemanticTypeHash()
public void removeSemanticType(java.lang.String id)
public java.util.Vector<java.lang.String> getDependencies()
public boolean getChanged()
public void setChanged(boolean b)
b
- public void addAttribute(Attribute a)
a
- the attribute to addpublic void addRelation(ComponentRelation r)
public NamedObj getActorAsNamedObj(CompositeEntity container) throws java.lang.Exception
container
- the new ComponentEntity's containerjava.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean addSuffixToSemanticTypeNames, boolean includeAttributes, boolean includePorts)
incSemanticTypeNames
- if true, add a suffix to property names
for semantic types, e.g. semanticType00 -> semanticType000includeAttributes
- if true, add the attributes and parameters
to the xml representation. this flag does not affect semantic types
or documentation attributes.includePorts
- if true, add the ports to the xml representation.public void addMetadataHandler(MetadataHandler handler)
handler
- the handler to addpublic void removeMetadataHandler(MetadataHandler handler)
handler
- the handler to removeprotected java.io.File searchClasspath(java.lang.String className) throws java.io.FileNotFoundException
className
- the name of the class to search forworkDir
- the directory where temp files can be createdjava.io.FileNotFoundException
protected ComponentEntity parseMoMLFile(java.lang.String className) throws java.lang.Exception
java.lang.Exception
public static NamedObj createInstance(java.lang.Class<?> newClass, java.lang.Object[] arguments) throws java.lang.Exception
newClass
- arguments
- java.lang.Exception