Example usage for java.util Properties clone

List of usage examples for java.util Properties clone

Introduction

In this page you can find the example usage for java.util Properties clone.

Prototype

@Override
    public synchronized Object clone() 

Source Link

Usage

From source file:org.sonar.batch.scan.DefaultProjectBootstrapper.java

@VisibleForTesting
protected static void cleanAndCheckAggregatorProjectProperties(ProjectDefinition project) {
    Properties properties = project.getProperties();

    // SONARPLUGINS-2295
    String[] sourceDirs = getListFromProperty(properties, PROPERTY_SOURCES);
    for (String path : sourceDirs) {
        File sourceFolder = getFileFromPath(path, project.getBaseDir());
        if (sourceFolder.isDirectory()) {
            LOG.warn(//w w  w .  jav  a 2  s  . c om
                    "/!\\ A multi-module project can't have source folders, so '{}' won't be used for the analysis. "
                            + "If you want to analyse files of this folder, you should create another sub-module and move them inside it.",
                    sourceFolder.toString());
        }
    }

    // "aggregator" project must not have the following properties:
    properties.remove(PROPERTY_SOURCES);
    properties.remove(PROPERTY_TESTS);
    properties.remove(PROPERTY_BINARIES);
    properties.remove(PROPERTY_LIBRARIES);

    // and they don't need properties related to their modules either
    Properties clone = (Properties) properties.clone();
    List<String> moduleIds = Lists.newArrayList(getListFromProperty(properties, PROPERTY_MODULES));
    for (Entry<Object, Object> entry : clone.entrySet()) {
        String key = (String) entry.getKey();
        if (isKeyPrefixedByModuleId(key, moduleIds)) {
            properties.remove(key);
        }
    }
}

From source file:org.sonar.plugins.csharp.core.VisualStudioProjectBuilder.java

private void createMultiProjectStructure(ProjectDefinition root) {
    VisualStudioSolution currentSolution = microsoftWindowsEnvironment.getCurrentSolution();
    root.resetSourceDirs();//  w ww. ja  va  2  s .  c o  m
    LOG.debug("- Root Project: {}", root.getName());
    String workDir = root.getWorkDir().getAbsolutePath()
            .substring(root.getBaseDir().getAbsolutePath().length() + 1);
    microsoftWindowsEnvironment.setWorkingDirectory(workDir);
    Properties rootProps = enhanceRootProperties(root);

    for (VisualStudioProject vsProject : currentSolution.getProjects()) {
        String projectKey = StringUtils.substringBefore(root.getKey(), ":") + ":"
                + StringUtils.deleteWhitespace(vsProject.getName());
        if (projectKey.equals(root.getKey())) {
            throw new SonarException("The solution and one of its projects have the same key ('" + projectKey
                    + "'). Please set a unique 'sonar.projectKey' for the solution.");
        }

        ProjectDefinition subProject = ProjectDefinition.create((Properties) rootProps.clone())
                .setBaseDir(vsProject.getDirectory()).setWorkDir(new File(vsProject.getDirectory(), workDir))
                .setKey(projectKey).setVersion(root.getVersion()).setName(vsProject.getName())
                .addContainerExtension(microsoftWindowsEnvironment);

        if (vsProject.isTest()) {
            subProject.setTestDirs(".");
            for (SourceFile sourceFile : vsProject.getSourceFiles()) {
                subProject.addTestFiles(sourceFile.getFile());
            }
        } else {
            subProject.setSourceDirs(".");
            for (SourceFile sourceFile : vsProject.getSourceFiles()) {
                subProject.addSourceFiles(sourceFile.getFile());
            }
        }

        LOG.debug("  - Adding Sub Project => {}", subProject.getName());
        root.addSubProject(subProject);
    }
}

From source file:org.wso2.carbon.identity.authenticator.inbound.saml2sso.test.SPInitTests.java

private void applyAllConfigs(Properties originalReqValidatorConfigs, Properties originalResponseBuilderConfigs,
        ServiceProviderConfig serviceProviderConfig) {
    Properties newReqValidatorConfigs = (Properties) originalReqValidatorConfigs.clone();
    Properties newResponseBuilderConfigs = (Properties) originalResponseBuilderConfigs.clone();

    // ACS, defaultACS, signingAlgo, DigestAlgo, EncryptionCert, Signing Certificate, AttributeConsumerUrl,
    // NameIdFormat,
    // NotOrAfterPeriod are set in sample.yaml SP by def`ault. Therefore no need to explicitly enable them
    newReqValidatorConfigs.put(SAML2AuthConstants.Config.Name.IDP_INIT_SSO_ENABLED, "true");
    newReqValidatorConfigs.put(SAML2AuthConstants.Config.Name.AUTHN_REQUEST_SIGNED, "true");
    newResponseBuilderConfigs.put(SAML2AuthConstants.Config.Name.AUTHN_RESPONSE_ENCRYPTED, "true");
    newResponseBuilderConfigs.put(SAML2AuthConstants.Config.Name.AUTHN_RESPONSE_SIGNED, "true");
    newResponseBuilderConfigs.put(SAML2AuthConstants.Config.Name.SEND_CLAIMS_ALWAYS, "true");
    serviceProviderConfig.getRequestValidationConfig().getRequestValidatorConfigs().get(0)
            .setProperties(newReqValidatorConfigs);
    serviceProviderConfig.getResponseBuildingConfig().getResponseBuilderConfigs().get(0)
            .setProperties(newResponseBuilderConfigs);
}

From source file:org.xdi.service.PythonService.java

private Properties getPreProperties() {
    Properties props = System.getProperties();
    Properties clonedProps = (Properties) props.clone();
    clonedProps.setProperty("java.class.path", ".");
    clonedProps.setProperty("java.library.path", "");
    clonedProps.remove("javax.net.ssl.trustStore");
    clonedProps.remove("javax.net.ssl.trustStorePassword");

    return clonedProps;
}