当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationProperties类代码示例

本文整理汇总了Java中org.apache.atlas.ApplicationProperties的典型用法代码示例。如果您正苦于以下问题:Java ApplicationProperties类的具体用法?Java ApplicationProperties怎么用?Java ApplicationProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ApplicationProperties类属于org.apache.atlas包,在下文中一共展示了ApplicationProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAuthenticationMethod

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
@PostConstruct
void setAuthenticationMethod() {
    try {
        Configuration configuration = ApplicationProperties.get();

        this.fileAuthenticationMethodEnabled = configuration.getBoolean(FILE_AUTH_METHOD, true);

        this.pamAuthenticationEnabled = configuration.getBoolean(PAM_AUTH_METHOD, false);

        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);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:21,代码来源:AtlasAuthenticationProvider.java

示例2: setPamProperties

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
private void setPamProperties() {
    try {
        this.groupsFromUGI = ApplicationProperties.get().getBoolean("atlas.authentication.method.pam.ugi-groups", true);
        Properties properties = ConfigurationConverter.getProperties(ApplicationProperties.get()
                .subset("atlas.authentication.method.pam"));
        for (String key : properties.stringPropertyNames()) {
            String value = properties.getProperty(key);
            options.put(key, value);
        }
        if (!options.containsKey("service")) {
            options.put("service", "atlas-login");
        }
    } catch (Exception e) {
        LOG.error("Exception while setLdapProperties", e);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:AtlasPamAuthenticationProvider.java

示例3: matches

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
@Override
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
    try {
        Configuration configuration = ApplicationProperties.get();
        boolean shouldRunSetup = configuration.getBoolean(ATLAS_SERVER_RUN_SETUP_KEY, false);
        if (shouldRunSetup) {
            LOG.warn("Running setup per configuration {}.", ATLAS_SERVER_RUN_SETUP_KEY);
            return true;
        } else {
            LOG.info("Not running setup per configuration {}.", ATLAS_SERVER_RUN_SETUP_KEY);
        }
    } catch (AtlasException e) {
        LOG.error("Unable to read config to determine if setup is needed. Not running setup.");
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:17,代码来源:SetupSteps.java

示例4: loadFileLoginsDetails

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
void loadFileLoginsDetails() {
    InputStream inStr = null;
    try {
        Configuration configuration = ApplicationProperties.get();
        inStr = ApplicationProperties.getFileAsInputStream(configuration, "atlas.authentication.method.file.filename", DEFAULT_USER_CREDENTIALS_PROPERTIES);
        userLogins = new Properties();
        userLogins.load(inStr);
    } catch (IOException | AtlasException e) {
        LOG.error("Error while reading user.properties file", e);
        throw new RuntimeException(e);
    } finally {
        if(inStr != null) {
            try {
                inStr.close();
            } catch(Exception excp) {
                // ignore
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:21,代码来源:UserDao.java

示例5: NotificationHookConsumer

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
@Inject
public NotificationHookConsumer(NotificationInterface notificationInterface, AtlasEntityStore atlasEntityStore,
                                ServiceState serviceState, AtlasInstanceConverter instanceConverter,
                                AtlasTypeRegistry typeRegistry) throws AtlasException {
    this.notificationInterface = notificationInterface;
    this.atlasEntityStore = atlasEntityStore;
    this.serviceState = serviceState;
    this.instanceConverter = instanceConverter;
    this.typeRegistry = typeRegistry;

    this.applicationProperties = ApplicationProperties.get();

    maxRetries = applicationProperties.getInt(CONSUMER_RETRIES_PROPERTY, 3);
    failedMsgCacheSize = applicationProperties.getInt(CONSUMER_FAILEDCACHESIZE_PROPERTY, 20);
    consumerRetryInterval = applicationProperties.getInt(CONSUMER_RETRY_INTERVAL, 500);

}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:18,代码来源:NotificationHookConsumer.java

示例6: writeConfiguration

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
public static String writeConfiguration(final PropertiesConfiguration configuration) throws Exception {
    String confLocation = System.getProperty("atlas.conf");
    URL url;
    if (confLocation == null) {
        url = BaseSecurityTest.class.getResource("/" + ApplicationProperties.APPLICATION_PROPERTIES);
    } else {
        url = new File(confLocation, ApplicationProperties.APPLICATION_PROPERTIES).toURI().toURL();
    }
    PropertiesConfiguration configuredProperties = new PropertiesConfiguration();
    configuredProperties.load(url);

    configuredProperties.copy(configuration);

    String persistDir = TestUtils.getTempDirectory();
    configuredProperties.setProperty("atlas.authentication.method.file", "true");
    configuredProperties.setProperty("atlas.authentication.method.file.filename", persistDir
            + "/users-credentials");
    configuredProperties.setProperty("atlas.auth.policy.file",persistDir
            + "/policy-store.txt" );
    TestUtils.writeConfiguration(configuredProperties, persistDir + File.separator +
            ApplicationProperties.APPLICATION_PROPERTIES);
    setupUserCredential(persistDir);
    setUpPolicyStore(persistDir);
    ApplicationProperties.forceReload();
    return persistDir;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:27,代码来源:BaseSecurityTest.java

示例7: testNoConfiguredCredentialProvider

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
@Test
public void testNoConfiguredCredentialProvider() throws Exception {
    String originalConf = null;
    try {
        originalConf = System.getProperty("atlas.conf");
        System.clearProperty("atlas.conf");
        ApplicationProperties.forceReload();
        secureEmbeddedServer = new SecureEmbeddedServer(securePort, TestUtils.getWarPath());
        secureEmbeddedServer.server.start();

        Assert.fail("Should have thrown an exception");
    } catch (IOException e) {
        Assert.assertEquals(e.getMessage(),
                "No credential provider path configured for storage of certificate store passwords");
    } finally {
        if (secureEmbeddedServer != null) {
            secureEmbeddedServer.server.stop();
        }

        if (originalConf == null) {
            System.clearProperty("atlas.conf");
        } else {
            System.setProperty("atlas.conf", originalConf);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:27,代码来源:SecureEmbeddedServerTestBase.java

示例8: validateType

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
public void validateType(AtlasBaseTypeDef typeDef) throws AtlasBaseException {
    if (!isValidName(typeDef.getName())) {
        throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID_FORMAT, typeDef.getName(), typeDef.getCategory().name());
    }

    try {
        final boolean allowReservedKeywords = ApplicationProperties.get().getBoolean(ALLOW_RESERVED_KEYWORDS, true);

        if (!allowReservedKeywords && typeDef instanceof AtlasStructDef) {
            final List<AtlasStructDef.AtlasAttributeDef> attributeDefs = ((AtlasStructDef) typeDef).getAttributeDefs();
            for (AtlasStructDef.AtlasAttributeDef attrDef : attributeDefs) {
                if (QueryParser.isKeyword(attrDef.getName())) {
                    throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_NAME_INVALID, attrDef.getName(), typeDef.getCategory().name());
                }
            }
        }
    } catch (AtlasException e) {
        LOG.error("Exception while loading configuration ", e);
        throw new AtlasBaseException(AtlasErrorCode.INTERNAL_ERROR, "Could not load configuration");
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:AtlasAbstractDefStoreV1.java

示例9: getTypeUpdateLockMaxWaitTimeInSeconds

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
public static int getTypeUpdateLockMaxWaitTimeInSeconds() {
    Integer ret = typeUpdateLockMaxWaitTimeInSeconds;

    if (ret == null) {
        try {
            Configuration config = ApplicationProperties.get();

            ret = config.getInteger(CONFIG_TYPE_UPDATE_LOCK_MAX_WAIT_TIME_IN_SECONDS, DEFAULT_TYPE_UPDATE_LOCK_MAX_WAIT_TIME_IN_SECONDS);

            typeUpdateLockMaxWaitTimeInSeconds = ret;
        } catch (AtlasException e) {
            // ignore
        }
    }

    return ret == null ? DEFAULT_TYPE_UPDATE_LOCK_MAX_WAIT_TIME_IN_SECONDS : ret;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:18,代码来源:AtlasRepositoryConfiguration.java

示例10: getConfiguration

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:24,代码来源:Titan1GraphDatabase.java

示例11: create

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
public static void create(String sandboxName) {
    Configuration configuration;
    try {
        configuration = ApplicationProperties.get();

        String newStorageDir = System.getProperty("atlas.data") +
                File.separatorChar + "storage" +
                File.separatorChar + sandboxName;

        configuration.setProperty("atlas.graph.storage.directory", newStorageDir);


        String newIndexerDir = System.getProperty("atlas.data") +
                File.separatorChar + "index" +
                File.separatorChar + sandboxName;

        configuration.setProperty("atlas.graph.index.search.directory", newIndexerDir);


        LOG.debug("New Storage dir : {}", newStorageDir);
        LOG.debug("New Indexer dir : {}", newIndexerDir);
    } catch (AtlasException ignored) {}
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:24,代码来源:GraphSandboxUtil.java

示例12: publish

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:22,代码来源:SqoopHook.java

示例13: setADProperties

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
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);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:35,代码来源:AtlasADAuthenticationProvider.java

示例14: setLdapProperties

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
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);
    }

}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:39,代码来源:AtlasLdapAuthenticationProvider.java

示例15: getConfiguration

import org.apache.atlas.ApplicationProperties; //导入依赖的package包/类
/**
 * Returns the application configuration.
 * @return
 */
protected org.apache.commons.configuration.Configuration getConfiguration() {
    try {
        return ApplicationProperties.get();
    } catch (AtlasException e) {
        throw new RuntimeException("Unable to load configuration: " + ApplicationProperties.APPLICATION_PROPERTIES);
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:12,代码来源:SecureEmbeddedServer.java


注:本文中的org.apache.atlas.ApplicationProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。