Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / jigsaw / src / org / w3c / tools / resources / ResourceSpace.java
diff --git a/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/ResourceSpace.java b/JMCR-Stable/real-world application/jigsaw/src/org/w3c/tools/resources/ResourceSpace.java
new file mode 100644 (file)
index 0000000..f8ff282
--- /dev/null
@@ -0,0 +1,141 @@
+// ResourceSpace.java\r
+// $Id: ResourceSpace.java,v 1.1 2010/06/15 12:20:15 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.tools.resources ;\r
+\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+\r
+import java.io.File;\r
+\r
+import org.w3c.tools.resources.event.ResourceEventQueue;\r
+\r
+public interface ResourceSpace {\r
+\r
+  public ResourceEventQueue getEventQueue();\r
+\r
+  /**\r
+   * Shutdown this resource space.\r
+   * Go through all entries, and shut them down.\r
+   */\r
+  public void shutdown();\r
+\r
+  /**\r
+   * Checkpoint all modified resource, by saving them to disk.\r
+   */\r
+  public void checkpoint();\r
+\r
+  /**\r
+   * Restore the resource whose name is given from the root.\r
+   * @param identifier The identifier of the resource to restore.\r
+   * @param defs Default attribute values.\r
+   */ \r
+  public ResourceReference loadRootResource(String identifier,\r
+                                           Hashtable defs);\r
+\r
+  /**\r
+   * Lookup this resource.\r
+   * @param sentry The resource space entry.\r
+   * @param identifier The resource identifier.\r
+   * @return A Resource instance, or <strong>null</strong> if either the\r
+   *    resource doesn't exist, or it isn't loaded yet.\r
+   */\r
+  public ResourceReference lookupResource(SpaceEntry sentry, \r
+                                         String identifier);\r
+\r
+  /**\r
+   * Restore the resource whose name is given.\r
+   * @param sentry The resource space entry.\r
+   * @param identifier The identifier of the resource to restore.\r
+   * @param defs Default attribute values.\r
+   */\r
+  public ResourceReference loadResource(SpaceEntry sentry, \r
+                                       String identifier,\r
+                                       Hashtable defs);\r
+\r
+  /**\r
+   * Add this resource to the space.\r
+   * @param sentry The resource space entry.\r
+   * @param resource The resource to add.\r
+   * @param defs Default attribute values.\r
+   */\r
+  public ResourceReference addResource(SpaceEntry sentry,\r
+                                      Resource resource,\r
+                                      Hashtable defs);\r
+\r
+  /**\r
+   * Save this resource to the space.\r
+   * @param sentry The resource space entry.\r
+   * @param resource The resource to save.\r
+   */\r
+  public void saveResource(SpaceEntry sentry,\r
+                          Resource resource);\r
+\r
+  /**\r
+   * Mark the given resource as being modified.\r
+   * @param sentry The resource space entry.\r
+   * @param resource The resource to mark as modified.\r
+   */\r
+  public void markModified(SpaceEntry sentry,\r
+                          Resource resource);\r
+\r
+  /**\r
+   * Rename a resource in this resource space.\r
+   * @param sentry The resource space entry.\r
+   * @param oldid The old resorce identifier.\r
+   * @param newid The new resorce identifier.\r
+   */\r
+  public void renameResource(SpaceEntry sentry,\r
+                            String oldid,\r
+                            String newid);\r
+\r
+  /**\r
+   * Delete this resource from the space.\r
+   * @param sentry The resource space entry.\r
+   * @param resource The resource to delete.\r
+   */\r
+  public void deleteResource(SpaceEntry sentry,\r
+                            Resource resource);\r
+\r
+  /**\r
+   * Delete all the children of resource indentified by its\r
+   * space entry.\r
+   * @param sentry The resource space entry\r
+   */\r
+  public void deleteChildren(SpaceEntry sentry);\r
+\r
+  /**\r
+   * Save all the children of the resource indentified by its\r
+   * spaec entry.\r
+   * @param sentry The resource space entry\r
+   */  \r
+  public void saveChildren(SpaceEntry sentry);\r
+\r
+  /**\r
+   * Acquire the children of the resource.\r
+   * @param sentry The resource space entry.\r
+   */\r
+  public void acquireChildren(SpaceEntry sentry);\r
+\r
+  /**\r
+   * acquire children from an external file.\r
+   * @param sentry The resource space entry.\r
+   * @param repository The file used to store children.\r
+   */\r
+  public void acquireChildren(SpaceEntry sentry,\r
+                             File repository,\r
+                             boolean transientFlag);\r
+\r
+  /**\r
+   * Enumerate the name (ie identifiers) of the resource children\r
+   * identified by its space entry.\r
+   * @param sentry The space entry.\r
+   * @return An enumeration, providing one element per child, which is\r
+   * the name of the child, as a String.\r
+   */\r
+  public \r
+  Enumeration enumerateResourceIdentifiers(SpaceEntry sentry);\r
+\r
+}\r