Permalink
Browse files

Renamed from win32 -> windows, added CM support

  • Loading branch information...
1 parent fdca460 commit d1521cff2fe4e0d432b211f907afa4b5023add49 @pke committed Feb 23, 2010
Showing with 1,319 additions and 300 deletions.
  1. +0 −1 file.monitor.core/OSGI-INF/l10n/bundle.properties
  2. 0 {file.monitor.osgi.win32.component → file.monitor.core}/epl-v10.html
  3. +22 −0 file.monitor.core/src/file/monitor/core/AbstractFileMonitor.java
  4. +11 −1 file.monitor.core/src/file/monitor/core/FileEvent.java
  5. +24 −2 file.monitor.core/src/file/monitor/core/FileInfo.java
  6. +10 −0 file.monitor.core/src/file/monitor/core/FileListener.java
  7. +11 −15 file.monitor.core/src/file/monitor/core/FileMonitor.java
  8. +0 −1 file.monitor.osgi.event/OSGI-INF/l10n/bundle.properties
  9. +261 −0 file.monitor.osgi.event/epl-v10.html
  10. +10 −0 file.monitor.osgi.event/src/file/monitor/osgi/event/FileMonitorEventContants.java
  11. +10 −0 file.monitor.osgi.event/src/file/monitor/osgi/event/internal/FileListenerImpl.java
  12. +0 −1 file.monitor.osgi.example.event/OSGI-INF/l10n/bundle.properties
  13. +1 −2 file.monitor.osgi.example.log/OSGI-INF/l10n/bundle.properties
  14. +0 −9 file.monitor.osgi.win32.component/OSGI-INF/FileMonitorComponent.xml
  15. +0 −3 file.monitor.osgi.win32.component/OSGI-INF/l10n/bundle.properties
  16. 0 {file.monitor.win32 → file.monitor.osgi.windows.component}/.classpath
  17. +1 −1 {file.monitor.osgi.win32.component → file.monitor.osgi.windows.component}/.project
  18. 0 ...win32.component → file.monitor.osgi.windows.component}/.settings/org.eclipse.core.resources.prefs
  19. 0 ....osgi.win32.component → file.monitor.osgi.windows.component}/.settings/org.eclipse.jdt.core.prefs
  20. 0 ....osgi.win32.component → file.monitor.osgi.windows.component}/.settings/org.eclipse.pde.core.prefs
  21. 0 ...nitor.osgi.win32.component → file.monitor.osgi.windows.component}/.settings/org.eclipse.pde.prefs
  22. +3 −2 {file.monitor.osgi.win32.component → file.monitor.osgi.windows.component}/FileMonitor.launch
  23. +1 −1 {file.monitor.osgi.win32.component → file.monitor.osgi.windows.component}/META-INF/MANIFEST.MF
  24. +9 −0 file.monitor.osgi.windows.component/OSGI-INF/FileMonitorComponent.xml
  25. +2 −0 file.monitor.osgi.windows.component/OSGI-INF/l10n/bundle.properties
  26. 0 {file.monitor.osgi.win32.component → file.monitor.osgi.windows.component}/build.properties
  27. +1 −0 ...tor.osgi.windows.component/configurations/services/file.monitor.osgi.windows.component.properties
  28. +6 −0 file.monitor.osgi.windows.component/configurations/services/org.ops4j.pax.logging.properties
  29. +261 −0 file.monitor.osgi.windows.component/epl-v10.html
  30. +69 −11 ...sgi.windows.component/src/file/monitor/osgi/windows}/component/internal/FileMonitorComponent.java
  31. +1 −1 file.monitor.target/Example.target
  32. BIN file.monitor.target/org.eclipse.equinox.cm_1.0.200.N20100214-2000.jar
  33. BIN file.monitor.target/pax-confman-propsloader-0.2.1.jar
  34. +0 −3 file.monitor.win32/OSGI-INF/l10n/bundle.properties
  35. +0 −208 file.monitor.win32/src/file/monitor/win32/WindowsFileMonitor.java
  36. +0 −37 file.monitor.win32/src/file/monitor/win32/internal/Win32FileInfo.java
  37. 0 {file.monitor.osgi.win32.component → file.monitor.windows}/.classpath
  38. 0 {file.monitor.win32 → file.monitor.windows}/.project
  39. 0 {file.monitor.win32 → file.monitor.windows}/.settings/org.eclipse.jdt.core.prefs
  40. 0 {file.monitor.win32 → file.monitor.windows}/.settings/org.eclipse.pde.core.prefs
  41. +2 −1 {file.monitor.win32 → file.monitor.windows}/META-INF/MANIFEST.MF
  42. +2 −0 file.monitor.windows/OSGI-INF/l10n/bundle.properties
  43. 0 {file.monitor.win32 → file.monitor.windows}/build.properties
  44. +261 −0 file.monitor.windows/epl-v10.html
  45. +145 −0 file.monitor.windows/src/file/monitor/windows/AbstractWindowsFileMonitor.java
  46. +44 −0 file.monitor.windows/src/file/monitor/windows/WindowsFileMonitor.java
  47. +151 −0 file.monitor.windows/src/file/monitor/windows/internal/Win32FileInfo.java
@@ -1,4 +1,3 @@
-#Properties file for de.topsystem.io.filemonitor
Bundle-Vendor = Philipp Kursawe
Bundle-Name = Filemonitor
Bundle-Description = Provides file monitoring service. FileListener services are notified about changes.
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Philipp Kursawe.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Philipp Kursawe (phil.kursawe@gmail.com) - initial API and implementation
+ ******************************************************************************/
package file.monitor.core;
@@ -57,4 +67,16 @@ public boolean isEmpty() {
}
protected abstract void fireChangeEvent(final FileEvent event);
+
+ protected void onListenerException(FileListener listener, Throwable t) {
+ t.printStackTrace(System.err);
+ }
+
+ protected void safeNotifyListener(FileListener listener, FileEvent event) {
+ try {
+ listener.fileChanged(event);
+ } catch (Throwable t) {
+ onListenerException(listener, t);
+ }
+ }
}
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Philipp Kursawe.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Philipp Kursawe (phil.kursawe@gmail.com) - initial API and implementation
+ ******************************************************************************/
package file.monitor.core;
import java.io.File;
@@ -6,7 +16,7 @@
/**
* Base event for file monitor changes.
*
- * @author <a href="mailto:kursawe@topsystem.de">Philipp Kursawe</a>
+ * @author <a href="mailto:phil.kursawe@gmail.com">Philipp Kursawe</a>
*
*/
public class FileEvent extends EventObject {
@@ -1,18 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Philipp Kursawe.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Philipp Kursawe (phil.kursawe@gmail.com) - initial API and implementation
+ ******************************************************************************/
package file.monitor.core;
import java.io.File;
+/**
+ * Information about a watched file/directory.
+ *
+ * @author <a href="mailto:phil.kursawe@gmail.com">Philipp Kursawe</a>
+ *
+ */
public class FileInfo {
public final File file;
- public final int notifyMask;
+ public final int mask;
public final boolean recursive;
public FileInfo(final File f, final int mask, final boolean recurse) {
this.file = f;
- this.notifyMask = mask;
+ this.mask = mask;
this.recursive = recurse;
}
+ /**
+ * Called by the {@link AbstractFileMonitor#unwatch(File)} when it removes the file info from its list.
+ *
+ * <p>
+ * Subclasses should free their resources associated with this info.
+ */
public void dispose() {
}
}
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Philipp Kursawe.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Philipp Kursawe (phil.kursawe@gmail.com) - initial API and implementation
+ ******************************************************************************/
package file.monitor.core;
import java.util.EventListener;
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Philipp Kursawe.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Philipp Kursawe (phil.kursawe@gmail.com) - initial API and implementation
+ ******************************************************************************/
package file.monitor.core;
import java.io.File;
@@ -9,25 +19,11 @@
* <p>
* Watched files which are removed from the filesystem are no longer watched.
*
- * <p>
- * This OSGi service consumes {@link FileListener} services. Such a listener service can optionally provide a
- * <code>file.name</code> property to specify the file or directory that this listener wants to add to the list of
- * watches. If the listener service does not specify this property, then it is informed about all changes of all
- * currently watched files and directories. If no listener service specifies such a property, then nothing is watched
- * unless someone calls {@link #watch(File, int, boolean)} directly.
- *
- * @TODO:
- * Use CM support to add file/directory watches
- *
- * @remarks
- * Base implementation by twall for the JNA project.
- *
- * @author <a href="mailto:kursawe@topsystem.de">Philipp Kursawe</a>
+ * @author <a href="mailto:phil.kursawe@gmail.com">Philipp Kursawe</a>
*
* @see FileListener
*/
public interface FileMonitor {
-
/**
* Adds a file or directory to watch for changes.
@@ -1,4 +1,3 @@
-#Properties file for de.topsystem.io.filemonitor.extender.event
Bundle-Vendor = Philipp Kursawe
Bundle-Name = EventAdmin extender for filemonitor service
Bundle-Description = FileMonitor listener that creates events using OSGi EventAdmin
Oops, something went wrong.

0 comments on commit d1521cf

Please sign in to comment.