Search in sources :

Example 16 with Properties

use of org.apache.felix.utils.properties.Properties in project karaf by apache.

the class Activator method doOpen.

@Override
protected void doOpen() throws Exception {
    super.doOpen();
    Properties configuration = new Properties();
    File configFile = new File(System.getProperty("karaf.etc"), FEATURES_SERVICE_CONFIG_FILE);
    if (configFile.isFile() && configFile.canRead()) {
        try {
            configuration.load(new FileReader(configFile));
        } catch (IOException e) {
            logger.warn("Error reading configuration file " + configFile.toString(), e);
        }
    }
    Dictionary<String, String> props = new Hashtable<>();
    for (Map.Entry<String, String> entry : configuration.entrySet()) {
        props.put(entry.getKey(), entry.getValue());
    }
    updated(props);
}
Also used : Hashtable(java.util.Hashtable) FileReader(java.io.FileReader) IOException(java.io.IOException) Properties(org.apache.felix.utils.properties.Properties) File(java.io.File) Map(java.util.Map)

Example 17 with Properties

use of org.apache.felix.utils.properties.Properties in project karaf by apache.

the class CreateCommand method doExecute.

protected Object doExecute() throws Exception {
    if (!bare) {
        Properties configuration = new Properties();
        File configFile = new File(System.getProperty("karaf.etc"), FEATURES_SERVICE_CONFIG_FILE);
        configuration.load(configFile);
        String featuresRepositories = configuration.getProperty("featuresRepositories", "");
        String featuresBoot = configuration.getProperty("featuresBoot", "");
        if (featureURLs == null) {
            featureURLs = new ArrayList<>();
        }
        for (String repo : featuresRepositories.split(",")) {
            repo = repo.trim();
            if (!repo.isEmpty()) {
                featureURLs.add(repo);
            }
        }
        if (features == null) {
            features = new ArrayList<>();
        }
        for (String feature : featuresBoot.split(",")) {
            feature = feature.trim();
            if (!feature.isEmpty()) {
                features.add(feature);
            }
        }
    }
    Map<String, URL> textResources = getResources(textResourceLocation);
    Map<String, URL> binaryResources = getResources(binaryResourceLocations);
    InstanceSettings settings = new InstanceSettings(sshPort, rmiRegistryPort, rmiServerPort, location, javaOpts, featureURLs, features, address, textResources, binaryResources, profiles);
    getInstanceService().createInstance(instance, settings, verbose);
    return null;
}
Also used : InstanceSettings(org.apache.karaf.instance.core.InstanceSettings) Properties(org.apache.felix.utils.properties.Properties) File(java.io.File) URL(java.net.URL)

Example 18 with Properties

use of org.apache.felix.utils.properties.Properties in project karaf by apache.

the class GSSAPILdapLoginModuleTest method ldapLoginModuleOptions.

protected Properties ldapLoginModuleOptions() throws IOException {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    File file = new File(basedir + "/target/test-classes/org/apache/karaf/jaas/modules/ldap/gssapi.ldap.properties");
    return new Properties(file);
}
Also used : Properties(org.apache.felix.utils.properties.Properties) File(java.io.File)

Example 19 with Properties

use of org.apache.felix.utils.properties.Properties in project karaf by apache.

the class LdapCacheTest method ldapLoginModuleOptions.

protected Properties ldapLoginModuleOptions() throws IOException {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    File file = new File(basedir + "/target/test-classes/org/apache/karaf/jaas/modules/ldap/ldap.properties");
    return new Properties(file);
}
Also used : Properties(org.apache.felix.utils.properties.Properties) File(java.io.File)

Example 20 with Properties

use of org.apache.felix.utils.properties.Properties in project karaf by apache.

the class LdapCaseInsensitiveDNTest method ldapLoginModuleOptions.

protected Properties ldapLoginModuleOptions() throws IOException {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    File file = new File(basedir + "/target/test-classes/org/apache/karaf/jaas/modules/ldap/ldapCaseInsensitiveDN.properties");
    return new Properties(file);
}
Also used : Properties(org.apache.felix.utils.properties.Properties) File(java.io.File)

Aggregations

Properties (org.apache.felix.utils.properties.Properties)64 File (java.io.File)26 Test (org.junit.Test)22 IOException (java.io.IOException)21 Subject (javax.security.auth.Subject)21 NamePasswordCallbackHandler (org.apache.karaf.jaas.modules.NamePasswordCallbackHandler)21 RolePrincipal (org.apache.karaf.jaas.boot.principal.RolePrincipal)16 UserPrincipal (org.apache.karaf.jaas.boot.principal.UserPrincipal)16 Principal (java.security.Principal)12 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 GroupPrincipal (org.apache.karaf.jaas.boot.principal.GroupPrincipal)6 Map (java.util.Map)5 AbstractKerberosITest (org.apache.directory.server.kerberos.kdc.AbstractKerberosITest)5 FileInputStream (java.io.FileInputStream)4 MalformedURLException (java.net.MalformedURLException)4 URL (java.net.URL)4 LinkedHashMap (java.util.LinkedHashMap)4 TreeMap (java.util.TreeMap)4 FailedLoginException (javax.security.auth.login.FailedLoginException)4