Package railo.commons.io.res

Examples of railo.commons.io.res.Resource


    return accessCount;
  }

    @Override
    public Resource getResource() {
      Resource p = getPhyscalFile();
      Resource a = getArchiveFile();
      if(mapping.isPhysicalFirst()){
        if(a==null) return p;
          if(p==null) return a;
         
        if(p.exists()) return p;
        if(a.exists()) return a;
        return p;
      }
      if(p==null) return a;
      if(a==null) return p;
     
      if(a.exists()) return a;
      if(p.exists()) return p;
      return a;
     
      //return getArchiveFile();
    }
View Full Code Here


            if(log!=null)log.error(logName,e.getMessage());
            hasError=true;
        }
       
        // write file
        Resource file = task.getResource();
        if(!hasError && file!=null && task.isPublish()) {
          String n=file.getName();
          if(n.indexOf("{id}")!=-1){
            n=StringUtil.replace(n, "{id}",CreateUUID.invoke(), false)
            file=file.getParentResource().getRealResource(n);
          }
         
          if(isText(rsp) && task.isResolveURL()) {
           
              String str;
View Full Code Here

      //return getArchiveFile();
    }
   
    @Override
    public Resource getResourceTranslated(PageContext pc) throws ExpressionException {
      Resource res = null;
      if(!isLoad(LOAD_ARCHIVE)) res=getPhyscalFile();
     
      // there is no physical resource
    if(res==null){
          String path=getDisplayPath();
View Full Code Here

    return task;
  }

  private void store(SpoolerTask task) {
    ObjectOutputStream oos=null;
    Resource persis = getFile(task);
    if(persis.exists()) persis.delete();
        try {
          oos = new ObjectOutputStream(persis.getOutputStream());
          oos.writeObject(task);
        }
        catch (IOException e) {}
        finally {
          IOUtil.closeEL(oos);
View Full Code Here

          IOUtil.closeEL(oos);
        }
  }

  private void unstore(SpoolerTask task) {
    Resource persis = getFile(task);
    boolean exists=persis.exists();
    if(exists) persis.delete();
  }
View Full Code Here

    Resource persis = getFile(task);
    boolean exists=persis.exists();
    if(exists) persis.delete();
  }
  private Resource getFile(SpoolerTask task) {
    Resource dir = persisDirectory.getRealResource(task.closed()?"closed":"open");
    dir.mkdirs();
    return dir.getRealResource(task.getId()+".tsk");
  }
View Full Code Here

    dir.mkdirs();
    return dir.getRealResource(task.getId()+".tsk");
  }
 
  private String createId(SpoolerTask task) {
    Resource dir = persisDirectory.getRealResource(task.closed()?"closed":"open");
    dir.mkdirs();
   
    String id=null;
    do{
      id=StringUtil.addZeros(++count, 8);
    }while(dir.getRealResource(id+".tsk").exists());
    return id;
  }
View Full Code Here

  public byte[] compile(ConfigImpl config,PageSource source, TagLib[] tld, FunctionLib[] fld,
        Resource classRootDir, String className) throws TemplateException, IOException {
    //synchronized(source){
      //print.out("src:"+source.getDisplayPath());
        //print.dumpStack();
      Resource classFile=classRootDir.getRealResource(className+".class");
      Resource classFileDirectory=classFile.getParentResource();
          byte[] barr = null;
      Page page = null;
     
      if(!classFileDirectory.exists()) classFileDirectory.mkdirs();
     
          try {
            page = cfmlTransformer.transform(config,source,tld,fld);
            barr = page.execute(source,classFile);
        IOUtil.copy(new ByteArrayInputStream(barr), classFile,true);
View Full Code Here

      credentials+proxy+resolveURL+publish+hidden+readonly+paused;
      md5=Md5.getDigestAsString(md5);
      this.md5=md5;
       
        if(file!=null && file.toString().trim().length()>0) {
          Resource parent = file.getParentResource();
          if(parent==null || !parent.exists())
              throw new IOException("Directory for output file ["+file+"] doesn't exist");
          if(file.exists() && !file.isFile())
              throw new IOException("output file ["+file+"] is not a file");
        }
        if(timeout<1) {
View Full Code Here

     */
    private void doUpdate() throws PageException {
        String message="missing attribute for tag schedule with action update";
        String detail="required attributes are [startDate, startTime, URL, interval, operation]";
       
        Resource file=null;
        //if(publish) {
        if(!StringUtil.isEmpty(strFile) && !StringUtil.isEmpty(strPath)) {
          file=ResourceUtil.toResourceNotExisting(pageContext, strPath);
          file=file.getRealResource(strFile);
        }
        else if(!StringUtil.isEmpty(strFile)) {
            file=ResourceUtil.toResourceNotExisting(pageContext, strFile);
        }
        else if(!StringUtil.isEmpty(strPath)) {
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.