tag:blogger.com,1999:blog-84844166086706428432024-03-24T00:09:42.719-07:00JDeveloper Frequently Asked QuestionsFrequently Asked (and not so frequently answered) Questions related to the JDeveloper development environment.Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.comBlogger41125tag:blogger.com,1999:blog-8484416608670642843.post-37033402901510993252017-02-15T12:06:00.000-08:002017-02-15T15:59:20.422-08:00FAQ #39 - Handling session expiration redirection in ADF 12c<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Introduction</b><br />
<br />
So how is this handled in 12c? I asked this to myself when I had to migrate an 11g ADF application to 12c. It seems that other people are asking about it too (see: <a href="https://community.oracle.com/thread/3952768">https://community.oracle.com/thread/3952768</a>, <a href="https://community.oracle.com/message/12531687#12531687">https://community.oracle.com/message/12531687#12531687</a>, <a href="https://community.oracle.com/message/12497105#12497105">https://community.oracle.com/message/12497105#12497105</a> and so on) but no answers yet. The tried and tested implementation in 11g was to implement a custom filter, detect a session expiration and if that occurs redirect to a session-expired page. This is all good but... it does not work in 12c.<br />
<br />
<b>Main Theme</b><br />
<br />
<i><u>Google this</u></i><br />
<br />
It is unfortunate for yet another instance there is practically no documentation on this at all. After googling intensly on the topic for a couple of days (talk about "agile" programming), I landed on this Oracle A-TEAM blog post, which seemed promising: <a href="http://www.ateam-oracle.com/customizing-session-time-out-pop-ups/">http://www.ateam-oracle.com/customizing-session-time-out-pop-ups/</a>. The post details how to customize the session expiration dialogs. Right at the top of the post there is a link with <i>tips-on-dealing-with-the-session-time-out-popup</i>. Eureka! As an older Greek colleague once said. So I navigated to it (<a href="http://www.ateam-oracle.com/tips-on-dealing-with-the-session-time-out-popup/">http://www.ateam-oracle.com/tips-on-dealing-with-the-session-time-out-popup/</a>) only to find out - to my dissapointment - that this was the good old 11g approach. Bammer.<br />
<br />
<i><u>Deep poetry</u></i><br />
<br />
Well, not everything was lost. A small glimpse of hope appeared thanks to an initially seeming esoteric comment at the bottom by Deep Saurabh (<b><u>Thank you Mr. Saurabh</u></b>). And the comment goes something like this:<br />
<br />
"<i>If neither of above two is working , override NewSessionURLProvider service/provider.</i><br />
<i>( http://docs.oracle.com/middleware/1212/adf/FACAR/oracle/adf/view/rich/context/NewSessionURLProvider.html )</i><br />
<i>In the web lib’s META-INF/services folder you should have file:</i><br />
<i>oracle.adf.view.rich.context.NewSessionURLProvider</i><br />
<i>(for quick test run from jdev create META-INF/services under your ViewController/public_html/WEB-INF/classes/)</i><br />
<i><br /></i>
<i>Which should contain FQCN of your custom overridden AdfcNewSessionURLProvider class.</i>"<br />
<br />
Hmm? What did the Deep poet mean?<br />
<br />
<i><u>Enter NewSessionURLProvider</u></i><br />
<br />
Well, other than the Deep comment above - which at the time I did not quite understand - the only other thing I had to go was the <b><i>NewSessionURLProvider</i> </b>class. Here is the 12.2.1 class JavaDoc: <a href="https://docs.oracle.com/middleware/1221/adf/api-reference-faces/oracle/adf/view/rich/context/NewSessionURLProvider.html">https://docs.oracle.com/middleware/1221/adf/api-reference-faces/oracle/adf/view/rich/context/NewSessionURLProvider.html</a><br />
The class is simple enough. It is an abstract class that needs to be overridden in the 12c ADF application by implementing the <i><b>getNewSessionURL()</b></i> method. As the documentation states, <i><b>getNewSessionURL() </b></i>is "<i>Used to provide the view with a URL to create a new session if the current session expires while the current page is displayed.</i>". Like I said, simple enough. That would be the first step. Override <i><b>NewSessionURLProvider </b></i>in your ADF application and provide an implementation for <b><i>getNewSessionURL()</i></b>. The code should look like this:<br />
<br />
<i>package com.jdeveloper.faq.services;</i><br />
<i><br /></i>
<i>public class MyNewSessionURLProvider extends NewSessionURLProvider {</i><br />
<i> @override</i><br />
<i> public String getNewSessionURL(FacesContext fc) {</i><br />
<i> return "pages/YourSessionExpirationPage.html";</i><br />
<i> }</i><br />
<i>}</i><br />
<br />
All you have to do is return the page that you want the application to redirect upon session expiration.<br />
<br />
<i><u>What next?</u></i><br />
<br />
It is unclear what needs to happen next, to miraculously connect your ADF 12c application to the ADF framework and instruct it to redirect to your page. If you decypher the line "<i>In the web lib’s META-INF/services folder you should have file: oracle.adf.view.rich.context.NewSessionURLProvider</i>" from the comment above, it simply states what needs to be done next:<br />
<br />
In your application's JDeveloper web <i><b>ViewController </b></i>project, under the <b><i>src/META-INF</i></b> directory create a new directory called <i><b>services</b></i>.In the <b><i>src/META-INF/services</i></b> directory create a text file (no extension) literally called <b><i>oracle.adf.view.rich.context.NewSessionURLProvider</i></b>. Edit the <b><i>src/META-INF/services/oracle.adf.view.rich.context.NewSessionURLProvider</i></b> text file and in it type the FQCN of your overridden <b><i>NewSessionURLProvider </i></b>class. This is what the <b><i>src/META-INF/services/oracle.adf.view.rich.context.NewSessionURLProvider</i></b> text file should look like:<br />
<br />
<i>com.jdeveloper.faq.services.MyNewSessionURLProvider</i><br />
<br />
<i><u>That's all?</u></i><br />
<br />
Pretty much. The only other thing that needs to be done is to ensure that the<b><i> src/META-INF/services/oracle.adf.view.rich.context.NewSessionURLProvider</i></b> file in included in your deployed WAR file (during the application EAR deployment). In order to do that, edit the web <b><i>ViewController </i></b>deployment profile properties and under the <b><i>WEB-INF/classes</i></b> file group <b><i>Contributors </i></b>ensure that the <b><i>Project Source Path</i></b> is checked. Verify that the <b><i>services/oracle.adf.view.rich.context.NewSessionURLProvider</i></b> is included in the file list by selecting <b><i>Filters </i></b>under the <b><i>WEB-INF/classes</i></b> file group. Once you deploy your application, open the WAR and ensure that the <b><i>services/oracle.adf.view.rich.context.NewSessionURLProvider</i></b> text file is indeed included in the archive.<br />
<br />
You are now ready to test it. Don't forget to remove the 11g custom filter implementation from <b><i>web.xml</i></b>.<br />
<br />
<b>Conclusion</b><br />
<br />
I personally like the session expiration redirection implementation in 12c. No need to come with custom filters and all. Hopefully this will be documented in future releases of ADF.<br />
<br />
Until the next post,(and that may be a long long time...) have fun with JDeveloping!<br />
<br /></div>
Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com4tag:blogger.com,1999:blog-8484416608670642843.post-18272809011317816312012-12-06T15:34:00.000-08:002017-02-13T14:56:47.362-08:00Oracle JDeveloper 11gR2 Cookbook<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
After almost a year of truly great effort by everyone involved, I am happy to announce that my <b><i>Oracle JDeveloper 11gR2 Cookbook</i></b> book is published by <b><i>Packt Publishing</i></b>. This book accumulates to a large degree my practical experience amassed over the last four years working on real world ADF projects.<br />
<br />
Special Thanks goes to <b><i>Frank Nimphius</i></b>, <b><i>Edwin Biemond</i></b> and <b><i>Spyros Doulgeridis</i></b> for their insight, knowledge and advice. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.packtpub.com/oracle-jdeveloper-11gR2-to-build-adf-applications-cookbook/book" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://4.bp.blogspot.com/-Bk30Uki1328/TyBZPprXPAI/AAAAAAAAA4k/fqruGefMXt8/s320/book.png" width="231" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
For further details about the book click <a href="http://www.packtpub.com/oracle-jdeveloper-11gR2-to-build-adf-applications-cookbook/book">here</a>. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-size: small;">Here are some peer references/reviews of the book from the blog sphere:</span></div>
<ul style="text-align: left;">
<li><span style="font-size: x-small;"><a href="https://blogs.oracle.com/shay/entry/new_adf_book_oracle_jdeveloper">https://blogs.oracle.com/shay/entry/new_adf_book_oracle_jdeveloper</a> </span></li>
<li><span style="font-size: x-small;"><a href="http://monkeyonoracle.blogspot.com/2012/02/preparing-to-work-with-adf.html">http://monkeyonoracle.blogspot.com/2012/02/preparing-to-work-with-adf.html</a></span></li>
<li><span style="font-size: x-small;"><a href="http://antonis-antoniou.blogspot.com/2012/03/new-adf-book-oracle-jdeveloper-11gr2.html">http://antonis-antoniou.blogspot.com/2012/03/new-adf-book-oracle-jdeveloper-11gr2.html</a> </span></li>
<li><span style="font-size: x-small;"><a href="http://www.adftips.com/2012/03/oracle-jdeveloper-11gr2-cookbook-new.html">http://www.adftips.com/2012/03/oracle-jdeveloper-11gr2-cookbook-new.html</a> </span></li>
<li><span style="font-size: x-small;"><a href="http://nickaiva.blogspot.com/2011/12/preview-of-oracle-jdeveloper-11gr2.html">http://nickaiva.blogspot.com/2011/12/preview-of-oracle-jdeveloper-11gr2.html</a></span></li>
<li><span style="font-size: x-small;"><a href="https://blogs.oracle.com/grantronald/entry/book_to_review_oracle_jdeveloper11gr2">https://blogs.oracle.com/grantronald/entry/book_to_review_oracle_jdeveloper11gr2</a></span></li>
<li><span style="font-size: x-small;"><a href="https://blogs.oracle.com/jdeveloperpm/entry/new_adf_book_oracle_jdeveloper">https://blogs.oracle.com/jdeveloperpm/entry/new_adf_book_oracle_jdeveloper</a></span></li>
<li><span style="font-size: x-small;"><a href="http://www.oraclemagazine-digital.com/oraclemagazine_twitter/20120304?pg=31#pg31">http://www.oraclemagazine-digital.com/oraclemagazine_twitter/20120304?pg=31#pg31</a></span></li>
<li><span style="font-size: x-small;"><a href="https://forums.oracle.com/forums/thread.jspa?threadID=2351960">https://forums.oracle.com/forums/thread.jspa?threadID=2351960</a></span></li>
<li><span style="font-size: x-small;"><a href="https://blogs.oracle.com/onesizedoesntfitall/entry/oracle_jdeveloper_11gr2_cookbook_book">https://blogs.oracle.com/onesizedoesntfitall/entry/oracle_jdeveloper_11gr2_cookbook_book</a> </span></li>
<li><span style="font-size: x-small;"><a href="http://serafeimk.blogspot.com/2012/04/adf-11g-oracle-jdeveloper-11gr2.html">http://serafeimk.blogspot.com/2012/04/adf-11g-oracle-jdeveloper-11gr2.html</a> </span></li>
<li><span style="font-size: x-small;"><a href="http://xmlandmore.blogspot.com/2012/04/book-review-oracle-jdeveloper-11gr2.html">http://xmlandmore.blogspot.com/2012/04/book-review-oracle-jdeveloper-11gr2.html</a> </span></li>
<li><span style="font-size: x-small;"><a href="http://www.amazon.com/Oracle-JDeveloper-11gR2-Cookbook-ebook/product-reviews/B00719PC60/ref=dp_top_cm_cr_acr_txt?ie=UTF8&showViewpoints=1">http://www.amazon.com/Oracle-JDeveloper-11gR2-Cookbook-ebook/product-reviews/B00719PC60/ref=dp_top_cm_cr_acr_txt?ie=UTF8&showViewpoints=1</a> </span></li>
</ul>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div>
Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com11tag:blogger.com,1999:blog-8484416608670642843.post-55066378322695724182012-03-09T20:07:00.000-08:002012-03-09T20:35:42.340-08:00FAQ #38 - How to add help to an ADF application<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;"><b>Introduction</b></span><br />
<br />
Adding help to an ADF Fusion Web application is thoroughly explained in section <a href="http://docs.oracle.com/cd/E24382_01/web.1112/e16181/af_message.htm#CHDHIGIA">19.5 Displaying Help for Components</a> of the <i>Web User Interface Developer’s Guide for Oracle Application Development Framework</i> guide. Yet, as it seems from this post <a href="https://forums.oracle.com/forums/message.jspa?messageID=10190922#10190922">https://forums.oracle.com/forums/message.jspa?messageID=10190922#10190922</a> in the <i>JDeveloper and ADF forum</i> at OTN, some of us still have questions around this subject. In this post I will attempt to clarify the subject of adding help to your ADF application by presenting pretty much the same information but in a different approach, so I suggest that before continuing with the reading this post you first take a look at the aforementioned link in the guide. Then, if you still have questions, read on.<br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
Help added to an ADF Fusion Web application is categorized based on where the help contents are stored. Currently the help contents can be stored in any of the following mediums:<br />
<ul style="text-align: left;">
<li>In a resource bundle</li>
<li>In a managed bean, or </li>
<li>In an XML Localization Interchange File Format (XLIFF) XML file</li>
</ul>
So the first step would be to determine where your help contents will be stored. As mentioned, you have the choices listed above. So the first step entails having to make a design decision which one to use. What gets a little bit confusing is that each one of the three choices above allows you to display help using an external URL, which will open the help contents in a separate browser window.<br />
<br />
So how do you add help to your ADF Fusion Web application? Simply by adding a <b><i>help-provider</i></b> tag to the <b><i>adf-settings.xml</i></b> configuration file. The <b><i>adf-settings.xml</i></b> file resides in the <b><i>.adf/META-INF </i></b>directory and it is accessible in JDeveloper in the <b><i>Application Resources</i></b> part of the <i>Application Navigator</i> via the <b><i>Descriptors</i></b> | <b><i>ADF META-INF</i></b> node. Depending on the help contents location (one of the three choices listed above) you need to provide values for the <b><i>help-provider-class</i></b> and <b><i>property</i></b> tags under the <b><i>help-provider tag</i></b>. Here is an example for the case where the help contents are stored in a resource bundle:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-JaifCtdW7Xk/T1qoZChHZVI/AAAAAAAAA6s/djHJyNTn6s0/s1600/FAQ38.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="89" src="http://1.bp.blogspot.com/-JaifCtdW7Xk/T1qoZChHZVI/AAAAAAAAA6s/djHJyNTn6s0/s320/FAQ38.1.png" width="320" /></a></div>
In the table below I have listed the appropriate help provider classes and property names/values depending on the location of the help contents:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-F9BTlKLVKxw/T1qsUSjkWrI/AAAAAAAAA60/lapn8rRR4sY/s1600/FAQ38.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="47" src="http://3.bp.blogspot.com/-F9BTlKLVKxw/T1qsUSjkWrI/AAAAAAAAA60/lapn8rRR4sY/s320/FAQ38.2.png" width="320" /></a></div>
<br />
You can provide external URL help in each case (resource bundle, managed bean, XLIFF) by providing your own custom help provider class. Just make sure that in each case you extend the appropriate default help provider class (shown in the table above), i.e. <b><i>oracle.adf.view.rich.help.ResourceBundleHelpProvider </i></b>for resource bundle based help or <b><i>oracle.adf.view.rich.help.ELHelpProvider</i></b> for managed bean or XLIFF based help.<br />
<br />
For the remainder of this post, we will see how to add help utilizing the resource bundle method, which is in my opinion the most straightforward case. In this case all you have to do is to create a resource bundle, i.e. a text file with the file extension <b><i>.properties</i></b> and add the help contents to it. The help contents are made up of text lines that conform to the following naming convention:<br />
<br />
<i>help_topic_id</i>=<i>help_topic_data</i><br />
<i></i><br />
where<i> help_topic_id</i> is the help topic identifier and <i>help_topic_data</i> is the actual help shown to the user. Here is an example:<br />
<br />
<i>PREFIX_TOPIC1_INSTRUCTIONS=Example for help instructions</i><br />
<i>PREFIX_TOPIC1_DEFINITION=Example for help definition</i><br />
<ul style="text-align: left;">
</ul>
A few things to notice about the help topic identifiers:<br />
<ul style="text-align: left;">
<li>For the same topic (<i>TOPIC1</i> in the example above), you can define both <i>instructions</i> help and <i>definition </i>help by appending <i>_INSTRUCTIONS</i> and <i>_DEFINITION</i> to the end of the id respectively. <i>Instructions</i> help usually appears as you tab from one UI component to another, while <i>definition</i> help usually appears as a help icon in front of the UI component but this may vary depending the UI component. Again, take a look at section <a href="http://docs.oracle.com/cd/E24382_01/web.1112/e16181/af_message.htm#CHDHIGIA">19.5 Displaying Help for Components</a> of the <i>Web User Interface Developer’s Guide for Oracle Application Development Framework</i> guide for more information on this.</li>
<li>Notice the prefix (<i>PREFIX_</i> in the example above) used by the help topic identifiers. The prefix identifies the help provider and is specified in the <b><i>help-provider</i></b> tag in the <b><i>adf-settings.xml</i></b> configuration file. </li>
</ul>
<br />
Finally, how do you assign help topic identifiers to UI components? For this you can use the <b><i>HelpTopicId </i></b>property under <b><i>Appearance</i></b> in the <b><i>Property Inspector</i></b>, just don't add the <i>_INSTRUCTIONS</i> or<i> _DEFINITION</i> part of the help topic id:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-c10BK3yQxVY/T1rOVS9Rz5I/AAAAAAAAA7E/ardt7wwW-9k/s1600/FAQ38.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="74" src="http://1.bp.blogspot.com/-c10BK3yQxVY/T1rOVS9Rz5I/AAAAAAAAA7E/ardt7wwW-9k/s320/FAQ38.3.png" width="320" /></a></div>
<br />
The result of using <i>PREFIX_TOPIC1</i> for an <b><i>af:inputText</i></b> UI component is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-NE4B6_5E6fw/T1rPghF61ZI/AAAAAAAAA7M/X92c4F3sR3s/s1600/FAQ38.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="100" src="http://4.bp.blogspot.com/-NE4B6_5E6fw/T1rPghF61ZI/AAAAAAAAA7M/X92c4F3sR3s/s320/FAQ38.4.png" width="320" /></a></div>
As soon as you tab into the <i>inputText</i> component the <i>instructions </i>help is shown. The <i>definition</i> help is shown by hovering the mouse on the question mark icon added by the framework in front of the <i>inputText</i> component.<br />
<br />
One last thing: the question mark icon could actually become a button that when clicked will display help from an external URL in a separate browser window. As mentioned earlier, you do this by extending the default help provider. But again, this is explained nicely in the documentation.<br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
Hopefully this post clarified any additional questions that you might have had related to adding help to your ADF Fusion Web application. <br />
<br />
Until the next post, have fun with JDeveloping!<br />
<br /></div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0tag:blogger.com,1999:blog-8484416608670642843.post-59974752040289699022012-03-08T08:34:00.000-08:002012-03-15T06:37:43.588-07:00FAQ #37 - How to create audit trail records using ADFBC, Pt. 2<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;"><b>Introduction</b></span><br />
<br />
In this second part of creating historical audit trail records using ADFBC we will see how to integrate, in a generic way, the stored procedures introduced in part 1 of these series. For more information on the database schema and stored procedures that are required to support this technique refer to <a href="http://jdeveloperfaq.blogspot.com/2012/03/faq-36-how-to-create-audit-trail.html">FAQ #36 - How to create audit trail records using ADFBC, Pt. 1</a>. <br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
As explained in part 1 (<a href="http://jdeveloperfaq.blogspot.com/2012/03/faq-36-how-to-create-audit-trail.html">FAQ #36 - How to create audit trail records using ADFBC, Pt. 1</a>), historical audit trails are generated by calling the stored procedures <b><i>AUDIT_TABLE</i></b> and <b><i>AUDIT_DETAILS</i></b>. Both of these procedures are part of the <b><i>AUDIT_PKG</i></b> database package.<br />
<br />
The <b><i>AUDIT_TABLE</i></b> procedure is called to create a historical audit trail of the corresponding table. As explained in part 1, corresponding history tables are created for each table being audited. These history tables conform to the following naming convention: <i>table_name_HISTORY</i> where <i>table_name</i> is the table being audited. For example the corresponding history <b><i>REGIONS</i></b> table is called <b><i>REGIONS_HISTORY</i></b>.<br />
<br />
To create a generic implementation, we will need to create framework extension classes for both the <b><i>oracle.jbo.server.EntityImpl</i></b> and <b><i>oracle.jbo.server.ApplicationModuleImpl</i></b> classes. Once these framework extension classes are created ensure that the ADFBC project settings are changed to reflect this fact. You do this by bringing up the <b><i>Project Properties</i></b> dialog and selecting <b><i>ADF Business Components</i></b> | <b><i>Base Classes</i></b> as it is shown in the picture below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-mBREWXRBVg8/T1gmXjKAsLI/AAAAAAAAA6E/v3A1JC_4C_A/s1600/FAQ37.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://3.bp.blogspot.com/-mBREWXRBVg8/T1gmXjKAsLI/AAAAAAAAA6E/v3A1JC_4C_A/s320/FAQ37.1.png" width="320" /></a></div>
The next step is to override the <b><i>EntityImpl doDML()</i></b> method for the <b><i>EntityImpl</i></b> extension framework class and add the following code to it:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-h9Y7GuPy97Y/T1goRLyXxDI/AAAAAAAAA6M/I3g6FBFiKns/s1600/FAQ37.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="129" src="http://2.bp.blogspot.com/-h9Y7GuPy97Y/T1goRLyXxDI/AAAAAAAAA6M/I3g6FBFiKns/s320/FAQ37.2.png" width="320" /></a></div>
Note a few things about this overridden <b><i>doDML()</i></b> method:<br />
<br />
<ol style="text-align: left;">
<li>We call <b><i>getEntityDef().getProperty(DISABLE_AUDIT_PROPERTY)</i></b> to determine whether auditing for the specific entity object has been disabled. This is controlled by the presence of an entity object property identified by the constant <b><i>DISABLE_AUDIT_PROPERTY</i></b>. As long as this property has not been defined in the entity object, auditing is enabled by default.</li>
<li>We call <b><i>getEntityDef().getSourceType()</i></b> to determine the source type of the entity object. We will audit entity objects based on database tables only. This is done by comparing the return value of <b><i>getEntityDef().getSourceType()</i></b> to <b><i>DBOBJ_TYPE_TABLE</i></b>. <b><i>DBOBJ_TYPE_TABLE </i></b>is a constant defined in <b><i>oracle.jbo.server.EntityDefImpl</i></b> indicating that the entity object is based on a database table.</li>
<li>The first parameter required by the <b><i>AUDIT_TABLE</i></b> stored procedure is the user's current session identifier. This can be retrieved by calling <b><i>SessionImpl.findOrCreateSessionContextManager().getCurrentSession().getId()</i></b>. Take a look at this post for information on this: <a href="http://adfcodebits.blogspot.com/2012/02/bit-39-retrieving-current-session-id-at.html">Bit #39 - Retrieving the current session id at the ADFBC layer</a>.</li>
<li>The second parameter passed to <b><i>AUDIT_TABLE</i></b> stored procedure is the commit identifier. We would like to keep track changes for each commit done in the same user session. We retrieve the commit identifier from a database sequence by calling the helper <b><i>getCommitId()</i></b> (see source code below).</li>
<li>We pass the DML operation as a string (<i>INSERT</i>, <i>UPDATE</i> or <i>DELETE</i>) based on the value of the <b><i>operation </i></b>parameter passed to <b><i>doDML()</i></b> by the ADFBC framework.</li>
<li>We call <b><i>getEntityDef().getSource()</i></b> to get the name of the table associated with the entity object.</li>
<li>Finally we call the <b><i>getEntityId()</i></b> helper (see code below) to get the entity object's primary key. Note that we convert the primary key to a string before passing as a parameter to the <b><i>AUDIT_TABLE</i></b> stored procedure.</li>
</ol>
Here is the code for the <b><i>getCommitId()</i></b> and <b><i>getEntityId()</i></b> helpers:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-WpazRafDElw/T1gswhcf0bI/AAAAAAAAA6U/z9xkvp_3uaA/s1600/FAQ37.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="203" src="http://1.bp.blogspot.com/-WpazRafDElw/T1gswhcf0bI/AAAAAAAAA6U/z9xkvp_3uaA/s320/FAQ37.3.png" width="320" /></a></div>
Notice a couple of things about these helper methods:<br />
<ol style="text-align: left;">
<li>In <b><i>getEntityId()</i></b> we iterate through the entity object attributes in order to determine the primary key attribute. We do this by first calling <b><i>getStructureDef().getAttributeDefs()</i></b> to get the attribute definitions and then by calling <b><i>isPrimaryKey()</i></b> for each attribute to determine if it is a primary key attribute. If it is, we call <b><i>getAttribute()</i></b> to retrieve and return its value. Notice that you will have to expand this implementation if you have an entity object with a composite primary key.</li>
<li>In <b><i>getCommitId()</i></b> we add the commit identifier returned from the database sequence to the session user data by calling <b><i>getDBTransaction().getSession().getUserData()</i></b>. We do this because we will need the same commit identifier at a later stage when calling the <b><i>AUDIT_DETAILS</i></b> stored procedure.</li>
</ol>
As explained in part 1 of this post, to create the specific details of the audit trail we need to call <b><i>AUDIT_PKG.AUDIT_DETAILS</i></b> stored procedure. To do this, override the <b><i>afterCommit()</i></b> in the <b><i>ApplicationModuleImpl</i></b> framework extension class and add the following code to it:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-ObJNtJn33Nc/T1gzFZULCAI/AAAAAAAAA6c/Kl7o3_Mrquc/s1600/FAQ37.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="109" src="http://4.bp.blogspot.com/-ObJNtJn33Nc/T1gzFZULCAI/AAAAAAAAA6c/Kl7o3_Mrquc/s320/FAQ37.4.png" width="320" /></a></div>
<br />
Notice in this case how we call <b><i>getSession().getUserData().get(ExtEntityImpl.COMMIT_ID)</i></b> to get the same commit identifier and pass it as a parameter to the <b><i>AUDIT_DETAILS</i></b> stored procedure. Also, notice that we remove the commit identifier from the session user data once we are done with calling the stored procedure.<br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
In this two-part series we've seen a custom implementation of creating a historical audit trail based on a stored procedure implementation in the database. Notice that this technique is fairly generic as it does not require any additional implementation in the specific entity objects used throughout the application. As mentioned above, auditing is enabled by default and can be disabled by the presence of a property defined in the entity object. This can be easily reversed so that auditing is not done by default. If you found this useful, let me know so I can email you or post the source code as well.<br />
<br />
Until the next time, have fun JDeveloping!<br />
<br />
<br /></div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com30tag:blogger.com,1999:blog-8484416608670642843.post-21065835983518573342012-03-07T11:12:00.000-08:002012-03-09T20:06:51.839-08:00FAQ #36 - How to create audit trail records using ADFBC, Pt. 1<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-size: large;"><b>Introduction</b></span><br />
<br />
ADFBC allows for the creation of historical audit trail records at the entity object level via the use of history columns. By default the framework allows for keeping track of historical information for attributes indicated as <i>Created On</i>, <i>Created By</i>, <i>Modified On</i>, <i>Modified By</i> and <i>Version Number</i>. This is explained in section <a href="http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcentities.htm#ADFFD201">4.10.12 How to Track Created and Modified Dates Using the History Column</a> of the <i>Fusion Developer's Guide for Oracle Application Development
Framework 11g Release 2</i> guide. The guide also explains how to create your own custom history types in section <a href="http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcentities.htm#ADFFD1162">4.16 Creating New History Types</a>. In this post we will detail a generic technique to create historical audit trail records using a PL/SQL stored procedure in the database. For this we will use the <b><i>HR </i></b>schema and demonstrate how to create an audit trail for the <b><i>REGIONS </i></b>and <b><i>COUNTRIES </i></b>tables.<br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
<i><u>Schema changes</u></i><br />
<br />
Before you start on implementing an audit trail in your ADF application you need to decide on what specific information you need to create a historical trail on. This might include creating audit trail information for specific tables and/or specific columns in these tables. For the sake of this post, I will demonstrate how to create historical information for the <b><i>REGIONS </i></b>and <b><i>COUNTRIES </i></b>tables in the <b><i>HR </i></b>schema. For this purpose you will need to create corresponding <b><i>REGIONS_HISTORY</i></b> and <b><i>COUNTRIES_HISTORY</i></b> tables. These tables will hold the historic information. Here is a structure of the <b><i>REGIONS_HISTORY</i></b> table used for this implementation:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-siydzLIhbMc/T1eYigLeLoI/AAAAAAAAA40/-0E1Flzowf4/s1600/FAQ36.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="http://4.bp.blogspot.com/-siydzLIhbMc/T1eYigLeLoI/AAAAAAAAA40/-0E1Flzowf4/s320/FAQ36.1.png" width="320" /></a></div>
This table holds the historical data (columns <b><i>REGION_ID</i></b> and <b><i>REGION_NAME</i></b>) and information related to audit trail such as the user session that created the audit trail (<b><i>SESSION_ID</i></b>), the commit number within the session (<b><i>COMMIT_ID</i></b>), the type of audit operation, i.e. <i>INSERT</i>, <i>UPDATE</i>, <i>DELETE</i> (<b><i>OPERATION</i></b>) and a link to the <b><i>HISTORY</i></b> table (<b><i>HISTORY_ID</i></b>). The <b><i>HISTORY</i></b> table provides the ability to browse for the complete audit trail and its structure is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-SYpe6kBZGGU/T1eaJRNxuFI/AAAAAAAAA48/MopHZPhxjP4/s1600/FAQ36.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="147" src="http://4.bp.blogspot.com/-SYpe6kBZGGU/T1eaJRNxuFI/AAAAAAAAA48/MopHZPhxjP4/s320/FAQ36.2.png" width="320" /></a></div>
The table holds such information as the date/time of the specific audit trail, the user that has created the audit trail and the user session identifier. For each <b><i>HISTORY</i></b> record there are a number of history lines that detail the specific changes. This detailed information is stored in a table called <b><i>HISTORY_LINE</i></b>. The structure of the <b><i>HISTORY_LINE</i></b> table is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-RHv4GryT8Qo/T1ebGSXRmDI/AAAAAAAAA5E/t8YasGAqf1k/s1600/FAQ36.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="http://3.bp.blogspot.com/-RHv4GryT8Qo/T1ebGSXRmDI/AAAAAAAAA5E/t8YasGAqf1k/s320/FAQ36.3.png" width="320" /></a></div>
As you can see, this table holds audit trail information specific for each change done to the table being audited. The information is kept in this table on a per session commit basis, i.e. for each commit done in the user session. Some of the columns of interest are the following:<br />
<ul style="text-align: left;">
<li><b><i>HISTORY_TABLE</i></b> - The name of the table that was audited</li>
<li><b><i>FIELD_NAME</i></b> - The name of the column with the <b><i>HISTORY_TABLE</i></b> that was audited</li>
<li><b><i>OPERATION</i></b> - The operation on the column, i.e. <i>INSERT</i>, <i>UPDATE</i>, <i>DELETE</i></li>
<li><b><i>VALUE_OLD</i></b> - The original column data value</li>
<li><b><i>VALUE_NEW</i></b> - The new column data value</li>
</ul>
Given the information in the <b><i>HISTORY_LINE</i></b> table we will be able to link to the corresponding history table (<b><i>REGIONS_HISTORY</i></b>, <b><i>COUNTRIES_HISTORY</i></b>, etc.) and be able to present a "picture" of what the data in the table looked like prior to the change. We can then compare it with the latest data in the corresponding table (<b><i>REGIONS</i></b>, <b><i>COUNTRIES</i></b>, etc.). Here an example of what the data in the <b><i>HISTORY_LINE</i></b> table might look like:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-5XwHtawTatQ/T1ehpFgXH_I/AAAAAAAAA5M/WNrBhuEdNbM/s1600/FAQ36.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="93" src="http://2.bp.blogspot.com/-5XwHtawTatQ/T1ehpFgXH_I/AAAAAAAAA5M/WNrBhuEdNbM/s320/FAQ36.4.png" width="320" /></a></div>
<u><i>PL/SQL support</i></u><br />
<br />
Historical audit trail information is created by calling two separate PL/SQL procedures called <b><i>AUDIT_TABLE</i></b> and <b><i>AUDIT_DETAILS</i></b>. These procedures have been implemented as part of the <b><i>AUDIT_PKG</i></b> in the database. <b><i>AUDIT_TABLE</i></b> is called to create the corresponding <i>_HISTORY (<b>REGIONS_HISTORY</b></i>, <b><i>COUNTRIES_HISTORY</i></b>) table row while <b><i>AUDIT_DETAILS</i></b> is called to create the <b><i>HISTORY</i></b> and <b><i>HISTORY_LINE</i></b> rows. This is what the <b><i>AUDIT_TABLE</i></b> procedure looks like:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-AfLxe4nzDzc/T1gWuLykpNI/AAAAAAAAA58/JqCA77pGOow/s1600/FAQ36.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="164" src="http://4.bp.blogspot.com/-AfLxe4nzDzc/T1gWuLykpNI/AAAAAAAAA58/JqCA77pGOow/s320/FAQ36.5.png" width="320" /></a></div>
<br />
The code uses dynamic SQL to call the specific table audit procedures. The <b><i>AUDIT_PKG</i></b> package declares an array called <b><i>tables_to_audit</i></b> which defines the specific tables to audit. If the table is to be audited it must be added to this array. Here is its declaration for this example:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-DjtjXiYtKOM/T1ekfkseTUI/AAAAAAAAA5c/pByQoM8M9ak/s1600/FAQ36.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="13" src="http://1.bp.blogspot.com/-DjtjXiYtKOM/T1ekfkseTUI/AAAAAAAAA5c/pByQoM8M9ak/s320/FAQ36.6.png" width="320" /></a></div>
Part of this implementation requires that you provide the specific table audit procedures. These procedures are called dynamically by <b><i>AUDIT_TABLE</i></b> as mentioned above. The specific audit procedures must conform to the following naming format: <i>AUDIT_table_name</i>, where <i>table_name</i> is the table being audited. For the <b><i>REGIONS</i></b> table for instance, the procedure should be called <b><i>AUDIT_REGIONS</i></b>. Here is an example implementation of <b><i>AUDIT_REGIONS</i></b>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-z8EvD3GuH4c/T1eli_tT1rI/AAAAAAAAA5k/tn4TbwEP4SE/s1600/FAQ36.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="100" src="http://4.bp.blogspot.com/-z8EvD3GuH4c/T1eli_tT1rI/AAAAAAAAA5k/tn4TbwEP4SE/s320/FAQ36.7.png" width="320" /></a></div>
The <b><i>AUDIT_PKG.AUDIT_TABLE</i></b> procedure will be called from the ADFBC layer to create an audit record for the specific table. The procedure is expecting the current session identifier, a commit identifier, the audit operation (<i>INSERT</i>, <i>UPDATE</i>, <i>DELETE</i>), the table name being audited and the table's primary key. Since the table's primary key is specified as a <i>VARCHAR2 </i>type, it will need to converted to this type if it is of different type. In this case also note the limitation of creating an audit trail for a table that uses a composite primary key. We will seen in part 2 of this post how this is done.<br />
<br />
As mentioned earlier, the <b><i>AUDIT_DETAILS</i></b> procedure creates or locates the <b><i>HISTORY</i></b> record for the specific user session and uses dynamic SQL to create the individual <b><i>HISTORY_LINE</i></b> rows. It is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-m0f_raqMxrw/T1eml2yQJeI/AAAAAAAAA5s/ZTblrTzpGrY/s1600/FAQ36.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="http://2.bp.blogspot.com/-m0f_raqMxrw/T1eml2yQJeI/AAAAAAAAA5s/ZTblrTzpGrY/s320/FAQ36.8.png" width="320" /></a></div>
<br />
In this case you will also need to implement the specific audit details procedures to generate the <b><i>HISTORY_LINE</i></b> rows for the columns that were affected for each specific table. These procedures must conform to the following naming format since they are dynamically called: <i>AUDIT_table_name_DETAILS</i>, where <i>table_name</i> is the table being audited. Here is an example implementation of the <b><i>AUDIT_REGIONS_DETAILS</i></b>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-R-L3WGU4gwg/T1esOAn8rXI/AAAAAAAAA50/7CKp2ZSq40U/s1600/FAQ36.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://4.bp.blogspot.com/-R-L3WGU4gwg/T1esOAn8rXI/AAAAAAAAA50/7CKp2ZSq40U/s320/FAQ36.9.png" width="320" /></a></div>
These procedures determine the differences between the original table (i.e. <b><i>REGIONS</i></b>) and the <i>_HISTORY</i> table (i.e. <b><i>REGIONS_HISTORY</i></b>) that have occurred for the specific commit session and produce the data in the <b><i>HISTORY_LINE</i></b> table.<br />
<br />
The <b><i>AUDIT_PKG.AUDIT_DETAILS</i></b> procedure will be called from the ADFBC layer specifying the user's session identifier, the commit identifier and the user name. We will see this in the second part of this post.<br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
We will conclude in the next part where we will see how to hook up this implementation to the ADFBC framework. We will do this in a generic way that will require minimal changes only to framework extension classes.<br />
<br />
Until then, enjoy JDeveloping!</div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com3tag:blogger.com,1999:blog-8484416608670642843.post-73632502881026650572011-06-07T14:23:00.000-07:002011-06-08T02:12:49.814-07:00FAQ #35 - How to set default values for View object row attributes<div dir="ltr" style="text-align: left;" trbidi="on"><b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
In this post we will see how to set default values to View object attributes. There are a number of places where you can do this:<br />
<br />
<ul style="text-align: left;"><li>In the overridden View object row <b><i>create()</i></b> method</li>
<li>Declaratively using a Groovy expression</li>
<li>In the attribute getter method</li>
</ul><br />
To demonstrate each case, consider the use case of setting the employee’s hire date to the current date for a newly created View object row.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<i><u>Setting default attribute values in the overriden ViewImpl <b>create()</b></u></i><br />
<br />
To set the default value for a View object attribute in the overridden <b><i>create()</i></b> method, follow these steps:<br />
<br />
<ul style="text-align: left;"><li>Create a View Row custom Java implementation class for the <b><i>Employees </i></b>View object.</li>
<li>Open the <b><i>EmployeesRowImpl.java</i></b> custom View Row Java implementation class and override the <b><i>create()</i></b> method using the <b><i>Override Methods…</i></b> button – the green left arrow on the editor toolbar.</li>
<li>To set the default employee’s hire date to today’s date, add the following code to <b><i>create()</i></b> immediately after the call to <b><i>super.create()</i></b>:</li>
</ul><i> // set the default hire date to today</i><br />
<i> this.setHireDate((Date)Date.getCurrentDate());</i><br />
<br />
<i><u>Setting default attribute values with a Groovy expression</u></i><br />
<br />
To set the attribute default value using a Groovy expression, follow these steps:<br />
<ul style="text-align: left;"><li>Open the Employees View object definition and go to the <b><i>Attributes </i></b>page.</li>
<li>Select the attribute that you want to initialize – <i>HireDate</i> in this case, and click on the <b><i>Edit selected attribute(s)</i></b> button (the pen icon).</li>
<li>On the <b><i>Edit Attribute</i></b> dialog select the <b><i>View Attribute</i></b> node.</li>
<li>Select <b><i>Expression</i></b> for the <b><i>Value Type</i></b> radio button in the <b><i>Attribute</i></b> section.</li>
<li>Enter the following Groovy expression in the <b><i>Value</i></b> field: <b><i>adf.currentDate</i></b></li>
</ul><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-3k2ngHGUJYg/Te6THPXRCwI/AAAAAAAAA4U/NmmCuCnq9Vo/s1600/FAQ35.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://2.bp.blogspot.com/-3k2ngHGUJYg/Te6THPXRCwI/AAAAAAAAA4U/NmmCuCnq9Vo/s320/FAQ35.1.png" width="320" /></a></div><br />
<br />
<u><i>Returning a default value from the attribute getter</i></u><br />
<br />
Another way to set a default value for a View object attribute is in the attribute getter method. Follow these steps to set the default employee hire date:<br />
<br />
<ul style="text-align: left;"><li>Locate the View object attribute getter in the View object custom row implementation class. In this example is the <i><b>getHireDate()</b></i> method in <i><b>EmployeesRowImpl.java</b></i>.</li>
<li>Replace the existing code in <i><b>getHireDate()</b></i> with the following:</li>
</ul><br />
<i> // get the HireDate attribute value</i><br />
<i> Date hireDate = (Date)getAttributeInternal(HIREDATE);</i><br />
<i> // check for null and return today's date if needed</i><br />
<i> return (hireDate == null) ? (Date)Date.getCurrentDate() : hireDate;</i><br />
<br />
Note that using this technique we don’t actually set the attribute value; rather we return a default value, which can be subsequently applied to the attribute. Also notice that this is done only if the attribute does not already have a value (the check for <b><i>null</i></b>).<br />
<br />
Actually setting an attribute value in a getter is not a recommended practice.<br />
<br />
<i><u>Attribute dependency</u></i><br />
<br />
A common use case related to this topic is setting an attribute’s value based on the value of another related attribute. Consider for instance the use case where the employee’s commission should be set to a certain default value if the employee is part of the Sales department. Also consider the case where the employee’s commission should be cleared if the employee is not part of the Sales department. In addition to accomplishing this task with Groovy as stated earlier, it can also be implemented in the employee’s <b><i>DepartmentId </i></b>setter, i.e. in the <i><b>setDepartmentId()</b></i> method as it is shown below:<br />
<br />
<i> public void setDepartmentId(Number value) {</i><br />
<i> // set the department identifier</i><br />
<i> setAttributeInternal(DEPARTMENTID, value);</i><br />
<i> // set employee's commission based on employee's department</i><br />
<i> try {</i><br />
<i> // check for Sales department</i><br />
<i> if (value != null && SALES_DEPARTMENT_ID == value.intValue()) {</i><br />
<i> // if the commission has not been set yet</i><br />
<i> if (this.getCommissionPct() == null) {</i><br />
<i> // set commission to default</i><br />
<i> this.setCommissionPct(new Number(DEFAULT_COMMISSION));</i><br />
<i> }</i><br />
<i> } else {</i><br />
<i> // clear commission for non Sales department</i><br />
<i> this.setCommissionPct(null);</i><br />
<i> }</i><br />
<i> } catch (SQLException e) {</i><br />
<i> // log the exception</i><br />
<i> LOGGER.severe(e);</i><br />
<i> }</i><br />
<i> }</i><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
As you can see, there are a number of different ways for initializing your View object row attributes. Which one you choose depends on the specific use case at hand. It is common on large projects that a combination of all (and more) is used. Setting a standard approach could be appropriate in this case.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
</div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com1tag:blogger.com,1999:blog-8484416608670642843.post-28043898692119159452011-05-09T07:41:00.000-07:002011-05-26T06:10:04.151-07:00FAQ #34 - How to utilize WebLogic Work Managers for long-running ADF processes, Pt. 1<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: large;"><b>Introduction</b></span><br />
<br />
The WebLogic <i>Work Manager</i> functionality along with its supporting Java API - <i>CommonJ</i>, can greatly improve performance for those long running processes in your ADF applications, especially for those notorious ones - you know, the one that cause "stuck" threads? This is true because these long running processes can now run asynchronously on a specific Work Manager that you define, one that is configured to ignore "stuck" threads. Let's take a look.<br />
<br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
<u><i>Adding and configuring a Work Manager in WebLogic</i></u><br />
<br />
You define a <i>Work Manager</i> in WebLogic by selecting <b><i>Work Managers</i></b> under the <b><i>Environment </i></b>node in the <b><i>Domain Structure</i></b> window and clicking <b><i>New</i></b> on the <b><i>Summary of Work Managers</i></b> page on the right on the <b><i>Global Work Managers, Request Classes and Constraints</i></b> table.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-gO1UayGenVg/Tcfqm5j0g0I/AAAAAAAAA30/CvvyHBcA96M/s1600/FAQ.34.1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="http://2.bp.blogspot.com/-gO1UayGenVg/Tcfqm5j0g0I/AAAAAAAAA30/CvvyHBcA96M/s320/FAQ.34.1.PNG" width="320" /></a></div><br />
On the <b><i>Select Work Manager Definition type</i></b> page select <b><i>Work Manager</i></b> and click <b><i>Next</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-61xEgL1kKYY/TcfsWFa2lHI/AAAAAAAAA34/FatvLPLFo-0/s1600/FAQ.34.2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="http://1.bp.blogspot.com/-61xEgL1kKYY/TcfsWFa2lHI/AAAAAAAAA34/FatvLPLFo-0/s320/FAQ.34.2.PNG" width="320" /></a></div><br />
On the <b><i>Work Manager Properties</i></b> page enter the name of the <i>Work Manager</i> and press <b><i>Next</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-9AQRWvCyW-8/Tcfu-3e2WmI/AAAAAAAAA38/b1MMzWK_UPY/s1600/FAQ.34.3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="http://1.bp.blogspot.com/-9AQRWvCyW-8/Tcfu-3e2WmI/AAAAAAAAA38/b1MMzWK_UPY/s320/FAQ.34.3.PNG" width="320" /></a></div><br />
On the <i><b>Select deployment targets</b></i> page select the <i>Work Manager</i> targets and click <b><i>Finish</i></b> to complete the creation of the <i>Work Manager</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/-UWQ6LnSzPUY/TcfvzbXzeZI/AAAAAAAAA4A/_rzTpB3POa8/s1600/FAQ.34.4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="http://4.bp.blogspot.com/-UWQ6LnSzPUY/TcfvzbXzeZI/AAAAAAAAA4A/_rzTpB3POa8/s320/FAQ.34.4.PNG" width="320" /></a></div><br />
The <i>Work Manager</i> will now appear in the <b><i>Summary of Work Managers</i></b> table. Click on it to bring up the <b><i>Configuration </i></b>page. In it select <b><i>Ignore Stuck Threads</i></b> and click <b><i>Save</i></b>. This will configure the <i>Work Manager</i> to ignore "stuck" threads for long running processes. We won't be changing the other configuration settings for this <i>Work Manager</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-n3hg5jNKuN4/Tcfw1ZGT2bI/AAAAAAAAA4E/bRpjggmTmU4/s1600/FAQ.34.5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="235" src="http://3.bp.blogspot.com/-n3hg5jNKuN4/Tcfw1ZGT2bI/AAAAAAAAA4E/bRpjggmTmU4/s320/FAQ.34.5.PNG" width="320" /></a></div><br />
<br />
<u><i>Configuring the Work Manager for your application</i></u><br />
<br />
To configure the <i>Work Manager</i> for your application, edit the <b><i>web.xml</i></b> file and enter the following resource reference:<br />
<br />
<i> <resource-ref><br />
<res-ref-name>wm/TestWorkManager</res-ref-name><br />
<res-type>commonj.work.WorkManager</res-type><br />
<res-auth>Container</res-auth><br />
<res-sharing-scope>Shareable</res-sharing-scope><br />
</resource-ref><br />
</i><br />
<br />
This is necessary so that you will be able to access the <i>Work Manager</i> programmatically as it shown below.<br />
<br />
<u><i>Programmatically submitting works to the Work Manager</i></u><br />
<br />
<br />
Here is an example of a long running process in an ADF application and a good candidate to produce a "stuck" thread:<br />
<br />
<i> public void selectAll() {<br />
RowSetIterator iterator = getMyViewObject().createRowSetIterator(null);<br />
<br />
iterator.reset();<br />
<br />
// loop over 1,000,000 records...<br />
while (iterator.hasNext()) {<br />
MyViewObject myViewObject = (MyViewObject)iterator.next();<br />
myViewObject.setProcessed(true);<br />
}<br />
iterator.closeRowSetIterator();<br />
}</i><br />
<br />
This is a method in the <i>Application Module</i> that loops over a large number of records - possibly millions - in order to set some boolean flag. Below we will re-write the code using the <i>Work Manager</i> Java API <i>CommonJ</i>.<br />
<br />
First you will need to add support for the <i>CommonJ</i> API in your ADF application. The <i>CommonJ </i>API is located in the <b><i>weblogic.jar</i></b> library, so use the <b><i>Libraries and Classpath</i></b> option in the <b><i>Project Properties</i></b> and add it. The library can be found in the <b><i>wlserver_10.3/server/lib</i></b> directory in your WebLogic installation directory.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-2YLHGW0FIuI/Tcf26pSLRGI/AAAAAAAAA4I/YxXJFmwRpAE/s1600/FAQ.34.6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="214" src="http://1.bp.blogspot.com/-2YLHGW0FIuI/Tcf26pSLRGI/AAAAAAAAA4I/YxXJFmwRpAE/s320/FAQ.34.6.PNG" width="320" /></a></div><br />
Now modify the method above to the following:<br />
<br />
<i> public void selectAll() {<br />
try {<br />
<b>//get Work Manager from local JNDI</b><br />
InitialContext ctx = new InitialContext();<br />
WorkManager workManager = (WorkManager)ctx.lookup("java:comp/env/wm/TestWorkManager");<br />
<b>//create instance of Work and WorkListener implementations</b><br />
Work work = new SelectAllWorkImpl(getMyViewObject().createRowSetIterator(null));<br />
WorkListener workListener=new SelectAllWorkListener();<br />
<b>//create work item for execution</b><br />
WorkItem workItem = workManager.schedule(work, workListener);<br />
<b>//create list of WorkItems that we want to execute</b><br />
List workItemList=new ArrayList();<br />
workItemList.add(workItem);<br />
<b>//run the work items in parallel; don't wait</b><br />
workManager.waitForAll(workItemList, WorkManager.IMMEDIATE);<br />
<b>//check results; use only if you are blocking</b><br />
//SelectAllWorkImpl workImpl= (SelectAllWorkImpl)workItem.getResult();<br />
} catch (NamingException e) {<br />
} catch (WorkException e) {<br />
} catch (InterruptedException e) {<br />
}<br />
}</i><br />
<br />
<br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
In this first installment of discovering Work Managers in WebLogic, we've seen how to create one and how to configure it and use it in your application. We will wrap up this topic on the next installment. There we will explain the code above and provide the implementations of <b><i>Work</i></b> and <b><i>WorkListener</i></b> interfaces. This is indeed a promising feature that should help in certain cases where long running processes can cause "stuck" threads.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/03/faq-33-how-to-configure-adf-diagnostics.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaqindex.blogspot.com/"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table><br />
<br />
</div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com5tag:blogger.com,1999:blog-8484416608670642843.post-46464300432726192222011-03-22T06:58:00.000-07:002011-05-09T07:43:46.273-07:00FAQ #33 - How to configure ADF diagnostics logging in WLS, Pt. 3<div dir="ltr" style="text-align: left;" trbidi="on"><span style="font-size: large;"><b>Introduction</b></span><br />
<br />
In this third installment of posts related to the configuration of ADF diagnostics logging we will focus on the following topics: 1) how logs could be added programmatically to the diagnostics log, 2) how new Loggers could be added and configured to the diagnostics logging configuration and 3) how to dynamically configure the WebLogic diagnostics logging. This includes changing the logging levels for the configured loggers at run-time without the need to restart the server.<br />
<br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
For some background information regarding diagnostics logging as it relates to ADF, JDeveloper and WebLogic refer to these earlier posts: <a href="http://jdeveloperfaq.blogspot.com/2009/12/faq-6-how-to-fine-tune-adf-diagnostics.html">FAQ #6 - How to fine tune ADF diagnostics logging in JDeveloper 11g R1 </a>, <a href="http://jdeveloperfaq.blogspot.com/2009/12/faq-7-how-to-configure-adf-diagnostics.html">FAQ #7 - How to configure ADF diagnostics logging in standalone WLS using JDeveloper 11g R1</a> and <a href="http://jdeveloperfaq.blogspot.com/2010/01/faq-8-how-to-perform-log-analysis-using.html">FAQ #8 - How to perform log analysis using the Diagnostic Log Analyzer in JDeveloper 11g </a>. The main advantages of using <i>Oracle Diagnostics Logging (ODL)</i> when compared to other logging frameworks is its tight integration with WebLogic and JDeveloper. In WebLogic, the logs produced conform to and integrate with the diagnostics logging facility. Diagnostic logs include in addition to the message logged additional information such as the session and user that produced the log entry at run-time. This is essential when analyzing the logs. In JDeveloper the log configuration and analysis is integrated via the <i>Oracle Diagnostics Logging Configuration</i> and <i>Oracle Diagnostics Log Analyzer</i> respectively. Both are discussed in detail in the above referenced posts.<br />
<br />
<i><u>Programmatic Usage</u></i><br />
<br />
Diagnostic logs can be generated programmatically from within your code by using the <b><i>ADFLogger </i></b>class. You simply instantiate an <i><b>ADFLogger </b></i>via the static <i><b>createADFLogger()</b></i> method and use its<i><b> log()</b></i> method. <i><b>log()</b></i> accepts a <i>java.util.logging.Level</i> parameter indicating the log level of the message that you are logging and it can be any of the <i><b>ADFLogger.INTERNAL_ERROR</b></i>, <i><b>ADFLogger.ERROR</b></i>, <i><b>ADFLogger.WARNING</b></i>, <i><b>ADFLogger.NOTIFICATION</b></i> and <i><b>ADFLogger.TRACE</b></i>. You can also use the <i><b>severe()</b></i>, <i><b>warning()</b></i>, <i><b>info()</b></i>, <i><b>config()</b></i>, <i><b>fine()</b></i>, <i><b>finer()</b></i> and <i><b>finest()</b></i> methods to do your logging. Here is an example:<br />
<br />
<i>// create the ADFLogger</i><br />
<i>private ADFLogger logger = ADFLogger.createADFLogger("package.class");</i><br />
<i>// log a trace</i><br />
<i>logger.log(ADFLogger.TRACE, "A trace log");</i><br />
<br />
<br />
<i><u>Configuration of Custom Loggers in JDeveloper</u></i><br />
<br />
In the <i>ADFLogger </i>example above, <i><b>"package.class"</b></i> is a custom logger which is associated with the <i>ADFLogger</i>. You will need to configure this custom logger in the diagnostics logging configuration file <i><b>logging.xml</b></i>. Ensure that you load the appropriate<i><b> logging.xml</b></i> file for the WebLogic server you are configuring. The file can be found in the domain <b><i>config\fmwconfig\servers</i></b> directory for each server. So, open the appropriate <i><b>logging.xml</b></i> configuration file in JDeveloper and create a custom logger called <i><b>"package.class"</b></i> by clicking on the <b><i>Add Logger</i></b> icon as it shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-TxvmhTuG6Cg/TYie1TGZiLI/AAAAAAAAA3Y/_OuntJn-l78/s1600/FAQ.33.1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://lh3.googleusercontent.com/-TxvmhTuG6Cg/TYie1TGZiLI/AAAAAAAAA3Y/_OuntJn-l78/s320/FAQ.33.1.PNG" width="320" /></a></div>In the <i><b>Add Persistent Logger</b></i> dialog that is presented add the logger class specified above in the <i>ADFLogger </i>(i.e. package.class), set its logging level and click <i><b>OK</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-2L9_iYf3zwI/TYifkJwGg0I/AAAAAAAAA3c/cOLRAP0cukQ/s1600/FAQ.33.2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="99" src="https://lh3.googleusercontent.com/-2L9_iYf3zwI/TYifkJwGg0I/AAAAAAAAA3c/cOLRAP0cukQ/s320/FAQ.33.2.PNG" width="320" /></a></div><br />
The custom logger will appear in the list of <i>Loggers </i>as it shown below. With its logging level set appropriately, your trace log in the earlier example will show in the diagnostics log.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh6.googleusercontent.com/-IEIyo6AGyTI/TYigIhcbRqI/AAAAAAAAA3g/ysYiIb1icwo/s1600/FAQ.33.3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://lh6.googleusercontent.com/-IEIyo6AGyTI/TYigIhcbRqI/AAAAAAAAA3g/ysYiIb1icwo/s320/FAQ.33.3.PNG" width="320" /></a></div><br />
<br />
<i><u>Dynamic Configuration of Logging in WebLogic</u></i><br />
<br />
Diagnostics logging can be configured dynamically in WebLogic via the <i><b>wlst</b></i> tool. Ensure that you run the <i><b>wlst</b></i> script located in the oracle common directory - <i>%MIDDLEWARE_HOME%\oracle_common\common\bin</i> for a JDeveloper installation - and not the one under the WebLogic server home - <i>%MIDDLEWARE_HOME%\wlserver_10.3\common\bin</i> for the stand-alone WebLogic installed along with JDeveloper. The former provides custom commands for configuring diagnostics logging. First you will need to connect to the admin server via the <b><i>connect()</i></b> command as in <i><b>connect('weblogic','weblogic1','t3://address:7001')</b></i>. To change the logging level for the custom logger class above, use the <i><b>setLogLevel()</b></i> command as in <b><i>setLogLevel(target="ManagedServer1", logger="package.class", level="ERROR")</i></b>. Specify the target WebLogic server with the <b><i>target= </i></b>argument (<i>ManagedServer1 </i>in this example), the logger class with the <b><i>logger=</i></b> argument and the new logging level with the <b><i>level=</i></b> argument. It can be either a Java level or an ODL level. Some valid Java levels are: <b><i>SEVERE</i></b>, <b><i>WARNING</i></b>, <b><i>INFO</i></b>, <b><i>CONFIG</i></b>, <b><i>FINE</i></b>, <b><i>FINER</i></b>, or <b><i>FINEST</i></b>. Valid ODL levels include a message type followed by a colon and a message level. The valid ODL message types are: <b><i>INCIDENT_ERROR</i></b>, <b><i>ERROR</i></b>, <b><i>WARNING</i></b>, <b><i>NOTIFICATION</i></b>, <b><i>TRACE</i></b>, and <b><i>UNKNOWN</i></b>. The message level is represented by an integer value that qualifies the message type. Possible values are from 1 (highest severity) through 32 (lowest severity). Additional commands for dynamic configuration of the diagnostics log will allow you to configure the Log Handler for each logger class, display the currently configured loggers and so on. For more details, check out the documentation references sited below.<br />
<br />
<br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
If you are considering a logging framework for an application to be deployed on WebLogic, I suggest that you take a closer look at the Oracle Diagnostics Logging facility. Its tight integration with JDeveloper (logging configuration and log analysis) and WebLogic (diagnostics log format, dynamic configuration) makes it a comparable choice.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<span style="font-size: large;"><b>References</b></span><br />
<br />
<span style="font-size: x-small;"><a href="http://download.oracle.com/docs/cd/E14571_01/web.1111/e13813/custom_logging.htm#BCGFIBHH">Logging Custom WLST Commands</a></span><br />
<span style="font-size: x-small;"><a href="http://download.oracle.com/docs/cd/E14571_01/core.1111/e10105/getstart.htm#ASADM10692">Using Custom WLST Commands</a></span><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/03/faq-32-how-to-get-started-with-jrockit.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/05/faq-34-using-weblogic-work-managers-to.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table><br />
<br />
</div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0tag:blogger.com,1999:blog-8484416608670642843.post-21610738082536915362011-03-13T12:21:00.000-07:002011-03-22T06:59:00.389-07:00FAQ #32 - How to get started with JRockit Mission Control, Pt. 1<div dir="ltr" style="text-align: left;" trbidi="on"><b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
<i>JRockit Mission Control</i> is a suite of tools that can be used to monitor, profile and manage the JRockit Java virtual machine. Among other, managing the JRockit Virtual Machine includes performing garbage collection on demand and eliminating memory leaks. JRockit is the virtual machine used in a production system by the WebLogic application server.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<u><i>Installation of JRockit Mission Control</i></u><br />
<br />
J<i>Rockit Mission Control</i> must be installed on a client machine through which a target JRockit virtual machine running on a server machine can be monitored, profiled and managed. To download <i>JRockit Mission Control</i>, go to the <a href="http://www.oracle.com/technetwork/middleware/jrockit/downloads/index.html">JRockit Family Download page</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: left;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-Ml7YC6jhPJE/TXzxP9VFBOI/AAAAAAAAA2M/cax40_ecvYg/s1600/FAQ32.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://lh5.googleusercontent.com/-Ml7YC6jhPJE/TXzxP9VFBOI/AAAAAAAAA2M/cax40_ecvYg/s1600/FAQ32.1.png" /></a></div>Accept the license agreement, select the appropriate version for your client operating system and proceed with the download. Once downloaded, start the installation by executing the file downloaded. Follow the installation wizard choosing in most cases the default options presented by the installer.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-ZkY69HkeJUw/TXzypGG4EZI/AAAAAAAAA2Q/w4dDk4BtsQo/s1600/FAQ32.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://lh5.googleusercontent.com/-ZkY69HkeJUw/TXzypGG4EZI/AAAAAAAAA2Q/w4dDk4BtsQo/s320/FAQ32.2.png" width="320" /></a></div><br />
During the installation you will be given the option to install the JRockit JRE in the client machine. Select <b><i>Yes (Install Public JRE)</i></b> and click <b><i>Next </i></b>to proceed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh6.googleusercontent.com/-LuaQ0P0uNfQ/TXzzM1_2PBI/AAAAAAAAA2U/OIEZgd-1g68/s1600/FAQ32.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://lh6.googleusercontent.com/-LuaQ0P0uNfQ/TXzzM1_2PBI/AAAAAAAAA2U/OIEZgd-1g68/s320/FAQ32.3.png" width="320" /></a></div><br />
The installer will proceed with the installation of both the JRockit JRE and the JRockit Mission Control. Verify that the installation was successful and click <b><i>Done</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-yDhnyH8wkf4/TXzzvwaEU3I/AAAAAAAAA2Y/Eb0yTiMeX3U/s1600/FAQ32.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://lh4.googleusercontent.com/-yDhnyH8wkf4/TXzzvwaEU3I/AAAAAAAAA2Y/Eb0yTiMeX3U/s320/FAQ32.4.png" width="320" /></a></div><br />
Once installed, you can start the JRockit Mission Control by running the <b><i>jrmc </i></b>program in the target installation directory. When installed on a Microsoft Windows operating system a shortcut called <b><i>Oracle JRockit Mission Control 4.0.1</i></b> is created under the<b><i> Oracle JRockit JDK R28.1 for Java SE 6 with JRMC 4.0.1 (32-bit)</i></b> group - for the version installed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-KZSz4IGtHj8/TXz0yBNjdhI/AAAAAAAAA2c/gTd-1Go9QCo/s1600/FAQ32.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="https://lh4.googleusercontent.com/-KZSz4IGtHj8/TXz0yBNjdhI/AAAAAAAAA2c/gTd-1Go9QCo/s320/FAQ32.5.png" width="320" /></a></div><br />
Before proceeding with <i>Mission Control</i>, you will have to configure the target JRockit Java virtual machine to allow its management via the Mission Control suite.<br />
<br />
<br />
<u><i>Configuration of target JRockit Java Virtual Machine</i></u><br />
<br />
For the sake of this example, we will configure a WebLogic SOA deployment consisting of one administration server and two managed servers - one for SOA and another for BAM. Similar configuration steps can be taken to configure your own setup. Start by ensuring that your WebLogic is configured to run on the JRockit Java virtual machine. This should be the case in all production environments. To ensure that we are indeed using JRockit, we will manually set the <i><b>JAVA_VENTOR</b></i> parameter to <b><i>Oracle </i></b>in the <i><b>setDomainEnv </b></i>script.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/--zlNa0Jeg3E/TXz74LHKpNI/AAAAAAAAA2g/NgVyRfQY9Ig/s1600/FAQ32.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="35" src="https://lh3.googleusercontent.com/--zlNa0Jeg3E/TXz74LHKpNI/AAAAAAAAA2g/NgVyRfQY9Ig/s320/FAQ32.6.png" width="320" /></a></div><br />
We will also add a parameter called <b><i>ENABLE_MNGMNT_CONSOLE</i></b> in <i><b>setDomainEnv </b></i>to control whether JRockit is started to allow its management.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh3.googleusercontent.com/-kviR4DSidbI/TXz8uKdKV6I/AAAAAAAAA2k/qlHPc2-lB-s/s1600/FAQ32.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="39" src="https://lh3.googleusercontent.com/-kviR4DSidbI/TXz8uKdKV6I/AAAAAAAAA2k/qlHPc2-lB-s/s320/FAQ32.7.png" width="320" /></a></div>Thats all with the <i><b>setDomainEnv </b></i>script. We will proceed by adding a few lines in the <b><i>startWebLogic </i></b>script. Here we will check to see whether the management console is enabled and if it is we will check if the management console startup options are set. If there are none specified, we will specify some defaults. We will see below when configuring the managed servers that the management console start up options can be set in the <i><b>startManagedWebLogic </b></i>script. The lines that we will add to the <i><b>startWebLogic </b></i>script are:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-WTt011JZnvU/TX0IHUv2qqI/AAAAAAAAA2o/lACmPeZ5WDQ/s1600/FAQ32.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="62" src="https://lh5.googleusercontent.com/-WTt011JZnvU/TX0IHUv2qqI/AAAAAAAAA2o/lACmPeZ5WDQ/s320/FAQ32.8.png" width="320" /></a></div><br />
As you can see in the above picture, we are starting the JRockit virtual machine with the <i><b>-Xmanagement</b></i> switch specifying no secure sockets, no authentication and 7091 as the default connection port. Each WebLogic server must be configured to allow<i> Mission Control</i> connections on a separate port.<br />
<br />
We will conclude the configuration changes by adding the following lines to the <b><i>startManagedWebLogic </i></b>script:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh6.googleusercontent.com/-ok4ztTTw1io/TX0Jat8yJLI/AAAAAAAAA2s/4nv-SZ-bRLU/s1600/FAQ32.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="58" src="https://lh6.googleusercontent.com/-ok4ztTTw1io/TX0Jat8yJLI/AAAAAAAAA2s/4nv-SZ-bRLU/s320/FAQ32.9.png" width="320" /></a></div><br />
What we have done here is configure a different JRockit management port for each managed server. In this case we need to make sure that the actual names of the managed servers are correct, so this needs to be adapted for your setup.<br />
<br />
Now we can start the SOA domain. For each server, observe that the management options are set correctly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-7uD7cJMKz00/TX0Lh55wCkI/AAAAAAAAA2w/2YeNZoigeSM/s1600/FAQ32.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="https://lh5.googleusercontent.com/-7uD7cJMKz00/TX0Lh55wCkI/AAAAAAAAA2w/2YeNZoigeSM/s320/FAQ32.10.png" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-dAylScC9ew8/TX0MSML3ETI/AAAAAAAAA20/UZMKGwseZ4M/s1600/FAQ32.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="100" src="https://lh5.googleusercontent.com/-dAylScC9ew8/TX0MSML3ETI/AAAAAAAAA20/UZMKGwseZ4M/s320/FAQ32.11.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-3mnkIazEGrQ/TX0MlXKOz5I/AAAAAAAAA24/DgLEiF6grvI/s1600/FAQ32.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="100" src="https://lh5.googleusercontent.com/-3mnkIazEGrQ/TX0MlXKOz5I/AAAAAAAAA24/DgLEiF6grvI/s320/FAQ32.12.png" width="320" /></a></div><br />
<u><i>Mission Control Connection Setup</i></u><br />
<br />
Now that we have the target JRockit virtual machines configured to allow <i>Mission Control</i> management connections - remember that each WebLogic server runs on its own virtual machine, we can proceed by creating the connections to each virtual machine from within the <i>Mission Control</i> suite. To create a new connection, right-click on the <b><i>Connectors </i></b>node and select <b><i>New Connection</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-ET2u2wvYYgs/TX0Nw8CM5ZI/AAAAAAAAA28/xWEFLMPetrE/s1600/FAQ32.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="276" src="https://lh5.googleusercontent.com/-ET2u2wvYYgs/TX0Nw8CM5ZI/AAAAAAAAA28/xWEFLMPetrE/s320/FAQ32.13.png" width="320" /></a></div><br />
In the<b><i> New Connection</i></b> dialog specify the WebLogic server host name or IP address, the management connection port and the connection name. Click on the <b><i>Test connection</i></b> button to test the connection.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-Fg_4Q4OE1lA/TX0Ouk50BNI/AAAAAAAAA3E/_WqevL88laI/s1600/FAQ32.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="307" src="https://lh4.googleusercontent.com/-Fg_4Q4OE1lA/TX0Ouk50BNI/AAAAAAAAA3E/_WqevL88laI/s320/FAQ32.14.png" width="320" /></a></div><br />
We will create a separate connection for each WebLogic administration and managed server configured for the SOA domain above. After creating all the connections the <i>Mission Control</i> suite should look like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh4.googleusercontent.com/-UalEMFE7GX0/TX0QQu24X7I/AAAAAAAAA3I/nWUNec2MUX0/s1600/FAQ32.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="https://lh4.googleusercontent.com/-UalEMFE7GX0/TX0QQu24X7I/AAAAAAAAA3I/nWUNec2MUX0/s320/FAQ32.15.png" width="320" /></a></div><br />
To start a monitor session for each configured virtual machine, right-click on the appropriate connection and select <b><i>Start Console</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-u0YKclb4P_A/TX0Qt0pcRyI/AAAAAAAAA3M/NCt8rVLUCLI/s1600/FAQ32.16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="274" src="https://lh5.googleusercontent.com/-u0YKclb4P_A/TX0Qt0pcRyI/AAAAAAAAA3M/NCt8rVLUCLI/s320/FAQ32.16.png" width="320" /></a></div><br />
This will open a monitor console as it is shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh6.googleusercontent.com/-DMj2knngGVw/TX0RKupaewI/AAAAAAAAA3Q/hMso6ub_FJI/s1600/FAQ32.17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://lh6.googleusercontent.com/-DMj2knngGVw/TX0RKupaewI/AAAAAAAAA3Q/hMso6ub_FJI/s320/FAQ32.17.png" width="320" /></a></div><br />
Additional monitor consoles can be opened by right-clicking on another connection and selecting <i><b>Start Console</b></i>. Each monitor session will be shown in a separate tab in <i>Mission Control</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://lh5.googleusercontent.com/-Rhbhvl4b-c0/TX0SAgQR7UI/AAAAAAAAA3U/qsOss8o8v2Q/s1600/FAQ32.18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="135" src="https://lh5.googleusercontent.com/-Rhbhvl4b-c0/TX0SAgQR7UI/AAAAAAAAA3U/qsOss8o8v2Q/s320/FAQ32.18.png" width="320" /></a></div><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
This concludes this first part of getting started with the <i>JRockit Mission Control</i>. In the next part we will look at some of the features of the <i>Mission Control</i>.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Code</span></b><br />
<br />
<a href="http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo32.zip">http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo32.zip</a><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/02/faq-31-how-to-create-your-own-in-house.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/03/faq-33-how-to-configure-adf-diagnostics.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table><br />
</div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com3tag:blogger.com,1999:blog-8484416608670642843.post-62777967317714311352011-02-09T06:07:00.000-08:002011-03-13T12:22:23.532-07:00FAQ #31 - How to create your own in-house Update Center in JDeveloper<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
If you ever used the <b><i>Check for Updates...</i></b> feature in JDeveloper, I am sure you've seen the list of available <i>Update Centers</i> from which you can download your JDeveloper extensions. In this post we will go through the process of adding your own <i>Update Center</i> to supply your own extensions in a corporate environment.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
You can access the <i><b>Check for Updates...</b></i> feature in JDeveloper via the <i><b>Help | Check for Updates...</b></i> menu. Once you do so, a list of the available <i>Update Centers</i> is presented as shown in the picture below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TVKSnXUYLbI/AAAAAAAAA1s/dwTeuyYEGlU/s1600/FAQ.31.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TVKSnXUYLbI/AAAAAAAAA1s/dwTeuyYEGlU/s320/FAQ.31.PNG" width="320" /></a></div><br />
It is easy to add your own <i>Update Center</i> by clicking on the <i><b>Add...</b></i> button and supplying the necessary information, i.e. the name of the <i>Update Center</i> and its location.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TVKUWwIufGI/AAAAAAAAA10/uA_-_rGutH0/s1600/FAQ.31.2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="117" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TVKUWwIufGI/AAAAAAAAA10/uA_-_rGutH0/s320/FAQ.31.2.PNG" width="320" /></a></div><br />
The <i>Update Center</i> location is the http address of the <i>Update Center</i> descriptor as in <i>http://192.168.5.134:8080/center.xml</i> in the above example. The <i>Update Center</i> descriptor is an XML file describing the <i>Update Center</i> and the extensions that makes available. Below is an example descriptor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TVKWj0UJ2zI/AAAAAAAAA14/e5RXnFiQ0bU/s1600/FAQ.31.3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="137" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TVKWj0UJ2zI/AAAAAAAAA14/e5RXnFiQ0bU/s320/FAQ.31.3.PNG" width="320" /></a></div>The <b><i>updates </i></b>tag encloses all available extension updates that are made available by the <i>Update Center</i>. Each extension is listed within the <b><i>update </i></b>tag. The information provided in the <b><i>name</i></b>, <b><i>version</i></b>, <b><i>author</i></b>, <b><i>author-url</i></b> and <i style="font-weight: bold;">description</i> tags<i style="font-weight: bold;"> </i>are used by JDeveloper to present the necessary information about the specific extension. The <i><b>bundle-url</b></i> tag points to the location from where the extension can be downloaded. It does not need to reside in the update location necessarily.<br />
<br />
After adding the update center, the <i><b>Check for Updates...</b></i> page will reflect the <i>Update Center</i> added as it is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TVKatz9nZvI/AAAAAAAAA18/NqSuo2Xd6hE/s1600/FAQ.31.4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TVKatz9nZvI/AAAAAAAAA18/NqSuo2Xd6hE/s320/FAQ.31.4.PNG" width="320" /></a></div><br />
Selecting the newly added <i>Update Center</i> and clicking <b><i>Next </i></b>will present a list of the extensions that are made available by the <i>Update Center</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TVKbFRx_vHI/AAAAAAAAA2A/kmWQ0YGTX8A/s1600/FAQ.31.5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TVKbFRx_vHI/AAAAAAAAA2A/kmWQ0YGTX8A/s320/FAQ.31.5.PNG" width="320" /></a></div><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
Adding your own JDeveloper <i>Update Center</i> to supply your own extensions is a pretty straightforward business. Just add it in the <i><b>Check for Updates...</b></i> and provide the appropriate <i>Update Center</i> descriptor to describe the JDeveloper extensions that are made available by the <i>Update Center</i>. Of course you've got to have your <i>Update Center</i> web server up and running and your extensions on-line to start serving the extension download requests ;)<br />
<br />
Until the next time, keep on JDeveloping!</div><br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-30-how-to-setup-weblogic-cluster.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/03/faq-32-how-to-get-started-with-jrockit.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table><br />
</div>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com2tag:blogger.com,1999:blog-8484416608670642843.post-80938495582880559522010-11-23T12:46:00.000-08:002011-02-09T06:08:16.447-08:00FAQ #30 - How to setup a WebLogic cluster load balancer using Apache and the Apache HTTP Server Plug-In<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
Load balancing refers to obtaining high availability and better performance by dispatching incoming user requests to different servers on a clustered setup. A load balancer can be anything from a simple servlet or plug-in, to expensive hardware. In this FAQ we will take a look at the <i>Apache HTTP Server Plug-In</i> and how it can be configured to proxy requests to the WebLogic cluster that we setup in <a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-27-how-to-setup-weblogic-cluster-pt.html">FAQ #27</a> and <a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-28-how-to-setup-weblogic-cluster-pt.html">FAQ #28</a>.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
"<i>The Apache HTTP Server Plug-In allows requests to be proxied from an Apache HTTP Server to WebLogic Server. The plug-in enhances an Apache installation by allowing WebLogic Server to handle requests that require the dynamic functionality of WebLogic Server.</i><br />
<i><br />
</i><br />
<i>The plug-in is intended for use in an environment where an Apache Server serves static pages, and another part of the document tree (dynamic pages best generated by HTTP Servlets or JavaServer Pages) is delegated to WebLogic Server, which may be operating in a different process, possibly on a different host. To the end user—the browser—the HTTP requests delegated to WebLogic Server still appear to be coming from the same source.</i><br />
<i><br />
</i><br />
<i>The Apache HTTP Server Plug-In operates as an Apache module within an Apache HTTP Server. An Apache module is loaded by Apache Server at startup, and then certain HTTP requests are delegated to it. Apache modules are similar to HTTP servlets, except that an Apache module is written in code native to the platform.</i>"<br />
<br />
In this example we will be installing the <i>Apache HTTP Server</i> on a separate Linux box. If you have followed the two previous FAQs (FAQ #27 and FAQ #28), we have setup a WebLogic cluster comprised of two <i>Managed Servers</i> running on two separate Linux machines.<br />
<div><br />
</div>Briefly the steps involved are:<br />
<br />
1. Install the <i>Apache HTTP Server</i><br />
2. Install and configure the <i>Apache HTTP Server Plug-In</i><br />
3. Verify the load balancer<br />
<br />
So, let's get started.<br />
<br />
<i><u>1. Install the Apache HTTP Server</u></i><br />
<br />
We will be installing <i>Apache</i> on an <i>openSUSE</i> Linux distribution. Start by opening a terminal window and as <i>root</i> install Apache by typing: <i><b>yast2 --install apache2</b></i>. This will initiate <i>YaST2</i> to download and install <i>Apache</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNXDXd_10_I/AAAAAAAAAzw/v2T0HGAG6UI/s1600/FAQ29.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="203" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNXDXd_10_I/AAAAAAAAAzw/v2T0HGAG6UI/s320/FAQ29.1.png" width="320" /></a></div><br />
Verify that the installation is successful by typing <i><b>rcapache2 status</b><span class="Apple-style-span" style="font-style: normal;"> in the terminal window. It should respond with status </span>unused<span class="Apple-style-span" style="font-style: normal;">.</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNXENTKgIOI/AAAAAAAAAz0/VL6z3LixHtQ/s1600/FAQ29.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="194" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNXENTKgIOI/AAAAAAAAAz0/VL6z3LixHtQ/s320/FAQ29.2.png" width="320" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
To test the installation we will need to create an <i>index.html</i> file in <i>/srv/www/htdocs</i> and start Apache by typing <i><b>rcapache2 start</b></i>. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNXI3litgGI/AAAAAAAAAz4/N9Ye8tM8e1k/s1600/FAQ29.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="194" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNXI3litgGI/AAAAAAAAAz4/N9Ye8tM8e1k/s320/FAQ29.3.png" width="320" /></a></div><br />
Finally open a browser window and verify that the server is accessible.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNXK722GmQI/AAAAAAAAAz8/CP-CpxiYhc0/s1600/FAQ29.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="195" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNXK722GmQI/AAAAAAAAAz8/CP-CpxiYhc0/s320/FAQ29.4.png" width="320" /></a></div><br />
For administration purposes it is recommended that you create an Apache administrator user account and give it ownership of the <i>/srv/www</i>, <i>/srv/ftp</i> and <i>/etc/apache2</i> directories, the apache startup script <i>/etc/init.d/apache2</i> and the log directory <i>/var/log/apache2</i>. Also add <i>/usr/sbin</i> to the account's path to get access to the <i><b>rcapache2</b></i> start-up link.<br />
<br />
The process of installing Apache is similar for other Linux distributions. For Windows you will have to download the Apache binary installation package from the Apache HTTP Server Project web site - <a href="http://httpd.apache.org/">http://httpd.apache.org/</a> at the time of this writing - and run the installation yourself.<br />
<br />
<br />
<u><i>2. Install and configure the </i></u><i><u>Apache HTTP Server Plug-In</u></i><br />
<br />
To download the Apache HTTP Server Plug-In go to the Oracle WebLogic downloads site - currently <a href="http://www.oracle.com/technetwork/middleware/ias/downloads/wls-main-097127.html">http://www.oracle.com/technetwork/middleware/ias/downloads/wls-main-097127.html</a> - and click <i>Oracle WebLogic Server Web Server Plugins 1.1 All versions</i> under the <i>Additional Fusion Middleware Downloads</i> section. You will have to first click <i>See All</i> under the <i>Oracle WebLogic Server 11g Rel 1 (10.3.3) Installers</i> section to see the <i>Additional Fusion Middleware Downloads</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNZj8McGItI/AAAAAAAAA0A/54QdOkUckDc/s1600/FAQ29.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="183" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNZj8McGItI/AAAAAAAAA0A/54QdOkUckDc/s320/FAQ29.5.png" width="320" /></a></div><br />
This will download a cumulative archive - called <i>WLSPlugin1.1-11gR1PS2.zip</i> - which contains all WebLogic plug-ins. Open the archive and extract the archive appropriate for your Operating System, for this example - a 64-bit Linux distribution - it is called <i>WLSPlugin1.1-64bitApache2.2-linux64-x86_64.zip</i>.<br />
<br />
To install the <i>WebLogic Plug-In</i> first extract the contents of the appropriate zip file - for this example we logged-in using the apache administrator account and extracted the WebLogic Plug-in into the <i>/home/apache/WLSPlugin1.1-64bitApache2.2-linux64-x86_64</i> directory. Then edit the <i>httpd.conf</i> file in <i>/etc/apache2</i> and add the following section:<br />
<br />
<br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"># WebLogic load balancer add-in configuration</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;">LoadModule weblogic_module /home/apache/WLSPlugin1.1-64bitApache2.2-linux64-x86_64/lib/mod_wl.so</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"><ifModule mod_weblogic.c></span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> WebLogicCluster 192.168.1.106:7003,192.168.1.107:7003</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> Debug ON</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> WLLogFile /home/apache/WLSPlugin1.1-64bitApache2.2-linux64-x86_64/log/mod_wl.log</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> WLTempDir /home/apache/WLSPlugin1.1-64bitApache2.2-linux64-x86_64/tmp</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> DebugConfigInfo ON</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> KeepAliveEnabled ON</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> KeepAliveSecs 15</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> DynamicServerList ON</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"></IfModule</span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"><Location /cluster</span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"> SetHandler weblogic-handler</span></span><br />
<span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="font-size: x-small;"></Location</span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">></span><br />
<br />
<br />
Change the cluster IP addresses and ports appropriately for your setup. Also ensure that the log and temporary directories that you specify exist - for this example we have created a <i>log</i> and a <i>tmp</i> directory inside the directory where we originally extracted the plug-in. Lastly, make sure that the plug-in library directory is listed in the <i>LD_LIBRARY_PATH</i> environment variable.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNaGE0MAZCI/AAAAAAAAA0E/3OyPNSxeD8U/s1600/FAQ29.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNaGE0MAZCI/AAAAAAAAA0E/3OyPNSxeD8U/s320/FAQ29.6.png" width="320" /></a></div><br />
Now restart Apache and observe that there are no errors. For complete installation instructions refer to the file <i>README.txt</i> included in the compressed archive.<br />
<i><br />
</i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNaIzBM2ZtI/AAAAAAAAA0I/KZCVQL1rIYo/s1600/FAQ29.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNaIzBM2ZtI/AAAAAAAAA0I/KZCVQL1rIYo/s320/FAQ29.7.png" width="320" /></a></div><i><br />
</i><br />
<i><u>3. Verify the load balancer</u></i><br />
<br />
<i><span class="Apple-style-span" style="font-style: normal;">To verify the load balancer installation you need to send a request to a </span><b>http://apache-host:apache-port/cluster/ <span class="Apple-style-span" style="font-style: normal;"><span class="Apple-style-span" style="font-weight: normal;">URL, </span></span></b><span class="Apple-style-span" style="font-style: normal;">where </span></i><i><span class="Apple-style-span">apache-host</span><span class="Apple-style-span" style="font-style: normal;"> is the host running Apache, </span></i><i><span class="Apple-style-span">apache-port</span><span class="Apple-style-span" style="font-style: normal;"> is the Apache HTTP port, </span></i><i><span class="Apple-style-span">cluster </span><span class="Apple-style-span" style="font-style: normal;">is the <u>configurable</u> context path we specified above with the </span></i><i><b><Location></b><span class="Apple-style-span" style="font-style: normal;"> tag when configuring the plug-in</span></i><i><span class="Apple-style-span" style="font-style: normal;">. Because of the </span><b>/cluster</b><span class="Apple-style-span" style="font-style: normal;"> context in the URL path, Apache will forward the request via the </span><span class="Apple-style-span">WebLogic Plug-In</span><span class="Apple-style-span" style="font-style: normal;"> to the WebLogic cluster. Any requests that do not contain the </span><span class="Apple-style-span">/cluster</span><span class="Apple-style-span" style="font-style: normal;"> context in the URL will be served normally by Apache. </span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"></span></i><i><span class="Apple-style-span" style="font-style: normal;">So, let's start JDeveloper and create a simple ADF application. On the </span><b>Edit WAR Deployment Profile Properties</b><span class="Apple-style-span" style="font-style: normal;"> dialog make sure that </span><b>cluster</b><span class="Apple-style-span" style="font-style: normal;"> is specified as the </span><span class="Apple-style-span">Java EE Web Context Root</span><span class="Apple-style-span" style="font-style: normal;">.</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TOwHlaLrBZI/AAAAAAAAA1I/sNb3O9V1R5k/s1600/FAQ30.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TOwHlaLrBZI/AAAAAAAAA1I/sNb3O9V1R5k/s320/FAQ30.8.png" width="320" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
Ensure that the cluster is up and running, create an <i>Application Server</i> connection to the WebLogic cluster, an application deployment profile and deploy the application on the cluster.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TOwJKmQ0ePI/AAAAAAAAA1M/G6W-yXYAphY/s1600/FAQ30.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TOwJKmQ0ePI/AAAAAAAAA1M/G6W-yXYAphY/s320/FAQ30.9.png" width="320" /></a></div><br />
Observe at the log window that the deployment is successful for all managed server nodes that make up the cluster.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TOwKq_6Q5pI/AAAAAAAAA1Q/1cAPv6gkztk/s1600/FAQ30.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="104" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TOwKq_6Q5pI/AAAAAAAAA1Q/1cAPv6gkztk/s320/FAQ30.10.png" width="320" /></a></div><br />
You can test the load balancer by sending the following request <i><b>http://apache-host:apache-port/cluster/faces/TestLoadBalancer.jspx</b><span class="Apple-style-span" style="font-style: normal;">, for this example the IP address of the Apache server is </span></i>192.168.1.101, so the complete URL is <i>http://192.168.1.101/cluster/faces/TestLoadBalancer.jspx</i>. Apache recognizes the <i>/cluster</i> context path in the URL and forwards the request to WebLogic via the <i>WebLogic Plug-In</i>!<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TOwOifQp9XI/AAAAAAAAA1U/zvUkuaqLZHM/s1600/FAQ30.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="239" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TOwOifQp9XI/AAAAAAAAA1U/zvUkuaqLZHM/s320/FAQ30.11.png" width="320" /></a></div><br />
Any requests that do not contain the <i>/cluster</i> context in the URL are served normally by Apache.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TOwPAtgupWI/AAAAAAAAA1Y/9XkOrRkj1Ks/s1600/FAQ30.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="219" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TOwPAtgupWI/AAAAAAAAA1Y/9XkOrRkj1Ks/s320/FAQ30.12.png" width="320" /></a></div><br />
For the Apache <i>WebLog Plug-In</i> logs refer to the log file defined during the configuration earlier.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TOwS4kVGFII/AAAAAAAAA1c/ZvACkBFXcdM/s1600/FAQ30.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="142" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TOwS4kVGFII/AAAAAAAAA1c/ZvACkBFXcdM/s320/FAQ30.13.png" width="320" /></a></div><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
In this post we 've seen how a software Load Balancer based on Apache and the Apache <i>WebLogic Plug-In</i> could be setup to work along with a cluster setup.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-29-how-to-deploy-adf-runtime.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2011/02/faq-31-how-to-create-your-own-in-house.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0tag:blogger.com,1999:blog-8484416608670642843.post-25618452441559583852010-11-07T10:26:00.000-08:002010-11-23T12:46:44.015-08:00FAQ #29 - How to deploy the ADF runtime libraries to a WebLogic cluster<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
In <a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-27-how-to-setup-weblogic-cluster-pt.html">FAQ #27</a> and <a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-28-how-to-setup-weblogic-cluster-pt.html">FAQ #28</a> we went through a WebLogic cluster setup comprised of two WebLogic Managed Servers running on separate physical machines each. In this FAQ we will take a look at how to extend the clustered domain with the ADF runtime libraries.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
The steps involved for extending a clustered domain are:<br />
<br />
1. Backup the <i>Middleware Home</i> that contains the domain about to be extended<br />
2. Install the <i>ADF Runtime</i><br />
3. Extend the WebLogic domain<br />
4. Verify that the cluster is operating as expected<br />
<br />
Note that <u>steps 1 through 3 must be repeated for each physical machine that is part of the cluster setup</u>.<br />
<br />
Let's follow these steps then to extend the clustered domain that we setup in <a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-27-how-to-setup-weblogic-cluster-pt.html">FAQ #27</a> and <a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-28-how-to-setup-weblogic-cluster-pt.html">FAQ #28</a>.<br />
<br />
<u><i>1. Backup the Middleware Home that contains the domain about to be extended</i></u><br />
<br />
Before backing up the <i>Middleware Home</i> directory ensure that the domain is shutdown and that the node manager is not running on the specific machine. We will use <i><b>tar</b></i> and <i><b>gzip</b></i> to create and compress the <i>Middleware Home</i> archive, so change directory to your Middleware Home and type <b><i>tar </i></b><i><b>cvf hostname.date.middlewarehome.tar middlewareHomeDirectory</b></i>, where <i>hostname.date.middlewarehome.tar<span class="Apple-style-span" style="font-style: normal;"> is the tar file that we will create and </span><b> </b></i><i>middlewareHomeDirectory </i>is the <i>Middleware Home</i> directory to archive, for example: <b><i>tar </i></b><i><b>cvf kvvm0007.20101107.middlewarehome.tar Oracle/</b></i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNba6wsizwI/AAAAAAAAA0M/fuBL_JKjaUo/s1600/FAQ29.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="152" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNba6wsizwI/AAAAAAAAA0M/fuBL_JKjaUo/s320/FAQ29.1.png" width="320" /></a></div><br />
Once tar completes, compress the archive by typing <b><i>gzip </i></b><i><b>hostname.date.middlewarehome.tar</b></i><br />
<i><b><br />
</b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNbctIs-wyI/AAAAAAAAA0Q/pyhbqIY5Ktg/s1600/FAQ29.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="151" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNbctIs-wyI/AAAAAAAAA0Q/pyhbqIY5Ktg/s320/FAQ29.2.png" width="320" /></a></div><i><b><br />
</b></i><br />
<i><span class="Apple-style-span" style="font-style: normal;">Keep the resulting tar.gz file just in case we need to restore the </span>Middleware Home<span class="Apple-style-span" style="font-style: normal;"> to its last configuration. </span></i><br />
<i><b><br />
</b></i><br />
<i><u>2. Install the ADF Runtime</u></i><br />
<br />
The <i>ADF Runtime</i> is distributed - among others - along with the JDeveloper installation package. So we will be using the JDeveloper installation to install it on our domain. Download the appropriate JDeveloper installation package for your operating system and start the JDeveloper installation. For installing on Linux you may refer to <a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-26-how-to-install-jdeveloper-in.html">FAQ #26 - How to Install JDeveloper on Linux</a>. Click <i><b>Next</b></i> on the <i>Welcome</i> screen and on the <i>Choose Middleware Home Directory</i> make sure that you select <i><b>Use an existing Middleware Home</b></i>. Verify that the <i>Middleware Home</i> selected is the one that contains the clustered domain to be extended.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbgT4lgtsI/AAAAAAAAA0U/waJttHBk_Kw/s1600/FAQ29.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbgT4lgtsI/AAAAAAAAA0U/waJttHBk_Kw/s320/FAQ29.3.png" width="320" /></a></div><br />
On the <i>Choose Products and Components</i> page make sure that you select only the <i><b>Application Development Framework Runtime</b></i> - <u>do not</u> select <i>JDeveloper Studio</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbhKT9GG2I/AAAAAAAAA0Y/y3PK9TN2ufg/s1600/FAQ29.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbhKT9GG2I/AAAAAAAAA0Y/y3PK9TN2ufg/s320/FAQ29.4.png" width="320" /></a></div><br />
Click <i><b>Next</b></i> on the <i>JDK Selection</i> page. Verify that you have selected the correct <i>Middleware Home</i> on the <i>Confirm Product Installation Directories</i> page and click <i><b>Next.</b><span class="Apple-style-span" style="font-style: normal;"> On the </span>Installation Summary<span class="Apple-style-span" style="font-style: normal;"> page click </span><b>Next</b><span class="Apple-style-span" style="font-style: normal;"> </span></i>to proceed with the installation. Ensure that only the <i>Application Development Framework Runtime</i> is included on the products to be installed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNbiSQIloGI/AAAAAAAAA0c/kubpDAU-CWI/s1600/FAQ29.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNbiSQIloGI/AAAAAAAAA0c/kubpDAU-CWI/s320/FAQ29.5.png" width="320" /></a></div><br />
The installation should proceed with no problems and complete. Uncheck the <i>Run Quickstart</i> and click <i><b>Done</b></i> to finish.<br />
<i><b><br />
</b></i><br />
<i><b><span class="Apple-style-span" style="font-weight: normal;"><u>3. Extend the WebLogic domain</u></span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">To extend the domain with the ADF libraries installed run the configuration script called </span>config<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> in </span><span class="Apple-style-span" style="font-weight: normal;">wlserver_10.3/common/bin</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> under the </span><span class="Apple-style-span" style="font-weight: normal;">Middleware Home</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">On the </span><span class="Apple-style-span" style="font-weight: normal;">Welcome</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> screen choose </span>Extend an existing WebLogic domain<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and click </span>Next<span class="Apple-style-span" style="font-style: normal; font-weight: normal;">. On the </span><span class="Apple-style-span" style="font-weight: normal;">Select a WebLogic Domain Directory</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> select the appropriate domain for the cluster and click </span>Next<span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbkngFgIGI/AAAAAAAAA0g/MRnUV-bLmoI/s1600/FAQ29.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbkngFgIGI/AAAAAAAAA0g/MRnUV-bLmoI/s320/FAQ29.6.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">On the </span><span class="Apple-style-span" style="font-weight: normal;">Select Extension Source</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> page select </span>Oracle JRF - 11.1.1.0 [oracle_common]<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and click </span>Next<span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNblPGQqnWI/AAAAAAAAA0k/eHf8Zu1i3io/s1600/FAQ29.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNblPGQqnWI/AAAAAAAAA0k/eHf8Zu1i3io/s320/FAQ29.7.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">On the </span><span class="Apple-style-span" style="font-weight: normal;">Select Optional Configuration</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> select </span>Deployments and Services<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and click </span>Next<span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbmOVf3O4I/AAAAAAAAA0o/aCbCJ-fiZD4/s1600/FAQ29.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbmOVf3O4I/AAAAAAAAA0o/aCbCJ-fiZD4/s320/FAQ29.8.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">On the </span><span class="Apple-style-span" style="font-weight: normal;">Target Deployments to Clusters or Servers</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> ensure that <u>all</u> </span><span class="Apple-style-span" style="font-weight: normal;">Libraries</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> are targeted to <u><b>both</b></u> the </span><span class="Apple-style-span" style="font-weight: normal;">Administration Server</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and the </span><span class="Apple-style-span" style="font-weight: normal;">Cluster</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> while the </span><span class="Apple-style-span" style="font-weight: normal;">Applications</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> are targeted <u><b>only</b></u> to the </span><span class="Apple-style-span" style="font-weight: normal;">Administration Server</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">. The page should look like the one below:</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNbnnrKvD3I/AAAAAAAAA0s/6Kan-zM2XYs/s1600/FAQ29.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNbnnrKvD3I/AAAAAAAAA0s/6Kan-zM2XYs/s320/FAQ29.9.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">On the </span><span class="Apple-style-span" style="font-weight: normal;">Target Services to Clusters or Servers</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> make sure that all services are targeted to <u><b>both</b></u> the cluster and the </span><span class="Apple-style-span" style="font-weight: normal;">Administration Server</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNboNe549WI/AAAAAAAAA0w/N1aoUdb5yH4/s1600/FAQ29.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNboNe549WI/AAAAAAAAA0w/N1aoUdb5yH4/s320/FAQ29.10.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">On the </span><span class="Apple-style-span" style="font-weight: normal;">Configuration Summary</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> page verify your selections and press </span>Extend<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> to extend the domain. The domain should be extended without any errors reported.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbpB_8PzgI/AAAAAAAAA00/9QWWMzRkd00/s1600/FAQ29.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNbpB_8PzgI/AAAAAAAAA00/9QWWMzRkd00/s320/FAQ29.11.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">This concludes the process of extending the domain with ADF runtime. Remember that you will have to repeat the steps above for <u><b>all</b></u> the machines in the cluster.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-weight: normal;"><u>4. Verify that the cluster is operating as expected</u></span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">This step should be performed once you gone through steps 1 through 3 above for all the machines on the cluster. Start the domain </span><span class="Apple-style-span" style="font-weight: normal;">Administration Server</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and the node managers for all machines and log in into the </span><span class="Apple-style-span" style="font-weight: normal;">Administration Console</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">. Using the </span><span class="Apple-style-span" style="font-weight: normal;">Domain Structure</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> tree click on </span>Deployments<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and on the </span><span class="Apple-style-span" style="font-weight: normal;">Summary of Deployments</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> page verify that all the ADF libraries are on </span><span class="Apple-style-span" style="font-weight: normal;">Active State</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNbr6upaocI/AAAAAAAAA04/Hyt6VldTKr0/s1600/FAQ29.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="316" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNbr6upaocI/AAAAAAAAA04/Hyt6VldTKr0/s320/FAQ29.12.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">This being the case, you can now proceed to start the </span><span class="Apple-style-span" style="font-weight: normal;">Managed Servers</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">. Click on </span>Environment<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> and then on </span>Servers<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> on the </span><span class="Apple-style-span" style="font-weight: normal;">Domain Structure</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> tree and on the </span><span class="Apple-style-span" style="font-weight: normal;">Summary of Servers</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> click on the </span>Control<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> tab. In the servers table select all the </span><span class="Apple-style-span" style="font-weight: normal;">Managed Servers</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> that comprise the cluster and click on the </span>Start<span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> button to start them. Once started all servers should be in </span><span class="Apple-style-span" style="font-weight: normal;">RUNNING State</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">. The </span><span class="Apple-style-span" style="font-weight: normal;">Health</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"> of the server should be indicated as </span><span class="Apple-style-span" style="font-weight: normal;">OK</span><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNbtbHtz-GI/AAAAAAAAA08/99VsfW-YqzA/s1600/FAQ29.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="299" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNbtbHtz-GI/AAAAAAAAA08/99VsfW-YqzA/s320/FAQ29.13.png" width="320" /></a></div><i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;">This concludes the installation of the ADF runtime to the cluster.</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<i><b><span class="Apple-style-span" style="font-style: normal; font-weight: normal;"><br />
</span></b></i><br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
Installing the ADF runtime on a clustered WebLogic domain involves the extension of the domain on each physical server machine. The ADF runtime can be installed using the JDeveloper installation package.<br />
<br />
Until the next time, keep on JDeveloping (on a cluster)!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-28-how-to-setup-weblogic-cluster-pt.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-30-how-to-setup-weblogic-cluster.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com1tag:blogger.com,1999:blog-8484416608670642843.post-74306793074483157152010-11-05T02:31:00.000-07:002010-11-09T06:30:25.779-08:00FAQ #28 - How to setup a WebLogic cluster, Pt. 2<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
In this second part of setting up a WebLogic cluster we will continue where we left of in part one and complete our cluster installation. We will also do some monitoring on the cluster setup to ensure that is configured and working properly.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
Just to recap what we 've done so far:<br />
<br />
1. we have installed WebLogic on both physical machines that make up the cluster,<br />
2. we have created a WebLogic <i>Domain</i> in one of the physical machines, and<br />
3. we have configured the domain: we created two WebLogic <i>Managed Servers</i> and two WebLogic <i>Machines</i>, we assigned the <i>Managed Servers</i> to WebLogic <i>Machines</i> and verified that the node manager running on the physical machines is reachable.<br />
<br />
We will complete the setup by following these steps:<br />
<br />
4. Copy the domain file structure to the other physical machine and enroll it to the WebLogic <i>Domain</i><br />
5. Ensure that both WebLogic <i>Machines</i> are operational<br />
6. Create and configure the WebLogic <i>Cluster</i><br />
7. Ensure that the <i>Cluster</i> is operational<br />
<br />
Let's get on with it!<br />
<br />
<u><i>4. Copy the domain file structure to the other physical machine and enroll it to the WebLogic Domain</i></u><br />
<br />
WebLogic comes with a <i>pack</i> utility that allows you to pack a domain and move it from one place to another. We will instead use plain old Linux <i>tar</i> and <i>gzip</i> to pack our WebLogic domain directory file structure and move it from one physical machine - the one that we have done steps 2 and 3 so far - to the other. Before doing so, we will shutdown the domain and node manager if they are still running on the first machine. Once the packing is done, we will re-start them.<br />
<br />
To shutdown the domain, simply press Ctrl-C within the console running the domain. Alternatively, you could shutdown the domain by shutting down the <i>Administration Server</i> using the <i>Administration Console</i>. Once the domain is shutdown, go to the <i>Middleware Home</i> directory and issue the following tar command to pack the domain directory file structure and contents, i.e. the <i>user_projects</i> directory: <i><b>tar cvf user_projects.tar user_projects</b></i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM8vQGfSxuI/AAAAAAAAAyo/uX1uE9sazFw/s1600/FAQ28.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="151" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM8vQGfSxuI/AAAAAAAAAyo/uX1uE9sazFw/s320/FAQ28.1.png" width="320" /></a></div><br />
When the <i>tar</i> command is done, zip the archive by typing: <i><b>gzip user_projects.tar</b></i>. The file that needs to be moved and unpacked on the other machine is called <i>user_projects.tar.gz</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM8xI1DmNvI/AAAAAAAAAys/LkC7yTuxz9s/s1600/FAQ28.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="151" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM8xI1DmNvI/AAAAAAAAAys/LkC7yTuxz9s/s320/FAQ28.2.png" width="320" /></a></div><br />
The compressed archive of the <i>user_projects</i> domain file structure should be moved to the <i>Middleware Home</i> on the other physical machine - remember that the <i>Middleware Home</i> directories on both physical machines should be <u>exactly the same</u> - and uncompress by typing <i><b>gunzip user_projects.tar.gz</b></i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM8yl83B_BI/AAAAAAAAAyw/3CUMphZJrKo/s1600/FAQ28.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM8yl83B_BI/AAAAAAAAAyw/3CUMphZJrKo/s320/FAQ28.3.png" width="320" /></a></div><br />
Finally extract the archive by typing <i><b>tar xvf user_projects.tar</b></i>. This will create the <i>user_projects</i> directory structure on the second physical machine.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM8ztHTRMUI/AAAAAAAAAy0/Hj4dRvvd0Xw/s1600/FAQ28.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM8ztHTRMUI/AAAAAAAAAy0/Hj4dRvvd0Xw/s320/FAQ28.4.png" width="320" /></a></div><br />
Now you need to re-start the domain - on the first (original) machine - and use the <i> WebLogic Scripting Tool</i> - on the second machine - to enroll the domain structure - the one we just extracted - to the WebLogic <i>Domain</i>. So, after making sure that the domain is started and is in <i>RUNNING </i>state, issue the following commands on the second machine - the one we are now setting up - to enroll it to the WebLogic <i>Domain</i>:<br />
<br />
Start the <i>WebLogic Scripting Tool</i> by changing to the <i>wlserver_10.3/common/bin</i> directory and typing <i><b>wlst</b><span class="Apple-style-span" style="font-style: normal;">. On the </span>wlst <span class="Apple-style-span" style="font-style: normal;">prompt issue the following command to connect to the WebLogic </span>Domain <span class="Apple-style-span" style="font-style: normal;">running on the other machine: </span></i><i><b>connect('weblogic','weblogic1','t3://192.168.1.106:7001')</b><span class="Apple-style-span" style="font-style: normal;">. </span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM85EU9ycnI/AAAAAAAAAy4/0Bicp3LJHA0/s1600/FAQ28.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="162" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM85EU9ycnI/AAAAAAAAAy4/0Bicp3LJHA0/s320/FAQ28.5.png" width="320" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;">Verify that the connection was successful and then </span><span class="Apple-style-span" style="font-style: normal;">issue the following command to enroll this machine to the WebLogic </span>Domain<span class="Apple-style-span" style="font-style: normal;">: </span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><b>nmEnroll('/home/weblogic/Oracle/Middleware/user_projects/domains/clusteredDomain', '/home/weblogic/Oracle/Middleware/wlserver_10.3/common/nodemanager')</b></i><br />
<br />
Verify that the machine was successfully enrolled into the <i>Domain</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM86nMtBIxI/AAAAAAAAAy8/TXQIipkXnA8/s1600/FAQ28.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM86nMtBIxI/AAAAAAAAAy8/TXQIipkXnA8/s320/FAQ28.6.png" width="320" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<br />
<i><u>5. Ensure that both WebLogic </u><i><u>Machines</u></i><u> are operational</u></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;">Now that the second machine was successfully enrolled into the WebLogic </span>Domain<span class="Apple-style-span" style="font-style: normal;">, we can start the node manager on the second machine and verify that it is </span>Reachable<span class="Apple-style-span" style="font-style: normal;"> by the WebLogic </span>Machine<span class="Apple-style-span" style="font-style: normal;">. We have already verified that the node manager on the first machine is </span>Reachable<span class="Apple-style-span" style="font-style: normal;"> back in step 3.</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;">You can start the node manager by running the </span><b>startNodeManager.sh</b><span class="Apple-style-span" style="font-style: normal;"> script in the </span>wlserver_10.3/server/bin<span class="Apple-style-span" style="font-style: normal;"> directory. Again, ensure that the node manager is not started in SSL mode by setting the </span><span class="Apple-style-span">SecureListener </span><span class="Apple-style-span" style="font-style: normal;">parameter to false in the </span><span class="Apple-style-span">nodemanager.properties</span><span class="Apple-style-span" style="font-style: normal;"> configuration file in </span><span class="Apple-style-span">wlserver_10.3/common/nodemanager</span><span class="Apple-style-span" style="font-style: normal;">. Note that </span><span class="Apple-style-span">nodemanager.properties</span><span class="Apple-style-span" style="font-style: normal;"> might not exist until you first run </span><span class="Apple-style-span">startNodeManager.sh</span><span class="Apple-style-span" style="font-style: normal;">.</span></i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM8_KIMktGI/AAAAAAAAAzA/NHmt47mFMrU/s1600/FAQ28.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="162" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM8_KIMktGI/AAAAAAAAAzA/NHmt47mFMrU/s320/FAQ28.7.png" width="320" /></a></div><br />
Now, with the node managers running on both physical machines return to the <i>Administration Console</i> and verify that the node managers are <i>Reachable</i> for both <i>Machines</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM9Bi1ljmuI/AAAAAAAAAzE/wka-ePXR-HM/s1600/FAQ28.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="264" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM9Bi1ljmuI/AAAAAAAAAzE/wka-ePXR-HM/s320/FAQ28.8.png" width="320" /></a></div><br />
<i><u>6. Create and configure the WebLogic Cluster</u></i><br />
<i><br />
</i><br />
To create a WebLogic <i>Cluster</i> use the <i>Administration Console</i> and<i> v</i>ia the <i>Domain Structure</i> tree navigate to <i>Environment</i> and then <i>Clusters</i>. On the <i>Summary of Clusters</i> table click the <i><b>New</b></i> button to create a new WebLogic <i>Cluster</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBfTBeQ_dI/AAAAAAAAAzI/c-COg5st6JQ/s1600/FAQ28.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBfTBeQ_dI/AAAAAAAAAzI/c-COg5st6JQ/s320/FAQ28.9.png" width="320" /></a></div><br />
On the <i>Create a New Cluster</i> page enter the <i>Name</i> of the <i>Cluster</i>, select <i><b>Unicast</b></i> for the <i>Messaging Mode</i> and click <i><b>OK</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBi3RDBGkI/AAAAAAAAAzM/HH8zmR0yvTY/s1600/FAQ28.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBi3RDBGkI/AAAAAAAAAzM/HH8zmR0yvTY/s320/FAQ28.10.png" width="320" /></a></div><br />
Ensure that the WebLogic <i>Cluster</i> is created successfully by observing the messages on the top <i>Messages</i> area and the new <i>Cluster</i> appearing in the <i>Clusters</i> table. Now, click on the newly created <i>Cluster</i> to go to the <i>Settings for Cluster</i> page. On the <i>Configuration General</i> tab on the <i>Cluster Address</i> field enter the IP addresses of the physical machines separated by comma(s) supplying <i><b>7003</b></i> as the cluster listen port, e.g. <i>192.168.1.106:7003,192.168.1.107:7003</i> in this example. Click <i><b>Save</b></i> to save the changes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNBlBIorMKI/AAAAAAAAAzQ/qWVylA5Qp-c/s1600/FAQ28.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TNBlBIorMKI/AAAAAAAAAzQ/qWVylA5Qp-c/s320/FAQ28.11.png" width="320" /></a></div><br />
While still on the<i> Settings for Cluster</i> page, go to the <i>Configuration Servers</i> tab and click <i><b>Add</b></i> on the <i>Servers</i> table to assign the <i>Managed Servers</i> to the <i>Cluster</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNBmE5IQe9I/AAAAAAAAAzU/hJ6iJRd6d8o/s1600/FAQ28.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNBmE5IQe9I/AAAAAAAAAzU/hJ6iJRd6d8o/s320/FAQ28.12.png" width="320" /></a></div><br />
On the <i>Add a Server to Cluster</i> page select the <i>Managed Servers</i> - one at a time - to add to the <i>Cluster</i> using the <i>Select a server</i> drop down and click <i><b>Finish</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBrDYFpgdI/AAAAAAAAAzY/toxUYeUSfqg/s1600/FAQ28.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBrDYFpgdI/AAAAAAAAAzY/toxUYeUSfqg/s320/FAQ28.13.png" width="320" /></a></div><br />
Repeat this step for both <i>Managed Servers</i>. In the end both <i>Managed Servers</i> should be shown on the <i>Servers</i> table for the Cluster.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNBrzyknwII/AAAAAAAAAzc/iNeFgVkoaa8/s1600/FAQ28.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNBrzyknwII/AAAAAAAAAzc/iNeFgVkoaa8/s320/FAQ28.14.png" width="320" /></a></div><br />
<br />
<i><u>7. Ensure that the Cluster is operational</u></i><br />
<br />
Now that the <i>Cluster</i> is setup we can start the <i>Managed Servers</i> and do some monitoring on the <i>Cluster</i> to ensure its proper operation. You can start the <i>Managed Servers</i> either by running the <i><b>startManagedWebLogic.sh</b></i> script in the <i>user_projects/domains/clusteredDomain/bin</i> directory - for each physical machine - or from within the <i>Administration Console</i>. We will use the <i>Administration Console</i> to do so, which will at the same time validate our setup. So, go to the <i>Summary of Servers</i> page - via the <i>Domain Structure</i> tree by clicking on <i><b>Environment</b></i> and then <i><b>Servers</b></i> - and click on the <i><b>Control</b></i> tab. Click on the checkboxes to select both <i>Managed Servers</i> - notice that they are both in <i>SHUTDOWN</i> state - and click the <i><b>Start</b></i> button to start them.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNBv2n7LaDI/AAAAAAAAAzg/IGPPeSe8gyQ/s1600/FAQ28.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TNBv2n7LaDI/AAAAAAAAAzg/IGPPeSe8gyQ/s320/FAQ28.15.png" width="320" /></a></div><br />
The <i>Administration Console</i> will delegate the start-up process to the node managers running on both machines. Each node manager will start the <i>Managed Server</i> assigned to the <i>Machine</i> controlled by the node manager. The process might take a minute or so to complete and once done both <i>Managed Servers</i> should be displayed on the Servers table with a <i>RUNNING</i> state. The <i>Status of Last Action</i> should be <i>TASK COMPLETED</i>. You will need to periodically refresh the page to see the final start-up status.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBzuncEm2I/AAAAAAAAAzk/C2warXgHHu0/s1600/FAQ28.16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNBzuncEm2I/AAAAAAAAAzk/C2warXgHHu0/s320/FAQ28.16.png" width="320" /></a></div><br />
Now with both <i>Managed Servers</i> running, let's take a look at our <i>Cluster</i> status. Return to the <i>Summary of Clusters</i> page - via <i><b>Environment</b></i> and then <i><b>Clusters</b></i> on the navigation tree - and click on the <i>Cluster</i> in the <i>Clusters</i> table. Then click on the <i><b>Monitoring</b></i> tab and observe the <i>Cluster</i> <i>Server</i> status on the <i>Summary</i> tab.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNB7zKQC1rI/AAAAAAAAAzo/4YliiW534Lo/s1600/FAQ28.17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TNB7zKQC1rI/AAAAAAAAAzo/4YliiW534Lo/s320/FAQ28.17.png" width="320" /></a></div><br />
Click on the <i><b>Health </b></i>and <i><b>Failover</b></i> tabs to see other monitoring information and status.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNB9gKdwTuI/AAAAAAAAAzs/OfNo0hmLvbw/s1600/FAQ28.18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="233" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TNB9gKdwTuI/AAAAAAAAAzs/OfNo0hmLvbw/s320/FAQ28.18.png" width="320" /></a></div><br />
This concludes our Cluster setup.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
In this two-part post we went through a basic two physical machine WebLogic cluster setup and configuration. Following the seven-step-process outlined on part one of this post, we first installed WebLogic on both machines (step 1), we created and initially configured the domain on one of the machines (steps 2 and 3), we copied the domain to the other machine (step 4), we verified that both machines are accessible by the domain (step 5), we created the WebLogic cluster (step 6) and finally verified that the cluster is operational (step 7).<br />
<br />
Until then keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-27-how-to-setup-weblogic-cluster-pt.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-29-how-to-deploy-adf-runtime.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com16tag:blogger.com,1999:blog-8484416608670642843.post-526248377128171772010-10-31T08:36:00.000-07:002010-11-20T02:57:58.988-08:00FAQ #27 - How to setup a WebLogic cluster, Pt. 1<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
This and the next FAQ will go over setting up a WebLogic cluster consisting of two <i>Managed Servers</i> running on a separate physical machine each. For the case of this example, each machine is running a different Linux distribution.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
A WebLogic cluster could be setup in a number of different configurations, a WebLogic <i>Domain</i> in fact could be comprised of a combination of WebLogic <i>Clusters</i> and <i>Managed Servers</i>. The following is an extract from section <a href="http://download.oracle.com/docs/cd/E14571_01/web.1111/e13709/overview.htm#CJAJHHBI">2 - Understanding WebLogic Server Clustering</a> of the <a href="http://download.oracle.com/docs/cd/E14571_01/web.1111/e13709/toc.htm">Oracle® Fusion Middleware Using Clusters for Oracle WebLogic Server 11g Release 1 (10.3.3)</a> documentation:<br />
<br />
"<i>A WebLogic Server cluster consists of multiple WebLogic Server server instances running simultaneously and working together to provide increased scalability and reliability. A cluster appears to clients to be a single WebLogic Server instance. The server instances that constitute a cluster can run on the same machine, or be located on different machines. You can increase a cluster's capacity by adding additional server instances to the cluster on an existing machine, or you can add machines to the cluster to host the incremental server instances. Each server instance in a cluster must run the same version of WebLogic Server</i>."<br />
<br />
There are also several methods for setting up the clustered domain, namely using the <i>Fusion Middleware Configuration Wizard</i>, the <i>Administration Console</i>, the <i>wlst </i>command line utility and even programmatically. In this example we will combine the first three: we will create the domain using the <i>Configuration Wizard</i> and setup the domain cluster using the <i>Administration Console</i> and the <i>wlst</i> utility.<br />
<br />
Briefly the steps involved in setting up the cluster are:<br />
<br />
1. Install WebLogic on both physical machines<br />
2. Create the WebLogic <i>Domain </i>on one physical machine<br />
3. Configure the domain by adding <i>Managed Servers</i> and <i>Machines </i>on one physical machine<br />
4. Copy the domain file structure to the other physical machine and enroll it to the WebLogic <i>Domain</i><br />
5. Ensure that both WebLogic <i>Machines</i> are operational<br />
6. Create and configure the <i>Cluster</i><br />
7. Ensure that the <i>Cluster</i> is operational<br />
<br />
<br />
<u><i>1. Install WebLogic on both physical machines</i></u><br />
<br />
The <u>same exact version</u> of WebLogic must be installed on both physical machines. Also, WebLogic must be installed on the <u>same Middleware Home</u> in both machines. This is necessary since we will be copying the domain file structure from one physical machine to the other - step 4 above.<br />
<br />
Start by going to the Oracle WebLogic downloads page and download the latest version of WebLogic for Linux. At the writing of this, this page can be accessed by clicking <a href="http://www.oracle.com/technetwork/middleware/fusion-middleware/downloads/index.html?ssSourceSiteId=ocomen">here</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMwB3LgTjcI/AAAAAAAAAxE/B_DC_koKDTg/s1600/FAQ27.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="308" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMwB3LgTjcI/AAAAAAAAAxE/B_DC_koKDTg/s320/FAQ27.1.png" width="320" /></a></div><br />
The 32-bit Linux WebLogic version 10.3.3. file that is downloaded is called <i><b>wls1033_oepe111150_linux32.bin</b></i>. For installing and administering this installation create a <b><i>weblogic</i></b> Linux user account and use it to login and perform the installation. Make sure that the maximum number of open files is set to 4096 for the user account.<br />
<br />
Ensure that the <i><b>wls1033_oepe111150_linux32.bin</b><span class="Apple-style-span" style="font-style: normal;"> has execute permission and start the installation by typing <b><i>./</i></b></span></i><i><b>wls1033_oepe111150_linux32.bin</b><span class="Apple-style-span" style="font-style: normal;">. The installation will self-unpack and present the </span>Welcome<span class="Apple-style-span" style="font-style: normal;"> page.</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMxCM8LfXOI/AAAAAAAAAxI/P_v1flxSf1c/s1600/FAQ27.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMxCM8LfXOI/AAAAAAAAAxI/P_v1flxSf1c/s320/FAQ27.2.png" width="320" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;">On the </span>Choose Middleware Home Directory<span class="Apple-style-span" style="font-style: normal;"> page accept the default </span>Oracle/Middleware<span class="Apple-style-span" style="font-style: normal;"> under the </span>/home/weblogic<span class="Apple-style-span" style="font-style: normal;"> and press </span><b>Next</b><span class="Apple-style-span" style="font-style: normal;">.</span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMxfkNWEpuI/AAAAAAAAAxM/8msU5IsIxa8/s1600/FAQ27.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMxfkNWEpuI/AAAAAAAAAxM/8msU5IsIxa8/s320/FAQ27.3.png" width="320" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i><br />
On the <i>Register for Security Updates</i> page click <b><i>Next</i></b>. On the <i>Choose Install Type</i> page select <b><i>Custom</i></b> and click <b><i>Next</i></b>. On the <i>Choose Products and Components</i> page you may deselect <i><b>Oracle Enterprise Pack for Eclipse</b></i> and click <b><i>Next</i></b>. Accept the defaults on the <i>JDK Selection</i> page - both the Java and JRockit SDKs are selected - and click <i><b>Next</b></i>. On the <i>Choose Product Installation Directories</i> page accepts the defaults and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMxh4_uwt6I/AAAAAAAAAxQ/uz5bJfD0-Io/s1600/FAQ27.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMxh4_uwt6I/AAAAAAAAAxQ/uz5bJfD0-Io/s320/FAQ27.4.png" width="320" /></a></div><br />
Verify the installation parameters on the <i>Installation Summary</i> page and press <i><b>Next</b></i> to proceed with the installation.<br />
<br />
Now proceed with the installation of WebLogic using the exact same installation package and the steps outlined above on the other machine.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TMxqs6ZcpzI/AAAAAAAAAxU/xxo5u4mtGkY/s1600/FAQ27.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="276" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TMxqs6ZcpzI/AAAAAAAAAxU/xxo5u4mtGkY/s320/FAQ27.5.png" width="320" /></a></div><br />
Ensure that in page <i>Choose Middleware Home Directory</i> the same <i>Middleware Home</i> is specified. In this case we will accept the default <i><b>Oracle/Middleware</b></i> under the <i>weblogic</i> user's home directory <i><b>/home/weblogic</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMxr2PTuo8I/AAAAAAAAAxY/R2OQxij2qrA/s1600/FAQ27.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMxr2PTuo8I/AAAAAAAAAxY/R2OQxij2qrA/s320/FAQ27.6.png" width="320" /></a></div><br />
<i><u><br />
</u></i><br />
<i><u>2. Create the WebLogic Domain in one physical machine</u></i><br />
<br />
Now, having completed the WebLogic installations on <u>both</u> machines, we can proceed with the creation of the WebLogic <i>Domain</i>. We will do this <u>only</u> on one of the two machines.<br />
<br />
Start the <i>Fusion Middleware Configuration Wizard</i> utility - it is called <i><b>config.sh</b></i> and is located in the <i>wlserver_10.3/common/bin</i> directory under the <i>Middleware Home</i> (<i>/home/weblogic/Oracle/Middleware</i> for our installation) and on the <i>Welcome</i> page select <i><b>Create a new WebLogic domain</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMxyYMt24aI/AAAAAAAAAxc/3x8JeZxQ5dg/s1600/FAQ27.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMxyYMt24aI/AAAAAAAAAxc/3x8JeZxQ5dg/s320/FAQ27.7.png" width="320" /></a></div><br />
At this point accept the default products on the <i>Select Domain Source</i> page and click <i><b>Next</b></i>. On the <i>Specify Domain Name and Location</i> page specify the name and location of the domain. For this example we have called it <i><b>clusteredDomain</b></i>. On the <i>Configure Administrator User Name and Password</i> page specify the weblogic administrator password. Accept the appropriate startup mode and JDK on the <i>Configure Server Start Mode and JDK</i> page and click <i><b>Next</b></i>. On the <i>Select Optional Configuration</i> page select <i><b>Administrator Server</b></i> only. We will create the <i>Managed Servers, Machines</i> and <i>Clusters</i> later on using the <i>Administration Console</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMx2LF7Ld2I/AAAAAAAAAxg/-JTo58LJe58/s1600/FAQ27.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMx2LF7Ld2I/AAAAAAAAAxg/-JTo58LJe58/s320/FAQ27.8.png" width="320" /></a></div><br />
On the <i>Configure the Administration Server</i> page you can accept the defaults for the administration server <i>Name</i> and <i>Listen port</i> and click <i><b>Next</b></i>. Verify your selections on the <i>Configuration Summary</i> page and when ready click on <i><b>Create</b></i> to proceed with the creation of the domain.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM1vfRId-HI/AAAAAAAAAxk/HT5Bi4uH6z8/s1600/FAQ27.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM1vfRId-HI/AAAAAAAAAxk/HT5Bi4uH6z8/s320/FAQ27.9.png" width="320" /></a></div><br />
The <i>Configuration Wizard</i> proceeds with the creation of the domain under the path specified, which defaults to <i>user_projects/domains</i> under the <i>Middleware Home</i>. Once the domain is created successfully, we can start it by running the <i><b>startWebLogic.sh</b></i> script in the <i>user_projects/domains/clusteredDomain</i>. Verify that the domain is started successfully by observing the logs in the terminal window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TM1xgg0o2kI/AAAAAAAAAxo/tMa7XNNNLpE/s1600/FAQ27.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="210" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TM1xgg0o2kI/AAAAAAAAAxo/tMa7XNNNLpE/s320/FAQ27.10.png" width="320" /></a></div><br />
<i><u>3. Configure the domain by adding Managed Servers and Machines in one physical machine</u></i><br />
<br />
With the domain running we can proceed with the creation of the <i>Managed Servers</i> and <i>Machines</i> using the WebLogic <i>Administration Console</i>. So, start your browser and go to the <i>Administration Console</i> by specifying its address as: <u><i>http://machine1:7001/console</i></u> ,where <i>machine1</i> is the ip address or host name of the machine that you used in step 2 above to create the <i>Administration Server</i>. This should display the Administration Console login form.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM1z4MirC2I/AAAAAAAAAxs/HbGiu26eMY4/s1600/FAQ27.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="246" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM1z4MirC2I/AAAAAAAAAxs/HbGiu26eMY4/s320/FAQ27.11.png" width="320" /></a></div><br />
Enter the server administration name and password you specified in step 2 when creating the domain - username defaults to <i>weblogic</i> - and click <i><b>Log In</b></i> to login.<br />
<br />
The first thing that we need to do now is to create the managed servers. Using the <i>Domain Structure</i> tree navigate to <i><b>Environment</b></i> and then <i><b>Servers</b></i>. On the <i>Summary of Servers</i> screen <i>Configuration</i> tab click on the <i><b>New</b></i> button to create a new <i>Managed Server</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM12vpz54SI/AAAAAAAAAxw/M5a-oywCzVA/s1600/FAQ27.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="286" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM12vpz54SI/AAAAAAAAAxw/M5a-oywCzVA/s320/FAQ27.12.png" width="320" /></a></div><br />
On the Create a New Server screen specify the <i>Server Name</i>, <i>Server Listen Address</i> and <i>Server Listen Port</i>. For the <i>Server Listen Address</i> specify the address of the first physical machine. You can click <b><i>Next </i></b>to verify your input and finally <i><b>Finish</b></i> to proceed with the creation of the <i>Managed Server</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM14CVtu4lI/AAAAAAAAAx0/RPuc0F9nCsk/s1600/FAQ27.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM14CVtu4lI/AAAAAAAAAx0/RPuc0F9nCsk/s320/FAQ27.13.png" width="320" /></a></div><br />
The <i>Administration Console</i> proceeds with the creation of the server. When done displays a success message in the <i>Messages</i> area and the server is shown in the <i>Summary of Servers</i> table in a <i>SHUTDOWN</i> state.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM15fj6mJyI/AAAAAAAAAx4/GC4rE0nyEZk/s1600/FAQ27.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM15fj6mJyI/AAAAAAAAAx4/GC4rE0nyEZk/s320/FAQ27.14.png" width="320" /></a></div><br />
Repeat the steps above to create the Managed Server sunning on the <u>other</u> physical machine. Make sure that you specify the <i>Server Listen Address</i> of the <u>other</u> physical machine.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM17NKFVcPI/AAAAAAAAAx8/rQVxUpE9zbA/s1600/FAQ27.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="271" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM17NKFVcPI/AAAAAAAAAx8/rQVxUpE9zbA/s320/FAQ27.15.png" width="320" /></a></div><br />
Now that the <i>Managed Servers</i> have been created we will proceed with the creation of the WebLogic <i>Machines</i> - one for each physical machine - and assign the <i>Managed Servers</i> to them.<br />
<br />
Using the Domain Structure tree navigate to <i><b>Environment</b></i> and then <i><b>Machines</b></i>. On the <i>Summary of Machines</i> table click on the <i><b>New</b></i> button to create a new WebLogic <i>Machine</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM18g1Q1H1I/AAAAAAAAAyA/WXmU8pzP0kw/s1600/FAQ27.16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM18g1Q1H1I/AAAAAAAAAyA/WXmU8pzP0kw/s320/FAQ27.16.png" width="320" /></a></div><br />
On the <i><b>Create a New Machine</b></i> page specify the name of the first machine and click <i><b>OK</b></i> to create the <i>Machine</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM19db1pZvI/AAAAAAAAAyE/Du9qyz_0Ybk/s1600/FAQ27.17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM19db1pZvI/AAAAAAAAAyE/Du9qyz_0Ybk/s320/FAQ27.17.png" width="320" /></a></div><br />
A success message in the <i>Messages</i> should indicate the successful creation of the <i>Machine</i> and the <i>Machine</i> will be available in the <i>Summary of Machines</i> table.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM1-iCbcPJI/AAAAAAAAAyI/KSCttzUJCjA/s1600/FAQ27.18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM1-iCbcPJI/AAAAAAAAAyI/KSCttzUJCjA/s320/FAQ27.18.png" width="320" /></a></div><br />
Now, click on the newly created <i>Machine</i> and then on the <i><b>Node Manager</b></i> tab under the <i>Configuration</i> tab. The node manager will be used on each physical machine to start the Managed Servers. On this tab we need to properly configure the node manager parameters. Make sure that the <i>Type</i> is set to <i><b>Plain</b></i> and that the <i>Listen Address</i> corresponds to the ip address of the physical machine where this <i>Machine</i>'s node manager is running. You can leave the port to the default 5556. Don't forget to click on the <i><b>Save</b></i> button to save your settings.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM2AWig8DzI/AAAAAAAAAyM/uRDetv6pVSg/s1600/FAQ27.19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TM2AWig8DzI/AAAAAAAAAyM/uRDetv6pVSg/s320/FAQ27.19.png" width="320" /></a></div><br />
Verify that your settings were set successful by observing the <i>Messages</i> area.<br />
<br />
Now you will need to assign the appropriate <i>Managed Server</i> to the <i>Machine</i>. You do this by clicking on the <i><b>Servers</b></i> tab under the Machine <i>Configuration</i> tab and then the <i><b>Add</b></i> button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM2BasxIaSI/AAAAAAAAAyQ/cQsRK69_9yo/s1600/FAQ27.20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM2BasxIaSI/AAAAAAAAAyQ/cQsRK69_9yo/s320/FAQ27.20.png" width="320" /></a></div><br />
In the <i>Add a Server to Machine</i> page ensure that the appropriate <i>Managed Server</i> - the one that corresponds to this <i>Machine</i> - is selected in the <i>Select a server</i> choice list. Click <b><i>Next</i></b> or <i><b>Finish </b></i>to proceed with the server assignment.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM2CU9NT6rI/AAAAAAAAAyU/rCx-AhigGjg/s1600/FAQ27.21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM2CU9NT6rI/AAAAAAAAAyU/rCx-AhigGjg/s320/FAQ27.21.png" width="320" /></a></div><br />
The <i>Managed Server</i> should be assigned successfully and should be displayed in the <i>Servers</i> table for this <i>Machine</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TM2DCETMpVI/AAAAAAAAAyY/BlXwWbhdwY0/s1600/FAQ27.22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TM2DCETMpVI/AAAAAAAAAyY/BlXwWbhdwY0/s320/FAQ27.22.png" width="320" /></a></div><br />
Now repeat the steps above to create a WebLogic <i>Machine</i> for the second physical machine. Make sure that you configure the <i>Machine</i> correctly and assign the appropriate <i>Managed Server</i> to it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TM2Dxzpo12I/AAAAAAAAAyc/ONFylbr6D_4/s1600/FAQ27.23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TM2Dxzpo12I/AAAAAAAAAyc/ONFylbr6D_4/s320/FAQ27.23.png" width="320" /></a></div><br />
Now with the WebLogic Machines created and configured we can start the node manager on the machine. Remember that we are still working on the same machine where we run the <i>Configuration Wizard</i> in the first place. It can be started by running the <i><b>startNodeManager.sh</b></i> script in the <i>wlserver_10.3/server/bin</i> directory under the <i>Middleware Home</i>. Before starting it, go over the start-up parameters specified in the <i><b>nodemanager.properties</b></i> configuration file in the <i>wlserver_10.3/common/nodemanager</i> directory and verify that it is not configured for SSL by ensuring that the <i>SecureListener</i> parameter is set to <i>false</i>. Once started the terminal window should indicate that the node manager is running and listening to the port configured.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM2HJoOkdOI/AAAAAAAAAyg/x2h4hEyJkR8/s1600/FAQ27.24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="201" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TM2HJoOkdOI/AAAAAAAAAyg/x2h4hEyJkR8/s320/FAQ27.24.png" width="320" /></a></div><br />
To verify that the node manager is reachable by the WebLogic <i>Machine</i>, return to the <i>Machines</i> page in the <i>Administrator Console</i> and on the <i>Summary of Machines</i> table click on the first <i>Machine</i> - <i><b>Machine1</b></i> in this case the one we are currently configuring. Click on the <i><b>Monitoring</b></i> tab and observe in the <i>Node Manager Status</i> tab that the node manager <i>Status</i> is <i>Reachable</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM2IpkK3nxI/AAAAAAAAAyk/h4na2Rktfws/s1600/FAQ27.25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="268" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TM2IpkK3nxI/AAAAAAAAAyk/h4na2Rktfws/s320/FAQ27.25.png" width="320" /></a></div><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
This concludes this first part of setting up the cluster. On the next and final part we will continue with the setup of the second physical machine, verify that both WebLogic Machines are operational, create, configure and start the WebLogic cluster.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-26-how-to-install-jdeveloper-in.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/11/faq-28-how-to-setup-weblogic-cluster-pt.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com12tag:blogger.com,1999:blog-8484416608670642843.post-3925232280666189732010-10-22T12:57:00.000-07:002010-11-09T06:29:39.645-08:00FAQ #26 - How to Install JDeveloper on Linux<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
A recent post on OTN related to the installation of JDeveloper on Linux is the inspiration for this FAQ. Let's go over the installation then and discover on the way how difficult or - as it turns out - how easy it is.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
Start by downloading the latest version of JDeveloper - at the writing of this, it is 11.1.1.3.0 - from the Oracle JDeveloper Downloads web page. This download page can be accessed directly by typing the following address on your browser: <a href="http://www.oracle.com/technetwork/developer-tools/jdev/downloads/soft11-098086.html">http://www.oracle.com/technetwork/developer-tools/jdev/downloads/soft11-098086.html</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHafN5f4lI/AAAAAAAAAwc/4prUDhK-N0s/s1600/FAQ26.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHafN5f4lI/AAAAAAAAAwc/4prUDhK-N0s/s320/FAQ26.1.png" width="262" /></a></div><br />
Once the download is done, open a terminal window and go to the directory where the installation package file resides. Ensure that you have given read and execute permissions to the installation auto-extraction package file and start its execution by typing <b><i>./jdevstudio11113install.bin</i></b>, where<i> jdevstudio11113install.bin</i> is the name of the downloaded installation package filename. This will start the unpacking of the installation package and upon completion it will present the <i>Welcome </i>installation page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMHg_IB8XxI/AAAAAAAAAwk/KCt8Sh8bWmk/s1600/FAQ26.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMHg_IB8XxI/AAAAAAAAAwk/KCt8Sh8bWmk/s320/FAQ26.3.png" width="320" /></a></div><br />
Note that if you are having trouble seeing the <i>Welcome </i>page in graphical mode, ensure that the <i>$DISPLAY </i>environment variable is set correctly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div>Click <b><i>Next </i></b>to proceed to the <i>Choose Middleware Home Directory</i> page and possibly accept the default <i>Middleware Home Directory</i> proposed by the installation program, namely <i>Oracle/Middleware</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHiD_-RRRI/AAAAAAAAAwo/qpPeDl6NwF8/s1600/FAQ26.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHiD_-RRRI/AAAAAAAAAwo/qpPeDl6NwF8/s320/FAQ26.4.png" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div>In the <i>Choose Install Type</i> page you can choose <b><i>Complete </i></b>to install all available components, that is JDeveloper, ADF support and the WebLogic Server. This would be fine, unless you want to selectively install certain components only.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHjJPFVZkI/AAAAAAAAAws/x3UqAORArbI/s1600/FAQ26.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHjJPFVZkI/AAAAAAAAAws/x3UqAORArbI/s320/FAQ26.5.png" width="320" /></a></div><br />
Click <b><i>Next </i></b>and confirm the installation directories in the <i>Confirm Product Installation Directories</i> page. Confirm and click <b>Next </b>once more<b> </b>to proceed to the <i>Installation Summary</i> page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHkcpNL8LI/AAAAAAAAAww/opvdjUFrAYk/s1600/FAQ26.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHkcpNL8LI/AAAAAAAAAww/opvdjUFrAYk/s320/FAQ26.6.png" width="320" /></a></div><br />
Review the installation summary and when ready press <b><i>Next </i></b>to proceed with the installation.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHlAh-dSbI/AAAAAAAAAw0/vlolamE26kY/s1600/FAQ26.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TMHlAh-dSbI/AAAAAAAAAw0/vlolamE26kY/s320/FAQ26.7.png" width="320" /></a></div><br />
The installation will start and upon a successful installation you should see the <i>Installation Complete</i> page. Uncheck the<b><i> Run Quickstart</i></b> checkbox and click <b><i>Done </i></b>to exit.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMHlxLUNJcI/AAAAAAAAAw4/KUNYZ-W1Rko/s1600/FAQ26.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TMHlxLUNJcI/AAAAAAAAAw4/KUNYZ-W1Rko/s320/FAQ26.8.png" width="320" /></a></div><br />
That's all there is to it.<br />
<br />
To start JDeveloper, go to the <b><i>/jdeveloper/jdev/bin</i></b> directory under the <i>Middleware Home</i> you selected during the installation and type <b><i>./jdev</i></b><br />
<b><i><br />
</i></b><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMHniRmvp8I/AAAAAAAAAw8/KOm6Og1fZjY/s1600/FAQ26.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="227" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMHniRmvp8I/AAAAAAAAAw8/KOm6Og1fZjY/s320/FAQ26.9.png" width="320" /></a></div><b><i><br />
</i></b><br />
JDeveloper should start.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMHomtB4ohI/AAAAAAAAAxA/G1_9W-32xFA/s1600/FAQ26.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TMHomtB4ohI/AAAAAAAAAxA/G1_9W-32xFA/s320/FAQ26.10.png" width="320" /></a></div><br />
You are know ready for developing your applications on Linux using JDeveloper. To make things easier create a shortcut to the specific file on your Linux desktop if you prefer.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
As it turns out, installing JDeveloper on Linux is very simple. Simply download the Linux version of the JDeveloper installation package and run it. Follow the directions presented during the installation and when done, start JDeveloper by running the <b><i>jdev </i></b>executable in the<i> /jdeveloper/jdev/bin</i> directory.<br />
<br />
Until the next time, keep on JDeveloping (on Linux)!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/06/faq-25-how-to-get-started-with-soa.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-27-how-to-setup-weblogic-cluster-pt.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com19tag:blogger.com,1999:blog-8484416608670642843.post-18471719291839884602010-06-11T23:55:00.000-07:002010-11-09T06:29:18.521-08:00FAQ #25 - How to get started with SOA Suite 11g R1, Pt. 4<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
In this part of the <i>How to get started with SOA Suite 11g R1</i> series we will conclude the <i>EmployeeInquirer</i> composite by wiring the <i>Web Service</i> binding to the <i>Database Adapter</i> using a <i>Mediator</i> component. We will also deploy the composite to WLS and test it using Enterprise Manager.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<i><u>Defining the transformations using a Mediator component</u></i><br />
<br />
Open the <i>EmployeeInquirer </i>project and bring up the composite <i>Design</i> screen. The Web Service binding and the Database Adapter should be displayed on the <i>Exposed Services</i> and on the <i>External Services</i> part of the design canvas respectively. From the <i>Component Palette</i> grab a <i>Mediator</i> component and drop it on the <i>Components</i> section of the composite. Enter <i>RouteRequest</i> for the <i>Name</i> of the mediator and click OK.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAo1YbIbcQI/AAAAAAAAAtw/Sy1UgI6q5GI/s1600/FAQ25.1.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="235" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAo1YbIbcQI/AAAAAAAAAtw/Sy1UgI6q5GI/s320/FAQ25.1.1.png" width="320" /></a></div><br />
The composite design screen should now look as it is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo15N-TdII/AAAAAAAAAt0/53dzHNmL0S0/s1600/FAQ25.1.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="283" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo15N-TdII/AAAAAAAAAt0/53dzHNmL0S0/s320/FAQ25.1.2.png" width="320" /></a></div><br />
Now that all components have been laid out on the screen we can wire them together to define their interactions. First we will wire the <i>Web Service</i> to the <i>Mediator</i>. Click on the green binding arrowhead icon on the top right of the <i>Web Service</i> and drag it to the left of the <i>Mediator</i>. Similarly wire the <i>Mediator</i> to the <i>Database Adapter</i> by clicking on the green arrowhead icon at the right of the <i>Mediator</i> and dragging it to the <i>Database Adapter</i>. When you are done the composite should look like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo3ySbOf2I/AAAAAAAAAt4/A2ZCwhCYhME/s1600/FAQ25.1.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="281" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo3ySbOf2I/AAAAAAAAAt4/A2ZCwhCYhME/s320/FAQ25.1.3.png" width="320" /></a></div><br />
Now that the components are wired, we will add the transformation of the request/reply messages to the <i>Mediator. </i>We do this by double-clicking on the <i>Mediator</i> component. Doing so will bring up the <i>Mediator</i> editor.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAo6GgMMp2I/AAAAAAAAAuA/vllUHeP3Ru0/s1600/FAQ25.1.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="313" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAo6GgMMp2I/AAAAAAAAAuA/vllUHeP3Ru0/s320/FAQ25.1.4.png" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div><br />
We will use the editor to define the XSLT transformations to both the request and reply messages, so click on the transformation icon next to the <i>Transform Using</i> combo - pointed above by the red arrow - to bring up the <i>Request Transformation Map</i> dialog.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAo6-lj2dII/AAAAAAAAAuE/zlCYXBvSkw0/s1600/FAQ25.1.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="94" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAo6-lj2dII/AAAAAAAAAuE/zlCYXBvSkw0/s320/FAQ25.1.5.png" width="320" /></a></div><br />
Click on the <i><b>Create New Mapper File</b></i> radio button and click <i><b>OK</b></i>. This will open the XSLT mapping editor.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAo8FUuVdCI/AAAAAAAAAuI/wgHMlSGmAHk/s1600/FAQ25.1.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="186" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAo8FUuVdCI/AAAAAAAAAuI/wgHMlSGmAHk/s320/FAQ25.1.6.png" width="320" /></a></div><br />
To map the <i>employeeId</i> from the <i>source</i> - left side - to the <i>target</i> - right side, grab the <i>employeeId</i> from the <i>source</i> side and drop it on the <i>employeeId</i> on the <i>target</i> side. The resulting mapping should look like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo9M3k6TUI/AAAAAAAAAuM/vO17XMN69DU/s1600/FAQ25.1.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="183" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo9M3k6TUI/AAAAAAAAAuM/vO17XMN69DU/s320/FAQ25.1.7.png" width="320" /></a></div><br />
Now save the mapping and close the mapping editor. Back on the <i>Mediator</i> editor repeat the mapping process for the reply.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo_AYLR3WI/AAAAAAAAAuQ/cs_E4CIH-ps/s1600/FAQ25.1.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAo_AYLR3WI/AAAAAAAAAuQ/cs_E4CIH-ps/s320/FAQ25.1.8.png" width="319" /></a></div><br />
On the <i>Reply Transformation Map</i> dialog click on the <i><b>Create New Mapper</b></i> radio and click <i><b>OK</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAo_RniV1JI/AAAAAAAAAuU/5Yo9u8wUrv0/s1600/FAQ25.1.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="103" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAo_RniV1JI/AAAAAAAAAuU/5Yo9u8wUrv0/s320/FAQ25.1.9.png" width="320" /></a></div><br />
This will open the XSLT mapping editor for the reply. Map the <i>firstName</i> and <i>lastName </i>elements from the <i>source </i>to the <i>destination</i>. The result mapping is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TApATdK8-0I/AAAAAAAAAuY/6AtYo_BAEWE/s1600/FAQ25.1.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="184" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TApATdK8-0I/AAAAAAAAAuY/6AtYo_BAEWE/s320/FAQ25.1.10.png" width="320" /></a></div><br />
This concludes the definition of the <i>Mediator </i>and concludes the project. Next we need to setup the database resource for the <i>Database Adapter</i> and deploy the composite to WebLogic.<br />
<br />
<i><u>Creating the database resources in WLS</u></i><br />
<br />
<i><u>Creating the data source</u></i><br />
<br />
The database resources are required by the <i>Database Adapter</i> in order to access the HR schema in the database. First we need to define the data source, so start WLS and log in to the Administration Console. Navigate to <i><b>Services | JDBC | Data Sources</b></i> using the <i>Domain Structure</i> tree on the left and click the <i><b>New</b></i> button on the <i>Data Sources</i> table to create a new data source.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqY0HUZmKI/AAAAAAAAAuc/mUtk73urhVA/s1600/FAQ25.1.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="133" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqY0HUZmKI/AAAAAAAAAuc/mUtk73urhVA/s320/FAQ25.1.11.png" width="320" /></a></div><br />
In the <i>Name</i> field enter <i>hrDatabase</i>. For the <i>JNDI Name</i> enter <i>jdbc/hrDatabase.</i> Select the <i>Database Type</i> and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqZ-keeB8I/AAAAAAAAAug/MmeHW0jLbpM/s1600/FAQ25.1.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="310" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqZ-keeB8I/AAAAAAAAAug/MmeHW0jLbpM/s320/FAQ25.1.12.png" width="320" /></a></div><br />
On the next screen select the <i>Database Driver</i> and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqa6-PvdCI/AAAAAAAAAuk/yqS59hNYIuY/s1600/FAQ25.1.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="155" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqa6-PvdCI/AAAAAAAAAuk/yqS59hNYIuY/s320/FAQ25.1.13.png" width="320" /></a></div><br />
On the <i>Transaction Options</i> screen click <i><b>Next</b></i>. On the<i> Connection Properties</i> screen enter the database connection information for the HR schema and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqb4sIfPwI/AAAAAAAAAuo/krIeJia40K8/s1600/FAQ25.1.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="274" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqb4sIfPwI/AAAAAAAAAuo/krIeJia40K8/s320/FAQ25.1.14.png" width="320" /></a></div><br />
On the <i>Test Database Connection</i> screen click the <i><b>Test Configuration</b></i> button to test the connection. If all is OK a <i>Connection test succeeded</i> message will be displayed. Click <i><b>Next</b></i> to continue.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqc-o7AisI/AAAAAAAAAus/1D7hXHYtsFo/s1600/FAQ25.1.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="204" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqc-o7AisI/AAAAAAAAAus/1D7hXHYtsFo/s320/FAQ25.1.15.png" width="320" /></a></div><br />
On the <i>Select Targets</i> screen select your SOA server and click <i><b>Finish</b></i> to complete the creation of the data source.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqdsDO0XyI/AAAAAAAAAuw/qVfek3yqseY/s1600/FAQ25.1.16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqdsDO0XyI/AAAAAAAAAuw/qVfek3yqseY/s320/FAQ25.1.16.png" width="320" /></a></div><br />
WLS will create the data source and update the <i>Data Sources</i> table showing the <i>hrDatabase</i> data source you just created.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAqejKqnrSI/AAAAAAAAAu0/r1GnUsLkm6I/s1600/FAQ25.1.17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="102" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAqejKqnrSI/AAAAAAAAAu0/r1GnUsLkm6I/s320/FAQ25.1.17.png" width="320" /></a></div><br />
<i><u>Creating the connection pool</u></i><br />
<br />
Next we will create a connection pool for the <i>DbAdapter</i> application. Since <i>DbAdapter</i> uses a deployment plan, you will first need to create a directory on your physical SOA server machine to contain it. I have created under the <i>%SOA_HOME%\soa</i> directory and I called it <i>DBPlan</i>. The explicit path is <i>C:\Oracle\Middleware\Oracle_SOA1\soa\DBPlan</i>.<br />
<br />
Using the WLS <i>Administration Console</i> click on the <i><b>Deployments</b></i> node of the <i>Domain Structure</i> tree and click on the <i>DbAdapter</i> application shown in the <i>Deployments</i> table.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqhyCWiMLI/AAAAAAAAAu4/rmWoJS-pAWg/s1600/FAQ25.1.18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="128" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqhyCWiMLI/AAAAAAAAAu4/rmWoJS-pAWg/s320/FAQ25.1.18.png" width="320" /></a></div><br />
On the Settings for <i>DbAdapter </i>screen click on the <i><b>Configuration </b></i>tab and then on the <i><b>Outbound Connection Pools</b></i> tab. Click <i><b>New</b></i> to create a new pool.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqiycC56LI/AAAAAAAAAvA/QqjoaPhlG80/s1600/FAQ25.1.19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqiycC56LI/AAAAAAAAAvA/QqjoaPhlG80/s320/FAQ25.1.19.png" width="320" /></a></div><br />
Select the <i>javax.resource.cci.ConnectionFactory</i> radio button and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqjUhMxYMI/AAAAAAAAAvE/eKkFjI5TpsM/s1600/FAQ25.1.20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="145" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqjUhMxYMI/AAAAAAAAAvE/eKkFjI5TpsM/s320/FAQ25.1.20.png" width="320" /></a></div><br />
On the<i> JNDI name for Outbound Connection Instance</i> screen enter the JNDI name as you have entered it for the <i>Database Adapter</i> definition in the <i>EmployeeInquirer</i> project. To ensure that it is entered correctly, return to JDeveloper, double-click on the <i>Database Adapter</i> in the composite and copy it from the <i>Service Connection</i> page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqkUs-v_OI/AAAAAAAAAvI/x7QH13r7mxU/s1600/FAQ25.1.21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqkUs-v_OI/AAAAAAAAAvI/x7QH13r7mxU/s320/FAQ25.1.21.png" width="320" /></a></div><br />
After you paste it on the <i>JNDI Name</i> field click <i><b>Finish</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqk6WXeLvI/AAAAAAAAAvM/nY6eE0dm7RI/s1600/FAQ25.1.22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="136" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqk6WXeLvI/AAAAAAAAAvM/nY6eE0dm7RI/s320/FAQ25.1.22.png" width="320" /></a></div><br />
At this point you will be asked for the deployment plan location. Enter the path that you created earlier and enter <i>Plan.xml</i> for the deployment plan and click <i><b>OK</b></i>. Confirm the deployment plan name in the <i><b>Overview </b></i>tab.<br />
<div class="separator" style="clear: both; text-align: center;"></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqnIGj-j1I/AAAAAAAAAvU/ar6saZeMlhY/s1600/FAQ25.1.23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAqnIGj-j1I/AAAAAAAAAvU/ar6saZeMlhY/s320/FAQ25.1.23.png" width="320" /></a></div><br />
Now edit the connection pool you just created to associate it with the data source previously created. Click on the <i><b>Configuration </b></i>tab and then on the <i><b>Outbound Connection Pools </b></i>tab. Expand the <i><b>javax.resource.cci.ConnectionFactory</b></i> connection factory and click on the<i><b> eis/DB/HrConnection</b></i> instance.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqodxVnoWI/AAAAAAAAAvY/I7bRXkdup5I/s1600/FAQ25.1.24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqodxVnoWI/AAAAAAAAAvY/I7bRXkdup5I/s320/FAQ25.1.24.png" width="320" /></a></div><br />
On the <i>Outbound Connection Properties</i> page enter the data source name - <i>jdbc/hrDatabase</i> - in the <i>Property Value</i> field of the <i>xDatabaseSourceName</i> <i>Property Name </i>and click <i><b>Save</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAqpxHbw_vI/AAAAAAAAAvc/X_c67JXg_cI/s1600/FAQ25.1.25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAqpxHbw_vI/AAAAAAAAAvc/X_c67JXg_cI/s320/FAQ25.1.25.png" width="320" /></a></div><br />
Finally we will need to update the DbAdapter application. Select <i><b>Deployments</b></i> from the <i>Domain Structure</i> tree and select the <i>DbAdapter</i> application. Click <i><b>Update</b></i> to update the application.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqqvyC3uRI/AAAAAAAAAvg/7Exm7WyWuI4/s1600/FAQ25.1.26.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqqvyC3uRI/AAAAAAAAAvg/7Exm7WyWuI4/s320/FAQ25.1.26.png" width="320" /></a></div><br />
In the <i>Update Application Assistant</i> page select the <i><b>Redeploy this application using the following deployment files:</b></i> radio button and click <i><b>Finish</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqrknUEwhI/AAAAAAAAAvk/WL7976o1nYU/s1600/FAQ25.1.27.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="195" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqrknUEwhI/AAAAAAAAAvk/WL7976o1nYU/s320/FAQ25.1.27.png" width="320" /></a></div><br />
If all went well you should see these success messages:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqsE8eHcaI/AAAAAAAAAvo/DIopoNiYZuw/s1600/FAQ25.1.28.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="171" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqsE8eHcaI/AAAAAAAAAvo/DIopoNiYZuw/s320/FAQ25.1.28.png" width="320" /></a></div><br />
<br />
<i><u>Deploying the composite</u></i><br />
<br />
Now we can deploy the composite to WLS. Create a connection to WLS, right-click on the project in the <i>Application Navigator</i> and select <i><b>Deploy</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqyYwyomdI/AAAAAAAAAv0/yAkRsomMJU8/s1600/FAQ25.1.29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="173" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAqyYwyomdI/AAAAAAAAAv0/yAkRsomMJU8/s320/FAQ25.1.29.png" width="320" /></a></div><br />
In the <i>Deployment Action</i> page of the <i>Deploy</i> wizard select <i><b>Deploy to Application Server</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAqy8fZIuAI/AAAAAAAAAv4/W0aBUlaI6p0/s1600/FAQ25.1.30.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAqy8fZIuAI/AAAAAAAAAv4/W0aBUlaI6p0/s320/FAQ25.1.30.png" width="320" /></a></div><br />
Click <i><b>Next</b></i> on the <i>Deploy Configuration</i> page. Select your WLS connection on the <i>Select Server</i> page and click <i><b>Next</b></i>. On the <i>SOA Servers</i> select your SOA server and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqz7-0KAuI/AAAAAAAAAv8/ZICFOyELy0c/s1600/FAQ25.1.31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAqz7-0KAuI/AAAAAAAAAv8/ZICFOyELy0c/s320/FAQ25.1.31.png" width="320" /></a></div><br />
Verify the deployment summary on the <i>Summary</i> page and click <i><b>Finish</b></i> to start the deployment. If everything went OK you should see a <i>BUILD SUCCESSFUL</i> message in the <i>SOA Log</i> window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAq09ltESRI/AAAAAAAAAwA/rN2bYW4BGrU/s1600/FAQ25.1.32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="88" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAq09ltESRI/AAAAAAAAAwA/rN2bYW4BGrU/s320/FAQ25.1.32.png" width="320" /></a></div><br />
The <i>Deployment Log</i> window should also indicate that the deployment went OK.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAq11QF8S5I/AAAAAAAAAwE/loERV9drlYI/s1600/FAQ25.1.33.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="100" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAq11QF8S5I/AAAAAAAAAwE/loERV9drlYI/s320/FAQ25.1.33.png" width="320" /></a></div><br />
<u><i>Testing the composite</i></u><br />
<br />
To test the composite log in to the Enterprise Manager Fusion Middleware Control and click on the <i>EmployeeInquirer </i>composite on the SOA navigation tree. Then click on the <i><b>Test</b></i> tab.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAq3sBEeJeI/AAAAAAAAAwI/pBFJoGGhv7g/s1600/FAQ25.1.34.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="73" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAq3sBEeJeI/AAAAAAAAAwI/pBFJoGGhv7g/s320/FAQ25.1.34.png" width="320" /></a></div><br />
On the <i>Test Web Service</i> page go the bottom of the page to the <i>Input Arguments</i> section and enter an Employee Id value - let's say 100, for the <i>EmployeeId</i> element of the request. Then click on the <i><b>Test Web Service</b></i> button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAq454ySZxI/AAAAAAAAAwM/qCoKiGa1V6A/s1600/FAQ25.1.35.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="151" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAq454ySZxI/AAAAAAAAAwM/qCoKiGa1V6A/s320/FAQ25.1.35.png" width="320" /></a></div><br />
The web service is executed and if everything goes OK the response will be shown on the <i>Response </i>tab.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAq555EEgEI/AAAAAAAAAwQ/iHsdPlvPPD0/s1600/FAQ25.1.36.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAq555EEgEI/AAAAAAAAAwQ/iHsdPlvPPD0/s320/FAQ25.1.36.png" width="320" /></a></div><br />
This concludes our introduction to SOA Suite 11g.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
In this series of posts we've seen how to get started with the SOA Suite 11g, from its installation to composite development - utilizing some of the basic components in JDeveloper, to testing the composite using Enterprise Manager Fusion Middleware Control. This just scratched the surface. SOA Suite is a vast technology with much more to offer.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Code</span></b><br />
<br />
<a href="http://code.google.com/p/jdeveloperfaq/downloads/detail?name=JDeveloperFAQNo25.rar&can=2&q=">http://code.google.com/p/jdeveloperfaq/downloads/detail?name=JDeveloperFAQNo25.rar&can=2&q=</a><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/06/faq-25-how-to-get-started-with-soa.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/10/faq-26-how-to-install-jdeveloper-in.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0tag:blogger.com,1999:blog-8484416608670642843.post-41912630725552307552010-06-06T03:17:00.000-07:002010-11-09T06:29:01.698-08:00FAQ #24 - How to get started with SOA Suite 11g R1, Pt. 3<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
In this third part of getting started with SOA Suite 11g we will continue the example that we started in part two by introducing a <i>Web Service</i> binding to our project.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
Start by opening the <i>EmployeeInquirer </i>project in JDeveloper. Prior to creating the Web Service binding for our project, the necessary XML schema definition (XSD) file describing the web service request, reply and error must be constructed. We will create a new XSD file by selecting <i><b>File | New...</b></i> and <i><b>XML Schema</b></i> from the <i>General | XML</i> category of the <i>New Gallery</i> dialog.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoHk7pzH0I/AAAAAAAAAtA/WS30-54xqI8/s1600/FAQ24.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoHk7pzH0I/AAAAAAAAAtA/WS30-54xqI8/s320/FAQ24.1.png" width="320" /></a></div><br />
In the <i>Create XML Schema</i> dialog enter the schema <i>File Name</i> and <i>Target Namespace</i> as it is shown below and click <i><b>OK</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoIxG8JutI/AAAAAAAAAtE/Hj06UEyt8n4/s1600/FAQ25.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoIxG8JutI/AAAAAAAAAtE/Hj06UEyt8n4/s320/FAQ25.2.png" width="320" /></a></div><br />
JDeveloper will proceed with creating the XSD file and it will open it in the <i>Design</i> editor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAoJ7pzJ1zI/AAAAAAAAAtI/LVLQ9tfsoIg/s1600/FAQ25.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAoJ7pzJ1zI/AAAAAAAAAtI/LVLQ9tfsoIg/s320/FAQ25.3.png" width="320" /></a></div><br />
The first thing we will do is rename the <i>exampleElement</i> generated by default to <i>employeeInfoRequest</i>. You can do this by selecting the element in the Design editor and changing its <i>name</i> attribute in the <i>Property Inspector</i>. If the<i> Property Inspector</i> is not shown, select <i><b>View | Property Inspector</b></i> from the menu to display it.<br />
<br />
Next, right-click on the <i>employeeInfoRequest </i>element and select <i><b>Insert inside element | sequence</b></i> to create a xsd:sequence.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAoMbLLxiFI/AAAAAAAAAtM/TNuWX-E4eSU/s1600/FAQ25.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="267" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAoMbLLxiFI/AAAAAAAAAtM/TNuWX-E4eSU/s320/FAQ25.4.png" width="320" /></a></div><br />
Similarly right-click on the newly created sequence and select <i><b>Insert inside sequence | element</b></i> to create the employee's id element for the request.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAoOOCzR4bI/AAAAAAAAAtQ/RZlFX9sBXaU/s1600/FAQ25.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="250" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAoOOCzR4bI/AAAAAAAAAtQ/RZlFX9sBXaU/s320/FAQ25.5.png" width="320" /></a></div><br />
Select the newly created element and change its name to <i>EmployeeId</i> and its type to <i>xsd:string</i> in the <i>Property Inspector</i>.<br />
<br />
Now let's create two more XSD elements: one for the web service reply and another to store an error message. Your final XSD should look like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAoTOd1EK1I/AAAAAAAAAtU/6GIHB1wI4fU/s1600/FAQ25.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="183" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAoTOd1EK1I/AAAAAAAAAtU/6GIHB1wI4fU/s320/FAQ25.6.png" width="320" /></a></div><br />
Now we are ready to create the web service binding. Switch to the composite <i>Design</i>, grab the <i>Web Service</i> icon from the <i>Component Palette</i> and drop it on the <i>Exposed Services</i> of the design canvas. This will initiate the <i>Create Web Service</i> wizard.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAoVAeLVKmI/AAAAAAAAAtY/QyRIlPRzOus/s1600/FAQ25.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAoVAeLVKmI/AAAAAAAAAtY/QyRIlPRzOus/s320/FAQ25.7.png" width="320" /></a></div><br />
Enter <i>getEmployeeInfoById</i> for the name of the web service and click the <i>gear </i>icon next to the <i>WSDL URL</i> edit box to generate the web service WSDL. This will bring up the <i>Create WSDL</i> dialog where we will specify the web service message schemas.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAoWDin0mEI/AAAAAAAAAtc/1a1cqMY7l3w/s1600/FAQ25.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAoWDin0mEI/AAAAAAAAAtc/1a1cqMY7l3w/s320/FAQ25.8.png" width="320" /></a></div><br />
With the <i>Request </i>tab selected, click on the <i>magnifying glass</i> icon next to the <i>URL</i> edit field and browse for the XSD file that you created earlier. In the <i>Type Chooser</i> dialog that is presented, expand the <i>Project Schema Files</i> and the <i>EmployeeInquirer.xsd</i> nodes and select employeeInfoRequest.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoX3A5GUHI/AAAAAAAAAtg/gDiFJgR_o68/s1600/FAQ25.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoX3A5GUHI/AAAAAAAAAtg/gDiFJgR_o68/s320/FAQ25.9.png" width="320" /></a></div><br />
Repeat for the <i>Reply </i>and <i>Fault </i>tabs of the <i>Create WSDL</i> dialog selecting <i>employeeInfoReply </i>and <i>employeeInfoError </i>respectively. When done click OK on the <i>Create WSDL</i> dialog. The Create Web Service dialog should look like this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAocjZawEmI/AAAAAAAAAtk/EITdxndOINk/s1600/FAQ25.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="229" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAocjZawEmI/AAAAAAAAAtk/EITdxndOINk/s320/FAQ25.10.png" width="320" /></a></div><br />
Finally click <i><b>OK</b></i> on the <i>Create Web Service</i> dialog to complete the creation of the web service. The composite should now look as it is shown below with the <i>getEmployeeInfoById</i> web service shown on the <i>Exposed Services</i> part of the design canvas.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoeVp0wmKI/AAAAAAAAAts/vdMLINI10pI/s1600/FAQ25.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAoeVp0wmKI/AAAAAAAAAts/vdMLINI10pI/s320/FAQ25.11.png" width="320" /></a></div><br />
This concludes the creation of the Web Service binding.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
In this part we created a <i>Web Service</i> binding for our <i>EmployeeInquirer</i> composite. We will complete and test the composite in the next part by wiring the web service to the <i>Database Adapter</i> that we developed previously using a <i>Mediator</i> component.<br />
<br />
Until the next time keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-23-how-to-get-started-with-soa.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/06/faq-25-how-to-get-started-with-soa.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0tag:blogger.com,1999:blog-8484416608670642843.post-36491507750652511282010-05-29T14:47:00.000-07:002010-11-09T06:28:43.706-08:00FAQ #23 - How to get started with SOA Suite 11g R1, Pt. 2<b><span class="Apple-style-span" style="font-size: large;">Introduction </span></b><br />
<br />
In <a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-22-how-to-get-started-with-soa.html">FAQ #22 - How to get started with SOA Suite 11g R1, Pt. 1</a> we covered the installation of SOA Suite 11g R1 on a development environment. We will continue in this part with setting up the SOA development environment in JDeveloper and developing a simple <i>Database Adapter Service</i> to return the Employee's information from the HR schema. Let's get down to it.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<i><u>Creating the Database Adapter service</u></i><br />
<br />
To develop SOA projects in JDeveloper an additional extension, called <i>SOA Composite Editor,</i> must be installed. The extension can be downloaded either via the JDeveloper <i><b>Help | Check for Updates...</b></i> menu option or directly from the <a href="http://www.oracle.com/technology/products/jdev/101/update/fmw_products.xml#oracle.sca.modeler">Oracle Fusion Middleware Products Update Center</a> web site.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAFfXK4TbhI/AAAAAAAAAsA/VQUxNGYUBaE/s1600/FAQ23.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAFfXK4TbhI/AAAAAAAAAsA/VQUxNGYUBaE/s320/FAQ23.1.png" width="320" /></a></div><br />
<br />
Once downloaded and installed it makes available additional functionality to support developing SOA projects. To begin with your first SOA application, start JDeveloper and from the <i><b>File | New...</b></i> menu create a <i><b>SOA Application</b></i> using the <i><b>New Gallery</b></i> wizard.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFhEfnlndI/AAAAAAAAAsE/jzOfDFdohKs/s1600/FAQ23.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFhEfnlndI/AAAAAAAAAsE/jzOfDFdohKs/s320/FAQ23.2.png" width="320" /></a></div><br />
On the <i><b>Name your application</b></i> page of the wizard enter the application name. Specify your project name on the <i><b>Name your project</b></i> page of the wizard. For the purpose of this example, we will call the project <i>EmployeeInquirer</i>. When asked to select a<i> Composite Template</i> on the <i><b>Configure SOA settings</b></i> page, select an <i><b>Empty Composite</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFo5DPj9VI/AAAAAAAAAsI/AGxuAMr6JtU/s1600/FAQ23.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFo5DPj9VI/AAAAAAAAAsI/AGxuAMr6JtU/s320/FAQ23.3.png" width="320" /></a></div><br />
Finally click <i><b>Finish</b></i> to complete the creation of the SOA application and its project. JDeveloper will proceed to create the project artifacts and display the composite <i>Design</i> screen as shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAFp2oVfolI/AAAAAAAAAsM/IBgsbcqMgfI/s1600/FAQ23.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="187" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/TAFp2oVfolI/AAAAAAAAAsM/IBgsbcqMgfI/s320/FAQ23.4.png" width="320" /></a></div><br />
As you can see, the composite is presented divided in 3 sections: <i>Exposed Services</i>, <i>Components</i> and <i>External References</i>. For this example, we will add a <i>Database Adapter Service </i>to the <i>External References</i> section. So grab a <i>Database Adapter</i> from the <i>Service Adapters</i> section of the <i>SOA Component Palette</i> and drop it to the <i>External References</i> section of the composite design canvas. This will start the <i><b>Adapter Configuration</b></i> wizard. Click <i><b>Next</b></i> on the <i><b>Welcome</b></i> screen. On the <i><b>Service Name</b></i> page specify the service name for the <i>Database Adapter</i>. For the purpose of this example let's call the service name <i>getEmployeeInfo</i>. This service will return some employee information based on some input.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFsnQuIWEI/AAAAAAAAAsQ/rRAQa6cRj0E/s1600/FAQ23.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFsnQuIWEI/AAAAAAAAAsQ/rRAQa6cRj0E/s320/FAQ23.5.png" width="320" /></a></div><br />
On the <i><b>Service Connection</b></i> page we will specify a connection to the HR schema in our database. You can do the connection right from this page by clicking the green plus icon.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFzH2uoUCI/AAAAAAAAAsU/v5S4g6jNZC8/s1600/FAQ23.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAFzH2uoUCI/AAAAAAAAAsU/v5S4g6jNZC8/s320/FAQ23.6.png" width="320" /></a></div><br />
Notice that based on the connection name that we specified - <i>HrConnection</i> - a default JNDI name - <i>eis/DB/HrConnection</i> - was generated. Before deploying the application to the application server, we must create and configure this database resource. For now we will continue with the <i>Adapter Configuration</i> by clicking <i><b>Next</b></i>. On the <i><b>Operation Type</b></i> page we will select <i><b>Perform an Operation on a Table</b></i> and then check on <i><b>Select</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF14uu2fzI/AAAAAAAAAsY/t3Xs3Le2BlA/s1600/FAQ23.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF14uu2fzI/AAAAAAAAAsY/t3Xs3Le2BlA/s320/FAQ23.7.png" width="320" /></a></div><br />
Clicking <b><i>Next </i></b>will present the <i><b>Select Table</b></i> page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF2xcuEm0I/AAAAAAAAAsc/lT3i32radpI/s1600/FAQ23.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF2xcuEm0I/AAAAAAAAAsc/lT3i32radpI/s320/FAQ23.8.png" width="320" /></a></div><br />
<br />
On this page click on the <i><b>Import Tables...</b></i> button to import the <i>EMPLOYEES</i> table from the <i>HR</i> schema. On the Import Tables dialog click <i><b>Query</b></i> to query the database tables, select the <i>EMPLOYEES</i> table and shuttle it to the <i>Selected</i> section of the dialog.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF3enMnpQI/AAAAAAAAAsg/i670NJiRFU4/s1600/FAQ23.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF3enMnpQI/AAAAAAAAAsg/i670NJiRFU4/s320/FAQ23.9.png" width="320" /></a></div><br />
Now click <i><b>OK</b></i> to bring the selected <i>EMPLOYEES</i> table to the <i><b>Select Table</b></i> page of the <i>Adapter Configuration</i> wizard.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF4H8pHQWI/AAAAAAAAAsk/aSLXD7gykN0/s1600/FAQ23.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF4H8pHQWI/AAAAAAAAAsk/aSLXD7gykN0/s320/FAQ23.10.png" width="320" /></a></div><br />
Click <i><b>Next</b></i> and once more <i><b>Next</b></i> on the <i><b>Relationships</b></i> page. On the <i><b>Attribute Filtering</b></i> page select only the <i>firstName</i> and <i>lastName</i> attributes and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAF5XYcYu-I/AAAAAAAAAso/gZSmxMOVO30/s1600/FAQ23.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAF5XYcYu-I/AAAAAAAAAso/gZSmxMOVO30/s320/FAQ23.11.png" width="320" /></a></div><br />
On the <i><b>Define Selection Criteria</b></i> page, we will add a parameter to the query. This parameter will be set to the Employee's identifier at runtime. So click on the <i><b>Add...</b></i> button in the <i>Parameters</i> section and enter <i>inEmployeeId</i> as the parameter name on the <i><b>Parameter Name</b></i> dialog.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF6esR-RrI/AAAAAAAAAss/Ld6w8aNI7Yc/s1600/FAQ23.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="267" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF6esR-RrI/AAAAAAAAAss/Ld6w8aNI7Yc/s320/FAQ23.12.png" width="320" /></a></div><br />
While on the <i><b>Define Selection Criteria</b></i> page, click on the <i><b>Edit..</b></i> button. This will bring up the <i><b>Expression Builder</b></i> dialog. Click the <i><b>Add...</b></i> button on the <i><b>Expression Builder</b></i> dialog and specify the expression <i>employeeId EQUAL inEmployeeId</i> by selecting <i>employeeId</i> for the <i>First Argument</i>, <i>EQUAL</i> for the <i>Operator</i> and the <i>Parameter inEmployeeId</i> for the <i>Second Argument</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF8RWf5zaI/AAAAAAAAAsw/IFE0vmZ-5u8/s1600/FAQ23.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="278" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF8RWf5zaI/AAAAAAAAAsw/IFE0vmZ-5u8/s320/FAQ23.13.png" width="320" /></a></div><br />
The SQL on the <i><b>Define Selection Criteria</b></i> page of the wizard should look like this now:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF87FK9jrI/AAAAAAAAAs0/qeM7_dsHuYw/s1600/FAQ23.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/TAF87FK9jrI/AAAAAAAAAs0/qeM7_dsHuYw/s320/FAQ23.14.png" width="320" /></a></div><br />
Click <i><b>Next </b></i>to go to the <i><b>Advanced Options</b></i> page. Leave the recommended options as they are and click <i><b>Next</b></i> once more. On the last page click <i><b>Finish</b></i> to complete the definition of the <i>getEmployeeInfo Database Adapter Service</i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAF99yRXRQI/AAAAAAAAAs4/_-27WKR9tU4/s1600/FAQ23.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="266" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/TAF99yRXRQI/AAAAAAAAAs4/_-27WKR9tU4/s320/FAQ23.15.png" width="320" /></a></div><br />
JDeveloper proceeds with the creation of the <i>getEmployeeInfo Database Adapter Service</i> and displays it on the <i>External References</i> section of the composite design canvas.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF-r9dF9iI/AAAAAAAAAs8/-Lvojr9yULQ/s1600/FAQ23.16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="199" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/TAF-r9dF9iI/AAAAAAAAAs8/-Lvojr9yULQ/s320/FAQ23.16.png" width="320" /></a></div><br />
This concludes the creation of the Database Adapter Service.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
In this part we setup the environment in JDeveloper for developing SOA applications. We created a simple Database Adapter Service called <i>getEmployeeInfo</i> for inquiring an Employee based on the Employee's identifier. We will continue this introduction to SOA development next time by creating a Web Service binding and hooking it up to the <i>getEmployeeInfo</i> Database Adapter service.<br />
<br />
Until the next time keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-22-how-to-get-started-with-soa.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/06/faq-24-how-to-get-started-with-soa.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0tag:blogger.com,1999:blog-8484416608670642843.post-69777952435181763622010-05-24T13:35:00.000-07:002010-11-09T06:28:21.992-08:00FAQ #22 - How to get started with SOA Suite 11g R1, Pt. 1<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
In this series of posts, we will examine some basic steps of getting started with Oracle SOA Suite. This first part deals with the software installation and configuration on a simple development environment running on Windows. Installing SOA Suite 11g is a series of steps that include a database installation, installation of WLS, installation of the SOA Suite software itself, creation of the repository and finally configuration. We will install the latest available version today, SOA Suite 11gR1 Patch Set 2 (11.1.1.3.0). Since SOA Suite 11gR1 Patch Set 2 (11.1.1.3.0) is a point release, installing it also requires that first SOA Suite 11g R1 Patch Set 1 (11.1.1.2.0) be installed and then upgrading it.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
To install SOA Suite 11g R1 Patch Set 2 (11.1.1.3.0) follow the steps below in order:<br />
<br />
<i><u>1. Installation of WLS 10.3.3</u></i><br />
<i><u><br />
</u></i><br />
The first step of installing SOA Suite would be to install WebLogic 10.3.3. It can be downloaded from the <a href="http://www.oracle.com/technology/software/products/middleware/htdocs/fmw_11_download.html">Oracle Fusion Middleware 11gR1 Software Downloads</a> page. Start the installation of WLS by executing <i><b>wls1033_win32.exe</b></i>. Click <b><i>Next </i></b>on the first page and on the <b><i>Choose Middleware Home Directory</i></b> select <b><i>Create a new Middleware Home</i></b>. Enter the new middleware home directory.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mMfL9K0QI/AAAAAAAAAo8/vyPDnMakxC8/s1600/FAQ22.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mMfL9K0QI/AAAAAAAAAo8/vyPDnMakxC8/s320/FAQ22.1.png" /></a></div><br />
On the <b><i>Register for Security Updates</i></b> page you can choose not to receive security updates and safely ignore the warning message that is displayed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mOAJzicjI/AAAAAAAAApE/akuzNDQuOt0/s1600/FAQ22.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mOAJzicjI/AAAAAAAAApE/akuzNDQuOt0/s320/FAQ22.2.png" /></a></div><br />
On the <b><i>Choose Install Type</i></b> you can select <b><i>Typical</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_mOji9-8fI/AAAAAAAAApM/bhDPhPevRAw/s1600/FAQ22.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_mOji9-8fI/AAAAAAAAApM/bhDPhPevRAw/s320/FAQ22.3.png" /></a></div><br />
Verify or change the installation directories on the <i><b>Choose Product Installation Directories</b></i> page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mO8108VSI/AAAAAAAAApU/SDldnKkS-ik/s1600/FAQ22.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mO8108VSI/AAAAAAAAApU/SDldnKkS-ik/s320/FAQ22.4.png" /></a></div><br />
In the <i><b>Choose Shortcut Location</b></i> page select <i><b>"All Users" Start Menu folder</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mPje5Kw_I/AAAAAAAAApc/ejQI7YTV0e4/s1600/FAQ22.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mPje5Kw_I/AAAAAAAAApc/ejQI7YTV0e4/s320/FAQ22.5.png" /></a></div><br />
Verify your installation selections on the <i><b>Installation Summary</b></i> page and click <b><i>Next </i></b>to start the installation.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mQEC__b-I/AAAAAAAAApk/rwYtqWjHAoY/s1600/FAQ22.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mQEC__b-I/AAAAAAAAApk/rwYtqWjHAoY/s320/FAQ22.6.png" /></a></div><br />
<br />
<i><u>2. Installation of SOA Suite 11g R1 Patch Set 1 (11.1.1.2.0)</u></i><br />
<br />
You can download SOA Suite 11g R1 Patch Set 1 from the <a href="http://www.oracle.com/technology/software/products/middleware/htdocs/fmw_11_download.html">Oracle Fusion Middleware 11gR1 Software Downloads</a> page. Once downloaded, unzip the <i><b>ofm_soa_generic_11.1.1.2.0_disk1_1of1.zip</b></i> file into a temporary directory and start the installation by going to the <i><b>Disk1</b></i><b> </b>folder and typing <i><b>Setup -jreLoc %JROCKIT_JRE%</b></i>, where <i>%JROCKIT_JRE%</i> is the location of the JRockit JRE.<br />
<br />
Click <b><i>Next</i></b> on the <i><b>Welcome</b></i> page. After the successful checks for the necessary prerequisites on the <i><b>Prerequisite Checks</b></i> page click <i><b>Next</b></i>. On the <i><b>Specify Installation Location</b></i> ensure that you select the middleware home where you previously installed WLS 10.3.3, specify the home directory - defaults to <i>Oracle_SOA1</i>, and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mfC0k8URI/AAAAAAAAAps/iN5erF9ksAM/s1600/FAQ22.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mfC0k8URI/AAAAAAAAAps/iN5erF9ksAM/s320/FAQ22.7.png" /></a></div><br />
On the <i><b>Installation Summary</b></i> page verify the installation selections and press <b><i>Install </i></b>to start the installation.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_mfn3gS9hI/AAAAAAAAAp0/oN1WZa5YJi8/s1600/FAQ22.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_mfn3gS9hI/AAAAAAAAAp0/oN1WZa5YJi8/s320/FAQ22.8.png" /></a></div><br />
When the installation completes, click <i><b>Next</b></i> and finally <i><b>Finish</b></i> on the <i><b>Installation Complete</b></i> page.<br />
<br />
<i><u>3. Installation of SOA Suite 11g R2 Patch Set 2 (11.1.1.3.0)</u></i><br />
<i><u><br />
</u></i><br />
Download SOA Suite 11g R2 Patch Set 2 from the <a href="http://www.oracle.com/technology/software/products/middleware/htdocs/fmw_11_download.html">Oracle Fusion Middleware 11gR1 Software Downloads</a> page. Once downloaded, unzip the <i><b>ofm_soa_generic_11.1.1.3.0_disk1_1of1.zip</b></i> file in a temporary directory and start the installation by going to the <i><b>Disk1</b></i> directory and typing <i><b>Setup -jreLoc %JROCKIT_JRE%</b></i>, where <i>%JROCKIT_JRE%</i> is the location of the JRockit JRE.<br />
<br />
Click <b><i>Next </i></b>on the <i><b>Welcome</b></i> page. On the <i><b>Specify Installation Location</b></i> page middleware home and middleware home directory where you previously installed the SOA Suite 11g R1 Patch Set 1.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mjiqZEj4I/AAAAAAAAAp8/1svxXFe9P7M/s1600/FAQ22.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mjiqZEj4I/AAAAAAAAAp8/1svxXFe9P7M/s320/FAQ22.9.png" /></a></div><br />
On the <i><b>Installation Summary</b></i> screen click <i><b>Install</b></i> to start the installation.<br />
<i><u><br />
</u></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mkBLlakqI/AAAAAAAAAqE/GkYi7eKAdzU/s1600/FAQ22.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mkBLlakqI/AAAAAAAAAqE/GkYi7eKAdzU/s320/FAQ22.10.png" /></a></div><i><u><br />
</u></i><br />
When the installation is complete click <i><b>Next</b></i> on the <i><b>Installation Progress</b></i> page and finally <i><b>Finish</b></i> on the <i><b>Installation Complete</b></i> screen.<br />
<i><u><br />
</u></i><br />
<i><u>4. Installing the Repository</u></i><br />
<i><u><br />
</u></i><br />
Download the RCU Repository Creation Utility 11.1.1.3.0 from the Required Additional Software section of the <a href="http://www.oracle.com/technology/software/products/middleware/htdocs/fmw_11_download.html">Oracle Fusion Middleware 11gR1 Software Downloads</a> page. Once downloaded, unzip the <i><b>ofm_rcu_win_11.1.1.3.0_disk1_1of1.zip</b></i> file in a temporary directory. Start the installation of the repository by going to the <i><b>rcuHome\BIN</b></i> directory and running the <i><b>rcu.bat</b></i> batch file.<br />
<br />
On the <i><b>Create Repository</b></i> page select <i><b>Create</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mnp-Ucf7I/AAAAAAAAAqM/ERmGBkTPGyQ/s1600/FAQ22.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_mnp-Ucf7I/AAAAAAAAAqM/ERmGBkTPGyQ/s320/FAQ22.11.png" /></a></div><br />
Specify the database information in the <i><b>Database Connection Details</b></i> page and click <i><b>Next</b></i>.<br />
<i><u><br />
</u></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_moI0tv4iI/AAAAAAAAAqU/OmdxXjq4bD0/s1600/FAQ22.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_moI0tv4iI/AAAAAAAAAqU/OmdxXjq4bD0/s320/FAQ22.12.png" /></a></div><br />
RCU will start a series of prerequisite checks and inform you of the status.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_mojApAXfI/AAAAAAAAAqc/yMtgoIWT3sQ/s1600/FAQ22.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_mojApAXfI/AAAAAAAAAqc/yMtgoIWT3sQ/s320/FAQ22.13.png" /></a></div><br />
Click <i><b>OK</b></i> on the <i><b>Checking Prerequisites</b></i> dialog to proceed. On the <i><b>Select Components</b></i> page, select <i><b>Create a new Prefix</b></i> and enter a prefix or keep the default. Select the components to install from the <i>Component </i>tree and click <b><i>Next</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mqQ2SP0YI/AAAAAAAAAqk/uUMxr4fJQXk/s1600/FAQ22.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_mqQ2SP0YI/AAAAAAAAAqk/uUMxr4fJQXk/s320/FAQ22.14.png" /></a></div><br />
RCU will proceed with checking the specific component prerequisites based on the components that you have selected. Verify that the prerequisites are all met and click <b><i>OK </i></b>in the <i><b>Checking Prerequisites</b></i> dialog.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_o1mGiSTLI/AAAAAAAAAqw/b3F_lXJrDlw/s1600/FAQ22.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="242" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_o1mGiSTLI/AAAAAAAAAqw/b3F_lXJrDlw/s320/FAQ22.15.png" width="320" /></a></div><br />
On the <i><b>Schema Passwords</b></i> page, enter the passwords for the schemas and click <i><b>Next</b></i>.<br />
<br />
<span id="goog_564975053"></span><span id="goog_564975054"></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_o2c2wgWzI/AAAAAAAAAq0/9rBfCgTOdE8/s1600/FAQ22.16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_o2c2wgWzI/AAAAAAAAAq0/9rBfCgTOdE8/s320/FAQ22.16.png" width="320" /></a></div><i><u><br />
</u></i><br />
Verify the tablespaces that will be created on the <i><b>Map Tablespaces</b></i> page and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_o25uSU6gI/AAAAAAAAAq4/QSyro1-uXIs/s1600/FAQ22.17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_o25uSU6gI/AAAAAAAAAq4/QSyro1-uXIs/s320/FAQ22.17.png" width="320" /></a></div><br />
After clicking <b><i>OK </i></b>on the warning regarding the creation of non-existing tablespaces, RCU will proceed with creating the necessary tablespaces. Once the tablespaces are created, click <i><b>OK</b></i> on the <i><b>Creating Tablespaces</b></i> dialog to proceed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_o35aermaI/AAAAAAAAAq8/7jFE8pxcFnc/s1600/FAQ22.18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_o35aermaI/AAAAAAAAAq8/7jFE8pxcFnc/s320/FAQ22.18.png" width="320" /></a></div><br />
On the <i><b>Summary</b></i> page verify your selections and click <i><b>Create</b></i> to proceed with the creation of the repository.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_o4Ufj3vII/AAAAAAAAArA/v-qEIYfHlGk/s1600/FAQ22.19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_o4Ufj3vII/AAAAAAAAArA/v-qEIYfHlGk/s320/FAQ22.19.png" width="320" /></a></div><br />
RCU will now proceed creating the selected schemas. When done, a <i><b>Competition Summary</b></i> dialog is displayed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_pSzEqnYZI/AAAAAAAAArE/vGZxQOLKd6I/s1600/FAQ22.20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_pSzEqnYZI/AAAAAAAAArE/vGZxQOLKd6I/s320/FAQ22.20.png" width="320" /></a></div><br />
<i><u>5. Configuring SOA Suite 11g</u></i><br />
<br />
Before using SOA Suite 11g, it must be configured. To start the configuration select <i><b>Configure Application Server</b></i> from the newly created <i><b>Oracle SOA 11g - Home1</b></i> Start Menu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_rU6HrjTII/AAAAAAAAArI/l0QH9GBOsjk/s1600/FAQ22.21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_rU6HrjTII/AAAAAAAAArI/l0QH9GBOsjk/s1600/FAQ22.21.png" /></a></div><br />
This will start the <i>Fusion Middleware Configuration Wizard</i>. On the <i><b>Welcome</b></i> page select <i><b>Create a new WebLogic domain</b></i> and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rXPvOLOeI/AAAAAAAAArM/mFGzQV_UIz4/s1600/FAQ22.22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rXPvOLOeI/AAAAAAAAArM/mFGzQV_UIz4/s320/FAQ22.22.png" width="320" /></a></div><br />
On the <i><b>Select Domain Source</b></i> page select the products that will be supported by the domain and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rX39AIqsI/AAAAAAAAArQ/Oka79k2e0DQ/s1600/FAQ22.23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rX39AIqsI/AAAAAAAAArQ/Oka79k2e0DQ/s320/FAQ22.23.png" width="320" /></a></div><br />
Enter the domain name on the <i><b>Specify Domain Name and Location</b></i> screen and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rYe2mkYvI/AAAAAAAAArY/bkuCszIJyEk/s1600/FAQ22.24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rYe2mkYvI/AAAAAAAAArY/bkuCszIJyEk/s320/FAQ22.24.png" width="320" /></a></div><br />
On the <i><b>Configure Administrator User Name and Password</b></i> page enter the name and password of the domain administrator user and click <i><b>Next</b></i>. Select the domain startup mode and JDK on the <i><b>Configure Server Start Mode and JDK</b></i> screen and click <i><b>Next</b></i>.<br />
<br />
On the <i><b>Configure JDBC Component Schema</b></i> page enter the SOA repository database connection settings.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_raPeSCkXI/AAAAAAAAArc/SCCa4l8GjJU/s1600/FAQ22.25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_raPeSCkXI/AAAAAAAAArc/SCCa4l8GjJU/s320/FAQ22.25.png" width="320" /></a></div><br />
If your connection details are correct, you should see a success check mark on the <i><b>Test Component Schema</b></i> screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rbSPRWc2I/AAAAAAAAArg/-cFtRWDLk-8/s1600/FAQ22.26.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rbSPRWc2I/AAAAAAAAArg/-cFtRWDLk-8/s320/FAQ22.26.png" width="320" /></a></div><br />
On the <i><b>Select Optional Configuration</b></i> screen click on <i><b>Administration Server</b></i> and on <i><b>Managed Servers, Clusters and Machines</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_rbssoopPI/AAAAAAAAArk/1qZvYbhOXFU/s1600/FAQ22.27.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_rbssoopPI/AAAAAAAAArk/1qZvYbhOXFU/s320/FAQ22.27.png" width="320" /></a></div><br />
You can choose the default administration server name on the <i><b>Configure the Administration Server</b></i> page and click <i><b>Next</b></i>. On the <i><b>Configure Managed Servers</b></i> page, enter the names of managed servers.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_rcd2K1QyI/AAAAAAAAAro/QbLFOozs9lM/s1600/FAQ22.28.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S_rcd2K1QyI/AAAAAAAAAro/QbLFOozs9lM/s320/FAQ22.28.png" width="320" /></a></div><br />
Do not configure any clusters on the <i><b>Configure Clusters</b></i> page. On the <i><b>Configure Machines</b></i> page accept the defaults and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rdqCyNlfI/AAAAAAAAArw/u-C3j87DvEo/s1600/FAQ22.29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S_rdqCyNlfI/AAAAAAAAArw/u-C3j87DvEo/s320/FAQ22.29.png" width="320" /></a></div><br />
Accept the default configuration on the <i><b>Assign Servers to Machines</b></i> page and click <i><b>Next</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_reAJRHs7I/AAAAAAAAAr0/pBZYazg9tGA/s1600/FAQ22.30.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_reAJRHs7I/AAAAAAAAAr0/pBZYazg9tGA/s320/FAQ22.30.png" width="320" /></a></div><br />
On the <i><b>Configuration Summary</b></i> page verify your selections and click <i><b>Create</b></i> to start with the domain creation process. When all is done, you should see a <i>Domain Created Successfully!</i> screen.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_re4OTLoPI/AAAAAAAAAr8/JfEx8_mSbcI/s1600/FAQ22.31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S_re4OTLoPI/AAAAAAAAAr8/JfEx8_mSbcI/s320/FAQ22.31.png" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div>This concludes the installation of SOA Suite 11g.<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
In this part we discussed how to install SOA Suite 11g R1 Patch Set 2 (11.1.1.3.0). In subsequent parts we will get into the details of how to use JDeveloper to develop SOA applications.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/extension-intermission-1-subversion.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-23-how-to-get-started-with-soa.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com2tag:blogger.com,1999:blog-8484416608670642843.post-2495873450647670092010-05-13T14:05:00.000-07:002010-05-26T10:14:56.048-07:00Extension Intermission #1 - Subversion Monitor, Extension to monitor a Subversion repository<span style="font-size: large;"><b>Introduction</b></span><br />
<br />
There are at least a couple of utility programs that will let you monitor the commit activity on a Subversion repository both running on the Windows platform. Here is a third one, appropriately baptized <b><i>Subversion Monitor</i></b>, developed to run - of course - as a JDeveloper extension. <br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
<u><i>Installation</i></u><br />
<br />
To install <b><i>Subversion Monitor</i></b>, first download the <b><i>SubversionMonitor.zip</i></b> file from the link below and save it somewhere in your computer. Then start JDeveloper - it was developed and tested with the <i>Studio Edition Version 11.1.1.2.0 </i>version of JDeveloper - and select <b><i>Help | Check for Updates...</i></b> to bring up the <i><b>Check for Updates</b></i> dialog. Chose <b><i>Install From Local File</i></b> and then click on the <i><b>Browse...</b></i> button to browse for the <b><i>SubversionMonitor.zip</i></b> file you just downloaded.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S-xYQV7KWyI/AAAAAAAAAok/uFHWRcXQNOM/s1600/Extension1.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S-xYQV7KWyI/AAAAAAAAAok/uFHWRcXQNOM/s320/Extension1.1.png" width="320" /></a></div><br />
Click <b><i>Next</i></b> to proceed with the installation and in the <b><i>Summary</i></b> page click <i><b>Finish</b></i>. JDeveloper needs to re-start to finalize the installation, so in the <b><i>Confirm Exit</i></b> dialog that is presented click <i><b>Yes</b></i>.<br />
<br />
<u><i>Setting up</i></u><br />
<br />
Upon re-starting, JDeveloper should load the <b><i>Subversion Monitor</i></b> extension and notify you that it is unable to connect to the Subversion repository.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S-xdF94TnmI/AAAAAAAAAoo/DIsaMV473PY/s1600/Extension1.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S-xdF94TnmI/AAAAAAAAAoo/DIsaMV473PY/s1600/Extension1.2.png" /></a></div><br />
This is OK. You will need to setup the Subversion repository url along with your Subversion credentials. To do this, select <b><i>Preferences</i></b> from the <b><i>Tools</i></b> menu to bring up the <b><i>Subversion Monitor Preferences</i></b> dialog.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S-xegHzwWFI/AAAAAAAAAos/J1QttxOEYu8/s1600/Extension1.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S-xegHzwWFI/AAAAAAAAAos/J1QttxOEYu8/s320/Extension1.3.png" width="320" /></a></div><br />
Enter your Subversion repository URL, username and password in the dialog and uncheck the <b><i>Disable Monitoring</i></b> check-box. This will enable a timer to notify you when there is a new revision in your repository. Set the timer delay appropriately with the <b><i>Monitor Repository Every (seconds)</i></b> spinner. When done, click <b><i>OK</i></b> to see <b><i>Subversion Monitor</i></b> in action!<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S-xhDKHA06I/AAAAAAAAAow/SK8_laKcgAQ/s1600/Extension1.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="149" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S-xhDKHA06I/AAAAAAAAAow/SK8_laKcgAQ/s320/Extension1.4.png" width="320" /></a></div><br />
You can bring up the notification balloon on demand anytime by clicking on the team icon on the status bar. To disable the timer monitor, check the <b><i>Disable monitoring</i></b> check-box on the balloon. You can review the latest revisions by clicking anywhere else on the notification balloon. Doing so will bring up the <b><i>Revisions </i></b>editor.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S-xim9cFaGI/AAAAAAAAAo0/ieqy9HZJ7yE/s1600/Extension1.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S-xim9cFaGI/AAAAAAAAAo0/ieqy9HZJ7yE/s320/Extension1.5.png" width="320" /></a></div><br />
As you click on the revision in the <b><i>Revisions</i></b> table, the files that were changed for that revision will be displayed in the <b><i>Revision Files</i></b> panel at the bottom. The M flag in front of the file is the action on the file and it can be any of the M(odified), A(dded), D(eleted). You can set the number of top revisions to view using the <b><i>Maximum Revisions to View in Editor</i></b> spinner in the preferences page.<br />
<br />
As a final note, <i><b>Subversion Monitor</b></i> does not require that you configure versioning for Subversion in JDeveloper.<br />
<br />
<br />
<i><span class="Apple-style-span" style="font-size: x-small;">[Amended on May 17th, 2010]</span></i><br />
<i><b>Subversion Monitor</b></i> is now available directly from the <i>Open Source and Partners Extensions</i> of the JDeveloper <i><b>Help | Check for Updates...</b></i> feature!<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_GlSl7u65I/AAAAAAAAAo4/_jt_R6ooEvk/s1600/Extension1.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S_GlSl7u65I/AAAAAAAAAo4/_jt_R6ooEvk/s320/Extension1.6.png" width="320" /></a></div><br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
Enjoy monitoring your colleagues as they commit their changes using <b><i>Subversion Monitor</i></b>! Your comments, suggestions (, bug reports) are welcomed.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<span style="font-size: large;"><b>Extension</b></span><br />
<br />
<span style="font-size: x-small;"><a href="http://code.google.com/p/jdeveloperfaq/downloads/detail?name=SubversionMonitor.zip&can=2&q=">SubversionMonitor.zip</a></span><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-21-how-to-passivateactivate-adf.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-22-how-to-get-started-with-soa.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com13tag:blogger.com,1999:blog-8484416608670642843.post-32246041248078531892010-05-02T09:33:00.000-07:002010-11-09T06:25:49.974-08:00FAQ #21 - How to passivate/activate ADF Application Module class instance variables<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
If you are using instance variables in your <i>Application Module (AM)</i> class, as part of some algorithm in your application and you expect these variables to persist from one user request to another so that the algorithm works as expected, passivation (and activation) support for these variables must be added. This FAQ will show you how to do this and at the same time build a "mini sub-framework" to avoid duplication of the basic passivation-activation code that you must write for all your <i>AMs</i> in your project.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<u><i>Some Introductory Information</i></u><br />
<br />
<i><span class="Apple-style-span" style="font-style: normal;"><i>Application Module</i> pooling is the process of acquiring an <i>AM</i> from and releasing it back to a pool. This pool of <i>AMs</i> contains a limited number of <i>AMs</i> defined in a configuration file. When all <i>AMs</i> have been associated with user sessions, an already-used <i>AM</i> must be re-used. For this to happen, the existing data associated with the <i>AM</i> must be saved. The passivation process saves information used by the <i>AM </i>into the passivation store - usually a database, while the activation process does exactly the opposite, restores the state of the <i>AM</i> from the passivation store. The information is saved as an XML document. Take a look at <a href="http://jdeveloperfaq.blogspot.com/2010/02/faq-14-how-to-test-application-module.html">FAQ #14 - How to test an Application Module for activation-safe in ADF 11g</a> for additional information regarding the passivation and activation processes.</span></i><br />
<br />
You can add custom passivation and activation logic in your <i>AM </i>class by overriding the <i>ApplicationModuleImpl </i>methods <i><b>passivateState() </b></i>and <i><b>activateState() </b></i>respectively. The <i><span class="Apple-style-span" style="font-style: normal;"><i><b>passivateState()</b><span class="Apple-style-span" style="font-style: normal;"> method should create the necessary XML elements for each </span>AM<span class="Apple-style-span" style="font-style: normal;"> instance variable that you need to passivate. The <i><b>activateState() </b><span class="Apple-style-span" style="font-style: normal;"> method should detect the specific XML elements that identify the instance variables in the passivated XML document and restore them back into the instance variables.</span></i></span></i></span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></i><br />
<i><i><i><u>A "mini sub-framework" for passivating/activating Application Module instance variables</u></i></i></i><br />
<br />
If you are using multiple <i>AMs</i>, you can avoid code duplication of this basic implementation of the <i><b>passivateState()</b></i> and <i><b>activateState()</b><span class="Apple-style-span" style="font-style: normal;"> methods by putting it in a base </span><span class="Apple-style-span">AM </span><span class="Apple-style-span" style="font-style: normal;">class</span><span class="Apple-style-span">. </span><span class="Apple-style-span" style="font-style: normal;">Then </span><span class="Apple-style-span" style="font-style: normal;">derive all of your other </span><span class="Apple-style-span">AMs </span><span class="Apple-style-span" style="font-style: normal;">from this base <i><span class="Apple-style-span">AM<span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">. The base <i><span class="Apple-style-span">AM</span><span class="Apple-style-span" style="font-style: normal;"> class</span><span class="Apple-style-span"> <span class="Apple-style-span" style="font-style: normal;">can then </span><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">provide activation/passivation "triggers" to which the derived </span><span class="Apple-style-span">AMs</span><span class="Apple-style-span" style="font-style: normal;"> can respond. The implementation of <i><b>passivateState() </b><span class="Apple-style-span" style="font-style: normal;"> in the base </span><span class="Apple-style-span">AM</span><span class="Apple-style-span" style="font-style: normal;"> should look like this:</span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S9yHSQoB-WI/AAAAAAAAAoQ/AlnGz603Nmw/s1600/FAQ21.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S9yHSQoB-WI/AAAAAAAAAoQ/AlnGz603Nmw/s400/FAQ21.1.png" width="400" /></a></div><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">As you can see, after calling </span><b>super.passivateState()</b><span class="Apple-style-span" style="font-style: normal;"> to allow the framework to do its own processing, we call </span><b>onStartPassivation()</b><span class="Apple-style-span" style="font-style: normal;"> to signal derived </span>AMs<span class="Apple-style-span" style="font-style: normal;"> that a passivation process is taking place. Derived </span>AMs<span class="Apple-style-span" style="font-style: normal;"> should override </span><b>onStartPassivation()</b><span class="Apple-style-span" style="font-style: normal;"> in order to provide a list of the identifiers - each identifier tied to a specific instance variable - to be passivated. Below is an example implementation of </span><b>onStartPassivation()</b><span class="Apple-style-span" style="font-style: normal;"> by a derived </span>AM<span class="Apple-style-span" style="font-style: normal;"> class. </span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S9yJV95dLuI/AAAAAAAAAoU/v-7Zc8fOfwo/s1600/FAQ21.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="215" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S9yJV95dLuI/AAAAAAAAAoU/v-7Zc8fOfwo/s400/FAQ21.2.png" width="400" /></a></div><br />
<span class="Apple-style-span" style="font-style: normal;">In this case a single passivation identifier call </span><i>EMPLOYEE_LIST_ID</i><span class="Apple-style-span" style="font-style: normal;"> is returned to indicate a </span><span class="Apple-style-span" style="font-style: normal;">list of Employees class instance variable.</span><br />
<span class="Apple-style-span" style="font-style: normal;"><br />
</span><b><i>passivateState()</i></b><span class="Apple-style-span" style="font-style: normal;"> then loops for all passivation identifiers, creates an XML node for each identifier in the XML passivation document and calls </span><b>onPassivate()</b> passing the passivation identifier as an argument to it. A derived <i>AM</i> will override this method in order to return the passivation data for the specific passivation identifier. An example implementation is shown below:<br />
<br />
<i><span class="Apple-style-span" style="font-style: normal;"></span></i><br />
<div class="separator" style="clear: both; text-align: center;"><i><span class="Apple-style-span" style="font-style: normal;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S9ycE5w1YlI/AAAAAAAAAoY/Uk3rAgA6SI4/s1600/FAQ21.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="183" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S9ycE5w1YlI/AAAAAAAAAoY/Uk3rAgA6SI4/s400/FAQ21.3.png" width="400" /></a></span></i></div><i><span class="Apple-style-span" style="font-style: normal;"></span><span class="Apple-style-span" style="font-style: normal;"><br />
</span><br />
<span class="Apple-style-span" style="font-style: normal;">In this case the passivation identifier is checked and if it matches the expected identifier, the passivation data is supplied. </span><br />
<span class="Apple-style-span" style="font-style: normal;"><br />
<i><span class="Apple-style-span" style="font-style: normal;">Finally, </span><b>passivateState() </b><span class="Apple-style-span" style="font-style: normal;">calls </span><b>onEndPassivation() </b><span class="Apple-style-span" style="font-style: normal;"> to indicate the end of the passivation process.</span><br />
<br />
<span class="Apple-style-span" style="font-style: normal;"> The reverse process of activation is similar.</span> </i></span><i><b>activateState()</b><span class="Apple-style-span" style="font-style: normal;"> calls </span><b>onStartActivation()</b><span class="Apple-style-span" style="font-style: normal;"> to get the activation identifiers. It then loops looking for each activation identifier in the activated XML document. If the identifier is found, calls </span><b>onActivate()</b><span class="Apple-style-span" style="font-style: normal;"> supplying the activation data along with its activation identifier as arguments. The derived </span>AM<span class="Apple-style-span" style="font-style: normal;"> can identify the instance variable being activated - based on the activation identifier, and restore it.<br />
<br />
<i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"> </span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i> <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">To test the framework, bring up the </span><span class="Apple-style-span">Edit Business Components Configuration</span><span class="Apple-style-span" style="font-style: normal;"> dialog </span><span class="Apple-style-span" style="font-style: normal;">and disable </span><b>Application Module Pooling</b><span class="Apple-style-span" style="font-style: normal;"> as it shown below. You do this by right-clicking on the </span><span class="Apple-style-span">AM</span><span class="Apple-style-span" style="font-style: normal;"> in the </span><span class="Apple-style-span">Application Navigator</span><span class="Apple-style-span" style="font-style: normal;"> and selecting </span><b>Configurations...</b><span class="Apple-style-span" style="font-style: normal;"> Then you click on </span><b>Edit...</b><span class="Apple-style-span" style="font-style: normal;"> to edit the specific configuration.<br />
</span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i> <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i> <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i> <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i> <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i> <i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i><br />
<i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><br />
<div class="separator" style="clear: both; text-align: center;"><i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S90uOm_nk7I/AAAAAAAAAoc/6E7769389UI/s1600/FAQ21.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S90uOm_nk7I/AAAAAAAAAoc/6E7769389UI/s320/FAQ21.4.png" width="296" /></a></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i></div><i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
This will in effect initiate a passivation-activation cycle for each request when the application is running. Finally save the configuration, enable debug logging on the console and run the application. You should see your <i>AM</i> class instance variables being activated.<br />
<br />
<br />
</span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><br />
<div class="separator" style="clear: both; text-align: center;"><i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S900hCxubGI/AAAAAAAAAog/TYqhKd9j1iU/s1600/FAQ21.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S900hCxubGI/AAAAAAAAAog/TYqhKd9j1iU/s400/FAQ21.5.png" width="400" /></a></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i></div><i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
</span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><br />
<i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><i></i></span></i></span></i></span><i></i></span></i></span></i></span><i></i></i></i><i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;">To further explore this framework, the source code is supplied below.</span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><br />
<i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
If you are using class instance variables in the <i>BC </i>layer and you want their values to persit from one request to another, then passivating-activating these variables becomes necessary. The ADF BC framework allows you to do this by overriding the <i><b>passivateState() </b></i>and <i><b>activateState()</b><span class="Apple-style-span" style="font-style: normal;"> methods</span><span class="Apple-style-span" style="font-style: normal;">.</span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<i><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span"><span class="Apple-style-span" style="font-style: normal;"><i><span class="Apple-style-span" style="font-style: normal;"> <b><span class="Apple-style-span" style="font-size: large;">Code</span></b><br />
<br />
<a href="http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo21.rar"><span class="Apple-style-span" style="font-size: x-small;">http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo21.rar</span></a></span></i></span></span></i></span></i></span></span></i></span></i></span></span></i></span></i></span></i></i><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/04/faq-20-how-to-refactor-adf-components.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/extension-intermission-1-subversion.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com7tag:blogger.com,1999:blog-8484416608670642843.post-76681076302046834682010-04-18T11:17:00.000-07:002010-11-09T06:25:08.373-08:00FAQ #20 - How to refactor ADF components in JDeveloper<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
When it comes to refactoring ADF components in JDeveloper, most ADF developers come to know the refactoring features when they rename, move or delete Business Components (BC) objects. Yet fewer know that additional options exist in JDeveloper to refactor object attributes, attribute domain types, bindings, JSF pages and more.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<i><u>Refactoring ADF BC objects</u></i><br />
<br />
Refactoring ADF BC objects is available through the <b><i>Rename...</i></b> and <b><i>Move...</i></b> menu selections of the <b><i>Refactor </i></b>menu. You can display the <i><b>Refactor</b></i> menu when you right-click on the BC component in the <i>Application Navigation</i> window.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8rZaVftOsI/AAAAAAAAAnQ/Ayh9UXC_djo/s1600/FAQ20.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="263" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8rZaVftOsI/AAAAAAAAAnQ/Ayh9UXC_djo/s320/FAQ20.1.png" width="320" /></a></div><br />
If you choose to rename a component, JDeveloper will present a <i>Rename</i> dialog. In this dialog you can specify the new name for the object and choose to preview the changes that will be generated by the refactoring process.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8ra9HBIYmI/AAAAAAAAAnU/rnzRBA2_GOM/s1600/FAQ20.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="138" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8ra9HBIYmI/AAAAAAAAAnU/rnzRBA2_GOM/s320/FAQ20.2.png" width="320" /></a></div><br />
It is a good idea to preview the changes, when the <i>Preview</i> option is available. When you click <i><b>Preview </b></i>in this case, a <i>Rename Log window</i> will open listing all the changes that will be made by the refactoring process.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8rcP9QUSsI/AAAAAAAAAnY/q-R3sN_cVp0/s1600/FAQ20.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="83" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8rcP9QUSsI/AAAAAAAAAnY/q-R3sN_cVp0/s320/FAQ20.3.png" width="320" /></a></div><br />
You can browse through the changes by clicking the <i><b>Synchronize with Editor</b></i> button<a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8rc__r_XZI/AAAAAAAAAnc/uOrMPaTPWEc/s1600/FAQ20.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8rc__r_XZI/AAAAAAAAAnc/uOrMPaTPWEc/s1600/FAQ20.4.png" /></a> This is a toggle button. It will open the applicable source file as you click through the changes in the Log window. When you are done reviewing the changes, click on the <i><b>Do Refactoring</b></i> button<a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8rfA8Vb9YI/AAAAAAAAAng/iA18IEU5HrU/s1600/FAQ20.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8rfA8Vb9YI/AAAAAAAAAng/iA18IEU5HrU/s1600/FAQ20.5.png" /></a> to apply the changes. If you decide for whatever reason not to go ahead with the refactoring, just close the <i>Rename Log</i> window.<br />
<br />
Choose <b><i>Move...</i></b> from the <i><b>Refactor</b></i> menu to move the BC object to another package. This will present a <i>Move</i> dialog, where you can specify the new package name for the object to be moved.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8riZ-LGvVI/AAAAAAAAAnk/9F_jcPdEJoY/s1600/FAQ20.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="131" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8riZ-LGvVI/AAAAAAAAAnk/9F_jcPdEJoY/s320/FAQ20.6.png" width="320" /></a></div><br />
Deleting a BC object is not available under the <i>Refactor </i>menu. It is available as a separate <i>Delete </i>menu option in the same context menu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8ruBkoZ51I/AAAAAAAAAno/q5y5bYgQCOw/s1600/FAQ20.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8ruBkoZ51I/AAAAAAAAAno/q5y5bYgQCOw/s1600/FAQ20.7.png" /></a></div><br />
When you select <i><b>Delete </b></i>to delete a BC object, a <i>Confirm Delete</i> dialog will be presented. If the BC object you are about to delete is used throughout the project, a <i>Show Usages</i> button will be also be available in the <i>Confirm Delete</i> dialog and a <i>Log</i> window will open displaying all of the object's usages.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8ryfQaeC9I/AAAAAAAAAnw/d2PYriV5I1w/s1600/FAQ20.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="181" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8ryfQaeC9I/AAAAAAAAAnw/d2PYriV5I1w/s320/FAQ20.8.png" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div>To view the object's usages on the <i>Confirm Delete</i> dialog itself, click on the <i><b>Show Usages</b></i> button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8ry9pFyy8I/AAAAAAAAAn0/TKiDdQriv0s/s1600/FAQ20.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="203" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8ry9pFyy8I/AAAAAAAAAn0/TKiDdQriv0s/s320/FAQ20.9.png" width="320" /></a></div><br />
To individually inspect each object usage, first click <i><b>No</b></i> to dismiss the <i>Confirm Delete</i> dialog. Then in the <i>Log</i> window click the <i><b>Synchronize with Editor</b></i> toggle button <a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8rc__r_XZI/AAAAAAAAAnc/uOrMPaTPWEc/s1600/FAQ20.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8rc__r_XZI/AAAAAAAAAnc/uOrMPaTPWEc/s1600/FAQ20.4.png" /></a> and browse through the object's usages. As you browse through the object's usages, the corresponding source file will be opened and you will be positioned exactly where the object is being referenced in the source.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8r1qnQfYII/AAAAAAAAAn4/_iN9gcYuNJE/s1600/FAQ20.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="103" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8r1qnQfYII/AAAAAAAAAn4/_iN9gcYuNJE/s320/FAQ20.10.png" width="320" /></a></div><br />
<br />
<i><u> Refactoring ADF BC Object Attributes</u></i><br />
<br />
Refactoring ADF BC object attributes allows you to rename, delete and change the domain type of a BC object's attribute. Moving an attribute is not supported. To refactor an attribute, bring-up the object's overview editor by double-clicking on the object in the <i>Application Navigator</i> window and select the <i>Attributes </i>pane. Then right-click on the attribute and select <i><b>Rename...</b></i> or <i><b>Delete</b></i> from the context menu that is displayed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8r4cTfKO4I/AAAAAAAAAn8/t674dNyblkw/s1600/FAQ20.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="201" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8r4cTfKO4I/AAAAAAAAAn8/t674dNyblkw/s320/FAQ20.11.png" width="320" /></a></div><br />
In both cases - renaming or deleting the attribute, you can preview the usages - as described earlier before proceeding with the refactoring process. Consider also selecting <i><b>Find Usages...</b></i> from the context menu to review the attribute usages without doing any refactoring.<br />
<br />
In addition to renaming and deleting an attribute, you can also refactor the attribute domain type by selecting <i><b>Change Type..</b></i> from the context menu. This will display a <i>Change type</i> dialog from where you can select the new domain type for the attribute. You can also choose to preview the changes in the <i>Change type Log </i>window. This window will open when you select <i><b>Preview</b></i> and click <i><b>OK</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8s9I9ZEe4I/AAAAAAAAAoM/akQjW3k3MGE/s1600/FAQ20.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="147" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8s9I9ZEe4I/AAAAAAAAAoM/akQjW3k3MGE/s320/FAQ20.15.png" width="320" /></a></div><br />
<br />
<i><u>Refactoring Data Bindings</u></i><br />
<br />
You can refactor bound objects in the <i>Data Binding Definition</i> page. To do so, bring up the<i> Page Definition File</i> associated with a JSF page and in the <i>Overview </i>tab right-click on the specific binding that you want to refactor. Then choose <i><b>Rename...</b></i> or <i><b>Delete</b></i> from the <i><b>Refactor</b></i> menu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8s22SElx1I/AAAAAAAAAoA/YMCmvdnyakw/s1600/FAQ20.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="290" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8s22SElx1I/AAAAAAAAAoA/YMCmvdnyakw/s320/FAQ20.12.png" width="320" /></a></div><br />
Again, before you delete a binding you can verify its usages by clicking the <i><b>View Usages</b></i> button in the <i>Delete Safely</i> dialog that is displayed. This will open the <i>Delete Safely Log</i> window where you can review the usages. Click on the <i><b>Synchronize with Editor</b></i> toggle button <img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8rc__r_XZI/AAAAAAAAAnc/uOrMPaTPWEc/s1600/FAQ20.4.png" /> to bring up each usage into the source editor.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8s34lK1jsI/AAAAAAAAAoE/L4L0ydN-oDI/s1600/FAQ20.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="60" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8s34lK1jsI/AAAAAAAAAoE/L4L0ydN-oDI/s320/FAQ20.13.png" width="320" /></a></div><br />
<i><u>Refactoring JSF Pages</u></i><br />
<br />
You can refactor a JSF page by right-clicking on the page in the Application Navigator and selecting <i><b>Rename...</b></i>, <i><b>Move...</b></i> or <i><b>Delete </b></i>from the <i><b>Refactor </b></i>menu. JDeveloper will update all references to the page in task flows and in the <i>DataBindings.cpx</i> mappings when renaming or moving the page.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8s6TSboMCI/AAAAAAAAAoI/2N0k34eFs2E/s1600/FAQ20.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8s6TSboMCI/AAAAAAAAAoI/2N0k34eFs2E/s320/FAQ20.14.png" width="250" /></a></div><br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
The refactoring options in JDeveloper are quite powerful and can help substantially during the development process. They range from refactoring data components objects, object attributes, attribute domain types, data bindings, JSF pages and files. For more information about refactoring and their limitations I suggest that you check out the Fusion Developer's Guide - referenced below.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Reference</span></b><br />
<br />
<a href="http://download.oracle.com/docs/cd/E15051_01/web.1111/b31974/refactoring.htm"><span class="Apple-style-span" style="font-size: x-small;">Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) Part Number B31974-02</span></a><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/04/faq-19-how-to-check-and-improve-code.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/05/faq-21-how-to-passivateactivate-adf.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com2tag:blogger.com,1999:blog-8484416608670642843.post-82026315061646044052010-04-11T07:22:00.000-07:002010-04-18T11:17:47.935-07:00FAQ #19 - How to check and improve code quality in JDeveloper<b><span class="Apple-style-span" style="font-size: large;">Introduction</span></b><br />
<br />
When it comes to checking and improving code quality, JDeveloper provides the <i>View Status</i> facility. Factoring in its ability to support third party tools through extensions, some already exist - PMD for example - others are left to the imagination of the able programmer, the possibility of producing good quality code now rests on utilizing these tools among others. In this FAQ will take a look at the <i>View Status</i> facility and at the PMD extension.<br />
<br />
<br />
<b><span class="Apple-style-span" style="font-size: large;">Main Theme</span></b><br />
<br />
<i><u>JDeveloper native support for code checking</u></i><br />
<br />
Code checking is supported natively in JDeveloper via the <i>View Status</i> facility. You can activate it by selecting <b><i>Status</i></b> from the <b><i>View</i></b> menu.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8D6h6G6qMI/AAAAAAAAAmc/YsXcD_fyp1k/s1600/FAQ19.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8D6h6G6qMI/AAAAAAAAAmc/YsXcD_fyp1k/s320/FAQ19.1.png" width="252" /></a></div><br />
Selecting it will open a <i>Status </i>window, which will display any issues related to the file currently active in the editor. The issues could be errors, warnings, incompletes or advisory issues.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8D7vmcUN3I/AAAAAAAAAmg/GKOf_qSDJi8/s1600/FAQ19.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="82" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8D7vmcUN3I/AAAAAAAAAmg/GKOf_qSDJi8/s320/FAQ19.2.png" width="320" /></a></div><br />
Double-clicking on an issue in the <i>Status </i>window, will take you to the line in the code that produces the problem. Right-clicking on an issue, produces in many cases a possible problem resolution.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8D84EBCCUI/AAAAAAAAAmk/UbXwjdZstbs/s1600/FAQ19.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="82" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8D84EBCCUI/AAAAAAAAAmk/UbXwjdZstbs/s320/FAQ19.3.png" width="320" /></a></div><br />
Resolving all issues associated with a particular file will produce a <i>No Issues</i> indicator in the <i>Status</i> window, which is what you want to see in most cases.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8D9to7B9GI/AAAAAAAAAmo/wfnel7xa_JU/s1600/FAQ19.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="83" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8D9to7B9GI/AAAAAAAAAmo/wfnel7xa_JU/s320/FAQ19.4.png" width="320" /></a></div><br />
In some cases, you will find the need to adjust the behavior of the Status facility to accommodate certain standards that you establish for your project. Consider the following issue for example:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8D-0zvwOBI/AAAAAAAAAms/MknT-Pyypu0/s1600/FAQ19.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="81" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8D-0zvwOBI/AAAAAAAAAms/MknT-Pyypu0/s320/FAQ19.5.png" width="320" /></a></div><br />
In this case, the <i>Status </i>window displays a warning related to an unused parameter in a backing bean function. In certain cases when the parameter cannot be removed - i.e. the method implements a superclass method, you won't be able to make this warning disappear unless you either use the parameter or adjust the properties of the <i>Status </i>facility. These properties are accessible through the <i><b>Tools | Preferences</b></i> menu under the <i><b>Audit | Profiles</b></i> section.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8ECl_bHTwI/AAAAAAAAAm0/hjNXeJfkf6I/s1600/FAQ19.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="237" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8ECl_bHTwI/AAAAAAAAAm0/hjNXeJfkf6I/s320/FAQ19.6.png" width="320" /></a></div><br />
For this case, select the specific <i>Profile</i>, then the <i><b>Rules </b></i>tab and then under the <b><i>Usages </i><span class="Apple-style-span" style="font-weight: normal;">section </span></b>the <i><b>Unused Parameter </b></i>rule. Change the <i>Severity </i>from <i>Warning </i>to <i>Assist</i> and Style from <i>Unused</i> to <i>Warning</i>. This will produce a <i>No Issues</i> indicator in the Status window but it will still highlight the issue as a warning in the editor. In some cases you may want to adjust the <i>Default Fix</i> setting as well.<br />
<br />
In closing, notice that the same issues identified by the <i>View | Status</i> feature are displayed in the right gutter of the editor window as well.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8G_nq7em4I/AAAAAAAAAm4/Bv-1TTTUFdY/s1600/FAQ19.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="122" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S8G_nq7em4I/AAAAAAAAAm4/Bv-1TTTUFdY/s320/FAQ19.7.png" width="320" /></a></div><i><u>PMD Extension</u></i><br />
<br />
PMD (<a href="http://pmd.sourceforge.net/">http://pmd.sourceforge.net/</a>) can be installed as a JDeveloper extension via the <b><i>Help | Check for Updates...</i></b> feature. Select the <i><b>Open Source and Partners Extensions</b></i> <i>Update Center</i> in step 2 of the <i>Check for Updates</i> wizard and in step 3 <i><b>PMD JDeveloper Extension 4.2.5.3.0</b></i>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8HQGaQn42I/AAAAAAAAAm8/Zgq1fXHKj_A/s1600/FAQ19.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8HQGaQn42I/AAAAAAAAAm8/Zgq1fXHKj_A/s320/FAQ19.8.png" width="320" /></a></div><br />
JDeveloper will download the extension and it will ask you to re-start upon clicking <b><i>Finish </i></b>in step 5 of the <i>Check for Updates</i> wizard. Upon re-starting JDeveloper, PMD is available by right-clicking anywhere in the editor window and selecting <b><i>PMD</i></b> from the context menu. This will check the file currently open in the editor. You can also right-click anywhere in the <i>Application Navigation</i> window to check multiple or all files in your project(s).<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8HRcJNBeiI/AAAAAAAAAnA/3Y7MTWThbEw/s1600/FAQ19.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8HRcJNBeiI/AAAAAAAAAnA/3Y7MTWThbEw/s320/FAQ19.9.png" width="183" /></a></div><br />
Before running PMD for the first time, ensure that all rules are enabled by clicking <b><i>Select all</i></b> in the <i>PMD Preferences </i>page (accessible through the <i><b>Tools | Preferences</b></i> menu) as it shown below. Later on, you can adjust these settings according to your project's standards.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8HTp4Tv7HI/AAAAAAAAAnE/0VJmHg1Fp4o/s1600/FAQ19.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S8HTp4Tv7HI/AAAAAAAAAnE/0VJmHg1Fp4o/s320/FAQ19.10.png" width="320" /></a></div><br />
When running <b><span class="Apple-style-span" style="font-weight: normal;">PMD</span><i> </i></b>it will open a <i>PMD - Log</i> window with a list of code improvement recommendations.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8HVENamx-I/AAAAAAAAAnI/8qI1IM1Noqo/s1600/FAQ19.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="69" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S8HVENamx-I/AAAAAAAAAnI/8qI1IM1Noqo/s320/FAQ19.11.png" width="320" /></a></div><br />
Double-clicking on any of the recommendations in the <i>PMD - Log</i> window, will take you directly to the specific line in the code that produces it. Resolving all issues reported by PMD will produce a <i>No problems found</i> dialog, which is again what you want to see in most cases.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8HWhBF_BEI/AAAAAAAAAnM/O3O72j08W64/s1600/FAQ19.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S8HWhBF_BEI/AAAAAAAAAnM/O3O72j08W64/s1600/FAQ19.12.png" /></a></div><br />
<b><span class="Apple-style-span" style="font-size: large;">Conclusion</span></b><br />
<br />
Through native support and support via third party extensions, the tools exist within the JDeveloper IDE to help you as a developer produce better quality code for your projects. Their usage will spot problem areas in your code and help you learn and improve.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/03/faq-18-how-to-get-started-with.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/04/faq-20-how-to-refactor-adf-components.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com1tag:blogger.com,1999:blog-8484416608670642843.post-30369050569037750682010-03-21T14:19:00.000-07:002010-04-11T07:28:57.067-07:00FAQ #18 - How to get started with the JDeveloper Extension SDK, Part 3<span style="font-size: large;"><b><span class="Apple-style-span">Introduction</span></b></span><br />
<br />
With this part, we will conclude the series of getting started with the <i>JDeveloper Extension SDK</i>. We will wrap up the example extension that we started in part 1 by constructing a custom editor and a custom preferences page for specifying the extension settings. Finally we will package the extension, so that it can be installed in JDeveloper through the <b><i>Help | Check for Updates...</i></b> feature. So, let's get to it!<br />
<br />
<span style="font-size: large;"><b>Main Theme</b></span><br />
<br />
<i><u>Creating a Custom Editor</u></i><br />
<br />
A custom editor will allow us to display data associated with an extension action in a customized view. A custom editor for the sample <i>Application Module Verifier</i> action is shown below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S6YfBAe5TTI/AAAAAAAAAic/-Fumb07yYio/s1600-h/FAQ18.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S6YfBAe5TTI/AAAAAAAAAic/-Fumb07yYio/s320/FAQ18.1.png" /></a></div><br />
We construct a custom editor by creating an editor class that extends the <i>oracle.ide.editor.Editor</i> abstract class and providing an implementation for the abstract method <i>getGUI()</i>. This method is actually defined in the <i>oracle.ide.view.View</i> class from which the <i>Editor</i> class is inherited. It returns the root graphical user interface component of our custom editor. You may also want to override the <i>getEditorAttribute()</i> method to set the characteristics of the editor such as background color, scroll bars and so on. Below is the <i>getGUI()</i> code for our custom editor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S6YBXXofCnI/AAAAAAAAAh8/SkFCtJMmtGA/s1600-h/FAQ18.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S6YBXXofCnI/AAAAAAAAAh8/SkFCtJMmtGA/s320/FAQ18.2.png" /></a></div><br />
In the code above we construct a <i>oracle.javatools.ui.TransparentPanel</i> panel called <i>AppModuleVerifierEditorPanel</i>, which contains the custom editor GUI. We do this after we ensure that the URL clicked by the user is related to our action since we can add other verifier actions in the future. We will not go into the details of the <i>AppModuleVerifierEditorPanel </i>GUI but in general it constructs a single <i>JTabbedPane </i>pane - called <i>General </i>(see <a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6X6g5uYpcI/AAAAAAAAAh0/MiR8OBqI6Es/s1600-h/FAQ18.1.png">picture</a> above) - that contains two oracle.<i>javatools.ui.HeaderPanel</i> panels the second of which hosts a <i>JTable</i> table. The specific details can be found in the source code below.<br />
<br />
It remains to hook-up the custom editor to our extension action. In order to do this, we need first to declare the custom editor in the <i>extension.xml</i> descriptor inside the <i><hooks></i> tag and then activate it. For the first part, add the following code to the <i>extension.xml</i> descriptor:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6YRXIPrsRI/AAAAAAAAAiE/2HBSPNEweM8/s1600-h/FAQ18.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6YRXIPrsRI/AAAAAAAAAiE/2HBSPNEweM8/s320/FAQ18.3.png" /></a></div>For the second part, we will invoke the custom editor by calling <i>EditorUtil.openDefaultEditorInFrameExternal()</i> from within the <i>launchEditor()</i> method of the <i>Verifier</i> and pass the URL of the file to view.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6YStCvaSOI/AAAAAAAAAiU/6J9fZXPgokY/s1600-h/FAQ18.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6YStCvaSOI/AAAAAAAAAiU/6J9fZXPgokY/s320/FAQ18.4.png" /></a></div><br />
Finally, what is left is to generate some data to display. Since our action is related to verifying <i>Application Modules Configurations</i> for ADF applications, we will extract certain data from each <i>Application Module Configuration</i>, such as for example the data source and the locking mode. For this purpose we will use the <i>XMLExtractor </i>class. To build our data model - an output XML file - we will use the <i>XMLBuilder</i> class. Again, the specific details can be found in the source code below.<br />
<br />
For more information about constructing a custom editor for your extension, take a look at the <i>CustomEditor </i>example extension, which is part of the samples downloaded along the <i>JDeveloper Extension SDK</i>.<br />
<br />
<br />
<u><i>Creating a Preferences Panel</i></u><br />
<br />
We can create a preferences panel to allow the user to configure our extension via the <i><b>Tools | Preferences...</b></i> menu option in JDeveloper. Below is a custom preferences panel that we will add in order to configure our <i>ADF Tools</i> extension:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S6ZESIv03ZI/AAAAAAAAAik/0Lrfb_F5wZw/s1600-h/FAQ18.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S6ZESIv03ZI/AAAAAAAAAik/0Lrfb_F5wZw/s320/FAQ18.5.png" /></a></div><br />
To begin, we first need to add the persistent data model for our extension preferences. We do this by right-clicking on the extension project in the <i>Application Navigator</i>, selecting <i><b>New...</b></i> and from the <i>New Gallery</i> dialog under the <i>Extension Development</i> category <b><i>Data Model (HashStructureAdapter)</i></b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZGJWDxGMI/AAAAAAAAAis/XdQqJ-0dmMA/s1600-h/FAQ18.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZGJWDxGMI/AAAAAAAAAis/XdQqJ-0dmMA/s320/FAQ18.6.png" /></a></div><br />
This will bring up the <i>Create Data Model</i> dialog where we can specify our extension configuration class and package.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZGyTAlDmI/AAAAAAAAAi0/MGnQwyn1aBY/s1600-h/FAQ18.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZGyTAlDmI/AAAAAAAAAi0/MGnQwyn1aBY/s320/FAQ18.7.png" /></a></div><br />
In the configuration class that is created, we need to add a getter and a setter method for each extension setting that can be configured by the user. For example, since we will allow the user to set the ADF application root folder to be verified, we will add the following code in <i>ADFToolsConfigData</i> to save and retrieve the root folder: <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6ZnEYsibuI/AAAAAAAAAjc/kIdgwUyOtzs/s1600-h/FAQ18.8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6ZnEYsibuI/AAAAAAAAAjc/kIdgwUyOtzs/s320/FAQ18.8.png" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div>The second step is to actually create the preferences page. We do this via the <i>New Gallery Preferences Page</i> wizard under the <i>Extension Development</i> category:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S6ZLwbOAAxI/AAAAAAAAAjE/s4EDj7neIQA/s1600-h/FAQ18.9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S6ZLwbOAAxI/AAAAAAAAAjE/s4EDj7neIQA/s320/FAQ18.9.png" /></a></div><br />
In the <i>Create Preferences Page</i> dialog we specify the details of the preferences page. It is here where we specify the data model that we created in the previous step:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZNNszsu_I/AAAAAAAAAjM/AC8yroqupIs/s1600-h/FAQ18.10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZNNszsu_I/AAAAAAAAAjM/AC8yroqupIs/s320/FAQ18.10.png" /></a></div><br />
The preferences page class that is created by the wizard overrides the base class' <i>onEntry()</i> and <i>onExit()</i> methods. We will write the necessary code in these methods to retrieve and save respectively the preferences from the data model. For our sample extension, this is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S6Zoj_WJq4I/AAAAAAAAAjk/yeWI0JP8KDM/s1600-h/FAQ18.11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S6Zoj_WJq4I/AAAAAAAAAjk/yeWI0JP8KDM/s320/FAQ18.11.png" /></a></div><br />
<br />
The last thing that we need to do is to write the necessary UI code to create the look and feel of the preferences page. For more information about constructing a configuration panel, refer to the <i>ConfigPanel</i> example extension. <br />
<br />
<br />
<u><i>Packaging the Extension</i></u><br />
<br />
Once our extension is complete, we need to package it in a format acceptable for installation by the JDeveloper <b><i>Check for Updates...</i></b> feature. We do this by firstly creating a deployment profile in the <i>Project Properties</i> dialog and deploying the extension in a jar archive.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6ZvAizla2I/AAAAAAAAAjs/rgQ_eNyG3dE/s1600-h/FAQ18.12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6ZvAizla2I/AAAAAAAAAjs/rgQ_eNyG3dE/s320/FAQ18.12.png" /></a></div><br />
The name of the jar archive must include the extension version. In our example we called the jar archive <i>ADFTools.11.1.1.2.36.55.36.2.jar</i>. The version of the extension can be set in the <i>extension.xml</i> descriptor.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZwC1a30II/AAAAAAAAAj0/_5aIiSfwPxU/s1600-h/FAQ18.13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S6ZwC1a30II/AAAAAAAAAj0/_5aIiSfwPxU/s320/FAQ18.13.png" /></a></div><br />
To deploy the extension, right-click on the project in the Application Navigator and select <i><b>Deploy</b></i>. Once the extension is deployed, we need to create a <i>bundle.xml</i> extension installation descriptor in order to provide the necessary installation details to JDeveloper. A sample <i>bundle.xml</i> file is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6ZyVk5xlgI/AAAAAAAAAj8/yzAuANtpdPM/s1600-h/FAQ18.14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S6ZyVk5xlgI/AAAAAAAAAj8/yzAuANtpdPM/s320/FAQ18.14.png" /></a></div><br />
The <i>bundle.xml</i> must be located in a <i>META-INF</i> directory. Finally, the deployed extension jar archive along with the <i>META-INF</i> folder and its contents - the <i>bundle.xml</i> descriptor - must be packaged into a .zip file. The .zip file finally can be installed via the <i>Check for Updates...</i> feature in JDeveloper.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S6Z5QhHHaLI/AAAAAAAAAkE/161p5y6NXuM/s1600-h/FAQ18.15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S6Z5QhHHaLI/AAAAAAAAAkE/161p5y6NXuM/s320/FAQ18.15.png" /></a></div><br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
With this FAQ we conclude our introduction to the JDeveloper Extension SDK. The ability to extend the IDE to integrate tasks specific to our development process is a powerful feature of JDeveloper.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<span style="font-size: large;"><b>Code</b></span><br />
<br />
<span style="font-size: xx-small;"><a href="http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo18.rar">http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo18.rar</a></span> <br />
<span style="font-size: xx-small;"><a href="http://jdeveloperfaq.googlecode.com/files/ADFTools.zip">http://jdeveloperfaq.googlecode.com/files/ADFTools.zip</a></span><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/03/faq-17-how-to-get-started-with.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/04/faq-19-how-to-check-and-improve-code.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com2tag:blogger.com,1999:blog-8484416608670642843.post-82083241656988538082010-03-14T12:08:00.000-07:002010-03-21T14:20:30.447-07:00FAQ #17 - How to get started with the JDeveloper Extension SDK, Part 2<b><span class="Apple-style-span" style="font-size: x-large;">Introduction</span></b><br />
<br />
In <a href="http://jdeveloperfaq.blogspot.com/2010/03/faq-16-how-to-get-started-with.html">FAQ #16 - How to get started with the JDeveloper Extension SDK, Part 1</a> we talked about the basics of getting started with writing your own JDeveloper extensions. In this FAQ we will expand on that knowledge to cover a few more introductory topics. Specifically we will talk about: 1) how to create a progress bar to indicate a long running action and 2) how to create and utilize a log window specific to your extension.<br />
<br />
<b><span class="Apple-style-span" style="font-size: x-large;">Main Theme</span></b><br />
<br />
<u><i>Creating a Progress Bar</i></u><br />
<br />
You can use a progress bar in a JDeveloper extension to indicate a long running action. Since our sample <i>ADFTools </i>extension will iterate a base directory looking for <i>Application Module</i> configuration files - for the <i>Application Module Verifier</i> action - this is the ideal place to use it.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S5y6OkXiUvI/AAAAAAAAAgs/aRAExqR25J4/s1600-h/FAQ17.1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S5y6OkXiUvI/AAAAAAAAAgs/aRAExqR25J4/s320/FAQ17.1.png" /></a></div><br />
For more information, check-out the <i>ProgressBar</i> example extension, part of the <i>extensionssdk</i> workspace downloaded along with the <i>JDeveloper Extension SDK</i>. For more information about downloading the JDeveloper Extension SDK refer to <a href="http://jdeveloperfaq.blogspot.com/2010/03/faq-16-how-to-get-started-with.html">FAQ #16 - How to get started with the JDeveloper Extension SDK, Part 1</a>.<br />
<br />
To get started, a progress bar is created by instantiating an <i>oracle.ide.dialogs.ProgressBar</i> class. The constructor for the <i>ProgressBar</i> class is documented as follows on the <a href="http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e13403/oracle/ide/dialogs/ProgressBar.html#ProgressBar%28java.awt.Component,%20java.lang.String,%20java.lang.Runnable,%20boolean%29">Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1)</a> on the web:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S5y8jGVEImI/AAAAAAAAAg0/vICemexOwV0/s1600-h/FAQ17.2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/_Lb-bi4pdlv8/S5y8jGVEImI/AAAAAAAAAg0/vICemexOwV0/s320/FAQ17.2.png" /></a></div><br />
The constructor documentation is almost self-explanatory. We need to provide the parent window of the progress bar, its title, a <i>Runnable </i>interface implementation and a true/false indicator of whether the task that is to be executed is determinate or not. Thus our main task becomes the implementation of the <i>Runnable </i>interface. For this purpose we will create a <i>Verifier</i> class that implements the <i>Runnable</i> interface by implementing the abstract <i>run()</i> method. In its <i>run()</i> method we will scan the application's root directory for <i>Application Module</i> configuration files. The code below shows the <i>run()</i> method of the <i>Verifier</i> class.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50Y12FP-cI/AAAAAAAAAhM/kMullebEx54/s1600-h/FAQ17.3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50Y12FP-cI/AAAAAAAAAhM/kMullebEx54/s320/FAQ17.3.png" /></a></div><br />
A few things to consider on the code above:<br />
<ul><li><i>FileScanner </i>is a generic utility class that will scan a specific root directory for a file pattern. This is done by calling its <i>scanForFiles()</i> method.</li>
<li><i>logMessage()</i> is a class method that will log a message in our own custom JDeveloper log window. More on this later.</li>
<li><i>progressbar </i>is a <i>ProgressBar </i>class variable that is passed to the <i>Verifier </i>via the <i>setProgressBar()</i>.</li>
<li><i>logLink()</i> is a class method that will log a click-able URL link in the custom log window. Again, more on this later when we will talk about the creation of our extension's log window.</li>
</ul><br />
Since the <i>Verifier </i>class can be re-used by other types of verifiers, we will also create a specialized <i>Verifier</i> class called <i>ApplicationModuleVerifier</i>. Now, we can write the plumbing code in the <i>ApplicationModuleVerifierCommand doit()</i> that implements the command. This code is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50WV8eHF7I/AAAAAAAAAhE/pAYe3OvCIp4/s1600-h/FAQ17.4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50WV8eHF7I/AAAAAAAAAhE/pAYe3OvCIp4/s320/FAQ17.4.png" /></a></div><br />
A few things of interest on the code above:<br />
<ul><li> <i>ApplicationModuleVerifier </i>is the <i>Verifier</i>-derived class specific for this command action.</li>
<li> The <i>ProgressBar</i> is created by specifying the IDE main window - <i>Ide.getMainWindow()</i> - as its parent. We also specify the <i>ApplicationModuleVerifier</i> we just created for its <i>Runnable</i> parameter.</li>
<li>We call <i>setCancelable() </i>on the ProgressBar to allow the user to cancel the command processing.</li>
<li>We pass the <i>ProgressBar </i>to the <i>ApplicationModuleVerifier </i>by calling its <i>setProgressBar()</i>.</li>
<li>Finally we start the <i>ProgressBar</i> by calling <i>start()</i>. Command will then be passed to the <i>Verifier run() </i>method. </li>
</ul><br />
<u><i>Creating and Utilizing a Log Window</i></u><br />
<br />
A log window will allow us to perform log actions specific to our extension. For example, we can clear the logs without interfering with other logs made by JDeveloper. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S50anw0CunI/AAAAAAAAAhU/RHtd6gknRVE/s1600-h/FAQ17.5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S50anw0CunI/AAAAAAAAAhU/RHtd6gknRVE/s320/FAQ17.5.png" /></a></div><br />
For more information, check-out the <i>ClickableURL</i> example extension. We can create our own log window by creating a class that extends the <i>oracle.ide.log.MessagePage</i>, instantiate it and call it <i>show()</i> method to display it in JDeveloper. All of these are done inside the <i>ApplicationModuleVerifierCommand</i>'s <i>doit()</i> as it is shown below:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S50dSHsEkOI/AAAAAAAAAhc/E5YlsAEavDc/s1600-h/FAQ17.6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_Lb-bi4pdlv8/S50dSHsEkOI/AAAAAAAAAhc/E5YlsAEavDc/s320/FAQ17.6.png" /></a></div><br />
Also in the code above observe the following:<br />
<ul><li><i>LogManager.getLogManager().showLog()</i> is called to show the JDeveloper Log pane </li>
<li><i>clearAll()</i> is called on our log window to clear its contents</li>
<li><i>setMessageWindow()</i> is called on the <i>ApplicationModuleVerifier</i> to pass the message pane. It will be used by the verifier to add log entries to the log pane.</li>
</ul>Log entries are added to the custom log pane in the <i>Verifier run()</i> by calling the <i>logMessage()</i> and <i>logLink()</i> methods (see <a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50Y12FP-cI/AAAAAAAAAhM/kMullebEx54/s1600-h/FAQ17.3.png">image</a> above). The <i>logLink()</i> method is shown below. An <i>oracle.ide.log.Href</i> is instantiated and logged in the custom log pane. When the link is clicked the <i>launchEditor() Verifier</i> method is called to display it in an editor.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50qsNRaSqI/AAAAAAAAAhk/NVdC8xj3S-0/s1600-h/FAQ17.7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S50qsNRaSqI/AAAAAAAAAhk/NVdC8xj3S-0/s320/FAQ17.7.png" /></a></div><br />
This pretty much wraps it up. Build the extension and run it. You should be able to see the progress bar while the action is running. You should also see the custom log window open and a number of log messages and links logged in it. <br />
<br />
<br />
<span style="font-size: large;"><b>Conclusion</b></span><br />
<br />
In this FAQ we've seen how to create a JDeveloper progress bar<i> </i>and a custom log pane - based on the <i>ProgressBar</i> and <i>ClickableURL </i>example extensions respectively. We've also seen how to add the plumbing code in the <i>Command doit()</i> method to create them and display them.<br />
<br />
Until the next time, keep on JDeveloping!<br />
<br />
<br />
<span style="font-size: large;"><b>Code</b></span><br />
<br />
<span style="font-size: xx-small;"><a href="http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo17.rar">http://jdeveloperfaq.googlecode.com/files/JDeveloperFAQNo17.rar</a></span><br />
<br />
<table><tbody>
<tr><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/03/faq-16-how-to-get-started-with.html"><br />
<img src="http://2.bp.blogspot.com/_Lb-bi4pdlv8/S0RrdKJDifI/AAAAAAAAARc/SgJhOs5a8tg/s320/previous.jpg" /><br />
</a></td><td><br />
<a href="http://jdeveloperfaq.blogspot.com/2010/03/faq-18-how-to-get-started-with.html"><br />
<img src="http://1.bp.blogspot.com/_Lb-bi4pdlv8/S0RotJU2dnI/AAAAAAAAARU/TuVKN33KA9k/s320/next.jpg" /><br />
</a></td></tr>
</tbody></table>Nickhttp://www.blogger.com/profile/06649943531692175880noreply@blogger.com0