當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getString方法代碼示例

本文整理匯總了Java中org.apache.flink.configuration.Configuration.getString方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getString方法的具體用法?Java Configuration.getString怎麽用?Java Configuration.getString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.flink.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromEnvironment

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Configures the overlay using the current environment (and global configuration).
 *
 * The following Flink configuration settings are used to source the keystore and truststore:
 *  - security.ssl.keystore
 *  - security.ssl.truststore
 */
public Builder fromEnvironment(Configuration globalConfiguration)  {

	String keystore = globalConfiguration.getString(SecurityOptions.SSL_KEYSTORE);
	if(keystore != null) {
		keystorePath = new File(keystore);
		if(!keystorePath.exists()) {
			throw new IllegalStateException("Invalid configuration for " + SecurityOptions.SSL_KEYSTORE.key());
		}
	}

	String truststore = globalConfiguration.getString(SecurityOptions.SSL_TRUSTSTORE);
	if(truststore != null) {
		truststorePath = new File(truststore);
		if(!truststorePath.exists()) {
			throw new IllegalStateException("Invalid configuration for " + SecurityOptions.SSL_TRUSTSTORE.key());
		}
	}

	return this;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:28,代碼來源:SSLStoreOverlay.java

示例2: PythonPlanBinder

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
public PythonPlanBinder(Configuration globalConfig) {
	String configuredPlanTmpPath = globalConfig.getString(PythonOptions.PLAN_TMP_DIR);
	tmpPlanFilesDir = configuredPlanTmpPath != null
		? configuredPlanTmpPath
		: System.getProperty("java.io.tmpdir") + File.separator + "flink_plan_" + UUID.randomUUID();

	tmpDistributedDir = new Path(globalConfig.getString(PythonOptions.DC_TMP_DIR));

	operatorConfig = new Configuration();
	operatorConfig.setString(PythonOptions.PYTHON_BINARY_PATH, globalConfig.getString(PythonOptions.PYTHON_BINARY_PATH));
	String configuredTmpDataDir = globalConfig.getString(PythonOptions.DATA_TMP_DIR);
	if (configuredTmpDataDir != null) {
		operatorConfig.setString(PythonOptions.DATA_TMP_DIR, configuredTmpDataDir);
	}
	operatorConfig.setLong(PythonOptions.MMAP_FILE_SIZE, globalConfig.getLong(PythonOptions.MMAP_FILE_SIZE));
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:PythonPlanBinder.java

示例3: SecurityConfiguration

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Create a security configuration from the global configuration.
 * @param flinkConf the Flink global configuration.
 * @param securityModuleFactories the security modules to apply.
 */
public SecurityConfiguration(Configuration flinkConf,
		List<SecurityModuleFactory> securityModuleFactories) {
	this.isZkSaslDisable = flinkConf.getBoolean(SecurityOptions.ZOOKEEPER_SASL_DISABLE);
	this.keytab = flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_KEYTAB);
	this.principal = flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL);
	this.useTicketCache = flinkConf.getBoolean(SecurityOptions.KERBEROS_LOGIN_USETICKETCACHE);
	this.loginContextNames = parseList(flinkConf.getString(SecurityOptions.KERBEROS_LOGIN_CONTEXTS));
	this.zkServiceName = flinkConf.getString(SecurityOptions.ZOOKEEPER_SASL_SERVICE_NAME);
	this.zkLoginContextName = flinkConf.getString(SecurityOptions.ZOOKEEPER_SASL_LOGIN_CONTEXT_NAME);
	this.securityModuleFactories = Collections.unmodifiableList(securityModuleFactories);
	this.flinkConfig = checkNotNull(flinkConf);
	validate();
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:SecurityConfiguration.java

示例4: initPossibleProperties

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
private List<OperatorDescriptorSingle> initPossibleProperties(Partitioner<?> customPartitioner) {
	// see if an internal hint dictates the strategy to use
	final Configuration conf = getOperator().getParameters();
	final String localStrategy = conf.getString(Optimizer.HINT_LOCAL_STRATEGY, null);

	final boolean useCombiner;
	if (localStrategy != null) {
		if (Optimizer.HINT_LOCAL_STRATEGY_SORT.equals(localStrategy)) {
			useCombiner = false;
		}
		else if (Optimizer.HINT_LOCAL_STRATEGY_COMBINING_SORT.equals(localStrategy)) {
			if (!isCombineable()) {
				Optimizer.LOG.warn("Strategy hint for GroupReduce '" + getOperator().getName() +
					"' requires combinable reduce, but user function is not marked combinable.");
			}
			useCombiner = true;
		} else {
			throw new CompilerException("Invalid local strategy hint for match contract: " + localStrategy);
		}
	} else {
		useCombiner = isCombineable();
	}
	
	// check if we can work with a grouping (simple reducer), or if we need ordering because of a group order
	Ordering groupOrder = null;
	if (getOperator() instanceof GroupReduceOperatorBase) {
		groupOrder = getOperator().getGroupOrder();
		if (groupOrder != null && groupOrder.getNumberOfFields() == 0) {
			groupOrder = null;
		}
	}
	
	OperatorDescriptorSingle props = useCombiner ?
		(this.keys == null ? new AllGroupWithPartialPreGroupProperties() : new GroupReduceWithCombineProperties(this.keys, groupOrder, customPartitioner)) :
		(this.keys == null ? new AllGroupReduceProperties() : new GroupReduceProperties(this.keys, groupOrder, customPartitioner));

	return Collections.singletonList(props);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:39,代碼來源:GroupReduceNode.java

示例5: createSSLClientContext

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Creates the SSL Context for the client if SSL is configured.
 *
 * @param sslConfig
 *        The application configuration
 * @return The SSLContext object which can be used by the ssl transport client
 * 	       Returns null if SSL is disabled
 * @throws Exception
 *         Thrown if there is any misconfiguration
 */
public static SSLContext createSSLClientContext(Configuration sslConfig) throws Exception {

	Preconditions.checkNotNull(sslConfig);
	SSLContext clientSSLContext = null;

	if (getSSLEnabled(sslConfig)) {
		LOG.debug("Creating client SSL context from configuration");

		String trustStoreFilePath = sslConfig.getString(SecurityOptions.SSL_TRUSTSTORE);
		String trustStorePassword = sslConfig.getString(SecurityOptions.SSL_TRUSTSTORE_PASSWORD);
		String sslProtocolVersion = sslConfig.getString(SecurityOptions.SSL_PROTOCOL);

		Preconditions.checkNotNull(trustStoreFilePath, SecurityOptions.SSL_TRUSTSTORE.key() + " was not configured.");
		Preconditions.checkNotNull(trustStorePassword, SecurityOptions.SSL_TRUSTSTORE_PASSWORD.key() + " was not configured.");

		KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());

		FileInputStream trustStoreFile = null;
		try {
			trustStoreFile = new FileInputStream(new File(trustStoreFilePath));
			trustStore.load(trustStoreFile, trustStorePassword.toCharArray());
		} finally {
			if (trustStoreFile != null) {
				trustStoreFile.close();
			}
		}

		TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(
			TrustManagerFactory.getDefaultAlgorithm());
		trustManagerFactory.init(trustStore);

		clientSSLContext = SSLContext.getInstance(sslProtocolVersion);
		clientSSLContext.init(null, trustManagerFactory.getTrustManagers(), null);
	}

	return clientSSLContext;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:48,代碼來源:SSLUtils.java

示例6: getUploadDir

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
private File getUploadDir(Configuration configuration) {
	File baseDir = new File(configuration.getString(WebOptions.UPLOAD_DIR,
		getBaseDirStr(configuration)));

	boolean uploadDirSpecified = configuration.contains(WebOptions.UPLOAD_DIR);
	return uploadDirSpecified ? baseDir : new File(baseDir, "flink-web-" + UUID.randomUUID());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:8,代碼來源:WebRuntimeMonitor.java

示例7: configure

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
@Override
public void configure(Configuration parameters) {
    connString = parameters.getString("db.connection", null);
    connUser = parameters.getString("db.user", null);
    connPassword = parameters.getString("db.password", null);

    if (connString == null || connUser == null || connPassword == null) {
        throw new InvalidParameterException("Required parameteres were not specified");
    }
}
 
開發者ID:Remper,項目名稱:sociallink,代碼行數:11,代碼來源:AbstractPostgresSink.java

示例8: substituteDeprecatedConfigKey

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
* Sets the value of a new config key to the value of a deprecated config key.
* @param config Config to write
* @param deprecated The old config key
* @param designated The new config key
*/
public static void substituteDeprecatedConfigKey(Configuration config, String deprecated, String designated) {
	// set the designated key only if it is not set already
	if (!config.containsKey(designated)) {
		final String valueForDeprecated = config.getString(deprecated, null);
		if (valueForDeprecated != null) {
			config.setString(designated, valueForDeprecated);
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:16,代碼來源:BootstrapTools.java

示例9: fromEnvironment

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Configures the overlay using the current environment (and global configuration).
 *
 * The following Flink configuration settings are checked for a keytab:
 *  - security.kerberos.login.keytab
 */
public Builder fromEnvironment(Configuration globalConfiguration) {
	String keytab = globalConfiguration.getString(SecurityOptions.KERBEROS_LOGIN_KEYTAB);
	if(keytab != null) {
		keytabPath = new File(keytab);
		if(!keytabPath.exists()) {
			throw new IllegalStateException("Invalid configuration for " +
				SecurityOptions.KERBEROS_LOGIN_KEYTAB +
				"; '" + keytab + "' not found.");
		}
	}

	return this;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:20,代碼來源:KeytabOverlay.java

示例10: createCheckpointIDCounter

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Creates a {@link ZooKeeperCheckpointIDCounter} instance.
 *
 * @param client        The {@link CuratorFramework} ZooKeeper client to use
 * @param configuration {@link Configuration} object
 * @param jobId         ID of job to create the instance for
 * @return {@link ZooKeeperCheckpointIDCounter} instance
 */
public static ZooKeeperCheckpointIDCounter createCheckpointIDCounter(
		CuratorFramework client,
		Configuration configuration,
		JobID jobId) {

	String checkpointIdCounterPath = configuration.getString(
			HighAvailabilityOptions.HA_ZOOKEEPER_CHECKPOINT_COUNTER_PATH);

	checkpointIdCounterPath += ZooKeeperSubmittedJobGraphStore.getPathForJob(jobId);

	return new ZooKeeperCheckpointIDCounter(client, checkpointIdCounterPath);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:21,代碼來源:ZooKeeperUtils.java

示例11: readParametersFromConfig

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void readParametersFromConfig(Configuration config, ClassLoader cl) throws ClassNotFoundException {
	// figure out how many key fields there are
	final int numKeyFields = config.getInteger(NUM_KEYS, -1);
	if (numKeyFields < 0) {
		throw new IllegalConfigurationException("The number of keys for the comparator is invalid: " + numKeyFields);
	}
	
	final int[] positions = new int[numKeyFields];
	final Class<? extends Value>[] types = new Class[numKeyFields];
	final boolean[] direction = new boolean[numKeyFields];
	
	// read the individual key positions and types
	for (int i = 0; i < numKeyFields; i++) {
		// next key position
		final int p = config.getInteger(KEY_POS_PREFIX + i, -1);
		if (p >= 0) {
			positions[i] = p;
		} else {
			throw new IllegalConfigurationException("Contained invalid position for key no positions for keys.");
		}
		
		// next key type
		final String name = config.getString(KEY_CLASS_PREFIX + i, null);
		if (name != null) {
			types[i] = (Class<? extends Value>) Class.forName(name, true, cl).asSubclass(Value.class);
		} else {
			throw new IllegalConfigurationException("The key type (" + i +
				") for the comparator is null"); 
		}
		
		// next key sort direction
		direction[i] = config.getBoolean(KEY_SORT_DIRECTION_PREFIX + i, true);
	}
	
	this.positions = positions;
	this.types = types;
	this.sortDirections = direction;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:41,代碼來源:RecordComparatorFactory.java

示例12: verifyRecoveryState

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Fails the test if the recovery state (file state backend and ZooKeeper) has been cleaned.
 */
private void verifyRecoveryState(Configuration config) throws Exception {
	// File state backend empty
	Collection<File> stateHandles = FileUtils.listFiles(
			tempFolder.getRoot(), TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);

	if (stateHandles.isEmpty()) {
		fail("File state backend has been cleaned: " + stateHandles);
	}

	// ZooKeeper
	String currentJobsPath = config.getString(
		HighAvailabilityOptions.HA_ZOOKEEPER_JOBGRAPHS_PATH);

	Stat stat = ZooKeeper.getClient().checkExists().forPath(currentJobsPath);

	if (stat.getCversion() == 0) {
		// Sanity check: verify that some changes have been performed
		fail("ZooKeeper state for '" + currentJobsPath + "' has not been modified during " +
			"this test. What are you testing?");
	}

	if (stat.getNumChildren() == 0) {
		// Children have been cleaned up?
		fail("ZooKeeper path '" + currentJobsPath + "' has been cleaned: " +
			ZooKeeper.getClient().getChildren().forPath(currentJobsPath));
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:31,代碼來源:JobManagerHAJobGraphRecoveryITCase.java

示例13: checkJobManagerAddress

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
public static void checkJobManagerAddress(Configuration config, String expectedAddress, int expectedPort) {
	String jobManagerAddress = config.getString(JobManagerOptions.ADDRESS);
	int jobManagerPort = config.getInteger(JobManagerOptions.PORT, -1);

	assertEquals(expectedAddress, jobManagerAddress);
	assertEquals(expectedPort, jobManagerPort);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:8,代碼來源:CliFrontendTestUtils.java

示例14: createMesosServices

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
/**
 * Creates a {@link MesosServices} instance depending on the high availability settings.
 *
 * @param configuration containing the high availability settings
 * @param hostname the hostname to advertise to remote clients
 * @return a mesos services instance
 * @throws Exception if the mesos services instance could not be created
 */
public static MesosServices createMesosServices(Configuration configuration, String hostname) throws Exception {

	ActorSystem localActorSystem = AkkaUtils.createLocalActorSystem(configuration);

	MesosArtifactServer artifactServer = createArtifactServer(configuration, hostname);

	HighAvailabilityMode highAvailabilityMode = HighAvailabilityMode.fromConfig(configuration);

	switch (highAvailabilityMode) {
		case NONE:
			return new StandaloneMesosServices(localActorSystem, artifactServer);

		case ZOOKEEPER:
			final String zkMesosRootPath = configuration.getString(
				HighAvailabilityOptions.HA_ZOOKEEPER_MESOS_WORKERS_PATH);

			ZooKeeperUtilityFactory zooKeeperUtilityFactory = new ZooKeeperUtilityFactory(
				configuration,
				zkMesosRootPath);

			return new ZooKeeperMesosServices(localActorSystem, artifactServer, zooKeeperUtilityFactory);

		default:
			throw new Exception("High availability mode " + highAvailabilityMode + " is not supported.");
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:35,代碼來源:MesosServicesUtils.java

示例15: configure

import org.apache.flink.configuration.Configuration; //導入方法依賴的package包/類
@Override
public void configure(Configuration parameters) {
	// get the output file path, if it was not yet set
	if (this.outputFilePath == null) {
		// get the file parameter
		String filePath = parameters.getString(FILE_PARAMETER_KEY, null);
		if (filePath == null) {
			throw new IllegalArgumentException("The output path has been specified neither via constructor/setters" +
					", nor via the Configuration.");
		}
		
		try {
			this.outputFilePath = new Path(filePath);
		}
		catch (RuntimeException rex) {
			throw new RuntimeException("Could not create a valid URI from the given file path name: " + rex.getMessage()); 
		}
	}
	
	// check if have not been set and use the defaults in that case
	if (this.writeMode == null) {
		this.writeMode = DEFAULT_WRITE_MODE;
	}
	
	if (this.outputDirectoryMode == null) {
		this.outputDirectoryMode = DEFAULT_OUTPUT_DIRECTORY_MODE;
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:29,代碼來源:FileOutputFormat.java


注:本文中的org.apache.flink.configuration.Configuration.getString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。