Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2011, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.connector.subsystems.datasources;
 
 import java.util.Map;
 
A modifiable DataSourceImpl to add connection properties

Author(s):
Stefano Maestri
 
 public class ModifiableXaDataSource extends DataSourceAbstractImpl implements XaDataSource {
    
The serialVersionUID
 
     private static final long serialVersionUID = -1401087499308709724L;

    
The bundle
 
     private static CommonBundle bundle = Messages.getBundle(CommonBundle.class);
 
     private final HashMap<StringStringxaDataSourceProperty;
 
     private String xaDataSourceClass;
 
     private final String driver;
 
     private final String newConnectionSql;
 
     private final CommonXaPool xaPool;
 
     private final Recovery recovery;

    
Create a new XADataSourceImpl.

Parameters:
transactionIsolation transactionIsolation
timeOut timeOut
security security
statement statement
validation validation
urlDelimiter urlDelimiter
urlSelectorStrategyClassName urlSelectorStrategyClassName
useJavaContext useJavaContext
poolName poolName
enabled enabled
jndiName jndiName
spy spy
useCcm useCcm
xaDataSourceProperty xaDataSourceProperty
xaDataSourceClass xaDataSourceClass
driver driver
newConnectionSql newConnectionSql
xaPool xaPool
recovery recovery
Throws:
org.jboss.jca.common.api.validator.ValidateException ValidateException
 
     public ModifiableXaDataSource(TransactionIsolation transactionIsolationTimeOut timeOutDsSecurity security,
                                   Statement statementValidation validationString urlDelimiterString urlSelectorStrategyClassName,
                                   Boolean useJavaContextString poolNameBoolean enabledString jndiNameBoolean spyBoolean useCcm,
                                   Map<StringStringxaDataSourcePropertyString xaDataSourceClassString driverString newConnectionSql,
                                  CommonXaPool xaPoolRecovery recoverythrows ValidateException {
        super(transactionIsolationtimeOutsecuritystatementvalidationurlDelimiter,
                urlSelectorStrategyClassNameuseJavaContextpoolNameenabledjndiNamespyuseCcm);
        if (xaDataSourceProperty != null) {
            this. = new HashMap<StringString>(xaDataSourceProperty.size());
            this..putAll(xaDataSourceProperty);
        } else {
            this. = new HashMap<StringString>(0);
        }
        this. = xaDataSourceClass;
        this. = driver;
        this. = newConnectionSql;
        this. = xaPool;
        this. = recovery;
        this.validate();
    }

    
Get the xaDataSourceClass.

Returns:
the xaDataSourceClass.
    @Override
    public final String getXaDataSourceClass() {
        return ;
    }

    
Get the driver.

Returns:
the driver.
    @Override
    public final String getDriver() {
        return ;
    }

    
Get the statement.

Returns:
the statement.
    @Override
    public final Statement getStatement() {
        return ;
    }

    
Get the urlDelimiter.

Returns:
the urlDelimiter.
    @Override
    public final String getUrlDelimiter() {
        return ;
    }

    
Get the urlSelectorStrategyClassName.

Returns:
the urlSelectorStrategyClassName.
    @Override
    public final String getUrlSelectorStrategyClassName() {
        return ;
    }

    
Get the newConnectionSql.

Returns:
the newConnectionSql.
    @Override
    public final String getNewConnectionSql() {
        return ;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (!(obj instanceof ModifiableXaDataSource))
            return false;
        ModifiableXaDataSource other = (ModifiableXaDataSourceobj;
        if ( == null) {
            if (other.driver != null)
                return false;
        } else if (!.equals(other.driver))
            return false;
        if ( == null) {
            if (other.newConnectionSql != null)
                return false;
        } else if (!.equals(other.newConnectionSql))
            return false;
        if ( == null) {
            if (other.xaDataSourceClass != null)
                return false;
        } else if (!.equals(other.xaDataSourceClass))
            return false;
        if ( == null) {
            if (other.xaDataSourceProperty != null)
                return false;
        } else if (!.equals(other.xaDataSourceProperty))
            return false;
        if ( == null) {
            if (other.xaPool != null)
                return false;
        } else if (!.equals(other.xaPool))
            return false;
        return true;
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("<xa-datasource");
        if ( != null)
            sb.append(" ").append(..).append("=\"").append().append("\"");
        if ( != null)
            sb.append(" ").append(..).append("=\"").append().append("\"");
        if ( != null)
            sb.append(" ").append(..).append("=\"").append().append("\"");
        if ( != null) {
            sb.append(" ").append(..);
            sb.append("=\"").append().append("\"");
        }
        if ()
            sb.append(" ").append(..).append("=\"").append().append("\"");
        if ()
            sb.append(" ").append(..).append("=\"").append().append("\"");
        sb.append(">");
        if ( != null && .size() > 0) {
            Iterator<Map.Entry<StringString>> it = .entrySet().iterator();
            while (it.hasNext()) {
                Map.Entry<StringStringentry = it.next();
                sb.append("<").append(..);
                sb.append(" name=\"").append(entry.getKey()).append("\">");
                sb.append(entry.getValue());
                sb.append("</").append(..).append(">");
            }
        }
        if ( != null) {
            sb.append("<").append(..).append(">");
            sb.append();
            sb.append("</").append(..).append(">");
        }
        if ( != null) {
            sb.append("<").append(..).append(">");
            sb.append();
            sb.append("</").append(..).append(">");
        }
        if ( != null) {
            sb.append("<").append(..).append(">");
            sb.append();
            sb.append("</").append(..).append(">");
        }
        if ( != null) {
            sb.append();
        }
        if ( != null) {
            sb.append("<").append(..).append(">");
            sb.append();
            sb.append("</").append(..).append(">");
        }
        if ( != null) {
            sb.append("<").append(..).append(">");
            sb.append();
            sb.append("</").append(..).append(">");
        }
        if ( != null)
            sb.append();
        if ( != null)
            sb.append();
        if ( != null)
            sb.append();
        if ( != null)
            sb.append();
        if ( != null)
            sb.append();
        if ( != null)
            sb.append();
        sb.append("</xa-datasource>");
        return sb.toString();
    }

    
Get the xaDataSourceProperty.

Returns:
the xaDataSourceProperty.
    @Override
    public final Map<StringStringgetXaDataSourceProperty() {
        return Collections.unmodifiableMap();
    }
    public final void addXaDataSourceProperty(String nameString value) {
        .put(namevalue);
    }

    
Get the xaPool.

Returns:
the xaPool.
    @Override
    public final CommonXaPool getXaPool() {
        return ;
    }
    @Override
    public void validate() throws ValidateException {
        if ((this. == null || this..trim().length() == 0) &&
                (this. == null || this..trim().length() == 0))
                    this.getClass().getCanonicalName()));
    }
    @Override
    public Recovery getRecovery() {
        return ;
    }

    
Set the xaDataSourceClass.

Parameters:
xaDataSourceClass The xaDataSourceClass to set.
    public final void forceXaDataSourceClass(String xaDataSourceClass) {
        this. = xaDataSourceClass;
    }
    public final XaDataSource getUnModifiableInstance() throws ValidateException {
        return new XADataSourceImpl(,
                ,
                ,
                ,
                );
    }
New to GrepCode? Check out our FAQ X