• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Spring as a Cloud Platform (Developer Summit 2011 17-C-5)
 

Spring as a Cloud Platform (Developer Summit 2011 17-C-5)

on

  • 2,590 views

 

Statistics

Views

Total Views
2,590
Views on SlideShare
2,168
Embed Views
422

Actions

Likes
0
Downloads
127
Comments
0

7 Embeds 422

http://shinodogg.com 189
http://devsummary.miukoba.net 117
http://grid-sv02.siz.nes.nec.co.jp 105
http://webcache.googleusercontent.com 7
http://www.techgig.com 2
http://agile-community.siz.nes.nec.co.jp 1
http://131.253.14.66 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Spring as a Cloud Platform (Developer Summit 2011 17-C-5) Spring as a Cloud Platform (Developer Summit 2011 17-C-5) Presentation Transcript

    • 17-C-5 Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Simple Object Portable Service Abstraction Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Application Framework Middle Ware OS H/W Developers Summit 2011
    • Roo/Grails Spring Servlet JVM Developers Summit 2011
    • vSphere App App App vCloud Other Cloud App App App Developers Summit 2011
    • Force.com Your Java App Platform Services Spring & Tomcat VMware vCloud VMware vSphere Force.com Database Developers Summit 2011
    • Your Java App Scaling( ) and Load- balancing( ) as a service Monitoring( ) and diagnostics( ) as a service & Force.com Database Developers Summit 2011
    • GWT Hyperic GAE/J Spring Developers Summit 2011
    • Developers Summit 2011
    • SUSE Linux vCloud vSphere Developers Summit 2011
    • App App App Linux vCloud vSphere Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Web Service Data Access JPA Hibernate Spring JDBC HSQLDB Spring tc Server Developers Summit 2011
    • @Controller@RequestMapping("/login.form")public class LoginController { private LoginService loginService; @Autowired public void setLoginService(LoginService loginService) { this.loginService = loginService; } ... @RequestMapping(method = RequestMethod.GET) appContext-web.xml public String setupForm(ModelMap model) { <?xml version="1.0" encoding="UTF-8"?> if (loginService.isLogin()) { <beans ...> model.addAttribute("login", loginService.getLoginUser()); return loginService.getWelcomePage(); <context:component-scan } else { base-package="sample.spring.mvc.web" /> <bean id="messageSource" model.addAttribute("login", new LoginBean()); return loginService.getLoginPage(); class="org.springframework.context.support. } ResourceBundleMessageSource"> } <property name="basename" value="messages" /> …} </bean> </beans> Developers Summit 2011
    • <%@ page language="java" contentType="text/html; charset=Shift_JIS" pageEncoding="Shift_JIS" isELIgnored="false" %><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"><title>Login Page</title></head><body><h1>Login!</h1><form:form modelAttribute="login"><table> appContext-view.xml <tr> <?xml version="1.0" encoding="UTF-8"?> <td>Login Name:</td> <td> <beans:beans ...> <form:input path="loginname"/> <annotation-driven /> <font color="red"><form:errors path="loginname"/></font> </td> <resources mapping="/resources/**" location="/resources/" /> </tr> <beans:bean .... <tr> class="org.springframework.web.servlet.view. InternalResourceViewResolver"> <td colspan="2"><input type="submit" name="Login" value="Login"></td> </tr> <beans:property name="prefix" value="/WEB-INF/views/" /></table></form:form> <beans:property name="suffix" value=".jsp" /></body> </beans:bean></html>login.jsp </beans:beans> Developers Summit 2011
    • @Service("loginService")public class LoginServiceImpl implements LoginService { @Autowired private MemberDao memberDao; public void setMemberDao(MemberDao memberDao) { this.memberDao = memberDao; } @Transactional(readOnly=true) public boolean login(String loginname, String password) { appContext-service.xml List<LoginBean> beans = memberDao.findByLoginname(loginname); <?xml version="1.0" encoding="UTF-8"?> if (beans.size() > 0) { <beans …> LoginBean bean = beans.get(0); <context:annotation-config/> if (bean.getPassword() != null && <context:component-scan bean.getPassword().equals(password)) { base-package="sample.spring.mvc.service"/> loginManager.setLoginUser(bean); return true; <bean id="loginManager" scope="session" } class="sample.spring.mvc.service.LoginManager"> } <aop:scoped-proxy/> return false; </bean> } </beans>} Developers Summit 2011
    • @Repository("memberDao")public class MemberDaoImpl implements MemberDao { @PersistenceContext appContext-dao.xml EntityManager em; <?xml version="1.0" encoding="UTF-8"?> <beans… <context:annotation-config/> public List<LoginBean> findByLoginname(String loginname) { <context:component-scan base-package="sample.spring.mvc.dao"/> Query query = em.createQuery( <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> "SELECT l FROM LoginBean l WHERE l.loginname = value="sample" /> <property name="persistenceUnitName" :loginname"); query.setParameter("loginname", loginname); ref="dataSource"/> <property name="dataSource" <property name="jpaVendorAdapter"> return query.getResultList(); <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> } <property name="showSql" value="true" /> </bean>} </property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.hsqldb.jdbcDriver"/> <property name="url" value="jdbc:hsqldb:hsql://localhost/"/> <property name="username" value="sa"/> <property name="password" value=""/> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> </beans> Developers Summit 2011
    • @Entity@Table(name="member")public class LoginBean implements Serializable { public LoginBean() {} @Id @GeneratedValue <?xml version="1.0" encoding="UTF-8"?> private Long id; <persistence …> @Column(unique=true) <persistence-unit name="sample" private String loginname; transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> private String password; <class>sample.spring.mvc.bean.LoginBean</class> @Column(name="name") <exclude-unlisted-classes>false</exclude-unlisted-classes> private String nickname; <properties> … <property name="hibernate.dialect"} value="org.hibernate.dialect.HSQLDialect" /> </properties> </persistence-unit> </persistence> persistence.xml Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Web Service Data Access JPA Datanucleus Web API Spring Connector Force.com Database Spring tc Server on VMForce Developers Summit 2011
    • @Controller@RequestMapping("/login.form")public class LoginController { private LoginService loginService; @Autowired public void setLoginService(LoginService loginService) { this.loginService = loginService; } ... @RequestMapping(method = RequestMethod.GET) appContext-web.xml public String setupForm(ModelMap model) { <?xml version="1.0" encoding="UTF-8"?> if (loginService.isLogin()) { <beans ...> model.addAttribute("login", loginService.getLoginUser()); return loginService.getWelcomePage(); <context:component-scan } else { base-package="sample.spring.mvc.web" /> <bean id="messageSource" model.addAttribute("login", new LoginBean()); return loginService.getLoginPage(); class="org.springframework.context.support. } ResourceBundleMessageSource"> } <property name="basename" value="messages" /> …} </bean> </beans> Developers Summit 2011
    • <%@ page language="java" contentType="text/html; charset=Shift_JIS" pageEncoding="Shift_JIS" isELIgnored="false" %><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"><title>Login Page</title></head><body><h1>Login!</h1><form:form modelAttribute="login"><table> appContext-view.xml <tr> <?xml version="1.0" encoding="UTF-8"?> <td>Login Name:</td> <td> <beans:beans ...> <form:input path="loginname"/> <annotation-driven /> <font color="red"><form:errors path="loginname"/></font> </td> <resources mapping="/resources/**" location="/resources/" /> </tr> <beans:bean .... <tr> class="org.springframework.web.servlet.view. InternalResourceViewResolver"> <td colspan="2"><input type="submit" name="Login" value="Login"></td> </tr> <beans:property name="prefix" value="/WEB-INF/views/" /></table></form:form> <beans:property name="suffix" value=".jsp" /></body> </beans:bean></html>login.jsp </beans:beans> Developers Summit 2011
    • @Service("loginService")public class LoginServiceImpl implements LoginService { @Autowired private MemberDao memberDao; public void setMemberDao(MemberDao memberDao) { this.memberDao = memberDao; } @Transactional(readOnly=true) public boolean login(String loginname, String password) { appContext-service.xml List<LoginBean> beans = memberDao.findByLoginname(loginname); <?xml version="1.0" encoding="UTF-8"?> if (beans.size() > 0) { <beans …> LoginBean bean = beans.get(0); <context:annotation-config/> if (bean.getPassword() != null && <context:component-scan bean.getPassword().equals(password)) { base-package="sample.spring.mvc.service"/> loginManager.setLoginUser(bean); return true; <bean id="loginManager" scope="session" } class="sample.spring.mvc.service.LoginManager"> } <aop:scoped-proxy/> return false; </bean> } </beans>} Developers Summit 2011
    • @Repository("memberDao")public class MemberDaoImpl implements MemberDao { @PersistenceContext EntityManager em; public List<LoginBean> findByLoginname(String loginname) { Query query = em.createQuery( appContext-dao.xml "SELECT l FROM LoginBean l WHERE l.loginname = :loginname"); <?xml version="1.0" encoding="UTF-8"?> <beans ...> query.setParameter("loginname", loginname); <context:annotation-config/> return query.getResultList(); <context:component-scan base-package="sample.spring.mvc.dao"/> } <bean id="entityManagerFactory"} class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="sample" /> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> </beans> Developers Summit 2011
    • @Entity@Table(name="member")public class LoginBean implements Serializable { ID public LoginBean() {} String <?xml version="1.0" encoding="UTF-8" standalone="no"?> @Id <persistence ...> <persistence-unit name="sample"> @GeneratedValue(strategy = GenerationType.IDENTITY) <provider>org.datanucleus.jpa.PersistenceProviderImpl</provider> private String id; <properties> <property name="datanucleus.Optimistic" value="false"/> @Column(unique=true) <property name="datanucleus.datastoreTransactionDelayOperations" value="true"/> private String loginname; <property name="sfdcConnectionName" value="DefaultSFDCConnection"/> private String password; <property name="datanucleus.ConnectionURL" value="sfdc:https://xxx.salesforce.com/services/Soap/u/20.0"/> //@Column(name="name") <property name="datanucleus.ConnectionUserName" value="xxx@xxx.com"/> private String nickname; <property name="datanucleus.ConnectionPassword" value="xxxx"/> ... <property name="datanucleus.autoCreateSchema" value="false"/> <property name="datanucleus.autoCreateTables" force.com API value="true"/>} <property name="datanucleus.autoCreateColumns" value="false"/> <property name="datanucleus.autoCreateConstraints" value="false"/> <property name="datanucleus.validateTables" value="false"/> <property name="datanucleus.validateConstraints" value="false"/> <property name="datanucleus.jpa.addClassTransformer" value="false"/> </properties> </persistence-unit> </persistence> Developers Summit 2011 persistence.xml
    • Developers Summit 2011
    • Developers Summit 2011
    • VMForce Extension Developers Summit 2011
    • Developers Summit 2011
    • URL Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Web Service Data Access JPA Datanucleus Spring Connector Google AppEngine BigTable Developers Summit 2011
    • @Controller@RequestMapping("/login.form")public class LoginController { private LoginService loginService; @Autowired public void setLoginService(LoginService loginService) { this.loginService = loginService; } ... @RequestMapping(method = RequestMethod.GET) appContext-web.xml public String setupForm(ModelMap model) { <?xml version="1.0" encoding="UTF-8"?> if (loginService.isLogin()) { <beans ...> model.addAttribute("login", loginService.getLoginUser()); return loginService.getWelcomePage(); <context:component-scan } else { base-package="sample.spring.mvc.web" /> <bean id="messageSource" model.addAttribute("login", new LoginBean()); return loginService.getLoginPage(); class="org.springframework.context.support. } ResourceBundleMessageSource"> } <property name="basename" value="messages" /> …} </bean> </beans> Developers Summit 2011
    • <%@ page language="java" contentType="text/html; charset=Shift_JIS" pageEncoding="Shift_JIS" isELIgnored="false" %><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"><title>Login Page</title></head><body><h1>Login!</h1><form:form modelAttribute="login"><table> appContext-view.xml <tr> <?xml version="1.0" encoding="UTF-8"?> <td>Login Name:</td> <td> <beans:beans ...> <form:input path="loginname"/> <annotation-driven /> <font color="red"><form:errors path="loginname"/></font> </td> <resources mapping="/resources/**" location="/resources/" /> </tr> <beans:bean .... <tr> class="org.springframework.web.servlet.view. InternalResourceViewResolver"> <td colspan="2"><input type="submit" name="Login" value="Login"></td> </tr> <beans:property name="prefix" value="/WEB-INF/views/" /></table></form:form> <beans:property name="suffix" value=".jsp" /></body> </beans:bean></html>login.jsp </beans:beans> Developers Summit 2011
    • <?xml version="1.0" encoding="utf-8" standalone="no"?><appengine-web-app xmlns="http://appengine.google.com/ns/1.0"><application>xxx</application><version>2</version><sessions-enabled>true</sessions-enabled> </appengine-web-app> appengine-web.xml Developers Summit 2011
    • @Service("loginService")public class LoginServiceImpl implements LoginService { @Autowired private MemberDao memberDao; public void setMemberDao(MemberDao memberDao) { this.memberDao = memberDao; } @Transactional(readOnly=true) public boolean login(String loginname, String password) { appContext-service.xml List<LoginBean> beans = memberDao.findByLoginname(loginname); <?xml version="1.0" encoding="UTF-8"?> if (beans.size() > 0) { <beans …> LoginBean bean = beans.get(0); <context:annotation-config/> if (bean.getPassword() != null && <context:component-scan bean.getPassword().equals(password)) { base-package="sample.spring.mvc.service"/> loginManager.setLoginUser(bean); return true; <bean id="loginManager" scope="session" } class="sample.spring.mvc.service.LoginManager"> } <aop:scoped-proxy/> return false; </bean> } </beans>} Developers Summit 2011
    • @Repository("memberDao")public class MemberDaoImpl implements MemberDao { @PersistenceContext EntityManager em; public List<LoginBean> findByLoginname(String loginname) { Query query = em.createQuery( appContext-dao.xml "SELECT l FROM LoginBean l WHERE l.loginname = :loginname"); <?xml version="1.0" encoding="UTF-8"?> <beans ...> query.setParameter("loginname", loginname); <context:annotation-config/> return query.getResultList(); <context:component-scan base-package="sample.spring.mvc.dao"/> } <bean id="entityManagerFactory"} class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="sample" /> </bean> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <tx:annotation-driven transaction-manager="transactionManager"/> </beans> Developers Summit 2011
    • @Entity@Table(name="member") AppEnginepublic class LoginBean implements Serializable { JPA public LoginBean() {} @Id <?xml version="1.0" encoding="UTF-8" standalone="no"?> @GeneratedValue(strategy =<persistence …> GenerationType.IDENTITY) <persistence-unit name="sample"> private String id; <provider>org.datanucleus.store.appengine.jpa.DatastorePersistenceProvider</provider> //@Column(unique=true) <properties> private String loginname; <property name="datanucleus.NontransactionalRead" value="true"/> <property name="datanucleus.NontransactionalWrite" value="true"/> private String password; <property name="datanucleus.ConnectionURL" value="appengine"/> //@Column(name="name") <property name="datanucleus.ConnectionUserName" value=""/> private String nickname; <property name="datanucleus.ConnectionPassword" value=""/> <property name="datanucleus.autoCreateSchema" value="false"/> ... <property name="datanucleus.autoCreateTables" value="true"/> } <property name="datanucleus.autoCreateColumns" value="false"/> <property name="datanucleus.autoCreateConstraints" value="false"/> <property name="datanucleus.validateTables" value="false"/> <property name="datanucleus.validateConstraints" value="false"/> <property name="datanucleus.jpa.addClassTransformer" value="false"/> </properties> </persistence-unit> </persistence> Developers Summit 2011 persistence.xml
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011
    • Developers Summit 2011