use of org.apache.asterix.common.configuration.AsterixConfiguration in project asterixdb by apache.
the class TestHelper method getConfigurations.
public static AsterixConfiguration getConfigurations(String fileName) throws IOException, JAXBException, AsterixException {
try (InputStream is = TestHelper.class.getClassLoader().getResourceAsStream(fileName)) {
if (is != null) {
JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
return (AsterixConfiguration) unmarshaller.unmarshal(is);
} else {
throw new AsterixException("Could not find configuration file " + fileName);
}
}
}
use of org.apache.asterix.common.configuration.AsterixConfiguration in project asterixdb by apache.
the class Utils method loadAsterixConfig.
public static AsterixConfiguration loadAsterixConfig(String path) throws IOException {
File f = new File(path);
try {
JAXBContext configCtx = JAXBContext.newInstance(AsterixConfiguration.class);
Unmarshaller unmarshaller = configCtx.createUnmarshaller();
AsterixConfiguration conf = (AsterixConfiguration) unmarshaller.unmarshal(f);
return conf;
} catch (JAXBException e) {
throw new IOException(e);
}
}
use of org.apache.asterix.common.configuration.AsterixConfiguration in project asterixdb by apache.
the class AsterixYARNClient method locateConfig.
/**
* Locate the Asterix parameters file.
*
* @return
* @throws FileNotFoundException
* @throws IOException
*/
private AsterixConfiguration locateConfig() throws FileNotFoundException, IOException {
AsterixConfiguration configuration;
String configPathBase = MERGED_PARAMETERS_PATH;
if (baseConfig != null) {
configuration = Utils.loadAsterixConfig(baseConfig);
configPathBase = new File(baseConfig).getParentFile().getAbsolutePath() + File.separator + PARAMS_DEFAULT_NAME;
MERGED_PARAMETERS_PATH = configPathBase;
} else {
configuration = Utils.loadAsterixConfig(DEFAULT_PARAMETERS_PATH);
}
return configuration;
}
use of org.apache.asterix.common.configuration.AsterixConfiguration in project asterixdb by apache.
the class InstallerUtil method getAsterixConfiguration.
public static AsterixConfiguration getAsterixConfiguration(String asterixConf) throws FileNotFoundException, IOException, JAXBException {
if (asterixConf == null) {
asterixConf = InstallerDriver.getManagixHome() + File.separator + DEFAULT_ASTERIX_CONFIGURATION_PATH;
}
File file = new File(asterixConf);
JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
AsterixConfiguration asterixConfiguration = (AsterixConfiguration) unmarshaller.unmarshal(file);
return asterixConfiguration;
}
use of org.apache.asterix.common.configuration.AsterixConfiguration in project asterixdb by apache.
the class PropertiesAccessor method configure.
private AsterixConfiguration configure(InputStream is, String fileName) throws AsterixException {
try {
JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
return (AsterixConfiguration) unmarshaller.unmarshal(is);
} catch (JAXBException e) {
throw new AsterixException("Failed to read configuration file " + fileName, e);
}
}
Aggregations