org.kie.internal.io

## Interface ResourceChangeNotifier

-     public interface ResourceChangeNotifier

  ResourceChangeListeners can subscribe to the notifier to receive ChangeSet info when results they are subscribed to change. The ResourceChangeNotifier itself is not monitoring resources for changes, instead it delegates to added ResourceChangeMonitor implementations. When a ResourceChangeListener subscribes to a Resource that subscription is delegated to the added monitors.

  This interface, as well as ChangeSet, ResourceChangeMonitor, esourceChangeListener and ResourceChangeScanner are still considered subject to change. Use the XML format change-set, as part of the ResourceType api when adding to KnowledgeBuilder, which is considered stable. KnowledgeBuilder currently ignored Added/Modified xml elements, the KnowledgeAgent will use them, when rebuilding the KnowledgeBase.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addResourceChangeMonitor(ResourceChangeMonitor monitor)` Add a ResourceChangeMonitor, which will receive all Resource subscriptions.
    `Collection<ResourceChangeMonitor>` | `getResourceChangeMonitors()` Return a collection of the added ResourceChangeMonitors
    `void` | `publishChangeSet(ChangeSet changeSet)` Called by the added ResourceChangeMonitors to inform this ResourceChangeNotifier of resource changes.
    `void` | `removeResourceChangeMonitor(ResourceChangeMonitor monitor)` Remove a ResourceChangeMonitor.
    `void` | `setSystemEventListener(SystemEventListener listener)`
    `void` | `start()` Start the service, this will create a new Thread.
    `void` | `stop()` Stop the service.
    `void` | `subscribeChildResource(org.kie.api.io.Resource directory, org.kie.api.io.Resource child)` When a ResourceChangeMonitor is asked to monitor a directory, it needs a way to tell the ResourceChangeNotifier of any newly added Resources.
    `void` | `subscribeResourceChangeListener(ResourceChangeListener listener, org.kie.api.io.Resource resource)`
    `void` | `unsubscribeResourceChangeListener(ResourceChangeListener listener, org.kie.api.io.Resource resource)`

- - ### Method Detail

    - #### subscribeResourceChangeListener

          void subscribeResourceChangeListener(ResourceChangeListener listener,
                                             org.kie.api.io.Resource resource)

    - #### unsubscribeResourceChangeListener

          void unsubscribeResourceChangeListener(ResourceChangeListener listener,
                                               org.kie.api.io.Resource resource)

    - #### subscribeChildResource

          void subscribeChildResource(org.kie.api.io.Resource directory,
                                    org.kie.api.io.Resource child)

      When a ResourceChangeMonitor is asked to monitor a directory, it needs a way to tell the ResourceChangeNotifier of any newly added Resources.
      Parameters:
        `directory` - The parent directory the discovered child is in.
        `child` - The discovered child resource

    - #### addResourceChangeMonitor

          void addResourceChangeMonitor(ResourceChangeMonitor monitor)

      Add a ResourceChangeMonitor, which will receive all Resource subscriptions.
      Parameters:
        `monitor` -

    - #### removeResourceChangeMonitor

          void removeResourceChangeMonitor(ResourceChangeMonitor monitor)

      Remove a ResourceChangeMonitor.
      Parameters:
        `monitor` -

    - #### getResourceChangeMonitors

          Collection<ResourceChangeMonitor> getResourceChangeMonitors()

      Return a collection of the added ResourceChangeMonitors
      Returns:

    - #### publishChangeSet

          void publishChangeSet(ChangeSet changeSet)

      Called by the added ResourceChangeMonitors to inform this ResourceChangeNotifier of resource changes. The ResourceChangeMontior must have a reference to the ResourceChangeNotifiers they are added to,
      Parameters:
        `changeSet` -

    - #### setSystemEventListener

          void setSystemEventListener(SystemEventListener listener)

    - #### start

          void start()

      Start the service, this will create a new Thread.

    - #### stop

          void stop()

      Stop the service.

Copyright © 2001–2015 JBoss by Red Hat. All rights reserved.