Getting Started - Joe23/capelin-opac GitHub Wiki

Introduction

This document assume you have experience on JEE which includes Java Servlet Container, IDE, SVN, Spring Framework, and Hibernate, DWR remote, JSP, Ant, and etc.

The IDE used for development by author is Eclipse; The application is build with ant; Tested in tomcat 6.

Getting Start

1. Try it

Google Capelin OPAC, you will find one or two applications that uses it. Take a look at their installation and get feel what it does.

2. Develop your own.

The next thing is to develop your own bibliographic search. This will working on the SVN source.

As a beginner, it is recommend to start with capelin-mvc.

Checkout the capelin-mvc and drop the released JAR file and all dependency libraries to the capelin-mvc/WebContent/WEB-INF/lib and load those into your IDE (Eclipse I prefer).

Alternatively, if you are more familiar with JEE development, ant and etc. Here are step of work with svn. Assume the JAVA_HOME ANT_HOME are set up correctly.

    mkdir workspace
    cd workspace
    # checkout all code
    svn co http://capline-opac.googlecode.com/svn/trunk capelin-opac
    # grap ivy and other dependencies from maven.
    ant -f init.xml    
    cd capelin-opac
    ant war

you should get the war file at workspace/dist/ which should be the same as you download from this site.

2.1 Change databases

DB configuration file is at capelin-mvc/WebContent/WEB-INF/conf/capelin-spring-hbcfg.xml. Please follow ReleaseFirstVersion

Then you are recommended to deploy it to your Servlet Container and test if all environment variables are setup correctly and data are persistent.

2.2 Import data

In capelin-mvc, package sample.capelin.mvc.samplecatalog is designed for user to follow. It is re-licences as GNU GPL. If you have background of Spring and Hibernate, this should be very easy to follow.

2.2.1 Record

This is the Model in the MVC. Please follow capelin-mvc/src/sample/capelin/mvc/samplecatalog/SampleMVCRecord.java

Also remember to change capelin-mvc/src/sample-capelin.hbm.xml if you write your own.

2.2.2 Importer There are two format that Capelin OPAC can import from, MARC and CSV.

2.2.2.1 Marc importer

Before import record, it is recommended to see what marc fields is used in the file, you can follow capelin-mvc/src/sample/capelin/mvc/samplecatalog/SampleMVCImporterDemo.java to display all fields in your marc file.

Then you can follow capelin-mvc/src/sample/capelin/mvc/samplecatalog/SampleMVCImporter.java to import.

Please check if the path are match your environment in capelin-mvc/src/org/capelin/mvc/utils/CapelinSpringContext.java before start importing.

You could run java run inside eclipse to do the import.

2.2.2.2 CSV importer

    public class YourImporter extends  org.capelin.transaction.utils.TXCSVRecordImporter{

        @Override
        protected void setUp() throws IOException {
                input = new FileReader("path/to/file");
                sf = ((HibernateTransactionManager) SpringContext
                                .getBeanFactory().getBean("txManager")).getSessionFactory();
        }

        @Override
        public CapelinRecord buildRecord(String[] data) {
                YourRecord r = new YourRecord();
                r.setTitle(data[3]);
                r.setDate(data[19]);
                r.setVolume(data[21]);
                ....
                return r;
        }

    }

Rest are the same as MARC importer.

2.2.3 MVC Controller Follow the capelin-mvc/src/sample/capelin/mvc/samplecatalog/SampleRecordController.java Most of methods are inheritance.

2.3 Change Look and Feels Look and feel are using JSP CSS and javascript. The new version in plan (0.4.0.0) will use AJAX (DWR remote) and JQuery.

Since 0.1 Capelin OPAC is using tiles for layout, you can file configuration files at

    capelin-mvc/WebContent/WEB-INF/conf/capelin-tiles-defs.xml
    capelin-mvc/WebContent/WEB-INF/templates/*
    Individual JSPs are located at capelin-mvc/WebContent/WEB-INF/jsp/sample/