use of org.codehaus.plexus.interpolation.InterpolationException in project indy by Commonjava.
the class AbstractKojiIT method initTestConfig.
@Override
protected void initTestConfig(CoreServerFixture fixture) throws IOException {
super.initTestConfig(fixture);
withNewClient((client) -> {
try {
File clientKeyCertPem = getClientKeyCertPem(client);
File serverCertsPem = getServerCertsPem(client);
Properties properties = System.getProperties();
properties.setProperty("client.pem", clientKeyCertPem.getAbsolutePath());
properties.setProperty("server.pem", serverCertsPem.getAbsolutePath());
properties.setProperty("hub.url", formatSSLUrl("kojihub"));
properties.setProperty("storage.url", formatSSLUrl("kojifiles"));
properties.setProperty("extra.config", getKojiExtraConfig());
StringSearchInterpolator ssi = new StringSearchInterpolator();
ssi.addValueSource(new PropertiesBasedValueSource(properties));
RecursionInterceptor ri = new SimpleRecursionInterceptor();
String kojiConf = readTestResource("test-koji.conf");
try {
kojiConf = ssi.interpolate(kojiConf, ri);
} catch (InterpolationException e) {
e.printStackTrace();
fail("Interpolation of test koji.conf failed!");
}
writeConfigFile("conf.d/koji.conf", kojiConf);
} catch (IOException e) {
e.printStackTrace();
fail("Cannot setup SSL config files for Koji.");
}
});
}
use of org.codehaus.plexus.interpolation.InterpolationException in project indy by Commonjava.
the class CacheProducer method interpolateStrFromStream.
private String interpolateStrFromStream(InputStream inputStream, String path) {
String configuration;
try {
configuration = IOUtils.toString(inputStream);
} catch (IOException e) {
throw new RuntimeException("Cannot read infinispan configuration from : " + path, e);
}
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new PropertiesBasedValueSource(System.getProperties()));
try {
configuration = interpolator.interpolate(configuration);
} catch (InterpolationException e) {
throw new RuntimeException("Cannot resolve expressions in infinispan configuration from: " + path, e);
}
return configuration;
}
use of org.codehaus.plexus.interpolation.InterpolationException in project indy by Commonjava.
the class KojiContentManagerDecorator method getRepositoryName.
private String getRepositoryName(final KojiBuildInfo build, final boolean isBinaryBuild) {
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new ObjectBasedValueSource(build));
try {
return interpolator.interpolate(isBinaryBuild ? config.getBinayNamingFormat() : config.getNamingFormat());
} catch (InterpolationException e) {
throw new RuntimeException("Cannot resolve expressions in Koji configuration.", e);
}
}
use of org.codehaus.plexus.interpolation.InterpolationException in project indy by Commonjava.
the class CacheProducer method start.
@PostConstruct
public void start() {
// FIXME This is just here to trigger shutdown hook init for embedded log4j in infinispan-embedded-query.
// FIXES:
//
// Thread-15 ERROR Unable to register shutdown hook because JVM is shutting down.
// java.lang.IllegalStateException: Cannot add new shutdown hook as this is not started. Current state: STOPPED
//
new MarshallableTypeHints().getBufferSizePredictor(CacheHandle.class);
File confDir = indyConfiguration.getIndyConfDir();
File ispnConf = new File(confDir, ISPN_XML);
String configuration;
if (ispnConf.exists()) {
try {
configuration = FileUtils.readFileToString(ispnConf);
} catch (IOException e) {
throw new RuntimeException("Cannot read infinispan configuration from file: " + ispnConf, e);
}
} else {
try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(ISPN_XML)) {
configuration = IOUtils.toString(stream);
} catch (IOException e) {
throw new RuntimeException("Cannot read infinispan configuration from classpath: " + ISPN_XML, e);
}
}
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new PropertiesBasedValueSource(System.getProperties()));
try {
configuration = interpolator.interpolate(configuration);
} catch (InterpolationException e) {
throw new RuntimeException("Cannot resolve expressions in infinispan configuration.", e);
}
Logger logger = LoggerFactory.getLogger(getClass());
logger.info("Using Infinispan configuration:\n\n{}\n\n", configuration);
try {
cacheManager = new DefaultCacheManager(new ByteArrayInputStream(configuration.getBytes(StandardCharsets.UTF_8)));
} catch (IOException e) {
throw new RuntimeException("Cannot read infinispan configuration.", e);
}
}
use of org.codehaus.plexus.interpolation.InterpolationException in project sling by apache.
the class BundleListUtils method interpolateProperties.
public static void interpolateProperties(BundleList bundleList, MavenProject project, MavenSession mavenSession) throws MojoExecutionException {
Interpolator interpolator = createInterpolator(project, mavenSession);
for (final StartLevel sl : bundleList.getStartLevels()) {
for (final Bundle bndl : sl.getBundles()) {
try {
bndl.setArtifactId(interpolator.interpolate(bndl.getArtifactId()));
bndl.setGroupId(interpolator.interpolate(bndl.getGroupId()));
bndl.setVersion(interpolator.interpolate(bndl.getVersion()));
bndl.setClassifier(interpolator.interpolate(bndl.getClassifier()));
bndl.setType(interpolator.interpolate(bndl.getType()));
} catch (InterpolationException e) {
throw new MojoExecutionException("Unable to interpolate properties for bundle " + bndl.toString(), e);
}
}
}
}
Aggregations