Changeset 2663


Ignore:
Timestamp:
03/08/13 09:30:01 (11 years ago)
Author:
keeloo
Message:

Starting working on tests for the VloConfig? class.

Location:
vlo/branches/vlo-2.13-param/vlo_importer
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/DataRoot.java

    r2570 r2663  
    77
    88/**
    9  * Description of the location from which the ingester collects meta data.
     9 * Description of the location from which the importer collects meta data.
    1010 *
    1111 * @author keeloo
    1212 */
    1313@Root // Simple directive
    14 public class DataRoot {
     14public class DataRoot extends Object {
     15   
     16    /**
     17     * Constructor method
     18     */
     19    public DataRoot (){
     20    }
     21   
     22    /**
     23     * Constructor method
     24     *
     25     * @param originName
     26     * @param rootFile
     27     * @param prefix
     28     * @param toStrip
     29     * @param deleteFirst
     30     */
     31    public DataRoot(String originName, File rootFile, String prefix, String toStrip, Boolean deleteFirst) {
     32        this.originName = originName;
     33        this.rootFile = rootFile;
     34        this.prefix = prefix;
     35        this.tostrip = toStrip;
     36        this.deleteFirst = deleteFirst;
     37    }
     38   
     39    /**
     40     *
     41     * @param dataRoot
     42     * @return
     43     */
     44    @Override
     45    public boolean equals (Object object){
     46        boolean equal = false;
     47       
     48        if (object == null) {
     49            // define this object to be different from nothing
     50        } else {
     51            if (! (object instanceof DataRoot)) {
     52                // the object is not a DataRoot, define it not to be equal
     53            } else {
     54                equal = this.originName.equals(((DataRoot) object).originName);
     55                equal = this.rootFile.equals(((DataRoot) object).rootFile) && equal;
     56                equal = this.prefix.equals(((DataRoot) object).prefix) && equal;
     57                equal = this.tostrip.equals(((DataRoot) object).tostrip) && equal;
     58
     59                equal = this.deleteFirst == ((DataRoot) object).deleteFirst && equal;
     60            }
     61        }
     62       
     63        return equal;
     64    }
     65
     66    @Override
     67    public int hashCode() {
     68        int hash = 7;
     69        hash = 29 * hash + (this.originName != null ? this.originName.hashCode() : 0);
     70        hash = 29 * hash + (this.rootFile != null ? this.rootFile.hashCode() : 0);
     71        hash = 29 * hash + (this.prefix != null ? this.prefix.hashCode() : 0);
     72        hash = 29 * hash + (this.tostrip != null ? this.tostrip.hashCode() : 0);
     73        hash = 29 * hash + (this.deleteFirst ? 1 : 0);
     74        return hash;
     75    }
    1576
    1677    /**
     
    2485     *
    2586     * The originName label can be used to reference the records the
    26      * ingester has submitted to the SOLR server.
     87     * importer has submitted to the SOLR server.
    2788     */
    2889    @Element // Simple directive
     
    3091 
    3192    /**
    32      * Meta data to be ingested. The rootFile can take the form of a root CMDI
    33      * file, a file for which the ingester will follow the links defined in it.
    34      * It can also be a directory with .xml and or .cmdi files to be ingested.
    35      * The ingester will process the directories recursively.
     93     * Meta data to be imported. The rootFile can take the form of a root CMDI
     94     * file, a file for which the importer will follow the links defined in it.
     95     * It can also be a directory with .xml and or .cmdi files to be imported.
     96     * The importer will process the directories recursively.
    3697     *   
    3798     * Example:
     
    58119     *
    59120     * If you remove toStrip from rootFile, and append the result to the prefix,
    60      * you get the URL at which the ingester looks for files. In the case of the
     121     * you get the URL at which the importer looks for files. In the case of the
    61122     * examples this would be the result:
    62123     *
     
    73134    @Element
    74135    private boolean deleteFirst = false;
    75    
    76    
    77     /**
    78      * Remove the get and set methods declared below one by one.
    79      */
    80136
    81137    public String getPrefix() {
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java

    r2661 r2663  
    274274
    275275    /**
     276     * Get the value of the deleteAllFirst parameter<br><br>
     277     *
     278     * For a description of the parameter, refer to the general VLO
     279     * documentation.
     280     *
     281     * @return the value
     282     */
     283    public static boolean deleteAllFirst() {
     284        return deleteAllFirst;
     285    }
     286
     287        /**
    276288     * Set the value of the deleteAllFirst parameter<br><br>
    277289     *
     
    286298
    287299    /**
    288      * Get the value of the deleteAllFirst parameter<br><br>
    289      *
    290      * For a description of the parameter, refer to the general VLO
    291      * documentation.
    292      *
    293      * @return the value
    294      */
    295     public static boolean isDeleteAllFirst() {
    296         return deleteAllFirst;
    297     }
    298 
     300     * Get the value of the printMapping parameter<br><br>
     301     *
     302     * For a description of the parameter, refer to the general VLO
     303     * documentation.
     304     *
     305     * @return the value
     306     */
     307    public static boolean printMapping() {
     308        return printMapping;
     309    }
     310   
    299311    /**
    300312     * Set the value of the printMapping parameter<br><br>
     
    309321    }
    310322
    311     /**
    312      * Get the value of the printMapping parameter<br><br>
    313      *
    314      * For a description of the parameter, refer to the general VLO
    315      * documentation.
    316      *
    317      * @return the value
    318      */
    319     public static boolean isPrintMapping() {
    320         return printMapping;
    321     }
    322    
    323323    /**
    324324     * Get the value of the VloHomeLink parameter<br><br>
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r2660 r2663  
    115115        try {
    116116            // Delete the whole Solr db
    117             if (VloConfig.isDeleteAllFirst()) {
     117            if (VloConfig.deleteAllFirst()) {
    118118                LOG.info("Deleting original data...");
    119119                solrServer.deleteByQuery("*:*");
     
    412412                // finished importing
    413413               
    414                 if (VloConfig.isPrintMapping()) {
     414                if (VloConfig.printMapping()) {
    415415                    File file = new File("xsdMapping.txt");
    416416                    FacetMappingFactory.printMapping(file);
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/resources/VloConfig.xml

    r2657 r2663  
    3131    </dataRoots>
    3232   
     33    <vloHomeLink>http://www.clarin.eu/vlo</vloHomeLink>
     34   
    3335    <solrUrl>http://localhost:8084/vlo_solr/</solrUrl>
    34    
    35     <vloHomeLink>http://www.clarin.eu/vlo</vloHomeLink>
    3636   
    3737    <profileSchemaUrl>http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/{PROFILE_ID}/xsd</profileSchemaUrl>
  • vlo/branches/vlo-2.13-param/vlo_importer/xsdMapping.txt

    r2661 r2663  
    1 This file is generated on Mar 7, 2013 12:22:39 PM and only used to document the mapping.
     1This file is generated on Mar 8, 2013 10:12:39 AM and only used to document the mapping.
    22This file contains xsd name and a list of conceptName with xpath mappings that are generated.
    33---------------------
    4 http://www.openarchives.org/OAI/2.0/oai_dc.xsd
    5 FacetName:id
    6 Mappings:
    7     /c:CMD/c:Header/c:MdSelfLink/text()
    8 FacetName:collection
    9 Mappings:
    10     /c:CMD/c:Header/c:MdCollectionDisplayName/text()
    11 FacetName:name
    12 Mappings:
    13     /c:CMD/c:Components/c:LrtInventoryResource/c:LrtCommon/c:ResourceName/text()
    14 FacetName:country
    15 Mappings:
    16     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:spatial[@dcterms-type="ISO3166"]/text()
    17     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:coverage[@dcterms-type="ISO3166"]/text()
    18 FacetName:language
    19 Mappings:
    20     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:language/@olac-language
    21     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:subject/@olac-language
    22     /c:CMD/c:Components/c:LrtInventoryResource/c:LrtCommon/c:Languages/c:ISO639/c:iso-639-3-code/text()
    23 FacetName:languages
    24 Mappings:
    25     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:language/@olac-language
    26     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:subject/@olac-language
    27     /c:CMD/c:Components/c:LrtInventoryResource/c:LrtCommon/c:Languages/c:ISO639/c:iso-639-3-code/text()
    28 FacetName:genre
    29 Mappings:
    30     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:type/@olac-linguistic-type
    31 FacetName:subject
    32 Mappings:
    33     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:subject/@olac-linguistic-field
    34     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:subject[@dcterms-type="LCSH"]/text()
    35 FacetName:resourceType
    36 Mappings:
    37     /c:CMD/c:Components/c:LrtInventoryResource/c:LrtCommon/c:ResourceType/text()
    38     /c:CMD/c:Components/c:OLAC-DcmiTerms/c:type/text()
    39 FacetName:nationalProject
    40 Mappings:
    41     /c:CMD/c:Header/c:MdCollectionDisplayName/text()
    42 FacetName:text
    43 Mappings:
    44     /c:CMD//text()
    45 FacetName:_componentProfile
    46 Mappings:
    47     /c:CMD/c:Header/c:MdProfile/text()
    48 ---------------------
Note: See TracChangeset for help on using the changeset viewer.