Friday, June 25, 2010

Humor for Friday - Java-4-ever

I don't want to post funny videos here too much as I think people come here for technical information. However, this is just too good to not share. There is one slightly NSFW (not safe for work) section. Even mentions XML, so its truly great.

Watch the Java 4-Ever Video

Now on YouTube

Thursday, June 3, 2010

OSGi applications and JPA2 feature pack has gone GA

WooHoo!!!!!!

Releasing any product involves a lot of hard work, sleepless nights and the occasional lost weekend, so you'll understand why I am happy that the feature pack for OSGi Applications and JPA 2 is now GA and can be installed either from the web, or locally, using installation manager.

Some highlights of what we have delivered:
  • Support for development and deployment of enterprise applications using OSGi
  • Support for Enterprise OSGi specs around Web application, Blueprint and JPA
  • The ability to update the individual bundles in an OSGi applications
  • Support for integrating OSGi and Java EE applications using SCA
  • Support for Java Persistence API 2, both from Java EE and OSGi applications
  • Development tooling for OSGi and JPA2 via the Rational Application Developer beta
  • Good performance increase measured using the SPECjEnterprise2010 benchmark.
I could go on and list some of the other cool features, like the bundle repository support for OSGi, and the JPA2 criteria API, but some of they have been discussed on the blog already, and then I wouldn't have an excuse to write more about them later.

Download, use, enjoy!
Alasdair

P.S. There is an iFix available for the feature pack and we recommend you install it.
P.P.S. You'll need to have 7.0.0.9 of the application server and JDK to install the feature pack.

Sunday, May 30, 2010

The Cure for XML in Web 2.0?

Earlier, I blogged about the Pain of XML in Web 2.0. I alluded to not being happy with the answer I ended up with. I'm happy to say that I'll finally be talking about a possible solution. As you see here, I have submitted a paper for the Balisage 2010 Conference entitled Where XForms meets the glass: Bridging between data and interaction design along with Charles Wiecha and Rahul Akolkar.

Here is the abstract:

XForms offers a model-view framework for XML applications. Some developers take a data-centric approach, developing XForms applications by first specifying abstract operations on data and then gradually giving those operations a concrete user interface using XForms widgets. Other developers start from the user interface and develop the MVC model only as far as is needed to support the desired user experience. Tools and design methods suitable for one group may be unhelpful (at best) for the other. We explore a way to bridge this divide by working within the conventions of existing Ajax frameworks such as Dojo.


Interested? Let me know and we can get a review copy of the paper to you. I have talked to many clients that want to integrate their meta data driven XML dominant data to the Web 2.0 work with DOJO and run into the impedance mismatch wall. Hopefully that wall will be coming down soon.

BTW, if you'd like to attend this great conference to hear about this topic and many others on the jam packed agenda, here is a great link to use to convince your management to let you join us in Montreal.

Thursday, May 27, 2010

XQuery: Powerful, Simple, Cool .. "Demo"

At IBM Impact this year, I did talks about the XML Feature Pack as well as basic introduction to the XPath 2.0, XSLT 2.0 and XQuery 1.0. I think one of the most useful parts of my talk was when I demoed code in XQuery. I found that people really saw the light (how simple and fully functioned XQuery is) once people saw the code in a useful application. Also, people that were experienced with XPath 1.0 appreciated the new features and people who had experience with XSLT 1.0 appreciated the syntax (closer to imperative coding). The application I used in the demo was the download stats program I have blogged about before. Let me take a second to do the same "demo" here.

First, I have an XML input file of all the downloads over a certain time period. That XML file could come from a web services, a JMS message, or be loaded from a XML database. The data looks something like:


<?xml version="1.0" encoding="UTF-8"?>
<downloads>
<download>
<transaction>1</transaction>
<userid>user1</userid>
<uniqueCustomerId>uid-1</uniqueCustomerId>
<filename>xml_and_import_repositories.zip</filename>
<name>Mr. Andrew Spyker</name>
<email>user@email.com</email>
<companyname>IBM</companyname>
<datedownloaded>2009-11-20</datedownloaded>
</download>
<!-- more download records repeating -->
</downloads>


First I want to quickly get rid of all downloads that have "education" in the filename. Next I want to split the downloads that come from IBM'ers (email or company has some version of IBM in it) vs. the downloads that come from clients. Of those groups, I want to quickly group repeat downloaders (by uniqueCustomerId). I won't include it here, but I've show how to write some of this with Java and DOM in the past. It's sufficient to say that this code is very complex (imagine all the loops through the data you'd write for each of these steps). Let's look at these steps in XQuery:


(: Quickly get rid of education downloads :)
declare variable $allNonEducationDownloads := /downloads/download[not(contains(filename, '/education/'))];

(: Split the IBM downloads from non-IBM downloads :)
declare variable $allIBMDownloads :=
$allNonEducationDownloads[contains(upper-case(email), 'IBM')] |
$allNonEducationDownloads[contains(upper-case(companyname), 'IBM')] |
$allNonEducationDownloads[contains(upper-case(companyname), 'INTERNATIONAL BUSINESS MACHINES')];

(: Get the unique IBM downloader id's :)
declare variable $allIBMUniqueIds := distinct-values($allIBMDownloads/uniqueCustomerId);

(: Get the non-IBM downloads :)
declare variable $allNonIBMDownloads := $allNonEducationDownloads except $allIBMDownloads;

(: Get the unique non-IBM downloader id's :)
declare variable $allINonIBMUniqueIds := distinct-values($allNonIBMDownloads/uniqueCustomerId);


I think the most powerful line of the above code is the "except" statement. In that one quick statement, I can quickly express that we want to take all the downloads and remove the IBM downloads which leaves us with the non-IBM downloads. I think it's quite impressive that XQuery expresses the above statements in about the same amount of lines as the English language I used to describe the requirements.

Additionally, since you are telling the runtime what you want to do instead of how you want to do it, our runtime can aggressively optimize the data access in ways that we couldn't if we had to try to understand the Java byte codes were doing on top of the DOM programming model. Also, since XQuery is functional (the above variables are final) we could span this to multi-core more safely than imperative code as we can guarantee there are no side-effects. This is why, as a performance guy, I think declarative languages are a key to the future of performance.

Back to the code. For people used to XPath 1.0 and its lack of all the built-in schema types, dealing with things as simple as dates was problematic (they were just strings). Here are a few functions that show, with schema awareness, XPath 2.0 and XQuery 1.0 are much more powerful than before:


declare function my:downloadsInDateRange($downloads, $startDate as xs:date, $endDate as xs:date) {
$downloads[xs:date(datedownloaded) >= $startDate and xs:date(datedownloaded) <= $endDate]
};

declare function my:codeDownloadsInDateRange($downloads, $startDate as xs:date, $endDate as xs:date) {
let $onlyCodeDownloads := my:onlyCodeDownloads($downloads)
return my:downloadsInDateRange($onlyCodeDownloads, $startDate, $endDate)
};


These two functions give me a quick way to look for "code" downloads within a date range. In the first function, it's very easy to understand that this functions take the downloads and returns only the subset that has a datedownloaded that is after the start date and before the end date. In the second function, you can see it's easy to call the first function. At this point, I think most Java programmers might be saying "this isn't like what I expected based on my previous work with XSLT". While XSLT is a great language for transformation (XSLT 2.0 even better), I think XQuery gets a little closer to a general purpose language with the ability to declare functions and variables in a more terse syntax.

Finally, let's cover two more important powerful features - FLOWR and output construction. Once I have sliced and diced the data, I need to output the data into a XML report. XQuery gives you a very nice way to mix XML and declarative code as shown below:


declare function my:downloadsByUniqid($uniqid, $downloads) {
for $id in $uniqid
let
$allDownloadsByUniqueId := $downloads[uniqueCustomerId = $id],
$allCodeDownloadsByUniqueId := $downloads[uniqueCustomerId = $id and (contains(filename, 'repositories'))]
return
<downloadById id="{ $id }" codeDownloads="{ count($allCodeDownloadsByUniqueId) }" >
<name>{ data($allDownloadsByUniqueId[1]/name) }</name>
<companyName>{ data($allDownloadsByUniqueId[1]/companyname) }</companyName>
<codeDownloads>
{
for $download in $allCodeDownloadsByUniqueId order by $download/datedownloaded return
<download>
<filename>{ data($download/filename) }</filename>
<datedownloaded>{ data($download/datedownloaded) }</datedownloaded>
</download>
}
</codeDownloads>
</downloadById>
};



This shows how you can create new XML documents and quickly mix in XQuery code. Some people I've talked to think this looks like scripting languages in terms of simplicity. Also, you'll see a For ($id in $uniqid) Let ($allDownloadsByUniqueId, ohters) Return (downloadsById). These three parts make up part of what people call FLOWR (and pronounce flower) which stands for for, let, order by, where, return. The FLOWR statement is a very powerful construct -- able to do all the sorts of joins of data you're used to in SQL -- but in this example I've chosen to show how it can be used to simplify code in the general case where joining data wasn't the focus. For Java people, think of it as a much more powerful looping construct that integrates all the power of SQL for XML.

In the end, I have a 200 line program that takes all the download reports and organizes them by unique IBM vs. unique non-IBM ids and produces a month by month summary. I'd be surprised if you could come up with anything shorter and more maintainable that worked with Java and DOM. I hope this "demo" encourages you to consider using XQuery in your next project where you need to work with data.

Finally, if you find people trying to convince you that XQuery isn't capable enough to be a general language, take a look at a complete ray tracer written in XQuery in a mere 300 lines of code (a real statement of XQuery's power and brevity).

PS. You can download this XQuery program here and some sample input here. You can run them by getting the XML Feature Pack thin client here. The thin client is a general purpose Java based XQuery processor that you can use for evaluation and in production when used with the WebSphere Application Server. All you need to do is download the thin client, unzip and run the below command:


.\executeXQuery.bat -input downloads-fake.xml summary.xq

Wednesday, May 26, 2010

Why the -outputfile switch in XML Thin Client is useful

A simple tip...

I was recently working with a set of files that contained non-English Unicode characters and trying to process the data with XSLT 2.0 and XQuery 1.0. I was using the Thin Client for XML that is part of the XML Feature Pack which offers J2SE and command line invocation options for XSLT and XQuery when used in a WebSphere environment.

I did something like:


.\executeXSLT.bat -input input.xml stylesheet.xslt > temp.xml
.\executeXQuery.bat -input temp.xml query.xq > final.xml


And this resulted in something like:


... executeXSLT "works" fine ...
... executeXQuery "fails" with ...
An invalid XML character (Unicode: 0x[8D,3F,E6,8D]) was found in the element content of the document
.
An invalid XML character (Unicode: 0x[8D,3F,E6,8D]) was found in the element content of the document
.


I figured something was wrong with the encodings in the XSLT output method or the xml encoding of the files themselves or -- worse yet -- something wrong with our processor. After some quick thinking by my excellent team, they had me replace the output redirection (where my OS and console got a chance to see/mess with the data between the processor and temp.xml) with the -outputfile option (which allows the processor to directly write to the file) like:


.\executeXSLT.bat -input input.xml -outputfile temp.xml stylesheet.xslt
.\executeXQuery.bat -input temp.xml -outputfile final.xml query.xq


Problem solved. No corruption of the data.

Lesson learned: Keep all the data inside of the processor and don't introduce things (like the Windows Console) into the pipeline that won't honor (or know) the encoding.

Monday, May 3, 2010

New CEA demo videos..

Here are some more demos of the WebSphere Application Server Feature Pack for Communications Enabled Applications (CEA). We'll be using some of these in the IBM Impact 2010 sessions that I referenced here

The first one is doing some of the contact center widgets (like click to call then cobrowsing) on the iPhone:



Here is the coshopping between a user on an iPhone and a Desktop:


The next is a shorter and HD version of our JavaScript widget walk through:

Saturday, May 1, 2010

WWW2010/FutureWeb Conference Summary

I had the opportunity to attend the Future Web part of the WWW2010 Conference this past week in Raleigh, NC. This conference was quiet amazing both in the scope/influence and the fact that it was in my hometown.

I was able to hear some technical giants like Sir Tim Berners-Lee, Vint Cerf, Danah Boyd and Doc Searls. I was able to meet up with many people locally (including Paul Jones) as well as folks from across the world working to make the internet move into the future.

The content was as technical as it was social and political. While it's interesting to hear about the Semantic Web and HTML5 and all the cool new areas for search/data mining, it was equally valuable to hear about the impacts the Web is having on education, healthcare, and media to name a few. Also, I hear about the work of many of the conference attendees to change government processes for the better and how involved that can be with the web spanning countries in ways no other technology can/does.

Some reflections on the technical content:

1) Facebook was bashed (a lot). I actually learned that yet again, Facebook had opted me into sharing information without my understanding. The key take away from all of this bashing was that Facebook (and all web technologies) have become a critical part of our culture. The information we all are producing to create value for sites like Facebook/Twitter/etc needs to be treated with care. Marketing folks salivate at the opportunities that this community created content provides. However, just because we can share and use such data in ways that benefit our companies, we shouldn't assume we should.

2) Adobe/Apple was based (a lot). The value of open standards on the web is clear. Some of the stories shared by the panelists were quite interesting -- Talk about how the internet was just a radical idea that would never compete with the "serious networks" of the time prove how valuable standards can be and how they have and will continue to change the world.

3) There was a great presentation by Carl Malamud talking about "Rules for Radicals" that documented 10 rules to make large changes to government and technology, but the rules applied equally well - I can apply them to working within a large corporation. Note that while take aways #1 and #2 got a lot of press, the fact is there were many iPad's, Mac Books and Facebook borne meetups. Carl's presentation showed that we need to work to affect change within these communities. Here is a quick video summary of the rules.

4) I've had it on my TODO list for some time now to look at the building blocks of the Semantic web. I needed to understand how RDF/RDFa and SPARQL relate to XML and XQuery. I'm starting to form some opinions now based upon what I've heard at the conference and the work I've done this week to play with the technologies. I can say with certainty that this Web 3.0 (the web for machines vs. Web 2.0 which was the web for human) and its related technologies - RDF, SPARQL are not going away. I can also say that RDF/SPARQL doesn't compete with XML/XQuery. I can see that we'll need to bridge the gap between these worlds as we look to unleash not only the XML stored in many enterprises but also relational data. We'll also need to do this quickly as this world is moving fast and those people who don't embrace Web 3.0 will be as left behind as those that are still moving towards Web 2.0. An example of this speed that impressed me was the creation of a Facebook Open Graph Protocol vocabulary that was peer edited during a session on Thursday but then live by Friday. Amazing.

5) Twitter is a business tool. I've known this for some time and had success stories, but given the audience of this conference (passionate web technologists) I saw the value of Twitter magnified by at least an order of magnitude. Every academic attendee was communicating via Twitter. I used it to find the IBM attendees and collaborate with them in ways I'm sure I would have missed without Twitter. I used it to meet people I've never met before (even led to a lunch out with Doc Searls and Kathy Gill and another with a local company that is working with SIP technologies). If it wasn't for twitter, I'd say the value of the collaboration at this conference would have been decreased by that same order of magnitude. Another funny story that proves Raleigh is well connected was a fight between two bars on Twitter that broke out trying to earn our patronage for a dinner on the town. If you're a business that isn't paying attention to Twitter are you losing the cost of a few beers or worse?

I'm sure there were more take aways I'll remember, but for now that's a good starting point. If you were at Future Web and had other big take aways, post them in comments.

PS. I got to meet a bunch of great local XML/XQuery folks at the XQuery meet-up I organized. I look forward to collaborating with these folks locally in the future.

Friday, April 30, 2010

Here comes WebSphere CloudBurst 2.0

Lifted from Dustin's Blog.

Just over a year ago, IBM announced the availability of the initial version of the WebSphere CloudBurst Appliance. Today, an announcement signals the coming availability of WebSphere CloudBurst 2.0, and that brings the major release count up to three in a period of about 12 months (the release of 1.1 came at the end of last year).


You can read the announcement for yourself, but here is a quick overview of the new features and enhancements delivered in the latest version:


- WebSphere Process Server support: You can now provision fully functional, virtualized WebSphere Process Server environments using WebSphere CloudBurst. This adds to the existing support for WebSphere Application Server, and the beta and trial versions of WebSphere Portal and DB2 respectively.


- Multi-image pattern support: In previous versions of WebSphere CloudBurst, all patterns mapped to a single virtual image. This meant your custom patterns could only contain parts (or nodes) from a single product. Now you can build patterns that contain parts from multiple different images. This allows you to represent diverse application environments, for instance, one that includes WebSphere Application Server, WebSphere Process Server, and DB2 components, as a single pattern. Of course, this also means installing and initializing these different product components becomes as simple as deploying a single pattern.


- Dynamic system management: During the lifetime of an application environment, it is commonplace to add additional capacity. Specifically for WebSphere environments, this often means adding more nodes and application servers into your landscape. WebSphere CloudBurst 2.0 makes it simple (click of a button) to add more nodes and application servers to a virtual system you previously deployed. Using this new capability, you can quickly scale up your application environment to meet the changing demands of its users. Conversely, you can scale down the environment and remove unnecessary nodes with the simple click of a button as well.


- Intelligence for the runtime: I always talk about the WebSphere intelligence the appliance delivers in terms of deploying and constructing WebSphere application environments. The addition of the WebSphere Application Server Hypervisor Edition Intelligent Management Pack means this intelligence starts to make its way into the runtimes of your application environments. Use the new intelligent management pack to enable a policy-based approach to managing your applications. You can enforce application health actions, govern application response times, and even manage the rollout of new versions of your application with no service disruption.


- New Red Hat WebSphere Application Server Hypervisor Edition: The WebSphere Application Server Hypervisor Edition is a virtual image that includes everything from the operating system all the way to the WebSphere Application Server, pre-installed and pre-configured. Initial versions of this virtual image shipped with Novell SUSE Linux Enterprise Server. Staring in WebSphere CloudBurst 2.0, users can use a new WebSphere Application Server Hypervisor Edition virtual image for VMWare ESX that packages the Red Hat Enterprise Linux Server operating system.



As WebSphere CloudBurst marches forward with new releases, a theme becomes apparent: Give users a choice. What do I mean? Well, just look at where WebSphere CloudBurst stands with the 2.0 release:


- You can use WebSphere CloudBurst to provision environments to VMware ESX, PowerVM, and z/VM hypervisor platforms


- You can use WebSphere CloudBurst to provision WebSphere Application Server, WebSphere Process Server, DB2, and WebSphere Portal


- You can run your virtualized WebSphere application environments on SUSE, Red Hat, AIX, and zLinux operating systems


Want to see more about the 2.0 release? Check out my new video. This much is inarguable: For running WebSphere application environments in an on-premise cloud, nothing comes close to the capabilities of WebSphere CloudBurst.



CEA Impact Sessions

In case you are looking to learn more about Communications Enabled Applications (CEA) at Impact, here are some talks you can come into:
Enabling Cobrowsing and Coshopping on your website - 2040A Tue, 4/May 10:15 AM - 11:30 AM Venetian - San Polo 3506
Adding Rich Interaction Support to your Enterprise Application - 2272A Wed, 5/May  10:15 AM - 11:30 AM Venetian - Lido 3103

Also, we have a lab on Enabling Coshopping and Two Way Forms on your Web Applications with CEA - 2027A Tue, 4/May 04:45 PM - 06:00 PM Venetian - Murano 3304

Finally, here is a less than 3 minute video showing cobrowsing and the new mobile widgets we have made available and will be demoing at Impact here as a tech preview

WebSphere Application Server Feature Pack for Dynamic Scripting

Lifted from Project Zero blog:

Today we announced a new feature pack for WebSphere Application Server based on WebSphere sMash. This new feature pack delivers the sMash programming model for use on entitled / current subscription WebSphere Application Server V6.1 and V7.0 servers.

Complete details can be found in the IBM.com announcement letter.

When the Feature Pack becomes electronically Generally Available, downloads will be available on the official IBM.com web site for WebSphere Application Server Feature Pack for Dynamic Scripting.

Also being made available through Project Zero, the sMash Enterprise Packager allows WebSphere Application Server V7 to deploy and manage sMash applications through the administrative console as an EAR file. Read more info about this and download the sMash Enterprise Packager on ProjectZero.org.

Find out more about this new Feature Pack and more at IBM Impact 2010.


Based on technology from WebSphere sMash V1.1.1, the feature pack for dynamic scripting provides support for dynamic scripting languages including PHP and Groovy all the while allowing you integrate with AJAX, REST, ATOM, RSS, etc. There is also a resource model as part of the included Zero programming model that simplifies the creation of RESTful services. Want a quick way to create a Web 2.0 application in these languages .. then give this feature pack a try.

Thursday, April 29, 2010

Video Blogs on Impact 2010 Sessions Next Week

Are you heading to IBM Software Impact 2010 next week? I hope so!

I will be presenting on WebSphere XML Strategy. I will be presenting a session on the WebSphere Application Server Feature Pack for XML talking about usage scenarios, how to use the feature pack, and best practices (Sessions 1635A/B on Monday and repeat Thursday). I will also be providing a general education session on XPath 2.0, XSLT 2.0 and XQuery 1.0 (Session 1634 on Tuesday) focused on basic education as well as noting whats new with the standards - with a cool give away! I will be assisting a lab where you can get hands on experience with the XML Feature Pack and the Rational Application Developer tools (Session 1606 on Monday). Stop by any of these session or hit me up on twitter (@aspyker) if you have any questions about XML or data strategy within your enterprise.

Along with the XML Feature Pack and XML strategy talks, I'll be participating in a SOA and BPM Performance update (1321) talking about SPEC SOA and multiple panel discussions around the values of the application server, performance, and feature packs.

You can hear me talk about the sessions here:



Some other videos about sessions next week are available as well.

Erik Kristiansen on RESTful, dynamic scripting, and OSGi programming models:



Lan Vuong on extreme transaction processing and elastic application architectures:

Thursday, April 8, 2010

Looking for XPath/XSLT/XQuery Education?

Last year, I attended the XML-In-Practice 2009 conference. One person I met there is Ken Holman. Ken works for Crane Softwrights Ltd. which is a consultancy delivering computer systems analysis and training services with focus in structured text processing related to XML and SGML including XSL/XSL-FO, XSLT, XPath and XQuery, and UBL.

Ken and I have been collaborating recently on enabling the hands-on in-depth XSLT/XQuery classes offered to use the IBM Thin Client for XML with WebSphere Application Server V7.0. Now students with the feature pack can quickly configure Crane's exercises to utilize the latest XSLT/XQuery support from IBM.

The three upcoming publicly-subscribed deliveries for XSLT/XQuery are:

West-coast North America: April 26-30, 2010 - San Francisco area

East-coast North America: May 10-14, 2010 - Ottawa, Canada

Europe: June 7-11, 2010 - Trondheim, Norway

Ken travels the world teaching a number of XML-related classes both privately and publicly. He is willing to consider teaching anywhere and he welcomes anyone to contact him regarding a possible private or public class of any of his material. Ken has taught and offers other classes. You can see them here.

Wednesday, April 7, 2010

XML Feature Pack 1.0.0.3 Available

I'm happy to announce another major update to the XML Feature Pack and its impact on our development tooling - Rational Application Developer for WebSphere.

We just released the 1.0.0.3 version of the XML Feature Pack that has two major new features (as well as some small bug fixes). The two new features are:

XQuery Schema Awareness



In the initial release we had Schema Awareness for XSLT 2.0. In this release we add similar function to XQuery. Specifically this means we started to support the optional XQuery 1.0 features of schema import and schema validation. With these features you can use your own type information in XQuery programs. A common scenario would be looking for all addresses in an input document, regardless of they were "billingAddress" or "shippingAddress". Programming based on type information is a powerful concept that leads to more flexible implementations. Also, validation allows you to validate incoming documents, xml trees and whole output documents. This allows for greater reliability in your XML processing.

Debugging support for XSLT 2.0 under Rational Application Developer (RAD) for WebSphere



Previously with RAD you could debug XSLT 1.0 stylesheets. With this new release of the XML Feature Pack and with RAD 7.5.5.1 you can debug XSLT 2.0 stylesheets. This isn't just about moving to a newer stylesheet level. With all the changes in the data model and advanced new concepts like grouping, there are many improvements in visualization with debugging over the XSLT 1.0 debugger.

What is also interesting is that this is a converged debugger. While there are other XSLT 2.0 debuggers out there, they only work on the stylesheet itself. With this support in RAD, you can debug not only the stylesheet, but also the Java code in your web application that invokes the XSLT engine along with any Java extension functions you might have. If you are using XSLT 2.0 in the application server, this is the tool you want for debugging end to end.

I hope to do a video demo of this Rational Application Developer functionality. Imagine setting breakpoints in XSLT as well as Java and being to jump between them. Anyone interested in seeing such a video demo?

Have fun with the new functions!

Sunday, April 4, 2010

Options for WebSphere Application Server Scripting

 WebSphere Application Server (WAS) provides a scripting interface called wsadmin. wsadmin supports two scripting languages jacl* and jython. Five objects are available when you use scripts:
  • AdminControl: Use to run operational commands.
  • AdminConfig: Use to run configurational commands to create/modify WAS configuration.
  • AdminApp: Use to administer applications.
  • AdminTask: Use to run administrative commands.
  • Help: Use to obtain general help.

WAS provides a number of aids to developers and system administrators for the development of wsadmin scripts. Different options that can be leveraged in developing wsadmin scripts are explained below.

WAS V7 Script Libraries (new in v7 .. supported)
WebSphere Application Server V7.0 includes script libraries that can simplify the use of these objects.
Script libraries can be used to perform a higher level of wsadmin functions than can be done using a single wsadmin command. Only a single line from a library function is needed to perform complex functions. Each script is written in Jython, and is often referred to as “the Jython script”. The script libraries are categorized into six types (Application, Resources, Security, Servers, System) and the types are further subdivided into application and utilities. See the WAS V7 Administration and Configuration Guide chapter 8 for additional details. The script libraries are located in  WAS_INSTALL_ROOT/scriptLibraries directory. These libraries are loaded when wsadmin starts and are readily available from the wsadmin command prompt or to be used from the customized scripts.

Command assistance ( supported)
The command assistance feature in the administrative console was introduced in WAS V6.1 with limited scope in function. The command assistance feature has been broadened in V7.0. When you perform an action in the administrative console, you can select the View administrative scripting command for last action option in the Help area of the panel to display the command equivalent. This command can be copied and pasted into a script or command window.You also have the option to send these as notifications to the Rational Application Developer V7.5, where you can use the Jython editor to build scripts.

wsadminlib.py ( 'as-is' see note below)
Another resource for WebSphere System Administrators for scripting is the wsadminlib.py script library.
wsadminlib.py  wsadminlib.py is a large python file containing hundreds of methods to help simplify configuring the WAS using scripting. A wide variety of methods have been developed. These methods perform tasks such as creating servers, starting servers, creating clusters, installing applications, proxies, core groups, core group bridge, dynacache, shared libraries, classloaders, replication domains, security, BLA, JDBC, etc. Please note that wsadminlib is provided on an 'as is' basis under the IBM DeveloperWorks license agreement. It is not a supported product. The underlying wsadmin calls made by the scripts are however supported by IBM.



Happy Scripting!


* jacl has been stabilized

Wednesday, March 31, 2010

Programming XML Across Multiple Tiers

In the XML Feature Pack, we ship a sample that shows how to use XML centric programming in the middle tier. The sample shows how to unlock data in Web 2.0 ATOM XML encoded feeds using XQuery and present the data in a typical web application using XSLT. As an extension to this sample, we also have a sample that shows how to persist data from these feeds into an XML Database such as DB2 pureXML or Apache Derby. We included this example as we found, frequently, that people working with XML centric programming typically had large XML datastores in XML centric databases.

While the sample is there, with source code, in the XML Feature Pack, we don't explain why we coded the sample the way we did. In this new developerWorks article (Programming XML across the multiple tiers: Use XML in the middle tier for performance, fidelity, and development ease), we go into detail why for simplicity, performance, and flexibility reasons we coded the sample the way we did.

The article is worth a read. It will walk you through the new features in the XML Feature Pack and JDBC 4.0 that allow an end to end native XML programming model across the XML Feature Pack and an XML database. We hope to expand this article over time to cover more advanced concepts when working with XML databases.

Finally, here are two quick videos that show how to get the sample working with DB2 pureXML and Apache Derby.

DB2 pureXML (Part 1/2)
Direct Link (HD Version)

Apache Derby (Part 2/2)
Direct Link (HD Version)

Tuesday, March 30, 2010

XQuery as a replacement for VBScript?

I was discussing with a colleague the leaning of folks to use JavaScript to process data on the server. I have seen a few products recently move to JavaScript as a programming model aimed towards folks that aren't skilled in languages such as Java. I always wondered why. JavaScript doesn't seem like the right language for a server environment and isn't the best language for data navigation. The colleague told me that his belief was that JavaScript was much closer to VBScript that "business users" are used to using in Excel. After looking at a presentation on XQuery I did, my colleague believes that XQuery could have filled the same need as JavaScript (high level language, script like, etc.).

In this presentation, I showed how I replaced a process we had internally using Excel and VBScript with an online application using XQuery running on the XML Feature Pack. I also showed how others have done non-query based applications using XQuery (like the XQuery Ray Tracer) proving that XQuery is a full language.

I wonder if others out there also believe that XQuery is a good language to replace VBScript and "programs" currently locked in Excel documents?

Monday, March 29, 2010

IBM WebSphere Application Server V8.0 Alpha

The WebSphere Application Server team is proud to announce the availability of the IBM WebSphere Application Server V8.0 Alpha.

Building upon the capabilities of our previous releases, some of the Alpha features include:
  • Key portions of Java™ Enterprise Edition 6.0 specifications

  • Increased developer productivity

  • Simplified product install with integrated prerequisite and interdependency checking

  • Enhanced security and governance capabilities

  • JPA L2 cache and JPA L2 cache integration with DynaCache

  • High Performance Extensible Logging


Our architects, designers, engineers, testers, information developers, and user experience professionals are eager to participate with you in the Alpha forum, discussing what's new, learning about your experiences with all aspects of the product, and answering questions.

Also, the WebSphere Customer Experience Program (CEP) offers opportunities for interactive sessions with our development teams, including demos of potential new features and opportunities to provide feedback that we can use to drive improvements into each version of the product.

More details about the Alpha program, how to download the product, and the CEP program can be found here:

https://www14.software.ibm.com/iwm/web/cc/earlyprograms/websphere/wsasoa/index.shtml

And, here's a link to the Alpha forum:

http://www.ibm.com/developerworks/forums/forum.jspa?forumID=2180&start=0

We're looking forward to hearing from you about your experiences with the IBM WebSphere Application Server V8.0 Alpha.

Enjoy!

Wednesday, March 17, 2010

More OSGi goodness

There is a new feature in the Beta refresh of the OSGi feature pack which went out last week - a tool to inspect application bundles. Here are some brief instructions on how to use it.

First, install the feature pack (see here) and start the application server, then at the shell command line navigate to:

[AppServerHome]/feature_packs/aries/bin


There is a script in there called osgApplicationConsole.sh (or .bat), run it and you should get a "wsadmin>" prompt. Use the list() at the prompt and it will show you ... nothing. That's fine, you need to install and start an application before you can see anything.

Install and start the Blog Sample (as described here), then try list() again, you will see something this:




Two frameworks are listed, 'shared bundles' and the Blog application. Connect to the first like this:

wasadmin>connect(0)

Use the ss() command to look at what is in it:



You don't have to disconnect from a framework explicitly, so to look at framework 1 (the Blog application) just connect to it:

wsadmin> connect(1)

then ss() shows the blog sample bundles.




This may by now be looking slightly familiar to anyone used to the Equinox OSGi console. The difference is that WebSphere is partitioning the space into separate application frameworks which you can look at individually - nice feature if you have a lot of applications. By the way, if you forget which framework you are connected to, list() at the wsadmin> prompt will tell you.


Other console commands can be found in the documentation, or by using 'help()' at the wsadmin> prompt. Have fun!

Friday, February 26, 2010

The pain of XML in Web 2.0

I have continued to think about the end to end XML story across database, middle tier, and the browser client. I have talked to many organizations that work with standard industry XML documents (HL7, OAGIS, ACCORD, etc) where the XML view unifies the data of their entire enterprise. To these organizations, they work data out from the message queues to data storage to middle tier. However, what does it look like when they want to expose this data to the web tier? There are products that handle this well like Lotus Forms based on XML centric standards like XForms. But what about Web 2.0 libraries like DOJO or jQuery?

I took the download sample I described here, and tried to visualize the data to Web 2.0 webpages. The data format of the XML of interest is:



First, I looked at the DOJO bar chart code and did something like this in a server side XQuery program that generated HTML with the following under JavaScript:



This works as XQuery can return sequence of primitive types and in this case, I'm just returning a string and inserting it inside of the JavaScript code that expects value/text values. But what if I want to have a REST endpoint serve up XML directly and have the browser consume it?

DOJO DataGrid can read from a DataStore which can be hooked to an XmlStore. This means I can use a browser side control to read from my server side XML. All seems good until you get into the details. Here are snippets of the code to make this "work":



What are the some of the issues with this? First, the XmlStore has to map to a simpler format for the DataGrid to understand the XML data. That is why I had to manually tell the XmlStore to promote all the attribute values to similarly named element names. Nicely, the XmlStore supports allowing the ability to drill down to something other than the root item for the data, but it really just allows you to pick the name of an element (you'll see I specified "month"). The second problem is that for any complex industry specific data, likely that wouldn't be sufficient. What if I had multiple month elements at different parts of the XML tree? I'd end up getting a table that combined months that meant different things. What I'd really want is XPath as the root selector. Third, even though the Store abstraction is nice for handling multiple data formats, if I wanted data to be combined from different parts of the XML tree or multiple trees, what I really would like is XPath from the DataGrid formatter function itself.

Assuming this might be easier in the other very popular library for JavaScript query, I went off an investigated jQuery. I quickly found articles that talked about jQuery and XML. I patterned the next part of the article after this example. So, rewriting, I ended up with:



Now, with jQuery, I'm actually able to do a little more "native" xml query. You'll see that I can access attributes directly. You'll see that I can navigate only to the months or the monthByMonthDownloadStats. However, as someone that knows XQuery, this syntax seems very unnatural (I'm sure it's very clear to JavaScript and/or CSS writers). Unnaturalness aside, this seems more verbose. In XQuery I can write this like:



With this I get all of the same benefits that jQuery has (plus more - I'm almost sure jQuery wouldn't support the rich Functions and Operations of XPath 2.0 or any mixed XML content common in document centric XML approaches). XQuery mixes the construction of the content with the query of input much better in my opinion (I believe if we showed date comparison for example you'd see a worse comparison). Of course the benefit of jQuery over XQuery is XQuery doesn't run in the browser. I had to run the previous XQuery sample on the server. That is a pretty big benefit.

I think the summary of all of this, if you stayed with me this long, is that Web 2.0 technology in the browser isn't really ready to handle the complex XML documents that exist within most enterprises. This means if you want to marry Web 2.0 with the enterprise XML data, you'll need to write data conversions essentially extending the presentation tier across the browser and middle tier that simplify the data or use feature like the Web 2.0 Feature Pack to do this for you. Also, you'll need to learn two languages (arguably three if you consider jQuery a language) and programming styles when dealing the with XML data.

Given I look at WebSphere XML Strategy, I'm not sure I'm happy with this answer. I am currently looking towards other solutions to this issue. Given I'm rather new to Web 2.0, feel free to point out other things I didn't consider in the Web 2.0 space for XML processing (outside of XForms of course).

Monday, February 22, 2010

XPath, XSLT 2.0 and XQuery 1.0 in five minutes

You may remember a similar demo back in the open beta timeframe. Now, the IBM Thin Client for XML with WebSphere Application Server v7.0 is available based upon the shipping version of the XML Feature Pack. The following video will show you how to get up and running in about five minutes (including download time).

The thin client for the XML Feature Pack allows you to use the XPath 2.0, XSLT 2.0, and XQuery 1.0 runtime in your client applications of the application server using the same API's as when running in the application server. Before, you could get the thin client by installing the XML Feature Pack on top of the application server. Now, we've made the thin client separately downloadable which makes prototyping very simple.

Here are the links shown in the demo:

Direct link to download the thin client, Demo files

XML Feature Pack Thin Client Demo



Direct Link (HD Version)


Please note that the thin client is only supported on Java 1.6 JVM's.