Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Sakai NWU Workshop, South Africa Spring Fundamentals & RSF Fundamentals.

Slides:



Advertisements
Similar presentations
Apache Struts Technology
Advertisements

1. Content – Collective term for all text, images, videos, etc. that you want to deliver to your audience. 2. Structure – How the content is placed on.
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Sakai NWU Workshop, South Africa Recap of Sakai Services Antranig.
Using JavaServer Pages Harry R. Erwin, PhD CIT304/CSE301.
Sakai Programmer's Café Introduction to RSF — II. EL, Scopes and the Request Cycle Antranig Basman
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
JSP Tag Extensions And Java Bean. JSP Tag Extensions Tag extensions look like HTML (or rather, XML) tags embedded in a JSP page. They have a special meaning.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
DT228/3 Web Development JSP: Directives and Scripting elements.
Abstract Data Types and Encapsulation Concepts
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Reasonable Sakai Widgets Aaron Zeckoski Gonzalo Silverio Antranig Basman
Java Server Pages (JSP) Presented by: Ananth Prasad & Alex Ivanov May 10, 2001.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License RSF Wiki Introduction to Reasonable Server Faces Aaron Zeckoski and Antranig Basman.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
Java Frameworks Indy Java Users Group January 29, 2003.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Sakai NWU Workshop, South Africa Introduction to Sakai and Sakai.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Ch6:creating consistent looking web sites. Master pages Master page defines a combination of fixed content and content place holder to hold the web page(.aspx)
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Saki PSaki PUK Introducing RSF (Reasonable Server Faces) Aaron.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Saki PSaki PUK New and Upcoming RSF Features – Antranig.
JDeveloper 10g and JavaServer Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
CSE446 S OFTWARE Q UALITY M ANAGEMENT Spring 2014 Yazılım ve Uyguluma Geliştirme Yöneticisi Orhan Başar Evren.
Li Tak Sing COMPS311F. Static attributes in Servlets Since Servlets are also Java classes, you can also use static attributes to store values that can.
1 Web Developer Foundations: Using XHTML Chapter 2 Key Concepts.
© 2006 IBM Corporation IBM WebSphere Portlet Factory Architecture.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
CHEF II / Sakai Architecture. CHEF II Changes uPortal replaces Jetspeed –jsr 168 portlet, servlet compliant Spring replaces Turbine component framework.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License RSF Wiki Introduction to Reasonable Server Faces Aaron Zeckoski
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Introduction to Spring Framework,
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License RSF Wiki Introduction to Reasonable Server Faces Aaron Zeckoski
JSF Framework Java Server Faces Presented by Songkran Totiya (6/10/2014)
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai development and app/tool tips Aaron Zeckoski
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
JSP Custom Tags. Prerequisites Servlet API Mapping to JSP implicit objects JavaServer Pages Basic syntax Implementation via servlet API XML.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Sakai code exercises Aaron Zeckoski.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Using RSF to Develop a Sakai Tool – Lessons Learned Mark Norton, Nolaria Consulting.
Jonathan Gallimore | Tomitribe Cluster your application with JCache and CDI.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
RSF Programming Techniques in Sakai Lessons from the Evaluation Project RSF features 0.7->0.7.1.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Introduction to Reasonable Server Faces Aaron Zeckoski
Java Servlets and Java Server Pages
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
1 Using const in C++ Classes In the presence of pointers we must take steps to ensure the integrity of the object Can use const method definitions The.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Chapter 4 Request and Response. Servlets are controlled by the container.
HTML Review * is used as a reference for most of the notes in this powerpoint.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
APACHE STRUTS ASHISH SINGH TOMAR ast2124. OUTLINE Introduction The Model-View-Controller Design Pattern Struts’ implementation of the MVC Pattern Additional.
Apache Struts Technology A MVC Framework for Java Web Applications.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Comparative Display Technologies.
Creative Commons Attribution- ShareAlike 2.5 License Sakai Programmer's Café Sakai Oxford Tetra ELF Workshop Comparative Display Technologies in Sakai.
J2EE Platform Overview (Application Architecture)
Abstract Data Types and Encapsulation Concepts
Scripted Page Web App Development (Java Server Pages)
Chapter 3: Using Methods, Classes, and Objects
Lecturer: Mukhtar Mohamed Ali “Hakaale”
Java Server Pages (JSP)
Classes and Objects.
Presentation transcript:

Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Sakai NWU Workshop, South Africa Spring Fundamentals & RSF Fundamentals Antranig Basman

2 The Spring Framework The most significant development in programming in 10 years Will only have a lightning tour in this session Crucial since –Is used throughout Sakai as a service location framework –Is the basis for the RSF presentation framework we will be using for tool development Is extensively used in the wider world as a Java “enterprise” technology Purpose is to organise and orchestrate the different parts of an application, which are packaged as “beans”

3 What is so important about Spring? Somewhat hard to convey without seeing it! Spring is the first “negative technology”, that as well as staying invisible in your code, also works hard to hide dependencies on other technologies as well Solidly separates code from configuration, making it easy to work with extremely large applications without getting lost/in a tangle Helps you think properly about smaller applications too! Is a deeper idea than it appears, that you will need a bit of time to settle into

4 Java Beans and Spring Beans have been with us since the beginning of Java (1996 and beyond) Almost a non-concept – a bean is a simple Java object with “getters and setters” Spring concept of a bean is not very much more loaded – however it is imagined that each bean “does some work” Setters in Spring are generally much more important than getters In Spring, a Setter is used to deliver a dependency public class MyBean { private String property; public void setProperty(String property) { this.property = property; } public String getProperty() { return property; }

5 A Simple Spring Bean Notes: –The whole point of Spring is not to see it –Spring isn’t just about service location, but it is one (common) way to use it public class WorkerBean { private UsefulService myService; public void setMyService(UsefulService myService) { this.myService = myService; } public int doMyWork(int argument) { int result = myService.invoke(argument); return result + 3; } Setter method marks this as a bean - The dependency on myService is injected The bean’s business method (work for its clients) is defined here

6 Spring Configuration for the bean Notes: –The “id” attribute is optional, but typically supplied since you usually want to refer to the bean again –You can “keep on going”, building a deeper and deeper tree of clients and dependencies –The ultimate endpoint of a mature Spring design is to have the entire application structure in Spring (still a controversial view!) –The use of Spring in Sakai is typically much “thinner” – there is ONE clear API/Impl boundary across the server.... Injection here delivers the bean “myService” to the setter on the client

7 Typical Spring usages The Spring configuration is typically written in an XML file, defining an Application Context –Recent support for configuration through Java 5 Annotations, but this defeats the whole point! Special support for loading in a Servlet environment, creating a WebApplicationContext from a file by default named applicationContext.xml –Initialised on context startup using Servlet Listeners defined in web.xml Can also use Spring completely “headless” by creating the application context by hand –Will see an example tomorrow morning

8 Sakai Services in Spring Sakai APIs are defined in terms of Java interfaces There is ONE implementation of each API interface in Sakai The name of the Spring bean in the Sakai Spring context (file components.xml ) is always the fully qualified interface name Classic example: the Sakai UserDirectoryService Lots more stuff here! Will learn about this later, but concentrate on the familiar elements and There is ONE global, shared Sakai application context holding beans for all Sakai services <bean id="org.sakaiproject.user.api.UserDirectoryService“ class="org.sakaiproject.user.impl.DbUserService" init-method="init"destroy-method="destroy" singleton="true">......

9 Sakai UserDirectoryService in code To use this API in your bean, you would write a setter which accepted a UserDirectoryService object, and then set up the injection in a Spring XML file package org.sakaiproject.user.api;.... /** * UserDirectoryService manages the end-user modeling for Sakai. * */ public interface UserDirectoryService extends EntityProducer {.... User getUser(String id) throws UserNotDefinedException;... }

10 RSF

11 Why RSF? RSF was designed with several special requirements of the Sakai community (and other similar communities) in mind –The first key point is to decouple the workflows of developers and designers/UX experts, and allow them to work independently –The second key point is to enable universal portability of apps to whatever environments may arise, without requiring code changes (today, to Servlets, Sakai, and JSR-168 Portlets, tomorrow to JSR-286 or the final “containerless” liberation) RSF is closely involved with the FLUID “Flexible UI” project now starting up at UToronto

12 RSF for coders and designers RSF is fun for coders since it is built out of Spring components –Can always break open the framework in an emergency –Once you get the pattern, it is really obvious how to build very powerful components and apps that require a lot more custom/stovepipe work in other frameworks RSF is fun for designers since they can just work with plain HTML and hand it over the fence to coders who can start working with it directly

13 Today’s talk A lightning tour of the basics, with enough “bootstrap” info about RSF fundamentals to let you understand and work with basic apps, and tackle the exercise after the break More thorough introduction and survey tomorrow

14 Let’s get started! Here is some real HTML: It is also an RSF template! –To make a template, you simply add the rsf:id attribute to tags which might have their content replaced when the app runs, or might need to be copied or moved about RSF sample Hello User Name Today is 1/1/2006 item value here

15 RSF Templates The template will load and render fine in any browser or editor –Properly, we will always give RSF templates a proper XHTML doctype, and namespace for the rsf:id attribute –The rsf:id attribute is the ONLY addition to the schema –RSF can actually render with any kind of XML template, not just XHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "

16 Using the Template Everything in RSF is a Spring-configured bean of some kind A special kind of bean called a Producer (or View Producer) is responsible for rendering a page from a template –The same Producer can render from many different templates, as long as the rsf:ids agree The purpose of a Producer is to create a Component Tree of RSF “Primitive Components” which will get paired up with the template by the RSF renderer (IKAT)

17 View Producer Java code (a Spring bean) which defines what appears in the view UIOutput and UIBranchContainer are primitive RSF components The 2 nd arguments to the make() calls match up with the rsf:ids written in the template public class ItemsProducer implements ViewComponentProducer, DefaultView {... private CrudPlusLogic logic; public void setLogic(CrudPlusLogic logic) { this.logic = logic; } public void fillComponents(UIContainer tofill, ViewParameters viewparams, ComponentChecker checker) { UIOutput.make(tofill, "user-name", logic.getUserName()); for (CrudPlusItem item: logic.getAllVisibleItems().iterator()) { UIBranchContainer itemrow = UIBranchContainer.make(listform, "item-row:", item.getId()); UIOutput.make(itemrow, “item-value”, item.getValue()); } UIOutput.make(itemrow, “current-date", new Date().toString() ); }

18 RSF rendering basics UIOutput – will pair up with ANY tag in the markup. The 3 rd argument will replace the body of the tag. –rsf:id must not have a colon UIBranchContainer – will also pair up with any tag. Represents a “branch point” in the rendering where a tag will be copied out again, missed out completely, or rendered out of order. –rsf:id must have a colon Full details on all the RSF primitive components (like UILink, UIForm, UICommand) on the RSF wiki at

19 Registering a Producer Spring beans typically live as long as the entire application (application scope) RSF extends Spring with a fast request-scope implementation, RSAC RSF Producers are typically declared as Spring beans at request scope Request-scope beans go into requestContext.xml rather than applicationContext.xml, but the file format is the same You can refer to any application-scope beans (including Sakai services) directly as dependencies of your request-scope beans

20 Registration of the ItemsView In WEB-INF/requestContext.xml: Typically no need for an id since RSF detects and loads up producers by itself The one dependency is a bean representing a Sakai API (service implementation) – not only at application scope but in the shared area. <property name="logic" ref="org.sakaiproject.crudplus.logic.CrudPlusLogic" />

21 The Scene This is enough “bootstrap” info about RSF basics to let you understand and work with basic apps, and tackle the exercise after the break More thorough introduction and survey tomorrow

22 Questions? RSF wiki, forums and JIRA – Spring framework –

23 The Scene Having set the scene with some general theory and background, we are set to continue after lunch with tackling some practical Sakai development