Simplify Enterprise Development with Scripting <ul><li>Tugdual Grall </li></ul><ul><li>Principal Product Manager </li></ul...
 
Scripting Strikes Back <Insert Picture Here>
Scripts are back <ul><li>Scripting: </li></ul><ul><ul><li>PHP, Ruby On Rails for Web Application Development </li></ul></u...
What scripts are good for? The main use cases of integration <ul><li>Prototyping/Testing </li></ul><ul><ul><li>Shell or bu...
Java and Scripting <ul><li>Java is a platform with a default language named Java.... </li></ul><ul><li>Leveraging the Java...
Java and Scripting   Many languages exist Javascript/Rhino Ruby/JRuby Python/Jython JudoScript BeanShell PNuts Tcl/Jacl Gr...
Java and Scripting In this talk.... <ul><li>Javascript </li></ul><ul><ul><li>Javascript is part of the new Java SE 6 envir...
Demonstration: Using Javascript in Java 6 <Insert Picture Here>
Calling scripts from Java import javax.scripting.* String fLocation = &quot;/OOW-2006-Scripting//customer-validation.js&qu...
Easier? <Insert Picture Here>
Simple Example  Java Code public class FilterApp { public static void main(String[] args) { List<String> list = new ArrayL...
Simple Example Groovy Code   def list = [&quot;Olaf&quot;,&quot;Tug&quot;,&quot;John&quot;,&quot;Dave&quot;] def data = li...
Groovy Features <ul><li>Dynamic and (optional) static typing </li></ul><ul><li>int a = 2 </li></ul><ul><li>def str = &quot...
Groovy Features (Cont.) <ul><li>Regex built-in </li></ul><ul><li>if ( &quot;name&quot; ==~ &quot;na.*&quot; ) { println &q...
Groovy Markup Native Support for Markup Languages <ul><li>Native support for hierarchical structures in code </li></ul><ul...
Groovy SQL Easy RDBMS Access <ul><li>Easy to use JDBC software thanks to closures </li></ul><ul><ul><li>def sql = Sql.newI...
Demonstration: Samples Applications <Insert Picture Here>
Administer OracleAS with Scripts Integrating JMX and Groovy Java Application Console
What is an MBean <ul><li>MBean is an embedded Java Object that instruments a Java application </li></ul><ul><li>It enables...
Demonstration: Administer OracleAS with Scripts & Groovier ADF-BC Groovier ADF-BC <Insert Picture Here>
Administration Using Scripts <ul><li>Administer your server with the power of Java and the Simplicity of Groovy </li></ul>...
Standardization & Integration JSR 223: Scripting for the Java Platform <Insert Picture Here>
JSR 223: Scripting for the Java Platform <ul><li>One API to rule them all! </li></ul><ul><li>JSE 6 includes JSR 223 and em...
Easy Development Use dynamic languages to  build Web Applications <Insert Picture Here>
Rapid Application Development The main use cases of integration <ul><li>Convention over configuration </li></ul><ul><li>Le...
Introduction to * Rails Ruby On Rails and Grails overview Ruby On Rails Grails <ul><li>aka: RoR & Rails </li></ul><ul><li>...
Grails Project Infrastructure + PROJECT_HOME + grails-app + conf + controllers + domain + i18n + services + taglib + views...
Demonstration: Create Application with Grails <Insert Picture Here>
Rapid Application Development Summary <ul><li>Development is  really  fast </li></ul><ul><li>Leverage WEB 2.0 </li></ul><u...
Summary <ul><li>Scripting technologies facilitate development </li></ul><ul><ul><li>Rapid integration of existing componen...
 
 
Upcoming SlideShare
Loading in …5
×

Scripting Oracle Develop 2007

2,175 views
2,124 views

Published on

A presentation that I gave during Oracle Develop 2007

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
  • An excellent presentation now embedded at OracleLink.com - The Oracle Community Network



    http://www.oraclelink.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,175
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
0
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Scripting Oracle Develop 2007

  1. 1. Simplify Enterprise Development with Scripting <ul><li>Tugdual Grall </li></ul><ul><li>Principal Product Manager </li></ul><ul><li>Oracle Application Server </li></ul>
  2. 3. Scripting Strikes Back <Insert Picture Here>
  3. 4. Scripts are back <ul><li>Scripting: </li></ul><ul><ul><li>PHP, Ruby On Rails for Web Application Development </li></ul></ul><ul><ul><li>Python, Perl for administrative tasks </li></ul></ul><ul><ul><li>in the browser when doing AJAX applications </li></ul></ul><ul><li>JCP agreed to standardize Groovy (JSR 241) and BeanShell (JSR 274) </li></ul><ul><li>Upcoming bytecode invokeDynamic (JSR 292) </li></ul><ul><li>Sun hires JRuby project leader,Microsoft IronPython leader, and also created JavaFX </li></ul><ul><li>Need simplicity to overcome enterprise development complexity </li></ul><ul><li>Extensibility using Domain Specific Languages (DSL) </li></ul>
  4. 5. What scripts are good for? The main use cases of integration <ul><li>Prototyping/Testing </li></ul><ul><ul><li>Shell or build scripts, data manipulation, unit testing, code generation driving native applications </li></ul></ul><ul><li>Building Standalone applications </li></ul><ul><ul><li>Small to mid-sized non-critical applications </li></ul></ul><ul><li>Integrating Scripting in Java EE applications </li></ul><ul><ul><li>Programmatic configuration </li></ul></ul><ul><ul><li>Business Rules Externalization </li></ul></ul><ul><ul><li>UI or Applications customizations </li></ul></ul>
  5. 6. Java and Scripting <ul><li>Java is a platform with a default language named Java.... </li></ul><ul><li>Leveraging the Java platform with a dynamic language </li></ul><ul><ul><li>Access all JavaEE resources </li></ul></ul><ul><ul><li>Reuse existing API of the Java Platform </li></ul></ul><ul><li>Java & Scripting standardization </li></ul><ul><ul><li>A new JSR to integrate scripts with Java: JSR 223 </li></ul></ul><ul><ul><li>Language specific JSRL Groovy (JSR 241), BeanShell </li></ul></ul><ul><ul><li>Javascript is now part of Java (Java 6) using JSR 223 </li></ul></ul>
  6. 7. Java and Scripting Many languages exist Javascript/Rhino Ruby/JRuby Python/Jython JudoScript BeanShell PNuts Tcl/Jacl Groovy Quercus FScript Sleep Bambookit ObjectScript Jickle Yoix Simkin BSF Dawn DynamicJava W4F Netscript PolyJsp FESI iScript
  7. 8. Java and Scripting In this talk.... <ul><li>Javascript </li></ul><ul><ul><li>Javascript is part of the new Java SE 6 environment </li></ul></ul><ul><ul><li>Based on the Rhino project </li></ul></ul><ul><li>Groovy </li></ul><ul><ul><li>Open Source language </li></ul></ul><ul><li>Grails </li></ul><ul><ul><li>Open Source Web Application Development framework </li></ul></ul>
  8. 9. Demonstration: Using Javascript in Java 6 <Insert Picture Here>
  9. 10. Calling scripts from Java import javax.scripting.* String fLocation = &quot;/OOW-2006-Scripting//customer-validation.js&quot;; ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName(&quot; JavaScript &quot;); engine.eval(new InputStreamReader( new FileInputStream(fLocation))); inv = ( Invocable ) engine; inv. invoke (&quot;getCustomerDiscount&quot;, new Object[] {customerType} ); Java 6 Build In Feature
  10. 11. Easier? <Insert Picture Here>
  11. 12. Simple Example Java Code public class FilterApp { public static void main(String[] args) { List<String> list = new ArrayList(); list.add(&quot;Olaf&quot;); list.add(&quot;Tug&quot;); list.add(&quot;John&quot;); list.add(&quot;Dave&quot;); FilterApp filter = new FilterApp(); List<String> data = filter.filterLongerThan(list,4); System.out.println(data.size()); Iterator it = data.iterator(); while (it.hasNext()) {System.out.println(it.next());} } public List filterLongerThan(List list, int length) { List<String> result = new ArrayList(); Iterator it = list.iterator(); while (it.hasNext()) { String item = (String)it.next(); if (item.length()>= length) {result.add(item);} } return result; } }
  12. 13. Simple Example Groovy Code def list = [&quot;Olaf&quot;,&quot;Tug&quot;,&quot;John&quot;,&quot;Dave&quot;] def data = list.findAll { it.size() >= 4 } println data.size() data.each { println it } Java 25-30 Lines / Groovy 4 lines
  13. 14. Groovy Features <ul><li>Dynamic and (optional) static typing </li></ul><ul><li>int a = 2 </li></ul><ul><li>def str = &quot;Hello&quot; </li></ul><ul><li>Native syntax for lists, maps, arrays, beans, etc. </li></ul><ul><li>def list = [&quot;Rod&quot;, 3, new Date()] </li></ul><ul><li>def myMap = [Neeta:32, Eric:34] </li></ul><ul><li>Closures </li></ul><ul><li>myMap.each( {name, age -> println &quot;$name is $age years old&quot; }) </li></ul><ul><li>>Eric is 34 years old </li></ul><ul><li>>Neeta is 32 years old </li></ul>
  14. 15. Groovy Features (Cont.) <ul><li>Regex built-in </li></ul><ul><li>if ( &quot;name&quot; ==~ &quot;na.*&quot; ) { println &quot;match!&quot; } </li></ul><ul><li>-> match! </li></ul><ul><li>Operator overloading </li></ul><ul><li>def list = [1, 2, 3] + [4, 5, 6] </li></ul><ul><li>list.each { print it } </li></ul><ul><li>-> 123456 </li></ul><ul><li>Autoboxing and polymorphism across collection, array, map, bean, String, iterators, etc. </li></ul><ul><li>String[] array = ['cat', 'dog', 'mouse'] </li></ul><ul><li>def str = 'hello' </li></ul><ul><li>Println&quot;${array.size()},${str.size()}, ${list.size()} -> 3,5,6 </li></ul>
  15. 16. Groovy Markup Native Support for Markup Languages <ul><li>Native support for hierarchical structures in code </li></ul><ul><ul><li>XML </li></ul></ul><ul><ul><li>XHTML </li></ul></ul><ul><ul><li>Ant </li></ul></ul><ul><ul><li>Swing </li></ul></ul><ul><ul><li>SWT </li></ul></ul><ul><li>Relatively easy to add your own </li></ul>
  16. 17. Groovy SQL Easy RDBMS Access <ul><li>Easy to use JDBC software thanks to closures </li></ul><ul><ul><li>def sql = Sql.newInstance(url, usr, pwd, driver) </li></ul></ul><ul><ul><li>sql.execute(&quot;insert into table values ($foo, $bar)&quot;) </li></ul></ul><ul><ul><li>sql.execute(&quot;insert into table values(?,?)&quot;, [a, b]) </li></ul></ul><ul><ul><li>sql.eachRow(&quot;select * from EMPLOYEES&quot;) { print it.name } </li></ul></ul><ul><ul><li>def list = sql.rows(&quot;select * from EMPLOYEES&quot;) </li></ul></ul><ul><li>DataSet notion: poor-man ORM </li></ul><ul><ul><li>def set = sql.dataSet(&quot;EMPLOYEES&quot;) </li></ul></ul><ul><ul><li>set.add(name: &quot;Johnny&quot;, age: 33) </li></ul></ul><ul><ul><li>set.each { user -> println user.name } </li></ul></ul><ul><ul><li>set.findAll { it.age > 22 && it.age < 42 } </li></ul></ul>
  17. 18. Demonstration: Samples Applications <Insert Picture Here>
  18. 19. Administer OracleAS with Scripts Integrating JMX and Groovy Java Application Console
  19. 20. What is an MBean <ul><li>MBean is an embedded Java Object that instruments a Java application </li></ul><ul><li>It enables management tools to remotely administer a Java Application </li></ul>Java Application MBean Management Tool
  20. 21. Demonstration: Administer OracleAS with Scripts & Groovier ADF-BC Groovier ADF-BC <Insert Picture Here>
  21. 22. Administration Using Scripts <ul><li>Administer your server with the power of Java and the Simplicity of Groovy </li></ul><ul><ul><li>Automate all repetitive tasks </li></ul></ul><ul><ul><li>Glue administrative tasks easily </li></ul></ul><ul><ul><li>Extend the administration capability with custom scripts </li></ul></ul>client = new OC4JClient() client.connect(&quot;localhost&quot;,&quot;23791&quot;,&quot;oc4jadmin&quot;,&quot;welcome1&quot;) defaultApp = client.helper.createGroovyMBean(client.helper.DEFAULTAPP_MBEAN_NAME); println &quot; --> Create ConnectionPool&quot; defaultApp.createJDBCConnectionPool(&quot;MyPool&quot;, &quot;oracle.jdbc.pool.OracleDataSource&quot;, &quot;scott&quot;, &quot;tiger&quot;, &quot;jdbc:oracle:thin:@localhost:1521:xe&quot;)
  22. 23. Standardization & Integration JSR 223: Scripting for the Java Platform <Insert Picture Here>
  23. 24. JSR 223: Scripting for the Java Platform <ul><li>One API to rule them all! </li></ul><ul><li>JSE 6 includes JSR 223 and embeds JavaScript </li></ul><ul><li>RI already usable starting from JDK 1.4 </li></ul><ul><ul><li>With Groovy, PHP, and Rhino </li></ul></ul><ul><li>ScriptEngines provide a common way to integrate stateful interpreters into Java </li></ul><ul><li>Invocable and Compilable interfaces extend ScriptEngines to support generic function invocations and compilation of scripts </li></ul>
  24. 25. Easy Development Use dynamic languages to build Web Applications <Insert Picture Here>
  25. 26. Rapid Application Development The main use cases of integration <ul><li>Convention over configuration </li></ul><ul><li>Leverage Dynamic nature of the languages </li></ul><ul><li>Imposes strong design constraints </li></ul><ul><li>Generators for creating code skeletons and scaffolding </li></ul><ul><li>CRUD oriented ( C reate R ead U pdate D elete) </li></ul>
  26. 27. Introduction to * Rails Ruby On Rails and Grails overview Ruby On Rails Grails <ul><li>aka: RoR & Rails </li></ul><ul><li>Convention over ConfigurationDon’t Repeat Yourself (DRY)Based on Ruby </li></ul><ul><li>Deployed as CGI/Fast CGI or in its own server (WEBRick) </li></ul><ul><li>... JRuby/JRubyOnRails... </li></ul><ul><li>Inspired by RoRDon’t Repeat Yourself (DRY)Based on Groovy </li></ul><ul><li>Leverage Java EE platform, Spring and other frameworks </li></ul><ul><li>Deployed as Java Web Applications </li></ul>
  27. 28. Grails Project Infrastructure + PROJECT_HOME + grails-app + conf + controllers + domain + i18n + services + taglib + views + lib + spring + hibernate + src + web-app + PROJECT_HOME + grails-app + conf + controllers + domain + i18n + services + taglib + views + lib + spring + hibernate + src + web-app Main Grails resources Additional Spring configuration Web resources e.g. CSS, JavaScript etc. Java sources Jar archive libraries
  28. 29. Demonstration: Create Application with Grails <Insert Picture Here>
  29. 30. Rapid Application Development Summary <ul><li>Development is really fast </li></ul><ul><li>Leverage WEB 2.0 </li></ul><ul><ul><li>AJAX is built-in </li></ul></ul><ul><ul><li>rapid and iterative development </li></ul></ul><ul><ul><li>integrated testing framework </li></ul></ul><ul><li>However, for large scale applications static-typing and IDE support is crucial </li></ul><ul><li>Provides the ability to use a blended approach </li></ul><ul><li>Think about the deployment and management in the beginning </li></ul><ul><ul><li>Grails leverages the JVM, JavaEE and run in an Application Server </li></ul></ul>
  30. 31. Summary <ul><li>Scripting technologies facilitate development </li></ul><ul><ul><li>Rapid integration of existing components </li></ul></ul><ul><ul><li>Choose your language based on </li></ul></ul><ul><ul><ul><li>your skills (eg: expert in Python... use Jython) </li></ul></ul></ul><ul><ul><ul><li>target: stand-alone, embedded in Java application, ... </li></ul></ul></ul><ul><li>RAD of Web Application </li></ul><ul><ul><li>leverage scripting to build applications </li></ul></ul><ul><li>Dynamic languages are now mainstream </li></ul><ul><ul><li>JSR 223 </li></ul></ul><ul><ul><li>Javscript in Java SE 6 </li></ul></ul><ul><ul><li>More to come in next releases </li></ul></ul>

×