Class DatapointBridge
java.lang.Object
at.ac.ait.lablink.clients.dpbridge.DatapointBridge
public class DatapointBridge extends Object
Class DatapointBridge.
-
Field Summary
Fields Modifier and Type Field Description private static StringALL_COMMENTSThe Constant ALL_COMMENTS.private Map<String,DatapointDataTypes>allDataPointsThe all data points.static StringANSI_BLACKThe Constant ANSI_BLACK.static StringANSI_BLACK_BACKGROUNDThe Constant ANSI_BLACK_BACKGROUND.static StringANSI_BLUEThe Constant ANSI_BLUE.static StringANSI_BLUE_BACKGROUNDThe Constant ANSI_BLUE_BACKGROUND.static StringANSI_CYANThe Constant ANSI_CYAN.static StringANSI_CYAN_BACKGROUNDThe Constant ANSI_CYAN_BACKGROUND.static StringANSI_GREENThe Constant ANSI_GREEN.static StringANSI_GREEN_BACKGROUNDThe Constant ANSI_GREEN_BACKGROUND.static StringANSI_PURPLEThe Constant ANSI_PURPLE.static StringANSI_PURPLE_BACKGROUNDThe Constant ANSI_PURPLE_BACKGROUND.static StringANSI_REDThe Constant ANSI_RED.static StringANSI_RED_BACKGROUNDThe Constant ANSI_RED_BACKGROUND.static StringANSI_RESETThe Constant ANSI_RESET.static StringANSI_WHITEThe Constant ANSI_WHITE.static StringANSI_WHITE_BACKGROUNDThe Constant ANSI_WHITE_BACKGROUND.static StringANSI_YELLOWThe Constant ANSI_YELLOW.static StringANSI_YELLOW_BACKGROUNDThe Constant ANSI_YELLOW_BACKGROUND.private Map<String,ConsumerBoolean>boolDataPointConsumersThe bool data point consumers.private static StringCLIENT_NAME_TAGThe Constant CLIENT_NAME_TAG.private StringclientNameThe client name.private Map<String,String>clientsUmlThe clients uml.private static StringCONFIG_FILE_NAMEThe Constant CONFIG_FILE_NAME.private StringconfigTypeprivate URLconfigUrlThe config url.private static StringDATA_POINTS_TAGThe Constant DATA_POINTS_TAG.private Map<String,ConsumerDouble>doubleDataPointConsumersThe double data point consumers.private static StringDP_CLIENT_NAME_TAGThe Constant DP_CLIENT_NAME_TAG.private static StringDP_CONNECTION_FROM_TAGThe Constant DP_CONNECTION_FROM_TAG.private static StringDP_CONNECTION_TAGThe Constant DP_CONNECTION_TAG.private static StringDP_CONNECTION_TO_TAGThe Constant DP_CONNECTION_TO_TAG.private static StringDP_DATATYPE_TAGThe Constant DP_DATATYPE_TAG.private static StringDP_GROUP_NAME_TAGThe Constant DP_GROUP_NAME_TAG.private static StringDP_ID_TAGThe Constant DP_ID_TAG.private static StringDP_IDENTIFIER_TAGThe Constant DP_IDENTIFIER_TAG.private static StringDP_NAME_TAGThe Constant DP_NAME_TAG.private static StringGROUP_NAME_TAGThe Constant GROUP_NAME_TAG.private StringgroupNameThe group name.private static StringIDENTITYThe Constant IDENTITY.private booleaninitializedThe initialized.private at.ac.ait.lablink.core.connection.ILlConnectionlabLinkThe lab link.private static StringLABLINK_AITThe Constant LABLINK_AIT.private static StringLABLINK_PROPERTIESThe Constant LABLINK_PROPERTIES.private DatapointSyncConsumerlabLinkLocalSyncConsumerThe local sync service.private at.ac.ait.lablink.core.service.sync.consumer.impl.SyncClientServiceImpllabLinkSyncServiceThe lab link sync service.private org.apache.logging.log4j.LoggerlogThe Constant LOG.private static org.apache.logging.log4j.LoggerLOGprivate Map<String,ConsumerLong>longDataPointConsumersThe long data point consumers.private StringplantUmlSourceThe plant uml source.private ThreadprintStatusThe print status.private static StringSCENARIO_NAME_TAGThe Constant SCENARIO_NAME_TAG.private StringscenarioNameThe scenario name.private at.ac.ait.lablink.core.service.datapoint.consumer.IDataPointConsumerServiceserviceConsumerThe service consumer.private static StringSIMULATOR_TAGprivate Map<String,ConsumerString>stringDataPointConsumersThe string data point consumers.private static StringUML_CONFIG_PNG_NAMEThe Constant UML_CONFIG_PNG_NAME.private static StringURL_LL_PROPERTIESThe Constant URL_LL_PROPERTIES.private static StringURL_SYNC_PROPERTIESThe Constant URL_SYNC_PROPERTIES.private StringurlLlPropertiesThe url ll properties.private StringurlSyncPropertiesThe url sync properties. -
Constructor Summary
Constructors Constructor Description DatapointBridge()Instantiates a new DatapointBridge client.DatapointBridge(String url, String type)Instantiates a new datapoint bridge. -
Method Summary
Modifier and Type Method Description private StringansiColorize(String text, String color)private voidcheckConsumerStatus()Check consumer status.private voidconfig(String url)Config.StringgetIdentity()Gets the identity.StringgetUrlLlProperties()Getter for the URL to the Lablink properties.StringgetUrlSyncProperties()Getter for the URL to the sync properties.voidinitialize()Initialize.booleanisInitialized()Checks if this instance is initialized.private voidparseConfig(String srcFileContents)private StringparseWithEnvironmentVariable(String input)Parses a config string containing an environment variable.voidpause()Pause.StringprintConfiguration()Prints the configuration.private StringreadConfigItem(org.json.simple.JSONObject jsonObj, String key)private voidreadSourcce()Read sourcce.private voidregisterBooleanConsumers()Register boolean consumers.private voidregisterConsumers()Register consumers.private voidregisterDoubleConsumers()Register double consumers.private voidregisterLongConsumers()Register long consumers.private voidregisterStringConsumers()Register string consumers.voidresume()Resume.private voidsetInitialized(boolean initialized)Sets the initialization flag.private voidsetupLablinkClient()Setup Lablink client.private voidsetUrlLlProperties(String urlLlProperties)Setter for the URL to the Lablink properties.private voidsetUrlSyncProperties(String urlSyncProperties)Setter for the URL to the sync properties.voidstart()Start.private voidstartLablink()Start Lablink.voidstop()Stop.
-
Field Details
-
ANSI_RESET
The Constant ANSI_RESET.- See Also:
- Constant Field Values
-
ANSI_BLACK
The Constant ANSI_BLACK.- See Also:
- Constant Field Values
-
ANSI_RED
The Constant ANSI_RED.- See Also:
- Constant Field Values
-
ANSI_GREEN
The Constant ANSI_GREEN.- See Also:
- Constant Field Values
-
ANSI_YELLOW
The Constant ANSI_YELLOW.- See Also:
- Constant Field Values
-
ANSI_BLUE
The Constant ANSI_BLUE.- See Also:
- Constant Field Values
-
ANSI_PURPLE
The Constant ANSI_PURPLE.- See Also:
- Constant Field Values
-
ANSI_CYAN
The Constant ANSI_CYAN.- See Also:
- Constant Field Values
-
ANSI_WHITE
The Constant ANSI_WHITE.- See Also:
- Constant Field Values
-
ANSI_BLACK_BACKGROUND
The Constant ANSI_BLACK_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_RED_BACKGROUND
The Constant ANSI_RED_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_GREEN_BACKGROUND
The Constant ANSI_GREEN_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_YELLOW_BACKGROUND
The Constant ANSI_YELLOW_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_BLUE_BACKGROUND
The Constant ANSI_BLUE_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_PURPLE_BACKGROUND
The Constant ANSI_PURPLE_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_CYAN_BACKGROUND
The Constant ANSI_CYAN_BACKGROUND.- See Also:
- Constant Field Values
-
ANSI_WHITE_BACKGROUND
The Constant ANSI_WHITE_BACKGROUND.- See Also:
- Constant Field Values
-
groupName
The group name. -
clientName
The client name. -
scenarioName
The scenario name. -
urlLlProperties
The url ll properties. -
urlSyncProperties
The url sync properties. -
labLink
private at.ac.ait.lablink.core.connection.ILlConnection labLinkThe lab link. -
serviceConsumer
private at.ac.ait.lablink.core.service.datapoint.consumer.IDataPointConsumerService serviceConsumerThe service consumer. -
labLinkSyncService
private at.ac.ait.lablink.core.service.sync.consumer.impl.SyncClientServiceImpl labLinkSyncServiceThe lab link sync service. -
labLinkLocalSyncConsumer
The local sync service. -
initialized
private boolean initializedThe initialized. -
plantUmlSource
The plant uml source. -
LABLINK_PROPERTIES
The Constant LABLINK_PROPERTIES.- See Also:
- Constant Field Values
-
LABLINK_AIT
The Constant LABLINK_AIT.- See Also:
- Constant Field Values
-
log
private org.apache.logging.log4j.Logger logThe Constant LOG. -
LOG
private static final org.apache.logging.log4j.Logger LOG -
stringDataPointConsumers
The string data point consumers. -
doubleDataPointConsumers
The double data point consumers. -
longDataPointConsumers
The long data point consumers. -
boolDataPointConsumers
The bool data point consumers. -
clientsUml
The clients uml. -
allDataPoints
The all data points. -
configUrl
The config url. -
IDENTITY
The Constant IDENTITY. -
GROUP_NAME_TAG
The Constant GROUP_NAME_TAG.- See Also:
- Constant Field Values
-
CLIENT_NAME_TAG
The Constant CLIENT_NAME_TAG.- See Also:
- Constant Field Values
-
SCENARIO_NAME_TAG
The Constant SCENARIO_NAME_TAG.- See Also:
- Constant Field Values
-
URL_LL_PROPERTIES
The Constant URL_LL_PROPERTIES.- See Also:
- Constant Field Values
-
URL_SYNC_PROPERTIES
The Constant URL_SYNC_PROPERTIES.- See Also:
- Constant Field Values
-
DATA_POINTS_TAG
The Constant DATA_POINTS_TAG.- See Also:
- Constant Field Values
-
SIMULATOR_TAG
- See Also:
- Constant Field Values
-
DP_ID_TAG
The Constant DP_ID_TAG.- See Also:
- Constant Field Values
-
DP_GROUP_NAME_TAG
The Constant DP_GROUP_NAME_TAG.- See Also:
- Constant Field Values
-
DP_CLIENT_NAME_TAG
The Constant DP_CLIENT_NAME_TAG.- See Also:
- Constant Field Values
-
DP_NAME_TAG
The Constant DP_NAME_TAG.- See Also:
- Constant Field Values
-
DP_IDENTIFIER_TAG
The Constant DP_IDENTIFIER_TAG.- See Also:
- Constant Field Values
-
DP_DATATYPE_TAG
The Constant DP_DATATYPE_TAG.- See Also:
- Constant Field Values
-
DP_CONNECTION_TAG
The Constant DP_CONNECTION_TAG.- See Also:
- Constant Field Values
-
DP_CONNECTION_FROM_TAG
The Constant DP_CONNECTION_FROM_TAG.- See Also:
- Constant Field Values
-
DP_CONNECTION_TO_TAG
The Constant DP_CONNECTION_TO_TAG.- See Also:
- Constant Field Values
-
CONFIG_FILE_NAME
The Constant CONFIG_FILE_NAME. -
UML_CONFIG_PNG_NAME
The Constant UML_CONFIG_PNG_NAME. -
ALL_COMMENTS
The Constant ALL_COMMENTS.- See Also:
- Constant Field Values
-
printStatus
The print status. -
configType
-
-
Constructor Details
-
DatapointBridge
Instantiates a new datapoint bridge.- Parameters:
url- the urltype- the type- Throws:
MalformedURLException- the malformed URL exception
-
DatapointBridge
public DatapointBridge() throws FileNotFoundException, org.json.simple.parser.ParseException, MalformedURLExceptionInstantiates a new DatapointBridge client.- Throws:
FileNotFoundException- the file not found exceptionorg.json.simple.parser.ParseException- the parse exceptionMalformedURLException- the malformed URL exception
-
-
Method Details
-
config
Config.- Parameters:
url- the url- Throws:
MalformedURLException- the malformed URL exception
-
ansiColorize
-
checkConsumerStatus
private void checkConsumerStatus()Check consumer status. -
setupLablinkClient
private void setupLablinkClient() throws org.apache.commons.configuration.ConfigurationExceptionSetup Lablink client.- Throws:
org.apache.commons.configuration.ConfigurationException- the configuration exception
-
startLablink
private void startLablink()Start Lablink. -
registerConsumers
private void registerConsumers()Register consumers. -
readConfigItem
-
readSourcce
private void readSourcce() throws org.json.simple.parser.ParseException, org.apache.commons.configuration.ConfigurationException, IOExceptionRead sourcce.- Throws:
org.json.simple.parser.ParseException- parsing exceptionorg.apache.commons.configuration.ConfigurationException- configuration exceptionIOException- signals that an I/O exception has occurred
-
parseConfig
private void parseConfig(String srcFileContents) throws org.json.simple.parser.ParseException, org.apache.commons.configuration.ConfigurationException- Throws:
org.json.simple.parser.ParseExceptionorg.apache.commons.configuration.ConfigurationException
-
registerStringConsumers
private void registerStringConsumers()Register string consumers. -
registerBooleanConsumers
private void registerBooleanConsumers()Register boolean consumers. -
registerDoubleConsumers
private void registerDoubleConsumers()Register double consumers. -
registerLongConsumers
private void registerLongConsumers()Register long consumers. -
initialize
public void initialize() throws FileNotFoundException, NullPointerException, IOException, org.json.simple.parser.ParseException, org.apache.commons.configuration.ConfigurationExceptionInitialize.- Throws:
FileNotFoundException- the file not found exceptionNullPointerException- the null pointer exceptionIOException- Signals that an I/O exception has occurred.org.json.simple.parser.ParseException- the parse exceptionorg.apache.commons.configuration.ConfigurationException- the configuration exception
-
start
public void start()Start. -
stop
public void stop()Stop. -
pause
public void pause()Pause. -
resume
public void resume()Resume. -
getIdentity
Gets the identity.- Returns:
- the identity
-
printConfiguration
Prints the configuration.- Returns:
- the string
-
isInitialized
public boolean isInitialized()Checks if this instance is initialized.- Returns:
- true, if is initialized
-
setInitialized
private void setInitialized(boolean initialized)Sets the initialization flag.- Parameters:
initialized- the new initialization status
-
getUrlLlProperties
Getter for the URL to the Lablink properties.- Returns:
- the urlLlProperties
-
setUrlLlProperties
Setter for the URL to the Lablink properties.- Parameters:
urlLlProperties- the urlLlProperties to set
-
getUrlSyncProperties
Getter for the URL to the sync properties.- Returns:
- the urlSyncProperties
-
setUrlSyncProperties
Setter for the URL to the sync properties.- Parameters:
urlSyncProperties- the urlSyncProperties to set
-
parseWithEnvironmentVariable
Parses a config string containing an environment variable.- Parameters:
input- the input- Returns:
- the string
-