private ResourceType convertResourceType(org.switchyard.common.io.resource.ResourceType syResourceType) { if (syResourceType != null) { String resourceTypeName = syResourceType.getName(); if ("BPMN".equals(resourceTypeName)) { // Drools ResourceType recognizes BPMN2, not BPMN resourceTypeName = ResourceType.BPMN2.getName(); } else if ("XLS".equals(resourceTypeName) || "CSV".equals(resourceTypeName)) { // Drools ResourceType recognizes DTABLE, not XLS or CSV resourceTypeName = ResourceType.DTABLE.getName(); } return ResourceType.getResourceType(resourceTypeName); } return null; }
private ResourceType convertResourceType(org.switchyard.common.io.resource.ResourceType syResourceType) { if (syResourceType != null) { String resourceTypeName = syResourceType.getName(); if ("BPMN".equals(resourceTypeName)) { // Drools ResourceType recognizes BPMN2, not BPMN resourceTypeName = ResourceType.BPMN2.getName(); } else if ("XLS".equals(resourceTypeName) || "CSV".equals(resourceTypeName)) { // Drools ResourceType recognizes DTABLE, not XLS or CSV resourceTypeName = ResourceType.DTABLE.getName(); } return ResourceType.getResourceType(resourceTypeName); } return null; }
String resourceType = type == null || type.length() == 0 ? ResourceType.DRL.getName() : type;
public static Object createRuntime(String type, String asset, String assetType){ RuntimeEnvironmentBuilder builder; RuntimeEnvironment environment; RuntimeManager manager; if ("empty".equalsIgnoreCase(type)) { builder = RuntimeEnvironmentBuilder.Factory.get().newEmptyBuilder(); } else if ("default".equalsIgnoreCase(type)) { builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder(); } else if ("defaultInMemory".equalsIgnoreCase(type)) { builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultInMemoryBuilder(); } else { throw new IllegalArgumentException("Could not find a RuntimeManager for the type : " + type); } // Add asset(s) if (assetType.equals(ResourceType.BPMN2.getName())){ builder.addAsset(ResourceFactory.newClassPathResource(asset), ResourceType.BPMN2); } else { throw new IllegalArgumentException("Asset is not of type BPMN2"); } // Get RuntimeEnvironment environment = builder.get(); // Create Singleton RuntimeManager // TODO Allow to create Singleton, PerProcess or PerRequest manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment); return manager; }
public static Object createRuntime(String type, String asset, String assetType){ RuntimeEnvironmentBuilder builder; RuntimeEnvironment environment; RuntimeManager manager; if ("empty".equalsIgnoreCase(type)) { builder = RuntimeEnvironmentBuilder.Factory.get().newEmptyBuilder(); } else if ("default".equalsIgnoreCase(type)) { builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder(); } else if ("defaultInMemory".equalsIgnoreCase(type)) { builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultInMemoryBuilder(); } else { throw new IllegalArgumentException("Could not find a RuntimeManager for the type : " + type); } // Add asset(s) if (assetType.equals(ResourceType.BPMN2.getName())){ builder.addAsset(ResourceFactory.newClassPathResource(asset), ResourceType.BPMN2); } else { throw new IllegalArgumentException("Asset is not of type BPMN2"); } // Get RuntimeEnvironment environment = builder.get(); // Create Singleton RuntimeManager // TODO Allow to create Singleton, PerProcess or PerRequest manager = RuntimeManagerFactory.Factory.get().newSingletonRuntimeManager(environment); return manager; }