Java Code Examples for org.apache.atlas.ApplicationProperties#get()
The following examples show how to use
org.apache.atlas.ApplicationProperties#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserDao.java From incubator-atlas with Apache License 2.0 | 6 votes |
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 } } } }
Example 2
Source File: NotificationHookConsumer.java From incubator-atlas with Apache License 2.0 | 6 votes |
@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); }
Example 3
Source File: AtlasRepositoryConfiguration.java From atlas with Apache License 2.0 | 6 votes |
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; }
Example 4
Source File: AtlasLdapAuthenticationProvider.java From incubator-atlas with Apache License 2.0 | 5 votes |
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); } }
Example 5
Source File: QuickStart.java From incubator-atlas with Apache License 2.0 | 5 votes |
static String[] getServerUrl(String[] args) throws AtlasException { if (args.length > 0) { return args[0].split(","); } Configuration configuration = ApplicationProperties.get(); String[] urls = configuration.getStringArray(ATLAS_REST_ADDRESS); if (urls == null || urls.length == 0) { System.out.println("Usage: quick_start_v1.py <atlas endpoint of format <http/https>://<atlas-fqdn>:<atlas port> like http://localhost:21000>"); System.exit(-1); } return urls; }
Example 6
Source File: BulkFetchAndUpdate.java From atlas with Apache License 2.0 | 5 votes |
private static String[] getAtlasRESTUrl() { Configuration atlasConf = null; try { atlasConf = ApplicationProperties.get(); return atlasConf.getStringArray(APPLICATION_PROPERTY_ATLAS_ENDPOINT); } catch (AtlasException e) { return new String[]{DEFAULT_ATLAS_URL}; } }
Example 7
Source File: NotificationProvider.java From atlas with Apache License 2.0 | 5 votes |
public static KafkaNotification get() { if (kafka == null) { try { Configuration applicationProperties = ApplicationProperties.get(); kafka = new KafkaNotification(applicationProperties); } catch (AtlasException e) { throw new RuntimeException(e); } } return kafka; }
Example 8
Source File: NotificationHookConsumerKafkaTest.java From atlas with Apache License 2.0 | 5 votes |
void initNotificationService() throws AtlasException, InterruptedException { Configuration applicationProperties = ApplicationProperties.get(); applicationProperties.setProperty("atlas.kafka.data", "target/" + RandomStringUtils.randomAlphanumeric(5)); kafkaServer = new EmbeddedKafkaServer(applicationProperties); kafkaNotification = new KafkaNotification(applicationProperties); notificationInterface = kafkaNotification; kafkaServer.start(); kafkaNotification.start(); Thread.sleep(2000); }
Example 9
Source File: SqoopHook.java From atlas with Apache License 2.0 | 5 votes |
@Override public void publish(SqoopJobDataPublisher.Data data) throws AtlasHookException { try { Configuration atlasProperties = ApplicationProperties.get(); String metadataNamespace = atlasProperties.getString(ATLAS_METADATA_NAMESPACE, getClusterName(atlasProperties)); AtlasEntity entDbStore = toSqoopDBStoreEntity(data); AtlasEntity entHiveDb = toHiveDatabaseEntity(metadataNamespace, data.getHiveDB()); AtlasEntity entHiveTable = data.getHiveTable() != null ? toHiveTableEntity(entHiveDb, data.getHiveTable()) : null; AtlasEntity entProcess = toSqoopProcessEntity(entDbStore, entHiveDb, entHiveTable, data, metadataNamespace); AtlasEntitiesWithExtInfo entities = new AtlasEntitiesWithExtInfo(entProcess); entities.addReferredEntity(entDbStore); entities.addReferredEntity(entHiveDb); if (entHiveTable != null) { entities.addReferredEntity(entHiveTable); } HookNotification message = new EntityCreateRequestV2(AtlasHook.getUser(), entities); atlasHook.sendNotification(message); } catch(Exception e) { LOG.error("SqoopHook.publish() failed", e); throw new AtlasHookException("SqoopHook.publish() failed.", e); } }
Example 10
Source File: AtlasRepositoryConfiguration.java From incubator-atlas with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static Class<? extends TypeCache> getTypeCache() { // Get the type cache implementation class from Atlas configuration. try { Configuration config = ApplicationProperties.get(); return ApplicationProperties.getClass(config, TYPE_CACHE_IMPLEMENTATION_PROPERTY, DefaultTypeCache.class.getName(), TypeCache.class); } catch (AtlasException e) { LOG.error("Error loading typecache ", e); return DefaultTypeCache.class; } }
Example 11
Source File: QuickStartV2.java From atlas with Apache License 2.0 | 5 votes |
static String[] getServerUrl(String[] args) throws AtlasException { if (args.length > 0) { return args[0].split(","); } Configuration configuration = ApplicationProperties.get(); String[] urls = configuration.getStringArray(ATLAS_REST_ADDRESS); if (ArrayUtils.isEmpty(urls)) { System.out.println("org.apache.atlas.examples.QuickStartV2 <Atlas REST address <http/https>://<atlas-fqdn>:<atlas-port> like http://localhost:21000>"); System.exit(-1); } return urls; }
Example 12
Source File: FalconHookIT.java From atlas with Apache License 2.0 | 5 votes |
@BeforeClass public void setUp() throws Exception { Configuration atlasProperties = ApplicationProperties.get(); if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) { atlasClient = new AtlasClient(atlasProperties.getStringArray(HiveMetaStoreBridge.ATLAS_ENDPOINT), new String[]{"admin", "admin"}); } else { atlasClient = new AtlasClient(atlasProperties.getStringArray(HiveMetaStoreBridge.ATLAS_ENDPOINT)); } AtlasService service = new AtlasService(); service.init(); STORE.registerListener(service); CurrentUser.authenticate(System.getProperty("user.name")); }
Example 13
Source File: GraphRepoMapperScaleTest.java From incubator-atlas with Apache License 2.0 | 5 votes |
@BeforeClass @GraphTransaction public void setUp() throws Exception { //force up front graph initialization TestUtils.getGraph(); searchIndexer = new GraphBackedSearchIndexer(new AtlasGraphProvider(), ApplicationProperties.get(), new AtlasTypeRegistry()); //Make sure we can cleanup the index directory Collection<IDataType> typesAdded = TestUtils.createHiveTypes(typeSystem); searchIndexer.onAdd(typesAdded); }
Example 14
Source File: NotificationHookConsumerKafkaTest.java From incubator-atlas with Apache License 2.0 | 5 votes |
KafkaNotification startKafkaServer() throws AtlasException, InterruptedException { Configuration applicationProperties = ApplicationProperties.get(); applicationProperties.setProperty("atlas.kafka.data", "target/" + RandomStringUtils.randomAlphanumeric(5)); kafkaNotification = new KafkaNotification(applicationProperties); kafkaNotification.start(); Thread.sleep(2000); return kafkaNotification; }
Example 15
Source File: StormAtlasHookIT.java From incubator-atlas with Apache License 2.0 | 5 votes |
@BeforeClass public void setUp() throws Exception { // start a local storm cluster stormCluster = StormTestUtil.createLocalStormCluster(); LOG.info("Created a storm local cluster"); Configuration configuration = ApplicationProperties.get(); if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) { atlasClient = new AtlasClient(configuration.getStringArray(HiveMetaStoreBridge.ATLAS_ENDPOINT), new String[]{"admin", "admin"}); } else { atlasClient = new AtlasClient(configuration.getStringArray(HiveMetaStoreBridge.ATLAS_ENDPOINT)); } }
Example 16
Source File: Constants.java From atlas with Apache License 2.0 | 5 votes |
private static String getEncodedTypePropertyKey(String defaultKey) { try { Configuration configuration = ApplicationProperties.get(); if (configuration.containsKey("atlas.graph.index.search.backend") && configuration.getString("atlas.graph.index.search.backend").equals("elasticsearch")) { return defaultKey.replaceAll("\\.", "_"); } return encodePropertyKey(defaultKey); } catch (AtlasException e) { return encodePropertyKey(defaultKey); } }
Example 17
Source File: AtlasKnoxSSOAuthenticationFilter.java From incubator-atlas with Apache License 2.0 | 5 votes |
@Inject public AtlasKnoxSSOAuthenticationFilter(AtlasAuthenticationProvider authenticationProvider) { this.authenticationProvider = authenticationProvider; try { configuration = ApplicationProperties.get(); } catch (Exception e) { LOG.error("Error while getting application properties", e); } if (configuration != null) { ssoEnabled = configuration.getBoolean("atlas.sso.knox.enabled", false); jwtProperties = loadJwtProperties(); } setJwtProperties(); }
Example 18
Source File: MetricsService.java From incubator-atlas with Apache License 2.0 | 4 votes |
@Inject public MetricsService(AtlasGraph atlasGraph) throws AtlasException { this(ApplicationProperties.get(), atlasGraph); }
Example 19
Source File: ServiceState.java From atlas with Apache License 2.0 | 4 votes |
public ServiceState() throws AtlasException { this(ApplicationProperties.get()); }
Example 20
Source File: AtlasTopicCreator.java From incubator-atlas with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws AtlasException { Configuration configuration = ApplicationProperties.get(); AtlasTopicCreator atlasTopicCreator = new AtlasTopicCreator(); atlasTopicCreator.createAtlasTopic(configuration, args); }