hu.soft4d.minerva.ssm
Class SSMFactory

java.lang.Object
  extended by hu.soft4d.minerva.ssm.SSMFactory
Direct Known Subclasses:
WSDLSSMFactory, XmiUMLSSMFactory

public abstract class SSMFactory
extends java.lang.Object

Factory class for generating a SymbolicTransitionSystem, if a WSDL/SSM schema definition URL or an UML definition is given.

Intended usage of this class is:

    SSMFactory ssmf = SSMFactory.getFactoryFromWSDL(URL wsdlURL, URL spssmURL, 
                               String serviceName, String portName);
    // or
    SSMFactory ssmf = SSMFactory.getFactoryFromUML(String modelFileName, String ssmName);
    
    SymbolicTransitionSystem ssm = ssmf.getSSM();
  

Known subclasses are: WSDLSSMFactory and XmiUMLSSMFactory.

Author:
Zsolt Kiss Gere, 4D Soft Ltd.

Field Summary
protected  java.lang.String initialState
           
protected  java.util.Map<java.lang.String,stsimulator.sts.InteractionVariable> intvarMap
           
protected  java.util.Map<java.lang.String,stsimulator.sts.Location> locationMap
           
protected  java.util.Map<java.lang.String,stsimulator.sts.LocationVariable> locvarMap
           
protected  java.util.Map<java.lang.String,stsimulator.sts.Message> messageMap
           
protected  java.lang.String namespace
           
protected  java.util.Map<java.lang.String,stsimulator.sts.Operation> operationMap
           
protected  stsimulator.sts.Port port
           
protected  java.lang.String portName
           
protected  stsimulator.sts.Service service
           
protected  java.lang.String serviceName
           
protected  java.util.List<stsimulator.sts.Switch> switchList
           
protected  java.util.Map<javax.xml.namespace.QName,stsimulator.types.Type> typeMap
           
protected  java.lang.String wsdlUri
           
 
Constructor Summary
SSMFactory()
           
 
Method Summary
protected  stsimulator.sts.Message createSSMMessage(UmlTransition trans, UmlOperation operation)
          Containers used in read/write mode: ssmTypes, intvarMap and operationMap
protected  stsimulator.sts.Switch createSwitch(UmlTransition trans)
          Creates an sts Switch from an UmlTransition.
 void dumpSSM(java.io.PrintStream out)
           
protected  stsimulator.sts.InteractionVariable getCreateInteractionVariable(java.lang.String name, stsimulator.types.Type type)
          If an interaction variable with the given (name, type) exists in the intvarMap, return it.
protected  stsimulator.sts.LocationVariable getCreateLocationVariable(java.lang.String name, stsimulator.types.Type type)
          If a location variable with the given name exists in the locvarMap, return it.
protected  stsimulator.sts.Operation getCreateSSMOperation(java.lang.String name, stsimulator.sts.OperationKind kind)
          Check if an ssm operation is stored under the key name.
protected  stsimulator.types.Type getCreateSSMType(UmlParameter parameter, java.util.Map<javax.xml.namespace.QName,stsimulator.types.Type> typeMap)
          Get the SSM type corresponding to the type of the UmlParameter parameter.
static SSMFactory getFactoryFromUML(java.lang.String modelFileName, java.lang.String ssmName)
           
static SSMFactory getFactoryFromWSDL(java.lang.String wsdlUri, java.lang.String spssmUri, java.lang.String serviceName, java.lang.String portName)
           
 java.lang.String getInitialState()
           
 java.util.Map<java.lang.String,stsimulator.sts.InteractionVariable> getIntvarMap()
           
 java.util.Map<java.lang.String,stsimulator.sts.Location> getLocationMap()
           
 java.util.Map<java.lang.String,stsimulator.sts.LocationVariable> getLocvarMap()
           
 java.util.Map<java.lang.String,stsimulator.sts.Message> getMessageMap()
           
 java.lang.String getNamespace()
           
 java.util.Map<java.lang.String,stsimulator.sts.Operation> getOperationMap()
           
 stsimulator.sts.Port getPort()
           
 java.lang.String getPortName()
           
 stsimulator.sts.Service getService()
           
 java.lang.String getServiceName()
           
 stsimulator.sts.SymbolicTransitionSystem getSSM()
           
 java.util.List<stsimulator.sts.Switch> getSwitchList()
           
 java.util.Map<javax.xml.namespace.QName,stsimulator.types.Type> getTypeMap()
           
protected  java.lang.String getVarKey(java.lang.String name, stsimulator.types.Type type)
           
 java.lang.String getWsdlUri()
           
protected  void initFromStateMachine(UmlStateMachine mystm)
          Fill the containers from an UmlStateMachine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wsdlUri

protected java.lang.String wsdlUri

namespace

protected java.lang.String namespace

serviceName

protected java.lang.String serviceName

portName

protected java.lang.String portName

service

protected stsimulator.sts.Service service

port

protected stsimulator.sts.Port port

initialState

protected java.lang.String initialState

locationMap

protected java.util.Map<java.lang.String,stsimulator.sts.Location> locationMap

switchList

protected java.util.List<stsimulator.sts.Switch> switchList

locvarMap

protected java.util.Map<java.lang.String,stsimulator.sts.LocationVariable> locvarMap

intvarMap

protected java.util.Map<java.lang.String,stsimulator.sts.InteractionVariable> intvarMap

messageMap

protected java.util.Map<java.lang.String,stsimulator.sts.Message> messageMap

operationMap

protected java.util.Map<java.lang.String,stsimulator.sts.Operation> operationMap

typeMap

protected java.util.Map<javax.xml.namespace.QName,stsimulator.types.Type> typeMap
Constructor Detail

SSMFactory

public SSMFactory()
Method Detail

getFactoryFromWSDL

public static SSMFactory getFactoryFromWSDL(java.lang.String wsdlUri,
                                            java.lang.String spssmUri,
                                            java.lang.String serviceName,
                                            java.lang.String portName)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getFactoryFromUML

public static SSMFactory getFactoryFromUML(java.lang.String modelFileName,
                                           java.lang.String ssmName)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

getSSM

public stsimulator.sts.SymbolicTransitionSystem getSSM()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

initFromStateMachine

protected void initFromStateMachine(UmlStateMachine mystm)
                             throws java.lang.Exception
Fill the containers from an UmlStateMachine.

Throws:
java.lang.Exception

getCreateSSMOperation

protected stsimulator.sts.Operation getCreateSSMOperation(java.lang.String name,
                                                          stsimulator.sts.OperationKind kind)
Check if an ssm operation is stored under the key name. If yes, return it. Otherwise create a new operation, store and return it.


getCreateLocationVariable

protected stsimulator.sts.LocationVariable getCreateLocationVariable(java.lang.String name,
                                                                     stsimulator.types.Type type)
If a location variable with the given name exists in the locvarMap, return it. Otherwise create a new location variable, record it in the map and return it.


getCreateInteractionVariable

protected stsimulator.sts.InteractionVariable getCreateInteractionVariable(java.lang.String name,
                                                                           stsimulator.types.Type type)
If an interaction variable with the given (name, type) exists in the intvarMap, return it. Otherwise create a new interaction variable, record it in the map and return it.


getCreateSSMType

protected stsimulator.types.Type getCreateSSMType(UmlParameter parameter,
                                                  java.util.Map<javax.xml.namespace.QName,stsimulator.types.Type> typeMap)
                                           throws java.lang.Exception
Get the SSM type corresponding to the type of the UmlParameter parameter. Recursive method. Uses typeMap for cache.

Throws:
java.lang.Exception

createSwitch

protected stsimulator.sts.Switch createSwitch(UmlTransition trans)
                                       throws java.lang.Exception
Creates an sts Switch from an UmlTransition. An sts message, with all its dependencies is also created if needed.

The following containers are filled/used when creating a switch: messageMap, ssmTypes, intvarMap and operationMap.

locationMap is only used in read mode.

Throws:
java.lang.Exception

createSSMMessage

protected stsimulator.sts.Message createSSMMessage(UmlTransition trans,
                                                   UmlOperation operation)
                                            throws java.lang.Exception
Containers used in read/write mode: ssmTypes, intvarMap and operationMap

Throws:
java.lang.Exception

getVarKey

protected java.lang.String getVarKey(java.lang.String name,
                                     stsimulator.types.Type type)

dumpSSM

public void dumpSSM(java.io.PrintStream out)

getInitialState

public java.lang.String getInitialState()

getIntvarMap

public java.util.Map<java.lang.String,stsimulator.sts.InteractionVariable> getIntvarMap()

getLocationMap

public java.util.Map<java.lang.String,stsimulator.sts.Location> getLocationMap()

getLocvarMap

public java.util.Map<java.lang.String,stsimulator.sts.LocationVariable> getLocvarMap()

getMessageMap

public java.util.Map<java.lang.String,stsimulator.sts.Message> getMessageMap()

getNamespace

public java.lang.String getNamespace()

getOperationMap

public java.util.Map<java.lang.String,stsimulator.sts.Operation> getOperationMap()

getPort

public stsimulator.sts.Port getPort()

getPortName

public java.lang.String getPortName()

getService

public stsimulator.sts.Service getService()

getServiceName

public java.lang.String getServiceName()

getSwitchList

public java.util.List<stsimulator.sts.Switch> getSwitchList()

getTypeMap

public java.util.Map<javax.xml.namespace.QName,stsimulator.types.Type> getTypeMap()

getWsdlUri

public java.lang.String getWsdlUri()