Load the layers based on the default setup.

@param jbossHome     the jboss home directory
@param productConfig the product config
@param repoRoots     the repository roots
@return the available layers
@throws IOException
550467
public static InstalledIdentity load(final File jbossHome, final ProductConfig productConfig, final File... repoRoots) throws IOException {
        final InstalledImage installedImage = installedImage(jbossHome);
        return load(installedImage, productConfig, Arrays.<File>asList(repoRoots), Collections.<File>emptyList());
    }
772078
@Override
    protected Properties mergeProperties() throws IOException {

        Properties rslt = null;

        /*
         * If properties file encryption is used in this deployment, the
         * encryption key will be made available to the application as an
         * environment variable called UP_JASYPT_KEY.
         */
        final String encryptionKey = System.getenv(JAYSYPT_ENCRYPTION_KEY_VARIABLE);
        if (encryptionKey != null) {

            logger.info("Jasypt support for encrypted property values ENABLED");

            StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
            encryptor.setPassword(encryptionKey);
            rslt = new EncryptableProperties(encryptor);

            /*
             * BEGIN copied from PropertiesLoaderSupport.mergeProperties()
             */

            if (this.localOverride) {
                // Load properties from file upfront, to let local properties override.
                loadProperties(rslt);
            }

            if (this.localProperties != null) {
                for (int i = 0; i < this.localProperties.length; i++) {
                    CollectionUtils.mergePropertiesIntoMap(this.localProperties[i], rslt);
                }
            }

            if (!this.localOverride) {
                // Load properties from file afterwards, to let those properties override.
                loadProperties(rslt);
            }

            /*
             * END copied from PropertiesLoaderSupport.mergeProperties()
             */

        } else {

            logger.info(
                    "Jasypt support for encrypted property values DISABLED;  "
                            + "specify environment variable {} to use this feature",
                    JAYSYPT_ENCRYPTION_KEY_VARIABLE);

            /*
             * The feature is not in use;  defer to the Spring-provided
             * implementation of this method.
             */
            return super.mergeProperties();
        }

        return rslt;
    }
19548
public static void loadFromXmlPluginPackageDefinitions(final IPluginRepository repo, final ClassLoader cl, final InputStream in)
            throws PluginConfigurationException {
        for (PluginDefinition pd : loadFromXmlPluginPackageDefinitions(cl, in)) {
            repo.addPluginDefinition(pd);
        }
    }
287746
protected void loadDefaultConfigurations() {
		if (JK.getURL(DEFAULT_LABLES_FILE_NAME) != null) {
			logger.debug("Load default lables from : " + DEFAULT_LABLES_FILE_NAME);
			addLables(JKIOUtil.readPropertiesFile(DEFAULT_LABLES_FILE_NAME));
		}
	}
465891
public void loadProperties(Properties properties) throws IOException {
        userSettings.putAll(properties);
        loadDataSource(obdaModel, userSettings);
    }
1181133
public void setProductDescriptions(java.util.Collection<String> productDescriptions) {
        if (productDescriptions == null) {
            this.productDescriptions = null;
            return;
        }

        this.productDescriptions = new com.amazonaws.internal.SdkInternalList<String>(productDescriptions);
    }
825470
public void setProductSubscriptions(java.util.Collection<String> productSubscriptions) {
        if (productSubscriptions == null) {
            this.productSubscriptions = null;
            return;
        }

        this.productSubscriptions = new java.util.ArrayList<String>(productSubscriptions);
    }
1134396
public Set<String> getSubsystems() throws IOException, XMLStreamException {
        final Set<String> result = new HashSet<>();
        for (ConfigFile configFile : description.getConfig().getDomainConfigFiles()) {
            for (Map<String, SubsystemConfig> subsystems : configFile.getSubsystemConfigs(featurePackFile).values()) {
                result.addAll(subsystems.keySet());
            }
        }
        for (ConfigFile configFile : description.getConfig().getStandaloneConfigFiles()) {
            for (Map<String, SubsystemConfig> subsystems : configFile.getSubsystemConfigs(featurePackFile).values()) {
                result.addAll(subsystems.keySet());
            }
        }
        for (ConfigFile configFile : description.getConfig().getHostConfigFiles()) {
            for (Map<String, SubsystemConfig> subsystems : configFile.getSubsystemConfigs(featurePackFile).values()) {
                result.addAll(subsystems.keySet());
            }
        }
        return result;
    }
89065
public static RestRepositoryConnectionProxy getProxyInfo(Properties repoProperties) throws InstallException {
        RestRepositoryConnectionProxy proxyInfo = null;
        URL proxyURL = null;
        if (repoProperties != null) {
            //Retrieve proxy settings properties
            String proxyHost = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_HOST);
            String proxyPort = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_PORT);
            String proxyUser = getProxyUser(repoProperties);
            String proxyPwd = getProxyPwd(repoProperties);
            try {
                //Construct proxy URL object from proxy host and port
                if ((proxyHost != null && !proxyHost.isEmpty()) && (proxyPort != null && !proxyPort.isEmpty())) {
                    //Trim any trailing whitespaces
                    proxyHost = proxyHost.trim();
                    proxyPort = proxyPort.trim();
                    logger.log(Level.FINEST, "proxyHost: " + proxyHost);
                    logger.log(Level.FINEST, "proxyPort: " + proxyPort);
                    logger.log(Level.FINEST, "proxyUser: " + proxyUser);
                    logger.log(Level.FINEST, "proxyPassword: ********");
                    if (proxyHost.toLowerCase().startsWith("http://"))
                        proxyURL = new URL(proxyHost + ":" + proxyPort);
                    else
                        proxyURL = new URL("http://" + proxyHost + ":" + proxyPort);
                    //Check proxy port number in range
                    if (proxyURL.getPort() < 0 || proxyURL.getPort() > 0xFFFF)
                        throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_INVALID_PROXY_PORT", String.valueOf(proxyURL.getPort())));
                } else {
                    if ((proxyHost == null || proxyHost.isEmpty()) && proxyPort != null) {
                        throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_HOST_MISSING"), InstallException.MISSING_CONTENT);
                    } else if (proxyHost != null && (proxyPort == null || proxyPort.isEmpty())) {
                        throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_PORT_MISSING"), InstallException.MISSING_CONTENT);
                    }
                }
            } catch (MalformedURLException e) {
                throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_INVALID_PROXY_PORT", proxyPort), e, InstallException.RUNTIME_EXCEPTION);
            }
            if (proxyURL != null) {
                if ((proxyUser != null && !proxyUser.isEmpty()) && (proxyPwd != null && !proxyPwd.isEmpty())) {
                    //Trim any trailing whitespaces
                    proxyUser = proxyUser.trim();
                    proxyPwd = proxyPwd.trim();
                    String decodedPwd = proxyPwd;
                    try {
                        //Decode encrypted proxy server password
                        decodedPwd = PasswordUtil.decode(proxyPwd);
                        //Check proxy server credentials for Authentication
                        setProxyAuthenticator(proxyHost, proxyPort, proxyUser, decodedPwd);
                    } catch (InvalidPasswordDecodingException ipde) {
                        decodedPwd = proxyPwd;
                        logger.log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_PASSWORD_NOT_ENCODED_PROXY", proxyURL) + InstallUtils.NEWLINE);
                        setProxyAuthenticator(proxyHost, proxyPort, proxyUser, decodedPwd);
                    } catch (UnsupportedCryptoAlgorithmException ucae) {
                        throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_PWD_CRYPTO_UNSUPPORTED"), ucae, InstallException.RUNTIME_EXCEPTION);
                    }
                }

                try {
                    proxyInfo = new RestRepositoryConnectionProxy(proxyURL);
                } catch (RepositoryException e) {
                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new PrintWriter(sw);
                    e.printStackTrace(pw);
                    if (sw.toString().contains("com.ibm.websphere.ssl.protocol.SSLSocketFactory"))
                        throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_FAILED_TO_CONNECT_JDK_WRONG"), e, InstallException.RUNTIME_EXCEPTION);
                    else
                        throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_FAILED_TO_CONNECT"), e, InstallException.RUNTIME_EXCEPTION);
                }

            }
        }
        return proxyInfo;
    }
200767
private void initializeRetireJsRepo(Settings settings, URL repoUrl) throws UpdateException {
        try {
            final File dataDir = settings.getDataDirectory();
            final File tmpDir = settings.getTempDirectory();
            boolean useProxy = false;
            if (null != settings.getString(Settings.KEYS.PROXY_SERVER)) {
                useProxy = true;
                LOGGER.debug("Using proxy");
            }
            LOGGER.debug("RetireJS Repo URL: {}", repoUrl.toExternalForm());
            final URLConnectionFactory factory = new URLConnectionFactory(settings);
            final HttpURLConnection conn = factory.createHttpURLConnection(repoUrl, useProxy);
            final String filename = repoUrl.getFile().substring(repoUrl.getFile().lastIndexOf("/") + 1, repoUrl.getFile().length());
            if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
                final File tmpFile = new File(tmpDir, filename);
                final File repoFile = new File(dataDir, filename);
                try (InputStream inputStream = conn.getInputStream();
                        FileOutputStream outputStream = new FileOutputStream(tmpFile)) {
                    IOUtils.copy(inputStream, outputStream);
                }
                //using move fails if target and destination are on different disks which does happen (see #1394 and #1404)
                Files.copy(tmpFile.toPath(), repoFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
                if (!tmpFile.delete()) {
                    tmpFile.deleteOnExit();
                }
            }
        } catch (IOException e) {
            throw new UpdateException("Failed to initialize the RetireJS repo", e);
        }
    }
1048158
protected static void loadPropertiesOverrides (
        PropRecord prec, Map<String,PropRecord> records, Map<String,PropRecord> applied,
        ClassLoader loader, Properties target)
        throws IOException
    {
        if (applied.containsKey(prec._package)) {
            return;
        }

        // first load up properties from all of our parent nodes
        if (prec._overrides != null) {
            for (String override : prec._overrides) {
                PropRecord parent = records.get(override);
                loadPropertiesOverrides(parent, records, applied, loader, target);
            }
        }

        // now apply our properties values
        InputStream in = prec.sourceURL.openStream();
        target.load(in);
        in.close();
        applied.put(prec._package, prec);
    }
954073
public static List<String> getOrderList(Properties repoProperties) throws InstallException {
        List<String> orderList = new ArrayList<String>();
        List<String> repoList = new ArrayList<String>();
        // Retrieves the Repository Properties file
        File repoPropertiesFile = new File(getRepoPropertiesFileLocation());

        if (repoPropertiesFile.exists() && repoPropertiesFile.isFile()) {
            //Load repository properties
            FileInputStream repoPropertiesInput = null;
            BufferedReader repoPropertiesReader = null;
            try {
                repoPropertiesInput = new FileInputStream(repoPropertiesFile);
                repoPropertiesReader = new BufferedReader(new InputStreamReader(repoPropertiesInput));
                String line;
                String repoName;
                while ((line = repoPropertiesReader.readLine()) != null) {
                    String keyValue[] = line.split(EQUALS);
                    if (!line.startsWith(COMMENT_PREFIX) && keyValue.length > 1 && keyValue[0].endsWith(URL_SUFFIX)) {
                        repoName = keyValue[0].substring(0, keyValue[0].length() - URL_SUFFIX.length());
                        //Ignore empty repository names
                        if (repoName.isEmpty()) {
                            continue;
                        }
                        //Remove duplicate entries
                        if (orderList.contains(repoName)) {
                            repoList.remove(orderList.indexOf(repoName));
                            orderList.remove(repoName);
                        }
                        orderList.add(repoName);
                        repoList.add(line);

                        // if Windows, replace \ to \\
                        if (InstallUtils.isWindows && keyValue.length > 1 && keyValue[1].contains("\\")) {
                            String url = repoProperties.getProperty(keyValue[0]);
                            if (url != null && !InstallUtils.isURL(url)) {
                                repoProperties.put(keyValue[0], keyValue[1].trim());
                                logger.log(Level.FINEST, "The value of " + keyValue[0] + " was replaced to " + repoProperties.getProperty(keyValue[0]));
                            }
                        }
                    }
                }

            } catch (IOException e) {
                throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_REPOSITORY_PROPS_NOT_LOADED",
                                                                                          getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);
            } finally {
                InstallUtils.close(repoPropertiesInput);
                InstallUtils.close(repoPropertiesReader);
            }
        }

        if (isWlpRepoEnabled(repoProperties)) {
            orderList.add(WLP_REPO);
        }

        return orderList;
    }
1151838
private List<Properties> loadGeneralJobConfigs()
      throws ConfigurationException, IOException {
    List<Properties> jobConfigs = SchedulerUtils.loadGenericJobConfigs(this.properties);
    LOG.info(String.format("Loaded %d job configurations", jobConfigs.size()));
    return jobConfigs;
  }
441743
public void loadBeans(Resource[] resources) throws IOException {
		Closure beans = new Closure(this){
			@Override
			public Object call(Object... args) {
				return beans((Closure)args[0]);
			}
		};
		Binding b = new Binding();
		b.setVariable("beans", beans);

		GroovyShell shell = classLoader != null ? new GroovyShell(classLoader,b) : new GroovyShell(b);
        for (Resource resource : resources) {
            shell.evaluate(new InputStreamReader(resource.getInputStream()));
        }
	}
1049159
public static Properties loadRepoProperties() throws InstallException {
        Properties repoProperties = null;

        // Retrieves the Repository Properties file
        File repoPropertiesFile = new File(getRepoPropertiesFileLocation());

        //Check if default repository properties file location is overridden
        boolean isPropsLocationOverridden = System.getProperty(InstallConstants.OVERRIDE_PROPS_LOCATION_ENV_VAR) != null ? true : false;

        if (repoPropertiesFile.exists() && repoPropertiesFile.isFile()) {
            //Load repository properties
            repoProperties = new Properties();
            FileInputStream repoPropertiesInput = null;
            try {
                repoPropertiesInput = new FileInputStream(repoPropertiesFile);
                repoProperties.load(repoPropertiesInput);
            } catch (Exception e) {
                throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_REPOSITORY_PROPS_NOT_LOADED",
                                                                                          getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);
            } finally {
                InstallUtils.close(repoPropertiesInput);
            }
        } else if (isPropsLocationOverridden) {
            //Checks if the override location is a directory
            throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage(repoPropertiesFile.isDirectory() ? "ERROR_TOOL_REPOSITORY_PROPS_NOT_FILE" : "ERROR_TOOL_REPOSITORY_PROPS_NOT_EXISTS",
                                                                                      getRepoPropertiesFileLocation()), InstallException.IO_FAILURE);
        }
        return repoProperties;
    }
309921
public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) {
          Set<Pattern> set = new HashSet<>();
          for (String wildcardExpr : runtimeNames) {
              Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr);
              set.add(pattern);
          }
          return listDeploymentNames(deploymentRootResource, set);
      }
421416
@Provides @Singleton
    public List<RemoteRepository> getRemoteRepositories(
            SettingsDecrypter decrypter,
            ExtensionList<RemoteRepositoryDecorator> decorators) {

        List<RemoteRepository> repositories = new ArrayList<RemoteRepository>();
        MavenDependencyResolverSettings resolverSettings = new MavenDependencyResolverSettings();
        resolverSettings.setUseMavenCentral(true);
        List<RemoteRepository> repos = resolverSettings.getRemoteRepositories();
        for (RemoteRepository remoteRepository : repos) {
            Server server = resolverSettings.getSettings().getServer(remoteRepository.getId());
            if (server != null) {
                server = decrypter.decrypt(new DefaultSettingsDecryptionRequest(server)).getServer();
                remoteRepository.setAuthentication(new Authentication(server.getUsername(), server.getPassword(), server.getPrivateKey(), server.getPassphrase()));
            }
            repositories.add(decorate(remoteRepository, decorators));
        }
        RemoteRepository r = new RemoteRepository("cloudbees-public-release", "default", "https://repository-cloudbees.forge.cloudbees.com/public-release/");
        repositories.add(decorate(r,decorators));
        return repositories;
    }