Changeset 5305


Ignore:
Timestamp:
2003-08-27T15:18:30+12:00 (21 years ago)
Author:
jmt12
Message:

Codec

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/msm/GDMDocument.java

    r5164 r5305  
    7777    /** Add this metadata to the named file. There is one tricky thing to consider. Whenever a metadata entry is added it is taken to be accumulating except if it is the first added, in which case it overwrites! */
    7878    public void addMetadata(String filename, Metadata metadata) {
    79     ///ystem.err.println("Add '" + metadata + "' to " + (filename != null ? filename : "directory."));
     79    Gatherer.println("Add '" + metadata + "' to " + (filename != null ? filename : "directory."));
    8080    try {
    8181        // Retrieve the document element.
     
    179179        metadata_element.setAttribute(MODE_ATTRIBUTE, ACCUMULATE);
    180180        }
    181                 // As we can't possibly store all the metadata in memory, nor can we ensure that the indexes written to file remain the same until the new time we look at this file, and to avoid having to open a rewrite every collection document whenever any value tree changes, I'm adding a new attribute called hvalue which indicates the hierarchy value path as a '\' separated string.
     181        // As we can't possibly store all the metadata in memory, nor can we ensure that the indexes written to file remain the same until the new time we look at this file, and to avoid having to open a rewrite every collection document whenever any value tree changes, I'm adding a new attribute called hvalue which indicates the hierarchy value path as a '\\' separated string.
    182182        GValueModel model = Gatherer.c_man.getCollection().msm.getValueTree(metadata.getElement());
    183183        if(model != null && model.isHierarchy()) {
    184         metadata_element.setAttribute(HVALUE_ATTRIBUTE, metadata.getValueNode().getFullPath());
    185         }
    186         metadata_element.appendChild(base_document.createTextNode(metadata.getAbsoluteValue()));
     184        metadata_element.setAttribute(HVALUE_ATTRIBUTE, metadata.getValueNode().getFullPath(false));
     185        }
     186        String node_value = metadata.getAbsoluteValue();
     187        metadata_element.appendChild(base_document.createTextNode(node_value));
    187188        // Retrieve the first description element for this fileset (there should only be one, but I'll play it safe).
    188189        NodeList description_elements = fileset_element.getElementsByTagName("Description");
     
    298299                    metadata = new Metadata(element, value);
    299300                    GDMManager.metadata_cache.put(raw_element, raw_value, metadata);
    300                     ///ystem.err.println("Added metadata to cache: " + raw_element + " -> " + raw_value + "\n");
     301                    ///ystem.err.println("Added metadata to cache: " + raw_element + " -> " + raw_value + "\n");
    301302                    value = null;
    302303                    element = null;
  • trunk/gli/src/org/greenstone/gatherer/msm/Metadata.java

    r5164 r5305  
    125125    if(model != null && model.isHierarchy()) {
    126126        if(value != null) {
    127         abs_value = value.getFullPath();
     127        abs_value = value.getFullPath(false);
    128128        }
    129129        abs_value = model.getHIndex(abs_value);
  • trunk/gli/src/org/greenstone/gatherer/msm/MetadataSetManager.java

    r5213 r5305  
    342342           || (mds.getNamespace().equals(Utility.EXTRACTED_METADATA_NAMESPACE) && mds.getNamespace().equals(HIDDEN) && all)) {
    343343        NodeList set_elements = mds.getElements();
    344         System.err.println("The set " + mds + " has " + set_elements.getLength() + " elements.");
     344        ///ystem.err.println("The set " + mds + " has " + set_elements.getLength() + " elements.");
    345345        for(int i = 0; i < set_elements.getLength(); i++) {
    346346            Element raw_element = (Element)set_elements.item(i);
  • trunk/gli/src/org/greenstone/gatherer/util/HashMap3D.java

    r4887 r5305  
    130130        }
    131131        element_name = null;
    132                 // Locate the appropriate metadata
    133         String value_name = metadata.getValueNode().getFullPath();
     132        // Locate the appropriate metadata
     133        String value_name = metadata.getValueNode().getFullPath(false);
    134134        result = (Metadata) inner_mapping.get(value_name);
    135135        if(result == null) {
  • trunk/gli/src/org/greenstone/gatherer/util/MetadataXML.java

    r5174 r5305  
    157157        GValueNode node = (GValueNode)all_values.get(i);
    158158        TreePath path = new TreePath(node.getPath());
    159         String value = node.getFullPath(); // formatPath(null, path, true);
     159        String value = node.getFullPath(false);
    160160        String index = model.getHIndex(value);
    161161        String alias = node.getAlias(index);
    162         if(value.indexOf("\\") != -1) {
    163             value = value.substring(value.lastIndexOf("\\") + 1);
     162        if(value.indexOf(GValueModel.PATH_SEP) != -1) {
     163            value = value.substring(value.lastIndexOf(GValueModel.PATH_SEP) + GValueModel.PATH_SEP.length());
    164164        }
    165165        write(bw, index + "\t\"" + alias + "\"\t\"" + Utility.stripNL(value) + "\"");
Note: See TracChangeset for help on using the changeset viewer.