Package org.apache.commons.vfs

Examples of org.apache.commons.vfs.FileSystemManager

@author Adam Murdoch

{
  private final static int NUOF_RESOLVES = 100000;

  public static void main(String[] args) throws FileSystemException
  {
    FileSystemManager mgr = VFS.getManager();

    FileObject root = mgr
        .resolveFile("smb://HOME\\vfsusr:vfs%2f%25\\te:st@10.0.1.54/vfsusr");
    FileName rootName = root.getName();
 
    testNames(mgr, rootName);
View Full Code Here


        }
        for (int i = 0; i < args.length; i++)
        {
            try
            {
                FileSystemManager mgr = VFS.getManager();
                System.out.println();
                System.out.println("Parsing: " + args[i]);
                FileObject file = mgr.resolveFile(args[i]);
                System.out.println("URL: " + file.getURL());
                System.out.println("getName(): " + file.getName());
                System.out.println("BaseName: " + file.getName().getBaseName());
                System.out.println("Extension: " + file.getName().getExtension());
                System.out.println("Path: " + file.getName().getPath());
View Full Code Here

  public static String resolveSchema(final ResourceManager resourceManager,
                                     final ResourceKey contextKey,
                                     String catalogUrl)
      throws FileSystemException
  {
    final FileSystemManager fsManager = VFS.getManager();
    if (fsManager == null)
    {
      throw Util.newError("Cannot get virtual file system manager");
    }

    // Workaround VFS bug.
    if (catalogUrl.startsWith("file://localhost"))
    {
      catalogUrl = catalogUrl.substring("file://localhost".length());
    }
    if (catalogUrl.startsWith("file:"))
    {
      catalogUrl = catalogUrl.substring("file:".length());
    }

    try
    {
      final File catalogFile = new File(catalogUrl).getCanonicalFile();
      final FileObject file = fsManager.toFileObject(catalogFile);
      if (file.isReadable())
      {
        return catalogFile.getPath();
      }
    }
View Full Code Here

  public IContentItem getFileOutputContentItem() {

    String contentRef = getContentRef();
    try {
      String contentName = getHandlerId().substring( 4 ) + ":" + contentRef; //$NON-NLS-1$
      FileSystemManager fsManager = VFS.getManager();
      if ( fsManager == null ) {
        Logger.error( ApacheVFSOutputHandler.class.getName(), Messages.getInstance().getString(
          "ApacheVFSOutputHandler.ERROR_0001_CANNOT_GET_VFSMGR" ) ); //$NON-NLS-1$
        return null;
      }
      FileObject file = fsManager.resolveFile( contentName );
      if ( file == null ) {
        Logger.error( ApacheVFSOutputHandler.class.getName(), Messages.getInstance().getString(
            "ApacheVFSOutputHandler.ERROR_0002_CANNOT_GET_VF", contentName ) ); //$NON-NLS-1$
        return null;
      }
View Full Code Here

    return new ServletContextCatalogLocator( servletConfig.getServletContext() ) {
      @Override
      public String locate( String catalogPath ) {
        if ( catalogPath.startsWith( "mondrian:" ) ) { //$NON-NLS-1$
          try {
            FileSystemManager fsManager = VFS.getManager();
            SolutionRepositoryVfsFileObject catalog = (SolutionRepositoryVfsFileObject)
                fsManager.resolveFile( catalogPath );
            catalogPath = "solution:" + catalog.getFileRef();
          } catch ( FileSystemException e ) {
            logger.error( e.getMessage() );
          }
        } else {
View Full Code Here

    try {
      LocalizingDynamicSchemaProcessor schemaProcessor = new LocalizingDynamicSchemaProcessor();
      PropertyList localeInfo = new PropertyList();
      localeInfo.put( "Locale", getLocale().toString() ); //$NON-NLS-1$

      FileSystemManager fsManager = VFS.getManager();


      SolutionRepositoryVfsFileObject mondrianDS =
        (SolutionRepositoryVfsFileObject) fsManager.resolveFile( urlStr );

      in = mondrianDS.getInputStream();
      res = schemaProcessor.filter( null, localeInfo, in );
    } catch ( FileNotFoundException fnfe ) {
      throw new MondrianCatalogServiceException( Messages.getInstance().getErrorString(
View Full Code Here

  }

  protected String getSolutionRepositoryRelativePath( final String path, final IPentahoSession pentahoSession ) {

    try {
      FileSystemManager fsManager = VFS.getManager();
      return fsManager.resolveFile( path ).getName().getPath();
    } catch ( FileSystemException e ) {
      throw new MondrianCatalogServiceException( Messages.getInstance().getErrorString(
        "MondrianCatalogHelper.ERROR_0012_FILESYSTEM_PROBLEM" ), e ); //$NON-NLS-1$
    }
View Full Code Here

  private FileObject repo;

  public void setPath(String path) throws Exception {

    FileSystemManager fileSystemManager;
    try {
      if (!path.endsWith("" + File.separatorChar)) {
        path += File.separatorChar;
      }
      fileSystemManager = VFS.getManager();
      FileObject fileObject;
      fileObject = fileSystemManager.resolveFile(path);
      if (fileObject == null) {
        throw new IOException("File cannot be resolved: " + path);
      }
      if (!fileObject.exists()) {
        throw new IOException("File does not exist: " + path);
View Full Code Here

    }
  }

  public void setPath(String path) {

    FileSystemManager fileSystemManager;
    try {
      fileSystemManager = VFS.getManager();

      FileObject fileObject;
      fileObject = fileSystemManager.resolveFile(path);
      if (fileObject == null) {
        throw new IOException("File cannot be resolved: " + path);
      }
      if (!fileObject.exists()) {
        throw new IOException("File does not exist: " + path);
View Full Code Here

    }
  }

  private void setPath(String path) {

    FileSystemManager fileSystemManager;
    try {
      fileSystemManager = VFS.getManager();

      FileObject fileObject;
      fileObject = fileSystemManager.resolveFile(path);
      if (fileObject == null) {
        throw new IOException("File cannot be resolved: " + path);
      }
      if (!fileObject.exists()) {
        throw new IOException("File does not exist: " + path);
View Full Code Here

TOP

Related Classes of org.apache.commons.vfs.FileSystemManager

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.