Package org.jitterbit.integration.server.data

Examples of org.jitterbit.integration.server.data.DataElement


            long msgId = msgDb.insertIncomingProcessMsg("me", "you", "subject", "processName", "taskName", 5, 1);
            System.out.print("MsgId=");
            System.out.println(msgId);

            double d = 123.4567;
            DataElement de = new DataElement(d);
            msgDb.insertProcessDataElement(msgId, "myDouble", de);
            de = new DataElement("Some String");
            msgDb.insertProcessDataElement(msgId, "myString", de);

            msgDb.flagMessageForExecution(msgId);
            KongaDbUtils.close(conn, true);
            conn = null;
View Full Code Here


            // Insert headers/properties as operation data elements (identified by SessionID)
            Map<String, DataElement> deMap = JmsPropertyUtils.mergeHeadersAndProperties(headers, properties,
                            "jms.header.in.", "jms.property.in.");

            // Also insert the base file name for payload/properties.
            deMap.put("__JmsBaseFileName", new DataElement(baseFileName));

            idbConnection = ServerDbInfo.getIDbConnectionInfo().getConnection();
            idbConnection.setAutoCommit(false);
            OperationDataElementManager deMgr = new OperationDataElementManager(idbConnection);
            int sessionId = deMgr.addDataElements(deMap);

            // Insert new message
            msgDbConnection = ServerDbInfo.getMsgDbConnectionInfo().getConnection();
            msgDbConnection.setAutoCommit(false);
            MsgDb msgDb = new MsgDb(msgDbConnection);
            long msgId = msgDb.insertIncomingProcessMsg(this.getClass().getName(), "Process Engine",
                            "Incoming JMS Message", "Interchange", "1", Priority.MSG_PRIORITY_NORMAL.toInt(), 1);

            // Associate with the SessionId.
            msgDb.insertProcessDataElement(msgId, "__SessionID", new DataElement(sessionId));

            // Associate with the OperationId.
            msgDb.insertProcessDataElement(msgId, "OperationID", new DataElement((int) operationId));

            // Tell the engine to execute and commit.
            msgDb.flagMessageForExecution(msgId);
            idbConnection.commit();
            msgDbConnection.commit();
View Full Code Here

        Map<String, DataElement> messageProps = Maps.newHashMap();
        try {
            stmt = msgDb.createStatement();
            rows = stmt.executeQuery(sql);
            while (rows.next()) {
                DataElement de = new DataElement(DataElement.Type.fromString(rows.getString(2)), rows.getString(3));
                messageProps.put(rows.getString(1), de);
            }
        } catch (SQLException ex) {
            throw new JmsServerException("Failed to read the properties for the message with id " + id, ex);
        } finally {
View Full Code Here

    int priority = defaultPriority;
    long timeToLive = defaultTimeToLive;
   
    for(Map.Entry<String, DataElement> entry : props.entrySet() ) {
      String propName = entry.getKey();
      DataElement value = entry.getValue();
      final String headerPrefix = "jms.header.out.";
      final String propertyPrefix = "jms.property.out.";
      if( propName.startsWith(headerPrefix) ) {
        String headerName = propName.substring(headerPrefix.length());
        if ( headerName.equalsIgnoreCase(JmsHeader.JmsDeliveryMode.getName()) ) {
          deliveryMode = value.toInt();
          if ( deliveryMode != DeliveryMode.NON_PERSISTENT && deliveryMode != DeliveryMode.PERSISTENT)
            deliveryMode = defaultDeliveryMode;
        }
        else if ( headerName.equalsIgnoreCase(JmsHeader.JmsPriority.getName())) {
          priority = value.toInt();
          if ( priority < 0 || priority > 9 )
            priority = defaultPriority;
        }
        else if ( headerName.equalsIgnoreCase("JMSTimeToLive") ) {
          timeToLive = value.toLong();
          if ( timeToLive < 0 )
            timeToLive = defaultTimeToLive;
        }
      }
      else if( propName.startsWith(propertyPrefix) ) {
        propName = propName.substring(propertyPrefix.length());
        switch( value.getType() ) {
        case DATE: msg.setLongProperty(propName, ((Date)value.getValue()).getTime()); break;
        default: msg.setObjectProperty(propName, value.getValue());
       
      }
    }
   
    return new SpecialJmsHeaders(deliveryMode, priority, timeToLive);
View Full Code Here

  }
 
  public void setHeadersFromMessage(Message message) throws JMSException {
    String s = message.getJMSCorrelationID();
    if ( s != null )
      headers.put(JmsHeader.JmsCorrelationId, new DataElement(s));
   
    int i = message.getJMSDeliveryMode();
    headers.put(JmsHeader.JmsDeliveryMode, new DataElement(i));
   
    Destination dest = message.getJMSDestination();
    addDestination(JmsHeader.JmsDestination, dest);
   
    long l = message.getJMSExpiration();
    headers.put(JmsHeader.JmsExpiration, new DataElement(l));
   
    s = message.getJMSMessageID();
    headers.put(JmsHeader.JmsMessageID, new DataElement(s));
   
    i = message.getJMSPriority();
    headers.put(JmsHeader.JmsPriority, new DataElement(i));
   
    boolean b = message.getJMSRedelivered();
    headers.put(JmsHeader.JmsRedelivered, new DataElement(b));
   
    dest = message.getJMSReplyTo();
    addDestination(JmsHeader.JmsReplyTo, dest);
   
    l = message.getJMSTimestamp();
    headers.put(JmsHeader.JmsTimestamp, new DataElement(l));
   
    s = message.getJMSType();
    if ( s != null )
      headers.put(JmsHeader.JmsType, new DataElement(s));
  }
View Full Code Here

            if (name.length() == 0)
                continue;
            Object o = message.getObjectProperty(name);
            if (o == null)
                continue;
            DataElement value = new DataElement(o);
            properties.put(name, value);

        }
        this.properties = properties;
    }
View Full Code Here

      JmsHeaders headers, JmsProperties properties,
      String headerPrefix, String propertyPrefix) {
    Map<String, DataElement> deMap = Maps.newHashMap();
    Set<JmsHeader> headerSet = headers.getDefinedHeaders();
    for ( JmsHeader header : headerSet ) {
      DataElement de = headers.getHeader(header);
      deMap.put(headerPrefix+header.toString(), de);
    }
   
    Set<String> propertySet = properties.getPropertyNames();
    for ( String name : propertySet ) {
      DataElement de = properties.getProperty(name);
      deMap.put(propertyPrefix+name, de);
    }
    return deMap;
  }
View Full Code Here

    builder.addElement(ROOT);

    builder.addElement(HEADERS);
    Set<JmsHeader> headers = jmsHeaders.getDefinedHeaders();
    for ( JmsHeader header : headers ) {
      DataElement de = jmsHeaders.getHeader(header);
      builder.addElement(HEADER);
      builder.addAttribute(TYPE, de.getType().toString());
      builder.addAttribute(NAME, header.getName());
      builder.setElementValue(de.toString());
      builder.closeElement();
    }
    builder.closeElement();

    builder.addElement(PROPERTIES);
    Set<String> properties = jmsProperties.getPropertyNames();
    for (String name : properties) {
      DataElement de = jmsProperties.getProperty(name);
      builder.addElement(PROPERTY);
      builder.addAttribute(TYPE, de.getType().toString());
      builder.addAttribute(NAME, name);
      builder.setElementValue(de.toString());
      builder.closeElement();
    }
    builder.closeAllElements();
   
    FileWriter fileWriter = null;
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.server.data.DataElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.