Transforms the configuration.

@throws Exception if something goes wrong
167549
public void transformConfig() throws Exception {

        List<TransformEntry> entries = readTransformEntries(new File(m_xsltDir, "transforms.xml"));
        for (TransformEntry entry : entries) {
            transform(entry.getConfigFile(), entry.getXslt());
        }
        m_isDone = true;
    }
1147194
@Override
	public void reconfigure() {

		// This method is invoked when properties change.
		// It is not related to life cycle (start/stop).
		this.logger.info( "Reconfiguration requested in agent " + getAgentId());
		if( this.messagingClient == null ) {
			this.logger.info( "The agent has not yet been started. Configuration is dropped." );
			return;
		}

		// Update the messaging connection
		this.messagingClient.setApplicationName( this.applicationName );
		this.messagingClient.setScopedInstancePath( this.scopedInstancePath );
		this.messagingClient.setIpAddress( this.ipAddress );
		this.messagingClient.setNeedsModel( needsModel());
		this.messagingClient.setDomain( this.domain );
		this.messagingClient.switchMessagingType( this.messagingType);

		// Deal with injected configurations
		AgentUtils.injectConfigurations(
				this.karafEtc,
				this.applicationName,
				this.scopedInstancePath,
				this.domain,
				this.ipAddress );

		this.logger.info( "The agent was successfully (re)configured." );
	}
1355111
public void exceptionShift() {
        numExceptional++;
        double mag = 0.05 * numExceptional;
        if (mag > 1.0) mag = 1.0;

        double angle = 2.0 * UtilEjml.PI * (rand.nextDouble() - 0.5) * mag;
        performImplicitSingleStep(0, angle, true);

        // allow more convergence time
        nextExceptional = steps + exceptionalThresh;  // (numExceptional+1)*
    }
1154424
public void setConfigException(Exception e)
  {
    log.log(Level.FINER, e.toString(), e);
  }
297358
public function setConfiguration(array $configuration): void
    {
        if ($this->frozen) {
            throw new Exception('The application configuration is already defined');
        }
        $this->configuration = $this->createApplicationConfiguration($configuration);
        $this->frozen = true;
    }
97820
private void reconfigure() throws ConfigurationException, FileNotFoundException {
        Properties consolidatedProps = getConsolidatedProperties();
        
        logger.info("The root category for log4j.rootCategory now is {}", consolidatedProps.getProperty(LOG4J_ROOT_CATEGORY));
        logger.info("The root category for log4j.rootLogger now is {}", consolidatedProps.getProperty(LOG4J_ROOT_LOGGER));

        // Pause the async appenders so that the appenders are not accessed
        for (String originalAppenderName : originalAsyncAppenderNameMap.keySet()) {
            MessageBatcher asyncBatcher = BatcherFactory.getBatcher(AsyncAppender.class.getName() + "." + originalAppenderName);
            if (asyncBatcher == null) {
                continue;
            }
            asyncBatcher.pause();
        }

        // Configure log4j using the new set of properties
        configureLog4j(consolidatedProps);
        
        // Resume all the batchers to continue logging
        for (String originalAppenderName : originalAsyncAppenderNameMap.keySet()) {
            MessageBatcher asyncBatcher = BatcherFactory.getBatcher(AsyncAppender.class.getName() + "." + originalAppenderName);
            if (asyncBatcher == null) {
                continue;
            }
            asyncBatcher.resume();
        }
    }
936726
private void applyConfig()
	{
		this.components.applyConfig(config);

		switch (config.getConfigType()) {
		case DEFAULT:
			break;
		case IMPORT:
			this.archives.applyConfiguration(config);
		}

		repaint();
	}
634312
@SuppressWarnings("unchecked")
	public <Input,Output> Output adapt(Input input, Class<Output> outputType) throws Exception {
		Class<?> inputType = input.getClass();
		Adapter a = findAdapter(input, inputType, outputType);
		if (a == null) return null;
		return (Output)a.adapt(input);
	}
206356
public function afterCreate()
    {
        //create company
        $company = new Companies();
        $company->name = $this->defaultCompanyName;
        $company->users_id = $this->getId();
        if (!$company->save()) {
            throw new Exception(current($company->getMessages()));
        }

        $this->default_company = $company->getId();

        if (!$this->update()) {
            throw new Exception(current($this->getMessages()));
        }
    }
290093
public ApiResponse updateTransformation(String transformation, Map updates, Map options) throws Exception {
        if (options == null) options = ObjectUtils.emptyMap();
        return callApi(HttpMethod.PUT, Arrays.asList("transformations", transformation), updates, options);
    }
647918
public static void initialize(Retransformer trans) throws Exception {
        transformer = trans;

        List<String> scripts = new ArrayList<>();
        List<String> scriptNames = new ArrayList<>();

        // Load default and custom rules
        Enumeration<URL> iter = ClassLoader.getSystemResources(ROOT_RULE_FOLDER);
        while (iter.hasMoreElements()) {
            loadRules(iter.nextElement().toURI(), scriptNames, scripts);
        }

        try (PrintWriter writer = new PrintWriter(new StringWriter())) {
            try {
                transformer.installScript(scripts, scriptNames, writer);
            } catch (Exception e) {
                log.log(Level.SEVERE, "Failed to install scripts", e);
            }
        }

        if (log.isLoggable(Level.FINE)) {
            log.fine("Installed rules");
        }
    }
1371609
protected void configureWebApp () throws Exception
    {
        //finally, finish configuring the webapp
        for (int i=0;i<_configurations.length;i++)
        {
            _configurations[i].setWebApplicationContext(this);
            _configurations[i].configureWebApp();
        }
        
    }
1095669
private function prepareOptions()
    {
        $metadata = $this->metadata();

        // Can be override from the outside.
        if (!$this->exportIdent()) {
            $exportIdent = $this->exportIdent() ? : $this->metadata()->get('admin.default_export');
            if (!$exportIdent) {
                throw new Exception(sprintf(
                    'No export ident defined for "%s" in %s',
                    $this->objType(),
                    get_class($this)
                ));
            }

            $this->setExportIdent($exportIdent);
        }

        $export = $metadata->get('admin.export.'.$this->exportIdent());
        if (!$export) {
            throw new Exception(sprintf(
                'No export data defined for "%s" at "%s" in %s',
                $this->objType(),
                $this->exportIdent(),
                get_class($this)
            ));
        }

        if (is_string($export)) {
            $export = $metadata->get('admin.lists.'.$export);
            if (!$export) {
                throw new Exception(sprintf(
                    'No export data defined for "%s" in %s',
                    $this->objType(),
                    get_class($this)
                ));
            }
        }

        if (!isset($export['properties'])) {
            throw new Exception(sprintf(
                'No properties defined to export "%s" in %s',
                $this->objType(),
                get_class($this)
            ));
        }

        if (isset($export['exporter_options'])) {
            $opts = $export['exporter_options'];
            if (isset($opts['convert_br_to_newlines'])) {
                $this->setConvertBrToNewlines($opts['convert_br_to_newlines']);
            }
            if (isset($opts['strip_tags'])) {
                $this->setStripTags($opts['strip_tags']);
            }
            if (isset($opts['filename'])) {
                $this->setFilename($opts['filename']);
            }
        }

        // Default filename.
        // Filename is not a requirement
        if (!$this->filename()) {
            $ts = new DateTime('now');
            $filename = str_replace('/', '.', strtolower($this->objType())).'-export-'.$ts->format('Ymd.His').'.csv';
            $this->setFilename($filename);
        }

        // Properties to be exported
        // They will defined the file header and the rows.
        $this->setProperties($export['properties']);

        // Unnecessary for collection config.
        unset($export['properties']);
        unset($export['exporter_options']);

        // The rest is just collection config
        $this->setCollectionConfig($export);

        return $this;
    }
758413
protected boolean transform(IResource resource) throws Exception {
        String name = StringUtils.trimToEmpty(resource.getSourcePath());
        
        if (resource.isDirectory() || mojo.isExcluded(name)) {
            return false;
        }
        
        AbstractTransform transform = getTransform(name);
        String targetPath = transform == null ? null : transform.getTargetPath(resource);
        
        if (targetPath != null) {
            File out = mojo.newStagingFile(relocateResource(targetPath), resource.getTime());
            try (OutputStream outputStream = new FileOutputStream(out);) {
                transform.transform(resource, outputStream);
                return true;
            }
        }
        
        return false;
    }
1311527
public function convert() {

        try {
            $this->log('creating the target directory', backup::LOG_DEBUG);
            $this->create_workdir();

            $this->log('executing the conversion', backup::LOG_DEBUG);
            $this->execute();

            $this->log('replacing the source directory with the converted version', backup::LOG_DEBUG);
            $this->replace_tempdir();
        } catch (Exception $e) {
        }

        // clean-up stuff if needed
        $this->destroy();

        // eventually re-throw the execution exception
        if (isset($e) and ($e instanceof Exception)) {
            throw $e;
        }
    }
362030
@Override
    public byte[] transform(ClassLoader loader,
                            String className,
                            Class<?> classBeingRedefined,
                            ProtectionDomain protectionDomain,
                            byte[] classfileBuffer) throws IllegalClassFormatException {
     	if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.entry(this, tc, "transform", loader, className, classBeingRedefined, protectionDomain);

		    	
		if (!isJava8TraceEnabled)
			return null; //Look for special trace instrumentation force until JDK bug fully fixed.
		
		if (classBeingRedefined != null)
        	return null;

        byte[] newClassBytes = null;
        if (isTransformPossible(classfileBuffer)) {
            try {
                newClassBytes = transform(classfileBuffer);
            } catch (Throwable t) {
                Tr.error(tc, "INSTRUMENTATION_TRANSFORM_FAILED_FOR_CLASS_2", className, t);
            }
        }

        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.exit(this, tc, "transform", newClassBytes);
        return newClassBytes;
    }
65872
public function init()
    {
        $this->conf = $this->getConfiguration();
        if (!isset($this->conf)) {
            throw new Exception("Adapter configuration not set, cannot initialize");
        }
        $this->adapters = array();
        foreach ($this->conf['adapters'] as $key => $adapter) {
            $adapterConf = ArrayHelper::merge($this->conf['common'], $adapter);

            $adapterConf['paymentHandler'] = $this;
            $adapterConf['adapterTag'] = $key;
            $this->adapters[$key] = \Yii::createObject($adapterConf);
        }
    }