use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class JaxbMarshalingTest method testJaxbDeploymentDescriptorSerialization.
@Test
public void testJaxbDeploymentDescriptorSerialization() throws Exception {
DeploymentDescriptor descriptor = new DeploymentDescriptorImpl();
descriptor.getBuilder().addTaskEventListener(new ObjectModel("org.jbpm.task.Listener", new Object[] { "test", "another" }));
String output = convertJaxbObjectToString(descriptor);
logger.debug(output);
assertNotNull(output);
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class DeploymentDescriptorIO method fromXml.
/**
* Reads XML data from given input stream and produces valid instance of
* <code>DeploymentDescriptor</code>
* @param inputStream input stream that comes with xml data of the descriptor
* @return instance of the descriptor after deserialization
*/
public static DeploymentDescriptor fromXml(InputStream inputStream) {
try {
Unmarshaller unmarshaller = getContext().createUnmarshaller();
unmarshaller.setSchema(schema);
DeploymentDescriptor descriptor = (DeploymentDescriptor) unmarshaller.unmarshal(inputStream);
return descriptor;
} catch (Exception e) {
throw new RuntimeException("Unable to read deployment descriptor from xml", e);
}
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class DeploymentDescriptorManager method getDeploymentDescriptorHierarchy.
public List<DeploymentDescriptor> getDeploymentDescriptorHierarchy(KieContainer kieContainer) {
List<DeploymentDescriptor> descriptorHierarchy = new ArrayList<DeploymentDescriptor>();
InternalKieModule module = ((KieModuleKieProject) ((KieContainerImpl) kieContainer).getKieProject()).getInternalKieModule();
collectDeploymentDescriptors(module, descriptorHierarchy);
// last is the default descriptor
descriptorHierarchy.add(getDefaultDescriptor());
return descriptorHierarchy;
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class DeploymentDescriptorManager method getDefaultDescriptor.
public DeploymentDescriptor getDefaultDescriptor() {
DeploymentDescriptor defaultDesc = null;
URL defaultDescriptorLocation = getDefaultdescriptorlocation();
if (defaultDescriptorLocation != null) {
try {
logger.debug("Reading default descriptor from " + defaultDescriptorLocation);
defaultDesc = DeploymentDescriptorIO.fromXml(defaultDescriptorLocation.openStream());
} catch (IOException e) {
throw new RuntimeException("Unable to read default deployment descriptor from " + defaultDescriptorLocation, e);
}
} else {
logger.debug("No descriptor found returning default instance");
defaultDesc = new DeploymentDescriptorImpl(defaultPU);
}
return defaultDesc;
}
use of org.kie.internal.runtime.conf.DeploymentDescriptor in project jbpm by kiegroup.
the class DeploymentDescriptorManager method getDescriptorFromKModule.
protected DeploymentDescriptor getDescriptorFromKModule(InternalKieModule kmodule) {
DeploymentDescriptor desc = null;
if (kmodule.isAvailable(DeploymentDescriptor.META_INF_LOCATION)) {
byte[] content = kmodule.getBytes(DeploymentDescriptor.META_INF_LOCATION);
ByteArrayInputStream input = new ByteArrayInputStream(content);
try {
desc = DeploymentDescriptorIO.fromXml(input);
} finally {
try {
input.close();
} catch (IOException e) {
logger.debug("Error when closing stream of kie-deployment-descriptor.xml");
}
}
}
return desc;
}
Aggregations