Add the RAS class transformer to the
instrumentation {@link java.lang.instrument.ClassFileTransformer} list.
350107
private static synchronized void addTransformer() {
        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.entry(tc, "addTransformer");

        if (registeredTransformer == null && instrumentation != null) {
            registeredTransformer = new LibertyJava8WorkaroundRuntimeTransformer();
            instrumentation.addTransformer(registeredTransformer, false);
        }

        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.exit(tc, "addTransformer");
    }
298049
public IndexingConfigurationBuilder addKeyTransformer(Class<?> keyClass, Class<?> keyTransformerClass) {
      Map<Class<?>, Class<?>> indexedEntities = keyTransformers();
      indexedEntities.put(keyClass, keyTransformerClass);
      attributes.attribute(KEY_TRANSFORMERS).set(indexedEntities);
      return this;
   }
300981
public static <T extends Transformer> TransformerDescriptor<T> ofTransformer(final Class<T> transformerClass) {
        return new AnnotationBasedTransformerComponentDescriptor<>(transformerClass);
    }
488978
protected <R, T extends Transformer<Transformed<R>>> Iterable<T> getTransformer(Class<T> transformerClass) {
        return Providers.getAllRankedSortedProviders(manager, transformerClass);
    }
1257959
public void addConverter(Converter<?, ?> converter) {
		GenericConverter.ConvertiblePair typeInfo = getRequiredTypeInfo(converter, Converter.class);
		Assert.notNull(typeInfo, "Unable to the determine sourceType <S> and targetType " +
				"<T> which your Converter<S, T> converts between; declare these generic types.");
		addConverter(new ConverterAdapter(converter, typeInfo));
	}
241474
private static void instrumentTransformer(Transformer transformer) throws Exception {
        transformer.setErrorListener(new TransformerErrorListener());

        if (transformer instanceof TransformerHandler) {
            transformer = ((TransformerHandler) transformer).getTransformer();
        }
        if (transformer instanceof TransformerImpl) {
            final TraceManager tm = ((TransformerImpl) transformer).getTraceManager();
            final PrintTraceListener ptl = new PrintTraceListener(new PrintWriter(System.out));
            // Print information as each node is 'executed' in the stylesheet.
            ptl.m_traceElements = true;
            // Print information after each result-tree generation event.
            ptl.m_traceGeneration = true;
            // Print information after each selection event.
            ptl.m_traceSelection = true;
            // Print information whenever a template is invoked.
            ptl.m_traceTemplates = true;
            // Print information whenever an extension call is made.
            ptl.m_traceExtension = true;
            tm.addTraceListener(ptl);
        }
    }
274181
private Transformer createTransformer(boolean indent) {

    try {
      Transformer result = this.transformerFactory.newTransformer();
      if (indent) {
        result.setOutputProperty(OutputKeys.INDENT, "yes");
      }
      return result;
    } catch (TransformerConfigurationException e) {
      throw new IllegalStateException("XML Transformer misconfigured!" + " Probably your JVM does not support the required JAXP version!", e);
    }
  }
508348
private byte[] transform(byte[] classfileBuffer, InstrumentationActions instrumentationActions) {
		ClassReader classReader = new ClassReader(classfileBuffer);
		ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES);
		ClassVisitor localVariableStateEmitterTestClassVisitor = new StateTrackingClassVisitor(classWriter,
				instrumentationActions);
		classReader.accept(localVariableStateEmitterTestClassVisitor, 0);
		return classWriter.toByteArray();
	}
115641
private static synchronized void addTransformer() {
        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.entry(tc, "addTransformer");

        if (registeredTransformer == null && instrumentation != null) {
            registeredTransformer = new LibertyRuntimeTransformer();
            instrumentation.addTransformer(registeredTransformer, true);
        }

        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.exit(tc, "addTransformer");
    }
362076
public static <P, R> List<R> transform(List<P> elements, Function<P, R> transformer) {
        return Lists.transform(elements, transformer);
    }
404511
function Transformer( file, res ) {
			stream.Transform.call( this );

			this.file = file;
			this.res = res;
			this.chunks = [];
		}
795442
@Nullable
  public static Transformer newTransformer (@Nonnull final TransformerFactory aTransformerFactory)
  {
    ValueEnforcer.notNull (aTransformerFactory, "TransformerFactory");

    try
    {
      return aTransformerFactory.newTransformer ();
    }
    catch (final TransformerConfigurationException ex)
    {
      LOGGER.error ("Failed to create transformer", ex);
      return null;
    }
  }
984871
private void addTransformInterceptors(List<Interceptor<?>> inInterceptors,
                                          List<Interceptor<?>> outInterceptors,
                                          boolean newClient) {
        
        // The old service expects the Customer data be qualified with
        // the 'http://customer/v1' namespace.
        
        // The new service expects the Customer data be qualified with
        // the 'http://customer/v2' namespace.
        
        // If it is an old client talking to the new service then:
        // - the out transformation interceptor is configured for 
        //   'http://customer/v1' qualified data be transformed into
        //   'http://customer/v2' qualified data.
        // - the in transformation interceptor is configured for 
        //   'http://customer/v2' qualified response data be transformed into
        //   'http://customer/v1' qualified data.
       
        // If it is a new client talking to the old service then:
        // - the out transformation interceptor is configured for 
        //   'http://customer/v2' qualified data be transformed into
        //   'http://customer/v1' qualified data.
        // - the in transformation interceptor is configured for 
        //   'http://customer/v1' qualified response data be transformed into
        //   'http://customer/v2' qualified data.
        // - new Customer type also introduces a briefDescription property
        //   which needs to be dropped for the old service validation to succeed
        
        
        // this configuration can be provided externally
        
        Map<String, String> newToOldTransformMap = new HashMap<String, String>();
        newToOldTransformMap.put("{http://customer/v2}*", "{http://customer/v1}*");
        Map<String, String> oldToNewTransformMap = 
            Collections.singletonMap("{http://customer/v1}*", "{http://customer/v2}*");
        
        TransformOutInterceptor outTransform =  new TransformOutInterceptor();
        outTransform.setOutTransformElements(newClient ? newToOldTransformMap 
                                              : oldToNewTransformMap);
        
        if (newClient) {
            newToOldTransformMap.put("{http://customer/v2}briefDescription", "");
            //outTransform.setOutDropElements(
            //    Collections.singletonList("{http://customer/v2}briefDescription"));    
        }
        
        TransformInInterceptor inTransform =  new TransformInInterceptor();
        inTransform.setInTransformElements(newClient ? oldToNewTransformMap 
                                            : newToOldTransformMap);

        inInterceptors.add(inTransform);
        outInterceptors.add(outTransform);
        
        
    }
298214
@SuppressWarnings("unchecked")
    public <TO> ChainedTransformer<I, TO> chain(Transformer<O, TO> transformer) {
        if (transformer != null) {
            transformers.add(transformer);
        }
        return (ChainedTransformer<I, TO>) this;
    }
290324
public void instrumentClassFile(File classfile) throws IOException {
        FileInputStream fis = new FileInputStream(classfile);
        byte[] bytes = transform(fis);
        fis.close();
        fis = null;

        // If the class was successfully transformed, rewrite it
        if (bytes != null) {
            FileOutputStream fos = new FileOutputStream(classfile);
            fos.write(bytes);
            fos.close();
        }
    }
771716
public static void premain(String args, Instrumentation inst) {
        GagTransformer transformer = new GagTransformer();
        if (args == null || args.length() == 0) {
            transformer.addAllGenerators();
        } else {
            for (String key : args.split(",")) {
                transformer.addGeneratorForKey(key);
            }
        }
        inst.addTransformer(transformer);
    }
775086
private static Transformer newTransformer() {

		if (TEMPLATES == null) {
			throw new IllegalStateException("TransformXMLInterceptor not initialized.");
		}

		try {
			return TEMPLATES.newTransformer();
		} catch (TransformerConfigurationException ex) {
			throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex);
		}
	}