Examples of FileSystem


Examples of com.knowgate.dfs.FileSystem

     throw new NoSuchFieldException ("Cannot find luceneindex property");

     sDirectory = Gadgets.chomp(sDirectory, File.separator) + DB.k_bugs + File.separator + sWorkArea;
     File oDir = new File(sDirectory);
     if (!oDir.exists()) {
       FileSystem oFS = new FileSystem();
       try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
    }  // fi

    Class oAnalyzer = Class.forName(oProps.getProperty("analyzer" , DEFAULT_ANALYZER));

    IndexWriter oIWrt = new IndexWriter(sDirectory, (Analyzer) oAnalyzer.newInstance(), true);
View Full Code Here

Examples of com.knowgate.dfs.FileSystem

      throw new NoSuchFieldException ("Cannot find luceneindex property");

    sDirectory = Gadgets.chomp(sDirectory, File.separator) + sTableName.toLowerCase() + File.separator + sWorkArea;
    File oDir = new File(sDirectory);
    if (!oDir.exists()) {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
    }

    Class oAnalyzer = Class.forName(oProps.getProperty("analyzer" , DEFAULT_ANALYZER));

    HashMap oKeys = new HashMap(11);
View Full Code Here

Examples of com.knowgate.dfs.FileSystem

      throw new NoSuchFieldException ("Cannot find luceneindex property");

    sDirectory = Gadgets.chomp(sDirectory, File.separator) + sTableName.toLowerCase() + File.separator + sWorkArea;
    File oDir = new File(sDirectory);
    if (!oDir.exists()) {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
    } // fi

    IndexReader oReader = IndexReader.open(sDirectory);

    int iDeleted = oReader.deleteDocuments(new Term("guid", sGuid));
View Full Code Here

Examples of com.knowgate.dfs.FileSystem

    if (null!=url.getFile()) {
      File oDir = new File(url.getFile());

      if (!oDir.exists()) {
        FileSystem oFS = new FileSystem();
        try {
          oFS.mkdirs(url.getFile());
        } catch (Exception e) {
          if (DebugFile.trace) DebugFile.writeln(e.getClass().getName() + " " + e.getMessage());
          throw new MessagingException(e.getMessage(), e);
        }
      }
View Full Code Here

Examples of com.knowgate.dfs.FileSystem

    final long lRefreshEvery = 60000l// 1 minute

    ByteArrayInputStream oInStream;
    ByteArrayOutputStream oOutStream;

    FileSystem oFS = new FileSystem(FileSystem.OS_PUREJAVA);
    String sOutput;
    String sDomainId = req.getProperty("domain");
    String sWorkAreaId = req.getProperty("workarea");
    String sUserId = req.getProperty("user");
    String sMailAccount = req.getProperty("account");
    String sZone = req.getProperty("zone");
    String sLang = req.getProperty("language");
    String sTemplatePath = req.getProperty("template");
    String sStorage = req.getProperty("storage");
    String sFileDir = "file://" + sStorage + "domains" + File.separator + sDomainId + File.separator + "workareas" + File.separator + sWorkAreaId + File.separator + "cache" + File.separator + sUserId;
    String sCachedFile = "newmails_" + req.getWindowState().toString() + ".xhtm";

    boolean bFetch;

    File oCached = new File(sFileDir.substring(7)+File.separator+sCachedFile);

    if (!oCached.exists()) {
      bFetch = true;
      try {
        oFS.mkdirs(sFileDir);
      } catch (Exception xcpt) {
        throw new PortletException(xcpt.getMessage(), xcpt);
      }
    } else {
      bFetch = (new Date().getTime()-oCached.lastModified()>lRefreshEvery);
    }
     
  if (bFetch) {

      String sXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><?xml-stylesheet type=\"text/xsl\"?>\n<folder account=\""+(null==sMailAccount ? "" : sMailAccount)+"\" name=\"inbox\">";
   
      if (req.getWindowState().equals(WindowState.MINIMIZED) || null==sMailAccount) {
        sXML += "<messages total=\"0\" skip=\"0\"/></folder>";
      } else {
        JDCConnection oCon = null;
        try {
       
        SessionHandler oHnr;

          DBBind oDBB = (DBBind) getPortletContext().getAttribute("GlobalDBBind");
       
        oCon = oDBB.getConnection("NewMail");
       
        MailAccount oMacc = new MailAccount(oCon, sMailAccount);
       
        if (oMacc.load(oCon, sMailAccount))
          oHnr = new SessionHandler(oMacc);
      else
        oHnr = null;

      oCon.close("NewMail");
      oCon=null;
     
      if (null!=oHnr) {
        String[] aRecentXML = oHnr.listRecentMessages("INBOX", iMaxNew);
          if (null!=aRecentXML) {
          int nRecentXML = aRecentXML.length;
          sXML += "<messages total=\""+String.valueOf(nRecentXML)+"\" skip=\"0\">";
          for (int r=0; r<nRecentXML; r++)
              sXML += aRecentXML[r];
            sXML += "</messages>";
          } else {
            sXML += "<messages total=\"0\" skip=\"0\"/>";
          }// fi
      } else {
         if (DebugFile.trace) {
             DebugFile.writeln("Mail Account "+sMailAccount+" not found");
         }
          sXML += "<messages total=\"0\" skip=\"0\" />";
      }
        } catch (SQLException sqle) {
          if (oCon!=null) { try { oCon.close("NewMail"); oCon=null; } catch (SQLException ignore) {} }
          throw new PortletException(sqle.getMessage(), sqle);
        } catch (AuthenticationFailedException afe) {
          if (oCon!=null) { try { oCon.close("NewMail"); oCon=null; } catch (SQLException ignore) {} }
          throw new PortletException(afe.getMessage(), afe);
        } catch (NoSuchProviderException nspe) {
          if (oCon!=null) { try { oCon.close("NewMail"); oCon=null; } catch (SQLException ignore) {} }
          throw new PortletException(nspe.getMessage(), nspe);
        } catch (MessagingException jmme) {
          if (oCon!=null) { try { oCon.close("NewMail"); oCon=null; } catch (SQLException ignore) {} }
          throw new PortletException(jmme.getMessage(), jmme);
        }
        sXML += "</folder>";
      } // fi

    DebugFile.writeln(sXML);

      try {
       if (DebugFile.trace) DebugFile.writeln("new ByteArrayInputStream(" + String.valueOf(sXML.length()) + ")");

       if (sEncoding==null)
         oInStream = new ByteArrayInputStream(sXML.getBytes());
       else
         oInStream = new ByteArrayInputStream(sXML.getBytes(sEncoding));

       oOutStream = new ByteArrayOutputStream(4000);

       Properties oProps = new Properties();

       Enumeration oKeys = req.getPropertyNames();
       while (oKeys.hasMoreElements()) {
         String sKey = (String) oKeys.nextElement();
         oProps.setProperty(sKey, req.getProperty(sKey));
       } // wend

       if (req.getWindowState().equals(WindowState.MINIMIZED))
         oProps.setProperty("windowstate", "MINIMIZED");
       else
         oProps.setProperty("windowstate", "NORMAL");

       StylesheetCache.transform (sTemplatePath, oInStream, oOutStream, oProps);

       if (sEncoding==null)
         sOutput = oOutStream.toString();
       else
         sOutput = oOutStream.toString("UTF-8");

       oOutStream.close();

       oInStream.close();
       oInStream = null;

       oFS.writefilestr (sFileDir+File.separator+sCachedFile, sOutput, sEncoding==null ? "ISO8859_1" : sEncoding);
      }
      catch (TransformerConfigurationException tce) {
       if (DebugFile.trace) {
         DebugFile.writeln("TransformerConfigurationException " + tce.getMessageAndLocation());
         try {
           DebugFile.write("--------------------------------------------------------------------------------\n");
           DebugFile.write(FileSystem.readfile(sTemplatePath));
           DebugFile.write("\n--------------------------------------------------------------------------------\n");
           DebugFile.write(sXML);
           DebugFile.write("\n--------------------------------------------------------------------------------\n");
         }
         catch (java.io.IOException ignore) { }
         catch (com.enterprisedt.net.ftp.FTPException ignore) { }

         DebugFile.decIdent();
       }
       throw new PortletException("TransformerConfigurationException " + tce.getMessage(), tce);
      }
      catch (TransformerException tex) {
       if (DebugFile.trace) {
         DebugFile.writeln("TransformerException " + tex.getMessageAndLocation());

         try {
           DebugFile.write("--------------------------------------------------------------------------------\n");
           DebugFile.write(FileSystem.readfile(sTemplatePath));
           DebugFile.write("\n--------------------------------------------------------------------------------\n");
           DebugFile.write(sXML);
           DebugFile.write("\n--------------------------------------------------------------------------------\n");
         }
         catch (java.io.IOException ignore) { }
         catch (com.enterprisedt.net.ftp.FTPException ignore) { }

         DebugFile.decIdent();
       }
       throw new PortletException("TransformerException " + tex.getMessage(), tex);
      }
  } else {
      try {
        sOutput = new String(oFS.readfile(sFileDir+File.separator+sCachedFile, sEncoding==null ? "ISO8859_1" : sEncoding));
      } catch (Exception xcpt) {
        throw new PortletException(xcpt.getClass().getName()+" "+xcpt.getMessage(), xcpt);
      }
  } // fi (bFetch)
 
View Full Code Here

Examples of com.knowgate.dfs.FileSystem

          int iDeleted = oReader.deleteDocuments(new Term("workarea", sWorkArea));
          oReader.close();
        }
      }
    } else {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
    }
    // *********************************************************************

    if (DebugFile.trace) DebugFile.writeln("new IndexWriter("+sDirectory+",[Analyzer], true)");

View Full Code Here

Examples of com.knowgate.dfs.FileSystem

    if (null==sDirectory)
      throw new NoSuchFieldException ("Cannot find luceneindex property");

    File oDir = new File(sDirectory);
    if (!oDir.exists()) {
      FileSystem oFS = new FileSystem();
      try { oFS.mkdirs(sDirectory); } catch (Exception e) { throw new IOException(e.getClass().getName()+" "+e.getMessage()); }
    }

    Class oAnalyzer = Class.forName((sAnalyzer==null) ? DEFAULT_ANALYZER : sAnalyzer);

    IndexWriter oIWrt = new IndexWriter(sDirectory, (Analyzer) oAnalyzer.newInstance(), true);
View Full Code Here

Examples of com.mozilla.bespin.FileSystem

    protected boolean isAuthenticated() {
        return getCtx().getReq().getSession(true).getAttribute("userSession") != null;
    }

    protected synchronized FileSystem getFilesystem() throws IOException {
        FileSystem filesys = (FileSystem) getCtx().getServletContext().getAttribute(KEY_FILESYSTEM);
        if (filesys == null) {
            createFileSystemAndSessionTracker();
            filesys = (FileSystem) getCtx().getServletContext().getAttribute(KEY_FILESYSTEM);
        }
        return filesys;
View Full Code Here

Examples of com.mozilla.grouperfish.services.api.FileSystem

    }

    @Override
    protected void configure() {

        final FileSystem localFs = new LocalFileSystem("./data/local/");

        bind(FileSystem.class).annotatedWith(Local.class).toInstance(localFs);
        bind(FileSystem.class).toInstance(localFs);
        if (hasHadoop(properties)) {
            log.info("Hadoop available. Using HDFS for shared file system.");
View Full Code Here

Examples of com.vexus2.cakestorm.lib.FileSystem

    IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (view != null) {
      this.directory = view.getOrChooseDirectory();
    }

    this.fileSystem = new FileSystem(currentFile, e.getDataContext());
    this.fileSystem.setProject(e.getProject());
    directorySystem = new DirectorySystem(e.getProject(), currentFile, fileSystem.getIdentifier());
    directorySystem.setAppPath(fileSystem.getAppFile(currentFile));
    this.fileSystem.setProject(e.getProject());
    this.fileSystem.setDirectorySystem(directorySystem);
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.