1 / 24

An Introduction to IBM WebSphere sMash

An Introduction to IBM WebSphere sMash. Robin Fernandes - PHP Runtime for WebSphere sMash robinf@php.net / robin_fernandes@uk.ibm.com . Why WebSphere sMash? . Developers want to: Build Web apps quickly . Re-use and combine existing apps simply .

morton
Download Presentation

An Introduction to IBM WebSphere sMash

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction to IBM WebSphere sMash Robin Fernandes - PHP Runtime for WebSphere sMash robinf@php.net / robin_fernandes@uk.ibm.com Introduction to IBM WebSphere sMash

  2. Why WebSphere sMash? • Developers want to: • Build Web apps quickly. • Re-use and combine existing apps simply. • Take an agile approach to Web app development. • Quick reaction to change • Cost-effective development • Ease of deployment  Speed, Simplicity, Agility • Developers are adopting: • Dynamic scripting languages for application logic (PHP, Ruby, Groovy…) • Low barrier to entry, high productivity • Enable “Search, copy and paste” style development • REST, JSON to tie Web Apps together • Simple, works well with Ajax

  3. What is WebSphere sMash? A complete platform for developing, assembling and executing agile Web 2.0 apps quickly and simply. • Started in 2007 as Project Zero, a community driven incubator project • http://projectzero.org • Released as WebSphere sMash product in May 2008 • Built from the ground up with a focus on Speed, Simplicity & Agility

  4. JVM Web server Application Code Language runtimes WebSphere sMash: Speed (time to value) • Quick to get started • Download from projectzero.org and unzip • Scripting languages: low barrier to entry • PHP, Groovy • Convention over configuration • Common tasks shouldn't require configuration • Application-centric runtime • Write the app, run it, and it’s ready for use. • No need for a separate application server. sMash application:

  5. WebSphere sMash: Simplicity • Small number of new concepts in sMash • Scripts, Events, Global Context • Focus on RESTful architecture • Build applications around CRUDL events on Resources • Tooling to encourage use of REST • Trivial deployment • To move an app to another machine: zip, copy, run

  6. WebSphere sMash: Agility • A clean runtime for your applications • Each app has its own JVM process  isolation • Short-lived processes (“ZSO” manages startup on 1st request, recycle) • App ready for use in <1s, footprint is ~380KB idle and ~28MB running • Modular architecture • Features and pre-built services downloaded as required • Core modules about ~5MB (includes HTTP stack, Groovy support) • Browser-based tooling for client and server-side development • Includes visual tools to simplify Web app interoperation

  7. RTE DE Versions of WebSphere sMash

  8. Demo: • WebSphere sMash on http://projectzero.org • The AppBuilder • Hello World on WebSphere sMash • Modules

  9. Available Modules • There are 65+ modules available currently • Modules provide function in many categories • Data Formats (JSON, ATOM, RSS, XML) • Data Access • Resource Modelling • Security / Content Filtering • Activity Flows • Services • Amazon ECS, Flickr, Weather, etc • Utilities (such as HTML parsing) • Management Tools • Development Tooling • Reliable Transport Engine for Messaging Interactions

  10. Key Concept: Events • WebSphere sMash initiates well-known system events. • Developers define the application behaviour by implementing event handlers. • Conventions define where sMash will search for event handlers. • Events are stateless. State information is stored in the Global Context.

  11. Key Concept: The Global Context • It’s a map of data! • Language-agnostic • Used for passing data between events, for storing application state • Zones define the life time of the data: Non-persistent Spot the zget() & zput() calls in the next demo! Persistent http://www.projectzero.org/sMash/1.0.x/docs/zero.devguide.doc/zero.core/GlobalContextReference.html

  12. Key Concept: RESTful Architecture • What is REST? • Application is defined in terms of Resources • Resources are exposed as URIs • Behaviour is governed by HTTP requests on these URIs • Standard HTTP methods specify the action to carry out on the resource (POST / GET / PUT / DELETE ) • Requests are stateless: HTTP requests contains enough information to carry out the desired operation in full  Scalable, because the request can be handled by any back-end system • http://myshop.com/customer • GET: Returns a list of customers • POST: Creates a customer record • http://myshop.com/customer/homer • GET: Retrieves customer record ‘homer’ • PUT: Updates record ‘homer’ • DELETE: Deletes record ‘homer’

  13. Demo: a RESTful Pastebin • What’s a Pastebin? see http://pastebin.com • Website for sharing snippets of text, usually code; get a URL for that snippet. • Useful for collaborating, heavily used by PHP community (help finding bugs in code, submitting patches etc…) • We’ll use the “Zero Resource Model” • The RESTful resource we’ll use in this demo: “snippet” : { “title”: string, “lang” : string, “body” : string }

  14. JVM The PHP Engine • Why PHP in sMash? • Gartner predict that within 5 years, 60% of 5.5 million PHP developers will work in corporate IT (up from 13% of 3M today) • Vast amounts of PHP code available for “search/copy/paste” development • Wikipedia, Facebook, Flickr, Yahoo, phpBB, SugarCRM… • http://php.net: the de facto standard PHP engine • Open Source, written in C • Vast array of extension functions (String, image manipulation, IMAP…) • Why write a PHP engine in Java for sMash? • Dynamic Languages + JVM =♥ • Excellent interop with sMash’s Java APIs – and with any Java code!

  15. PHP Engine Architecture Debug API (DBGp) Runtime • Runtime for PHP 5 scripts • Implemented in Java, runs on any Java 5+ VM • Parse script to intermediate representation • Compile to bytecode • JVM executes the bytecode • Bytecode calls back into runtime to access PHP language elements, which are represented as Java objects • Extensibility via XAPI • XAPI-C for C extensions from php.net • XAPI-J for new Java extensions, native libraries invoked over JNI and Project Zero interface • Extension language choice opaque to PHP script • Debug via DBGp using Eclipse with PDT PHP Scripts sMash CLI SAPI - J PHP Engine AST Parser P8 Runtime Variables Compiler opcodes Stack Interpreter Resources .class Classes Objects Cache XAPI-J XAPI-C Java Extensions C Extensions Native code sMash Extensions

  16. PHP Language Support • Core PHP extensions supported • Currently supports a subset of PHP extensions • The goal is maximum re-use of existing PHP scripts and applications. phpBB SugarCRM

  17. Two levels of PHP/Java Integration • <?php • $date = new Java("java.util.Date", 70, 9, 4); • var_dump($date->toString()); • $map = new Java("java.util.HashMap"); • $map->put("title", "Java Bridge!"); • $map->put("when", $date); • echo$map->get("when")->toString()."\n"; • echo$map->get("title")."\n"; • $array = array(1,2,3,4,5); • $map->put("stuff", $array); // PHP array to Java Map • var_dump($map->get("stuff"))."\n"; • ?> • Direct use of Java objects in PHP Code:

  18. Two levels of PHP/Java Integration • Use annotations and a thin wrapper around your Java code • Allows definition of PHP specific attributes that could not be represented in plain Java code. @XAPIClass("ArrayObject") publicfinalclassArrayObjectDescriptor { @XAPIMethod(name = "setIteratorClass") @XAPIForbidStaticCalls @XAPIArguments( PassSemantics = { XAPIPassSemantics.ByValue }, MandatoryArguments = 1, MaximumArguments = 2, DefaultValues = { "ArrayIterator" } ) publicstaticvoid setIteratorClass(RuntimeContextStack runtime, intargsPassed){ //...

  19. Show PHP interacting with a custom Java asset Demo: PHP / Java Integration PHP Code PHP Runtime in sMash Your Java code AST Generator! JVM

  20. Features we didn’t cover • Client Programming with the Dojo Framework • Assemble Tooling • Data APIs • Security • Eclipse-based tooling • REST to SOAP adapter • Reliable Messaging • Error Handling • Logging, Tracing, Debugging • …

  21. Summary • WebSphere sMash: • Runtime optimized for quickly and easily creating situational applications • Low barrier to entry • Browser-based tooling for client and server side development • Convention over configuration • Focus on REST • Java/PHP/Groovy interoperability • All, including PHP, run on the JVM

  22. http://projectzero.org Community site for users and developers • Content • Documentation and User Guides • Design documents and Roadmaps • Demos and Samples • Forum for interactive discussion • Help and Feedback for questions from users • Developer Alerts to notify users of new features and breaking changes • Development discussion • 3554 Posts on 828 Topics to date • Blogs • Development blog with interesting commentary, demos, and opinion • News blog for project announcements • Binary Downloads (500,000 and counting…) • Bug Tracking System (Bugzilla) • Source code (Subversion)

  23. Links • http://projectzero.org • Search for WebSphere sMash onhttp://www.ibm.com/developerworks • Thanks to the following for presentation material: • Colin Thorne, Stuart Hayton, Don Boulia, Rob Nicholson, Roland Barcia, Steve Ims Robin Fernandes robinf@php.net robin_fernandes@uk.ibm.com

  24. Legal Notices • Java and all Java-based trademarks and logos are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. • Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. • Intel and Pentium are trademarks or registered trademark of Intel Corporation or its subsidiaries in the United States and other countries. • UNIX is a registered trademark of The Open Group in the United States and other countries. • Linux is a trademark of Linus Torvalds in the United States, other countries, or both. • Other company, product, or service names may be trademarks or service marks of others.

More Related