コード例 #1
0
    @Override
    protected ManagedConnectionFactory createMcf(XaDataSource arg0, String arg1, ClassLoader arg2)
        throws NotFoundException, DeployException {
      final WildFlyXaMCF xaManagedConnectionFactory = new WildFlyXaMCF();

      if (xaDataSourceConfig.getUrlDelimiter() != null) {
        xaManagedConnectionFactory.setURLDelimiter(xaDataSourceConfig.getUrlDelimiter());
      }
      if (xaDataSourceConfig.getXaDataSourceClass() != null) {
        xaManagedConnectionFactory.setXADataSourceClass(xaDataSourceConfig.getXaDataSourceClass());
      }
      if (xaDataSourceConfig.getXaDataSourceProperty() != null) {
        xaManagedConnectionFactory.setXaProps(xaDataSourceConfig.getXaDataSourceProperty());
      }
      if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) {
        xaManagedConnectionFactory.setUrlSelectorStrategyClassName(
            xaDataSourceConfig.getUrlSelectorStrategyClassName());
      }
      if (xaDataSourceConfig.getXaPool() != null
          && xaDataSourceConfig.getXaPool().isSameRmOverride() != null) {
        xaManagedConnectionFactory.setIsSameRMOverrideValue(
            xaDataSourceConfig.getXaPool().isSameRmOverride());
      }

      if (xaDataSourceConfig.getNewConnectionSql() != null) {
        xaManagedConnectionFactory.setNewConnectionSQL(xaDataSourceConfig.getNewConnectionSql());
      }

      if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) {
        xaManagedConnectionFactory.setUrlSelectorStrategyClassName(
            xaDataSourceConfig.getUrlSelectorStrategyClassName());
      }

      setMcfProperties(
          xaManagedConnectionFactory, xaDataSourceConfig, xaDataSourceConfig.getStatement());
      return xaManagedConnectionFactory;
    }
コード例 #2
0
  private void writeXADsElement(XMLExtendedStreamWriter streamWriter, XaDataSource ds)
      throws XMLStreamException {
    streamWriter.writeStartElement(DataSources.Tag.DATASOURCE.getLocalName());
    streamWriter.writeAttribute(XaDataSource.Attribute.JNDINAME.getLocalName(), ds.getJndiName());
    if (ds.isEnabled() != null)
      streamWriter.writeAttribute(
          XaDataSource.Attribute.ENABLED.getLocalName(), ds.isEnabled().toString());
    if (ds.isUseJavaContext() != null)
      streamWriter.writeAttribute(
          XaDataSource.Attribute.USEJAVACONTEXT.getLocalName(), ds.isUseJavaContext().toString());
    streamWriter.writeAttribute(XaDataSource.Attribute.POOL_NAME.getLocalName(), ds.getPoolName());

    if (ds.getXaDataSourceProperty() != null) {
      for (Entry<String, String> entry : ds.getXaDataSourceProperty().entrySet()) {
        writeXaProperty(streamWriter, entry);
      }
    }

    if (ds.getXaDataSourceClass() != null) {
      streamWriter.writeStartElement(XaDataSource.Tag.XADATASOURCECLASS.getLocalName());
      streamWriter.writeCharacters(ds.getXaDataSourceClass());
      streamWriter.writeEndElement();
    }

    if (ds.getModule() != null) {
      streamWriter.writeStartElement(XaDataSource.Tag.MODULE.getLocalName());
      streamWriter.writeCharacters(ds.getModule());
      streamWriter.writeEndElement();
    }

    if (ds.getUrlDelimiter() != null) {
      streamWriter.writeStartElement(XaDataSource.Tag.URLDELIMITER.getLocalName());
      streamWriter.writeCharacters(ds.getUrlDelimiter());
      streamWriter.writeEndElement();
    }

    if (ds.getUrlSelectorStrategyClassName() != null) {
      streamWriter.writeStartElement(XaDataSource.Tag.URLSELECTORSTRATEGYCLASSNAME.getLocalName());
      streamWriter.writeCharacters(ds.getUrlSelectorStrategyClassName());
      streamWriter.writeEndElement();
    }

    if (ds.getNewConnectionSql() != null) {
      streamWriter.writeStartElement(XaDataSource.Tag.NEWCONNECTIONSQL.getLocalName());
      streamWriter.writeCharacters(ds.getNewConnectionSql());
      streamWriter.writeEndElement();
    }

    if (ds.getTransactionIsolation() != null) {
      streamWriter.writeStartElement(XaDataSource.Tag.TRANSACTIONISOLATION.getLocalName());
      streamWriter.writeCharacters(ds.getTransactionIsolation().name());
      streamWriter.writeEndElement();
    }

    streamWriter.writeStartElement(XaDataSource.Tag.XA_POOL.getLocalName());
    writeXaPool(streamWriter, ds.getXaPool());
    streamWriter.writeEndElement();

    streamWriter.writeStartElement(XaDataSource.Tag.SECURITY.getLocalName());
    writeSecurity(streamWriter, ds.getSecurity());
    streamWriter.writeEndElement();

    streamWriter.writeStartElement(XaDataSource.Tag.VALIDATION.getLocalName());
    writeValidation(streamWriter, ds.getValidation());
    streamWriter.writeEndElement();

    streamWriter.writeStartElement(XaDataSource.Tag.TIMEOUT.getLocalName());
    writeTimeOut(streamWriter, ds.getTimeOut());
    streamWriter.writeEndElement();

    streamWriter.writeStartElement(XaDataSource.Tag.STATEMENT.getLocalName());
    writeStatement(streamWriter, ds.getStatement());
    streamWriter.writeEndElement();

    streamWriter.writeEndElement();
  }