at.lcm.x2c.scilab.xcos.x2cManager
Class X2cManager

java.lang.Object
  extended by at.lcm.x2c.scilab.xcos.x2cManager.X2cManager

public class X2cManager
extends java.lang.Object

Central instance to manage the working diagram etc. This class is implemented as singleton.

Author:
Martin Hochwallner

Constructor Summary
protected X2cManager()
           
 
Method Summary
 boolean communicatorConnect()
          Connects to the communicator and makes some retries (20) when connecting fails.
 boolean communicatorConnect(int retrys)
          Connects to the communicator and makes retries when connecting fails.
 void communicatorDisconnect()
           
 X2cBlock getBlock(java.lang.String[][] exprs, java.lang.String xcosBlockId, double sampletimePreset)
          Return the block from the model or generate one according to the parameter.
 X2cBlock getBlock(java.lang.String blockLabel, java.lang.String componentName, java.lang.String xcosBlockId, java.lang.String xcosModelIdentification, double sampletimePreset)
          Return the block from the model or generate one according to the parameter.
 X2cBlock getBlock(XcosExprs exprs, java.lang.String xcosBlockId, double sampletimePreset)
          Return the block from the model or generate one according to the parameter.
 X2cBlock getBlockWithDummyModel(java.lang.String componentName, double sampletimePreset)
           
 X2cBlock getBlockWithDummyModel(java.lang.String blockLabel, java.lang.String componentName, double sampletimePreset)
           
 at.lcm.x2c.gui.communicator.IRmiCommunicator getCommunicator()
          Returns RMI Communicator.
static X2cManager getInstance()
          Return the only instance of the X2cManager.
 java.lang.String getSERVICENAME_extension()
           
 boolean isCommunicatorConnected()
          Test whether a Communicator is connected and the connection alive.
 boolean isCommunicatorConnected(java.lang.String xcosModelIdentification)
          Test whether a Communicator is connected and the connection alive.
 void notifyChangeBlockMaskParameter(at.lcm.x2c.gui.communicator.RmiMaskParameterUpdateEvent event)
           
 void notifyLocalChange2Remote_BlockMaskParameter(java.lang.String componentName, java.util.List<java.lang.String> systemNames, java.lang.String blockName, java.lang.String parameter, java.lang.String value)
           
 void notifyLocalChange2Remote_BlockMaskParameter(java.lang.String componentName, java.lang.String blockName, java.lang.String parameter, java.lang.String value)
          Deprecated. 
 void openCommunicatorNew()
          Disconnects if communicator is connected and tries to connect to the communicator via a RMI communication in order to enable communicator methods within the Scilab JVM.
 void resetModel()
          Make a reset so that the model is not known to the Manager anymore.
 void setCurrentDiagram()
          Set the currently open XcosDiagram as the "work" or "active" or "current" diagram in the X2cManager.
 void setSERVICENAME_extension(java.lang.String sERVICENAME_extension)
           
 java.lang.String toString()
           
 void updateModel()
          Transforms the xcos model in a x2c model and starts the communicator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

X2cManager

protected X2cManager()
Method Detail

getInstance

public static X2cManager getInstance()
Return the only instance of the X2cManager.

Returns:
the only instance of the X2cManager

setCurrentDiagram

public void setCurrentDiagram()
                       throws java.lang.Exception
Set the currently open XcosDiagram as the "work" or "active" or "current" diagram in the X2cManager. There has to be one and exactly one diagram open at that time.

Throws:
java.lang.Exception

updateModel

public void updateModel()
                 throws java.lang.Exception
Transforms the xcos model in a x2c model and starts the communicator.

Throws:
java.lang.Exception

resetModel

public void resetModel()
Make a reset so that the model is not known to the Manager anymore.


getBlock

public X2cBlock getBlock(java.lang.String[][] exprs,
                         java.lang.String xcosBlockId,
                         double sampletimePreset)
                  throws java.lang.Exception
Return the block from the model or generate one according to the parameter. The current model is existing and containing the block asked for: return the block else: generate one This method is specially meant to be used from Scilab.

Parameters:
exprs -
xcosBlockId -
sampletimePreset -
Returns:
the block
Throws:
java.lang.Exception

getBlock

public X2cBlock getBlock(XcosExprs exprs,
                         java.lang.String xcosBlockId,
                         double sampletimePreset)
                  throws X2cEnvironmentScilabException
Return the block from the model or generate one according to the parameter.
The current model is existing and containing the block asked for: return the block else: generate one This method is specially meant to be used from Scilab.

Parameters:
exprs - Xcos expressions
xcosBlockId - Xcos block identifier
sampletimePreset - Sample time preset
Returns:
X2C block
Throws:
X2cEnvironmentScilabException

getBlock

public X2cBlock getBlock(java.lang.String blockLabel,
                         java.lang.String componentName,
                         java.lang.String xcosBlockId,
                         java.lang.String xcosModelIdentification,
                         double sampletimePreset)
                  throws java.lang.Exception
Return the block from the model or generate one according to the parameter. The current model is existing and containing the block asked for: return the block else: generate one

Parameters:
blockLabel -
componentName -
xcosBlockId -
xcosModelIdentification -
sampletimePreset -
Returns:
X2cBlock
Throws:
java.lang.Exception

getBlockWithDummyModel

public X2cBlock getBlockWithDummyModel(java.lang.String componentName,
                                       double sampletimePreset)
                                throws java.lang.Exception
Throws:
java.lang.Exception

getBlockWithDummyModel

public X2cBlock getBlockWithDummyModel(java.lang.String blockLabel,
                                       java.lang.String componentName,
                                       double sampletimePreset)
                                throws java.lang.Exception
Throws:
java.lang.Exception

getCommunicator

public at.lcm.x2c.gui.communicator.IRmiCommunicator getCommunicator()
                                                             throws java.rmi.RemoteException
Returns RMI Communicator.

Returns:
RMI Communicator
Throws:
java.rmi.RemoteException

openCommunicatorNew

public void openCommunicatorNew()
                         throws java.lang.Exception
Disconnects if communicator is connected and tries to connect to the communicator via a RMI communication in order to enable communicator methods within the Scilab JVM. This method is called from Scilab JVM indirectly with communicatorConnect(), in order to connect to the RMI server. RMI server is started in the main method of X2cCommuniatorManagerRMI.java, which runs within the X2C-JVM

Throws:
java.lang.Exception

communicatorConnect

public boolean communicatorConnect()
Connects to the communicator and makes some retries (20) when connecting fails.

Returns:
true if connecting was successful

communicatorConnect

public boolean communicatorConnect(int retrys)
Connects to the communicator and makes retries when connecting fails.

Returns:
true if connecting was successful

communicatorDisconnect

public void communicatorDisconnect()

isCommunicatorConnected

public boolean isCommunicatorConnected()
Test whether a Communicator is connected and the connection alive.


isCommunicatorConnected

public boolean isCommunicatorConnected(java.lang.String xcosModelIdentification)
Test whether a Communicator is connected and the connection alive.


getSERVICENAME_extension

public java.lang.String getSERVICENAME_extension()
Returns:
the sERVICENAME_extension

setSERVICENAME_extension

public void setSERVICENAME_extension(java.lang.String sERVICENAME_extension)
Parameters:
sERVICENAME_extension - the sERVICENAME_extension to set

notifyLocalChange2Remote_BlockMaskParameter

@Deprecated
public void notifyLocalChange2Remote_BlockMaskParameter(java.lang.String componentName,
                                                                   java.lang.String blockName,
                                                                   java.lang.String parameter,
                                                                   java.lang.String value)
                                                 throws java.lang.Exception
Deprecated. 

Throws:
java.lang.Exception

notifyLocalChange2Remote_BlockMaskParameter

public void notifyLocalChange2Remote_BlockMaskParameter(java.lang.String componentName,
                                                        java.util.List<java.lang.String> systemNames,
                                                        java.lang.String blockName,
                                                        java.lang.String parameter,
                                                        java.lang.String value)
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

notifyChangeBlockMaskParameter

public void notifyChangeBlockMaskParameter(at.lcm.x2c.gui.communicator.RmiMaskParameterUpdateEvent event)
                                    throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 2019 LCM. All rights reserved.