private EJBClientDescriptorMetaData parse(final InputStream source, final File file, final XMLMapper mapper) throws DeploymentUnitProcessingException { try { final XMLInputFactory inputFactory = INPUT_FACTORY; setIfSupported(inputFactory, XMLInputFactory.IS_VALIDATING, Boolean.FALSE); setIfSupported(inputFactory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); final XMLStreamReader streamReader = inputFactory.createXMLStreamReader(source); try { final EJBClientDescriptorMetaData result = new EJBClientDescriptorMetaData(); mapper.parseDocument(result, streamReader); return result; } finally { safeClose(streamReader); } } catch (XMLStreamException e) { throw EeLogger.ROOT_LOGGER.xmlErrorParsingEJBClientDescriptor(e, file.getAbsolutePath()); } }
protected void parseRemotingReceiver(final XMLExtendedStreamReader reader, final EJBClientDescriptorMetaData ejbClientDescriptorMetaData) throws XMLStreamException { String outboundConnectionRef = null; final Set<EJBClientDescriptorXMLAttribute> required = EnumSet.of(EJBClientDescriptorXMLAttribute.OUTBOUND_CONNECTION_REF); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final EJBClientDescriptorXMLAttribute attribute = EJBClientDescriptorXMLAttribute.forName(reader.getAttributeLocalName(i)); required.remove(attribute); switch (attribute) { case OUTBOUND_CONNECTION_REF: outboundConnectionRef = readResolveValue(reader, i); ejbClientDescriptorMetaData.addRemotingReceiverConnectionRef(outboundConnectionRef); break; default: unexpectedContent(reader); } } if (!required.isEmpty()) { missingAttributes(reader.getLocation(), required); } // This element is just composed of attributes which we already processed, so no more content // is expected if (reader.hasNext() && reader.nextTag() != END_ELEMENT) { unexpectedContent(reader); } }
final EJBClientDescriptorMetaData.ClusterConfig clusterConfig = ejbClientDescriptorMetaData.newClusterConfig(clusterName); clusterConfig.setConnectTimeout(connectTimeout); clusterConfig.setNodeSelector(clusterNodeSelector);
case INVOCATION_TIMEOUT: final Long invocationTimeout = Long.parseLong(val.trim()); ejbClientDescriptorMetaData.setInvocationTimeout(invocationTimeout); break; case DEPLOYMENT_NODE_SELECTOR: ejbClientDescriptorMetaData.setDeploymentNodeSelector(val.trim()); break; default:
case EXCLUDE_LOCAL_RECEIVER: final boolean excludeLocalReceiver = Boolean.parseBoolean(value); ejbClientDescriptorMetaData.setExcludeLocalReceiver(excludeLocalReceiver); break; case LOCAL_RECEIVER_PASS_BY_VALUE: ejbClientDescriptorMetaData.setLocalReceiverPassByValue(localReceiverPassByValue != Boolean.FALSE); while (reader.hasNext()) { switch (reader.nextTag()) {
final String profile = ejbClientDescriptorMetaData.getProfile(); final ServiceName profileServiceName; if (profile != null) { final ServiceBuilder<RemotingProfileService> profileServiceBuilder = serviceTarget.addService(profileServiceName, profileService); if (ejbClientDescriptorMetaData.isLocalReceiverExcluded() != Boolean.TRUE) { final Boolean passByValue = ejbClientDescriptorMetaData.isLocalReceiverPassByValue(); profileServiceBuilder.addDependency(passByValue == Boolean.FALSE ? LocalTransportProvider.BY_REFERENCE_SERVICE_NAME : LocalTransportProvider.BY_VALUE_SERVICE_NAME, EJBTransportProvider.class, profileService.getLocalTransportProviderInjector()); final Collection<EJBClientDescriptorMetaData.RemotingReceiverConfiguration> receiverConfigurations = ejbClientDescriptorMetaData.getRemotingReceiverConfigurations(); for (EJBClientDescriptorMetaData.RemotingReceiverConfiguration receiverConfiguration : receiverConfigurations) { final String connectionRef = receiverConfiguration.getOutboundConnectionRef(); final String deploymentNodeSelectorClassName = ejbClientDescriptorMetaData.getDeploymentNodeSelector(); if (deploymentNodeSelectorClassName != null) { final DeploymentNodeSelector deploymentNodeSelector; final long invocationTimeout = ejbClientDescriptorMetaData.getInvocationTimeout(); service.setInvocationTimeout(invocationTimeout); final Collection<EJBClientDescriptorMetaData.ClusterConfig> clusterConfigs = ejbClientDescriptorMetaData.getClusterConfigs(); if (!clusterConfigs.isEmpty()) { final List<EJBClientCluster> clientClusters = new ArrayList<>(clusterConfigs.size());
private EJBClientConfiguration createClientConfiguration(final ServiceRegistry serviceRegistry, final ClassLoader classLoader, final EJBClientDescriptorMetaData ejbClientDescriptorMetaData) throws DeploymentUnitProcessingException { final JBossEJBClientXmlConfiguration ejbClientConfig = new JBossEJBClientXmlConfiguration(); ejbClientConfig.setInvocationTimeout(ejbClientDescriptorMetaData.getInvocationTimeout()); // deployment node selector final String deploymentNodeSelectorClassName = ejbClientDescriptorMetaData.getDeploymentNodeSelector(); if (deploymentNodeSelectorClassName != null && !deploymentNodeSelectorClassName.trim().isEmpty()) { try { final Class<?> deploymentNodeSelectorClass = classLoader.loadClass(deploymentNodeSelectorClassName); ejbClientConfig.setDeploymentNodeSelector((DeploymentNodeSelector) deploymentNodeSelectorClass.newInstance()); } catch (Exception e) { throw EjbMessages.MESSAGES.failedToCreateDeploymentNodeSelector(e, deploymentNodeSelectorClassName); } } for (final EJBClientDescriptorMetaData.ClusterConfig clusterMetadata : ejbClientDescriptorMetaData.getClusterConfigs()) { final EJBClientClusterConfig clusterConfig = new EJBClientClusterConfig(clusterMetadata, classLoader, serviceRegistry); // add it to the client configuration ejbClientConfig.addClusterConfiguration(clusterConfig); for (final EJBClientDescriptorMetaData.ClusterNodeConfig nodeMetadata : clusterMetadata.getClusterNodeConfigs()) { final EJBClientClusterNodeConfig clusterNodeConfig = new EJBClientClusterNodeConfig(nodeMetadata, classLoader, serviceRegistry); clusterConfig.addClusterNode(clusterNodeConfig); } } return ejbClientConfig; }
case INVOCATION_TIMEOUT: final Long invocationTimeout = Long.parseLong(value); ejbClientDescriptorMetaData.setInvocationTimeout(invocationTimeout); break; case DEPLOYMENT_NODE_SELECTOR: final String deploymentNodeSelector = readResolveValue(reader, i); ejbClientDescriptorMetaData.setDeploymentNodeSelector(deploymentNodeSelector); break; default:
case EXCLUDE_LOCAL_RECEIVER: final boolean excludeLocalReceiver = Boolean.parseBoolean(val.trim()); ejbClientDescriptorMetaData.setExcludeLocalReceiver(excludeLocalReceiver); break; case LOCAL_RECEIVER_PASS_BY_VALUE: ejbClientDescriptorMetaData.setLocalReceiverPassByValue(localReceiverPassByValue); while (reader.hasNext()) { switch (reader.nextTag()) {
case INVOCATION_TIMEOUT: final Long invocationTimeout = Long.parseLong(val.trim()); ejbClientDescriptorMetaData.setInvocationTimeout(invocationTimeout); break; case DEPLOYMENT_NODE_SELECTOR: ejbClientDescriptorMetaData.setDeploymentNodeSelector(val.trim()); break; default:
case EXCLUDE_LOCAL_RECEIVER: final boolean excludeLocalReceiver = Boolean.parseBoolean(val.trim()); ejbClientDescriptorMetaData.setExcludeLocalReceiver(excludeLocalReceiver); break; case LOCAL_RECEIVER_PASS_BY_VALUE: ejbClientDescriptorMetaData.setLocalReceiverPassByValue(localReceiverPassByValue); while (reader.hasNext()) { switch (reader.nextTag()) {
outboundConnectionRef = value; remotingReceiverConfiguration = ejbClientDescriptorMetaData .addRemotingReceiverConnectionRef(outboundConnectionRef); break; case CONNECT_TIMEOUT:
final EJBClientDescriptorMetaData.ClusterConfig clusterConfig = ejbClientDescriptorMetaData.newClusterConfig(clusterName); clusterConfig.setConnectTimeout(connectTimeout); clusterConfig.setNodeSelector(clusterNodeSelector);
private EJBClientDescriptorMetaData parse(final InputStream source, final File file, final DeploymentUnit deploymentUnit, final ModuleLoader moduleLoader) throws DeploymentUnitProcessingException { try { final XMLInputFactory inputFactory = INPUT_FACTORY; setIfSupported(inputFactory, XMLInputFactory.IS_VALIDATING, Boolean.FALSE); setIfSupported(inputFactory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); final XMLStreamReader streamReader = inputFactory.createXMLStreamReader(source); try { final EJBClientDescriptorMetaData result = new EJBClientDescriptorMetaData(); mapper.parseDocument(result, streamReader); return result; } finally { safeClose(streamReader); } } catch (XMLStreamException e) { throw EeMessages.MESSAGES.xmlErrorParsingEJBClientDescriptor(e, file.getAbsolutePath()); } }
case INVOCATION_TIMEOUT: final Long invocationTimeout = Long.parseLong(val.trim()); ejbClientDescriptorMetaData.setInvocationTimeout(invocationTimeout); break; case DEPLOYMENT_NODE_SELECTOR: ejbClientDescriptorMetaData.setDeploymentNodeSelector(val.trim()); break; default:
case EXCLUDE_LOCAL_RECEIVER: final boolean excludeLocalReceiver = Boolean.parseBoolean(val.trim()); ejbClientDescriptorMetaData.setExcludeLocalReceiver(excludeLocalReceiver); break; case LOCAL_RECEIVER_PASS_BY_VALUE: ejbClientDescriptorMetaData.setLocalReceiverPassByValue(localReceiverPassByValue); while (reader.hasNext()) { switch (reader.nextTag()) {
private void parseRemotingReceiver(final XMLExtendedStreamReader reader, final EJBClientDescriptorMetaData ejbClientDescriptorMetaData) throws XMLStreamException { String outboundConnectionRef = null; final Set<Attribute> required = EnumSet.of(Attribute.OUTBOUND_CONNECTION_REF); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final Attribute attribute = Attribute.of(reader.getAttributeName(i)); required.remove(attribute); switch (attribute) { case OUTBOUND_CONNECTION_REF: outboundConnectionRef = reader.getAttributeValue(i).trim(); ejbClientDescriptorMetaData.addRemotingReceiverConnectionRef(outboundConnectionRef); break; default: unexpectedContent(reader); } } if (!required.isEmpty()) { missingAttributes(reader.getLocation(), required); } // This element is just composed of attributes which we already processed, so no more content // is expected if (reader.hasNext() && reader.nextTag() != END_ELEMENT) { unexpectedContent(reader); } }
final EJBClientDescriptorMetaData.ClusterConfig clusterConfig = ejbClientDescriptorMetaData.newClusterConfig(clusterName); clusterConfig.setConnectTimeout(connectTimeout); clusterConfig.setNodeSelector(clusterNodeSelector);
private EJBClientDescriptorMetaData parse(final InputStream source, final File file, final XMLMapper mapper) throws DeploymentUnitProcessingException { try { final XMLInputFactory inputFactory = INPUT_FACTORY; setIfSupported(inputFactory, XMLInputFactory.IS_VALIDATING, Boolean.FALSE); setIfSupported(inputFactory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); final XMLStreamReader streamReader = inputFactory.createXMLStreamReader(source); try { final EJBClientDescriptorMetaData result = new EJBClientDescriptorMetaData(); mapper.parseDocument(result, streamReader); return result; } finally { safeClose(streamReader); } } catch (XMLStreamException e) { throw EeLogger.ROOT_LOGGER.xmlErrorParsingEJBClientDescriptor(e, file.getAbsolutePath()); } }
case INVOCATION_TIMEOUT: final Long invocationTimeout = Long.parseLong(val.trim()); ejbClientDescriptorMetaData.setInvocationTimeout(invocationTimeout); break; case DEPLOYMENT_NODE_SELECTOR: ejbClientDescriptorMetaData.setDeploymentNodeSelector(val.trim()); break; default: