Developer Instructions

Contents:



Requirements

Getting started

MIR uses a repository to manage its source code. Instructions on how to check out the code can be found at the Source Repository page.

Setup

Please have a look at Installation instructions for more informations. For the development we use MCR.DataPrefix=dev. So all configuration is done in the configuration directory named dev-mir.

SOLR

For the development process please use this SOLR-URL:

  MCR.Module-solr.ServerURL=http:\/\/localhost:8291/solr/collection1

You are also required to tell solr where to find its configuration files. You can do so by modifying your Maven settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  ...
  <profiles>
    <profile>
      ...
      <properties>
        <mir.solr.home>${user.home}/.mycore/dev-mir/data/solr</mir.solr.home>
        <mir.solr.data.dir>${user.home}/.mycore/dev-mir/data/solr/data</mir.solr.data.dir>
      </properties>
      ...
    </profile>
  </profiles>
  ...
</settings>

If you are using Windows you need to change the paths to match your installation.

As a quick starting point to configure SOLR you can copy the directory mir-it/src/test/solr to $user.home/.mycore/dev-mir/data/ and overwrite schema.xml and solrconfig.xml with those provided in mir-cli/src/main/config/solr-home/conf.

Hibernate
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

  <session-factory>
    <property name="connection.driver_class">org.h2.Driver</property>
    <property name="connection.url">jdbc:h2:file:/path/to/.mycore/dev-mir/data/h2/mir</property>
    <property name="connection.username">sa</property>
    <property name="connection.password"></property>
    <property name="dialect">org.hibernate.dialect.H2Dialect</property>
    <property name="current_session_context_class">thread</property>
    <property name="cache.use_second_level_cache">false</property>
    <property name="cache.use_query_cache">false</property>
    <property name="current_session_context_class">org.mycore.backend.hibernate.MCRSessionContext</property>
    <property name="jdbc.batch_size">0</property>
    <property name="show_sql">false</property>
  </session-factory>

</hibernate-configuration>

Additionally please store h2.jar in your lib directory under dev-mir.

How to build and start

After you set-up Hibernate and SOLR you can proceed with the Installation instructions to create admin user, add classification and basic ACL rules. Set JAVA_OPTS environment variable to -DMCR.DataPrefix=dev before running the setup script.

Starting up a servlet container in development environment is quite simple:

If you use Linux or Mac OS X you can just enter:

   mvn install -am -pl mir-webapp && mvn -Pdev -Djetty org.codehaus.cargo:cargo-maven2-plugin:run -pl mir-webapp

What it does is that it compiles and bundles all artifacts necessary to run mir-webapp. After that is starts Jetty with a /solr and a /mir application. If you want to test the application with Tomcat instead replace -Djetty by -Dtomcat=8.

The parameter -Pdev triggers the maven profile dev. This activates remote debugging on port 8295 and sets system property MCR.DataPrefix=dev.