Package org.cdp1802.xpl

Examples of org.cdp1802.xpl.xPL_MutableMessageI


    List<String> matching = new ArrayList<String>();
   
    if (theMessage.getType()  != xPL_MessageI.MessageType.COMMAND) {              // the message must not be is not a xpl-cmnd
      for (String key: bindingConfigs.keySet()) {
        XplBindingConfig config = (XplBindingConfig) bindingConfigs.get(key);
        NamedValuesI theBody = config.Message.getMessageBody();
        if ( (theBody !=  null) &&   (!theBody.isEmpty()) &&
          (config.Message.getTarget().isBroadcastIdentifier() || config.Message.getTarget().equals(theMessage.getSource()))  &&
          config.Message.getSchemaClass().equalsIgnoreCase(theMessage.getSchemaClass()) &&
          config.Message.getSchemaType().equalsIgnoreCase(theMessage.getSchemaType())          
          )
        {     
          boolean bodyMatched = true;                 
          for(NamedValueI theValue: theBody.getAllNamedValues()) {            // iterate through the item body to
            String aKey = theValue.getName();                      // see if ...
            String aValue = theValue.getValue();
            String bValue = theMessage.getNamedValue(aKey);
            boolean  lineMatched = (bValue != null) && (
                      aKey.equalsIgnoreCase(config.NamedParameter) ||
View Full Code Here


      @ParamDoc(name="bodyElements") String ... bodyElements
          )
  {   
    xPL_MutableMessageI theMessage  = xPL_Utils.createMessage();
   
      xPL_IdentifierI targetIdentifier = xplTransportService.parseNamedIdentifier(target);
    if (targetIdentifier == null) {
      logger.error("Invalid target identifier");
      return false;
    }
     
View Full Code Here

      @ParamDoc(name="msgType") String msgType,
      @ParamDoc(name="schema") String schema,     
      @ParamDoc(name="bodyElements") String ... bodyElements
          )
  {   
    xPL_MutableMessageI theMessage  = xPL_Utils.createMessage();
   
      xPL_IdentifierI targetIdentifier = xplTransportService.parseNamedIdentifier(target);
    if (targetIdentifier == null) {
      logger.error("Invalid target identifier");
      return false;
    }
     
      theMessage.setTarget(targetIdentifier);
     
      // Parse type
      if (msgType.equalsIgnoreCase("TRIGGER"))
        theMessage.setType(xPL_MessageI.MessageType.TRIGGER);
      else if (msgType.equalsIgnoreCase("STATUS"))
        theMessage.setType(xPL_MessageI.MessageType.STATUS);
      else if (msgType.equalsIgnoreCase("COMMAND"))
        theMessage.setType(xPL_MessageI.MessageType.COMMAND);
      else {
      logger.error("Invalid message type");
      return false;
    }

      // Parse Schema
      int delimPtr = schema.indexOf(".");
    if (delimPtr == -1) {
      logger.error("Invalid/improperly formatted schema class.type");
      return false;
    }
   
      String schemaClass = schema.substring(0, delimPtr);
      String schemaType = schema.substring(delimPtr + 1);
      if ((schemaClass.length() == 0) || (schemaType.length() == 0)) {
      logger.error("Empty/missing parts of schema class.type");
      return false;
    }
     
      theMessage.setSchema(schemaClass, schemaType);
     
      // Parse name/value pairs     
      String theName = null;
      String theValue = null;
      theMessage.clearMessageBody();
     
      for (int pairPtr = 0; pairPtr < bodyElements.length; pairPtr++) {
        if ((delimPtr = bodyElements[pairPtr].indexOf("=")) == -1) {
        logger.error("Invalid message body name/value pair");
        return false;
        }
        if ((theName = bodyElements[pairPtr].substring(0, delimPtr)).length() == 0) {
        logger.error("Empty name in message body name/value pair");
        return false;
        }
       
        theValue = bodyElements[pairPtr].substring(delimPtr + 1);

        theMessage.addNamedValue(theName, theValue);
      }
     
      xplTransportService.sendMessage(theMessage);
     
    return true;
View Full Code Here

TOP

Related Classes of org.cdp1802.xpl.xPL_MutableMessageI

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.