Method for wrapping the handler of the postmessage for parsing
@param {Object} mapping - the handler for incoming messages to invoke which maps the message to event
@returns {Function} handler function for messages
@private
549966
function _createMessageHandler(mapping) {
                return function(message) {
                    var handler;
                    var result;
                    var params;
                    var retMsg;
                    var id;
                    var name;
                    var args;

                    if (message) {
                        id = message.method && message.method.id;
                        name = message.method && message.method.name;
                        args = message.method && message.method.args;

                        // In case the message is a return value from a request/response call
                        // It is marked as a "return" message and we need to call the supplied cached callback
                        if (ACTION_TYPE.RETURN === name) {
                            _handleReturnMessage.call(this, id, message.method);
                        }
                        else {
                            // Call the mapping method to receive the handling method on the event channel
                            // Invoke the handling method
                            try {
                                if (_isTwoWay(name)) {
                                    if (args.length) {
                                        args.push(_getReturnMessageHandler.call(this, id, name, message));
                                    }
                                }

                                handler = mapping(message);
                                result = handler && handler();
                            }
                            catch (ex) {
                                /* istanbul ignore next: special handling for other implementations of channels which does not catch exceptions from triggers (like backbone) - when working with chronos channels it will not be called  */
                                PostMessageUtilities.log("Error while trying to invoke the handler on the events channel", "ERROR", "PostMessageCourier");
                                /* istanbul ignore next: special handling for other implementations of channels which does not catch exceptions from triggers (like backbone) - when working with chronos channels it will not be called  */
                                if (_isTwoWay(name)) {
                                    params = [id, ACTION_TYPE.RETURN, {error: ex.toString()}];
                                    retMsg = this.mapper.toMessage.apply(this.mapper, params);
                                    _returnMessage.call(this, retMsg, message.source);
                                }
                            }

                            // In case the method is two way and returned a result
                            if (_isTwoWay(name) && "undefined" !== typeof result) {
                                _handleResult.call(this, id, name, result, message);
                            }
                        }
                    }
                };
            }
1239138
private static function parseMapping($mapping, &$i = 0, $references = array())
    {
        $output = array();
        $len = strlen($mapping);
        ++$i;
        $allowOverwrite = false;

        // {foo: bar, bar:foo, ...}
        while ($i < $len) {
            switch ($mapping[$i]) {
                case ' ':
                case ',':
                    ++$i;
                    continue 2;
                case '}':
                    if (self::$objectForMap) {
                        return (object) $output;
                    }

                    return $output;
            }

            // key
            $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);

            if ('<<' === $key) {
                $allowOverwrite = true;
            }

            // value
            $done = false;

            while ($i < $len) {
                switch ($mapping[$i]) {
                    case '[':
                        // nested sequence
                        $value = self::parseSequence($mapping, $i, $references);
                        // Spec: Keys MUST be unique; first one wins.
                        // Parser cannot abort this mapping earlier, since lines
                        // are processed sequentially.
                        // But overwriting is allowed when a merge node is used in current block.
                        if ('<<' === $key) {
                            foreach ($value as $parsedValue) {
                                $output += $parsedValue;
                            }
                        } elseif ($allowOverwrite || !isset($output[$key])) {
                            $output[$key] = $value;
                        }
                        $done = true;
                        break;
                    case '{':
                        // nested mapping
                        $value = self::parseMapping($mapping, $i, $references);
                        // Spec: Keys MUST be unique; first one wins.
                        // Parser cannot abort this mapping earlier, since lines
                        // are processed sequentially.
                        // But overwriting is allowed when a merge node is used in current block.
                        if ('<<' === $key) {
                            $output += $value;
                        } elseif ($allowOverwrite || !isset($output[$key])) {
                            $output[$key] = $value;
                        }
                        $done = true;
                        break;
                    case ':':
                    case ' ':
                        break;
                    default:
                        $value = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i, true, $references);
                        // Spec: Keys MUST be unique; first one wins.
                        // Parser cannot abort this mapping earlier, since lines
                        // are processed sequentially.
                        // But overwriting is allowed when a merge node is used in current block.
                        if ('<<' === $key) {
                            $output += $value;
                        } elseif ($allowOverwrite || !isset($output[$key])) {
                            $output[$key] = $value;
                        }
                        $done = true;
                        --$i;
                }

                ++$i;

                if ($done) {
                    continue 2;
                }
            }
        }

        throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
    }
1238561
function (mapping) {
          var result = {}
          for (var property in mapping) {
            result[property] = parseInt(lines[mapping[property]].replace(/\s+/, ' ').split(' ')[0], 10)
          }
          return result
        }
480795
function _getMappedMethod(message) {
            var method = message && message.method;
            var name = method && method.name;
            var args = method && method.args;
            var eventChannel = this.eventChannel;

            return function() {
                if (eventChannel && eventChannel[name]) {
                    return eventChannel[name].apply(eventChannel, args);
                }
                else {
                    /* istanbul ignore next  */
                    PostMessageUtilities.log("No channel exists", "ERROR", "PostMessageMapper");
                }
            };
        }
335925
function loadMap(map){
  if (!map)
  {
    /** @cut */ basis.dev.warn(namespace + '.loadMap(): Wrong value for map');
    return;
  }

  for (var key in map)
  {
    var eventsMap = map[key];

    if (!eventsMap)
    {
      /** @cut */ basis.dev.warn(namespace + '.loadMap(): Value of map should be an object for path: ' + key);
      continue;
    }

    var selector = parsePath(key);
    for (var events in eventsMap)
    {
      var data = eventsMap[events];

      events.trim().split(/\s+/).forEach(function(eventName){
        registrateSelector(selector, eventName, data);
      });
    }
  }
}
1223182
function listen(query,key,func)
    {
      /* standard message listener */
      if(arguments.length === 2)
      {
        func = key.bind(this);
        key = query;
        if(!_messages[key]) _messages[key] = [];
        _messages[key].push(func);
      }
      else
      {
        func = func.bind(this);
        if(!_scopemessages[query]) _scopemessages[query] = {};
        if(!_scopemessages[query][key]) _scopemessages[query][key] = [];
        _scopemessages[query][key].push(func);
        
        /* if this happens to be a parent component we immediately retrieve the value, if not then callAllSubscribers will fire initial */
        if(document.querySelector('.'+query))
        {
          var scopeMessages = _scopemessages[query][key],
              data = document.querySelector('.'+query).kb_mapper.kb_viewmodel,
              local = data.getLayer(key),
              localKey = key.split('.').pop(),
              val = local[localKey];
          scopeMessages[(scopeMessages.length-1)]({
            key:localKey,
            value:val,
            oldValue:val,
            local:local,
            kbref:data,
            onChange:false,
            initial:true
          });
        }
      }
      return this;
    }
992358
function getMappingType(mapping) {
  if (is.array(mapping)) {
    return every(isMixed, mapping) ? 'mixed' : 'array';
  }
  if (is.object(mapping)) return 'map';
  return 'unknown';
}
1112725
function(mapping, i)
	{
		if ( i == undefined ) i = 0;
		var output = {};
		var len = mapping.length;
		i += 1;
		var done = false;
		var doContinue = false;

		// {foo: bar, bar:foo, ...}
		while ( i < len )
		{
			doContinue = false;
			
			switch ( mapping.charAt(i) )
			{
				case ' ':
				case ',':
					i++;
					doContinue = true;
					break;
				case '}':
					this.i = i;
					return output;
			}
			
			if ( doContinue ) continue;

			// key
			var key = this.parseScalar(mapping, [':', ' '], ['"', "'"], i, false);
			i = this.i;

			// value
			done = false;
			while ( i < len )
			{
				switch ( mapping.charAt(i) )
				{
					case '[':
						// nested sequence
						output[key] = this.parseSequence(mapping, i);
						i = this.i;
						done = true;
						break;
					case '{':
						// nested mapping
						output[key] = this.parseMapping(mapping, i);
						i = this.i;
						done = true;
						break;
					case ':':
					case ' ':
						break;
					default:
						output[key] = this.parseScalar(mapping, [',', '}'], ['"', "'"], i);
						i = this.i;
						done = true;
						i--;
				}

				++i;

				if ( done )
				{
					doContinue = true;
					break;
				}
			}
			
			if ( doContinue ) continue;
		}

		throw new YamlParseException('Malformed inline YAML string "'+mapping+'"');
	}
1355245
protected static void handleCreateDurable(
    DestinationManager DM, 
    ControlCreateDurable msg,
    MessageProcessor MP)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "handleCreateDurable", new Object[] {DM, msg, MP});

    int       status        = STATUS_SUB_GENERAL_ERROR;
    SIBUuid12 handlerID     = msg.getGuaranteedTargetDestinationDefinitionUUID(); // create requests require a target dest ID
    String    subName       = msg.getDurableSubName();
    String    discriminator = msg.getDurableDiscriminator();
    String    selectorString      = msg.getDurableSelector();
    SelectorDomain selectorDomain = SelectorDomain.
                                      getSelectorDomain(msg.getDurableSelectorDomain());
    
    // Create a selectorProperties Map to convey any additional properties associated
    // with the selector. At present (26/03/08) there is only one additional property
    // which is itself a map (of name spaces). The name space map is used in the XPath10 selector domain
    // to map URLs to prefixes. The use of a selectorProperties map keeps the Core SPI generic but
    // when conveying information over JMF we need a simpler structure and so will need to
    // break out individual properties for transportation.
    Map<String, Object> selectorProperties = null;
    Map<String, String> selectorNamespaceMap = msg.getDurableSelectorNamespaceMap();
    if(selectorNamespaceMap != null)
    {
      selectorProperties = new HashMap<String, Object>();
      selectorProperties.put("namespacePrefixMappings", selectorNamespaceMap);
    }

    String    user          = msg.getSecurityUserid();
    //TODO this flag needs to be set from the message.
    boolean   isSIBServerSubject = msg.isSecurityUseridSentBySystem();
    
    try {
      // Resolve the target BaseDestinationHandler
      BaseDestinationHandler handler = (BaseDestinationHandler) DM.getDestination(handlerID, false);
      
      // We'll create SelectionCriteria based on the properties we've been passed.
      SelectionCriteria criteria = null;
      
      // Use the appropriate SelectionCriteria factory dependent on whether we've been passed
      // selectorProperties
      if(selectorProperties == null)
      {
        criteria = MP.getSelectionCriteriaFactory().
                     createSelectionCriteria(discriminator,
                                             selectorString, 
                                             selectorDomain);
      }
      else
      {
        // Non-null selectorProperties, so we create MPSelectionCriteria
        criteria = 
          MPSelectionCriteriaFactory.
            getInstance().
              createSelectionCriteria(discriminator,
                                      selectorString, 
                                      selectorDomain,
                                      selectorProperties);
      }
      
      // Ask the BaseDestinationHandler to attempt the create
      // then we send back the result.
      status = handler.createDurableFromRemote(subName, 
                                               criteria,
                                               user, 
                                               msg.isCloned(),
                                               msg.isNoLocal(),
                                               isSIBServerSubject);
    }
    catch (Exception e)
    {
      // Log the exception
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.DurableOutputHandler.handleCreateDurable",
        "1:281:1.45.1.1",
        DurableOutputHandler.class);

      SibTr.exception(tc, e);
    }
    
    // Forward the status to the caller and we're done
    SIBUuid8              sender = msg.getGuaranteedSourceMessagingEngineUUID(); 
    ControlDurableConfirm reply  = createDurableConfirm(MP, sender, msg.getRequestID(), status);
    MP.getMPIO().sendToMe(sender, SIMPConstants.CONTROL_MESSAGE_PRIORITY, reply);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleCreateDurable");
  }
623074
function (msg) {
            console.log("Runtime.evaluate");
            var result = eval(msg.params.expression);
            MessageBroker.respond(msg, {
                result: JSON.stringify(result) // TODO: in original protocol this is an object handle
            });
        }
166676
function(map) {
        this.handlers.feature.setMap(map);
        if (this.box) {
            this.handlers.box.setMap(map);
        }
        OpenLayers.Control.prototype.setMap.apply(this, arguments);
    }
1035332
public Object map(final Value message) throws ObjectToIdMappingException {
        final UUID valueId = message.getObservableObjectId();
        if (valueId != null) {
            return objectRegistry.getByIdOrFail(valueId);
        } else {
            return message.getSimpleObjectValue();
        }
    }
431456
private String mapToJSONString(Map<String, Object> eventMap) {
        JSONObject jsonEvent = new JSONObject();
        String jsonString = null;
        map2JSON(jsonEvent, eventMap);
        try {
            if (!compact) {
                jsonString = jsonEvent.serialize(true).replaceAll("\\\\/", "/");
            } else {
                jsonString = jsonEvent.toString();
            }
        } catch (IOException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Unexpected error converting AuditEvent to JSON String", e);
            }
        }
        return jsonString;
    }
202898
function parseQueryMap(query) {
  var map = {};
  parseQueryString(query, function(key, value) {
    map[key] = value;
  });
  return map;
}
613785
function Mapping() {
    this.generatedLine = 0;
    this.generatedColumn = 0;
    this.source = null;
    this.originalLine = null;
    this.originalColumn = null;
    this.name = null;
  }
1201114
function proxy(target, mapping) {
    return new Proxy(mapping, {
        get(map, key) {
            if (Reflect.has(map, key)) {
                return resolve(target, Reflect.get(map, key))
            }
        },
        set(map, key, value) {
            if (Reflect.has(map, key)) {
                return resolve(target, Reflect.get(map, key), value)
            }
        }
    })
}
1030044
function _wrapMessageHandler(onmessage) {
            return function(message) {
                var msgObject;

                if (!message.origin || "*" === message.origin ||  this.targetOrigin === message.origin) {
                    if (_isHandshake.call(this, message) && !this.disposed && !this.hosted && !this.ready) {
                        _onReady.call(this);
                    }
                    else {
                        try {
                            msgObject = this.deserialize(message.data);

                            if (_validateToken.call(this, msgObject)) {
                                return onmessage && onmessage(msgObject);
                            }
                        }
                        catch (ex) {
                            msgObject = message.data || message;
                            PostMessageUtilities.log("Error while trying to handle the message", "ERROR", "PostMessageChannel");
                        }

                        return msgObject || message;
                    }
                }
            };
        }