Changeset 24367

Show
Ignore:
Timestamp:
04.08.2011 21:12:12 (8 years ago)
Author:
ak19
Message:

Changes to GLI to do with embedded metadata: the plugin and changes to the processing of ex.metadata to deal with ex.something.metadata

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfigXMLReadWrite.java

    r23680 r24367  
    11381138      value_str = ""; 
    11391139      for (int k=0; k<=values.length-1; k++) { 
    1140         if(values[k].startsWith (StaticStrings.EXTRACTED_NAMESPACE)) { 
     1140        if(values[k].startsWith (StaticStrings.EXTRACTED_NAMESPACE) && values[k].indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    11411141          values[k] = values[k].substring (StaticStrings.EXTRACTED_NAMESPACE.length ()); 
    11421142        } 
     
    12531253    if (name_str != null && name_str.equals (StaticStrings.METADATA_STR)) { 
    12541254                     
    1255       // The metadata argument is the fully qualified name of a metadata element, so if it contains a namespace, remove the extracted metadata namespace as the build process doesn't know about it. 
     1255      // The metadata argument is the fully qualified name of a metadata element, so if it contains a namespace, remove the extracted metadata namespace as the build process doesn't know about it, but ONLY if it is not embedded metadata (e.g. ex.dc.*) 
    12561256      String[] values = value_str.split (StaticStrings.COMMA_CHARACTER); 
    12571257      value_str = ""; 
    12581258      for (int k=0; k<=values.length-1; k++) { 
    1259         if(values[k].startsWith (StaticStrings.EXTRACTED_NAMESPACE)) { 
     1259        if(values[k].startsWith (StaticStrings.EXTRACTED_NAMESPACE) && values[k].indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    12601260          values[k] = values[k].substring (StaticStrings.EXTRACTED_NAMESPACE.length ()); 
    12611261        } 
     
    13831383      String name_str = content_element.getAttribute (StaticStrings.NAME_ATTRIBUTE); 
    13841384             
    1385       if(name_str.startsWith (StaticStrings.EXTRACTED_NAMESPACE)) { 
     1385      if(name_str.startsWith (StaticStrings.EXTRACTED_NAMESPACE) && name_str.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    13861386    name_str = name_str.substring (StaticStrings.EXTRACTED_NAMESPACE.length ()); 
    13871387      } 
     
    14351435      } 
    14361436             
    1437       if(content.startsWith (StaticStrings.EXTRACTED_NAMESPACE)) { 
     1437      if(content.startsWith (StaticStrings.EXTRACTED_NAMESPACE) && content.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    14381438    content = content.substring (StaticStrings.EXTRACTED_NAMESPACE.length ()); 
    14391439      } 
     
    15841584      String meta_name = language_metadata.getAttribute (StaticStrings.NAME_ATTRIBUTE); 
    15851585      Element language_meta = to.createElement (StaticStrings.LANGUAGE_METADATA_ELEMENT_STR); 
    1586       if(meta_name.startsWith (StaticStrings.EXTRACTED_NAMESPACE)) { 
     1586      if(meta_name.startsWith (StaticStrings.EXTRACTED_NAMESPACE) && meta_name.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    15871587    meta_name = meta_name.substring (StaticStrings.EXTRACTED_NAMESPACE.length ()); 
    15881588      } 
     
    16641664    } 
    16651665                 
    1666     if(name_str.startsWith (StaticStrings.EXTRACTED_NAMESPACE)) { 
     1666    if(name_str.startsWith (StaticStrings.EXTRACTED_NAMESPACE) && name_str.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    16671667      name_str = name_str.substring (StaticStrings.EXTRACTED_NAMESPACE.length ()); 
    16681668    } 
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/Index.java

    r12798 r24367  
    166166        if (source_object instanceof MetadataElement) { 
    167167            String full_element_name = ((MetadataElement)source_object).getFullName(); 
    168             if(full_element_name.startsWith(StaticStrings.EXTRACTED_NAMESPACE)) { 
     168            if(full_element_name.startsWith(StaticStrings.EXTRACTED_NAMESPACE) && full_element_name.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    169169               id_buffer.append(full_element_name.substring(StaticStrings.EXTRACTED_NAMESPACE.length())); 
    170170            } 
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/IndexManager.java

    r18886 r24367  
    970970                // Determine the metadatum value 
    971971                String name = source.toString(); 
    972                 if(name.startsWith(StaticStrings.EXTRACTED_NAMESPACE)) { 
     972                if(name.startsWith(StaticStrings.EXTRACTED_NAMESPACE) && name.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    973973                name = name.substring(StaticStrings.EXTRACTED_NAMESPACE.length()); 
    974974                } 
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java

    r22410 r24367  
    119119        if (!plugin.isAbstract()) { 
    120120        String plugin_name = plugin.getName(); 
    121         if (!plugin_name.equals(StaticStrings.ARCPLUG_STR) && !plugin_name.equals(StaticStrings.RECPLUG_STR) && !plugin_name.equals(StaticStrings.METADATAXMLPLUG_STR)) { 
     121        if (!plugin_name.equals(StaticStrings.ARCPLUG_STR) && !plugin_name.equals(StaticStrings.RECPLUG_STR)  
     122            && !plugin_name.equals(StaticStrings.METADATAXMLPLUG_STR) && !plugin_name.equals(StaticStrings.EMBEDMETAPLUG_STR)) { 
    122123          available.add(plugin); 
    123124        } 
     
    725726              remove.setEnabled(false); 
    726727            }  
    727              
     728 
    728729            else { 
    729730              // don't let people remove special plugins such GreenstoneXMLPlug and GreenstoneMETSPlug, 
  • main/trunk/gli/src/org/greenstone/gatherer/collection/LegacyCollectionImporter.java

    r11625 r24367  
    132132    static private String mapLegacyMetadataElementName(String metadata_element_name) 
    133133    { 
    134     // Remove the extracted namespace if it has been added 
    135     if (metadata_element_name.startsWith(StaticStrings.EXTRACTED_NAMESPACE)) { 
     134    // Remove the extracted namespace if it has been added, but only 
     135    // if there are no subsequent namespaces following it (like ex.dc.*) 
     136    // since we want to preserve embedded metadata names as is. 
     137    if (metadata_element_name.startsWith(StaticStrings.EXTRACTED_NAMESPACE) && metadata_element_name.indexOf(StaticStrings.NS_SEP, StaticStrings.EXTRACTED_NAMESPACE.length()) == -1) { 
    136138        metadata_element_name = metadata_element_name.substring(StaticStrings.EXTRACTED_NAMESPACE.length()); 
    137139    } 
  • main/trunk/gli/src/org/greenstone/gatherer/metadata/MetadataElement.java

    r23394 r24367  
    196196 
    197197 
     198    public boolean isGSExtractedMetadataElement() 
     199    { 
     200    return getNamespace().equals(MetadataSetManager.EXTRACTED_METADATA_NAMESPACE); 
     201    } 
     202 
    198203    public boolean isExtractedMetadataElement() 
    199204    { 
    200     return getNamespace().equals(MetadataSetManager.EXTRACTED_METADATA_NAMESPACE); 
    201     } 
     205    return getNamespace().startsWith(MetadataSetManager.EXTRACTED_METADATA_NAMESPACE); 
     206    } 
     207 
    202208 
    203209    public boolean isPredefined() { 
  • main/trunk/gli/src/org/greenstone/gatherer/util/StaticStrings.java

    r22970 r24367  
    9696    static final public String DOCUMENT_STR = "document"; 
    9797    static final public String DOT_CHARACTER = "."; 
     98    static final public String EMBEDMETAPLUG_STR = "EmbeddedMetadataPlugin"; 
    9899    static final public String EMPTY_STR = ""; 
    99100    static final public String ENGLISH_LANGUAGE_STR = "en"; 
     
    156157    static final public String INT_STR = "int"; 
    157158    static final public String IMPORT_STR = "import"; 
    158     static final public String[] KEEP_PLUG = { "GreenstoneXMLPlugin", "GreenstoneMETSPlugin" }; 
     159    static final public String[] KEEP_PLUG = { "GreenstoneXMLPlugin", "GreenstoneMETSPlugin", "EmbeddedMetadataPlugin" }; 
    159160    static final public String LANGUAGE_ARGUMENT = "l="; 
    160161    static final public String LANGUAGE_ATTRIBUTE = "language";