Package railo.runtime.db

Examples of railo.runtime.db.DataSource


        boolean verify=getBoolV("verify",true);
        Struct custom=getStruct("custom",new StructImpl());
      String dbdriver = getString("dbdriver", "");
       
        //config.getDatasourceConnectionPool().remove(name);
        DataSource ds=null;
    try {
      ds = new DataSourceImpl(name,classname,host,dsn,database,port,username,password,connLimit,connTimeout,metaCacheTimeout,blob,clob,allow,custom,false,validate,storage,null, dbdriver);
    } catch (ClassException e) {
      throw new DatabaseException(
          "can't find class ["+classname+"] for jdbc driver, check if driver (jar file) is inside lib folder ("+e.getMessage()+")",null,null,null);
    }
       
        if(verify)_doVerifyDatasource(classname,ds.getDsnTranslated(),username,password);
        //print.out("limit:"+connLimit);
        admin.updateDataSource(
            name,
            newName,
                classname,
View Full Code Here


        Iterator it = ds.keySet().iterator();
       
        while(it.hasNext()) {
            String key=(String)it.next();
            if(key.equalsIgnoreCase(name)) {
                DataSource d=(DataSource) ds.get(key);
                Struct sct=new StructImpl();
               
                sct.setEL(KeyConstants._name,key);
                sct.setEL(KeyConstants._host,d.getHost());
                sct.setEL("classname",d.getClazz().getName());
                sct.setEL("dsn",d.getDsnOriginal());
                sct.setEL("database",d.getDatabase());
                sct.setEL("port",d.getPort()<1?"":Caster.toString(d.getPort()));
                sct.setEL("dsnTranslated",d.getDsnTranslated());
                sct.setEL("timezone",toStringTimeZone(d.getTimeZone()));
                sct.setEL("password",d.getPassword());
                sct.setEL("passwordEncrypted",ConfigWebFactory.encrypt(d.getPassword()));
                sct.setEL("username",d.getUsername());
                sct.setEL("readonly",Caster.toBoolean(d.isReadOnly()));
                sct.setEL("select",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_SELECT)));
                sct.setEL("delete",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DELETE)));
                sct.setEL("update",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_UPDATE)));
                sct.setEL("insert",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_INSERT)));
                sct.setEL("create",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_CREATE)));
                sct.setEL("insert",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_INSERT)));
                sct.setEL("drop",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DROP)));
                sct.setEL("grant",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_GRANT)));
                sct.setEL("revoke",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_REVOKE)));
                sct.setEL("alter",Boolean.valueOf(d.hasAllow(DataSource.ALLOW_ALTER)));
   
                sct.setEL("connectionLimit",d.getConnectionLimit()<1?"":Caster.toString(d.getConnectionLimit()));
                sct.setEL("connectionTimeout",d.getConnectionTimeout()<1?"":Caster.toString(d.getConnectionTimeout()));
                sct.setEL("metaCacheTimeout",Caster.toDouble(d.getMetaCacheTimeout()));
                sct.setEL("custom",d.getCustoms());
                sct.setEL("blob",Boolean.valueOf(d.isBlob()));
                sct.setEL("clob",Boolean.valueOf(d.isClob()));
                sct.setEL("validate",Boolean.valueOf(d.validate()));
                sct.setEL("storage",Boolean.valueOf(d.isStorage()));

              if (d instanceof DataSourceImpl) {

                sct.setEL("dbdriver", Caster.toString( ((DataSourceImpl)d).getDbDriver(), "" ));
              }
View Full Code Here

       
        int row=0;

        while(it.hasNext()) {
            Object key=it.next();
            DataSource d=(DataSource) ds.get(key);
            row++;
            qry.setAt(KeyConstants._name,row,key);
            qry.setAt(KeyConstants._host,row,d.getHost());
            qry.setAt("classname",row,d.getClazz().getName());
            //qry.setAt("driverversion",row,getDriverVersion(d.getClazz()));
            qry.setAt("dsn",row,d.getDsnOriginal());
            qry.setAt("database",row,d.getDatabase());
            qry.setAt(KeyConstants._port,row,d.getPort()<1?"":Caster.toString(d.getPort()));
            qry.setAt("dsnTranslated",row,d.getDsnTranslated());
            qry.setAt("timezone",row,toStringTimeZone(d.getTimeZone()));
            qry.setAt(KeyConstants._password,row,d.getPassword());
            qry.setAt(KeyConstants._username,row,d.getUsername());
            qry.setAt(KeyConstants._readonly,row,Caster.toBoolean(d.isReadOnly()));
            qry.setAt(KeyConstants._select,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_SELECT)));
            qry.setAt(KeyConstants._delete,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DELETE)));
            qry.setAt(KeyConstants._update,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_UPDATE)));
            qry.setAt(KeyConstants._create,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_CREATE)));
            qry.setAt(KeyConstants._insert,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_INSERT)));
            qry.setAt(KeyConstants._drop,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_DROP)));
            qry.setAt(KeyConstants._grant,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_GRANT)));
            qry.setAt(KeyConstants._revoke,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_REVOKE)));
            qry.setAt(KeyConstants._alter,row,Boolean.valueOf(d.hasAllow(DataSource.ALLOW_ALTER)));

            qry.setAt("connectionLimit",row,d.getConnectionLimit()<1?"":Caster.toString(d.getConnectionLimit()));
            qry.setAt("connectionTimeout",row,d.getConnectionTimeout()<1?"":Caster.toString(d.getConnectionTimeout()));
            qry.setAt("customSettings",row,d.getCustoms());
            qry.setAt("blob",row,Boolean.valueOf(d.isBlob()));
            qry.setAt("clob",row,Boolean.valueOf(d.isClob()));
            qry.setAt("validate",row,Boolean.valueOf(d.validate()));
            qry.setAt("storage",row,Boolean.valueOf(d.isStorage()));
           
        }
        pageContext.setVariable(getString("admin",action,"returnVariable"),qry);
    }
View Full Code Here

    this.useComponentShadow = useComponentShadow;
  }
 
  @Override
  public DataSource getDataSource(String datasource) throws DatabaseException {
    DataSource ds=(datasource==null)?null:(DataSource) datasources.get(datasource.toLowerCase());
    if(ds!=null) return ds;
   
   
    // create error detail
    DatabaseException de = new DatabaseException("datasource ["+datasource+"] doesn't exist",null,null,null);
View Full Code Here

    throw de;
  }
 
  @Override
  public DataSource getDataSource(String datasource, DataSource defaultValue) {
    DataSource ds=(datasource==null)?null:(DataSource) datasources.get(datasource.toLowerCase());
    if(ds!=null) return ds;
    return defaultValue;
  }
View Full Code Here

          client=ClientCookie.getInstance(appContext.getName(),pc,getLog());
        else if("memory".equals(storage)){
          client=ClientMemory.getInstance(pc,getLog());
        }
        else{
          DataSource ds = ((PageContextImpl)pc).getDataSource(storage,null);
          if(ds!=null)client=ClientDatasource.getInstance(storage,pc,getLog());
          else client=ClientCache.getInstance(storage,appContext.getName(),pc,getLog(),null);
         
          if(client==null){
            // datasource not enabled for storage
View Full Code Here

        else if("file".equals(storage))
          return SessionFile.hasInstance(appContext.getName(),pc);
        else if("cookie".equals(storage))
          return SessionCookie.hasInstance(appContext.getName(),pc);
        else {
          DataSource ds = ((ConfigImpl)pc.getConfig()).getDataSource(storage,null);
          if(ds!=null && ds.isStorage()){
            if(SessionDatasource.hasInstance(storage,pc)) return true;
          }
          return  SessionCache.hasInstance(storage,appContext.getName(),pc);
        }
      }
View Full Code Here

          session=SessionFile.getInstance(appContext.getName(),pc,getLog());
        }
        else if("cookie".equals(storage))
          session=SessionCookie.getInstance(appContext.getName(),pc,getLog());
        else{
          DataSource ds = ((PageContextImpl)pc).getDataSource(storage,null);
          if(ds!=null && ds.isStorage())session=SessionDatasource.getInstance(storage,pc,getLog(),null);
          else session=SessionCache.getInstance(storage,appContext.getName(),pc,getLog(),null);
         
          if(session==null){
            // datasource not enabled for storage
            if(ds!=null)
View Full Code Here

    return defaultValue;
  }
 
  @Override
  public DataSource getDataSource(String dataSourceName) throws ApplicationException {
    DataSource source = getDataSource(dataSourceName,null);
    if(source==null)
      throw new ApplicationException("there is no datasource with name ["+dataSourceName+"]");
    return source;
  }
View Full Code Here

TOP

Related Classes of railo.runtime.db.DataSource

Copyright © 2018 www.massapicom. 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.