Java Code Examples for java.nio.file.WatchEvent.Modifier

The following examples show how to use java.nio.file.WatchEvent.Modifier. These examples are extracted from open source projects. 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 Project: jsch-nio   Source File: UnixSshFileSystemWatchService.java    License: 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 Project: baratine   Source File: JWatchService.java    License: 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 3
Source Project: baratine   Source File: JWatchKey.java    License: 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 4
Source Project: baratine   Source File: JPath.java    License: 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 5
public ArtifactSourceFileWatcherThread(ArtifactDescriptor artifact, Modifier... modifiers) {
    this.artifact = artifact;
    this.modifiers = modifiers;
    setDaemon(true);
    setName("FS File Watcher Thread");
    init();
    start();
}
 
Example 6
Source Project: jsr203-hadoop   Source File: HadoopPath.java    License: 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 7
Source Project: jsch-nio   Source File: UnixSshPath.java    License: 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 8
Source Project: buck   Source File: BuckUnixPath.java    License: 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 9
Source Project: openjdk-systemtest   Source File: MemoryPath.java    License: 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 10
Source Project: mycore   Source File: MCRPath.java    License: 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]);
}
 
Example 11
Source Project: mycore   Source File: MCRPath.java    License: 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 12
Source Project: baratine   Source File: PathBase.java    License: 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 13
Source Project: baratine   Source File: JPath.java    License: 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 14
Source Project: lucene-solr   Source File: FilterPath.java    License: 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 15
public ArtifactSourceFileWatcherThread(ArtifactDescriptor artifact) {
    this(artifact, new Modifier[0]);
}
 
Example 16
Source Project: sftp-fs   Source File: SFTPPath.java    License: 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 17
Source Project: fix-orchestra   Source File: ZipPath.java    License: 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 18
Source Project: MtgDesktopCompanion   Source File: MTGPath.java    License: 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 19
Source Project: incubator-taverna-language   Source File: BundlePath.java    License: 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 20
Source Project: jsr203-hadoop   Source File: HadoopPath.java    License: 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 21
Source Project: jsch-nio   Source File: UnixSshPath.java    License: 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 22
Source Project: buck   Source File: BuckUnixPath.java    License: 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]);
}