Project Zero
Encyclopedia
WebSphere sMash is a development and runtime environment from IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...

 for the creation of dynamic web applications using the scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

s Groovy and PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

. It contains a PHP runtime
Run-time system
A run-time system is a software component designed to support the execution of computer programs written in some computer language...

 written in Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

.
Project Zero is the experimental software development community in which new versions of WebSphere
WebSphere
IBM WebSphere refers to a brand of computer software products in the genre of enterprise software known as "application and integration middleware". These software products are used by end-users to create applications and integrate applications with other applications...

 sMash are incubated.

WebSphere Smash integrates with Eclipse
Eclipse (software)
Eclipse is a multi-language software development environment comprising an integrated development environment and an extensible plug-in system...

 and produces REST
Rest
Rest may refer to:* Leisure* Human relaxation* SleepRest may also refer to:* Rest , a pause in a piece of music* Rest , the relation between two observers* Rest , a 2008 album by Gregor Samsa...

-style services on top of Groovy or PHP
.

Architecture

There are a number of distinguishing aspects to the architecture of WebSphere sMash.

Event-driven programming model

WebSphere sMash uses an event-driven programming
Event-driven programming
In computer programming, event-driven programming or event-based programming is a programming paradigm in which the flow of the program is determined by events—i.e., sensor outputs or user actions or messages from other programs or threads.Event-driven programming can also be defined as an...

 model. Applications are typically composed of a number of small modules which communicate with each other by firing events which are then caught by other handlers that have registered to catch the events. The code firing the event does not have any knowledge of the code that will handle the event. This architecture allows application to be built up from a mixture of code written using PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

, Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

, Groovy or the Flow language.

Global context

Since events are stateless
Program state
One of the key concepts in computer programming is the idea of state, essentially a snapshot of the measure of various conditions in the system. Most programming languages require a considerable amount of state information in order to operate properly - information which is generally hidden from...

, a mechanism is required to share data between event handlers. This mechanism is the Global Context. The Global context functions basically as a large map of data divided up into various zones with different lifetimes, properties and persistence.

Repository management system

sMash makes use of the Ivy
Apache Ivy
Apache Ivy is a transitive relation dependency manager. It is a sub-project of the Apache Ant project, with which Ivy works to resolve project dependencies. An external XML file defines project dependencies and lists the resources necessary to build a project...

 dependency manager. sMash applications are composed of models which can specify dependencies on other modules which may be present in a local Ivy repository or which can be fetched from a remote repository. IBM maintains a repository of useful modules at projectzero.org and dependencies can also be specified on the maven2 repository.

PHP support

The PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

 support in WebSphere sMash is provided by a PHP runtime implemented in Java.. PHP scripts are compiled into Java bytecode
Java bytecode
Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use...

 which then run on the Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 Virtual Machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

 (JVM). This is similar in concept to the approach taken by other projects such as JRuby
JRuby
JRuby is a Java implementation of the Ruby programming language, being developed by the JRuby team. It is free software released under a three-way CPL/GPL/LGPL license...

 and Jython
Jython
Jython, successor of JPython, is an implementation of the Python programming language written in Java.-Overview:Jython programs can seamlessly import and use any Java class. Except for some standard modules, Jython programs use Java classes instead of Python modules...

, which run the Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 and Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 languages, respectively, against the JVM. Running on the JVM allows direct, same process calls between PHP, Java and Groovy code allowing applications to be assembled using a variety of languages.

In contrast to the approach taken by Quercus, the other JVM based PHP implementation, sMash is able to re-use existing PHP extensions from PHP.net attaching them to the Java virtual machine via the Java Native Interface (JNI) and an API layer called XAPI-C.

The runtime has a DBGp debug port allowing debug access from IDEs and debuggers which support the DBGp protocol such as the Eclipse
Eclipse (software)
Eclipse is a multi-language software development environment comprising an integrated development environment and an extensible plug-in system...

 PDT
PHP Development Tools
PHP Development Tools is a Language IDE plugin for the Eclipse platform and the open source project that develops it.The project intends to encompass all tools necessary to develop PHP based software...

 project.

The PHP runtime does not have an identity outside of sMash so it is simply referred to as the "WebSphere sMash runtime for PHP."

As of October 2008 WebSphere sMash is capable of running several well known PHP applications on a Java Virtual Machine. These include SugarCRM
SugarCRM
SugarCRM is a software company based in Cupertino, California. They produce the web application Sugar, also known as SugarCRM, which is a customer relationship management system that is available in both open source and Commercial open source applications.Sugar's functionality includes sales-force...

 , phpBB
PhpBB
phpBB is a popular Internet forum package written in the PHP scripting language. The name "phpBB" is an abbreviation of PHP Bulletin Board...

 , WordPress
WordPress
WordPress is a free and open source blogging tool and publishing platform powered by PHP and MySQL. It is often customized into a content management system . It has many features including a plug-in architecture and a template system. WordPress is used by over 14.7% of Alexa Internet's "top 1...

  and Mediawiki
MediaWiki
MediaWiki is a popular free web-based wiki software application. Developed by the Wikimedia Foundation, it is used to run all of its projects, including Wikipedia, Wiktionary and Wikinews. Numerous other wikis around the world also use it to power their websites...

 .

The PHP runtime supports close integration with the Java and Groovy languages through its Java/Groovy bridge. This allows PHP scripts to use libraries written in Java and Groovy through a lightweight and extremely fast interop layer. The Groovy bridge allows advanced features from Groovy to be accessed directly from PHP. Examples include closures
Closure (computer science)
In computer science, a closure is a function together with a referencing environment for the non-local variables of that function. A closure allows a function to access variables outside its typical scope. Such a function is said to be "closed over" its free variables...

 and Groovy metaobjects.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK