Examples of SystemFile


Examples of ca.carleton.gcrc.olkit.multimedia.file.SystemFile

  public FileConversionMetaData getFileMetaData(File file) {
   
    FileConversionMetaData result = new FileConversionMetaData();
   
    try {
      SystemFile sf = SystemFile.getSystemFile(file);
      String mimeType = sf.getMimeType();
      String mimeEncoding = sf.getMimeEncoding();
 
      // Is it a known MIME type?
      MultimediaClass aClass = MimeUtils.getMultimediaClassFromMimeType(sf.getMimeType());
      if( MultimediaClass.AUDIO == aClass
       || MultimediaClass.VIDEO == aClass
       || MultimediaClass.IMAGE == aClass
       ) {
        String fileClass = aClass.getValue();
View Full Code Here

Examples of ca.carleton.gcrc.olkit.multimedia.file.SystemFile

    }

    // Report converted object
    {
      File convertedFile = request.getOutFile();
      SystemFile convertedSf = SystemFile.getSystemFile(convertedFile);

      if( CouchNunaliitUtils.hasVetterRole(submitter, atlasName) ) {
        attDescription.setStatus(UploadConstants.UPLOAD_STATUS_APPROVED);
      } else {
        attDescription.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
      }
      attDescription.setConversionPerformed(request.isConversionPerformed());
      attDescription.setMediaFileName(convertedFile.getName());
      attDescription.setSize(convertedFile.length());
      attDescription.setContentType(convertedSf.getMimeType());
      attDescription.setEncodingType(convertedSf.getMimeEncoding());
      if( request.getOutHeight() != 0 && request.getOutWidth() != 0 ) {
        attDescription.setHeight(request.getOutHeight());
        attDescription.setWidth(request.getOutWidth());
      }
     
      ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
      serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
    }

    // Report thumbnail object
    if( request.isThumbnailCreated() ) {
      File thumbFile = request.getThumbnailFile();
      SystemFile thumbSf = SystemFile.getSystemFile(thumbFile);
     
      String thumbnailAttachmentName = computeThumbnailName(attDescription.getAttachmentName());
      AttachmentDescriptor thumbnailObj = conversionContext.getAttachmentDescription(thumbnailAttachmentName);

      if( CouchNunaliitUtils.hasVetterRole(submitter, atlasName) ) {
        thumbnailObj.setStatus(UploadConstants.UPLOAD_STATUS_APPROVED);
      } else {
        thumbnailObj.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
      }
      thumbnailObj.setFileClass("image");
      thumbnailObj.setOriginalName(attDescription.getOriginalName());
      thumbnailObj.setMediaFileName(thumbFile.getName());
      thumbnailObj.setSource(attDescription.getAttachmentName());

      thumbnailObj.setSize(thumbFile.length());
      thumbnailObj.setContentType(thumbSf.getMimeType());
      thumbnailObj.setEncodingType(thumbSf.getMimeEncoding());

      if( request.getThumbnailHeight() != 0 && request.getThumbnailWidth() != 0 ) {
        thumbnailObj.setHeight(request.getThumbnailHeight());
        thumbnailObj.setWidth(request.getThumbnailWidth());
      }
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

  public Object coerce(Object original, Class target) {
    if (original instanceof CharSequence) {
      String url = String.valueOf( original );
      if (url.startsWith("file:/")) {
        return url.endsWith("/") || IVirtualDirectory.class.isAssignableFrom(target) ? new SystemDirectory( url.substring(6) ) : new SystemFile( url.substring(6) );
      } else if (url.startsWith(VirtualArtifactSystem.VAS_PROTOCOL + ":")) {
        String host = url.split(":")[1];
        String path = url.substring((VirtualArtifactSystem.VAS_PROTOCOL + ":" + host + ":").length());
        VirtualArtifactSystem vas = VirtualArtifactSystem.get(host, true);
        return url.endsWith("/") ? vas.getDirectory(new SimplePath(path), true) : vas.getFile(new SimplePath(path), true);
      } else {
        return url.endsWith("/") || IVirtualDirectory.class.isAssignableFrom(target) ? new SystemDirectory(url) : new SystemFile(url);
      }
    } else if (original instanceof IVirtualArtifact) {
      String url = ((IVirtualArtifact)original).getURL().toExternalForm();
      if (original instanceof IVirtualDirectory && !url.endsWith("/")) url += "/";
     
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

     
      if ( urlPath.startsWith("file:") ) urlPath = urlPath.substring(5);
      if ( urlPath.indexOf('!')>0 ) urlPath = urlPath.substring(0, urlPath.indexOf('!'));
     
      File file = new File(urlPath);
      return file.isDirectory() ? new SystemDirectory(file) : new ZippedDirectory(new SystemFile(file));
    } catch (UnsupportedEncodingException e) {
      throw ThrowableManagerRegistry.caught(e);
    }
  }
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

  /**
   * @param artifact The artifact in question
   * @return A {@link SystemFile} or a {@link SystemDirectory} wrapper depending on the type of the file
   */
  public static ISystemArtifact getSystemArtifact (File artifact) {
    return artifact.isFile() ? new SystemFile(artifact) : new SystemDirectory(artifact);
  }
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

 
  /**
   * @param file The file for which a {@link ISystemArtifact} is desired
   * @return A valid system artifact wrapper
   */
  public static ISystemArtifact toSystem (File file) { return file.isDirectory() ? new SystemDirectory(file) : new SystemFile(file); }
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

  public Object execute(GroovyCLIContext ctx, CommandLineArgumentsStandard arguments) {
    PassedArgument arg = arguments.getArgument(0);
   
    String filename = (String) arg.getValue();
    SystemFile file = new SystemFile(filename);
   
    if (file.isExists()) {
      try {
        Class clazz = compiler.parseClass(file.getInputStream());
        if (Script.class.isAssignableFrom(clazz)) {
          Script script = (Script) ReflectionUtil.newInstance(clazz, new Class[] { Binding.class }, ctx.getUI().getDomain());
          return script.run();
        } else {
          ctx.getUI().error("File is not a script: " + filename + ": " + clazz, null);
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

    public void setOptional(boolean optional) { this.optional = optional; }
   
    public String getSystemPath() { return systemPath; }
    public void setSystemPath(String systemPath) { this.systemPath = systemPath; }
   
    public ISystemArtifact getSystemArtifact() { return this.isSystemReference() ? new SystemFile(systemPath) : null; }
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

    IVirtualArtifact va = VirtualArtifactSystem.getArtifactFor(url);
    if (va == null) {
      if (url.getProtocol().equals("jar")) {
        String path = url.getPath();
        if (path.startsWith("file://")) path = path.substring(7);
        va = new ZippedDirectory(new SystemFile(path));
      } else if (url.getProtocol().equals("file")) {
        String path = url.getPath();
        File target = new File(path);
        if (target.isDirectory()) {
          va = new SystemDirectory(target);
        } else {
          if (ArchiveUtil.isArchive(target)) {
            va = new ZippedDirectory(new SystemFile(target));
          }
        }
      }
    } else {
      if (va instanceof VirtualArtifactWrapped) {
View Full Code Here

Examples of net.sourceforge.javautil.common.io.impl.SystemFile

    } catch (IOException e) {
      throw ThrowableManagerRegistry.caught(new RuntimeException(url.toExternalForm(), e));
    }
  }
 
  @Override public IVirtualArtifact getVirtualArtifact() { return new SystemFile(file); }
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.