Thursday, March 26, 2009

JSF Portlet Bridge and WebCenter

I did a post a while back on JSF Portlet Bridge that I will now revise, because things are not quite like I thought they were.

Let's say that your organization has an Oracle Portal 10g install. Then let's say you want to start integrating ADF Faces apps that were generated from JDev 10g. (That would be Apache Trinidad in JDev 11g parlance). Here is what you would want to do: install your ADF apps on a 10.1.3.4 Oracle App Server. Let's say you did not have the WebCenter license of any kind. Then you would need to add some kind of generic web page with an iframe on it that called out to the ADF Page. That would be your option.

But let's say you had the minimal, or "Services" WebCenter License (I believe that is priced by CPU-core count.). Then you can deploy your ADF Faces apps to that same 10.1.3.4 after you have doctored it up. By doctored it up I mean the following:
1. Install SOA 10.1.3.1
2. Apply patchset 10.1.3.4
3. Create new oc4j in EM. Call it wsrp2
4. Install portlet-server-install.jar
5. PER NOTE: Note 752220.1 Java.Lang.Noclassdeffounderror: Javax/Xml/Soap/Soapelement Deploying Standalone Application
cd $ORACLE_HOME/j2ee/wsrp2/config
vi server.xml

6. Start container. (opmnctl startproc process-type=wsrp2)
7. Deploy application. NO ERROR


A few notes about this process above:
  • You can get the portlet-server-install.jar by looking at the following:

http://www.oracle.com/technology/products/webcenter/pdk.html

http://www.oracle.com/technology/products/webcenter/portlet_download.html

(http://download.oracle.com/otndocs/tech/webcenter/files/pdksoftware.zip)

Oracle Portlet Container and PDK-Java 10.1.3.2

  • Your Oracle Portal installation will need to be up to date. So that means at least your Portal Repository needs to be at 10.1.4.0...but then you will have a work-around because your images will not work right. It is best if you upgrade to 10.1.2.3 on your iAS and 10.1.4.2 on your Portal Repository and do all the pertinent patches...and there are a few! But they are documented.
  • At this point there will still be some CSS-related issues that are documented in an Oracle bug. (7968131) I am gathering this case is not being worked too hard, though.

So then you can consume your "produced", portletized ADF apps just fine. They work pretty darn well, too!

Apparently, though, JSF Portlet Bridge is not supported by Oracle for Apps that you deploy to the OC4J 10.1.2.x -- which is Portal 10g's current iAS platform until Portal 11g comes out.

web.xml role-name with spaces

I was having some trouble using with a value with spaces in it. I figured out why and how to fix it: The XML parser probably fails to read the role-name data because role-name is defined as xsd:ID in XML Schema which cannot have spaces. So if you escape the role name with CDATA, which suspends parsing, your roles will match up with LDAP roles that have spaces in them -- if you happen to have that convention in your LDAP. So now role-name entries in web.xml look like the following if they have spaces in them:

<role-name><![CDATA[my role name]]></role-name>
instead of

<role-name>my role name</role-name>

Wednesday, March 25, 2009

Quick Note about JSF, ADF and Postbacks

Unlike ADF, in pure JSF it appears there is no AdfFacesContext.postback context element to use to determine if you are currently in a post back or not. To determine postback you have to do some odd stuff.

So what is a postback? In short it is when a JSF page submits and it stays right where it is. In other words the action of the form is set to post to itself, passing all of its named fields as parameters. When the Faces Servlet sees this occurring it alters its “behavior”. The normal JSF request lifecycle has 7 or 8 phases when it is drawn out for others to see…but all these phases only come into play on a post back. When you first call a JSF page, all that you actually get is the first and the last phase…everything else is left out.

These postbacks are extremely important in the Rich Component world though. You have to postback in order to implement a very nice way to do AJAX functionality without having to make others who want to use your components add servlets to their web.xml.

Programmer Metamorphosis Psychology 101

It is always interesting to read journal entries. I found one here that someone might find helpful. Fortunately it has a happy ending... :-)
I am undergoing a change of a drastic nature. I am going from being a Forms/Reports guy to being a Java guy. I have been elated during most of the professional “metamorphosis” time – especially where I did things I was afraid to do at first, but then I realized I could handle it. I was productive and HAPPY about having done these things…about having suspended my disbelief long enough to know that I was about to say I could do something, that I had no idea I how I would do…long enough to put on a happy face to the person that wanted someone who appeared confident to tell them we would make miracles happen. And after a fashion I would even see how I was going to get these things done. But I never would have tried if I had not suspended the disbelief long enough to say: ‘I can do this’ to someone without having the slightest idea of how I was going to make that happen.

And…when all was said and done…I was better for this “lie”, and so was my employer. I was always taught not to lie.

In the Constitution of System Engineering Services Corporation®, there is a phrase in there: that they expect their employees to Stretch. That is what I am talking about.

When I was doing the work and working miracles, I was happy, and excited…LIKE I HAVE WANTED TO BE IN MY PROFESSION ALL ALONG. I thought the right thing to do was to be faithful to your technology, and your boss and their wishes. But…what if your bosses are fearful? What if they don’t know this secret about stretching? What if they know it but don’t want to do it because it’s scary? Then they suffer. Their company suffers. Their employees suffer…at least those that buy into this mode of behavior.

Why should anybody GRIND IT OUT with embarrassingly outdated technology at their job which is providing a paycheck, but which is providing a place where they are losing ground? Why?? Everybody is failing then…employer and employee…

All you need is to find a risk taker…and to be a risk taker. And I think you have to renew your vows to be such a risk taking creature on a daily basis. But the result is you have fun, learn lots, become more marketable, make friends, um…is there a downside to this?

I am still learning gobs…I hope that never stops. I guess I have something to do with it stopping or not, eh?

I hope you can benefit from the following analysis, and hope it aides you in whatever metamorphosis you are currently undergoing.

12/15/08 – Slight addendum to this forward: I am currently looking for work. So this transition is causing me some pain now. I feel it is because there are not jobs running out of everybody’s ears now that the economy is messed up. It is also because it is late in the year and that is a notoriously bad time to be out of work. But there is another thing the fledgling risk-takers should be aware of. You should strive to find good positions where you will continue to learn, but most employers want you to already be experts in whatever their suite of technologies is…and you also have to be better at this particular suite than 90% of the other candidates who are applying for that position.

Obviously, this is a difficult situation. Yes it is. I do not regret trying to leave Forms/Reports behind. I am a little worried I have not been more responsible…on a bad day, but mostly this is just the trough of the biorhythm of learning a new bunch of technology. Because…as I recall: finding a new job is ALWAYS a little…OK: a LOT…scary! When I get my job I will be elated…not bored and internally dead and miserable.

1/8/09 – I may have found a place in Minnesota (Trane Corporation) that does custom JSF component development, and really likes my work. So: off I go (happily) to St. Paul for the next 6 months to a year.

1/20/09 – Trane just announced a hiring freeze. Darn. Back to more looking.

Tuesday, March 24, 2009 -- OK: I am now at Fairfax, VA. Things are going well and we are speeding our way toward our first ADF app for this company. It would be ideal (in my boss’s words) if we could do work in WebLogic with the new ADF 11g technology. Wouldn’t that be sweet…??? Back on top of the world.

Wednesday, March 18, 2009

Developer Day Notes

I have some notes I would like to share about Oracle Developer Day. I got a whole lot out of it. Most of it extremely positive.

Here are my notes from the session. Hope they are helpful.
OTN Developer Day Notes

· OPI? OPEE?? (Eclipse Oracle Developer pack)

· Panel Collection – can surround a table to et a header and footer

· Rebuild will allow you to sometimes avoid rerunning a page in IDE

· Export to Excel – component to do that (uses a listener of some sort)

· FMW 11g released – calendar year 2009

· Moving splitters – maintained per user by session. To persist user settings you can use Oracle MDS – for example for a set of users you could create a preference set and store it on a database.

· When I deployed to 11g, I did not see OC4J as an option. But Lynn Munsinger says it is among the app servers they offer.

· The focus of the binding layer (JSR 227) is to abstract business services so that you don’t have to know implementation specific details SOAP,WSRP. Also it reduced the number of backing beans you need to write, and also shortens the

· I need to build a wiki of some sort (there is support for this in WebCenter suite).

· Components are ADA (Americans with disapbilities act) compliant

· Learn more about MDS (Metadata Services).

· Although ADF/BC control hints is UI mixed in Model (violation of mvc), it allows us to set standards.

· Can package up ADF BC’s as a library and deploy it, so developers can use this.

· Static list – keep small.

· You need to get a handle on deploying Application Modules for use by company.

· Google “ADF Methodology” – google group has a grassroots naming standards.

· Can create resource bundle on the fly when you create control hints.

· How do you create a plsql web service? Then you can use them in ADF/BC.

· JSF Component good because for example, table takes a collection and is trusted with doing the right thing with the data to make the table viable in HTML.

· What is stateless again? Lynne kept talking about stateless components.

· Check out print component, poll, listeners (that’s that client/javascript thing, I think)…

· Graphs are svg or flash.

· ADF Data Visualization are the graphs I think.

· Experiment with reusing a task flow.

· Task flows can go into a region really easily.

· Bounded task flows can battle the back button (huge reason for using task flows).

· Task flows are integrated with database transactions and process trains

· Can bundle components (like address block) as declarative components.

· It is better to add javascript to a component by creating a custom component and adding javascript.

· Decorative box is a nice layout; three column template is the fusion look.

· Awesome demo; my bosses really should have been there for it. Lynn Munsinger was doing it.

· If using non-adf business components (EJB, or session bean…), you can create declarative validation on the adf binding layer….not used to much often.

· Read the fusion developer guide.

· Read the Fusion UI Developer’s Guide

· (there will be a SOA Developers Guide)

· Q&A on OTn

· JDeveloper might be “less free” if we do not deploy to WebLogic server.

· While we are waiting for FMW 11g to come on line, I need to be establishing standards, best practices, packaging task flows and app modules for reuse, creating templates, creating declarative combined components, skins, page fragments, backing bean bases, ADF/BC component bases, ….

· Active Data Services – pushes changes to data. (ADS) better than polling.

· If we deploy to Tomcat 6.0 we have to pay for license to use the ADF libraries.

· For some reasons, when I was trying to add a default value to an entity date attribute, the groovy expression that I typed in did not register as having “taken”. I typed the value in and hit enter…well actually the first thing I did was enter the expression editor, which opens a dialog. But as soon as I went away from that context and came back the value I had entered did not appear. I bet if I had just entered the default value groovy expression on the property, the value would have taken as expected. At any rate entering the value in the field and switching to the source for the page made the little green dot appear in the property sheet, but no corresponding XML attribute value appeared for the “attribute” element for hireDate attribute. So finally I quit out of JDeveloper and reentered the tool. Then I entered the groovy expression, pressed enter, and it took: got the green dot (signifying non-default value in this property), and I checked the source screen and saw the corresponding DefaultValue attribute pop up with the Groovy value in it. Yay! Oddly enough once I got this to take I had accidentally left the value type to literal…which caused an error…because “adf.currentDate” is not really a valid date, is it? But changing to expression type made the XML change to a Transient expression and the data was put in a “CDATA” thingy. Lol Then it worked.

· Do the demo on page 23, 25, 27, etc. of the class pdf for your bosses.

· I wonder if the Fusion Developer’s guide has good documentation on the aspects of the groovy language that you need to know in order to, for example, express the endpoint values of a validation rule’s range as parameters that could be incorporated into an error message.

· For column selection I am not sure what freeze, wrap do. Not sure what the point is of detatch, but maybe I would discover all this stuff down the road. The tutorial called attention to the features, but I do not see what to do with them yet; and the tutorial did not say either.

· When you do a new ViewObject on the model, and you are to select the entities you want to use, the first one you select is marked as updatable, and reference checkbox is grayed out. When you shuttle over the second entity it assumes it is a reference. Of course this maybe due that not only is employee a child of department, but department is a child of employee due to the manager FK.

· Lynn said to post test cases of bugs on JDeveloper Forums

· Need to download a slightly newer version of JDev 11g which has fixes to memory leaks and many other issues…the memory leak issue actually makes the permgen error happen, and when you try to correct for it by restarting the embedded web logic server the same error happens. If you just restart JDeveloper, the WL Server won’t start because it says there is already one running. The fix for this is either remove the java.exe process in task manager and probably restart JDeveloper…or download this new version of JDeveloper that has a patch for this and other problems.
Questions

· Page Flow versus Task Flow – which one if either is related to an open source standard? Is Page Flow simply JSF’s built in controller, or is it something else?

· Is there a version of OC4J which works with Java EE 5.0. Yes! OC4J 10.1.4 (did not know that existed.) It does not quite do JPA 3.0 right because it was produced prior to the spec being completed for Java EE…but everything else is fine. When I asked Lynn if ADF Faces Rich Client could be deployed to this, she said “no, because of differences in libraries”.

· Could developers use either JDev 10.1.3 ADF Faces, or JDev 11g Trinidad for the same app depending on their preference?

· Client/Server: what does it buy you to run the components on the client side? Server side?

· Custom login modules? Are these harder to write in WebLogic? The same? Are there more built in options.

· Can you pass parameters in via EL? Used to be only HashMaps would allow this. Other means now? (In Java EE unified EL)

· What kind of expressions are allowed in the Token Message Expression area of the validation for an entity? For example, on a range how would you access the ends of the range? Is it Groovy? Where is the list of valid Groovy expressions?

Friday, March 13, 2009

doing battle with WSRP, Part II

Had a great session with Oracle technical support over the trouble I have been having with portletizing ADF Faces. The analyst mapped out an upgrade path for me which will solve all my problems; he demonstrated on his upgraded scenario using ias 10.1.2.3 (instead of my 10.1.2.0.2), and using Portal repository 10.1.4.2, plus the mandatory updates (instead of my 10.1.4.0), and also if I am going to deploy to OAS 10.1.3.4, that I make sure I have applied the web center jar file that WSRP-enables your particular OC4J instance that you have designated for exposing ADF apps via WSRP.

If I do all this, he demonstrated that the same ear I was having problems with, worked like a champ! YAY.

(The SR is 7381737.994 if you need it for reference. If you cannot access it, please leave a comment for this blog entry, and I will see if our situations are similar enough to warrent further action.)

Thursday, March 12, 2009

What forum is best for answering Oracle Portal-JSF integration questions?

WebCenter Framework Oracle Technet forum

The above URL is the WebCenter Framework forum on the Technet forums. This is the place that Peter Moskovits and similar people review and comment, and the place where questions get answered of the kind I have been dealing with lately.

I read the overview of WebCenter and I guess I did not realize that portal-JSF integration was synonymous with "WebCenter", but I think it is for some reason...

I hope it helps you.

JDev 11g's Class Diagrammer

Must comment on JDev 11g's Class Diagrammer.

I wanted to diagram some classes. I was in the Model projects of a MVC project, and the project technologies, under New gallery, under Diagrammers, was Java Class Diagrammer. So I selected it. Then I discovered that it seems this diagrammer is geared toward ADF/BC Java Class diagramming...in other words, if you want to model an entity or a view Java Class or something. I guess my poor brain has not even conceived of the need for such a diagrammer, but there must be a methodology where such a thing is a good idea. I will have to experiment with that...

But for that timeframe I just wanted a simple UML Class Diagrammer, but to find it you need to select all technologies, and select Class Diagrammer...not Java Class Diagrammer. What-EVER!! Now I am in the KNOW.

Once in the Class Diagrammer things went very smoothly. You can enter attributes and method with a short hand where + means public, - means private, # means protected, and blank means package. The diagrammer makes it pretty simple to enter multiple attributes at a time: type one, hit enter...and the diagrammer is waiting to take the next attributes. Same with methods. Links are pretty intuitive as well...which for a diagrammer is good.

That's it. OKThanksBye.

Tuesday, March 10, 2009

doing battle with WSRP

Victory! I got a portletized ADF app to deploy to JDeveloper 10.1.3.4's preconfigured oc4j. Here is how I did it and some pitfalls you can avoid: technet's jdev forum thread

I need to add more to this post to document what I did and did not try (for many reasons). I did a basic ADFBC/JSF master-detail app. I just dragged a child collection from the Data Control pallet into a Panel page and dropped it as master detail. I also put a menu tab on top that went no-where. (If this seems a familiar demo, it is the same one used by Shay Shmeltzer in a recent blog about Trinidad.)

So, I used the WebCenter Developer Guide 10.1.3.2 to instruct me on portletizing my simple app. No problem there, I don't think.

Then I made a deployment profile (WAR) for the ViewController project. Then I deployed to an ear from that profile. That's where it starts to get interesting. During this deployment process, a dialog window comes up asking if your target Portal Container is 10.1.3.2 or above. Now maybe this number is a WebCenter version of some sort...not sure. Our Portal version is 10.1.4. It is on a 10.1.2.0.2 OAS installation. So I tried answering both yes and no alternately to this question. Both created an ear, but the deployment results are what varied.

No seemed to create a JSR 168 producer, but I am not sure how to tell Oracle Portal to find this consumer. It seemed all the documentation I found has WSRP associated with JSR 168.

When I tried to deploy the ear to various OC4J's the results were varied:
  1. The "No" version of the ear file deployed everywhere, but I did not know how to consume it.
  2. The "Yes" version failed to deploy on the Oracle Portal OC4J, 10.1.2.0.2/Portal 10.1.4, because the process of creating the "yes" ear file installed an orion-application.xml file, which had an element that the OAS 10.1.2.0.2 deployment process could not handle...something like or something like that. I had trouble finding documentation on this element, but I am guessing that J2EE 1.3 had no such element in its DTD for orion-application. I did try creating my own version of orion-application.xml with a version 2 orion-application.xml, instead of version 10 -- like the JDeveloper ear generator produced. Still 10.1.2.0.2 OAS did not like this...the element was still foreign to it. Also the ear generator renamed my orion-application.xml file and put is own back in there, so I would have had to edit the ear file to get it to accept mine, during the ear generator's "yes" path. But even on the "no" path, when I put a version 2 orion-application.xml in my META-INF directory, with the same "mystery" element, the OAS deployer still could not deal with that element.
  3. The The "Yes" version of the ear failed to deploy on a 10.1.3.4 OC4J (stand-alone) version due to a Null Pointer exception I think.
  4. The "yes" version succeeded when I deployed it to the pre-configured OC4J which is installed in the /jdev/extensions directory. Although as noted on the technet link above, I had to log in twice to get into EM. The first time gave a JAXB error. Also once in I did not have button images, so I had to go from memory.

So anyway...I am now asking our 10.1.2.0.2 OAS to find and consume this baby, now that it is WSRP-produced. But...my development computer is apparently on a different sub-net or something. So today I am going to change my development computer to be fixed IP, and try this stunt again. Wish me luck.

Wednesday, March 4, 2009

ADF/Portal interview with Peter Moskovits

The company I am with and I interviewed Peter Moskovits, and got some questions answered we had about migration path of Oracle Portal 10g users and how to integrate the changing versions of ADF, which version of WSRP to use in which case, etc. Here are part of the minutes to the meeting:

Peter started with an overview of the Oracle products and product direction. Peter noted that Portal technology is a decade older than ADF technology, so efforts to merge them are challenging. Peter mentioned that there are a couple of kinds of portlets at work here: PDK Java Portlets, and WSRP/JSR168 Portlets. The latter is where the future is. In each case each technology offers something the other does not have, so Oracle promotes both. With Portal you have features such as runtime customization, reusable portlets, and content integration. So you can include portlets into ADF using WebCenter technology, or you can bring ADF portlets over and consume them WSRP 1.0 or 2.0 using JSF Portlet Bridge technology.

Regarding Portlet Bridge licensing…Peter says that there are two kinds of licensing for WebCenter: a WebCenter services license (meant mostly for developers) and a suite license (to get everything). The services license would be cheaper also than the suite license. If the Portlet Bridge was the only part of WebCenter that you were using, it sounded like you should get WebCenter Services license which is cheaper. The Portlet Bridge enables communication with OAS/OC4J 10.1.3.4 to obtain exposed portlets through WSRP portlet producer. If we are using 10g portal (OAS 10.1.2.0.2/Portal 10.1.4), we would need to use WSRP 1.0 (I have a question out to Peter to know if we could use ADF Faces (10g) PPR features with WSRP 1.0 or not).

Peter acknowledged that if you had to use OAS 10.1.2.0.2/Portal 10.1.4 that you would be much better off if you deployed your portletized 10g ADF Faces apps to OAS 10.1.3.4, and then consumed them with the 10.1.2.0.2 server with WSRP 1.0; rather than deploying directly to OAS 10.1.2.0.2 and having to dumb your 10g ADF Faces app down from 10.1.3.x down to 10.1.2 technology (J2EE 1.3/JDK 1.4 from J2EE 1.4/JDK 1.5).

We should not deploy portlets with the SOAP provider if we are using ADF; we should use the JSF Portlet Bridge. SOAP was only for Struts applications.

Peter and Jay both let me know that deploying a 10g ADF program was no big deal: a 3-step process, that was well documented in the 10g WebCenter Developer’s Guide.

Tuesday, March 3, 2009

JSF Portlet Bridge for dummys

Today I read an entry from the blog of Oracle Portal Principal Product Manager Peter Moskovits, dated from about 9 months ago. It talked about JSF Portlet Bridge, and showed him creating a video of his creating a an application which demonstrated JSF Portlet Bridge at work.

I am just starting to learn about Oracle Portal, unlike Peter, so I thought the world of people who are at my understanding level might like to hear my comments. All of the following are eithe quotes from Peter Moskovits, or they are my interpretations of Peter's words or actions, coupled with what I know and have read.

So in JDev 11g you can right-click on a reusable item called a Task Flow, or a jspx/jsp page and something comes up which says "Create Portlet Entry...". Doing this action will create a file called portlet.xml which is apparently the key file in portlet applications. I believe this is the equivalent of doing what is called "portletizing" an application.

In Peter's video, he is deploying his portletized JSF application to the embedded preconfigured OC4J which also had the portlet container in it. Even after this app was portletized, Peter could still run the jspx/jsp files individually. But also Peter demonstrated that you could access something called a "portlet producer". Apparently there is something called WSRP which is a portlet producer. I guess WSRP is a web service also because it has a WSDL, which you need to copy and save if you are ever going to use the portlet-ized JSF app you made.,..and also deployed.

WSDL URL's are also called "endpoint URL's".

Although it appears you get to the portletized JSF applications though the WSRP service, portlet parlance says that your application "consumes" a portlet...just like an app consumes a web service.

So when you create your application that consumes portlets (preferable, hopes oracle, a webcenter template application out of JDev 11g) it is called a portlet consumer application. In JDev 11g (and probably all IDE's) you need to register the portlet producer with your application. In 11g Jdev this is done by...
  1. clicking ViewController project
  2. New --> WebTier --> Portlets --> WSRP Producer Registration
  3. Name the portlet producer you are registering
  4. paste in that WSRP WSDL you have been saving (see above)
After a successful registration you see a WSRP producer node in the Application Resources section. This opens up to child nodes and you see your portletized JSF app.

Then in your app you can just create you JSF (or other technology that supports using WSRP), and drag and drop the portlet out from under the WSRP producer node and onto the page. This will add the portlet tag and portlet binding to the page (assuming you are using ADF, ;-). If you run it you will see your page in a portlet on the browser.

So where is the JSF Portlet Bridge coming into play here? I read that the JSF Portlet Bridge bridges JSF and Portlet technologies...but where do the implementing classes reside. I think they reside on the machine where you first deployed your portletized JSF application. I am beginning to think that this app server that you first deploy your portletized JSF app does not need to have a Portlet Container...like Oracle Portal. I think it just needs that portlet.xml in order for WSRP to talk to it. I suspect that WSRP needs to be implemented on both ends...probably the same version...but maybe not?

I know this though, because Peter said it: when you create your portlet consumer application, you can use your published portletized JSF app in any other 3rd party portal that supports WSRP (and the version of WSRP you are using).

Still trying to digest all of this. Tomorrow I have a conference call with Peter and the rest of my teammates.

Here is the video Peter made... video

Also the link for the JSR for JSF Portlet Bridge has a Spec with some great overview material in it. It helped me.