IoMappings ////////////////////////////////////////////////////////
963788
protected void parseActivityInputOutput(Element activityElement, ActivityImpl activity) {
    Element extensionElements = activityElement.element("extensionElements");
    if (extensionElements != null) {
      IoMapping inputOutput = null;
      try {
        inputOutput = parseInputOutput(extensionElements);
      } catch (BpmnParseException e) {
        addError(e);
      }

      if (inputOutput != null) {
        if (checkActivityInputOutputSupported(activityElement, activity, inputOutput)) {

          activity.setIoMapping(inputOutput);

          if (getMultiInstanceScope(activity) == null) {
            // turn activity into a scope (->local, isolated scope for
            // variables) unless it is a multi instance activity, in that case
            // this
            // is not necessary because:
            // A scope is already created for the multi instance body which
            // isolates the local variables from other executions in the same
            // scope, and
            // * parallel: the individual concurrent executions are isolated
            // even if they are not scope themselves
            // * sequential: after each iteration local variables are purged
            activity.setScope(true);
          }
        }
      }
    }
  }
665252
private void mapAndSetOffset() {
        try {
            final RandomAccessFile backingFile = new RandomAccessFile(this.file, "rw");
            backingFile.setLength(this.size);
            final FileChannel ch = backingFile.getChannel();
            this.addr = (Long) mmap.invoke(ch, 1, 0L, this.size);

            ch.close();
            backingFile.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
659928
public static void saveMapping(final Writer out,
                                   final DSLMapping mapping) throws IOException {
        for (DSLMappingEntry dslMappingEntry : mapping.getEntries()) {
            out.write(dslMappingEntry.toString());
            out.write("\n");
        }
    }
257194
Collection<MappingImpl> build(PropertyMap<S, D> propertyMap) {
    try {
      PROPERTY_MAP_CONFIGURE.invoke(propertyMap, this);
      saveLastMapping();
    } catch (IllegalAccessException e) {
      errors.errorAccessingConfigure(e);
    } catch (InvocationTargetException e) {
      Throwable cause = e.getCause();
      if (cause instanceof ConfigurationException)
        throw (ConfigurationException) cause;
      else
        errors.addMessage(cause, "Failed to configure mappings");
    } catch (NullPointerException e) {
      if (proxyErrors.hasErrors()) {
        throw proxyErrors.toException();
      }
      throw e;
    }

    errors.throwConfigurationExceptionIfErrorsExist();
    return propertyMappings;
  }
586853
public static MapMapping createMapMapping( List<Element> inputElements ){
        if( inputElements == null || inputElements.isEmpty() ){
            return null;
        }
        MapMapping result = new MapMapping();
        for( Element element : inputElements ){
            String name = element.getString( 1 );
            result.addEntryMapping( name, createInputMapping( element.getObject( 0 ) ) );
        }
        return result;
    }
695664
private void initMappings() throws Exception {
        checkClient();
        // We extract indexes and mappings to manage from mappings definition
        if (mappings != null && mappings.length > 0) {
            Map<String, Collection<String>> indices = getIndexMappings(mappings);

            // Let's initialize indexes and mappings if needed
            for (String index : indices.keySet()) {
                createIndex(client.getLowLevelClient(), classpathRoot, index, forceMapping);
                if (mergeSettings) {
                    updateSettings(client.getLowLevelClient(), classpathRoot, index);
                }

                createMapping(client, classpathRoot, index, mergeMapping);
            }
        }
    }
733701
public void setInputStreamData(HashMap inStreamInfo) throws IOException
    {

        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }	
        if (_srtRequestHelper._gotReader)
        {
            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
                logger.logp(Level.FINE, CLASS_NAME,"setInputStreamData","attempt to setInputStreamData after it has been read");
            throw new IllegalStateException(
                                            liberty_nls.getString(
                                                                  "Reader.already.obtained",
                                                            "Reader already obtained"));
        } else {
            _setInputDataStreamCalled = true; // 516233

            if (inStreamInfo != null)
            {

                // 516233 - the input map should have a contentLength, if not we were given the wring map 
                Integer contentLength = (Integer) inStreamInfo.get(INPUT_STREAM_CONTENT_DATA_LENGTH);

                if (contentLength==null) {

                    // security passed in a map that we did not create - should not happen
                    if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
                        logger.logp(Level.FINE, CLASS_NAME,"setInputStreamData", "No content length in passed map. Throw IOException");
                    throw new IllegalStateException();

                } else {

                    _setInputStreamContentLength = contentLength.intValue();

                    _setInputStreamContentType = (String) inStreamInfo.get(INPUT_STREAM_CONTENT_TYPE);

                    byte[] inStreamContentData = (byte[]) inStreamInfo.get(INPUT_STREAM_CONTENT_DATA);

                    // 516233 allow for no post data
                    if (inStreamContentData != null)
                    {

                        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
                            logger.logp(Level.FINE, CLASS_NAME, "setInputStreamData", "SetInputStreamData Content Type = " + _setInputStreamContentType + ", " +
                                            "contentLength = " + _setInputStreamContentLength+ ", data length = " + inStreamContentData.length + " : this = " + this );

                        ByteArrayInputStream inDataInputStream = new ByteArrayInputStream(inStreamContentData);
                        try
                        {
                            _in.init(inDataInputStream);
                            if (inStreamContentData.length > 0)
                            {
                                _in.setContentLength(inStreamContentData.length);
                            }
                            SRTServletRequestThreadData.getInstance().setParameters(null);  //reset output of parseParameter method.
                        }
                        catch (IOException exc)
                        {
                            if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
                                logger.logp(Level.FINE, CLASS_NAME, "setInputStreamData", "Exception caught : " + exc );
                            throw exc;
                        }
                    }
                }
            } else {
                // securty passed didn't provide a map - should not happen
                if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
                    logger.logp(Level.FINE, CLASS_NAME, "setInputStreamData","No map passed as input");
                throw new IllegalArgumentException();
            }
        }
    }
701465
private static void mapToWriter(Map<?, ?> map, JsonWriter writer) throws IOException {
    writer.beginObject();
    for (Map.Entry<?, ?> entry : map.entrySet()) {
      writer.name(String.valueOf(entry.getKey()));
      writeValue(entry.getValue(), writer);
    }
    writer.endObject();
  }
1220291
private void setAllMapping(List<Map<IAtom, IAtom>> mappings) {
        try {
            int counter = 0;
            for (Map<IAtom, IAtom> solution : mappings) {
                Map<Integer, Integer> atomMappings = new TreeMap<Integer, Integer>();
                for (Map.Entry<IAtom, IAtom> map : solution.entrySet()) {
                    IAtom sourceAtom = map.getKey();
                    IAtom targetAtom = map.getValue();
                    atomMappings.put(source.indexOf(sourceAtom), target.indexOf(targetAtom));
                }
                allMCS.add(counter++, atomMappings);
            }
        } catch (Exception I) {
            I.getCause();
        }
    }
129614
private static void loadMappings(ConfigServerImpl configServer, ConfigImpl config, Document doc, int mode, Log log) throws IOException {
	try {
	    boolean hasAccess = ConfigWebUtil.hasAccess(config, SecurityManager.TYPE_MAPPING);
	    Element el = getChildByName(doc.getDocumentElement(), "mappings");
	    Element[] _mappings = getChildren(el, "mapping");

	    Map<String, Mapping> mappings = MapFactory.<String, Mapping>getConcurrentMap();
	    Mapping tmp;

	    boolean finished = false;

	    if (configServer != null && config instanceof ConfigWeb) {
		Mapping[] sm = configServer.getMappings();
		if (sm != null) {
		    for (int i = 0; i < sm.length; i++) {
			if (!sm[i].isHidden()) {
			    if ("/".equals(sm[i].getVirtual())) finished = true;
			    if (sm[i] instanceof MappingImpl) {
				tmp = ((MappingImpl) sm[i]).cloneReadOnly(config);
				mappings.put(tmp.getVirtualLowerCase(), tmp);

			    }
			    else {
				tmp = sm[i];
				mappings.put(tmp.getVirtualLowerCase(), tmp);
			    }
			}
		    }
		}
	    }

	    if (hasAccess) {
		boolean hasServerContext = false;
		for (int i = 0; i < _mappings.length; i++) {
		    el = _mappings[i];

		    String physical = el.getAttribute("physical");
		    String archive = el.getAttribute("archive");
		    String virtual = getAttr(el, "virtual");
		    String listType = getAttr(el, "listener-type");
		    String listMode = getAttr(el, "listener-mode");

		    boolean readonly = toBoolean(getAttr(el, "readonly"), false);
		    boolean hidden = toBoolean(getAttr(el, "hidden"), false);
		    boolean toplevel = toBoolean(getAttr(el, "toplevel"), true);

		    if (config instanceof ConfigServer && (virtual.equalsIgnoreCase("/lucee-server/") || virtual.equalsIgnoreCase("/lucee-server-context/"))) {
			hasServerContext = true;
		    }

		    // lucee
		    if (virtual.equalsIgnoreCase("/lucee/")) {
			if (StringUtil.isEmpty(listType, true)) listType = "modern";
			if (StringUtil.isEmpty(listMode, true)) listMode = "curr2root";
			toplevel = true;
		    }

		    int listenerMode = ConfigWebUtil.toListenerMode(listMode, -1);
		    int listenerType = ConfigWebUtil.toListenerType(listType, -1);
		    ApplicationListener listener = ConfigWebUtil.loadListener(listenerType, null);
		    if (listener != null || listenerMode != -1) {
			// type
			if (mode == ConfigImpl.MODE_STRICT) listener = new ModernAppListener();
			else if (listener == null) listener = ConfigWebUtil.loadListener(ConfigWebUtil.toListenerType(config.getApplicationListener().getType(), -1), null);
			if (listener == null)// this should never be true
			    listener = new ModernAppListener();

			// mode
			if (listenerMode == -1) {
			    listenerMode = config.getApplicationListener().getMode();
			}
			listener.setMode(listenerMode);

		    }

		    // physical!=null &&
		    if ((physical != null || archive != null)) {

			short insTemp = inspectTemplate(el);
			if ("/lucee/".equalsIgnoreCase(virtual) || "/lucee".equalsIgnoreCase(virtual) || "/lucee-server/".equalsIgnoreCase(virtual)
				|| "/lucee-server-context".equalsIgnoreCase(virtual))
			    insTemp = ConfigImpl.INSPECT_ONCE;

			String primary = getAttr(el, "primary");
			boolean physicalFirst = primary == null || !primary.equalsIgnoreCase("archive");

			tmp = new MappingImpl(config, virtual, physical, archive, insTemp, physicalFirst, hidden, readonly, toplevel, false, false, listener, listenerMode,
				listenerType);
			mappings.put(tmp.getVirtualLowerCase(), tmp);
			if (virtual.equals("/")) {
			    finished = true;
			    // break;
			}
		    }
		}

		// set default lucee-server-context
		if (config instanceof ConfigServer && !hasServerContext) {
		    ApplicationListener listener = ConfigWebUtil.loadListener(ApplicationListener.TYPE_MODERN, null);
		    listener.setMode(ApplicationListener.MODE_CURRENT2ROOT);

		    tmp = new MappingImpl(config, "/lucee-server", "{lucee-server}/context/", null, ConfigImpl.INSPECT_ONCE, true, false, true, true, false, false, listener,
			    ApplicationListener.MODE_CURRENT2ROOT, ApplicationListener.TYPE_MODERN);
		    mappings.put(tmp.getVirtualLowerCase(), tmp);
		}
	    }

	    if (!finished) {

		if ((config instanceof ConfigWebImpl) && ResourceUtil.isUNCPath(config.getRootDirectory().getPath())) {

		    tmp = new MappingImpl(config, "/", config.getRootDirectory().getPath(), null, ConfigImpl.INSPECT_UNDEFINED, true, true, true, true, false, false, null, -1, -1);
		}
		else {

		    tmp = new MappingImpl(config, "/", "/", null, ConfigImpl.INSPECT_UNDEFINED, true, true, true, true, false, false, null, -1, -1);
		}

		mappings.put("/", tmp);
	    }

	    Mapping[] arrMapping = new Mapping[mappings.size()];
	    int index = 0;
	    Iterator it = mappings.keySet().iterator();
	    while (it.hasNext()) {
		arrMapping[index++] = mappings.get(it.next());
	    }
	    config.setMappings(arrMapping);
	    // config.setMappings((Mapping[]) mappings.toArray(new
	    // Mapping[mappings.size()]));
	}
	catch (Exception e) {
	    log(config, log, e);
	}
    }
1257771
public void saveMapping(final Writer out) throws IOException {
        for ( final Iterator it = this.mapping.getEntries().iterator(); it.hasNext(); ) {
            out.write( it.next().toString() );
            out.write( "\n" );
        }
    }
1369659
@Override
  public void addMapping(
      String sourceName, @Nullable String symbolName,
      FilePosition sourceStartPosition,
      FilePosition startPosition, FilePosition endPosition) {

    // Don't bother if there is not sufficient information to be useful.
    if (sourceName == null || sourceStartPosition.getLine() < 0) {
      return;
    }

    FilePosition adjustedStart = startPosition;
    FilePosition adjustedEnd = endPosition;

    if (offsetPosition.getLine() != 0
        || offsetPosition.getColumn() != 0) {
      // If the mapping is found on the first line, we need to offset
      // its character position by the number of characters found on
      // the *last* line of the source file to which the code is
      // being generated.
      int offsetLine = offsetPosition.getLine();
      int startOffsetPosition = offsetPosition.getColumn();
      int endOffsetPosition = offsetPosition.getColumn();

      if (startPosition.getLine() > 0) {
        startOffsetPosition = 0;
      }

      if (endPosition.getLine() > 0) {
        endOffsetPosition = 0;
      }

      adjustedStart = new FilePosition(
          startPosition.getLine() + offsetLine,
          startPosition.getColumn() + startOffsetPosition);

      adjustedEnd = new FilePosition(
          endPosition.getLine() + offsetLine,
          endPosition.getColumn() + endOffsetPosition);
    }

    // Create the new mapping.
    Mapping mapping = new Mapping();
    mapping.sourceFile = sourceName;
    mapping.originalPosition = sourceStartPosition;
    mapping.originalName = symbolName;
    mapping.startPosition = adjustedStart;
    mapping.endPosition = adjustedEnd;

    // Validate the mappings are in a proper order.
    if (lastMapping != null) {
      int lastLine = lastMapping.startPosition.getLine();
      int lastColumn = lastMapping.startPosition.getColumn();
      int nextLine = mapping.startPosition.getLine();
      int nextColumn = mapping.startPosition.getColumn();
      Preconditions.checkState(nextLine > lastLine
          || (nextLine == lastLine && nextColumn >= lastColumn),
          "Incorrect source mappings order, previous : (%s,%s)\n"
          + "new : (%s,%s)",
          lastLine, lastColumn, nextLine, nextColumn);
    }

    lastMapping = mapping;
    mappings.add(mapping);
  }
1267169
private void writeMapSimple(SerIterator itemIterator) throws IOException {
        StringConverter<Object> keyConverter = settings.getConverter().findConverterNoGenerics(itemIterator.keyType());
        output.writeObjectStart();
        while (itemIterator.hasNext()) {
            itemIterator.next();
            Object key = itemIterator.key();
            if (key == null) {
                throw new IllegalArgumentException("Unable to write map key as it cannot be null");
            }
            String str = keyConverter.convertToString(itemIterator.key());
            if (str == null) {
                throw new IllegalArgumentException("Unable to write map key as it cannot be a null string");
            }
            output.writeObjectKey(str);
            writeObject(itemIterator.valueType(), itemIterator.value(), itemIterator);
        }
        output.writeObjectEnd();
    }
1178101
private void initMapping(BinaryResourcesHandler binaryRsHandler) {

		if (jawrConfig.getUseBundleMapping() && rsBundleHandler.isExistingMappingFile()) {

			// Initialize the binary web resource mapping
			Iterator<Entry<Object, Object>> mapIterator = bundleMapping.entrySet().iterator();
			while (mapIterator.hasNext()) {
				Entry<Object, Object> entry = mapIterator.next();
				binaryRsHandler.addMapping((String) entry.getKey(), entry.getValue().toString());
			}

		} else {
			// Create a resource handler to read files from the WAR archive or
			// exploded dir.

			String binaryResourcesDefinition = jawrConfig.getBinaryResourcesDefinition();
			if (binaryResourcesDefinition != null) {

				StringTokenizer tokenizer = new StringTokenizer(binaryResourcesDefinition, ",");
				while (tokenizer.hasMoreTokens()) {
					String pathMapping = tokenizer.nextToken();

					// path is a generated image and ends with an image
					// extension
					if (generatorRegistry.isGeneratedBinaryResource(pathMapping)
							&& hasBinaryFileExtension(pathMapping)) {

						addBinaryResourcePath(binaryRsHandler, pathMapping);
					}
					// path ends in /, the folder is included without subfolders
					else if (pathMapping.endsWith("/")) {
						addItemsFromDir(binaryRsHandler, pathMapping, false);
					}
					// path ends in /, the folder is included with all
					// subfolders
					else if (pathMapping.endsWith("/**")) {
						addItemsFromDir(binaryRsHandler, pathMapping.substring(0, pathMapping.lastIndexOf("**")), true);
					} else if (hasBinaryFileExtension(pathMapping)) {
						addBinaryResourcePath(binaryRsHandler, pathMapping);
					} else
						LOGGER.warn(
								"Wrong mapping [" + pathMapping + "] for image bundle. Please check configuration. ");
				}
			}
		}

		// Store the bundle mapping
		if (jawrConfig.getUseBundleMapping() && !rsBundleHandler.isExistingMappingFile()) {
			rsBundleHandler.storeJawrBundleMapping(bundleMapping);
		}

		if (LOGGER.isDebugEnabled())
			LOGGER.debug("Finish creation of map for image bundle");
	}
421065
private static void simpleMapboxDirectionsRequest() throws IOException {

    MapboxDirections.Builder builder = MapboxDirections.builder();

    // 1. Pass in all the required information to get a simple directions route.
    builder.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN);
    builder.origin(Point.fromLngLat(-95.6332, 29.7890));
    builder.destination(Point.fromLngLat(-95.3591, 29.7576));

    // 2. That's it! Now execute the command and get the response.
    Response<DirectionsResponse> response = builder.build().executeCall();

    // 3. Log information from the response
    System.out.printf("Check that the GET response is successful %b", response.isSuccessful());
    System.out.printf("%nGet the first routes distance from origin to destination: %f",
      response.body().routes().get(0).distance());
  }
1085113
public void visitPropertyMap(PropertyMap<S, D> propertyMap) {
    String propertyMapClassName = propertyMap.getClass().getName();

    try {
      ClassReader cr = new ClassReader(propertyMap.getClass().getClassLoader().getResourceAsStream(
          propertyMapClassName.replace('.', '/') + ".class"));
      ExplicitMappingVisitor visitor = new ExplicitMappingVisitor(errors, configuration,
          propertyMapClassName, destinationType.getName(), propertyMap.getClass().getClassLoader());
      cr.accept(visitor, ClassReader.SKIP_FRAMES | ClassReader.SKIP_DEBUG);
      visitedMappings = visitor.mappings;
    } catch (IOException e) {
      errors.errorReadingClass(e, propertyMapClassName);
    }

    errors.throwConfigurationExceptionIfErrorsExist();
    createProxies();
  }
1119648
private static void setInputMapUnsafe(Node node, InputMap<?> im) {
        getProperties(node).put(P_INPUTMAP, im);
    }