/** * Ensures that the process definition is cached in the appropriate places, including the * deployment's collection of deployed artifacts and the deployment manager's cache, as well * as caching any ProcessDefinitionInfos. */ public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) { CommandContext commandContext = Context.getCommandContext(); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache(); DeploymentEntity deployment = parsedDeployment.getDeployment(); for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition); Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition); ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process); processDefinitionCache.add(processDefinition.getId(), cacheEntry); addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext); // Add to deployment for further usage deployment.addDeployedArtifact(processDefinition); } }
public Object getInstance(String deploymentId, String resource) { // First find in cache DeploymentCache<Object> deploymentCache = cacheInstance.get(deploymentId); if (deploymentCache == null) { deploymentCache = new DefaultDeploymentCache<Object>(); cacheInstance.put(deploymentId, deploymentCache); } Object instance = deploymentCache.get(resource); if (instance == null) { @SuppressWarnings("rawtypes") ProjectEngineFactory projectEngineFactory = get(deploymentId, resource); try { instance = projectEngineFactory.newInstance(); } catch (Exception e) { throw new ResourceCompileException( "Resource with name '" + resource + "' in deployment with id '" + deploymentId + "' compilation has been failed"); } deploymentCache.add(resource, instance); } return instance; }
public Object getInstance(String deploymentId, String resource) { // First find in cache DeploymentCache<Object> deploymentCache = cacheInstance.get(deploymentId); if (deploymentCache == null) { deploymentCache = new DefaultDeploymentCache<Object>(); cacheInstance.put(deploymentId, deploymentCache); } Object instance = deploymentCache.get(resource); if (instance == null) { @SuppressWarnings("rawtypes") ProjectEngineFactory projectEngineFactory = get(deploymentId, resource); try { instance = projectEngineFactory.newInstance(); } catch (Exception e) { throw new ResourceCompileException( "Resource with name '" + resource + "' in deployment with id '" + deploymentId + "' compilation has been failed"); } deploymentCache.add(resource, instance); } return instance; }
public void deploy(DeploymentEntity deployment, Map<String, Object> deploymentSettings) { log.debug("Processing deployment {}", deployment.getName()); KnowledgeBuilder knowledgeBuilder = null; DeploymentManager deploymentManager = Context.getProcessEngineConfiguration().getDeploymentManager(); Map<String, ResourceEntity> resources = deployment.getResources(); for (String resourceName : resources.keySet()) { log.info("Processing resource {}", resourceName); if (resourceName.endsWith(".drl")) { // is only parsing .drls sufficient? what about other rule dsl's? (@see ResourceType) if (knowledgeBuilder == null) { knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); } ResourceEntity resourceEntity = resources.get(resourceName); byte[] resourceBytes = resourceEntity.getBytes(); Resource droolsResource = ResourceFactory.newByteArrayResource(resourceBytes); knowledgeBuilder.add(droolsResource, ResourceType.DRL); } } if (knowledgeBuilder != null) { KnowledgeBase knowledgeBase = knowledgeBuilder.newKnowledgeBase(); deploymentManager.getKnowledgeBaseCache().add(deployment.getId(), knowledgeBase); } } }
public void deploy(DeploymentEntity deployment) { KnowledgeBuilder knowledgeBuilder = null; DeploymentManager deploymentManager = Context .getProcessEngineConfiguration() .getDeploymentManager(); Map<String, ResourceEntity> resources = deployment.getResources(); for (String resourceName : resources.keySet()) { log.info("Processing resource {}", resourceName); if (resourceName.endsWith(".drl")) { // is only parsing .drls sufficient? what about other rule dsl's? (@see ResourceType) if (knowledgeBuilder==null) { knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); } ResourceEntity resourceEntity = resources.get(resourceName); byte[] resourceBytes = resourceEntity.getBytes(); Resource droolsResource = ResourceFactory.newByteArrayResource(resourceBytes); knowledgeBuilder.add(droolsResource, ResourceType.DRL); } } if (knowledgeBuilder!=null) { KnowledgeBase knowledgeBase = knowledgeBuilder.newKnowledgeBase(); deploymentManager.getKnowledgeBaseCache().add(deployment.getId(), knowledgeBase); } } }
.build(); deploymentCache.add(resource, simpleProjectEngineFactory);
.build(); deploymentCache.add(resource, simpleProjectEngineFactory);
/** * Ensures that the process definition is cached in the appropriate places, including the * deployment's collection of deployed artifacts and the deployment manager's cache, as well * as caching any ProcessDefinitionInfos. */ public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) { CommandContext commandContext = Context.getCommandContext(); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache(); DeploymentEntity deployment = parsedDeployment.getDeployment(); for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition); Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition); ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process); processDefinitionCache.add(processDefinition.getId(), cacheEntry); addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext); // Add to deployment for further usage deployment.addDeployedArtifact(processDefinition); } }
.getDeploymentManager() .getProcessDefinitionCache() .add(processDefinition.getId(), processDefinition);