Scripting Oracle Develop 2007

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

1 comments

Comments 1 - 1 of 1 previous next Post a comment

Post a comment
Embed Video
Edit your comment Cancel

2 Favorites

Scripting Oracle Develop 2007 - Presentation Transcript

  1. Simplify Enterprise Development with Scripting
    • Tugdual Grall
    • Principal Product Manager
    • Oracle Application Server
  2.  
  3. Scripting Strikes Back <Insert Picture Here>
  4. Scripts are back
    • Scripting:
      • PHP, Ruby On Rails for Web Application Development
      • Python, Perl for administrative tasks
      • in the browser when doing AJAX applications
    • JCP agreed to standardize Groovy (JSR 241) and BeanShell (JSR 274)
    • Upcoming bytecode invokeDynamic (JSR 292)
    • Sun hires JRuby project leader,Microsoft IronPython leader, and also created JavaFX
    • Need simplicity to overcome enterprise development complexity
    • Extensibility using Domain Specific Languages (DSL)
  5. What scripts are good for? The main use cases of integration
    • Prototyping/Testing
      • Shell or build scripts, data manipulation, unit testing, code generation driving native applications
    • Building Standalone applications
      • Small to mid-sized non-critical applications
    • Integrating Scripting in Java EE applications
      • Programmatic configuration
      • Business Rules Externalization
      • UI or Applications customizations
  6. Java and Scripting
    • Java is a platform with a default language named Java....
    • Leveraging the Java platform with a dynamic language
      • Access all JavaEE resources
      • Reuse existing API of the Java Platform
    • Java & Scripting standardization
      • A new JSR to integrate scripts with Java: JSR 223
      • Language specific JSRL Groovy (JSR 241), BeanShell
      • Javascript is now part of Java (Java 6) using JSR 223
  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
  8. Java and Scripting In this talk....
    • Javascript
      • Javascript is part of the new Java SE 6 environment
      • Based on the Rhino project
    • Groovy
      • Open Source language
    • Grails
      • Open Source Web Application Development framework
  9. Demonstration: Using Javascript in Java 6 <Insert Picture Here>
  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
  11. Easier? <Insert Picture Here>
  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; } }
  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
  14. Groovy Features
    • Dynamic and (optional) static typing
    • int a = 2
    • def str = &quot;Hello&quot;
    • Native syntax for lists, maps, arrays, beans, etc.
    • def list = [&quot;Rod&quot;, 3, new Date()]
    • def myMap = [Neeta:32, Eric:34]
    • Closures
    • myMap.each( {name, age -> println &quot;$name is $age years old&quot; })
    • >Eric is 34 years old
    • >Neeta is 32 years old
  15. Groovy Features (Cont.)
    • Regex built-in
    • if ( &quot;name&quot; ==~ &quot;na.*&quot; ) { println &quot;match!&quot; }
    • -> match!
    • Operator overloading
    • def list = [1, 2, 3] + [4, 5, 6]
    • list.each { print it }
    • -> 123456
    • Autoboxing and polymorphism across collection, array, map, bean, String, iterators, etc.
    • String[] array = ['cat', 'dog', 'mouse']
    • def str = 'hello'
    • Println&quot;${array.size()},${str.size()}, ${list.size()} -> 3,5,6
  16. Groovy Markup Native Support for Markup Languages
    • Native support for hierarchical structures in code
      • XML
      • XHTML
      • Ant
      • Swing
      • SWT
    • Relatively easy to add your own
  17. Groovy SQL Easy RDBMS Access
    • Easy to use JDBC software thanks to closures
      • def sql = Sql.newInstance(url, usr, pwd, driver)
      • sql.execute(&quot;insert into table values ($foo, $bar)&quot;)
      • sql.execute(&quot;insert into table values(?,?)&quot;, [a, b])
      • sql.eachRow(&quot;select * from EMPLOYEES&quot;) { print it.name }
      • def list = sql.rows(&quot;select * from EMPLOYEES&quot;)
    • DataSet notion: poor-man ORM
      • def set = sql.dataSet(&quot;EMPLOYEES&quot;)
      • set.add(name: &quot;Johnny&quot;, age: 33)
      • set.each { user -> println user.name }
      • set.findAll { it.age > 22 && it.age < 42 }
  18. Demonstration: Samples Applications <Insert Picture Here>
  19. Administer OracleAS with Scripts Integrating JMX and Groovy Java Application Console
  20. What is an MBean
    • MBean is an embedded Java Object that instruments a Java application
    • It enables management tools to remotely administer a Java Application
    Java Application MBean Management Tool
  21. Demonstration: Administer OracleAS with Scripts & Groovier ADF-BC Groovier ADF-BC <Insert Picture Here>
  22. Administration Using Scripts
    • Administer your server with the power of Java and the Simplicity of Groovy
      • Automate all repetitive tasks
      • Glue administrative tasks easily
      • Extend the administration capability with custom scripts
    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;)
  23. Standardization & Integration JSR 223: Scripting for the Java Platform <Insert Picture Here>
  24. JSR 223: Scripting for the Java Platform
    • One API to rule them all!
    • JSE 6 includes JSR 223 and embeds JavaScript
    • RI already usable starting from JDK 1.4
      • With Groovy, PHP, and Rhino
    • ScriptEngines provide a common way to integrate stateful interpreters into Java
    • Invocable and Compilable interfaces extend ScriptEngines to support generic function invocations and compilation of scripts
  25. Easy Development Use dynamic languages to build Web Applications <Insert Picture Here>
  26. Rapid Application Development The main use cases of integration
    • Convention over configuration
    • Leverage Dynamic nature of the languages
    • Imposes strong design constraints
    • Generators for creating code skeletons and scaffolding
    • CRUD oriented ( C reate R ead U pdate D elete)
  27. Introduction to * Rails Ruby On Rails and Grails overview Ruby On Rails Grails
    • aka: RoR & Rails
    • Convention over ConfigurationDon’t Repeat Yourself (DRY)Based on Ruby
    • Deployed as CGI/Fast CGI or in its own server (WEBRick)
    • ... JRuby/JRubyOnRails...
    • Inspired by RoRDon’t Repeat Yourself (DRY)Based on Groovy
    • Leverage Java EE platform, Spring and other frameworks
    • Deployed as Java Web Applications
  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
  29. Demonstration: Create Application with Grails <Insert Picture Here>
  30. Rapid Application Development Summary
    • Development is really fast
    • Leverage WEB 2.0
      • AJAX is built-in
      • rapid and iterative development
      • integrated testing framework
    • However, for large scale applications static-typing and IDE support is crucial
    • Provides the ability to use a blended approach
    • Think about the deployment and management in the beginning
      • Grails leverages the JVM, JavaEE and run in an Application Server
  31. Summary
    • Scripting technologies facilitate development
      • Rapid integration of existing components
      • Choose your language based on
        • your skills (eg: expert in Python... use Jython)
        • target: stand-alone, embedded in Java application, ...
    • RAD of Web Application
      • leverage scripting to build applications
    • Dynamic languages are now mainstream
      • JSR 223
      • Javscript in Java SE 6
      • More to come in next releases
  32.  
  33.  

+ Tugdual GrallTugdual Grall, 2 years ago

custom

1513 views, 2 favs, 0 embeds more stats

A presentation that I gave during Oracle Develop 20 more

More info about this document

© All Rights Reserved

Go to text version

  • Total Views 1513
    • 1513 on SlideShare
    • 0 from embeds
  • Comments 1
  • Favorites 2
  • Downloads 0
Most viewed embeds

more

All embeds

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories