blob: 558c4428d1593c4958cc27cd20edc82737a90e3f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.builder.xml.dom;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.text.XML;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.container.component.Component;
import com.yahoo.vespa.model.container.component.Handler;
import com.yahoo.vespa.model.container.xml.BundleInstantiationSpecificationBuilder;
import org.w3c.dom.Element;
/**
* @author gjoranv
*/
public class DomHandlerBuilder extends VespaDomBuilder.DomConfigProducerBuilder<Handler> {
@Override
protected Handler doBuild(DeployState deployState, AbstractConfigProducer ancestor, Element handlerElement) {
Handler<? super Component<?, ?>> handler = getHandler(handlerElement);
for (Element binding : XML.getChildren(handlerElement, "binding"))
handler.addServerBindings(XML.getValue(binding));
for (Element clientBinding : XML.getChildren(handlerElement, "clientBinding"))
handler.addClientBindings(XML.getValue(clientBinding));
DomComponentBuilder.addChildren(deployState, ancestor, handlerElement, handler);
return handler;
}
protected Handler<? super Component<?, ?>> getHandler(Element handlerElement) {
BundleInstantiationSpecification bundleSpec = BundleInstantiationSpecificationBuilder.build(handlerElement);
return new Handler<>(new ComponentModel(bundleSpec));
}
}
|