Exemplo n.º 1
0
  public void clearExternalXSDs() {
    if (m_params == null) return;

    for (int i = 0; i < m_params.size(); i++) {
      Param param = (Param) m_params.get(i);

      if (param.getParamName().startsWith("External_")) removeParam(param);
    }
  }
Exemplo n.º 2
0
  /**
   * This method tests whether this object of <code>InPort</code> has the required(mandatory) fields
   * set, before inserting values in the database.
   *
   * @exception FioranoException if the object is not valid
   * @since Tifosi2.0
   */
  public void validate() throws FioranoException {
    if (m_strPortName == null) {
      throw new FioranoException(DmiErrorCodes.ERR_INVALID_ARGUMENT_ERROR);
    }

    if (m_params != null) {
      Enumeration _enum = m_params.elements();

      while (_enum.hasMoreElements()) {
        Param param = (Param) _enum.nextElement();

        param.validate();
      }
    }
  }
Exemplo n.º 3
0
  /**
   * Parses a method parameter type definition
   *
   * @param docParameter
   * @param paramComment
   * @return
   */
  protected static Param ParseParameter(Parameter docParameter, ParamTag paramComment) {
    assert (docParameter != null);

    Param xmlParameter = new Param();
    xmlParameter.name = docParameter.name();

    xmlParameter.type = ParseType(docParameter.type());

    if (paramComment != null) {
      xmlParameter.comment = paramComment.parameterComment();
    }

    xmlParameter.annotationInstances =
        ParseAnnotationInstances(docParameter.annotations(), docParameter.typeName());
    return xmlParameter;
  }
Exemplo n.º 4
0
  /**
   * Gets the extNamespaces attribute of the InPort object
   *
   * @return The extNamespaces value
   */
  public Enumeration getExtNamespaces() {
    Vector v = new Vector();
    int length = "External_".length();

    int size = m_params.size();

    for (int i = 0; i < size; i++) {
      Param param = (Param) m_params.get(i);

      if (param.getParamName().startsWith("External_")) {
        v.add(param.getParamName().substring(length));
      }
    }

    return v.elements();
  }
Exemplo n.º 5
0
  /**
   * Retruns the xml string equivalent of this object
   *
   * @param document instance of Xml Document.
   * @return org.w3c.dom.Node
   * @exception FioranoException thrown in case of error.
   */
  protected Node toJXMLString(Document document) throws FioranoException {
    Node root0 = document.createElement("InPort");

    ((Element) root0).setAttribute("isSyncRequestType", "" + isSyncRequestType());

    Node child = null;

    child = XMLDmiUtil.getNodeObject("Name", m_strPortName, document);
    if (child != null) {
      root0.appendChild(child);
    }

    child = XMLDmiUtil.getNodeObject("Description", m_strDscription, document);
    if (child != null) {
      root0.appendChild(child);
    }

    if (m_strXSD != null) {
      Element elem = document.createElement("XSD");
      CDATASection cdata = document.createCDATASection(m_strXSD);

      elem.appendChild(cdata);
      root0.appendChild(elem);
    }

    child = XMLDmiUtil.getNodeObject("JavaClass", m_strJavaClass, document);
    if (child != null) {
      root0.appendChild(child);
    }

    if (m_params != null && m_params.size() > 0) {
      Enumeration _enum = m_params.elements();

      while (_enum.hasMoreElements()) {
        Param param = (Param) _enum.nextElement();
        if (!StringUtil.isEmpty(param.getParamName())
            && !StringUtil.isEmpty(param.getParamValue())) {
          Node paramNode = param.toJXMLString(document);

          root0.appendChild(paramNode);
        }
      }
    }

    return root0;
  }
Exemplo n.º 6
0
  /**
   * This is called to read this object <code>InPort</code> from the specified object of input
   * stream.
   *
   * @param is DataInput object
   * @param versionNo Description of the Parameter
   * @exception IOException if an error occurs while reading bytes or while converting them into
   *     specified Java primitive type.
   * @since Tifosi2.0
   */
  public void fromStream(DataInput is, int versionNo) throws IOException {
    super.fromStream(is, versionNo);

    m_strPortName = readUTF(is);
    m_strDscription = readUTF(is);
    m_strXSD = readUTF(is);
    m_strJavaClass = readUTF(is);
    m_bIsSyncRequestType = is.readBoolean();

    int size = is.readInt();

    for (int i = 0; i < size; ++i) {
      Param param = new Param();

      param.fromStream(is, versionNo);
      m_params.addElement(param);
    }
  }
Exemplo n.º 7
0
  /**
   * This interface method is called to set all the fieldValues of this object of <code>InPort
   * </code>, using the specified XML string.
   *
   * @param port The new fieldValues value
   * @exception FioranoException if an error occurs while parsing the XMLString
   * @since Tifosi2.0
   */
  public void setFieldValues(Element port) throws FioranoException {
    //        Document doc = XMLUtils.getDOMDocumentFromXML(xmlString);
    //        Element port = doc.getDocumentElement();

    if (port != null) {
      m_bIsSyncRequestType = XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType");

      NodeList children = port.getChildNodes();
      Node child = null;

      for (int i = 0; children != null && i < children.getLength(); ++i) {
        child = children.item(i);

        String nodeName = child.getNodeName();

        if (nodeName.equalsIgnoreCase("Name")) {
          m_strPortName = XMLUtils.getNodeValueAsString(child).toUpperCase();
        }

        if (nodeName.equalsIgnoreCase("Description")) {
          m_strDscription = XMLUtils.getNodeValueAsString(child);
        }

        if (nodeName.equalsIgnoreCase("XSD")) {
          m_strXSD = XMLUtils.getNodeValueAsString(child);
        }

        if (nodeName.equalsIgnoreCase("JavaClass")) {
          m_strJavaClass = XMLUtils.getNodeValueAsString(child);
        }

        if (nodeName.equalsIgnoreCase("Param")) {
          Param paramDmi = new Param();

          paramDmi.setFieldValues((Element) child);
          addParam(paramDmi);
        }
      }
    }
    validate();
  }
Exemplo n.º 8
0
  /**
   * This method is called to write this object of <code>InPort</code> to the specified output
   * stream object.
   *
   * @param out DataOutput object
   * @param versionNo Description of the Parameter
   * @exception IOException if an error occurs while converting data and writing it to a binary
   *     stream.
   * @since Tifosi2.0
   */
  public void toStream(DataOutput out, int versionNo) throws IOException {
    super.toStream(out, versionNo);

    writeUTF(out, m_strPortName);
    writeUTF(out, m_strDscription);
    writeUTF(out, m_strXSD);
    writeUTF(out, m_strJavaClass);
    out.writeBoolean(m_bIsSyncRequestType);

    if (m_params != null && m_params.size() > 0) {
      int num = m_params.size();

      out.writeInt(num);
      for (int i = 0; i < num; ++i) {
        Param param = (Param) m_params.elementAt(i);

        param.toStream(out, versionNo);
      }
    } else {
      out.writeInt(0);
    }
  }
Exemplo n.º 9
0
 /**
  * Sets the paramValue attribute of the InPort object
  *
  * @param name The new paramValue value
  * @param value The new paramValue value
  */
 public void setParamValue(String name, String value) {
   Param.setParamValue(m_params, name, value);
 }
Exemplo n.º 10
0
 /**
  * Gets the paramValue attribute of the InPort object
  *
  * @param name Description of the Parameter
  * @return The paramValue value
  */
 public String getParamValue(String name) {
   return Param.getParamValue(m_params, name);
 }
Exemplo n.º 11
0
 /**
  * Gets the paramWithName attribute of the InPort object
  *
  * @param name Description of the Parameter
  * @return The paramWithName value
  */
 public Param getParamWithName(String name) {
   return Param.getParamWithName(m_params, name);
 }