public class ServerUtility
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROXY_SINK_ATTRIBUTE
Attribute value indicating that the actor is a sink.
|
static java.lang.String |
PROXY_SOURCE_ATTRIBUTE
Attribute value indicating that the actor is a source.
|
static java.lang.String |
REMOTE_ATTRIBUTE
Attribute value indicating that the parent attribute is a remote attribute -
its value needs to synchronized between client and server models.
|
static java.lang.String |
REMOTE_OBJECT_TAG
Attribute name indicating that the named object needs to be handled by the ProxyModelBuilder.
|
Constructor and Description |
---|
ServerUtility() |
Modifier and Type | Method and Description |
---|---|
static MoMLParser |
createMoMLParser()
Create and initialize a new MoMLParser.
|
static java.util.List<Attribute> |
deepAttributeList(NamedObj container)
Return the deep attribute list of the container in a depth first order.
|
static void |
findRemoteAttributes(java.util.List<Attribute> attributeList,
java.util.HashMap<java.lang.String,Settable> remoteAttributeMap)
Find all remote attributes of the model and add them to the
remoteAttributeMap.
|
static boolean |
isRemoteAttribute(Attribute attribute)
Return true if the attribute is marked as remote attribute, false otherwise.
|
static boolean |
isTargetProxySink(Attribute targetEntityAttribute)
Return true if the attribute is marked as remote sink, false otherwise.
|
static boolean |
isTargetProxySource(Attribute targetEntityAttribute)
Return true if the attribute is marked as remote source, false otherwise.
|
static CompositeEntity |
mergeModelWithLayout(CompositeEntity model,
CompositeEntity layout,
java.util.HashSet<java.lang.Class<? extends Attribute>> classesToMerge,
java.util.HashSet<java.lang.String> namedObjectsToMerge)
Merge the model with layout.
|
static CompositeEntity |
mergeModelWithLayout(java.lang.String modelURL,
java.lang.String layoutURL,
java.util.HashSet<java.lang.Class<? extends Attribute>> classesToMerge,
java.util.HashSet<java.lang.String> namedObjectsToMerge)
Merge the model with layout.
|
static CompositeEntity |
mergeModelWithLayout(java.net.URL modelURL,
java.net.URL layoutURL,
java.util.HashSet<java.lang.Class<? extends Attribute>> classesToMerge,
java.util.HashSet<java.lang.String> namedObjectsToMerge)
Merge the model with layout.
|
static CompositeEntity |
openModelFile(java.net.URL url)
Open a MoML file, parse it, and the parsed model.
|
static java.lang.String |
stripFullName(java.lang.String fullName)
Strips the first part of a compound element name, including the
"." at the beginning.
|
LayoutValidationErrors |
validateModelAndLayout(java.lang.String modelURL,
java.lang.String layoutURL)
Validate the model and layout and return list of errors that might prevent
merging.
|
public static final java.lang.String REMOTE_ATTRIBUTE
public static final java.lang.String REMOTE_OBJECT_TAG
public static final java.lang.String PROXY_SOURCE_ATTRIBUTE
public static final java.lang.String PROXY_SINK_ATTRIBUTE
public static MoMLParser createMoMLParser()
public static java.util.List<Attribute> deepAttributeList(NamedObj container)
container
- the container to process.public static void findRemoteAttributes(java.util.List<Attribute> attributeList, java.util.HashMap<java.lang.String,Settable> remoteAttributeMap)
attributeList
- the attribute list to searchremoteAttributeMap
- the map where the attributes need to be added.public static boolean isRemoteAttribute(Attribute attribute)
attribute
- the child attribute of the attribute to be checked.public static boolean isTargetProxySink(Attribute targetEntityAttribute)
targetEntityAttribute
- the child attribute the source
actor to be checked.public static boolean isTargetProxySource(Attribute targetEntityAttribute)
targetEntityAttribute
- the child attribute of the source actor to be checked.public static CompositeEntity mergeModelWithLayout(CompositeEntity model, CompositeEntity layout, java.util.HashSet<java.lang.Class<? extends Attribute>> classesToMerge, java.util.HashSet<java.lang.String> namedObjectsToMerge) throws IllegalActionException, NameDuplicationException, java.lang.CloneNotSupportedException
model
- The model to merge.layout
- The layout to merge.classesToMerge
- The classes that need to be merged.namedObjectsToMerge
- The named objects that need to be merged.IllegalActionException
- if there is a problem merging the model.NameDuplicationException
- if there is a problem merging the model.java.lang.CloneNotSupportedException
- if there is a problem merging the model.public static CompositeEntity mergeModelWithLayout(java.net.URL modelURL, java.net.URL layoutURL, java.util.HashSet<java.lang.Class<? extends Attribute>> classesToMerge, java.util.HashSet<java.lang.String> namedObjectsToMerge) throws IllegalActionException, NameDuplicationException, java.lang.CloneNotSupportedException
modelURL
- The URL to the model.layoutURL
- The URL to the layout.classesToMerge
- The classes that need to be merged.namedObjectsToMerge
- The named objects that need to be merged.IllegalActionException
- if there is a problem merging the model.NameDuplicationException
- if there is a problem merging the model.java.lang.CloneNotSupportedException
- if there is a problem merging the model.public static CompositeEntity mergeModelWithLayout(java.lang.String modelURL, java.lang.String layoutURL, java.util.HashSet<java.lang.Class<? extends Attribute>> classesToMerge, java.util.HashSet<java.lang.String> namedObjectsToMerge) throws java.net.MalformedURLException, IllegalActionException, NameDuplicationException, java.lang.CloneNotSupportedException
modelURL
- The URL to the model.layoutURL
- The URL to the layout.classesToMerge
- The classes that need to be merged.namedObjectsToMerge
- The named objects that need to be merged.java.net.MalformedURLException
- if there is a problem merging the model.IllegalActionException
- if there is a problem merging the model.NameDuplicationException
- if there is a problem merging the model.java.lang.CloneNotSupportedException
- if there is a problem merging the model.public static CompositeEntity openModelFile(java.net.URL url) throws IllegalActionException
url
- The url of the model.IllegalActionException
- If the parsing failed.public static java.lang.String stripFullName(java.lang.String fullName)
fullName
- The compound name of an element.public LayoutValidationErrors validateModelAndLayout(java.lang.String modelURL, java.lang.String layoutURL)
modelURL
- The URL of the model.layoutURL
- The URL of the layout.