Package railo.commons.io.res

Examples of railo.commons.io.res.Resource


  public PDF(Config config) throws PageException {
    //this.isEvaluation=isEvaluation;
    try {
      //classLoader=new URLClassLoader(new URL[]{new File("/Users/mic/Downloads/java/pd4ml/fullversion/pd4ml.volume.310/lib/pd4ml.jar").toURL()},this.getClass().getClassLoader());
      if(classLoader==null) {
        Resource temp = config.getConfigDir().getRealResource("temp");
        Resource file=temp.getRealResource(Md5.getDigestAsString(Info.getVersionAsString())+".lmdp");
           
        if(!file.exists()){
          ResourceUtil.removeChildrenEL(temp, new ExtensionResourceFilter(".lmdp"));
         
              file.createFile(true);
              //print.out(new Info().getClass().getResource("/resource/lib/pd4ml.jar"));
              InputStream jar = new Info().getClass().getResourceAsStream("/resource/lib/pd4ml.jar");
            IOUtil.copy(jar, file,true);
            }
            ClassLoader parent = Version.class.getClassLoader();
View Full Code Here


    else if("JBossCache".equalsIgnoreCase(cacheProvider))   cacheProvider="org.hibernate.cache.TreeCacheProvider";
    else if("HashTable".equalsIgnoreCase(cacheProvider))   cacheProvider="org.hibernate.cache.HashtableCacheProvider";
    else if("SwarmCache".equalsIgnoreCase(cacheProvider))   cacheProvider="org.hibernate.cache.SwarmCacheProvider";
    else if("OSCache".equalsIgnoreCase(cacheProvider))     cacheProvider="org.hibernate.cache.OSCacheProvider";
 
    Resource cacheConfig = ormConf.getCacheConfig();
    Configuration configuration = new Configuration();
   
    // ormConfig
    Resource conf = ormConf.getOrmConfig();
    if(conf!=null){
      try {
        Document doc = CommonUtil.toDocument(conf);
        configuration.configure(doc);
      }
View Full Code Here

          throw ExceptionUtil.createException(data,null,it.next());
        }
  }

  private static void executeSQLScript(ORMConfiguration ormConf,DatasourceConnection dc) throws SQLException, IOException {
        Resource sqlScript = ormConf.getSqlScript();
        if(sqlScript!=null && sqlScript.isFile()) {
          BufferedReader br = CommonUtil.toBufferedReader(sqlScript,(Charset)null);
          String line;
            StringBuilder sql=new StringBuilder();
            String str;
            Statement stat = dc.getConnection().createStatement();
View Full Code Here

         
          // MUST still a bad solution
          PageSource ps = pc.toPageSource(res,null);
          if(ps==null || ps.getComponentName().indexOf("..")!=-1) {
            PageSource ps2=null;
            Resource root = cfclocation.getPhysical();
                    String path = ResourceUtil.getPathToChild(res, root);
                    if(!Util.isEmpty(path,true)) {
                      ps2=cfclocation.getPageSource(path);
                    }
                    if(ps2!=null)ps=ps2;
View Full Code Here

   
  }

  private static void saveMapping(ORMConfiguration ormConf, Component cfc, Element hm) {
    if(ormConf.saveMapping()){
      Resource res=cfc.getPageSource().getResource();
      if(res!=null){
        res=res.getParentResource().getRealResource(res.getName()+".hbm.xml");
        try{
        CommonUtil.write(res,
            XMLCaster.toString(hm,false,true,
                HibernateSessionFactory.HIBERNATE_3_PUBLIC_ID,
                HibernateSessionFactory.HIBERNATE_3_SYSTEM_ID,
View Full Code Here

    }
  }
 
  private static long loadMapping(StringBuilder sb,ORMConfiguration ormConf, Component cfc) {
   
    Resource res=cfc.getPageSource().getResource();
    if(res!=null){
      res=res.getParentResource().getRealResource(res.getName()+".hbm.xml");
      try{
        sb.append(CommonUtil.toString(res, CommonUtil.UTF8));
        return res.lastModified();
      }
      catch(Exception e){}
    }
    return 0;
  }
View Full Code Here

            else cfhttp.set(MIME_TYPE,mimetype);
          }
          else cfhttp.set(MIME_TYPE,NO_MIMETYPE);

      // File
          Resource file=null;
         
          if(strFile!=null && strPath!=null) {
              file=ResourceUtil.toResourceNotExisting(pageContext, strPath).getRealResource(strFile);
          }
          else if(strFile!=null) {
              file=ResourceUtil.toResourceNotExisting(pageContext, strFile);
          }
          else if(strPath!=null) {
              file=ResourceUtil.toResourceNotExisting(pageContext, strPath);
              //Resource dir = file.getParentResource();
              if(file.isDirectory()){
                file=file.getRealResource(httpMethod.getURI().getName());
              }
             
          }
          if(file!=null)pageContext.getConfig().getSecurityManager().checkFileLocation(file);
         
View Full Code Here

     * @return matching file
     */
    public static Resource getFile(Config config, Resource directory,String path, short type) {
      path=replacePlaceholder(path,config);
        if(!StringUtil.isEmpty(path,true)) {
            Resource file=getFile(directory.getRealResource(path),type);
            if(file!=null) return file;

            file=getFile(config.getResource(path),type);
           
            if(file!=null) return file;
View Full Code Here

     * @return file
   */
    static Resource getFile(Resource rootDir,String strDir, String defaultDir,Resource configDir, short type, ConfigImpl config)  {
      strDir=replacePlaceholder(strDir,config);
        if(!StringUtil.isEmpty(strDir,true)) {
          Resource res;
          if(strDir.indexOf("://")!=-1){ // TODO better impl.
            res=getFile(config.getResource(strDir),type);
            if(res!=null) return res;
          }
          res=getFile(rootDir.getRealResource(strDir),type);
            if(res!=null) return res;

            res=getFile(config.getResource(strDir),type);
            if(res!=null) return res;
        }
        if(defaultDir==null) return null;
        Resource file=getFile(configDir.getRealResource(defaultDir),type);
        return file;
    }
View Full Code Here

                else if(str.startsWith("-directory}",13)) str=checkResult(str,config.getConfigDir().getReal(str.substring(24)));
            }
           
           
            else if(config!=null && str.startsWith("{railo-server")) {
              Resource dir=config instanceof ConfigWeb?((ConfigWeb)config).getConfigServerDir():config.getConfigDir();
                //if(config instanceof ConfigServer && cs==null) cs=(ConfigServer) cw;
                if(dir!=null) {
                    if(str.startsWith("}",13)) str=checkResult(str,dir.getReal(str.substring(14)));
                    else if(str.startsWith("-dir}",13)) str=checkResult(str,dir.getReal(str.substring(18)));
                    else if(str.startsWith("-directory}",13)) str=checkResult(str,dir.getReal(str.substring(24)));
                }
            }
            // Config Web
            else if(str.startsWith("{railo-web")) {
                //if(cw instanceof ConfigServer) cw=null;
View Full Code Here

TOP

Related Classes of railo.commons.io.res.Resource

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.