java.nio.file.WatchEvent.Modifier Java Examples

The following examples show how to use java.nio.file.WatchEvent.Modifier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnixSshFileSystemWatchService.java    From jsch-nio with MIT License 6 votes vote down vote up
UnixSshPathWatchKey register( UnixSshPath path, Kind<?>[] events, Modifier... modifiers ) {
    try {
        watchKeysLock.lock();
        if ( watchKeys.containsKey( path ) ) {
            return watchKeys.get( path );
        }

        UnixSshPathWatchKey watchKey = newWatchKey( path, events );
        watchKeys.put( path, watchKey );
        watchKeyFutures.put( path, executorService.submit( watchKey ) );
        return watchKey;
    }
    finally {
        watchKeysLock.unlock();
    }
}
 
Example #2
Source File: BuckUnixPath.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public WatchKey register(
    WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers)
    throws IOException {
  // TODO(buck_team): do not recourse to default Path implementation
  return asDefault().register(watcher, events, modifiers);
}
 
Example #3
Source File: JWatchService.java    From baratine with GNU General Public License v2.0 5 votes vote down vote up
protected JWatchKey register(JPath path, Kind<?>[] events, Modifier ... modifiers)
{
  JWatchKey key = new JWatchKey(this, path, events, modifiers);

  synchronized (this) {
    _watchList.add(key);
  }

  return key;
}
 
Example #4
Source File: JWatchKey.java    From baratine with GNU General Public License v2.0 5 votes vote down vote up
public JWatchKey(JWatchService watchService,
                 JPath path,
                 Kind<?>[] events,
                 Modifier ... modifiers)
{
  Objects.requireNonNull(events);

  _watchService = watchService;
  _path = path;
  _events = events;
  _modifiers = modifiers;

  _watchHandle = path.getBfsFile().watch(pathString -> onWatch(pathString));
}
 
Example #5
Source File: UnixSshPath.java    From jsch-nio with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public WatchKey register( WatchService watcher, Kind<?>[] events, Modifier... modifiers ) throws IOException {
    if ( watcher == null ) {
        throw new NullPointerException();
    }
    if ( !(watcher instanceof UnixSshFileSystemWatchService) ) {
        throw new ProviderMismatchException();
    }
    if ( !getFileSystem().provider().readAttributes( this, BasicFileAttributes.class ).isDirectory() ) {
        throw new NotDirectoryException( this.toString() );
    }
    getFileSystem().provider().checkAccess( this, AccessMode.READ );
    return ((UnixSshFileSystemWatchService) watcher).register( this, events, modifiers );
}
 
Example #6
Source File: JPath.java    From baratine with GNU General Public License v2.0 5 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events,
                         Modifier... modifiers) throws IOException
{
  if (events.length == 0) {
    throw new IllegalArgumentException(L.l("no events specified to watch on: {0}", toUri()));
  }

  JWatchService jWatcher = (JWatchService) watcher;

  WatchKey key = jWatcher.register(this, events, modifiers);

  return key;
}
 
Example #7
Source File: HadoopPath.java    From jsr203-hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events,
    Modifier... modifiers) throws IOException {
  if (watcher == null || events == null || modifiers == null) {
    throw new NullPointerException();
  }

  // Not implemented now
  // The Hadoop API for notification is not stable
  throw new IOException("Not implemented");
}
 
Example #8
Source File: ArtifactSourceFileWatcherThread.java    From rug-cli with GNU General Public License v3.0 5 votes vote down vote up
public ArtifactSourceFileWatcherThread(ArtifactDescriptor artifact, Modifier... modifiers) {
    this.artifact = artifact;
    this.modifiers = modifiers;
    setDaemon(true);
    setName("FS File Watcher Thread");
    init();
    start();
}
 
Example #9
Source File: SFTPPath.java    From sftp-fs with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException {
    throw Messages.unsupportedOperation(Path.class, "register"); //$NON-NLS-1$
}
 
Example #10
Source File: BuckUnixPath.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>... events) throws IOException {
  return this.register(watcher, events, new Modifier[0]);
}
 
Example #11
Source File: UnixSshPath.java    From jsch-nio with MIT License 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public WatchKey register( WatchService watcher, Kind<?>... events ) throws IOException {
    return register( watcher, events, new WatchEvent.Modifier[0] );
}
 
Example #12
Source File: HadoopPath.java    From jsr203-hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>... events)
    throws IOException {
  return register(watcher, events, new WatchEvent.Modifier[0]);
}
 
Example #13
Source File: BundlePath.java    From incubator-taverna-language with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events,
		Modifier... modifiers) throws IOException {
	throw new UnsupportedOperationException();
}
 
Example #14
Source File: MTGPath.java    From MtgDesktopCompanion with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException {
	return null;
}
 
Example #15
Source File: ZipPath.java    From fix-orchestra with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers)
    throws IOException {
  throw new UnsupportedOperationException();
}
 
Example #16
Source File: MemoryPath.java    From openjdk-systemtest with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events,
		Modifier... modifiers) throws IOException {
	return null;
}
 
Example #17
Source File: ArtifactSourceFileWatcherThread.java    From rug-cli with GNU General Public License v3.0 4 votes vote down vote up
public ArtifactSourceFileWatcherThread(ArtifactDescriptor artifact) {
    this(artifact, new Modifier[0]);
}
 
Example #18
Source File: FilterPath.java    From lucene-solr with Apache License 2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException {
  return delegate.register(watcher, events, modifiers);
}
 
Example #19
Source File: JPath.java    From baratine with GNU General Public License v2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>... events)
    throws IOException
{
  return register(watcher, events, new Modifier[0]);
}
 
Example #20
Source File: PathBase.java    From baratine with GNU General Public License v2.0 4 votes vote down vote up
@Override
public WatchKey register(WatchService watcher, Kind<?>[] events,
                         Modifier... modifiers) throws IOException
{
  throw new UnsupportedOperationException();
}
 
Example #21
Source File: MCRPath.java    From mycore with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WatchKey register(final WatchService watcher, final Kind<?>[] events, final Modifier... modifiers)
    throws IOException {
    throw new UnsupportedOperationException();
}
 
Example #22
Source File: MCRPath.java    From mycore with GNU General Public License v3.0 4 votes vote down vote up
@Override
public WatchKey register(final WatchService watcher, final Kind<?>... events) throws IOException {
    return register(watcher, events, new WatchEvent.Modifier[0]);
}