Changeset 2677


Ignore:
Timestamp:
03/12/13 13:44:04 (11 years ago)
Author:
keeloo
Message:

Repaired command line parsing, improved the
DataRoot? class annotation, modified context files as a result of
running tests. Added an instruction for installing.

Location:
vlo/branches/vlo-2.13-param
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-2.13-param/vlo_importer/nbactions.xml

    r2641 r2677  
    88            </goals>
    99            <properties>
    10                 <exec.args>-classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter -c /Users/keeloo/VloConfig.xml</exec.args>
     10                <exec.args>-DconfigFile=/Users/keeloo/VloConfig.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
    1111                <exec.executable>java</exec.executable>
    1212                <exec.classpathScope>runtime</exec.classpathScope>
     
    2020            </goals>
    2121            <properties>
    22                 <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter -c /Users/keeloo/VloConfig.xml</exec.args>
     22                <exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -DconfigFile=/Users/keeloo/VloConfig.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
    2323                <exec.executable>java</exec.executable>
    2424                <exec.classpathScope>runtime</exec.classpathScope>
     
    3333            </goals>
    3434            <properties>
    35                 <exec.args>${profiler.args} -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter -c /Users/keeloo/VloConfig.xml</exec.args>
     35                <exec.args>${profiler.args} -DconfigFile=/Users/keeloo/VloConfig.xml -classpath %classpath eu.clarin.cmdi.vlo.importer.MetadataImporter</exec.args>
    3636                <exec.executable>${profiler.java}</exec.executable>
    3737            </properties>
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/DataRoot.java

    r2663 r2677  
    77
    88/**
    9  * Description of the location from which the importer collects meta data.
     9 * A dataRoot describes the met data sources.
    1010 *
     11 * In an XML file, a dataRoot is reflected like this:<br><br>
     12 *
     13 * {@literal <DataRoot>}
     14 *      {@literal<originName>}name{@literal</originName>}
     15 *      {@literal<rootFile>}topLevelMetadataDirectory/{@literal</rootFile>}
     16 *      {@literal<prefix>}startOfUrl{@literal</prefix>}
     17 *      {@literal<tostrip>}leftPartOfRootFile{@literal</tostrip>}
     18 *      {@literal<deleteFirst>}falseOrTrue{@literal</deleteFirst>}
     19 * {@literal</DataRoot>}
     20 * 
    1121 * @author keeloo
    1222 */
     
    2333     * Constructor method
    2434     *
    25      * @param originName
    26      * @param rootFile
    27      * @param prefix
    28      * @param toStrip
     35     * @param originName name describing the meta data
     36     * @param rootFile top level directory in which the meta data is stored
     37     * @param prefix left part of the rootFile
     38     * @param toStrip if you want to create the URL to the meta data, this is
     39     * the part to be removed from the rootFile
    2940     * @param deleteFirst
    3041     */
     
    3849   
    3950    /**
    40      *
     51     * Test for equality of the object itself and the object passed to it
     52     *
    4153     * @param dataRoot
    42      * @return
     54     * @return true if the object equals this, false otherwise
    4355     */
    4456    @Override
     
    6476    }
    6577
     78    /**
     79     * Generate by the ide
     80     *
     81     * @return hash code
     82     */
    6683    @Override
    6784    public int hashCode() {
     
    7693
    7794    /**
    78      * Label of the data root. For example
    79      *
    80      * "MPI CMDIfied IMDI archive"
    81      *
    82      * or
    83      *
    84      * "LRT Inventory"
    85      *
    86      * The originName label can be used to reference the records the
    87      * importer has submitted to the SOLR server.
     95     * name describing the meta data
    8896     */
    8997    @Element // Simple directive
     
    9199 
    92100    /**
    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.
    97      *   
    98      * Example:
    99      *
    100      * /lat/apache/htdocs/oai-harvester/mpi-self-harvest/harvested/results/cmdi/
    101      *
    102      * Normally, rootFile resides under a web server.
     101     * top level directory in which the meta data is stored
    103102     */
    104103    @Element
     
    114113
    115114    /**
    116      * Filesystem equivalent of the prefix. For example:
    117      *
    118      * http://catalog.clarin.eu/
    119      *
    120      * If you remove toStrip from rootFile, and append the result to the prefix,
    121      * you get the URL at which the importer looks for files. In the case of the
    122      * examples this would be the result:
    123      *
    124      * http://catalog.clarin.eu/oai-harvester/mpi-self-harvest/harvested/results/cmdi/
     115     * Left part of the rootFile
     116     *
     117     * By first removing {@literal tostrip} from {@literal rootFile} and then
     118     * append the result of that operation to the {@literal prefix} you obtain
     119     * the URL to the meta data.
    125120     */
    126121    @Element
    127     private String tostrip; // refactor this to toStrip
    128    
    129     /**
    130      * Flag to signal the removal of records SOLR server. This flag overrides
    131      * the flag in the VLOConfig class. The deleteFirst flag controls the
     122    private String tostrip;
     123   
     124    /**
     125     * Flag to signal the removal of records from the Solr server
     126     *
     127     * The value of this flag overrides the value defined in the {@lieteral
     128     * VloConfig.xml} file. With the deleteFirst flag you can control the
    132129     * removal of the records originating from originName.
    133130     */
     
    135132    private boolean deleteFirst = false;
    136133
     134    /**
     135     * Get the value of the prefix element<br><br>
     136     *
     137     * For a description of the element, refer to the general VLO
     138     * documentation.
     139     *
     140     * @return the value
     141     */
    137142    public String getPrefix() {
    138143        return prefix;
    139144    }
    140145
     146    /**
     147     * Set the value of the prefix element<br><br>
     148     *
     149     * For a description of the element, refer to the general VLO
     150     * documentation.
     151     *
     152     * @param prefix the value
     153     */
    141154    public void setPrefix(String prefix) {
    142155        this.prefix = prefix;
    143156    }
    144157
    145     public String getTostrip() {
     158    /**
     159     * Get the value of the {@literal tostrip} element<br><br>
     160     *
     161     * For a description of the element, refer to the general VLO
     162     * documentation.
     163     *
     164     * @return the value
     165     */
     166    public String getToStrip() {
    146167        return tostrip;
    147168    }
    148169
     170    /**
     171     * Set the value of the {@literal tostrip} element<br><br>
     172     *
     173     * For a description of the element, refer to the general VLO
     174     * documentation.
     175     *
     176     * @param tostrip the value
     177     */
    149178    public void setTostrip(String tostrip) {
    150179        this.tostrip = tostrip;
    151180    }
    152181
     182    /**
     183     * Get the value of the originName element<br><br>
     184     *
     185     * For a description of the element, refer to the general VLO
     186     * documentation.
     187     *
     188     * @return the value
     189     */   
    153190    public String getOriginName() {
    154191        return originName;
    155192    }
    156193
     194    /**
     195     * Set the value of the originName element<br><br>
     196     *
     197     * For a description of the element, refer to the general VLO
     198     * documentation.
     199     *
     200     * @param originName the value
     201     */   
    157202    public void setOriginName(String originName) {
    158203        this.originName = originName;
    159204    }
    160205
     206    /**
     207     * Get the value of the rootFile element<br><br>
     208     *
     209     * For a description of the element, refer to the general VLO
     210     * documentation.
     211     *
     212     * @return the value
     213     */   
    161214    public File getRootFile() {
    162215        return rootFile;
    163216    }
    164217
     218    /**
     219     * Set the value of the rootFile element<br><br>
     220     *
     221     * For a description of the element, refer to the general VLO
     222     * documentation.
     223     *
     224     * @param rootFile the value
     225     */   
    165226    public void setRootFile(File rootFile) {
    166227        this.rootFile = rootFile;
    167228    }
    168229
     230    /**
     231     * Set the value of the deleteFirst element<br><br>
     232     *
     233     * For a description of the element, refer to the general VLO
     234     * documentation.
     235     *
     236     * @param deleteFirst the value
     237     */   
    169238    public void setDeleteFirst(boolean deleteFirst) {
    170239        this.deleteFirst = deleteFirst;
    171240    }
    172241
    173     public boolean isDeleteFirst() {
     242    /**
     243     * Get the value of the deleteFirst element<br><br>
     244     *
     245     * For a description of the element, refer to the general VLO
     246     * documentation.
     247     *
     248     * @return the value
     249     */   
     250    public boolean deleteFirst() {
    174251        return deleteFirst;
    175252    }
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java

    r2663 r2677  
    1010import org.slf4j.LoggerFactory;
    1111
    12 
    13     /**
    14 
    15      */
    16 
    1712/**
    1813 * VLO configuration<br><br>
    1914 *
    2015 * The annotated members in this class are the parameters by means of which
    21  * you can configure a VLO application like for example the VLO importer or
    22  * the VLO web application.
    23  *
    24  * A member is annotated by prepending {@literal @element}. When the VloConfig
    25  * class is reflected into the Simple framework, the framework will assign the
    26  * values it finds in the VloConfig.xml file to the members in the VloConfig
    27  * class.
     16 * you can configure a VLO application.
     17 *
     18 * A member is annotated by prepending {@literal @element} to it. When the
     19 * VloConfig class is reflected into the Simple framework, the framework will
     20 * assign the values it finds in the {@literal VloConfig.xml} file to the
     21 * members in the VloConfig class.
    2822 *
    2923 * Whenever you need to add a parameter the VLO configuration, add a member
     
    3125 * declaration, like this:
    3226 *
    33  * {@literal @element}<br> {@literal parameterMember}<br><br>
     27 * {@literal @element}<br><br>
     28 * {@literal parameterMember}<br><br>
    3429 *
    3530 * The XML should in this case contain a definition like
     
    4035 * If you want to add a type of member that is not included in VloConfig class
    4136 * yet, or if you are looking for more information on the framework, please
    42  * refer to <url> <br><br>
     37 * refer to VLO documentation.<br><br>
    4338 *
    4439 * In the VloConfig class, the parameters are stored statically. This means that
     
    5146 * {@literal WebAppConfig.getSomeParameter();}<br><br>
    5247 *
    53  * in any scope, also the scope from which the read message was send.
    54  *
    55  *
    56  *
    57  * Move the following remarks to a general remark in the class description, a
    58  * remark indicating what you could do if you do not want to use the packaged
    59  * configuration.
    60  *
    61  *
    62  * Here, modifications of the parameters inspired on the difference
    63  * in context can be made.
    64  *
    65  * A web application can serve as a typical example of a difference in context:
    66  * the application itself runs in a web server container, while the tests
    67  * associated with the web application will be run outside this container. *
    68  *
    69  *
     48 * in any scope, also a scope different from the one in which the read message
     49 * was send.
    7050 *
    7151 * Through the get and set methods, the application is indifferent to the origin
     
    285265    }
    286266
    287         /**
     267    /**
    288268     * Set the value of the deleteAllFirst parameter<br><br>
    289269     *
     
    363343     * documentation.
    364344     *
    365      * @param url the parameter
     345     * @param url the value
    366346     */
    367347    public static void setSolrUrl(String param) {
  • vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java

    r2668 r2677  
    123123            for (DataRoot dataRoot : dataRoots) {
    124124                LOG.info("Start of processing: " + dataRoot.getOriginName());
    125                 if (dataRoot.isDeleteFirst()) {
     125                if (dataRoot.deleteFirst()) {
    126126                    LOG.info("Deleting data for data provider: " + dataRoot.getOriginName());
    127127                    solrServer.deleteByQuery(FacetConstants.FIELD_DATA_PROVIDER + ":" + ClientUtils.escapeQueryChars(dataRoot.getOriginName()));
     
    291291        //System.out.println(dataOrigin.getTostrip().length());
    292292        //System.out.println(file.getAbsolutePath());
    293         metadataSourceUrl += file.getAbsolutePath().substring(dataOrigin.getTostrip().length());
     293        metadataSourceUrl += file.getAbsolutePath().substring(dataOrigin.getToStrip().length());
    294294
    295295        solrDocument.addField(FacetConstants.FIELD_COMPLETE_METADATA, metadataSourceUrl);
     
    413413            LOG.error(message);
    414414            System.err.println(message);
     415        }
     416       
     417        if (configFile == null){
     418
     419            String message;
     420
     421            message = "Could not get configuration file name via the command line.";
     422            LOG.error(message);
    415423           
    416424            String key;
     425
    417426            key = "configFile";
    418427            configFile = System.getProperty(key);
    419428        }
    420            
     429
    421430        if (configFile == null) {
    422431           
    423432            String message;
    424433           
    425             message = "Could not get filename as system property either.";
     434            message = "Could not get filename as system property either - stopping.";
    426435            LOG.error(message);
    427             System.err.println(message);
    428436        } else {
    429437            // read the configuration from the externally supplied file
  • vlo/branches/vlo-2.13-param/vlo_solr/src/main/webapp/META-INF/context.xml

    r2628 r2677  
    11<?xml version="1.0" encoding="utf-8"?>
    22
    3 <!-- Solr context file
    43
    5 solr/home : the directory in which the solr server will store it's data
     4<!-- Solr server context file
     5
     6path : solr server context path. If u is the url of the web server, the solr
     7server will be reachable at u/path
     8
     9solr/home : the top level directory which is created on unpacking the solr
     10server war file. The solr server will store it's data in the tree starting at
     11this directory.
    612
    713Please refer to http://wiki.apache.org/solr for more information on how the
    8 solr server should be configured. The war should be unpacked in the docBase
    9 directory.
     14solr server should be configured. 
    1015
    1116-->
     17
     18
    1219
    1320<Context path="/vlo_solr" debug="0" crossContext="true">
  • vlo/branches/vlo-2.13-param/vlo_web_app/src/main/webapp/META-INF/context.xml

    r2641 r2677  
    11<?xml version="1.0" encoding="UTF-8"?>
     2
    23<!-- VLO application context file
    34
    4 explain about how the configurtion works
     5path : web application context path. If u is the url of the web server, the web
     6application will be reachable at u/path
     7
     8externalConfig : the path to an external configuration file. In this file you
     9can set the value of the VLO parameters.
     10
     11The specification of an external configuration file is optional. If you do not
     12specify one, the VLO web application will use the packaged parameters. This will
     13only be usefull when the application is run from within a development
     14environment.
     15
     16In a VLO configuration file, among others, you need to define the value of the
     17solrUrl parameter. You can override this value by defining it in the context
     18fragement directly. This is not obligatory however.
     19
     20For more information on the meaning and purpose of the VLO parameters, please
     21refer to the documentation.
    522
    623-->
Note: See TracChangeset for help on using the changeset viewer.