A Changeset object can be created just with the node id. The actually data will be loaded on demand when it is accessed
No source should be added to the change set more than once, either with the same or a different kind of change. It does not make sense, for example, for a source to be both added and removed, and it is redundant for a source to be marked as changed in its entirety and changed in some specific range. @coverage dart.engine
Notice that each resource defines a protocol for it's source, this is because when using a ChangeSet all resource elements are turned into a URL instance, so it obeys the format as provided by the JDK URL class. There is one exception which is the classpath protocol, which is handled separately. Here the resource is loaded from the classpath, where it uses the default ClassLoader of the KnowledgeBase.
A path, when using file based protocols, can point to a folder. In such a situation all the resources in that folder will be added. When used with a KnowledgeAgent, which is also set to scan directories, it will continue to scan the directory for new or removed resources.
The ChangeSet can be used as a ResourceType with the KnowledgeBuilder or applied directly to a KnowledgeAgent.
Example showing a changeset being used with a KnowledgeBuilder:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newUrlResource( url ), ResourceType.ChangeSet );
Example showing a changeset being applied to a KnowledgeAgent:
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" ); kagent.applyChangeSet( ResourceFactory.newUrlResource( url ) ); KnowledgeBase kbase = kagent.getKnowledgeBase();
This interface, as well as ResourceChangeMonitor, ResourceChangeNotifier, ResourceChangeScanner and ResourceChangeListener 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.
It contains several lists, indicating new, changed, deleted and unchanged files. File paths are stored relative to the root Syncany directory.
@author Philipp C. Heckel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|