コード例 #1
0
        public static void ListPackageContent(string msiPath, DirectoryInfo di)
        {
            IInstallPackage package = null;

            try
            {
                package = DeploymentUnit.ScanPackage(msiPath);
                if (package != null)
                {
                    Console.WriteLine("Title: " + package.Title);
                    Console.WriteLine("Author: " + package.Author);
                    Console.WriteLine("Subject: " + package.Subject);
                    Console.WriteLine("Comments: " + package.Comments);
                    Console.WriteLine("Keywords: " + package.Keywords);
                    Console.WriteLine("Create Time: " + package.CreateTime.ToString("u", CultureInfo.InvariantCulture));
                    Console.WriteLine("Package Code: " + package.RevisionNumber);
                    Console.WriteLine("Resource type;Luid;Filename;Version");
                    if ((package.Resources != null) && (package.Resources.Length != 0))
                    {
                        foreach (IDeploymentResource resource in package.Resources)
                        {
                            Console.Write(string.Format("{0};{1};", new object[] { resource.ResourceType, resource.Luid }));
                            // Get the corresponding file
                            if (resource.Properties.ContainsKey("DestinationLocation"))
                            {
                                string filename = (string)resource.Properties["DestinationLocation"];
                                if (!string.IsNullOrEmpty(filename))
                                {
                                    FileInfo   fi  = new FileInfo(filename);
                                    FileInfo[] fis = di.GetFiles(fi.Name, SearchOption.AllDirectories);
                                    if (fis.Length > 0)
                                    {
                                        FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(fis[0].FullName);
                                        Console.WriteLine(string.Format("{0};{1}", filename, versionInfo.FileVersion));
                                    }
                                    else
                                    {
                                        Console.WriteLine(";");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine(";");
                                }
                            }
                            else
                            {
                                Console.WriteLine(";");
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error occured: {0}", exception.Message);
                Console.ResetColor();
            }
        }
コード例 #2
0
        public const int PRIORITY = 0x2010;   // after PARSE_WEB_MERGE_METADATA

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public virtual void deploy(DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
            EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);

            // must be EE Module
            if (eeModuleDescription == null)
            {
                return;
            }

            // discover user-provided component
            ComponentDescription paComponent = detectExistingComponent(deploymentUnit);

            if (paComponent != null)
            {
                log.log(Level.INFO, "Detected user-provided @" + typeof(ProcessApplication).Name + " component with name '" + paComponent.ComponentName + "'.");

                // mark this to be a process application
                ProcessApplicationAttachments.attachProcessApplicationComponent(deploymentUnit, paComponent);
                ProcessApplicationAttachments.mark(deploymentUnit);
                ProcessApplicationAttachments.markPartOfProcessApplication(deploymentUnit);
            }
        }
コード例 #3
0
 /// <summary>
 /// marks a a <seealso cref="DeploymentUnit"/> as part of a process application
 /// </summary>
 public static void markPartOfProcessApplication(DeploymentUnit unit)
 {
     if (unit.Parent != null && unit.Parent != unit)
     {
         unit.Parent.putAttachment(PART_OF_MARKER, true);
     }
 }
コード例 #4
0
        private void ListPackageContent(string msiPath, DirectoryInfo di, Dictionary <string, string> properties)
        {
            IInstallPackage package = null;

            try
            {
                package = DeploymentUnit.ScanPackage(msiPath);
                if (package != null)
                {
                    string productCode = string.Empty;
                    if ((null != properties) && properties.ContainsKey("ProductCode"))
                    {
                        productCode = properties["ProductCode"];
                    }
                    this.installedPackages.Package.AddPackageRow(
                        package.Title,
                        package.Author,
                        package.Subject,
                        package.Comments,
                        package.CreateTime,
                        package.RevisionNumber,
                        productCode);

                    if ((package.Resources != null) && (package.Resources.Length != 0))
                    {
                        foreach (IDeploymentResource resource in package.Resources)
                        {
                            string filename = string.Empty;
                            string version  = string.Empty;
                            // Get the corresponding file
                            if (resource.Properties.ContainsKey("DestinationLocation"))
                            {
                                filename = (string)resource.Properties["DestinationLocation"];
                                if (!string.IsNullOrEmpty(filename))
                                {
                                    FileInfo   fi  = new FileInfo(filename);
                                    FileInfo[] fis = di.GetFiles(fi.Name, SearchOption.AllDirectories);
                                    if (fis.Length > 0)
                                    {
                                        FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(fis[0].FullName);
                                        version = versionInfo.FileVersion;
                                    }
                                }
                            }

                            this.installedPackages.Resources.AddResourcesRow(
                                resource.ResourceType,
                                resource.Luid,
                                filename,
                                version,
                                package.RevisionNumber);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                throw new Exception(string.Format("ListPackageContent Error occured: {0}", exception.Message), exception);
            }
        }
コード例 #5
0
        private void ImportFromMsi()
        {
            if (this.MsiPath == null)
            {
                // -Package           Required. The path and file name of the Windows Installer package.
                this.Log.LogError("MSI source is required");
                return;
            }

            this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Importing from {0}", this.MsiPath.ItemSpec));

            if (string.IsNullOrEmpty(this.Application))
            {
                // -ApplicationName   Optional. The name of the BizTalk application.
                this.Application = this.explorer.DefaultApplication.Name;
                this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Using default application {0}", this.Application));
            }

            // create application if it doesn't exist
            if (!this.CheckExists(this.Application))
            {
                OM.Application newapp = this.explorer.AddNewApplication();
                newapp.Name = this.Application;
                this.explorer.SaveChanges();
                this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Creating new application {0}", this.Application));
            }

            using (Group group = new Group())
            {
                group.DBName   = this.Database;
                group.DBServer = this.DatabaseServer;

                Microsoft.BizTalk.ApplicationDeployment.Application appl = group.Applications[this.Application];

                // used to specify custom properties for import, i.e. TargetEnvironment
                IDictionary <string, object> requestProperties = null;
                if (!string.IsNullOrEmpty(this.Environment))
                {
                    // -Environment       Optional. The environment to deploy.
                    requestProperties = new Dictionary <string, object> {
                        { "TargetEnvironment", this.Environment }
                    };
                    this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Target environment {0} specified", this.Environment));
                }

                // the overload that takes request properties also requires this
                IInstallPackage      package = DeploymentUnit.ScanPackage(this.MsiPath.ItemSpec);
                ICollection <string> applicationReferences = package.References;

                // -Overwrite         Optional. Update existing resources. If not specified and resource exists, import will fail.
                appl.Import(this.MsiPath.ItemSpec, requestProperties, applicationReferences, this.Overwrite);
                this.LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "Successfully imported {0} into application {1}", this.MsiPath.ItemSpec, this.Application));
            }
        }
コード例 #6
0
 /// <summary>
 /// return true if the deployment unit is either itself a process
 /// application or part of a process application.
 /// </summary>
 public static bool isPartOfProcessApplication(DeploymentUnit unit)
 {
     if (isProcessApplication(unit))
     {
         return(true);
     }
     if (unit.Parent != null && unit.Parent != unit)
     {
         return(unit.Parent.hasAttachment(PART_OF_MARKER));
     }
     return(false);
 }
コード例 #7
0
 public MsiPackage(string msiPath)
 {
     this.MsiPath = msiPath;
     try
     {
         _scannedPackage = DeploymentUnit.ScanPackage(msiPath);
     }
     catch (Exception)
     {
         _scannedPackage = null;
     }
 }
コード例 #8
0
        /// <summary>
        /// Gets a list of all the target environments bundled in the specified BizTalk msi file.
        /// </summary>
        /// <param name="msiPath">The path of the BizTalk msi.</param>
        /// <returns>Returns List, with a list of all target environments.</returns>
        public static List <string> GetTargetEnvironmentList(string msiPath)
        {
            List <string> targetEnvironmentlist = new List <string>();

            targetEnvironmentlist.Add("<Default>");
            var query = (from resource in DeploymentUnit.ScanPackage(msiPath).Resources
                         from property in resource.Properties
                         where resource.ResourceType == "System.BizTalk:BizTalkBinding" &&
                         property.Key == "TargetEnvironment" &&
                         (string)property.Value != string.Empty
                         orderby(string) property.Value
                         select(string) property.Value).Distinct();

            targetEnvironmentlist.AddRange(query);
            return(targetEnvironmentlist);
        }
コード例 #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public virtual void deploy(DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;

            if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit))
            {
                return;
            }

            IList <ProcessesXmlWrapper> processesXmls = ProcessApplicationAttachments.getProcessesXmls(deploymentUnit);

            foreach (ProcessesXmlWrapper wrapper in processesXmls)
            {
                foreach (ProcessEngineXml processEngineXml in wrapper.ProcessesXml.ProcessEngines)
                {
                    startProcessEngine(processEngineXml, phaseContext);
                }
            }
        }
コード例 #10
0
        public const int PRIORITY = 0x0000;   // this can happen ASAP in the POST_MODULE Phase

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public virtual void deploy(DeploymentPhaseContext phaseContext)
        {
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;

            if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit))
            {
                return;
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.modules.Module module = deploymentUnit.getAttachment(MODULE);
            Module module = deploymentUnit.getAttachment(MODULE);

            // read @ProcessApplication annotation of PA-component
            string[] deploymentDescriptors = getDeploymentDescriptors(deploymentUnit);

            // load all processes.xml files
            IList <URL> deploymentDescriptorURLs = getDeploymentDescriptorUrls(module, deploymentDescriptors);

            foreach (URL processesXmlResource in deploymentDescriptorURLs)
            {
                VirtualFile processesXmlFile = getFile(processesXmlResource);

                // parse processes.xml metadata.
                ProcessesXml processesXml = null;
                if (isEmptyFile(processesXmlResource))
                {
                    processesXml = ProcessesXml.EMPTY_PROCESSES_XML;
                }
                else
                {
                    processesXml = parseProcessesXml(processesXmlResource);
                }

                // add the parsed metadata to the attachment list
                ProcessApplicationAttachments.addProcessesXml(deploymentUnit, new ProcessesXmlWrapper(processesXml, processesXmlFile));
            }
        }
コード例 #11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected String[] getDeploymentDescriptors(org.jboss.as.server.deployment.DeploymentUnit deploymentUnit) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        protected internal virtual string[] getDeploymentDescriptors(DeploymentUnit deploymentUnit)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.ComponentDescription processApplicationComponent = org.camunda.bpm.container.impl.jboss.deployment.marker.ProcessApplicationAttachments.getProcessApplicationComponent(deploymentUnit);
            ComponentDescription processApplicationComponent = ProcessApplicationAttachments.getProcessApplicationComponent(deploymentUnit);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String paClassName = processApplicationComponent.getComponentClassName();
            string paClassName = processApplicationComponent.ComponentClassName;

            string[] deploymentDescriptorResourceNames = null;

            Module module = deploymentUnit.getAttachment(MODULE);

            Type paClass = null;

            try
            {
                paClass = (Type)module.ClassLoader.loadClass(paClassName);
            }
            catch (ClassNotFoundException)
            {
                throw new DeploymentUnitProcessingException("Unable to load process application class '" + paClassName + "'.");
            }

            ProcessApplication annotation = paClass.getAnnotation(typeof(ProcessApplication));

            if (annotation == null)
            {
                deploymentDescriptorResourceNames = new string[] { PROCESSES_XML };
            }
            else
            {
                deploymentDescriptorResourceNames = annotation.deploymentDescriptors();
            }
            return(deploymentDescriptorResourceNames);
        }
コード例 #12
0
 /// <summary>
 /// Attach the <seealso cref="ComponentDescription"/> for the <seealso cref="AbstractProcessApplication"/> component
 /// </summary>
 public static void attachProcessApplicationComponent(DeploymentUnit deploymentUnit, ComponentDescription componentDescription)
 {
     deploymentUnit.putAttachment(PA_COMPONENT, componentDescription);
 }
コード例 #13
0
        public const int PRIORITY = 0x0000;   // this can happen at the beginning of the phase

//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void deploy(org.jboss.as.server.deployment.DeploymentPhaseContext phaseContext) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        public override void deploy(DeploymentPhaseContext phaseContext)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
            DeploymentUnit deploymentUnit = phaseContext.DeploymentUnit;

            if (!ProcessApplicationAttachments.isProcessApplication(deploymentUnit))
            {
                return;
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.ComponentDescription paComponent = getProcessApplicationComponent(deploymentUnit);
            ComponentDescription paComponent = getProcessApplicationComponent(deploymentUnit);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName paViewServiceName = getProcessApplicationViewServiceName(paComponent);
            ServiceName paViewServiceName = getProcessApplicationViewServiceName(paComponent);

            Module module = deploymentUnit.getAttachment(Attachments.MODULE);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String moduleName = module.getIdentifier().toString();
            string moduleName = module.Identifier.ToString();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName paStartServiceName = org.camunda.bpm.container.impl.jboss.service.ServiceNames.forProcessApplicationStartService(moduleName);
            ServiceName paStartServiceName = ServiceNames.forProcessApplicationStartService(moduleName);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName paStopServiceName = org.camunda.bpm.container.impl.jboss.service.ServiceNames.forProcessApplicationStopService(moduleName);
            ServiceName paStopServiceName = ServiceNames.forProcessApplicationStopService(moduleName);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.msc.service.ServiceName noViewStartService = org.camunda.bpm.container.impl.jboss.service.ServiceNames.forNoViewProcessApplicationStartService(moduleName);
            ServiceName noViewStartService = ServiceNames.forNoViewProcessApplicationStartService(moduleName);

            IList <ServiceName> deploymentServiceNames = new List <ServiceName>();

            ProcessApplicationStopService paStopService = new ProcessApplicationStopService();
            ServiceBuilder <ProcessApplicationStopService> stopServiceBuilder = phaseContext.ServiceTarget.addService(paStopServiceName, paStopService).addDependency(phaseContext.PhaseServiceName).addDependency(ServiceNames.forBpmPlatformPlugins(), typeof(BpmPlatformPlugins), paStopService.PlatformPluginsInjector).setInitialMode(ServiceController.Mode.ACTIVE);

            if (paViewServiceName != null)
            {
                stopServiceBuilder.addDependency(paViewServiceName, typeof(ComponentView), paStopService.PaComponentViewInjector);
            }
            else
            {
                stopServiceBuilder.addDependency(noViewStartService, typeof(ProcessApplicationInterface), paStopService.NoViewProcessApplication);
            }

            stopServiceBuilder.install();

            // deploy all process archives
            IList <ProcessesXmlWrapper> processesXmlWrappers = ProcessApplicationAttachments.getProcessesXmls(deploymentUnit);

            foreach (ProcessesXmlWrapper processesXmlWrapper in processesXmlWrappers)
            {
                ProcessesXml processesXml = processesXmlWrapper.ProcessesXml;
                foreach (ProcessArchiveXml processArchive in processesXml.ProcessArchives)
                {
                    ServiceName processEngineServiceName = getProcessEngineServiceName(processArchive);
                    IDictionary <string, sbyte[]> deploymentResources = getDeploymentResources(processArchive, deploymentUnit, processesXmlWrapper.ProcessesXmlFile);

                    // add the deployment service for each process archive we deploy.
                    ProcessApplicationDeploymentService deploymentService = new ProcessApplicationDeploymentService(deploymentResources, processArchive, module);
                    string processArachiveName = processArchive.Name;
                    if (string.ReferenceEquals(processArachiveName, null))
                    {
                        // use random name for deployment service if name is null (we cannot ask the process application yet since the component might not be up.
                        processArachiveName = System.Guid.randomUUID().ToString();
                    }
                    ServiceName deploymentServiceName = ServiceNames.forProcessApplicationDeploymentService(deploymentUnit.Name, processArachiveName);
                    ServiceBuilder <ProcessApplicationDeploymentService> serviceBuilder = phaseContext.ServiceTarget.addService(deploymentServiceName, deploymentService).addDependency(phaseContext.PhaseServiceName).addDependency(paStopServiceName).addDependency(processEngineServiceName, typeof(ProcessEngine), deploymentService.ProcessEngineInjector).setInitialMode(ServiceController.Mode.ACTIVE);

                    if (paViewServiceName != null)
                    {
                        // add a dependency on the component start service to make sure we are started after the pa-component (Singleton EJB) has started
                        serviceBuilder.addDependency(paComponent.StartServiceName);
                        serviceBuilder.addDependency(paViewServiceName, typeof(ComponentView), deploymentService.PaComponentViewInjector);
                    }
                    else
                    {
                        serviceBuilder.addDependency(noViewStartService, typeof(ProcessApplicationInterface), deploymentService.NoViewProcessApplication);
                    }

                    JBossCompatibilityExtension.addServerExecutorDependency(serviceBuilder, deploymentService.ExecutorInjector, false);

                    serviceBuilder.install();

                    deploymentServiceNames.Add(deploymentServiceName);
                }
            }

            AnnotationInstance postDeploy  = ProcessApplicationAttachments.getPostDeployDescription(deploymentUnit);
            AnnotationInstance preUndeploy = ProcessApplicationAttachments.getPreUndeployDescription(deploymentUnit);

            // register the managed process application start service
            ProcessApplicationStartService paStartService = new ProcessApplicationStartService(deploymentServiceNames, postDeploy, preUndeploy, module);
            ServiceBuilder <ProcessApplicationStartService> serviceBuilder = phaseContext.ServiceTarget.addService(paStartServiceName, paStartService).addDependency(phaseContext.PhaseServiceName).addDependency(ServiceNames.forDefaultProcessEngine(), typeof(ProcessEngine), paStartService.DefaultProcessEngineInjector).addDependency(ServiceNames.forBpmPlatformPlugins(), typeof(BpmPlatformPlugins), paStartService.PlatformPluginsInjector).addDependencies(deploymentServiceNames).setInitialMode(ServiceController.Mode.ACTIVE);

            if (paViewServiceName != null)
            {
                serviceBuilder.addDependency(paViewServiceName, typeof(ComponentView), paStartService.PaComponentViewInjector);
            }
            else
            {
                serviceBuilder.addDependency(noViewStartService, typeof(ProcessApplicationInterface), paStartService.NoViewProcessApplication);
            }

            serviceBuilder.install();
        }
コード例 #14
0
        protected internal virtual IDictionary <string, sbyte[]> getDeploymentResources(ProcessArchiveXml processArchive, DeploymentUnit deploymentUnit, VirtualFile processesXmlFile)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.modules.Module module = deploymentUnit.getAttachment(MODULE);
            Module module = deploymentUnit.getAttachment(MODULE);

            IDictionary <string, sbyte[]> resources = new Dictionary <string, sbyte[]>();

            // first, add all resources listed in the processe.xml
            IList <string>    process     = processArchive.ProcessResourceNames;
            ModuleClassLoader classLoader = module.ClassLoader;

            foreach (string resource in process)
            {
                Stream inputStream = null;
                try
                {
                    inputStream         = classLoader.getResourceAsStream(resource);
                    resources[resource] = IoUtil.readInputStream(inputStream, resource);
                }
                finally
                {
                    IoUtil.closeSilently(inputStream);
                }
            }

            // scan for process definitions
            if (PropertyHelper.getBooleanProperty(processArchive.Properties, org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_IS_SCAN_FOR_PROCESS_DEFINITIONS, process.Count == 0))
            {
                //always use VFS scanner on JBoss
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.container.impl.deployment.scanning.VfsProcessApplicationScanner scanner = new org.camunda.bpm.container.impl.deployment.scanning.VfsProcessApplicationScanner();
                VfsProcessApplicationScanner scanner = new VfsProcessApplicationScanner();

                string   resourceRootPath           = processArchive.Properties[org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_RESOURCE_ROOT_PATH];
                string[] additionalResourceSuffixes = StringUtil.Split(processArchive.Properties[org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_ADDITIONAL_RESOURCE_SUFFIXES], org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml_Fields.PROP_ADDITIONAL_RESOURCE_SUFFIXES_SEPARATOR);
                URL      processesXmlUrl            = vfsFileAsUrl(processesXmlFile);
//JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'putAll' method:
                resources.putAll(scanner.findResources(classLoader, resourceRootPath, processesXmlUrl, additionalResourceSuffixes));
            }

            return(resources);
        }
コード例 #15
0
        protected internal virtual ComponentDescription getProcessApplicationComponent(DeploymentUnit deploymentUnit)
        {
            ComponentDescription paComponentDescription = ProcessApplicationAttachments.getProcessApplicationComponent(deploymentUnit);

            return(paComponentDescription);
        }
コード例 #16
0
 public override void undeploy(DeploymentUnit deploymentUnit)
 {
 }
コード例 #17
0
 /// <summary>
 /// Returns the attached <seealso cref="ProcessesXml"/> marker or null;
 ///
 /// </summary>
 public static IList <ProcessesXmlWrapper> getProcessesXmls(DeploymentUnit deploymentUnit)
 {
     return(deploymentUnit.getAttachmentList(PROCESSES_XML_LIST));
 }
コード例 #18
0
 public virtual void undeploy(DeploymentUnit deploymentUnit)
 {
 }
コード例 #19
0
        /// <summary>
        /// Detect an existing <seealso cref="ProcessApplication"/> component.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected org.jboss.as.ee.component.ComponentDescription detectExistingComponent(org.jboss.as.server.deployment.DeploymentUnit deploymentUnit) throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
        protected internal virtual ComponentDescription detectExistingComponent(DeploymentUnit deploymentUnit)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION);
            EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.ee.component.EEApplicationClasses eeApplicationClasses = deploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
            EEApplicationClasses eeApplicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.server.deployment.annotation.CompositeIndex compositeIndex = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPOSITE_ANNOTATION_INDEX);
            CompositeIndex compositeIndex = deploymentUnit.getAttachment([email protected]_ANNOTATION_INDEX);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.jboss.as.web.common.WarMetaData warMetaData = deploymentUnit.getAttachment(org.jboss.as.web.common.WarMetaData.ATTACHMENT_KEY);
            WarMetaData warMetaData = deploymentUnit.getAttachment(WarMetaData.ATTACHMENT_KEY);

            // extract deployment metadata
            IList <AnnotationInstance> processApplicationAnnotations = null;
            IList <AnnotationInstance> postDeployAnnnotations        = null;
            IList <AnnotationInstance> preUndeployAnnnotations       = null;
            ISet <ClassInfo>           servletProcessApplications    = null;

            if (compositeIndex != null)
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                processApplicationAnnotations = compositeIndex.getAnnotations(DotName.createSimple(typeof(ProcessApplication).FullName));
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                postDeployAnnnotations = compositeIndex.getAnnotations(DotName.createSimple(typeof(PostDeploy).FullName));
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                preUndeployAnnnotations = compositeIndex.getAnnotations(DotName.createSimple(typeof(PreUndeploy).FullName));
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                servletProcessApplications = compositeIndex.getAllKnownSubclasses(DotName.createSimple(typeof(ServletProcessApplication).FullName));
            }
            else
            {
                return(null);
            }

            if (processApplicationAnnotations.Count == 0)
            {
                // no pa found, this is not a process application deployment.
                return(null);
            }
            else if (processApplicationAnnotations.Count > 1)
            {
                // found multiple PAs -> unsupported.
                throw new DeploymentUnitProcessingException("Detected multiple classes annotated with @" + typeof(ProcessApplication).Name + ". A deployment must only provide a single @" + typeof(ProcessApplication).Name + " class.");
            }
            else
            {
                // found single PA

                AnnotationInstance annotationInstance = processApplicationAnnotations[0];
                ClassInfo          paClassInfo        = (ClassInfo)annotationInstance.target();
                string             paClassName        = paClassInfo.name().ToString();

                ComponentDescription paComponent = null;

                // it can either be a Servlet Process Application or a Singleton Session Bean Component or
                if (servletProcessApplications.Contains(paClassInfo))
                {
                    // Servlet Process Applications can only be deployed inside Web Applications
                    if (warMetaData == null)
                    {
                        throw new DeploymentUnitProcessingException("@ProcessApplication class is a ServletProcessApplication but deployment is not a Web Application.");
                    }

                    // check whether it's already a servlet context listener:
                    JBossWebMetaData         mergedJBossWebMetaData = warMetaData.MergedJBossWebMetaData;
                    IList <ListenerMetaData> listeners = mergedJBossWebMetaData.Listeners;
                    if (listeners == null)
                    {
                        listeners = new List <ListenerMetaData>();
                        mergedJBossWebMetaData.Listeners = listeners;
                    }

                    bool isListener = false;
                    foreach (ListenerMetaData listenerMetaData in listeners)
                    {
                        if (listenerMetaData.ListenerClass.Equals(paClassInfo.name().ToString()))
                        {
                            isListener = true;
                        }
                    }

                    if (!isListener)
                    {
                        // register as Servlet Context Listener
                        ListenerMetaData listener = new ListenerMetaData();
                        listener.ListenerClass = paClassName;
                        listeners.Add(listener);

                        // synthesize WebComponent
                        WebComponentDescription paWebComponent = new WebComponentDescription(paClassName, paClassName, eeModuleDescription, deploymentUnit.ServiceName, eeApplicationClasses);

                        eeModuleDescription.addComponent(paWebComponent);

                        deploymentUnit.addToAttachmentList(WebComponentDescription.WEB_COMPONENTS, paWebComponent.StartServiceName);

                        paComponent = paWebComponent;
                    }
                    else
                    {
                        // lookup the existing component
                        paComponent = eeModuleDescription.getComponentsByClassName(paClassName).get(0);
                    }

                    // deactivate sci
                }
                else
                {
                    // if its not a ServletProcessApplication it must be a session bean component

                    IList <ComponentDescription> componentsByClassName = eeModuleDescription.getComponentsByClassName(paClassName);

                    if (componentsByClassName.Count > 0 && (componentsByClassName[0] is SessionBeanComponentDescription))
                    {
                        paComponent = componentsByClassName[0];
                    }
                    else
                    {
                        throw new DeploymentUnitProcessingException("Class " + paClassName + " is annotated with @" + typeof(ProcessApplication).Name + " but is neither a ServletProcessApplication nor an EJB Session Bean Component.");
                    }
                }

                // attach additional metadata to the deployment unit

                if (postDeployAnnnotations.Count > 0)
                {
                    if (postDeployAnnnotations.Count == 1)
                    {
                        ProcessApplicationAttachments.attachPostDeployDescription(deploymentUnit, postDeployAnnnotations[0]);
                    }
                    else
                    {
                        throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PostDeploy. Found [" + postDeployAnnnotations + "]");
                    }
                }

                if (preUndeployAnnnotations.Count > 0)
                {
                    if (preUndeployAnnnotations.Count == 1)
                    {
                        ProcessApplicationAttachments.attachPreUndeployDescription(deploymentUnit, preUndeployAnnnotations[0]);
                    }
                    else
                    {
                        throw new DeploymentUnitProcessingException("There can only be a single method annotated with @PreUndeploy. Found [" + preUndeployAnnnotations + "]");
                    }
                }

                return(paComponent);
            }
        }
コード例 #20
0
 /// <returns> the description of the PreUndeploy method </returns>
 public static AnnotationInstance getPreUndeployDescription(DeploymentUnit deploymentUnit)
 {
     return(deploymentUnit.getAttachment(PRE_UNDEPLOY_METHOD));
 }
コード例 #21
0
 public override void undeploy(DeploymentUnit context)
 {
 }
コード例 #22
0
 /// <summary>
 /// Returns true if the <seealso cref="DeploymentUnit"/> itself is a process application (carries a processes.xml)
 ///
 /// </summary>
 public static bool isProcessApplication(DeploymentUnit deploymentUnit)
 {
     return(deploymentUnit.hasAttachment(MARKER));
 }
コード例 #23
0
 public virtual void undeploy(DeploymentUnit context)
 {
 }
コード例 #24
0
 /// <summary>
 /// Attach the parsed ProcessesXml file to a deployment unit.
 ///
 /// </summary>
 public static void addProcessesXml(DeploymentUnit unit, ProcessesXmlWrapper processesXmlWrapper)
 {
     unit.addToAttachmentList(PROCESSES_XML_LIST, processesXmlWrapper);
 }
コード例 #25
0
 /// <summary>
 /// Returns the <seealso cref="ComponentDescription"/> for the <seealso cref="AbstractProcessApplication"/> component
 /// </summary>
 public static ComponentDescription getProcessApplicationComponent(DeploymentUnit deploymentUnit)
 {
     return(deploymentUnit.getAttachment(PA_COMPONENT));
 }
コード例 #26
0
        public static List <string> ListPackageContentAsList(string msiPath)
        {
            IInstallPackage package     = null;
            List <string>   packageInfo = new List <string>();

            if (string.IsNullOrWhiteSpace(msiPath))
            {
                return(packageInfo);
            }
            try
            {
                Dictionary <string, string> properties;
                string        path = Helper.ExtractFiles(msiPath, out properties);
                DirectoryInfo di   = new DirectoryInfo(path);

                package = DeploymentUnit.ScanPackage(msiPath);
                if (package != null)
                {
                    packageInfo.Add("Title: " + package.Title);
                    packageInfo.Add("Author: " + package.Author);
                    packageInfo.Add("Subject: " + package.Subject);
                    packageInfo.Add("Comments: " + package.Comments);
                    packageInfo.Add("Keywords: " + package.Keywords);
                    packageInfo.Add("Create Time: " + package.CreateTime.ToString("u", CultureInfo.InvariantCulture));
                    packageInfo.Add("Package Code: " + package.RevisionNumber);
                    if ((null != properties) && properties.ContainsKey("ProductCode"))
                    {
                        packageInfo.Add("Product Code: " + properties["ProductCode"]);
                    }
                    else
                    {
                        packageInfo.Add("Product Code: ");
                    }
                    packageInfo.Add("Resource type;Luid;Filename;Version");
                    if ((package.Resources != null) && (package.Resources.Length != 0))
                    {
                        foreach (IDeploymentResource resource in package.Resources)
                        {
                            string resourceItem = string.Format("{0};{1};", new object[] { resource.ResourceType, resource.Luid });
                            // Get the corresponding file
                            if (resource.Properties.ContainsKey("DestinationLocation"))
                            {
                                string filename = (string)resource.Properties["DestinationLocation"];
                                if (!string.IsNullOrEmpty(filename))
                                {
                                    FileInfo   fi  = new FileInfo(filename);
                                    FileInfo[] fis = di.GetFiles(fi.Name, SearchOption.AllDirectories);
                                    if (fis.Length > 0)
                                    {
                                        FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(fis[0].FullName);
                                        resourceItem += string.Format("{0};{1}", filename, versionInfo.FileVersion);
                                    }
                                    else
                                    {
                                        resourceItem += ";";
                                    }
                                }
                                else
                                {
                                    resourceItem += ";";
                                }
                            }
                            else
                            {
                                resourceItem += ";";
                            }

                            packageInfo.Add(resourceItem);
                        }
                    }
                }
                di.Delete(true);
            }
            catch (Exception exception)
            {
                throw new Exception(string.Format("ListPackageContent: Error occured: {0}", exception.Message), exception);
            }
            return(packageInfo);
        }
コード例 #27
0
 /// <returns> the description of the PostDeploy method </returns>
 public static AnnotationInstance getPostDeployDescription(DeploymentUnit deploymentUnit)
 {
     return(deploymentUnit.getAttachment(POST_DEPLOY_METHOD));
 }
コード例 #28
0
 /// <summary>
 /// Attach the <seealso cref="AnnotationInstance"/>s for the PreUndeploy methods
 /// </summary>
 public static void attachPreUndeployDescription(DeploymentUnit deploymentUnit, AnnotationInstance annotation)
 {
     deploymentUnit.putAttachment(PRE_UNDEPLOY_METHOD, annotation);
 }
コード例 #29
0
 /// <summary>
 /// marks a a <seealso cref="DeploymentUnit"/> as a process application
 /// </summary>
 public static void mark(DeploymentUnit unit)
 {
     unit.putAttachment(MARKER, true);
 }