/* * Dassault Aviation confidential * Copyright (c) 2019 Dassault Aviation. All rights reserved. * * This file is part of the protoframework project. * * NOTICE: All information contained herein is, and remains the property of Dassault Aviation. * The intellectual and technical concepts contained herein are proprietary to Dassault Aviation, * and are protected by trade secret or copyright law. * Unauthorized copying of this file, via any medium, is strictly prohibited. * It can not be copied and/or distributed, in source or binary form, without the express permission of * Dassault Aviation. */ package org.da.testcustom.python; import org.da.protoframework.custom.CustomModuleDefinition; import org.da.protoframework.model.def.ApplicationDefinition; /** * The custom definition for a Python Module. * * @since 0.6.12 */ public class CustomPythonModuleDefinition extends CustomModuleDefinition implements CustomModuleParameters { private int sendingPort = -1; private int receivingPort = -1; private int sendingSize = -1; private int receivingSize = -1; private final static String SEPARATOR = "^"; private final static int WAIT_AT_START = 2000; private final static int WAIT_AT_INIT = 500; private final static int WAIT = 10; private final static int QUEUE_SIZE = 10; /** * Constructor. * * @param factory the custom module factory * @param appli the application definition * @param name the module name * @param id the module ID */ public CustomPythonModuleDefinition(CustomPythonModuleFactory factory, ApplicationDefinition appli, String name, long id) { super(factory, appli, name, id); } @Override public void setModuleParameter(String key, Object value) { if (key.equals(SENDING_PORT)) { sendingPort = (Integer) value; } else if (key.equals(SENDING_SIZE)) { sendingSize = (Integer) value; } else if (key.equals(RECEIVING_PORT)) { receivingPort = (Integer) value; } else if (key.equals(RECEIVING_SIZE)) { receivingSize = (Integer) value; } } /** * Return the character used to separate values in a message. * * @return the character */ public String getSeparator() { return SEPARATOR; } /** * Return the duration in ms to apply when beginning the dialog with the python application. * * @return the duration in ms */ public int getWaitAtStartMS() { return WAIT_AT_START; } /** * Return the duration in ms to apply when beginning the dialog with the python application. * * @return the duration in ms */ public int getWaitAtInitMS() { return WAIT_AT_INIT; } /** * Return the duration in ms to apply between two sendings to the python application. * * @return the duration in ms */ public int getWaitMS() { return WAIT; } /** * Return the queue size for sending to the python application. * * @return the queue size */ public int getQueueSize() { return QUEUE_SIZE; } /** * Return the port from Java to Python. * * @return the port from Java to Python */ public int getSendingPort() { return sendingPort; } /** * Return the port from Python to Java. * * @return the port from Python to Java */ public int getReceivingPort() { return receivingPort; } /** * Return the size of the port from Java to Python. * * @return the size of the port from Java to Python */ public int getSendingSize() { return sendingSize; } /** * Return the size of the port from Python to Java. * * @return the size of the port from Python to Java */ public int getReceivingSize() { return receivingSize; } }