@Override
public Object getObject() throws Exception {
RuntimeEnvironmentBuilder builder = null;
RuntimeEnvironmentBuilderFactory factory = RuntimeEnvironmentBuilder.Factory.get();
if (type.equalsIgnoreCase(TYPE_EMPTY)) {
builder = factory.newEmptyBuilder();
} else if (type.equalsIgnoreCase(TYPE_DEFAULT_IN_MEMORY)) {
builder = factory.newDefaultInMemoryBuilder();
} else if (type.equalsIgnoreCase(TYPE_DEFAULT)) {
builder = factory.newDefaultBuilder();
} else if (type.equalsIgnoreCase(TYPE_DEFAULT_KJAR)) {
if (releaseId != null) {
builder = factory.newDefaultBuilder(releaseId, kbaseName, ksessionName);
} else {
builder = factory.newDefaultBuilder(groupId, artifactId, version, kbaseName, ksessionName);
}
} else if (type.equalsIgnoreCase(TYPE_DEFAULT_KJAR_CL)) {
builder = factory.newClasspathKmoduleDefaultBuilder(kbaseName, ksessionName);
} else {
throw new IllegalArgumentException("Unknown type of environment");
}
// apply all known properties