+ org.netbeans.modules.dlight.remote.impl
+ org.netbeans.modules.remotefs.bridge
org.netbeans.modules.javafx.source
org.netbeans.modules.parsing.api
org.netbeans.modules.parsing.lucene
--- a/nbbuild/cluster.properties
+++ a/nbbuild/cluster.properties
@@ -340,6 +340,7 @@
properties,\
properties.syntax,\
refactoring.api,\
+ remotefs.bridge,\
schema2beans,\
server,\
servletapi,\
--- a/remotefs.bridge/build.xml
+++ a/remotefs.bridge/build.xml
@@ -0,0 +1,5 @@
+
+
+ Builds, tests, and runs the project org.netbeans.modules.remotefs.bridge
+
+
--- a/remotefs.bridge/manifest.mf
+++ a/remotefs.bridge/manifest.mf
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.modules.remotefs.bridge
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/remotefs/bridge/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
--- a/remotefs.bridge/nbproject/project.properties
+++ a/remotefs.bridge/nbproject/project.properties
@@ -0,0 +1,2 @@
+javac.source=1.6
+javac.compilerargs=-Xlint -Xlint:-serial
--- a/remotefs.bridge/nbproject/project.xml
+++ a/remotefs.bridge/nbproject/project.xml
@@ -0,0 +1,41 @@
+
+
+ org.netbeans.modules.apisupport.project
+
+
+ org.netbeans.modules.remotefs.bridge
+
+
+ org.netbeans.modules.dlight.nativeexecution
+
+
+
+ 1.10.3
+
+
+
+ org.netbeans.modules.masterfs
+
+
+
+ 2
+ 2.32.1
+
+
+
+ org.openide.filesystems
+
+
+
+ 7.47.1
+
+
+
+
+ org.netbeans.modules.dlight.remote.impl
+ org.netbeans.modules.versioning
+ org.netbeans.modules.remotefs.bridge.spi
+
+
+
+
--- a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/Bundle.properties
+++ a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/Bundle.properties
@@ -0,0 +1,12 @@
+OpenIDE-Module-Display-Category=Infrastructure
+OpenIDE-Module-Long-Description=\
+ The module extends master file system providers SPI.\n\
+ Master file system providers SPI has java.io.file in the interface ProvidedExtensions.\n\
+ It prevents using VCS for remote file system.\n\
+ The module provides:\n1. \
+ Interface ProvidedExtensions2. \
+ It extends interface ProvidedExtensions and replaces java.io.File by java.net.URL.\n2. \
+ Bridge that can get execution environment by URL.\n3. \
+ FileProxy helper class that provides restricted set of java.io.File methods needed by VCS.
+OpenIDE-Module-Name=Remote File System Bridge
+OpenIDE-Module-Short-Description=Remote File System Bridge
--- a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/Bridge.java
+++ a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/Bridge.java
@@ -0,0 +1,159 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.remotefs.bridge.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
+import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+import org.openide.filesystems.FileUtil;
+import org.openide.filesystems.URLMapper;
+
+/**
+ *
+ * @author Alexander Simon
+ */
+public final class Bridge {
+ static FileSystem rootFileSystem;
+
+ static {
+ File tmpFile = null;
+ try {
+ tmpFile = File.createTempFile("NetBeans", ".tmp"); //NOI18N
+ tmpFile = FileUtil.normalizeFile(tmpFile);
+ FileObject fo = FileUtil.toFileObject(tmpFile);
+ rootFileSystem = fo.getFileSystem();
+ } catch (IOException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ } finally {
+ if (tmpFile != null) {
+ tmpFile.delete();
+ }
+ }
+ }
+
+ private Bridge() {
+ }
+
+ public static FileProxy toFileProxy(URL path) {
+ return new FileProxy(path);
+ }
+
+ public static ExecutionEnvironment getExecutionEnvironment(URL path) {
+ if (isRemote(path)) {
+ //TODO: provide SPI to get remote file system
+ FileSystem fs = getRemoteFileSystem(path);
+ Class extends FileSystem> aClass = fs.getClass();
+ try {
+ Method method = aClass.getMethod("getExecutionEnvironment"); //NOI18N
+ return (ExecutionEnvironment) method.invoke(fs);
+ } catch (IllegalArgumentException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (InvocationTargetException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (NoSuchMethodException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (SecurityException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ return ExecutionEnvironmentFactory.getLocal();
+ }
+
+ static URL toLocalFileURL(File file) {
+ try {
+ return file.toURI().toURL();
+ } catch (MalformedURLException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ return null;
+ }
+ }
+
+ //static URL toURL(FileObject file) {
+ // return URLMapper.findURL(file, URLMapper.EXTERNAL);
+ //}
+
+ static URL toURL(FileSystem fs, String path) {
+ if (isRemote(fs)) {
+ //TODO: provide SPI to create remote URL
+ } else {
+ try {
+ return new File(path).toURI().toURL();
+ } catch (MalformedURLException ex) {
+ Logger.getLogger(Bridge.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ return null;
+ }
+
+ static FileObject toFileObject(URL path) {
+ return URLMapper.findFileObject(path);
+ }
+
+ private static boolean isRemote(FileSystem fs) {
+ //TODO: provide SPI
+ Class extends FileSystem> aClass = fs.getClass();
+ if ("org.netbeans.modules.remote.impl.fs.RemoteFileSystem".equals(aClass.getName())) { //NOI18N
+ return true;
+ }
+ return false;
+ }
+
+ static boolean isRemote(URL path) {
+ return "rfs".equals(path.getProtocol());
+ }
+
+ static FileSystem getRemoteFileSystem(URL path) {
+ //TODO: provide SPI
+ return null;
+ }
+}
--- a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/FileProxy.java
+++ a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/FileProxy.java
@@ -0,0 +1,181 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.remotefs.bridge.spi;
+
+import java.io.File;
+import java.net.URL;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileSystem;
+
+/**
+ * Represents file on remote or local file system.
+ *
+ * @author Alexander Simon
+ */
+public final class FileProxy {
+
+ private final URL url;
+ private final FileSystem fs;
+ private final boolean isLocal;
+
+ FileProxy(URL path) {
+ this.url = path;
+ if (Bridge.isRemote(path)) {
+ this.fs = Bridge.getRemoteFileSystem(path);
+ this.isLocal = false;
+ } else {
+ this.isLocal = true;
+ this.fs = Bridge.rootFileSystem;
+ }
+ }
+
+ /**
+ *
+ * @return Absolute path to file in file system.
+ */
+ public String getAbsolutePath() {
+ return url.getPath();
+ }
+
+ public String getName() {
+ if (isLocal) {
+ return new File(url.getPath()).getName();
+ }
+ int index = url.getPath().lastIndexOf('/');
+ if (index >= 0) {
+ return url.getPath().substring(index + 1);
+ } else {
+ return ""; //NOI18N
+ }
+ }
+
+ public boolean isDirectory() {
+ if (isLocal) {
+ return new File(url.getPath()).isDirectory();
+ }
+ FileObject fo = Bridge.toFileObject(url);
+ return fo == null ? false : fo.isFolder();
+ }
+
+ public boolean isFile() {
+ if (isLocal) {
+ return new File(url.getPath()).isFile();
+ } else {
+ FileObject fo = Bridge.toFileObject(url);
+ return fo == null ? false : fo.isData();
+ }
+ }
+
+ public boolean canWrite() {
+ if (isLocal) {
+ return new File(url.getPath()).canWrite();
+ } else {
+ FileObject fo = Bridge.toFileObject(url);
+ return fo == null ? false : fo.canWrite();
+ }
+ }
+
+ public FileProxy getParentFile() {
+ if (isLocal) {
+ File parent = new File(url.getPath()).getParentFile();
+ if (parent != null) {
+ return new FileProxy(Bridge.toLocalFileURL(parent));
+ }
+ } else {
+ int index = url.getPath().lastIndexOf('/');
+ if (index >= 0) {
+ String parent = url.getPath().substring(0, index);
+ Bridge.toURL(fs, parent);
+ return new FileProxy(Bridge.toURL(fs, parent));
+ }
+ }
+ return null;
+ }
+
+ public boolean exists() {
+ if (isLocal) {
+ return new File(url.getPath()).exists();
+ } else {
+ FileObject fo = Bridge.toFileObject(url);
+ return fo == null ? false : fo.isValid();
+ }
+ }
+
+ public FileProxy newFileProxy(String name) {
+ if (isLocal) {
+ return new FileProxy(Bridge.toLocalFileURL(new File(url.getPath(),name)));
+ } else {
+ return new FileProxy(Bridge.toURL(fs, url.getPath()+'/'+name));
+ }
+ }
+
+ @Override
+ public String toString() {
+ return fs + " " + url.getPath(); //NOI18N
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 59 * hash + (this.url.getPath() != null ? this.url.getPath().hashCode() : 0);
+ hash = 59 * hash + (this.fs != null ? this.fs.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final FileProxy other = (FileProxy) obj;
+ if (this.fs != other.fs && (this.fs == null || !this.fs.equals(other.fs))) {
+ return false;
+ }
+ if ((this.url == null) ? (other.url.getPath() != null) : !this.url.getPath().equals(other.url.getPath())) {
+ return false;
+ }
+ return true;
+ }
+}
--- a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/ProvidedExtensions2.java
+++ a/remotefs.bridge/src/org/netbeans/modules/remotefs/bridge/spi/ProvidedExtensions2.java
@@ -0,0 +1,208 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.remotefs.bridge.spi;
+
+import java.net.URL;
+import java.util.List;
+import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
+import org.openide.filesystems.FileObject;
+
+/**
+ * Extension of {@link ProvidedExtensions} to process remote file operations.
+ *
+ * The interface is intended to be implemented in remote file system and VCS
+ * when modules extend class ProvidedExtensions.
+ *
+ * @author Alexander Simon
+ */
+public interface ProvidedExtensions2 {
+ /**
+ * Return instance of {@link ProvidedExtensions.IOHandler}
+ * that is responsible for copying the file or null.
+ *
+ * Just the first non null instance of IOHandler
is used by
+ * RemoteFileSystem
+ *
+ * @param from file to be copied
+ * @param to target to copy this file to
+ * @return instance of {@link ProvidedExtensions.IOHandler}
+ * that is responsible for copying the file or null
+ */
+ ProvidedExtensions.IOHandler getCopyHandler(URL from, URL to);
+
+ /**
+ * Return instance of {@link ProvidedExtensions.IOHandler}
+ * that is responsible for moving the file or null.
+ *
+ * Just the first non null instance of IOHandler
is used by
+ * RemoteFileSystem
+ *
+ * @param from file to be moved
+ * @param to target to move this file to
+ * @return instance of {@link ProvidedExtensions.IOHandler}
+ * that is responsible for moving the file or null
+ */
+ ProvidedExtensions.IOHandler getMoveHandler(URL from, URL to);
+
+ /*
+ * Return instance of {@link ProvidedExtensions.IOHandler}
+ * that is responsible for renaming the file or null.
+ *
+ * Just the first non null instance of IOHandler
is used by
+ * RemoteFileSystem
+ *
+ * @param from file to be renamed
+ * @param newName new name of file
+ * @return instance of {@link ProvidedExtensions.IOHandler}
+ * that is responsible for renaming the file or null
+ */
+ ProvidedExtensions.IOHandler getRenameHandler(URL from, String newName);
+
+ /*
+ * Return instance of {@link ProvidedExtensions.DeleteHandler}
+ * that is responsible for deleting the file or null.
+ *
+ * Just the first non null instance of DeleteHandler
is used by
+ * RemoteFileSystem
+ *
+ * @param f file or folder to be deleted
+ * @return instance of {@link ProvidedExtensions2.DeleteHandler2}
+ * that is responsible for deleting the file or null
+ */
+ ProvidedExtensions2.DeleteHandler2 getDeleteHandler(URL f);
+
+ public interface DeleteHandler2 {
+ /**
+ * Deletes the file or directory denoted by this abstract pathname. If
+ * this pathname denotes a directory, then the directory must be empty in
+ * order to be deleted.
+ *
+ * @return true
if and only if the file or directory is
+ * successfully deleted; false
otherwise
+ */
+ boolean delete(URL file);
+ }
+
+ /**
+ * Called by RemoteFileSystem
before FileObject
+ * is copied
+ * @param from FileObject to be moved
+ * @param to URL target to move this file to
+ */
+ void beforeCopy(FileObject from, URL to);
+
+ /**
+ * Called by RemoteFileSystem
after FileObject
+ * was successfully copied
+ * @param from FileObject to be moved
+ * @param to URL target to move this file to
+ */
+ void copySuccess(FileObject from, URL to);
+
+ /**
+ * Called by RemoteFileSystem
after a FileObject
+ * copy failed
+ * @param from FileObject to be moved
+ * @param to URL target to move this file to
+ */
+ void copyFailure(FileObject from, URL to);
+
+ /**
+ * Called by RemoteFileSystem
before FileObject
+ * is moved
+ * @param from FileObject to be moved
+ * @param to URL target to move this file to
+ */
+ void beforeMove(FileObject from, URL to);
+
+ /**
+ * Called by RemoteFileSystem
after FileObject
+ * was successfully
+ * @param from FileObject to be moved
+ * @param to URL target to move this file to
+ */
+ void moveSuccess(FileObject from, URL to);
+
+ /**
+ * Called by RemoteFileSystem
after a FileObject
+ * move failed
+ * @param from FileObject to be moved
+ * @param to URL target to move this file to
+ */
+ void moveFailure(FileObject from, URL to);
+
+ /**
+ * Called by RemoteFileSystem
when FileObject
is queried for writability with the
+ * canWrite() method.
+ *
+ * @param f a URL to query
+ * @return true if the file can be written to, deleted or moved, false otherwise
+ */
+ boolean canWrite(URL f);
+
+ /**
+ * Called by {@code RemoteFileSystem} when {@code FileObject} is
+ * queried for attribute and attribute's name starts with {@code ProvidedExtensions}
+ * prefix.
+ * @param attrName name of attribute
+ * @return value of attribute
+ */
+ Object getAttribute(URL file, String attrName);
+
+ /** Allows versioning system to exclude some children from recursive
+ * listening check. Also notifies the versioning whenever a refresh
+ * is required and allows the versiniong to provide special timestamp
+ * for a directory.
+ *
+ * Default implementation of this method returns -1.
+ *
+ * @param dir the directory to check timestamp for
+ * @param lastTimeStamp the previously known timestamp or -1
+ * @param children add subfiles that shall be interated into this array
+ * @return the timestamp that shall represent this directory, it will
+ * be compared with timestamps of all children and the newest
+ * one will be kept and next time passed as lastTimeStamp. Return
+ * 0 if the directory does not have any special timestamp. Return
+ * -1 if you are not providing any special implementation
+ */
+ long refreshRecursively(URL dir, long lastTimeStamp, List children);
+}
--- a/versioning/nbproject/project.xml
+++ a/versioning/nbproject/project.xml
@@ -85,6 +85,14 @@