Examples of FileObject


Examples of org.apache.commons.vfs.FileObject

    }
    return new File(_workDir, path);
  }
 
  public void copy(String sourcePath, File targetDir) throws IOException {
    FileObject target = VFS.getManager().resolveFile(targetDir.getAbsolutePath());
    FileObject source = _source.resolveFile(sourcePath);
    if (source.exists()) {
      target.copyFrom(source, new FileSelector() {

        public boolean includeFile(FileSelectInfo arg0) throws Exception {
          return true;
        }
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

    if (_properties == null) {
      TemporaryFile tempFile = null;
      try {       
        tempFile = new TemporaryFile("template_" + _name, getContent(), WGADesignerPlugin.getDefault().getStateLocation().toFile());
        FileSystemManager fsManager = VFS.getManager();
        FileObject propFile = fsManager.resolveFile("zip:" + tempFile.getFile().toURI() + "!" + PROPERTIES_FILENAME);
        if (propFile.exists()) {
          _properties = new Properties();
          InputStream propIn = null;
          try {
            propIn = propFile.getContent().getInputStream();
            _properties.load(propIn);
          } finally {
            if (propIn != null) {
              try {
                propIn.close();
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

  public void createOrUpdateDefaultDeployment(File defaultWGAWar, IProgressMonitor monitor) throws FileSystemException, IOException, ZipException {
    if (monitor == null) {
      monitor = new NullProgressMonitor();
    }
    FileSystemManager fsManager = VFS.getManager();
    FileObject propFile = fsManager.resolveFile( "zip:" + defaultWGAWar.toURI() + "!/WEB-INF/wgabuild.properties");
    //_defaultDeploymentName = DEFAULT_DEPLOYMENT_PREFIX + WGADeployment.determineWGAVersion(propFile.getURL().openStream(), "_", true, false);
       
    // init default wga installation
    // check if we already have a deployment with same major, minor version
    WGADeployment existingDefaultDeployment = getDeployment(DEFAULT_DEPLOYMENT_NAME);
    if (existingDefaultDeployment != null) {
      InputStream propIn = null;
      try {
        propIn = propFile.getURL().openStream();
        Version newDefaultDeploymentVersion = WGADeployment.determineWGAVersion(propIn);
        Version existingDefaultDeploymentVersion = existingDefaultDeployment.getWGAVersion();
        if (!newDefaultDeploymentVersion.equals(existingDefaultDeploymentVersion)) {
          // we have to update the default deployment
          createDeployment(DEFAULT_DEPLOYMENT_NAME, defaultWGAWar, monitor, true);
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

  public static boolean isWGAVersionSupported(File wgaWar) {
    InputStream propIn = null;
    try {
      FileSystemManager fsManager = VFS.getManager();
      FileObject propFile = fsManager.resolveFile( "zip:" + wgaWar.toURI() + "!/WEB-INF/wgabuild.properties");
      propIn = propFile.getURL().openStream();
      Version version = WGADeployment.determineWGAVersion(propIn);
      if (version != null) {
        if (version.isAtLeast(Activator.SUPPORTED_WGA_VERSION_MIN.getMajor(),  Activator.SUPPORTED_WGA_VERSION_MIN.getMinor())) {
          if (version.getMajorVersion() < Activator.SUPPORTED_WGA_VERSION_MAX.getMajor()) {
            return true;
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

                new Object[]{
                    name, rootName, name.getRootURI()});
        }

        // imario@apache.org ==> use getFileFromCache
        FileObject file;
        if (useCache)
        {
            file = getFileFromCache(name);
        }
        else
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

     */
    private void fireEvent(final AbstractFileChangeEvent event)
    {
        synchronized (listenerMap)
        {
            final FileObject file = event.getFile();
            final ArrayList listeners = (ArrayList) listenerMap.get(file.getName());
            if (listeners != null)
            {
                final int count = listeners.size();
                for (int i = 0; i < count; i++)
                {
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

     * Creates an output stream to write the file content to.
     */
    protected OutputStream doGetOutputStream(boolean bAppend) throws Exception
    {
        int fileCount;
        FileObject webdavTmp;
        synchronized (tmpFileCountSync)
            {
                tmpFileCount++;
                fileCount = tmpFileCount;
            }
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

    public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
    {
        // Locate the base Zip file
        final String zipFilePath = AbstractVfsTestCase.getTestResource("nested.zip").getAbsolutePath();
        String uri = "zip:" + zipFilePath + "!/test.zip";
        final FileObject zipFile = manager.resolveFile(uri);

        // Now build the nested file system
        final FileObject nestedFS = manager.createFileSystem(zipFile);
        return nestedFS.resolveFile("/");
    }
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

    /**
     * Returns the base folder for tests.
     */
    public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
    {
        final FileObject baseFolder = config.getBaseTestFolder(manager);

        // Create an empty file system, then link in the base folder
        final FileSystem newFs = manager.createVirtualFileSystem("vfs:").getFileSystem();
        final String junctionPoint = "/some/dir";
        newFs.addJunction(junctionPoint, baseFolder);
View Full Code Here

Examples of org.apache.commons.vfs.FileObject

     * Checks nested junctions are not supported.
     */
    public void testNestedJunction() throws Exception
    {
        final FileSystem fs = getManager().createVirtualFileSystem("vfs:").getFileSystem();
        final FileObject baseDir = getBaseDir();
        fs.addJunction("/a", baseDir);

        // Nested
        try
        {
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.