Examples of FileObject


Examples of com.alibaba.antx.util.FileObject

            return new EarExpanderHandler(url);
        }
    }

    private String getPathRelativeToDestdir(File file) {
        return new FileObject(destdir).newFileObject(file).getRelativePath();
    }
View Full Code Here

Examples of com.dragome.compiler.utils.FileObject

    //  }
  }

  private void pipeFileToStream(Writer writer, String relativeFilePath) throws IOException
  {
    FileObject fileObject= DragomeJsCompiler.compiler.fileManager.getFileForInput(relativeFilePath);
    String content;
    if (DragomeJsCompiler.compiler.isCompression())
    {
      JavaScriptCompressor compressor= new JavaScriptCompressor();
      content= compressor.compress(fileObject.openInputStream());
    }
    else
    {
      content= IOUtils.toString(fileObject.openInputStream());
    }
    writer.write(content);

    fileObject.close();
  }
View Full Code Here

Examples of com.orange.wink.util.FileObject

          lt.setLineStart(scope.getLineStart());
        }
      }

      if (!lt.isVirtual()) {
        FileObject fo = null;
        WinkJsFile jf = null;
        String ltSource;
        int linesSize = -1;

        try {
          if (Constants.optimDontKeepJsFile) {
            fo = FileManager.getFileObject(sourceName);
            if ((lt.getLineEnd() == -1)) {
              linesSize = fo.getLines().size();
            }
          } else {
            jf = getJsFile(sourceName);
            if ((lt.getLineEnd() == -1)) {
              linesSize = jf.getLines().size();
            }
          }

          final int lns = (lt.getLineStart() == -1) ? 1 : lt.getLineStart();
          final int lne = (lt.getLineEnd() == -1) ? linesSize : lt.getLineEnd();

          if (Constants.optimDontKeepJsFile) {
            ltSource = fo.getLinesAsString(lns, lne);
          } else {
            ltSource = jf.getLinesAsString(lns, lne);
          }

          ParserUtils.updateLiteralLines(lt, ltSource, lns);
          if (lt.getLineStart() == -1 || lt.getLineEnd() == -1) {
            throw new WinkParseException("Bad literal lines [" + lt.getNamespace() + "] identified (L:" + lt.getLineStart() + ", " + lt.getLineEnd() + ")");
          }

          String las;
          if (Constants.optimDontKeepJsFile) {
            las = fo.getLinesAsString(lt.getLineStart(), lt.getLineEnd());
          } else {
            las = jf.getLinesAsString(lt.getLineStart(), lt.getLineEnd());
          }
          ParserUtils.updateLiteralChars(lt, las);
        } catch (final IOException e) {
View Full Code Here

Examples of eu.planets_project.pp.plato.services.crib_integration.remoteclient.FileObject

        try {
            // all migration actions are done via the metaconverter
            metaconverterService = metaconverterServiceLocator.getMetaconverter();

            // prepare the data of the sample record for migration
            FileObject sampleFile = new FileObject(sampleObject.getData().getData(), sampleObject.getFullname());
            RepresentationObject representationObject = new RepresentationObject(new FileObject[]{sampleFile});

            // the action parameters specify which migration service is called
            MigrationPath migrationPath = new MigrationPath();
            LinkedList<String> urls = new LinkedList<String>();
View Full Code Here

Examples of eu.planets_project.pp.plato.services.crib_integration.tu_client.FileObject

     * Migrates sample record <code>sampleObject</code>  with the migration action  defined in <code>action</code>.
     * 
     */
    public boolean perform(PreservationActionDefinition action, SampleObject sampleObject) throws PlatoServiceException {
        try {
            FileObject sampleFile = new FileObject(sampleObject.getData().getData(), sampleObject.getFullname());
            RepresentationObject representationObject = new RepresentationObject(new FileObject[]{sampleFile});
            LinkedList<String> urls = new LinkedList<String>();
            for (Parameter param : action.getParams()) {
                if (param.getName().startsWith("crib::location")) {
                    urls.add(param.getValue());
View Full Code Here

Examples of javax.tools.FileObject

    String pkg = getPackage( resource );
    String name = getRelativeName( resource );
    InputStream ormStream;
    try {
      FileObject fileObject = context.getProcessingEnvironment()
          .getFiler()
          .getResource( StandardLocation.CLASS_OUTPUT, pkg, name );
      ormStream = fileObject.openInputStream();
    }
    catch ( IOException e1 ) {
      // TODO - METAGEN-12
      // unfortunately, the Filer.getResource API seems not to be able to load from /META-INF. One gets a
      // FilerException with the message with "Illegal name /META-INF". This means that we have to revert to
View Full Code Here

Examples of net.paoding.rose.scanning.vfs.FileObject

                urlString = ResourceUtils.URL_PROTOCOL_JAR + ":" + resourceFile.toURI()
                        + ResourceUtils.JAR_URL_SEPARATOR;
            } else {
                urlString = resourceFile.toURI().toString();
            }
            FileObject rootObject = fileSystem.resolveFile(urlString);
            if (rootObject == null || !rootObject.exists()) {
                if (logger.isDebugEnabled()) {
                    logger.debug("[moduleResource] Ignored because not exists: " + urlString);
                }
                continue;
            }
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

            String fullPath = fo.getURL().toString();
            int pos = fullPath.indexOf("?");
            if (pos != -1) {
                fullPath = fullPath.substring(0, pos);
            }
            FileObject lockObject = fsManager.resolveFile(fullPath + ".lock");
            if (lockObject.exists()) {
                log.debug("There seems to be an external lock, aborting the processing of the file "
                        + fo.getName() + ". This could possibly be due to some other party already "
                        + "processing this file or the file is still being uploaded");
            } else {

                // write a lock file before starting of the processing, to ensure that the
                // item is not processed by any other parties
                lockObject.createFile();
                OutputStream stream = lockObject.getContent().getOutputStream();
                try {
                    stream.write(lockValue);
                    stream.flush();
                    stream.close();
                } catch (IOException e) {
                    lockObject.delete();
                    log.error("Couldn't create the lock file before processing the file "
                            + fullPath, e);
                    return false;
                } finally {
                    lockObject.close();
                }

                // check whether the lock is in place and is it me who holds the lock. This is
                // required because it is possible to write the lock file simultaneously by
                // two processing parties. It checks whether the lock file content is the same
                // as the written random lock value.
                // NOTE: this may not be optimal but is sub optimal
                FileObject verifyingLockObject = fsManager.resolveFile(
                        fullPath + ".lock");
                if (verifyingLockObject.exists() && verifyLock(lockValue, verifyingLockObject)) {
                    return true;
                }
            }
        } catch (FileSystemException fse) {
            log.error("Cannot get the lock for the file : " + maskURLPassword(fo.getName().getURI())
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

     * @param fsManager which is used to resolve the processed file
     * @param fo representing the processed file
     */
    public static void releaseLock(FileSystemManager fsManager, FileObject fo) {
        try {
            FileObject lockObject = fsManager.resolveFile(fo.getURL().toString() + ".lock");
            if (lockObject.exists()) {
                lockObject.delete();
            }
        } catch (FileSystemException e) {
            log.error("Couldn't release the lock for the file : "
                    + fo.getName() + " after processing");
        }
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

    _work = VFS.getManager().resolveFile(workDir.getAbsolutePath());
    _workDir = workDir;
  }
 
  public File getResourceAsFile(String path) throws IOException {
    FileObject unpackedResource = _work.resolveFile(path);
    if (!unpackedResource.exists()) {
      FileObject sourceFile = _source.resolveFile(path);
      sourceFile.copyFrom(unpackedResource, new FileSelector() {

        public boolean includeFile(FileSelectInfo arg0) throws Exception {
          return true;
        }
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.