public ConfigModule(CConfiguration cConf, Configuration hConf, SConfiguration sConf) { CConfigurationUtil.verify(cConf); this.cConf = cConf; this.hConf = hConf; this.sConf = sConf; CConfigurationUtil.copyTxProperties(cConf, hConf); CConfigurationUtil.copyPrefixedProperties("twill.", cConf, hConf); CConfigurationUtil.copyPrefixedProperties("hbase.", cConf, hConf); // Set system properties for all HTTP requests if they were found String connectionTimeout = cConf.get(Constants.HTTP_CLIENT_CONNECTION_TIMEOUT_MS); String readTimeout = cConf.get(Constants.HTTP_CLIENT_READ_TIMEOUT_MS); if (connectionTimeout != null) { System.setProperty(DefaultHttpRequestConfig.CONNECTION_TIMEOUT_PROPERTY_NAME, connectionTimeout); } else { LOG.warn("Configuration for {} not found. Falling back to default value of {}", Constants.HTTP_CLIENT_CONNECTION_TIMEOUT_MS, DefaultHttpRequestConfig.DEFAULT_TIMEOUT); } if (readTimeout != null) { System.setProperty(DefaultHttpRequestConfig.READ_TIMEOUT_PROPERTY_NAME, readTimeout); } else { LOG.warn("Configuration for {} not found. Falling back to default value of {}", Constants.HTTP_CLIENT_READ_TIMEOUT_MS, DefaultHttpRequestConfig.DEFAULT_TIMEOUT); } }
/** * Asserts that the given CConfiguration has valid properties. * @param cConf the CConfiguration object to check * @throws IllegalArgumentException if the given cConf is invalid. */ public static void verify(CConfiguration cConf) { // Checks to ensure that certain keys (e.g. "root.prefix") are valid as expected by CDAP. assertAlphanumeric(cConf, Constants.ROOT_NAMESPACE); assertAlphanumeric(cConf, Constants.Dataset.TABLE_PREFIX); }
/** * Adds extra jars as defined in {@link CConfiguration} to the container and container classpath. */ private void addContainerJars(CConfiguration cConf, Map<String, LocalizeResource> localizeResources, Collection<String> classpath) { // Create localize resources and update classpath for the container based on the "program.container.dist.jars" // configuration. List<String> containerExtraJars = new ArrayList<>(); for (URI jarURI : CConfigurationUtil.getExtraJars(cConf)) { String scheme = jarURI.getScheme(); LocalizeResource localizeResource = new LocalizeResource(jarURI, false); String localizedName = LocalizationUtils.getLocalizedName(jarURI); localizeResources.put(localizedName, localizeResource); classpath.add(localizedName); String jarPath = "file".equals(scheme) ? localizedName : jarURI.toString(); containerExtraJars.add(jarPath); } // Set the "program.container.dist.jars" since files are already localized to the container. cConf.setStrings(Constants.AppFabric.PROGRAM_CONTAINER_DIST_JARS, containerExtraJars.toArray(new String[containerExtraJars.size()])); }
public static void main(String[] args) { // create a config and load the gateway properties CConfiguration cConf = CConfiguration.create(); Configuration hConf = new Configuration(); CConfigurationUtil.copyTxProperties(cConf, hConf); TransactionManagerDebuggerMain instance = new TransactionManagerDebuggerMain(hConf); boolean success = instance.execute(args); if (!success) { System.exit(1); } } }
private void assertIsValidCConf(CConfiguration cConf) { CConfigurationUtil.verify(cConf); } }
/** * Adds extra jars as defined in {@link CConfiguration} to the container and container classpath. */ private void addContainerJars(CConfiguration cConf, Map<String, LocalizeResource> localizeResources, Collection<String> classpath) { // Create localize resources and update classpath for the container based on the "program.container.dist.jars" // configuration. List<String> containerExtraJars = new ArrayList<>(); for (URI jarURI : CConfigurationUtil.getExtraJars(cConf)) { String scheme = jarURI.getScheme(); LocalizeResource localizeResource = new LocalizeResource(jarURI, false); String localizedName = LocalizationUtils.getLocalizedName(jarURI); localizeResources.put(localizedName, localizeResource); classpath.add(localizedName); String jarPath = "file".equals(scheme) ? localizedName : jarURI.toString(); containerExtraJars.add(jarPath); } // Set the "program.container.dist.jars" since files are already localized to the container. cConf.setStrings(Constants.AppFabric.PROGRAM_CONTAINER_DIST_JARS, containerExtraJars.toArray(new String[containerExtraJars.size()])); }
public static void main(String[] args) { // create a config and load the gateway properties CConfiguration cConf = CConfiguration.create(); Configuration hConf = new Configuration(); CConfigurationUtil.copyTxProperties(cConf, hConf); TransactionManagerDebuggerMain instance = new TransactionManagerDebuggerMain(hConf); boolean success = instance.execute(args); if (!success) { System.exit(1); } } }
private void assertIsInvalidCConf(CConfiguration cConf) { try { CConfigurationUtil.verify(cConf); Assert.fail("Expected cConf to be invalid"); } catch (IllegalArgumentException expected) { } }
for (URI jarURI : CConfigurationUtil.getExtraJars(cConfCopy)) { extraJars.add(Paths.get("$PWD", LocalizationUtils.getLocalizedName(jarURI)).toString()); localizeResources.add(new LocalizeResource(jarURI, false));
public ConfigModule(CConfiguration cConf, Configuration hConf, SConfiguration sConf) { CConfigurationUtil.verify(cConf); this.cConf = cConf; this.hConf = hConf; this.sConf = sConf; CConfigurationUtil.copyTxProperties(cConf, hConf); CConfigurationUtil.copyPrefixedProperties("twill.", cConf, hConf); CConfigurationUtil.copyPrefixedProperties("hbase.", cConf, hConf); // Set system properties for all HTTP requests if they were found String connectionTimeout = cConf.get(Constants.HTTP_CLIENT_CONNECTION_TIMEOUT_MS); String readTimeout = cConf.get(Constants.HTTP_CLIENT_READ_TIMEOUT_MS); if (connectionTimeout != null) { System.setProperty(DefaultHttpRequestConfig.CONNECTION_TIMEOUT_PROPERTY_NAME, connectionTimeout); } else { LOG.warn("Configuration for {} not found. Falling back to default value of {}", Constants.HTTP_CLIENT_CONNECTION_TIMEOUT_MS, DefaultHttpRequestConfig.DEFAULT_TIMEOUT); } if (readTimeout != null) { System.setProperty(DefaultHttpRequestConfig.READ_TIMEOUT_PROPERTY_NAME, readTimeout); } else { LOG.warn("Configuration for {} not found. Falling back to default value of {}", Constants.HTTP_CLIENT_READ_TIMEOUT_MS, DefaultHttpRequestConfig.DEFAULT_TIMEOUT); } }
@Override protected Configuration getSnapshotConfiguration() throws IOException { CConfiguration cConf = configReader.read(); Configuration txConf = HBaseConfiguration.create(getConf()); CConfigurationUtil.copyTxProperties(cConf, txConf); // Set the instance id so that it gets logged setId(cConf.get(Constants.INSTANCE_NAME)); return txConf; } }
/** * Asserts that the given CConfiguration has valid properties. * @param cConf the CConfiguration object to check * @throws IllegalArgumentException if the given cConf is invalid. */ public static void verify(CConfiguration cConf) { // Checks to ensure that certain keys (e.g. "root.prefix") are valid as expected by CDAP. assertAlphanumeric(cConf, Constants.ROOT_NAMESPACE); assertAlphanumeric(cConf, Constants.Dataset.TABLE_PREFIX); }
for (URI jarURI : CConfigurationUtil.getExtraJars(cConfCopy)) { extraJars.add(Paths.get("$PWD", LocalizationUtils.getLocalizedName(jarURI)).toString()); localizeResources.add(new LocalizeResource(jarURI, false));
@Override protected Configuration getSnapshotConfiguration() throws IOException { CConfiguration cConf = configReader.read(); Configuration txConf = HBaseConfiguration.create(getConf()); CConfigurationUtil.copyTxProperties(cConf, txConf); // Set the instance id so that it gets logged setId(cConf.get(Constants.INSTANCE_NAME)); return txConf; } }
for (URI jarURI : CConfigurationUtil.getExtraJars(cConfCopy)) { extraJars.add(Paths.get("$PWD", LocalizationUtils.getLocalizedName(jarURI)).toString()); localizeResources.add(new LocalizeResource(jarURI, false));
CConfigurationUtil.copyTxProperties(cConf, txConf);
for (URI jarURI : CConfigurationUtil.getExtraJars(cConf)) { if ("file".equals(jarURI.getScheme())) { Location extraJarLocation = copyFileToLocation(new File(jarURI.getPath()), tempLocation);
for (URI jarURI : CConfigurationUtil.getExtraJars(cConf)) { if ("file".equals(jarURI.getScheme())) { Location extraJarLocation = copyFileToLocation(new File(jarURI.getPath()), tempLocation);