//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testParseSubsystemWithJobExecutorXml() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testParseSubsystemWithJobExecutorXml() { string subsystemXml = FileUtils.readFile(SUBSYSTEM_WITH_JOB_EXECUTOR); // System.out.println(normalizeXML(subsystemXml)); IList <ModelNode> operations = parse(subsystemXml); // System.out.println(operations); assertEquals(4, operations.Count); ModelNode jobExecutor = operations[1]; PathAddress pathAddress = PathAddress.pathAddress(jobExecutor.get(ModelDescriptionConstants.OP_ADDR)); assertEquals(2, pathAddress.size()); PathElement element = pathAddress.getElement(0); assertEquals(ModelDescriptionConstants.SUBSYSTEM, element.Key); assertEquals(org.camunda.bpm.container.impl.jboss.extension.ModelConstants_Fields.SUBSYSTEM_NAME, element.Value); element = pathAddress.getElement(1); assertEquals(Element.JOB_EXECUTOR.LocalName, element.Key); assertEquals(Attribute.DEFAULT.LocalName, element.Value); assertEquals("job-executor-tp", jobExecutor.get(Element.THREAD_POOL_NAME.LocalName).asString()); ModelNode jobAcquisition = operations[2]; assertEquals("default", jobAcquisition.get(Attribute.NAME.LocalName).asString()); assertEquals("SEQUENTIAL", jobAcquisition.get(Element.ACQUISITION_STRATEGY.LocalName).asString()); jobAcquisition = operations[3]; assertEquals("anders", jobAcquisition.get(Attribute.NAME.LocalName).asString()); assertEquals("SEQUENTIAL", jobAcquisition.get(Element.ACQUISITION_STRATEGY.LocalName).asString()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void performRuntime(final OperationContext context, final org.jboss.dmr.ModelNode operation, final org.jboss.dmr.ModelNode model) throws OperationFailedException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: protected internal override void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { string engineName = PathAddress.pathAddress(operation.get(ADDRESS)).LastElement.Value; ManagedProcessEngineMetadata processEngineConfiguration = transformConfiguration(context, engineName, model); ServiceController <ProcessEngine> controller = installService(context, processEngineConfiguration); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void parseJobExecutor(org.jboss.staxmapper.XMLExtendedStreamReader reader, java.util.List<org.jboss.dmr.ModelNode> list, org.jboss.dmr.ModelNode parentAddress) throws javax.xml.stream.XMLStreamException private void parseJobExecutor(XMLExtendedStreamReader reader, IList <ModelNode> list, ModelNode parentAddress) { if (!Element.JOB_EXECUTOR.LocalName.Equals(reader.LocalName)) { throw unexpectedElement(reader); } // Add the 'add' operation for 'job-executor' parent ModelNode addJobExecutor = new ModelNode(); addJobExecutor.get(OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, ModelConstants_Fields.SUBSYSTEM_NAME), PathElement.pathElement(Element.JOB_EXECUTOR.LocalName, ModelConstants_Fields.DEFAULT)); addJobExecutor.get(OP_ADDR).set(addr.toModelNode()); list.Add(addJobExecutor); // iterate deeper while (reader.hasNext()) { switch (reader.nextTag()) { case END_ELEMENT: { if (Element.forName(reader.LocalName) == Element.JOB_EXECUTOR) { // should mean we're done, so ignore it. return; } } goto case START_ELEMENT; case START_ELEMENT: { switch (Element.forName(reader.LocalName)) { case JOB_AQUISITIONS: { parseJobAcquisitions(reader, list, addJobExecutor); break; } case THREAD_POOL_NAME: { parseElement(SubsystemAttributeDefinitons.THREAD_POOL_NAME, reader, addJobExecutor); break; } default: { throw unexpectedElement(reader); } } break; } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void performRuntime(org.jboss.as.controller.OperationContext context, org.jboss.dmr.ModelNode operation, org.jboss.dmr.ModelNode model, org.jboss.as.controller.ServiceVerificationHandler verificationHandler, java.util.List<org.jboss.msc.service.ServiceController<?>> newControllers) throws org.jboss.as.controller.OperationFailedException protected internal override void performRuntime <T1>(OperationContext context, ModelNode operation, ModelNode model, ServiceVerificationHandler verificationHandler, IList <T1> newControllers) { string engineName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).LastElement.Value; ManagedProcessEngineMetadata processEngineConfiguration = transformConfiguration(context, engineName, model); ServiceController <ProcessEngine> controller = installService(context, verificationHandler, processEngineConfiguration); newControllers.Add(controller); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override protected void performRuntime(final OperationContext context, final org.jboss.dmr.ModelNode operation, final org.jboss.dmr.ModelNode model) throws OperationFailedException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: protected internal override void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { string acquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).LastElement.Value; MscRuntimeContainerJobExecutor mscRuntimeContainerJobExecutor = new MscRuntimeContainerJobExecutor(); if (model.hasDefined(SubsystemAttributeDefinitons.PROPERTIES.Name)) { IList <Property> properties = SubsystemAttributeDefinitons.PROPERTIES.resolveModelAttribute(context, model).asPropertyList(); foreach (Property property in properties) { PropertyHelper.applyProperty(mscRuntimeContainerJobExecutor, property.Name, property.Value.asString()); } } // start new service for job executor ServiceController <RuntimeContainerJobExecutor> serviceController = context.ServiceTarget.addService(ServiceNames.forMscRuntimeContainerJobExecutorService(acquisitionName), mscRuntimeContainerJobExecutor).addDependency(ServiceNames.forMscRuntimeContainerDelegate()).addDependency(ServiceNames.forMscExecutorService()).setInitialMode(ServiceController.Mode.ACTIVE).install(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void parseJobAcquisition(org.jboss.staxmapper.XMLExtendedStreamReader reader, java.util.List<org.jboss.dmr.ModelNode> list, org.jboss.dmr.ModelNode parentAddress) throws javax.xml.stream.XMLStreamException private void parseJobAcquisition(XMLExtendedStreamReader reader, IList <ModelNode> list, ModelNode parentAddress) { if (!Element.JOB_AQUISITION.LocalName.Equals(reader.LocalName)) { throw unexpectedElement(reader); } string acquisitionName = null; for (int i = 0; i < reader.AttributeCount; i++) { string attr = reader.getAttributeLocalName(i); if (Attribute.forName(attr).Equals(Attribute.NAME)) { acquisitionName = reader.getAttributeValue(i).ToString(); } else { throw unexpectedAttribute(reader, i); } } if ("null".Equals(acquisitionName)) { throw missingRequiredElement(reader, Collections.singleton(Attribute.NAME.LocalName)); } // Add the 'add' operation for each 'job-acquisition' child ModelNode addJobAcquisition = new ModelNode(); addJobAcquisition.get(OP).set(ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, ModelConstants_Fields.SUBSYSTEM_NAME), PathElement.pathElement(Element.JOB_EXECUTOR.LocalName, ModelConstants_Fields.DEFAULT), PathElement.pathElement(Element.JOB_AQUISITIONS.LocalName, acquisitionName)); addJobAcquisition.get(OP_ADDR).set(addr.toModelNode()); addJobAcquisition.get(Attribute.NAME.LocalName).set(acquisitionName); list.Add(addJobAcquisition); // iterate deeper while (reader.hasNext()) { switch (reader.nextTag()) { case END_ELEMENT: { if (Element.forName(reader.LocalName) == Element.JOB_AQUISITION) { // should mean we're done, so ignore it. return; } } goto case START_ELEMENT; case START_ELEMENT: { switch (Element.forName(reader.LocalName)) { case PROPERTIES: { parseProperties(reader, list, addJobAcquisition); break; } case ACQUISITION_STRATEGY: { parseElement(SubsystemAttributeDefinitons.ACQUISITION_STRATEGY, reader, addJobAcquisition); break; } default: { throw unexpectedElement(reader); } } break; } } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void parseProcessEngine(org.jboss.staxmapper.XMLExtendedStreamReader reader, java.util.List<org.jboss.dmr.ModelNode> list, org.jboss.dmr.ModelNode parentAddress, java.util.List<String> discoveredEngineNames) throws javax.xml.stream.XMLStreamException private void parseProcessEngine(XMLExtendedStreamReader reader, IList <ModelNode> list, ModelNode parentAddress, IList <string> discoveredEngineNames) { if (!Element.PROCESS_ENGINE.LocalName.Equals(reader.LocalName)) { throw unexpectedElement(reader); } ModelNode addProcessEngine = new ModelNode(); string engineName = null; for (int i = 0; i < reader.AttributeCount; i++) { string attr = reader.getAttributeLocalName(i); if (Attribute.forName(attr).Equals(Attribute.NAME)) { engineName = reader.getAttributeValue(i).ToString(); } else if (Attribute.forName(attr).Equals(Attribute.DEFAULT)) { SubsystemAttributeDefinitons.DEFAULT.parseAndSetParameter(reader.getAttributeValue(i), addProcessEngine, reader); } else { throw unexpectedAttribute(reader, i); } } if ("null".Equals(engineName)) { throw missingRequiredElement(reader, Collections.singleton(Attribute.NAME.LocalName)); } //Add the 'add' operation for each 'process-engine' child addProcessEngine.get(OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, ModelConstants_Fields.SUBSYSTEM_NAME), PathElement.pathElement(Element.PROCESS_ENGINES.LocalName, engineName)); addProcessEngine.get(OP_ADDR).set(addr.toModelNode()); addProcessEngine.get(Attribute.NAME.LocalName).set(engineName); if (discoveredEngineNames.Contains(engineName)) { throw new ProcessEngineException("A process engine with name '" + engineName + "' already exists. The process engine name must be unique."); } else { discoveredEngineNames.Add(engineName); } list.Add(addProcessEngine); // iterate deeper while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Element element = Element.forName(reader.getLocalName()); Element element = Element.forName(reader.LocalName); switch (element.innerEnumValue) { case org.camunda.bpm.container.impl.jboss.extension.Element.InnerEnum.PLUGINS: { parsePlugins(reader, list, addProcessEngine); break; } case org.camunda.bpm.container.impl.jboss.extension.Element.InnerEnum.PROPERTIES: { parseProperties(reader, list, addProcessEngine); break; } case org.camunda.bpm.container.impl.jboss.extension.Element.InnerEnum.DATASOURCE: { parseElement(SubsystemAttributeDefinitons.DATASOURCE, reader, addProcessEngine); break; } case org.camunda.bpm.container.impl.jboss.extension.Element.InnerEnum.HISTORY_LEVEL: { parseElement(SubsystemAttributeDefinitons.HISTORY_LEVEL, reader, addProcessEngine); break; } case org.camunda.bpm.container.impl.jboss.extension.Element.InnerEnum.CONFIGURATION: { parseElement(SubsystemAttributeDefinitons.CONFIGURATION, reader, addProcessEngine); break; } default: { throw unexpectedElement(reader); } } } }