1.16k likes | 1.53k Views
Introduction to Development on the Open Source VIVO Project. 2011 VIVO Conference. Welcome. Goals of this workshop. Connect you to the VIVO Application by building and deploying from the VIVO repositories Connect you to the VIVO Architecture by modifying VIVO
E N D
Introduction to Development on the Open Source VIVO Project 2011 VIVO Conference
Goals of this workshop • Connect you to the VIVO Application by building and deploying from the VIVO repositories • Connect you to the VIVO Architecture by modifying VIVO • Connect you to the VIVO community
Schedule • Part 1 • Introduction • Deploying VIVO • break: 15 min • Part 2 • Application overview • Modifying VIVO • break: 15 min • Part 3 • Developer tools • Linked open data • The VIVO community
Parts of an open source community • Open repositories • Open development • Open documentation • Open communication
Open repositories • Project space is at sf.net/p/vivo • There are currently four repositories • VITRO – sf.net/p/vivo/vitro/code • VIVO – sf.net/p/vivo/code • Harvester – sf.net/p/vivo/harvester/code • Tools – sf.net/p/vivo/tools/code
SourceForge repositories these buttons modify the checkout Text box For Read/Write Read Only HTTPS Checkout current revision A timeline of the commits to the project This table details the root folders files (standard SVN here) and the latest activity
SourceForge repositories The commit history viewer is only available for projects under 2000 commits at this time. VIVO is at 3455! VITRO is at 8943! Commit history map in reverse order Selected revisions info Items modified
Types of VIVO repositories SVN Git Projects using GIT: Harvester git-scm.com Why Git? Error in original SVN repo forced a distributed model • Project using SVN: VIVO, VITRO, Tools • subversion.apache.org • Standard versioning system used at • Cornell • Indiana • UF
Regardless of repository • Development occurs in trunk • Branches are used for • Release Candidates • Final Releases • Maintenance • Large features • Events like • VIVO Hackathon • This Workshop! vivo-dev-workshops-08-2011
What is not included in the repo • SVN – subversion.apache.org • Java – java.com • ANT – ant.apache.org • Mysql– www.mysql.com • Tomcat6 – tomcat.apache.org • Git– git-scm.com • Maven2 – maven.apache.org
JAVA 6 JDK • Can I use the open-jdk? • Some parts of VIVO require classes that only exist in the sun/oracle implementation • What is Java? • “Write once, run anywhere” – popular quote about java • Many libraries for Java including • JENA http://jena.sourceforge.net/ • Freemarkerhttp://freemarker.sourceforge.net/ • Installation • Debian/Ubuntu – apt-get install sun-java6-jdk • Centos/Redhat – yum install java (need to configure alternatives) • Windows: download and install
Tomcat 6 • Why not Tomcat 7 yet? • Issues with Windows support (seen as minor) • What is Tomcat? • “an open source software implementation of the Java Servlet and JavaServer Pages technologies” – tomcat.apache.org • A webserver for java applications • Installation • Debian/Ubuntu – apt-get install tomcat6 • Centos/Redhat – yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps • Windows: download and follow the instructions
ANT • What is ANT • “a Java library and command-line tool whose mission is to drive processes described by build file” – ant site • Install ANT • Ubuntu/Debian – apt-get install ant • Centos/Redhat – yum install ant • Windows – download and install
Maven 2 • Why Maven2? • Initially it was the ability to NOT commit the libraries needed for harvesting to the repository • What is Maven2? • “a software project management and comprehension tool” –maven.apache.org • Build, reporting, and documentation tool • Install Maven2 • Ubuntu/Debian – apt-get install maven2 • Centos/Redhat – yum install maven2 • Windows – download and install
VIVO and Vitro • Vitro • a general-purpose web-based ontology and instance editor with customizable public browsing • VIVO • some overrides, mostly additions • ontology • theme • custom editing and display • visualization • Harvester interface VIVO Vitro
VIVO and Vitro • Vivo Cornell • “inherits” from both Vitro and VIVO. • adds a theme • overrides some behavior Vivo Cornell VIVO Vitro
Directories VIVO Installation Vitro Installation Tomcat /demo/install/vivo /demo/install/vitro /usr/local/tomcat VIVO Home MySQL /demo/vivohome
Installation directories • Where the coding happens • Comes from Subversion • 2 directories • R/W by • the build script VIVO Installation Vitro Installation Tomcat /demo/install/vivo /demo/install/vitro /usr/local/tomcat VIVO Home MySQL /demo/vivohome
Home Directory • Site-dependent data • Solr index • Uploaded images • Upgrade logs • R/W by • the build script • Tomcat VIVO Installation Vitro Installation Tomcat /demo/install/vivo /demo/install/vitro /usr/local/tomcat VIVO Home MySQL /demo/vivohome
Directories • The running application webapps/vivo webapps/vivosolr • R/W by • Tomcat VIVO Installation Vitro Installation Tomcat /demo/install/vivo /demo/install/vitro /usr/local/tomcat VIVO Home MySQL /demo/vivohome
Directories • The data model • Located somewhere • R/W by • MySQL VIVO Installation Vitro Installation Tomcat /demo/install/vivo /demo/install/vitro /usr/local/tomcat VIVO Home MySQL /demo/vivohome
Create the database CREATE DATABASE vivo CHARACTER SET UTF8; GRANT ALL ON vivo.* TO 'vivoUser'@'localhost' IDENTIFIED BY 'vivoPass'; • Need the MySQL admin ID and password.
Deploying • in the Vivo installation directory, create the deploy.properties file • start with a copy of example.deploy.properties • edit as needed • Run the build ant all
Installation directories # # Where is the Vitro core directory? # In most deployments, this is set to ./vitro-core # (It is not uncommon for this setting to point # elsewhere in development environments). # Examples: # vitro.core.dir = ./vitro-core # vitro.core.dir = ../vitro # vitro.core.dir = /usr/local/vitro/trunk vitro.core.dir = ../vitro
Home directory # # Tells the VIVO application where to store the data # that it creates. This includes uploaded files # (usually images) and the search index. # vitro.home.directory = /usr/local/vivo/data
Tomcat # # The base install directory for your Tomcat server. # The VIVO application will be deployed in the /webapps # directory below this base. # tomcat.home = /usr/local/tomcat # # The name of the VIVO application. # This will appear in the URL for the application. # For example, http://my.vivo.server/vivo # webapp.name = vivo
MySQL access # # Change the end of the URL to reflect your database name. # Change the username and password to match the authorized # database user you created. # VitroConnection.DataSource.url = jdbc:mysql://localhost/vivo VitroConnection.DataSource.username = vivoUser VitroConnection.DataSource.password = vivoPass
Root user # # The email address of the root user for VIVO. # The password for this user is initially set to # "rootPassword", but you will be asked to # change the password the first time you log in. # rootUser.emailAddress = root@mydomain.edu
Default namespace # # This namespace will be used when generating URIs # for objects created in the editor. # In order to serve linked data, the default # namespace must be composed as follows # (optional elements in parentheses): # # scheme + server_name (+ port) (+ servlet_context) + # "/individual/" # # For example, Cornell's default namespace is: # # http://vivo.cornell.edu/individual/ # Vitro.defaultNamespace = http://vivo.mydomain.edu/individual/
Email (disabled) # # Email parameters which VIVO can use to send mail. # If these are left empty, the "Contact Us" form # will be disabled and users will not be notified of # changes to their accounts. # #email.smtpHost = smtp.mydomain.edu #email.replyTo = vivo_admin@mydomain.edu
Solr # # URL of Solr context used in local VIVO search. # This will usually consist of: # scheme + server_name + port + vivo_webapp_name + "solr" # In the standard installation, the Solr context will be on # the same server as VIVO, and in the same Tomcat instance, # so the path will be: # webapp.name (specified above) + "solr" # Example: # vitro.local.solr.url = http://localhost:8080/vivosolr vitro.local.solr.url = http://localhost:8080/vivosolr
More… • Database parameters: VitroConnection.DataSource.pool.maxActive VitroConnection.DataSource.pool.maxIdle VitroConnection.DataSource.dbtype VitroConnection.DataSource.driver VitroConnection.DataSource.validationQuery • Authentication and Profiles: selfEditing.idMatchingProperty externalAuth.buttonText externalAuth.netIdHeaderName
More… • Visualization: visualization.temporal visualization.topLevelOrg • Harvester: harvester.location • Google reconcile: Vitro.reconcile.defaultTypeList • Solr: vitro.local.solr.ipaddress.mask
Did it work? • Start tomcat • Browse these pages: http://localhost:8080/vivo http://localhost:8080/vivosolr • Look in the home directory: • see solr/data • see uploads
Troubleshooting • Log files in the tomcat/logs directory • names will differ slightly depending on OS • catalina.out • vivo.all.log • solr.log • localhost.log
Break 1 15 min break We will start again at X:XX AM
Application flow overview System startup Servlet context Context listeners Solr indexer policies Freemarker configuration file system Configuration properties HTTP Request Controllers Freemarker Templates Servlet filters HTTP Response models data filters DAOs Application bean Request Session Editing session status User Account
View from the controller Session Login status and user information Editing: EditConfiguration EditSubmission Short-term display preferences ServletContext Configuration properties (from deploy.properties) FreemarkerConfiguration Loader VClassGroupCache Search: SolrServer IndexBuilder Policies Request DAO factories: Default (filtered) Unfiltered Full Dataset Models: Assertions model Inferences model Full model Application bean App name Theme directory etc.
Theming Making it your own
Anatomy of a VIVO theme • Templates (.ftl) • Stylesheets (.css) • Scripts (.js) • Templates are written in FreeMarker • Stylesheets and scripts – nothing unusual
Directory structure • Any VIVO theme must include “templates” directory • App knows to look here when loading templates
Template types • Page request = multiple templates • Templates grouped by type • base template • body template
page.ftl – the Base Template • first template called • complete control over HTML • called no matter what page is requested* • placed shared content/markup here • header • navigation • footer • every theme must contain page.ftl as a bare minimum