use of com.yahoo.container.bundle.BundleInstantiationSpecification in project vespa by vespa-engine.
the class ContainerCluster method addMbusServer.
public void addMbusServer(ComponentId chainId) {
ComponentId serviceId = chainId.nestInNamespace(ComponentId.fromString("MbusServer"));
addComponent(new Component<>(new ComponentModel(new BundleInstantiationSpecification(serviceId, ComponentSpecification.fromString(MbusServerProvider.class.getName()), null))));
}
use of com.yahoo.container.bundle.BundleInstantiationSpecification in project vespa by vespa-engine.
the class BundleInstantiationSpecificationBuilder method build.
public static BundleInstantiationSpecification build(Element spec, boolean legacyMode) {
ComponentSpecification id = XmlHelper.getIdRef(spec);
ComponentSpecification classId = getComponentSpecification(spec, "class");
ComponentSpecification bundle = getComponentSpecification(spec, "bundle");
BundleInstantiationSpecification instSpec = new BundleInstantiationSpecification(id, classId, bundle);
if (// TODO: Remove?
!legacyMode)
validate(instSpec);
return bundle == null ? setBundleForKnownClass(instSpec) : instSpec;
}
use of com.yahoo.container.bundle.BundleInstantiationSpecification in project vespa by vespa-engine.
the class JettyContainerModelBuilderTest method assertComponentHasClassNameAndBundle.
private static void assertComponentHasClassNameAndBundle(SimpleComponent simpleComponent, String className, String bundleName) {
BundleInstantiationSpecification spec = simpleComponent.model.bundleInstantiationSpec;
assertThat(spec.classId.toString(), is(className));
assertThat(spec.bundle.toString(), is(bundleName));
}
use of com.yahoo.container.bundle.BundleInstantiationSpecification in project vespa by vespa-engine.
the class DomComponentBuilderTest method ensureCorrectModel.
@Test
public void ensureCorrectModel() {
Component<?, ?> handler = new DomComponentBuilder().doBuild(root, parse("<handler id='theId' class='theClass' bundle='theBundle' />"));
BundleInstantiationSpecification instantiationSpecification = handler.model.bundleInstantiationSpec;
assertThat(instantiationSpecification.id.stringValue(), is("theId"));
assertThat(instantiationSpecification.classId.stringValue(), is("theClass"));
assertThat(instantiationSpecification.bundle.stringValue(), is("theBundle"));
}
use of com.yahoo.container.bundle.BundleInstantiationSpecification in project vespa by vespa-engine.
the class ContainerTestBase method complete.
public void complete() {
try {
Container container = new Container(new CloudSubscriberFactory(dirConfigSource().configSource()), dirConfigSource().configId(), new ContainerTest.TestDeconstructor(), new Osgi() {
@SuppressWarnings("unchecked")
@Override
public Class<Object> resolveClass(BundleInstantiationSpecification spec) {
try {
return (Class<Object>) Class.forName(spec.classId.getName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
@Override
public BundleClasses getBundleClasses(ComponentSpecification bundle, Set<String> packagesToScan) {
throw new UnsupportedOperationException("getBundleClasses not supported");
}
@Override
public void useBundles(Collection<FileReference> bundles) {
}
@Override
public Bundle getBundle(ComponentSpecification spec) {
throw new UnsupportedOperationException("getBundle not supported.");
}
});
componentGraph = container.runOnce(componentGraph, Guice.createInjector());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations