User Tools

Site Tools


magik-demo:developer:magik-project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
magik-demo:developer:magik-project [2013/05/14 20:33]
admin
magik-demo:developer:magik-project [2017/07/06 15:24] (current)
Line 1: Line 1:
 +{{:​magik-demo:​magik_logo.png?​nolink&​500|}}
 +
 +====== MAGIK Project ======
 +
 This document describes how to manipulate with MAGIK project. \\ This document describes how to manipulate with MAGIK project. \\
 In particular how to:  In particular how to: 
-  * [[#Install ​MAGIK]] +  * [[#Deploy ​MAGIK on Server or Localhost]]
-    * [[#​Download|Download]] +
-    * [[#​Install|Installation]]+
   * [[#Import MAGIK Project in Eclipse]]   * [[#Import MAGIK Project in Eclipse]]
   * [[#MAGIK Project Description]]   * [[#MAGIK Project Description]]
   ​   ​
  
-===== Install ​MAGIK =====+===== Deploy ​MAGIK on Server or Localhost ​===== 
 +Here we explain how to deploy compiled MAGIK application (in [[http://​en.wikipedia.org/​wiki/​WAR_file_format_(Sun)|.WAR]] file format) on your web server or localhost.
 === Requirements === === Requirements ===
-  * [[http://​tomcat.apache.org/​download-70.cgi|Apache Tomcat 7.0]] +  * [[http://​tomcat.apache.org/​download-70.cgi|Apache Tomcat 7.0]] installed on your web server or localhost 
-  * [[http://​www.postgresql.org/​download/​|PostgreSQL]]. ​One of PostgreSQL tools to manage the database is [[http://​www.pgadmin.org/​download/​|pgAdmin]].+  * [[http://​www.postgresql.org/​download/​|PostgreSQL]] ​installed on your web server or localhost 
 + We recommend ​[[http://​www.pgadmin.org/​download/​|pgAdmin]] ​as a PostgreSQL tool to manage your databases.
  
 === Steps === === Steps ===
-  - Deploy WAR file to Apache Tomcat server. There are two ways to do it:+  ​- First step is to set the DLV executable file path and PROLOG folder (for the code to execute for the specialization) by setting up environment variable  
 +    - Detect where is located the folder magik_libs 
 +    - Copy the (absolute) entire path (file name included) 
 +    - Put in an __ENVIRONMENT VARIABLE__ called **MAGIK_LIBS**. An example: <​code>​ DLV_PATH =/​Users/​user/​Documents/​workspace/​MAGIK_WEB_3/​magik_libs</​code>​ 
 +    - E.g., on Mac OS X or Linux Operating systems, one can set this environment variable the following command in terminal <​code>​$export MAGIK_LIBS=aboslute_path_to_your_local_magik_libs</​code>​ 
 + 
 +  ​- Deploy WAR file to Apache Tomcat server. ​\\ There are two ways to do it:
     - Using **Tomcat Web Application Manager**     - Using **Tomcat Web Application Manager**
       * Start Tomcat.  ​       * Start Tomcat.  ​
       * Open **Tomcat Web Application Manager** which usually can be accessed through ''​http://​[yourwebsiteorlocalocalhost]/​manager''​ .       * Open **Tomcat Web Application Manager** which usually can be accessed through ''​http://​[yourwebsiteorlocalocalhost]/​manager''​ .
       * Select WAR file to be uploaded, then click **Deploy**.       * Select WAR file to be uploaded, then click **Deploy**.
-    - Manual copying +    - Manual copying ​the .WAR file using  
-      * Stop Tomcat. +      * Stop Tomcat. ​On Unix like systems (Linux) one can do it with shell command: ''​$/​etc/​init.d/​tomcat7 stop''​ 
-      * Delete existing deployment. ​If you have previously deployed "​foo.war"​ in TOMCAT_HOME/​webapps,​ then it has been unpacked into webapps/​foo/​... You must delete this directory and all its contents. On Unix, this can be done with ''​rm -r $TOMCAT_HOME/​webapps/​foo''​. +      * If you have previously deployed "​foo.war"​ in ''​[TOMCAT_HOME]/webapps/''​, then it has been unpacked into ''​webapps/​foo/​''​Firstly ​delete this directory and all its content. On Unix, this can be done with ''​rm -r $TOMCAT_HOME/​webapps/​foo''​. 
-      * Copy WAR file to TOMCAT_HOME/​webapps/​. +      * Copy WAR file to ''​[TOMCAT_HOME]/webapps/''​
-      * Start Tomcat.+      * Start Tomcat ​againOn Unix like systems (Linux) one can do it with shell command: ''​$/​etc/​init.d/​tomcat7 stop''​
   - Create new designated PostgreSQL database for MAGIK web application. Detail explanation on how to create PostgreSQL database can be found [[http://​www.postgresql.org/​docs/​8.1/​static/​manage-ag-createdb.html|here]]. ​   - Create new designated PostgreSQL database for MAGIK web application. Detail explanation on how to create PostgreSQL database can be found [[http://​www.postgresql.org/​docs/​8.1/​static/​manage-ag-createdb.html|here]]. ​
-  - Run MAGIK web application, which can also be done in two ways: +  - Run MAGIK web application. This also can be done in two ways: 
-    - Through **Tomcat Web Application Manager**, ​click the chosen application. +    - Through **Tomcat Web Application Manager**, ​by clicking ​the chosen application 
-    - Through web browser, e.g.: localhost/foo+    - Through web browser, e.g.: ''​http://​[yourwebsiteorlocalocalhost]/manager''​
   - Specify database connection for MAGIK web application. ​     - Specify database connection for MAGIK web application. ​  
    
-[[magik-demo:​developer:​magik-project|Back to Top]] | [[magik-demo:​start|Back to Home Page]]+[[magik-demo:​developer:​magik-project|Back to Top]] | [[magik-demo:​start-here|Back to Home Page]]
 ===== Import MAGIK Project in Eclipse ===== ===== Import MAGIK Project in Eclipse =====
  
Line 37: Line 47:
   ​   ​
 === Steps === === Steps ===
-  * Download Eclipse 3.x. Choose a workspace folder (not the one using for MEGIK-DEMO SVN). +  * Download Eclipse 3.x. Choose a workspace folder (not the one using for MAGIK-DEMO SVN). 
-  * Install Eclipse plugin ''​subversion.tigris.org''​ for SVN control (see instruction http://​web.mit.edu/​6.005/​www/​fa11/​psets/​ps0/​subclipse.html)+  * Install Eclipse plugin ''​subversion.tigris.org''​ for SVN control (see instruction http://​web.mit.edu/​6.005/​www/​fa11/​psets/​ps0/​subclipse.html). Alternatively,​ one can use any SVN control program (e.g., svn command line tool, SmartSVN, etc.) but here we provide instruction for  ''​subversion.tigris.org''​ only. 
   * Import MAGIK project:   * Import MAGIK project:
-              * ''​File>​Import>​SVN>​Check'' ​out project from SVN +              * ''​File>​Import>​SVN>​Check out project from SVN''​ 
-              * Create new repository location, and enter in the URL field: ''​https://​babbage.inf.unibz.it/​repositories/​svn/​osavkovic/​MAGIK-DEMO/​Implementation'' ​(use your unibz credentials for the username and password). ​+              * Create new repository location, and enter in the URL field: ''​https://​babbage.inf.unibz.it/​repositories/​svn/​osavkovic/​MAGIK-DEMO/​Implementation/​MAGIK_WEB_[VERSION]''​.  Use your unibz credentials for the username and password. Beforehand, you need to obtain reading rights for the SVN (request by email). 
               * Select MAGIK folder and press Next. Again Next. And Finish. Now the Eclipse should import the project and MAGIK folder (with small database icon) appears in the package explorer.               * Select MAGIK folder and press Next. Again Next. And Finish. Now the Eclipse should import the project and MAGIK folder (with small database icon) appears in the package explorer.
  
-  * **DLV API**: +=== Running MAGIK from Eclipse in localhost === 
-      * DLV systems offers DLV Wrapper to use DLV in Java Object Environment (''​http://​www.dlvsystem.com/​dlvsystem/​index.php/​DLV_WRAPPER''​).  +  ​To do so, one needs to link locally installed Apache Tomcat with Eclipse (see [[http://​www.coreservlets.com/​Apache-Tomcat-Tutorial/​eclipse.html| tutorial]]). Go to ''​File>​New>​Other''​. Find ''​Server''​ and click ''​Next''​. Then choose ''​Apache>​Tomcat v7.0 Server''​ and click ''​Next''​. Then go ''​Browse''​ and enter the local directory path where Apache Tomcat is installed. Finally, click ''​Finish''​. 
-      * Wrapper Installation:​+  ​To run your MAGIK copy within Eclipse, right-click on the main project folder and then go to ''​Run As>Run on Server''​ and then ''​Finish''​.  
 + 
 +=== DLV API === 
 +  ​DLV is an Answer-Set Programming solver that MAGIK uses internally to reason about completeness. 
 +  ​DLV executable files for Win, Mac and Linux comes within the project. They are located in project directory ''/​lib'' ​ 
 +  * DLV systems offers DLV Wrapper to use DLV in Java Object Environment (''​http://​www.dlvsystem.com/​dlvsystem/​index.php/​DLV_WRAPPER''​).  
 +  * In case Eclipse is not able to find DLV using relative path, edit class  ''​it.unibz.inf.magik.core.DLV_engine''​ and set absolute path to your DLV executable. 
 +  ​* Wrapper Installation ​instructions - a remainder:
                * Go to ''​http://​www.dlvsystem.com/​dlvsystem/​files/​DLVwrapper-v4.2.jar''​. Add this file to your MAGIK libraries (RightClick on ''​project>​Properties>​Java Build Path>​Libraries>​Add external JARs''​).                * Go to ''​http://​www.dlvsystem.com/​dlvsystem/​files/​DLVwrapper-v4.2.jar''​. Add this file to your MAGIK libraries (RightClick on ''​project>​Properties>​Java Build Path>​Libraries>​Add external JARs''​).
-               * Depending on the OS (Win, Mac, Linux) one will use different DLV executable. ​committed DLV executables for major systems ​into  ''/​dlv''​.  +               * Depending on the OS (Win, Mac, Linux) one will use different DLV executable. ​The committed DLV executables for major systems ​are in the project folder ​ ''/​lib''​.  
-               * To test your DLV API, created a ''​JUnit''​ class ''​TestDLVAPI'',​ which one should run to test whether ​ DLV API is installed. ​NOTICE: ​set a path variabile DLV_PATH to the absolute path of your DLV executable. ​(later this should be done to be independent of an OS...) +               * To test your DLV API, we created a ''​JUnit''​ class ''​TestDLVAPI'',​ which one should run to test whether ​ DLV API is properly ​installed. ​Finally, ​set a path variabile DLV_PATH to the absolute path of your DLV executable. ​
- +
- +
-[[magik-demo:​developer:​magik-project|Back to Top]] | [[magik-demo:​start|Back to Home Page]]+
  
  
 +[[magik-demo:​developer:​magik-project|Back to Top]] | [[magik-demo:​start-here|Back to Home Page]]
 ===== MAGIK Project Description ===== ===== MAGIK Project Description =====
 MAGIK Web application is developed using Eclipse as a Web development platform, with the type of [[http://​help.eclipse.org/​indigo/​topic/​org.eclipse.wst.webtools.doc.user/​topics/​ccwebprj.html|Dynamic Web project]]. ​ MAGIK Web application is developed using Eclipse as a Web development platform, with the type of [[http://​help.eclipse.org/​indigo/​topic/​org.eclipse.wst.webtools.doc.user/​topics/​ccwebprj.html|Dynamic Web project]]. ​
Line 68: Line 83:
       * ''​[[#​it.unibz.inf.magik.db|it.unibz.inf.magik.db]]''​       * ''​[[#​it.unibz.inf.magik.db|it.unibz.inf.magik.db]]''​
       * ''​[[#​it.unibz.inf.magik.exception|it.unibz.inf.magik.exception]]''​       * ''​[[#​it.unibz.inf.magik.exception|it.unibz.inf.magik.exception]]''​
-      * ''​[[#​it.unibz.inf.magik.hibernate|it.unibz.inf.magik.hibernate]]''​+      * ''​[[#​it.unibz.inf.magik.hibernate|it.unibz.inf.magik.hibernate]]'' ​
       * ''​[[#​it.unibz.inf.magik.test|it.unibz.inf.magik.test]]''​       * ''​[[#​it.unibz.inf.magik.test|it.unibz.inf.magik.test]]''​
       * ''​[[#​it.unibz.inf.magik.web|it.unibz.inf.magik.web]]''​       * ''​[[#​it.unibz.inf.magik.web|it.unibz.inf.magik.web]]''​
Line 77: Line 92:
     * ''​**WEB-INF**''​ → contains the supporting Web resources for a Web application,​ including the web.xml file and the classes and lib directories.     * ''​**WEB-INF**''​ → contains the supporting Web resources for a Web application,​ including the web.xml file and the classes and lib directories.
       * ''​**/​classes**''​ → for servlets, utility classes, and the Java compiler output directory.       * ''​**/​classes**''​ → for servlets, utility classes, and the Java compiler output directory.
-      * ''​**/​lib**''​ → contains the supporting JAR files that the Web application references. Any classes in .jar files placed in this directory will be available for the Web application.+      * ''​**/​lib**''​ → contains the supporting JAR files that the Web application references. Any classes in .jar files placed in this directory will be available for the Web application. MAGIK comes with the following libraries.
         * [[http://​www.dlvsystem.com/​dlvsystem/​index.php/​DLV_WRAPPER|DLV Wrapper]]         * [[http://​www.dlvsystem.com/​dlvsystem/​index.php/​DLV_WRAPPER|DLV Wrapper]]
         * [[http://​jdbc.postgresql.org/​|PostgreSQL JDBC Driver]]         * [[http://​jdbc.postgresql.org/​|PostgreSQL JDBC Driver]]
Line 84: Line 99:
   * ''​**doc**''​ → contains all the documentation files related to the project.   * ''​**doc**''​ → contains all the documentation files related to the project.
  
-It is also possible to compile the project as standalone application to be deployed ​in local machine. ​One only needs to change one line in ''​[[magik-demo:​documentation:code:​functionality#​index.jsp|WebContent/​index.jsp]]'':​+It is also possible to compile the project as standalone application to be deployed ​on a local machine. ​This is obtained by changing the line in ''​[[magik-demo:​developer:magik-business-logic#​index.jsp|WebContent/​index.jsp]]'':​
 <code java> <code java>
 sessionSchemas.setWebApp(true);​ sessionSchemas.setWebApp(true);​
Line 93: Line 108:
 </​code>​ </​code>​
  
-[[magik-demo:​developer:​magik-project|Back to Top]] | [[magik-demo:​start|Back to Home Page]]+[[magik-demo:​developer:​magik-project|Back to Top]] | [[magik-demo:​start-here|Back to Home Page]]
magik-demo/developer/magik-project.1368556384.txt.gz · Last modified: 2017/07/06 15:24 (external edit)