Examples of DbConfig


Examples of com.founder.fix.fixflow.core.impl.db.DbConfig

  protected void initDB2DbConfig() {
    DataBase dataBase = this.selectedDatabase;
    // OraclePaginationImpl
    Pagination pagination = (Pagination) ReflectUtil.instantiate(dataBase.getPaginationImpl());
    DbConfig dbConfig = new DbConfig();
    dbConfig.setDbType(DbType.ORACLE);
    dbConfig.setPagination(pagination);
    dbConfig.setKeyword("?");

    Map<String, String> map = new HashMap<String, String>();
    map.put("topOrderBy", " ");

    dbConfig.setDbSqlMap(map);

    this.dbConfig = dbConfig;
  }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.db.DbConfig

  protected void initOracleDbConfig() {
    DataBase dataBase = this.selectedDatabase;
    // OraclePaginationImpl
    Pagination pagination = (Pagination) ReflectUtil.instantiate(dataBase.getPaginationImpl());
    DbConfig dbConfig = new DbConfig();
    dbConfig.setDbType(DbType.ORACLE);
    dbConfig.setPagination(pagination);
    dbConfig.setKeyword("?");

    Map<String, String> map = new HashMap<String, String>();
    map.put("topOrderBy", " ");

    dbConfig.setDbSqlMap(map);

    this.dbConfig = dbConfig;
  }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.db.DbConfig

    DataBase dataBase = this.selectedDatabase;

    // OraclePaginationImpl
    Pagination pagination = (Pagination) ReflectUtil.instantiate(dataBase.getPaginationImpl());
    DbConfig dbConfig = new DbConfig();
    dbConfig.setDbType(DbType.SQLSERVER);
    dbConfig.setPagination(pagination);
    dbConfig.setKeyword("?");

    Map<String, String> map = new HashMap<String, String>();
    map.put("topOrderBy", " top 100 percent ");

    dbConfig.setDbSqlMap(map);

    this.dbConfig = dbConfig;
  }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.db.DbConfig

  protected void initMySqlDbConfig() {

    DataBase dataBase = this.selectedDatabase;
    // OraclePaginationImpl
    Pagination pagination = (Pagination) ReflectUtil.instantiate(dataBase.getPaginationImpl());
    DbConfig dbConfig = new DbConfig();
    dbConfig.setDbType(DbType.ORACLE);
    dbConfig.setPagination(pagination);
    dbConfig.setKeyword("?");

    Map<String, String> map = new HashMap<String, String>();
    map.put("topOrderBy", " ");

    dbConfig.setDbSqlMap(map);

    this.dbConfig = dbConfig;
  }
View Full Code Here

Examples of data.DBConfig

        this.config.load();
    }

    private void initDatabase( String dbConfigResource ) {
        DBConfig dbConfig = null;

        try {
            dbConfig = new DBConfig( dbConfigResource );
        } catch( FileNotFoundException e ) {
            // @TODO implement error handling
        }

        this.dbConnection = new DBConnection( dbConfig );
View Full Code Here

Examples of org.apache.stonehenge.stocktrader.config.xsd.DBConfig

        *                If this object is not an element, it is a complex type and the reader is at the event just after the outer start element
        * Postcondition: If this object is an element, the reader is positioned at its end element
        *                If this object is a complex type, the reader is positioned at the end element of its outer element
        */
        public static DBConfig parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{
            DBConfig object =
                new DBConfig();

            int event;
            java.lang.String nillableValue = null;
            java.lang.String prefix ="";
            java.lang.String namespaceuri ="";
            try {
               
                while (!reader.isStartElement() && !reader.isEndElement())
                    reader.next();

               
                if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type")!=null){
                  java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
                        "type");
                  if (fullTypeName!=null){
                    java.lang.String nsPrefix = null;
                    if (fullTypeName.indexOf(":") > -1){
                        nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
                    }
                    nsPrefix = nsPrefix==null?"":nsPrefix;

                    java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
                   
                            if (!"DBConfig".equals(type)){
                                //find namespace for the prefix
                                java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
                                return (DBConfig)org.apache.stonehenge.stocktrader.config.xsd.ExtensionMapper.getTypeObject(
                                     nsUri,type,reader);
                              }
                       

                  }
               

                }

               

               
                // Note all attributes that were handled. Used to differ normal attributes
                // from anyAttributes.
                java.util.Vector handledAttributes = new java.util.Vector();
               

                
                   
                    reader.next();
               
                                   
                                    while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
                               
                                    if (reader.isStartElement() && new javax.xml.namespace.QName("http://apache.org/stonehenge/stocktrader/xsd","DBName").equals(reader.getName())){
                               
                                    java.lang.String content = reader.getElementText();
                                   
                                              object.setDBName(
                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));
                                             
                                        reader.next();
                                   
                              // End of if for expected property start element
                               
                                else{
                                    // A start element we are not expecting indicates an invalid parameter was passed
                                    throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
                                }
                           
                                   
                                    while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
                               
                                    if (reader.isStartElement() && new javax.xml.namespace.QName("http://apache.org/stonehenge/stocktrader/xsd","DBHostName").equals(reader.getName())){
                               
                                    java.lang.String content = reader.getElementText();
                                   
                                              object.setDBHostName(
                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToAnyURI(content));
                                             
                                        reader.next();
                                   
                              // End of if for expected property start element
                               
                                else{
                                    // A start element we are not expecting indicates an invalid parameter was passed
                                    throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName());
                                }
                           
                                   
                                    while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
                               
                                    if (reader.isStartElement() && new javax.xml.namespace.QName("http://apache.org/stonehenge/stocktrader/xsd","DBPort").equals(reader.getName())){
                               
                                    java.lang.String content = reader.getElementText();
                                   
                                              object.setDBPort(
                                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToUnsignedInt(content));
                                             
                                        reader.next();
                                   
                              // End of if for expected property start element
View Full Code Here

Examples of org.mule.module.db.internal.domain.database.DbConfig

    @Override
    public MuleEvent process(MuleEvent muleEvent) throws MuleException
    {
        DbConnection connection = null;

        DbConfig dbConfig = dbConfigResolver.resolve(muleEvent);

        try
        {
            connection = dbConfig.getConnectionFactory().createConnection(transactionalAction);

            Object result = executeQuery(connection, muleEvent);

            if (mustCloseConnection())
            {
                try
                {
                    dbConfig.getConnectionFactory().releaseConnection(connection);
                }
                finally
                {
                    connection = null;
                }
            }

            if (target == null || "".equals(target) || "#[payload]".equals(target))
            {
                muleEvent.getMessage().setPayload(result);
            }
            else
            {
                muleContext.getExpressionManager().enrich(target, muleEvent, result);
            }

            return processNext(muleEvent);
        }
        catch (SQLException e)
        {
            throw new MessagingException(muleEvent, e);
        }
        finally
        {
            if (connection != null && mustCloseConnection())
            {
                dbConfig.getConnectionFactory().releaseConnection(connection);
            }
        }
    }
View Full Code Here

Examples of org.mule.module.db.internal.domain.database.DbConfig

    private Result<MetaData> getMetaDataResult(Query query, MetadataResolver metadataResolver)
    {
        DbConnection connection = null;

        DbConfig dbConfig = dbConfigResolver.resolve(null);

        try
        {
            try
            {
                connection = dbConfig.getConnectionFactory().createConnection(TransactionalAction.NOT_SUPPORTED);
            }
            catch (SQLException e)
            {
                return new DefaultResult<MetaData>(null, Result.Status.FAILURE, e.getMessage(), FailureType.CONNECTION_FAILURE, e);
            }

            PreparedStatement preparedStatement;
            try
            {
                preparedStatement = connection.prepareStatement(query.getQueryTemplate().getSqlText());
            }
            catch (SQLException e)
            {
                return new DefaultResult<MetaData>(null, Result.Status.FAILURE, e.getMessage(), FailureType.INVALID_CONFIGURATION, e);
            }

            return metadataResolver.resolveMetaData(preparedStatement, query);
        }
        finally
        {
            dbConfig.getConnectionFactory().releaseConnection(connection);
        }
    }
View Full Code Here

Examples of org.mule.module.db.internal.domain.database.DbConfig

    private final MuleEvent muleEvent = mock(MuleEvent.class);

    @Test
    public void resolvesDefaultDbConfig() throws Exception
    {
        DbConfig dbConfig = mock(DbConfig.class);

        MuleRegistry registry = mock(MuleRegistry.class);
        Collection<DbConfig> foundDbConfigs = new ArrayList<DbConfig>();
        foundDbConfigs.add(dbConfig);

        when(registry.lookupObjects(DbConfig.class)).thenReturn(foundDbConfigs);
        DefaultDbConfigResolver dbConfigResolver = new DefaultDbConfigResolver(registry);

        DbConfig resolvedDbConfig = dbConfigResolver.resolve(muleEvent);

        assertThat(dbConfig, sameInstance(resolvedDbConfig));
    }
View Full Code Here

Examples of org.mule.module.db.internal.domain.database.DbConfig

    }

    @Test
    public void throwsErrorWhenMultipleDbConfigAvailable() throws Exception
    {
        DbConfig dbConfig1 = mock(DbConfig.class);
        when(dbConfig1.getName()).thenReturn("dbConfig1");
        DbConfig dbConfig2 = mock(DbConfig.class);
        when(dbConfig2.getName()).thenReturn("dbConfig2");

        MuleRegistry registry = mock(MuleRegistry.class);
        Collection<DbConfig> foundDbConfigs = new ArrayList<DbConfig>();
        foundDbConfigs.add(dbConfig1);
        foundDbConfigs.add(dbConfig2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.