Search in sources :

Example 51 with Configuration

use of org.apache.commons.configuration.Configuration in project incubator-atlas by apache.

the class AtlasADAuthenticationProvider method setADProperties.

private void setADProperties() {
    try {
        Configuration configuration = ApplicationProperties.get();
        Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap.ad"));
        this.adDomain = properties.getProperty("domain");
        this.adURL = properties.getProperty("url");
        this.adBindDN = properties.getProperty("bind.dn");
        this.adBindPassword = properties.getProperty("bind.password");
        this.adUserSearchFilter = properties.getProperty("user.searchfilter");
        this.adBase = properties.getProperty("base.dn");
        this.adReferral = properties.getProperty("referral");
        this.adDefaultRole = properties.getProperty("default.role");
        this.groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true);
        if (LOG.isDebugEnabled()) {
            LOG.debug("AtlasADAuthenticationProvider{" + "adURL='" + adURL + '\'' + ", adDomain='" + adDomain + '\'' + ", adBindDN='" + adBindDN + '\'' + ", adUserSearchFilter='" + adUserSearchFilter + '\'' + ", adBase='" + adBase + '\'' + ", adReferral='" + adReferral + '\'' + ", adDefaultRole='" + adDefaultRole + '\'' + ", groupsFromUGI=" + groupsFromUGI + '}');
        }
    } catch (Exception e) {
        LOG.error("Exception while setADProperties", e);
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Properties(java.util.Properties) ApplicationProperties(org.apache.atlas.ApplicationProperties)

Example 52 with Configuration

use of org.apache.commons.configuration.Configuration in project incubator-atlas by apache.

the class AtlasAuthenticationProvider method setAuthenticationMethod.

@PostConstruct
void setAuthenticationMethod() {
    try {
        Configuration configuration = ApplicationProperties.get();
        this.fileAuthenticationMethodEnabled = configuration.getBoolean(FILE_AUTH_METHOD, true);
        boolean ldapAuthenticationEnabled = configuration.getBoolean(LDAP_AUTH_METHOD, false);
        if (ldapAuthenticationEnabled) {
            this.ldapType = configuration.getString(LDAP_TYPE, "NONE");
        } else {
            this.ldapType = "NONE";
        }
    } catch (Exception e) {
        LOG.error("Error while getting atlas.login.method application properties", e);
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) AuthenticationException(org.springframework.security.core.AuthenticationException) PostConstruct(javax.annotation.PostConstruct)

Example 53 with Configuration

use of org.apache.commons.configuration.Configuration in project incubator-atlas by apache.

the class AtlasLdapAuthenticationProvider method setLdapProperties.

private void setLdapProperties() {
    try {
        Configuration configuration = ApplicationProperties.get();
        Properties properties = ConfigurationConverter.getProperties(configuration.subset("atlas.authentication.method.ldap"));
        ldapURL = properties.getProperty("url");
        ldapUserDNPattern = properties.getProperty("userDNpattern");
        ldapGroupSearchBase = properties.getProperty("groupSearchBase");
        ldapGroupSearchFilter = properties.getProperty("groupSearchFilter");
        ldapGroupRoleAttribute = properties.getProperty("groupRoleAttribute");
        ldapBindDN = properties.getProperty("bind.dn");
        ldapBindPassword = properties.getProperty("bind.password");
        ldapDefaultRole = properties.getProperty("default.role");
        ldapUserSearchFilter = properties.getProperty("user.searchfilter");
        ldapReferral = properties.getProperty("referral");
        ldapBase = properties.getProperty("base.dn");
        groupsFromUGI = configuration.getBoolean("atlas.authentication.method.ldap.ugi-groups", true);
        if (LOG.isDebugEnabled()) {
            LOG.debug("AtlasLdapAuthenticationProvider{" + "ldapURL='" + ldapURL + '\'' + ", ldapUserDNPattern='" + ldapUserDNPattern + '\'' + ", ldapGroupSearchBase='" + ldapGroupSearchBase + '\'' + ", ldapGroupSearchFilter='" + ldapGroupSearchFilter + '\'' + ", ldapGroupRoleAttribute='" + ldapGroupRoleAttribute + '\'' + ", ldapBindDN='" + ldapBindDN + '\'' + ", ldapDefaultRole='" + ldapDefaultRole + '\'' + ", ldapUserSearchFilter='" + ldapUserSearchFilter + '\'' + ", ldapReferral='" + ldapReferral + '\'' + ", ldapBase='" + ldapBase + '\'' + ", groupsFromUGI=" + groupsFromUGI + '}');
        }
    } catch (Exception e) {
        LOG.error("Exception while setLdapProperties", e);
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) Properties(java.util.Properties) ApplicationProperties(org.apache.atlas.ApplicationProperties) AuthenticationException(org.springframework.security.core.AuthenticationException)

Example 54 with Configuration

use of org.apache.commons.configuration.Configuration in project incubator-atlas by apache.

the class Titan1GraphDatabase method getConfiguration.

public static Configuration getConfiguration() throws AtlasException {
    Configuration configProperties = ApplicationProperties.get();
    Configuration titanConfig = ApplicationProperties.getSubsetConfiguration(configProperties, GRAPH_PREFIX);
    //add serializers for non-standard property value types that Atlas uses
    titanConfig.addProperty("attributes.custom.attribute1.attribute-class", TypeCategory.class.getName());
    titanConfig.addProperty("attributes.custom.attribute1.serializer-class", TypeCategorySerializer.class.getName());
    //not ideal, but avoids making large changes to Atlas
    titanConfig.addProperty("attributes.custom.attribute2.attribute-class", ArrayList.class.getName());
    titanConfig.addProperty("attributes.custom.attribute2.serializer-class", StringListSerializer.class.getName());
    titanConfig.addProperty("attributes.custom.attribute3.attribute-class", BigInteger.class.getName());
    titanConfig.addProperty("attributes.custom.attribute3.serializer-class", BigIntegerSerializer.class.getName());
    titanConfig.addProperty("attributes.custom.attribute4.attribute-class", BigDecimal.class.getName());
    titanConfig.addProperty("attributes.custom.attribute4.serializer-class", BigDecimalSerializer.class.getName());
    return titanConfig;
}
Also used : Configuration(org.apache.commons.configuration.Configuration) StringListSerializer(org.apache.atlas.repository.graphdb.titan1.serializer.StringListSerializer) ArrayList(java.util.ArrayList) TypeCategory(org.apache.atlas.typesystem.types.DataTypes.TypeCategory) BigInteger(java.math.BigInteger) BigIntegerSerializer(org.apache.atlas.repository.graphdb.titan1.serializer.BigIntegerSerializer) BigDecimal(java.math.BigDecimal) TypeCategorySerializer(org.apache.atlas.repository.graphdb.titan1.serializer.TypeCategorySerializer) BigDecimalSerializer(org.apache.atlas.repository.graphdb.titan1.serializer.BigDecimalSerializer)

Example 55 with Configuration

use of org.apache.commons.configuration.Configuration in project incubator-atlas by apache.

the class SqoopHook method publish.

@Override
public void publish(SqoopJobDataPublisher.Data data) throws AtlasHookException {
    try {
        Configuration atlasProperties = ApplicationProperties.get();
        String clusterName = atlasProperties.getString(ATLAS_CLUSTER_NAME, DEFAULT_CLUSTER_NAME);
        Referenceable dbStoreRef = createDBStoreInstance(data);
        Referenceable dbRef = createHiveDatabaseInstance(clusterName, data.getHiveDB());
        Referenceable hiveTableRef = createHiveTableInstance(clusterName, dbRef, data.getHiveTable(), data.getHiveDB());
        Referenceable procRef = createSqoopProcessInstance(dbStoreRef, hiveTableRef, data, clusterName);
        int maxRetries = atlasProperties.getInt(HOOK_NUM_RETRIES, 3);
        HookNotification.HookNotificationMessage message = new HookNotification.EntityCreateRequest(AtlasHook.getUser(), dbStoreRef, dbRef, hiveTableRef, procRef);
        AtlasHook.notifyEntities(Arrays.asList(message), maxRetries);
    } catch (Exception e) {
        throw new AtlasHookException("SqoopHook.publish() failed.", e);
    }
}
Also used : HookNotification(org.apache.atlas.notification.hook.HookNotification) Configuration(org.apache.commons.configuration.Configuration) Referenceable(org.apache.atlas.typesystem.Referenceable) ImportException(org.apache.sqoop.util.ImportException) AtlasHookException(org.apache.atlas.hook.AtlasHookException) AtlasHookException(org.apache.atlas.hook.AtlasHookException)

Aggregations

Configuration (org.apache.commons.configuration.Configuration)185 Test (org.junit.Test)51 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)44 ZapXmlConfiguration (org.zaproxy.zap.utils.ZapXmlConfiguration)23 Test (org.testng.annotations.Test)22 File (java.io.File)14 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)13 MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)11 Properties (java.util.Properties)10 HashMap (java.util.HashMap)9 AtlasException (org.apache.atlas.AtlasException)9 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)9 ArrayList (java.util.ArrayList)8 ZkUtils (kafka.utils.ZkUtils)8 ConfigurationException (org.apache.commons.configuration.ConfigurationException)8 IndexLoadingConfigMetadata (com.linkedin.pinot.common.metadata.segment.IndexLoadingConfigMetadata)7 AtlasClient (org.apache.atlas.AtlasClient)6 BeforeClass (org.testng.annotations.BeforeClass)6 MockResponse (com.github.bordertech.wcomponents.util.mock.MockResponse)5 IOException (java.io.IOException)5