sessions.get(key).setType(stateful);
}
}
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) {
final KBaseModel kBase = new KBaseModel();
kBase.setName(reader.getAttribute("name"));
kBase.setDefault("true".equals(reader.getAttribute("default")));
String eventMode = reader.getAttribute("eventProcessingMode");
if (eventMode != null) {
kBase.setEventProcessingMode(EventProcessingOption.determineEventProcessingMode(eventMode));
}
String equalsBehavior = reader.getAttribute("equalsBehavior");
if (equalsBehavior != null) {
kBase.setEqualsBehavior(AssertBehaviorOption.determineAssertBehaviorMode(equalsBehavior));
}
String declarativeAgenda = reader.getAttribute("declarativeAgenda");
if (declarativeAgenda != null) {
kBase.setDeclarativeAgenda(DeclarativeAgendaOption.determineDeclarativeAgendaMode(declarativeAgenda));
}
String scope = reader.getAttribute("scope");
if (scope != null) {
kBase.setScope(scope.trim());
}
String pkgs = reader.getAttribute("packages");
if (pkgs != null) {
for (String pkg : pkgs.split(",")) {
kBase.addPackage(pkg.trim());
}
}
String includes = reader.getAttribute("includes");
if (includes != null) {
for (String include : includes.split(",")) {
kBase.addInclude(include.trim());
}
}
readNodes(reader, new AbstractXStreamConverter.NodeReader() {
public void onNode(HierarchicalStreamReader reader, String name, String value) {
if ("ksession".equals(name)) {
KSessionModel kSession = readObject(reader, context, KSessionModel.class);
kBase.getKSessions().add(kSession);
} else if ("includes".equals(name)) {
for (String include : readList(reader)) {
kBase.addInclude(include);
}
}
}
});
return kBase;