== Instructions - How to Start with Development == The application and it's build process is OK with GNU/Linux, Microsoft Windows and other operating systems. == Setting up Java Development Kit (JDK) == The application is coded in the Java programming language, so you will need the tools that are part of a recent JDK. The recommended IDE is Eclipse, which also uses Java. If you want you can run Eclipse in one version of Java, and compile and run the application with another version of Java, but it is not necessary. ==== Installation ==== The application has been tested with: * Open JDK 7 * Oracle JDK 8 (http://www.oracle.com/technetwork/java/javase/downloads/index.html). We recommend going the 8 route due to planned upgrades of the code base in the near future. So, download the JDK version that you prefer and install it. NOTE: Check if you already have some other Java or JDK versions. If you use built-in packages and package managers in some operating systems, the JDK version might be old, and if you try to install a new version alongside an old one, you might get a conflict when using the default installation options. If you don't need both versions, uninstall the old one before installing the new one. If you do need both version, install the new one in a different path. It is possible to switch between the two afterwards. ==== Configuring in Windows ==== * Set up system variable JAVA_HOME to the absolute path to the main directory where you installed the JDK * Set up system variable PATH to the absolute path of the bin directory inside the JDK or %JAVA_HOME%\bin * For 64-bit operating systems, both 64-bit and 32-bit JDK versions should be installed [[Image(1.jpg)]] * Check installation in command shell {{{ javac -version }}} you should get the version of the installed java compiler ---- == Download and setup Eclipse IDE == - Download Eclipse (there are many versions - you can use the Eclipse IDE for Java Developers as a basic installation, but Eclipse IDE or Java EE Developers is the recommended choice because the packages for Web Development (WTP) are preinstalled. - Best way is to download a ZIP or TGZ version and just unpack it in the folder of your choice === Before running Eclipse === Make sure that Eclipse uses the JDK version that you installed for this, and not some other one. The instructions are given here: http://wiki.eclipse.org/Eclipse.ini NOTE: If you have problem in the future with the memory for recompilation being full too often it might be beneficial to increase some of the default values in this file (PermGen). Check the instructions at the bottom. Then you can start Eclipse IDE === Install the Maven and Subversion support in Eclipse === The application is built using Maven, so you need the maven integrated in the Eclipse IDE. In all late versions of Eclipse, Maven integration is built-in. For older version of Eclipse you would have to install the m2eclipse plugin from the following update address - [http://m2eclipse.sonatype.org/sites/m2e] (In Eclipse -> Help -> Install New Software , you will add the address and available packages will showup, please add everything becides AJDT and WTP that depend on other plugins) The application source is managed in a central subversion repository, so you need a SVN integration in Eclipse to access this repository and commit new versions of the code. You can find such integration plugins in the Eclipse Marketplace. There are two main such plugins and we have used them both in the past: * Subversive team provider (recommended) * Subclipse If you use Subversive, after the installation and restart of Eclipse it will ask to download and install a SVN connector, there are two options: * SVN Kit based that are pure Java and work everywhere - recommended - choose the latest version * JavaHL which are compiled with native code for the operating system and can run faster in some occasions/ == Download the project source code and setup a project == === Setup the subversion source code location === Change the Eclipse IDE perspective to the SVN Repository. Create a new SVN Repository location, pointing to https://develop.finki.ukim.mk/svn/isis You will then be able to view the contents of the repository. The main and latest source code is in the folder "trunk". Right click on trunk and choose "Checkout". This means that you will get a version of the source code out of the repository for you to work on. It will be automatically downloaded and setup as a new project with the name "isis". If you create modifications to the source code in this project, you will be able to check them in with the subversion Commit command. Switch back to the Java perspective. Maven should be setup automatically and is supposed to download all necessary files needed to run the application that are listed in the pom.xml (this might actually take very very long depending on the internet connection speed ). === Eclipse JDK and JRE setup for the project === - In Eclipse open Window -> Preferences -> Java -> Installed JREs Delete the old record and add a new one that points to the JDK (and not JRE) as in the image [[Image(2.jpg)]] - After this create a Shortcut to Eclipse.exe anywhere you like, right click the shortcut, and in the Target textbox add: ''-vm "C:\Program Files (x86)\Java\jdk1.6.0_16\bin"'' This is supposed to be the path to the JDK/bin folder. (on 64-bit operating systems the path in the –VM argument should point to a 32-bit JDK) With these two steps Eclipse will start and won't show a maven related warning. For a linux installation everything is the same just a different path. Before running or building the project, several local parameters should be set. This is done via a standard way of maven profiles, so you should open/create a file named '''settings.xml''' in the '''.m2''' directory in your main OS user profile directory. If you don't know where this is - check Eclipse preferences - maven - user settings. Sample maven settings.xml file: {{{ develop env develop ??????? ???????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? ?????????? }}} You can create several profiles in this file, with different id and activation parameters, so that you can use choose the one you want on running the application, or packaging for deployment. Contact the developer team for parameter values for the development test servers. Otherwise install PostgreSQL, setup a username, password and create a UTF-8 database, and set the '''hbm2ddlauto''' parameter to '''update''', and the database schema structure will be automatically created. With hbm2ddlauto=update used, enables updates to the database schema structure when the Java source code of the Entities changes, otherwise the default value of this parameter is '''validate'''. More precisely this parameter designates that the database will be scanned and if the source code has structural changes, such changes will be automatically implemented in the database schema. This should be only used by intenet and it should not be left as default as unwanted changes could be commited to the database by mistake without a warning. So set this to update only when you are about to make database structure changes and then change it back to validate, which only checks that the source and the schema correspond. If you use another database system then hibernate.dialect should be changed, '''but this is not tested'''. '''CAS (CENTRAL AUTHENTICATION SERVICE)''' If you already have a CAS server, change the paths in the settings.xml file. If you need a test CAS server, follow the procedure. - Download any of the 3.5.x CAS versions from [http://downloads.jasig.org/cas/] and unpack it. - Find the file named CAS-server-webapp-versionnumber.war and copy it to the main folder of the Eclipse project and rename it to cas.war This will enable a test login to the system, whereas the username is anything you need, and the password is the same as the username. '''Start the application from Eclipse'''[[BR]] Run -> Run Configurations , then in the maven section right click then New, use any Name you like (for example '''start dossier'''), Base Directory -> ${workspace_loc:/projectname} , Goals -> '''clean jetty:run''' In the parameter add one with the name of '''env''', and value of '''develop'''. Repeat this again all the same but with a Name '''stop app''' and Goals '''jetty:stop''' It should look like this:[[BR]] [[Image(10.jpg)]] Click on Run and the application will begin to build. Note that on the first run, Maven will try to download all required libraries for development from the Internet and setup the library paths for all dependencies. This can take a very long time if your connection is not fast. On subsequent runs, this will not happed, but Maven tries to check for changes. If you want to speed up the process, after everything has been run without problems at least once, you should check the parameter '''Offline''' in the Maven parameters for that run configuration. The system listens on port 8081 (Jetty on 8081) http://localhost:8081/ '''Note:''' - in log4j.properties in the application folder src/main/resources one should change the line log4j.appender.R.File=/upisi.log or log4j.appender.R.File=/home/username/upisi.log or a location where the user running eclipse has write permission and where the logs should reside. [[wiki:WikiStart Back]]