Wednesday, 16 April 2014

Implementing Portlet Preferences

Process of building PortletPreferences / Personalization

1. Create PortletPreferences object and setValue() with request.getParameter or something else.
2. Store the portletpreference object into persistent storage using prefobj.store()
3. And can retrieve/set the stored preference object in XXX.jsp or any render method

-> In back-end this preference objects will stored into the Portal database with predefined conditions.
-> We have two important methods store() and reset(), where store() method stores the preference object into database and if we want to reset the values to default we can use reset() method.
-> We should not invoke the store() method in any portlet’s render method, in any portlet mode, which will result in an exception.
-> We can also validate preferences by using interface PreferencesValidator.
-> We can also set preference and preferences-validator in Portlet.xml file as below;

<portlet-app ...>
<portlet>
<portlet-name>yourportlet</portlet-name>
<portlet-class>portlet class path</portlet-class>
...
<portlet-preferences>
<preference>
<name>maxNumOfBooks</name>
<value>1000</value>
</preference>
<preferences-validator>
chapter10.code.listing.validators.BookCatalogPrefsValidator
</preferences-validator>
</portlet-preferences>
</portlet>
...
</portlet-app>


Code in file -- msperfportlet_view.jsp --

<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%-- Uncomment below lines to add portlet taglibs to jsp --%>
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />

<%
    // We can also get preferences object here in jsp
    PortletPreferences jspprefs = renderRequest.getPreferences();
    //String prefvalues[] = jspprefs.getValues("category",new String[]{"-99"});
    List list = java.util.Arrays.asList(jspprefs.getValues("category",new String[]{"-99"}));
%>


<form action="<portlet:actionURL/>" method="POST">
       
    <h2>User Preference on Cricket</h2>
   
    <select name="cricketPref" multiple="multiple">
        <option value="test"<%=list.contains("test")?"selected":""%> id="userselection">Test Matches</option>
        <option value="od"<%=list.contains("od")?"selected":""%> id="userselection">OD Matches</option>
        <option value="ipl"<%=list.contains("ipl")?"selected":""%> id="userselection">IPL</option>
        <option value="icl"<%=list.contains("icl")?"selected":""%> id="userselection">ICL</option>
        <option value="t20"<%=list.contains("t20")?"selected":""%> id="userselection">T20</option>
    </select>
   
    <input type="submit" value="Submit" />
       

</form>



Code in file -- msperfportlet.java --

package ms.eb;

import javax.portlet.GenericPortlet;
import javax.portlet.ActionRequest;
import javax.portlet.RenderRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PreferencesValidator;
import javax.portlet.ProcessAction;
import javax.portlet.RenderMode;
import javax.portlet.ValidatorException;

/**
 * msperfportlet Portlet Class
 */
public class msperfportlet extends GenericPortlet{// implements PreferencesValidator{
   
     
    //@ProcessAction(name = "savePreferences")
    public void processAction(ActionRequest request, ActionResponse response)throws PortletException, IOException {
       
        // Getting parameter values from msperfportlet_view.jsp
        String[] prefCategories = request.getParameterValues("cricketPref");
        for(int i=0; i<prefCategories.length; i++){
            System.out.println("Selected Preference Value is :: "+prefCategories[i]);
        }
       
        // Creating a PortletPreferences object and setting preference value using setValues
        PortletPreferences prefs = request.getPreferences();        
        if(prefCategories != null) {
            // Setting preffered categorites preffered value
            prefs.setValues("category", prefCategories);
        }
       
        // Storing preferences in a persistent store
        // This should be in only processAction method only
        prefs.store();          
       
        // Reseting preference value to default
        // We have to reset preference by reset() only but not with assigning null value to setValues() has null is also taken has valid entry
        //prefs.reset("category");
    }
   
    public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
        response.setContentType("text/html");
        // We Can get preferences object in doview also but we cant store preferences object here
        /*PortletPreferences renderpref = request.getPreferences();
        String str[] = renderpref.getValues("category",new String[]{"-99"});
        for(int i=0; i<str.length; i++){
            System.out.println("Preference Value from doView() :: "+str[i]);
        }*/
        PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/msperfportlet_view.jsp");
        dispatcher.include(request, response);
    }

    public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {
        response.setContentType("text/html");      
        PortletRequestDispatcher dispatcher =
                getPortletContext().getRequestDispatcher("/WEB-INF/jsp/msperfportlet_edit.jsp");
        dispatcher.include(request, response);
    }
   
//    @RenderMode(name = "edit")
//    public void showPrefs(RenderRequest request, RenderResponse response)throws PortletException, IOException{
//        PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/msperfportlet_edit.jsp");
//        dispatcher.include(request, response);
//    }

    public void doHelp(RenderRequest request, RenderResponse response) throws PortletException, IOException {
       
        response.setContentType("text/html");      
        PortletRequestDispatcher dispatcher =
                getPortletContext().getRequestDispatcher("/WEB-INF/jsp/msperfportlet_help.jsp");
        dispatcher.include(request, response);
    }

}




Monday, 10 February 2014

Fixing Cross Domain issue in WebSphere Portal with Connections

Environment - Integrated WebSphere Portal 8X with Connections 4.5 with SSO established.

Issue - Unable to retreive Connections Feed in Portlet without passing credentials.

Solution - To Resolve cross domain issue we have to update proxy-config.xml file and restart the server.

Process - Goto,

D:\IBM\WebSphere\wp_profile\config\cells\TIT-JAVA-010Cell\applications\AJAX Proxy Configuration.ear\deployments\AJAX Proxy Configuration\wp.proxy.config.war\WEB-INF\proxy-config.xml

    1. Take backup of proxy-config.xml
    2. Update the proxy-config.xml by adding below lines after <mapping ;
            <policy url="*" acf="none">
                <actions>
                    <method>GET</method>
                </actions>
            </policy>
    3. Update the proxy-config.xml by adding below lines for <policy url="{$ibm_connections_policy}" acf="none" basic-auth-support="true">
            <users>
                <user>AllAuthenticatedUsers</user>           
            </users>
    4. For my testing I also updated Connections Proxy-config.xml at location IBM/WebSphere/proxy-config.xml
   
    5. Restart the server.
   
    6. Next, call below url in portlet to retrive feed without using credentials;
            http://<hostname>:<port>/wps/proxy/http/conserver.com/path/on/server/somefile.xml
           
            Example : https://andiwspdb01.spil.com/social/proxy/http/andiswp01.spil.com/connections/opensocial/basic/rest/activitystreams/urn:lsid:lconn.ibm.com:communities.community:89743724-9899-488a-bd9d-491ee2fed4f6/@all/@status?rollup=true&format=atom
           
           
Ref Url :

http://www-10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+WebSphere+Portal+7+Product+Documentation#action=openDocument&res_title=Global_proxy_configuration_wp7&content=pdcontent

http://publib.boulder.ibm.com/infocenter/ltscnnct/v2r0/index.jsp?topic=/com.ibm.connections.25.help/t_admin_proxy_ltpa_token.html

http://publib.boulder.ibm.com/infocenter/ltscnnct/v2r0/index.jsp?topic=/com.ibm.connections.25.help/t_admin_config_ajax_proxy.html

http://www-10.lotus.com/ldd/lcwiki.nsf/dx/Setting_up_single_sign-on_between_IBM_Lotus_Connections_2.5_and_Computer_Associates_SiteMinder

http://www-10.lotus.com/ldd/lcwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+Documentation#action=openDocument&res_title=Enabling_the_AJAX_proxy_to_forward_user_credentials_ic45&content=pdcontent

http://infolib.lotus.com/resources/portal/8.0.0/doc/en_us/PT800ACD002/collab/i_coll_t_enable_lcserver_access.html

http://www-10.lotus.com/ldd/mashupswiki.nsf/page.xsp?documentId=655ED56EB51DE0C5852576CE004BA293&action=openDocument

http://www-10.lotus.com/ldd/mashupswiki.nsf/xpDocViewer.xsp?lookupName=IBM+Mashup+Center+2.0+documentation#action=openDocument&res_title=Configuring_the_AJAX_proxy_with_single_signon__Mashup_Center_2.0&content=pdcontent

http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Troubleshooting_the_Ajax_Proxy_in_Portal

http://www-10.lotus.com/ldd/portalwiki.nsf/dx/The_Ajax_Proxy_in_Portal

Thursday, 6 February 2014

Creating JDBC Provider and DataSource in WebSphere Portal

Ref URL : http://www.websphereusergroup.org/steverobinson/blog/2012/07/23/using_mysql_with_websphere_application_server
 http://www.websphereusergroup.org/go/thread/view/108057/30020763/Error_trying_to_connect_Mysql_Database

 Problem: If server couldn't reach database server. To solve the problem, I got into "custom properties" and set the "url" property with jdbc connection string. Now everything works fine and operative

For MYSQL
---------

** required jar file 'mysql-connector-java-5.1.6.jar'

Process to configure JDBC Provider
----------------------------------
1. Goto Admin console, Resources -> JDBC -> JDBC Provider -> New
2. Select the  Database type  you would like to use from the dropdown list(here i used MYSql so i selected user-defined)
3. Provide Implementation class name for MYSql, i.e. 'com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource'
4. And specify a name and description for jdbc provider.
5. And specify 'mysql-connector-java-5.1.6.jar' file path, i.e. D:/jars/mysql-connector-java-5.1.6.jar
6. And provide Native library path(.dll file path) if requried

Now your JDBC Provider created.

Process to configure Datasource
-------------------------------
1. Goto Admin console, Resources -> Data sources -> New
2. Provide custom Datasourcename and JNDIname
3. Select an existing JDBC Provider just we created.
4. Specify 'Data store helper class name' value with this 'com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper'
5. At 'Setup security aliases' dont select any thing just click next and finish.

Now your Data source created, now you have to provide authentication and database details.

6. Now click on Datasource just now we created
7. Here you can see 'JAAS - J2C authentication data' link click on that and select New
8. Now you provide
-> Alias, any name to refer for security
-> User ID, database userid i.e. root for mysql
-> Password, database password, and save.
9. Now here 'JAAS - J2C authentication data' has created which is used to connect to database
10. Now click on Datasource and goto 'Security settings' and configure following properties,
-> Component-managed authentication alias, from drop down select just now created alias name
-> Mapping-configuration alias, from drop down select 'DefaultPrincipalMapping'
-> Container-managed authentication alias, from drop down select just now created alias name, and save.
11. Now click on Datasource and click on 'Custom properties' link
12. Here we need to provide below three properties so that WAS can connect to MySQL
-> serverName (with ip address)
-> port (3306)
-> databaseName  (sumandb)
13. Now restart the portal server to apply changes.








Integrating Connections with Portal

ConfigEngine.bat install-paa -DPAALocation=D:\paa\SNPortlets.paa -DWasPassword=admin -DPortalAdminPwd=admin

ConfigEngine.bat deploy-paa -DappName=SNPortlets -DmaxTimeToWait=30 -DmaxAppTimeToWait=5 -DWasPassword=admin -DPortalAdminPwd=admin

ConfigEngine configure-SNPortlets -DICversion=4.5 -DICblogsHomepageHandle=homepage -DICemailSetting=email-exposed -DICtagSearchType=mysearch -DICdsxAdminId=wasadmin -DICdsxAdminPwd=Password1 -DICbaseURLunsecured=http://connections.socialnet.com -DICbaseURL=https://connections.socialnet.com -DWasPassword=admin -DPortalAdminPwd=admin

(OR, we have to configure connections host name in host file located at Windows/System32/drivers/etc/host)

ConfigEngine configure-SNPortlets -DICversion=4.5 -DICblogsHomepageHandle=homepage -DICemailSetting=email-exposed -DICtagSearchType=mysearch -DICdsxAdminId=wasadmin -DICdsxAdminPwd=Password1 -DICbaseURLunsecured=192.168.1.69 -DICbaseURL=https://192.168.1.69 -DWasPassword=admin -DPortalAdminPwd=admin

Changing WAS Admin Console password

It is not working properly have to do R&D

This is through manual process:
-------------------------------
1. We have to disable security in security.xml file so that we can directly login to IBM Console and change username and password.

2. Path of security.xml file "\IBM\WebSphere\wp_profile\config\cells\TIT-JAVA-010Cell\security.xml"

3. Change very first occurance of enabled="true" to enabled="false" so that security will be disabled.

4. Restart server and access Admin Console without login.

5. In leftside navigation goto Security->GlobalSecurity->SecurityConfigurationWizard->Next->Fedarated Repositories

6. Change username/password and save changes

7. Enable security and restart server. Now you can login into Admin Console with new credentials.


Ref Url : This is through scripting
-----------------------------------
http://kbee.de/2011/11/04/resetting-was-admin-password-when-the-browser-console-does-not-work-anymore/

About AJAX and retrieving connections feed example

AJAX
----
AJAX = Asynchronous JavaScript and XML.

AJAX is not a new programming language, but a new way to use existing(Internet) standards.

AJAX is the art of exchanging data with a server, and updating parts of a web page - without reloading the whole page.
AJAX is about updating parts of a web page, without reloading the whole page.

AJAX applications are browser- and platform-independent!

The keystone of AJAX is the XMLHttpRequest object.

The XMLHttpRequest object is used to exchange data with a server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

-> 'XMLHttpRequest' object is used for data exchange asynchronusly.

Basic Flow of Ajax
------------------
1. When an event occurs in a browser, an 'XMLHttpRequest' object is created and send that request object to server.
2. In server Http request is processed and send responce to  browser.

There are few methods for XMLHttpRequest to process, they are,
open(method,url,async)
send(string)
setRequestHeader(header,value)

When async=true, 'onreadystatechange' event is used to execute response, this event is triggered every time the 'readyState' changes.

The 'readyState' property holds the status of the XMLHttpRequest.

Three important properties of the 'XMLHttpRequest' object:
onreadystatechange -
Stores a function (or the name of a function) to be called automatically each time the readyState property changes
readyState -
Holds the status of the XMLHttpRequest. Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status -
200: "OK"
404: Page not found

To get the response data from the server we use properties 'responseText' & 'responseXML' for xmlhttprequest object.


Sample Example
--------------
<html>

<head>
<script type="text/javascript">
function loadXMLDoc()
{
var xmlhttp;

/* To create an 'XMLHttpRequest' object */
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();  // here xmlhttprequest object is created
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

    /* 'onreadystatechange' is used when async=true, to execute when the response is ready */
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText; // responseText : gets the response data as a string
// responseXML  : gets the response data as XML
}
}

/* xmlhttprequest object methods are open(method,url,async), send(string) and setRequestHeader(header,value) */
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
}
</script>

</head>

<body>
<div id="myDiv"><h2>Let AJAX change this text</h2></div>
<button type="button" onclick="loadXMLDoc()">Change Content</button>
</body>
</html>


Example for retrieving websphere connections feed  in ajax:

var getMyKeyURL = "https://tecnics.connections.com/communities/service/atom/forms/communities/my?sortField=lastmod&inclForum=true&ps=3&forceRefresh=1386773191722";

$.ajax({
type : "GET",
url : getMyKeyURL,
dataType : "xml",
cache : false,
async : true,
success : function(data) {
alert("XML File is loaded!");
alert("data: "+data);
var author = $(data).find("author").last();
alert("author: "+author);
name = $(author).find("name").text();
alert("name: "+name);
myKey = $(author).find("userid").text();
alert("myKey : "+myKey);
},
error: function() {
alert("getMyKey error...!");
}
});



Adding Blog Library and Configuring broadcast links in WCM

Adding Blog Library in WCM
--------------------------
1. Add Blog Library from administration->portal content->web content libraries.
2. Here Blog is refered as SiteArea and Content is reffered as post.
3. Create the required content(post) and configure the portlet.

4. Now you see your websphere blog. In right side we have latest posts. If we click on the latest post it should show complete post with theme. This can be done using broadcast links.

How to configure broadcast links
--------------------------------
1. In 'Blog page' while configuring portlet, in advanced options, in Broadcast Links -- select 'following page' and specify 'page unique name'(ie. testBlog page).
2. Here 'testBlog page' is the new dummy page and 'unique name' should match. And specify same theme.
3. and for 'testBlog page' while configuring portlet, in advanced options, in Broadcast Links -- keep none.

broadcast link works


=============================================

Creating Blogs for Site
-----------------------
Create a content in 'Blog Template V70 library' -- 'central' site area, using authoring template 'Blog Home' which is in 'Web Resources v70'.

Adding Comments in WCM

WCM ADD Comments
----------------
MENU_Comments structure
-----------------------
// Header
<table><tbody><tr>
<td>___________________________________________________</td>

</td></tr>


// Design
<tr><td><br><br>
<b>Comments:<b><br>
<br>[Element context="autofill" type="content" key="Comment"]
<br>Commented By:[Property context="autofill" type="content" field="creator"]
<br>------------------------------------<br>
</td><td>
</td></tr>


// Footer
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
            function checkdata() {


var sapath =$("input#paths").val();
var ctitle="&ctitle=" +'[Property context="current" type="content" field="title"]';
var remove = "/wps/wcm/myconnect/Dark+Theme+Library";
sapath=sapath.replace(remove,"");

var sa='[Property context="current" type="content" field="title"]';
var sec_remove=sa;
sapath=sapath.replace(sec_remove,"");


var link="/wps/wcm/jsp/html/ndtvcomment.jsp?contenttitle="+sapath+ctitle;

var frm = document.getElementById("frm_comment");
                frm.action=link;

            }
        </script><tr><td>
<br>ADD YOUR COMMENT<br>
<form name="contact" action="" method="post" id="frm_comment" onsubmit="checkdata()">  
<textarea rows="2" cols="20" name="Comment" id="comment_field"></textarea>
<input type="submit" name="AddComment" id="commentbtn" value="Add Comment">
</form></td></tr>
</tbody></table>
<input type="text" id="paths" value='[URLCmpnt context="current" type="content" mode="standalone"]' style="display:none;"></input>


// No Result Design
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
            function checkdata() {


var sapath =$("input#paths").val();
var ctitle="&ctitle=" +'[Property context="current" type="content" field="title"]';
var remove = "/wps/wcm/myconnect/Dark+Theme+Library";
sapath=sapath.replace(remove,"");

var sa='[Property context="current" type="content" field="title"]';
var sec_remove=sa;
sapath=sapath.replace(sec_remove,"");


var link="/wps/wcm/jsp/html/ndtvcomment.jsp?contenttitle="+sapath+ctitle;

var frm = document.getElementById("frm_comment");
                frm.action=link;

            }
        </script>

<table><tbody><tr>
<td>___________________________________________________
<br>ADD YOUR COMMENT<br>

<form name="contact" action="" method="post" id="frm_comment" onsubmit="checkdata()">  
<textarea rows="2" cols="20" name="Comment" id="comment_field"></textarea>
<input type="submit" name="AddComment" id="commentbtn" value="Add Comment">
</form></td></tr>
</tbody></table>
<input type="text" id="paths" value='[URLCmpnt context="current" type="content" mode="standalone"]' style="display:none;"></input>

WCM Active Site Analytics - 2

Portal Analytics is the process of Collecting, Processing, and Reporting portal usage data.

Analytics Data Collection Approaches ::
 There are two main approaches for collecting analytics data:

Server side site analytics
Active Site Analytics

Analyzing portal usage data
----------------------------
You can collect data about the usage of your portal and analyze them.

You can collect these types of data:
1. Server side data of your portal site. This consists mainly of technical data internal to the portal.
2. Data about the behavior of your client users. You analyze this data by using Active Site Analytics (ASA).


Analyzing user behavior by Active Site Analytics ::
---------------------------------------------------
You can collect data about user behavior in your portal and send that data to a service for analysis. For this purpose the portal provides Active Site Analytics (ASA).

To configure active site analytics for a page. In page properties-->advanced options-->set parameter value
parameter value
--------- -----
asa_aggregator asa.jsp

If asa is configured for parent page, it is inhereted to child pages also.

=========================================================WCM 8==================================================================================================

We can collect data about user behavior in our portal and send that data to a service for analysis. For this purpose the portal provides Active Site Analytics (ASA).

The portal provides a rich set of page metadata as part of its themes and skins. Examples are:
Page title
Page identifier
Portlet title
Portlet identifier.

We can write scripts to retrieve the data. Such scripts are called aggregators.

Aggregators are located in the PortalServer_root/doc/js-samples directory of your portal installation.

Process for Active Site Analytics ::
1. Collecting analytics data
Before we can send data about user behavior in our portal to a service for analysis, we need to collect that data.
2. Displaying overlay analytic reports
Active Site Analytics show graphical statistics reports about individual portal resources, such as pages or portlets.
These reports are called Active Site Analytics overlay reports.
3. Analytics tags and site promotion

1. Collecting analytics data
----------------------------
The data for the analysis of user behavior is retrieved from markup embedded in the portal pages.
The data is represented as a 'microformat' in portal page. An example of such microformat is:
<span class="asa.portlet.title">My Portlet</span>
Portal supports several aggregator tags, like; asa.portlet.title etc...
The aggregator typically submits the collected data to an external analytics service where the data is then recorded, processed, and formatted in the form of reports.
Portal administrators can manage the aggregators. They can assign an aggregator to one or more portal labels or pages.
Adding an ASA aggregator to a portal page
-----------------------------------------
Goto webDAV-->js folder-->take the name of the aggregator file. ex:- asa_sample.js
Goto Portal administration-->Manage pages-->Page(to set aggreator)-->Page properties-->Advanced options-->I want to set parameters
-->Add Parameter and Value(aggregator file name)-->ok-->ok
*In the field New parameter, type a string that starts with 'asa_aggregator' or 'asa_dependency' . asa_aggregator are added to the page body, asa_dependency are added to the head.

2. Displaying overlay analytic reports
--------------------------------------
The statistics graph is shown on a portal page in the format of a overlay.
The statistics are generated as follows:
-> The data collected by the portal site analytics are collected and forwarded to your business partners for portal analytics.
-> Your business partner analyses and evaluates the portal data and sends back a report to your portal.
-> The portal then displays the report as the overlay graph.
To setup active site analytics overlay report on portal, we have to follow these steps:
1. Enable data collection. For example, you can do this by adding an Active Site Analytics aggregator to a portal page:
-> Access the IBM® Coremetrics® Web Analytics web site or contact your Coremetrics representative.
-> Retrieve the appropriate aggregator file from Coremetrics.
-> Upload the aggregator file to your portal theme folder, for example, by using WebDAV.
-> Add Active Site Analytics aggregator to a portal page.
-> As a result of these steps, analytics data is sent from browsers of your portal users to the Coremetrics data collection servers.
-> You can log on to Coremetrics and analyze the portal usage.
2. Enable inline display of Coremetrics reports by enabling overlay reports:
-> Establish trust with Coremetrics servers.
To display overlay analytic report we have to configure/activate overlay reports for our site :
- Goto Admin console-->Resources-->Resources Environment-->Resource Environment Provider-->WP Config Services-->Custom Properties-->New
- Use the property name 'wp.proxy.config.urlreplacement.default_policy.1' and the value https://welcome.coremetrics.com/*
- If this name is already in use increment the counter of key.
- Apply and Save.
- Next, Import the Coremetrics certificate into your server truststore.
- Goto Admin console-->Security-->SSL certificate and key management-->SSL configurations-->NodeDefaultSSLSettings-->Key stores and
 certificates-->NodeDefaultTrustStore-->Signer certificates-->Retrive form Port, and fill the form with details
If 'NodeDefaultSSLSettings' then it is Stand-alone environment
If 'CellDefaultSSLSettings' then it is Portal Clustur environment
- For the host: welcome.coremetrics.com
 For the port: 443
 For the alias: coremetrics or another identifying string of your choice.
- Retrive Signer Information and Apply & Save.

-> Optional: Set up security for overlay reports.
- You can administer which users can view overlay reports.
- To do this, you use the virtual resource OVERLAY_REPORTS having USER role assigned.

-> Configure your Coremetrics user ID.
- To access the IBM® Coremetrics® Web Analytics system, you have to store user information in a Credential Vault slot.
- If you do not do this, the portal overlay reports cannot show data from the Coremetrics system.
- To configure this we require,
Coremetrics client ID
Coremetrics user name
Coremetrics authentication key.
- Goto admin-->access-->credential vault-->add vault slot, and fill the portlet with details
- name : com.ibm.portal.asa.coremetrics.slot
 shared user ID : coremetrics_user_name#coremetrics_client_id

-> Display overlay reports by choosing Show Portlet Reports or Show Page Reports.
- To enable overlay statistics, the user opens the page actions menu and selects either Show Portlet Reports or Show Page Reports.
- When the user clicks a report type in the actions menu, the display reports setting is persisted in the navigational state.
- This means that the user can now navigate through the portal and view statistics on every page that the user visits.
- To disable overlay statistics, the user opens the page actions menu again and clicks the menu item Close Analytics Reports.

-> Optional: Customize the overlay report by providing additional configuration parameters.

3. Optional: To further customize the tagging of your site, assign site promotions to pages and portlets as required.




Ref : http://publib.boulder.ibm.com/infocenter/wcmdoc/v6r1/index.jsp?topic=%2Fcom.ibm.lotus.wcm.doc_v615%2Fadmin%2Fsa_asa_use_theme.html
: http://wpcertification.blogspot.in/search/label/asa
: http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Enabling_Active_Site_Analytics_in_WebSphere_Portal_7.0
: http://www-10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+WebSphere+Portal+8+Product+Documentation#action=openDocument&res_title=Displaying_overlay_analytics_reports_wp8&content=pdcontent
http://www-10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+WebSphere+Portal+8+Product+Documentation#action=openDocument&res_title=Analyzing_user_behavior_by_Active_Site_Analytics_wp8&content=pdcontent
http://www-10.lotus.com/ldd/portalwiki.nsf/xpDocViewer.xsp?lookupName=IBM+WebSphere+Portal+8+Product+Documentation#action=openDocument&res_title=Web_analytics_wp8&content=pdcontent

http://www-10.lotus.com/ldd/portalwiki.nsf/xpSearch.xsp?searchValue=active%20site%20analytics







Portal Scripting jython(.py) files samples that implemented

 customJDBCProvider.py

#
# My Custom Jython Script file for creating JDBC Provider --- customJDBCProvider.py
# To Run script in wsadmin follow below command
# wsadmin.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin -f  customJDBCProvider.py
#
sc =  AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/')
t = AdminConfig.listTemplates('JDBCProvider', 'User-defined JDBC Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_0)')
AdminConfig.createUsingTemplate('JDBCProvider', sc, [['name', 'customUserDefined']], t)
AdminConfig.save()


customDataSourceTotal.py

newjdbc = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:customUserDefined/')
print newjdbc
print AdminConfig.required('DataSource')
name = ['name', 'customUserDefinedDataSource']
dsAttrs = [name]
newds = AdminConfig.create('DataSource', newjdbc, dsAttrs)
print newds
AdminConfig.save()

newds = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:customUserDefined/DataSource:customUserDefinedDataSource/')
print AdminConfig.create('ConnectionPool', newds, [])
AdminConfig.save()

newds = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/JDBCProvider:customUserDefined/DataSource:customUserDefinedDataSource/')
print newds
propSet = AdminConfig.showAttribute(newds, 'propertySet')
print propSet
print AdminConfig.required('J2EEResourceProperty')
name = ['name', 'RP4']
rpAttrs = [name]
print AdminConfig.create('J2EEResourceProperty', propSet, rpAttrs)
AdminConfig.save()


customDataSourceCustomProperties.py

newds=AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:customDB2JDBCProviderfortesting/DataSource:customDB2JDBCProviderDataSource/')
print newds
propSet = AdminConfig.showAttribute(newds, 'propertySet')
print propSet
print AdminConfig.required('J2EEResourceProperty')
name = ['name', 'RP4']
rpAttrs = [name]
print AdminConfig.create('J2EEResourceProperty', propSet, rpAttrs)
AdminConfig.save()

customDataSource.py

newjdbc = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:customDB2JDBCProviderfortesting/')
print newjdbc
print AdminConfig.required('DataSource')
name = ['name', 'customDB2JDBCProviderDataSource']
dsAttrs = [name]
newds = AdminConfig.create('DataSource', newjdbc, dsAttrs)
print newds
AdminConfig.save()


customConnectionPool.py

newds = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:customDB2JDBCProviderfortesting/DataSource:customDB2JDBCProviderDataSource/')
print AdminConfig.create('ConnectionPool', newds, [])
AdminConfig.save()

Portal Scripting - Configuring new Java 2 Connector authentication data entries using scripting

Configuring new Java 2 Connector authentication data entries using scripting
----------------------------------------------------------------------------

1. Identify the parent ID:
security = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Security:/')
print security

2. Get required attributes:
print AdminConfig.required('JAASAuthData')

3. Set up required attributes:
alias = ['alias', 'myCustomAlias']
userid = ['userId', 'root']
password = ['password', 'admin']
jaasAttrs = [alias, userid, password]
print jaasAttrs

4. Create JAAS auth data:
print AdminConfig.create('JAASAuthData', security, jaasAttrs)

5. Save changes
AdminConfig.save()


When we try to establish connection below exception is showing up;

The test connection operation failed for data source Custom Datasource on server WebSphere_Portal at node TIT-JAVA-010Node with the following exception: java.sql.SQLException: Access denied for user ''@'tit-java-010.tecnicsdev.com' (using password: NO) DSRA0010E: SQL State = 28000, Error Code = 1,045. View JVM logs for further details.

But if we go to created alias and once again type the same userid and password then it is connecting.

Portal Scripting - Created JDBC Provider using AdminTask

Created JDBC Provider using Admin Task with interactive
-------------------------------------------------------

AdminTask.createJDBCProvider (['-interactive'])

Cell=TIT-JAVA-010Cell, Node=TIT-JAVA-010Node, Server=WebSphere_Portal

User-defined

User-defined JDBC Provider

Connection pool data source

com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource

D:\smn\Jars\mysql-connector-java-5.1.6.jar

Native, false
isolated, false

AdminConfig.save()

Portal Scripting - Creating new Datasource using wsadmin tool

***Creating new Datasource using wsadmin tool***
------------------------------------------------
There are two ways to configure datasource through wsadmin
1. AdminConfig object
2. AdminTask object

AdminConfig gives you more configuration control than the AdminTask object.

Using the AdminConfig object to configure a new data source:
------------------------------------------------------------
1. Identify the parent ID, which is the name and location of the JDBC provider that supports your data source
newjdbc = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:CustomJDBC2/')
print newjdbc

2. Obtain the required attributes
print AdminConfig.required('DataSource')

3. Set up the required attributes
name = ['name', 'customDataSource']
dsAttrs = [name]

4. Create the data source
newds = AdminConfig.create('DataSource', newjdbc, dsAttrs)
print newds

5. Save changes
AdminConfig.save()

Using the AdminTask object to configure a new data source:
----------------------------------------------------------
1. AdminTask.createDatasource (['-interactive'])

2. provide requird fields and follow the procedure

3. save changes




***Configuring new data source custom properties using wsadmin***
-----------------------------------------------------------------
1. Identify the parent ID
newds = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/JDBCProvider:CustomJDBC2/DataSource:customDataSource/')
print newds

2. Get the J2EE resource property set
propSet = AdminConfig.showAttribute(newds, 'propertySet')
print propSet

3. Get required attribute
print AdminConfig.required('J2EEResourceProperty')

4. Set up attributes
name = ['name', 'RP4']
rpAttrs = [name]

5. Create a J2EE resource property
print AdminConfig.create('J2EEResourceProperty', propSet, rpAttrs)

6. Save changes
AdminConfig.save()

Portal Scripting - jdbc provider list of templates

'"Cloudscape JDBC Provider (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2j_4)"\r\n
 "Cloudscape JDBC Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2j_4)"\r\n
 "Cloudscape JDBC Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2j_3)"\r\n
 "Cloudscape JDBC Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2j_3)"\r\n
 "Cloudscape Network Server Using Universal JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2jN_1)"\r\n
 "Cloudscape Network Server Using Universal JDBC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2jN_1)"\r\n

 "DB2 Legacy CLI-based Type 2 JDBC Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)"\r\n
 "DB2 Legacy CLI-based Type 2 JDBC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_4)"\r\n
 "DB2 Legacy CLI-based Type 2 JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_3)"\r\n
 "DB2 Legacy CLI-based Type 2 JDBC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_3)"\r\n
 "DB2 UDB for iSeries (Native - V5R1 and earlier)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"\r\n
 "DB2 UDB for iSeries (Native - V5R2 and later)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_3)"\r\n
 "DB2 UDB for iSeries (Native XA - V5R1 and earlier)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_6)"\r\n
 "DB2 UDB for iSeries (Native XA - V5R2 and later)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_4)"\r\n
 "DB2 UDB for iSeries (Native XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_2)"\r\n
 "DB2 UDB for iSeries (Native)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_1)"\r\n
 "DB2 UDB for iSeries (Toolbox XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_10)"\r\n
 "DB2 UDB for iSeries (Toolbox)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_9)"\r\n
 "DB2 UDB for iSeries Provider Only (Native - V5R2 and later)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2400_3)"\r\n
 "DB2 UDB for iSeries Provider Only (Native XA - V5R2 and later)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2400_4)"\r\n
 "DB2 UDB for iSeries Provider Only (Native XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2400_2)"\r\n
 "DB2 UDB for iSeries Provider Only (Native)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2400_1)"\r\n
 "DB2 UDB for iSeries Provider Only (Toolbox XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2400_10)"\r\n
 "DB2 UDB for iSeries Provider Only (Toolbox)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_db2400_9)"\r\n
 "DB2 Universal JDBC Driver Provider (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)"\r\n
 "DB2 Universal JDBC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DB2_UNI_2)"\r\n
 "DB2 Universal JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DB2_UNI_1)"\r\n
 "DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)"\r\n
 "DB2 Using IBM JCC Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2IDS_XA)"\r\n
 "DB2 Using IBM JCC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DB2IDS_XA)"\r\n
 "DB2 Using IBM JCC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DB2IDS)"\r\n
 "DB2 Using IBM JCC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2IDS)"\r\n
 "DB2 for zOS Local JDBC Provider (RRS)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_RRS_zOS)"\r\n
 "DB2 for zOS Local JDBC Provider Only (RRS)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DB2_RRS_zOS)"\r\n

 "DataDirect ConnectJDBC type 4 driver for MS SQL Server (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DataDirect_2)"\r\n
 "DataDirect ConnectJDBC type 4 driver for MS SQL Server Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DataDirect_2)"\r\n
 "DataDirect ConnectJDBC type 4 driver for MS SQL Server Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DataDirect_1)"\r\n
 "DataDirect ConnectJDBC type 4 driver for MS SQL Server(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DataDirect_1)"\r\n
 "DataDirect SequeLink type 3 JDBC driver for MS SQL Server (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DataDirect_4a)"\r\n
 "DataDirect SequeLink type 3 JDBC driver for MS SQL Server (templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DataDirect_3a)"\r\n

 "Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/DeveloperServer|resources.xml#builtin_jdbcprovider)"\r\n
 "Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/PortalServerTemplate|resources.xml#builtin_jdbcprovider)"\r\n
 "Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/defaultZOS|resources.xml#builtin_jdbcprovider)"\r\n
 "Derby JDBC Provider (XA)(templates/servertypes/APPLICATION_SERVER/servers/default|resources.xml#builtin_jdbcprovider)"\r\n
 "Derby JDBC Provider (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)"\r\n
 "Derby JDBC Provider 40 (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_2)"\r\n
 "Derby JDBC Provider 40 Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_2)"\r\n
 "Derby JDBC Provider 40 Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_1)"\r\n
 "Derby JDBC Provider 40(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_1)"\r\n
 "Derby JDBC Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_4)"\r\n
 "Derby JDBC Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derby_3)"\r\n
 "Derby JDBC Provider(templates/servertypes/APPLICATION_SERVER/servers/DeveloperServer|resources.xml#JDBCProvider_1124467079638)"\r\n
 "Derby JDBC Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derby_3)"\r\n

 "Derby Network Server Using Derby Client (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derbyNS_3)"\r\n

 "Derby Network Server Using Derby Client 40 (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derbyNS_8)"\r\n
 "Derby Network Server Using Derby Client 40 Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derbyNS_8)"\r\n
 "Derby Network Server Using Derby Client 40 Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derbyNS_7)"\r\n
 "Derby Network Server Using Derby Client 40(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derbyNS_7)"\r\n

 "Derby Network Server Using Derby Client Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derbyNS_3)"\r\n

 "Derby Network Server Using Derby Client Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derbyNS_2)"\r\n
 "Derby Network Server Using Derby Client(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derbyNS_2)"\r\n

 "Derby Network Server Using Universal JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_derbyNS_1)"\r\n
 "Derby Network Server Using Universal JDBC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_derbyNS_1)"\r\n

 "Informix JDBC Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_2)"\r\n
 "Informix JDBC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Informix_2)"\r\n
 "Informix JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Informix_1)"\r\n
 "Informix JDBC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_1)"\r\n
 "Informix Using IBM DB2 JDBC Universal Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_JCC_2)"\r\n
 "Informix Using IBM DB2 JDBC Universal Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Informix_JCC_2)"\r\n
 "Informix Using IBM DB2 JDBC Universal Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Informix_JCC_1)"\r\n
 "Informix Using IBM DB2 JDBC Universal Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_JCC_1)"\r\n
 "Informix Using IBM JCC Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_JCC4_2)"\r\n
 "Informix Using IBM JCC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Informix_JCC4_2)"\r\n
 "Informix Using IBM JCC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Informix_JCC4_1)"\r\n
 "Informix Using IBM JCC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_JCC4_1)"\r\n

 "Microsoft JDBC driver for MSSQLServer 2000 (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_MS_2)"\r\n
 "Microsoft JDBC driver for MSSQLServer 2000(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_MS_1)"\r\n
 "Microsoft SQL Server JDBC Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Microsoft_XA)"\r\n
 "Microsoft SQL Server JDBC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Microsoft_XA)"\r\n
 "Microsoft SQL Server JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Microsoft)"\r\n
 "Microsoft SQL Server JDBC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Microsoft)"\r\n

 "Oracle JDBC Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Oracle_6)"\r\n
 "Oracle JDBC Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Oracle_6)"\r\n
 "Oracle JDBC Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Oracle_5)"\r\n
 "Oracle JDBC Driver UCP (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Oracle_6_UCP)"\r\n
 "Oracle JDBC Driver UCP Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Oracle_6_UCP)"\r\n
 "Oracle JDBC Driver UCP Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Oracle_5_UCP)"\r\n
 "Oracle JDBC Driver UCP(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Oracle_5_UCP)"\r\n
 "Oracle JDBC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Oracle_5)"\r\n

 "Sybase JDBC 2 Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Sybase_4)"\r\n
 "Sybase JDBC 2 Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Sybase_4)"\r\n
 "Sybase JDBC 2 Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Sybase_3)"\r\n
 "Sybase JDBC 2 Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Sybase_3)"\r\n
 "Sybase JDBC 3 Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Sybase_6)"\r\n
 "Sybase JDBC 3 Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Sybase_6)"\r\n
 "Sybase JDBC 3 Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Sybase_5)"\r\n
 "Sybase JDBC 3 Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Sybase_5)"\r\n
 "Sybase JDBC 4 Driver (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Sybase_8)"\r\n
 "Sybase JDBC 4 Driver Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Sybase_8)"\r\n
 "Sybase JDBC 4 Driver Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_Sybase_7)"\r\n
 "Sybase JDBC 4 Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Sybase_7)"\r\n

 "User-defined JDBC Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_0)"\r\n
 "User-defined JDBC Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_0)"\r\n

 "WebSphere embedded ConnectJDBC driver for MS SQL Server (XA)(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DataDirect_2a)"\r\n
 "WebSphere embedded ConnectJDBC driver for MS SQL Server Provider Only (XA)(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DataDirect_2a)"\r\n
 "WebSphere embedded ConnectJDBC driver for MS SQL Server Provider Only(templates/system|jdbc-resource-provider-only-templates.xml#JDBCProvider_DataDirect_1a)"\r\n
 "WebSphere embedded ConnectJDBC driver for MS SQL Server(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DataDirect_1a)"\r\n
 wpdbJDBC_derby(templates/servertypes/APPLICATION_SERVER/servers/PortalServerTemplate|resources.xml#JDBCProvider_1335003070131)'

Portal Scripting - To create JDBC Provider using Portal Scripting


****To create JDBC Provider****
-------------------------------

1. To set parent where we have to work
wsadmin>node = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/')

2. To print/output the node
wsadmin>print node

3. To Identify the required attributes for JDBC Provider
print AdminConfig.required('JDBCProvider')

4. Setting values for jdbc provider required attributes
n1 = ['name', 'CustomJDBC']
implCN = ['implementationClassName', 'com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource']
jdbcAttrs = [n1,  implCN]

5. To print this jdbcAttrs
print jdbcAttrs

6. Create a new JDBC provider using node as the parent
AdminConfig.create('JDBCProvider', node, jdbcAttrs)

7. Save the configuration changes
AdminConfig.save()

------The above procedure is used to create JDBC Provider through create(-,-,-) method---------

8. To set parent where we have to work
wsadmin>node = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/')

9. To list the templates provided in JDBC Provider
AdminConfig.listTemplates('JDBCProvider')

10. Specify the template that you want to use
t1 = AdminConfig.listTemplates('JDBCProvider', 'DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)')

11. Create a new JDBC provider using node as the parent using template
AdminConfig.createUsingTemplate('JDBCProvider', node, [['name', 'customDB2JDBCProvider']], t1)

12. Save the configuration changes
AdminConfig.save()

------The above procedure is used to create JDBC Provider through createUsingTemplate(-,-,-,-) method---------


Portal Scripting - Sample Script for creating JDBC Provider using AdminConfig

# This are comment lines
# My Custom Jython Script for creating JDBC Provider through create/createUsingTemplate
# Here getid should be specified has parent(scope) where we are creating our JDBC Provider
# To Run script in wsadmin follow below command
# wsadmin.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin -f  # #customJDBCProvider.py


# Creating JDBC provider using create command

node = AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/')
print node
print AdminConfig.required('JDBCProvider')
n2 = ['name', 'CustomJDBCProviderThroughScript']
implCN2 = ['implementationClassName', 'com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource']
jdbcAttrs = [n2,  implCN2]
print jdbcAttrs
AdminConfig.create('JDBCProvider', node, jdbcAttrs)
AdminConfig.save()



******************************************************************************************************************************************************************

# Creating JDBC provider using createUsingTemplate command


sc =  AdminConfig.getid('/Cell:TIT-JAVA-010Cell/Node:TIT-JAVA-010Node/Server:WebSphere_Portal/')
t = AdminConfig.listTemplates('JDBCProvider', 'DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)')
AdminConfig.createUsingTemplate('JDBCProvider', sc, [['name', 'customDB2JDBCProvider']], t)
AdminConfig.save()

Jython Commands - Portal Scripting Commands

To start wsadmin client tool, ->

 Goto, /appserver/bin and copy below command

 wsadmin.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin

 To run a jython file we have to type this below command and this file should be kept at following location "/appserver/bin" -> Goto, /appserver/bin and copy below command 

wsadmin.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin -f customJDBCProvider.py

Logging into Portal
wsadmin>Portal.login("virtuser","Wsadmin1")

Search for a portal page
wsadmin>Content.find("page","un","uniqenameofpage","select")      

To display some standard information about a portal resource, use the details() command
wsadmin>Content.find("any","un","uniquename","select")
Content.details()
Content.get("type")
Content.get("uniquename")
Content.get("allportlets")
Content.nlsget("title", "en")
Content.path()

To Create a Page
wsadmin>Content.find("page","un","uniqenameofpage","select")
wsadmin>Content.create("page","First Page","html","select")

To Add portlet to that page
wsadmin>myportlet = Portlet.find("portlet", "un", "portletunqiuename")
wsadmin>Layout.create("container", "horizontal", "select")
wsadmin>Layout.create("portlet", myportlet)

Portal Scripting Interface

- Portal Scripting Interface is an extension to the WebSphere Application Server wsadmin tool.
- You can use the Portal Scripting Interface to configure and administer your portal by running scripts from a command line.
- You can also write the commands into a file and run that file.
- Portal Scripting supports two languages JACL and Jython.

Difference between JACL and Jython :

- Jacl is a Java-based variant of the Tcl language(Tool Command Language).
- Jython is a Java-based variant of the Python language.
- The most important thing to consider in comparing the two is that JACL is officially deprecated under WebSphere 6.x and will be phased out completely in favor of Jython in WebSphere 7.x.
- If you're writing scripts now, it's probably best to just learn Jython and write in Jython, as the Jacl2Jython tool still requires manual verification and editing of the converted script code. The conversion tool will probably convert most simple scripts, but anything even moderately complex has a chance of not translating very well, which may result in scripts doing unexpected things or not running at all.

-> Portal Scripting is installed at /opt/WebSphere/AppServer/bin
-> Portal Scripting Interface startup command file: wpscript.sh
-> Portal Scripting supports two lang;
1. Jython -- -lang jython
2. JACL -- -lang jacl

-> Command for Jython : ./wpscript.sh -lang jython
Command for JACL   : ./wpscript.sh -lang jacl


We got three ways to start wsadmin tool;

First:
1. goto location, IBM/WebSphere/PortalServer/bin
2. all script(jython/jacl) files should be located at, IBM/WebSphere/PortalServer/bin
3. run command, wpscript.bat -lang jython
4. to run a script(jython) file, wpscript.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin -f XXX.py

Second(Prefered):
1. goto location, IBM/WebSphere/AppServer/bin
2. all script(jython/jacl) files should be located at, IBM/WebSphere/AppServer/bin 
3. run command, wsadmin.bat -lang jython
4. to run a script(jython) file, wsadmin.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin -f XXX.py

Third:
1. goto location, IBM/WebSphere/wp_profile/bin
2. all script(jython/jacl) files should be located at, IBM/WebSphere/wp_profile/bin
3. run command, wsadmin.bat -lang jython
4. to run a script(jython) file, wsadmin.bat -lang jython -javaoption "-Djython.package.path=D:\IBM\WebSphere\AppServer\plugins\com.ibm.ws.wlm.jar" -username admin -password admin -f XXX.py


We are working with jython example

-> Not all of the WebSphere® Application Server component classes are packaged in the same .jar file.
   If you are going to be using the wsadmin tool to run Jython scripts,
   include the jython.package.path system property on your wsadmin command to ensure that all of the required JAR files are set to the jython package path during wsadmin startup.
 
-> Run wsadmin with an option other than -f or -c or without an option.
   The wsadmin tool starts and displays an interactive shell with a wsadmin prompt.
   From the wsadmin prompt, enter any Jacl or Jython command.
   You can also invoke commands using the AdminControl, AdminApp, AdminConfig, AdminTask, or Help wsadmin objects.
   To leave an interactive scripting session, use the quit or exit commands.
 
-> to run a jython file we have to type this below command and this file should be kept at following location "/bin"

wsadmin.bat -lang jython -f  jythonfile.py




Ref : http://setgetweb.com/tech/portal80/adpsi_start.html   http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Fae%2Ftxml_dataaccess.html
  http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Fae%2Ftxml_launchscript.html
  http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Fae%2Ftxml_configjdbc.html
  http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Fae%2Ftxml_template.html
  http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/cdat_jdbcprov.html

Showing Sametime icon on Portal Page

Here we are showing sametime icon on Portal page, and clicking on that icon opens a sametime popup window.

<html>
  <head>
    <script type="text/javascript">
function windopen(){
/*window.open(chaturl,"_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=no, resizable=yes, copyhistory=no, width=350, height=550");*/

window.open("https://st85meetingsp.lotus.com:9444/stwebclient/popup.jsp#{%27disableXDomain%27:true}","_blank","toolbar=yes, location=yes, scrollbars=no, resizable=yes, width=350, height=550");
}
   </script>
   <style type="text/css">
 #footerChart{bottom:0; right:10px; position:fixed; background:#3c70c9; color:#fff; width:auto; display:inline; padding:0px 0px; width:175px;}
#footerChart .userStatus{ float:left; display:inline; padding:5px 15px 2px 15px; font-size:16px;}
#footerChart .iconChart{ float:right ; display:inline; width:20px; border-left:1px solid #FFFFFF; text-align:center; padding:5px 5px;}
</style>
  </head>
<body>
<div id="footerChart">
<div class="userStatus">I am Available</div>
<div class="iconChart">
<a href="#" onclick="windopen();">
<img src="footerChat.gif" />
</a>
</div>
</div>
</body>
</html>