コード例 #1
0
        protected internal virtual void autoDeployResources(ProcessEngine processEngine)
        {
            if (deploymentResources != null && deploymentResources.Length > 0)
            {
                RepositoryService repositoryService = processEngine.RepositoryService;

                DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering(deployChangedOnly).name(deploymentName).tenantId(deploymentTenantId);

                foreach (Resource resource in deploymentResources)
                {
                    string resourceName = null;

                    if (resource is ContextResource)
                    {
                        resourceName = ((ContextResource)resource).PathWithinContext;
                    }
                    else if (resource is ByteArrayResource)
                    {
                        resourceName = resource.Description;
                    }
                    else
                    {
                        resourceName = getFileResourceName(resource);
                    }

                    try
                    {
                        if (resourceName.EndsWith(".bar", StringComparison.Ordinal) || resourceName.EndsWith(".zip", StringComparison.Ordinal) || resourceName.EndsWith(".jar", StringComparison.Ordinal))
                        {
                            deploymentBuilder.addZipInputStream(new ZipInputStream(resource.InputStream));
                        }
                        else
                        {
                            deploymentBuilder.addInputStream(resourceName, resource.InputStream);
                        }
                    }
                    catch (IOException e)
                    {
                        throw new ProcessEngineException("couldn't auto deploy resource '" + resource + "': " + e.Message, e);
                    }
                }

                deploymentBuilder.deploy();
            }
        }