jsf custom grid tags mehmet nacar tallahassee, fl march, 2006

50
JSF Custom Grid JSF Custom Grid Tags Tags Mehmet Nacar Mehmet Nacar Tallahassee, FL Tallahassee, FL March, 2006 March, 2006

Upload: denis-higgins

Post on 12-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

JSF Custom Grid TagsJSF Custom Grid Tags

Mehmet NacarMehmet Nacar

Tallahassee, FLTallahassee, FL

March, 2006March, 2006

Page 2: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Optional JSF Optional JSF Background MaterialBackground Material

Page 3: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Standard JSF ValidatorsStandard JSF Validators

required attribute checks if the input required attribute checks if the input text is empty.text is empty.

<h:inputText id="username“ required="true“ value="#{resource.username}“ /><h:message id="junk1" for="username“ showDetail="true"errorStyle="color:red"/>

There are also validator methods to check format of the valueAlso there values to look up the property validity.

How do you write custom validators? How do you use them in the JSF page/bean code? Where do they go in the code base? What validators does VLab need? Where do they go? This is more of a discussion topic. --Marlon

Page 4: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Standard NavigationStandard Navigation

Navigation among JSF pages Navigation among JSF pages provided by faces-config.xmlprovided by faces-config.xml

Navigation rules defined like below.Navigation rules defined like below.<navigation-rule> <from-view-id>/upload/gFTP.jsp</from-view-id> <navigation-case> <from-outcome>proxy</from-outcome> <to-view-id>/upload/gftpProxy.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>success</from-outcome> <to-view-id>/upload/fileList.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>link</from-outcome> <to-view-id>/upload/junk.jsp</to-view-id> </navigation-case> </navigation-rule>

Page 5: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Managed BeansManaged Beans All beans has own specific property values. All beans has own specific property values. There are also common properties among the There are also common properties among the

beans.beans. submitAction() method is common for all beans.submitAction() method is common for all beans.

• Returns “success” value that controls navigation.Returns “success” value that controls navigation. error and errorStatus properties are also common error and errorStatus properties are also common

for all beans.for all beans.• <h:outputText value="#{taskgraph.error}" <h:outputText value="#{taskgraph.error}"

rendered="#{taskgraph.errorStatus}" rendered="#{taskgraph.errorStatus}" style="color:red" />style="color:red" />

Error properties catch exceptions and Error properties catch exceptions and display message summary to the user.display message summary to the user.

Page 6: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Beans in faces-config.xmlBeans in faces-config.xml managed-bean>managed-bean> <description>Context Bean is for context <description>Context Bean is for context

tags</description>tags</description> <managed-bean-name>context</managed-<managed-bean-name>context</managed-

bean-name>bean-name> <managed-bean-<managed-bean-

class>ogce.gsf.context.ContextBean</managclass>ogce.gsf.context.ContextBean</managed-bean-class>ed-bean-class>

<managed-bean-scope>session</managed-<managed-bean-scope>session</managed-bean-scope>bean-scope>

</managed-bean></managed-bean>

Page 7: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

JSF Extensions for JSF Extensions for VLABVLAB

Page 8: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Basic Idea for Grid Service ClientsBasic Idea for Grid Service Clients

We write JSF tag libraries wrap calls to the We write JSF tag libraries wrap calls to the Java CoG kit.Java CoG kit.

This simplifies association of page events This simplifies association of page events (button clicks, link clicks) with composite (button clicks, link clicks) with composite Grid actions.Grid actions.• And increase reuse of code.And increase reuse of code.

For documentation of the COG Abstraction For documentation of the COG Abstraction API and some programming examples, see API and some programming examples, see http://wiki.cogkit.org/index.php/Java_CoG_http://wiki.cogkit.org/index.php/Java_CoG_Kit_Abstraction_GuideKit_Abstraction_Guide

Page 9: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Custom TagsCustom Tags tasktask

• Creates and submits grid tasksCreates and submits grid tasks taskgraphtaskgraph

• Creates and submits grid taskgraphs as Directed Acyclic Graph Creates and submits grid taskgraphs as Directed Acyclic Graph (DAG)(DAG)

• That is, describes composite, multistep actionsThat is, describes composite, multistep actions taskAddtaskAdd

• Sub component for taskgraph. Adds dependencySub component for taskgraph. Adds dependency proxyproxy

• Gets and manage proxies from Myproxy serverGets and manage proxies from Myproxy server storeContext storeContext

• Stores job information to ws-context server.Stores job information to ws-context server. uploadupload

• Provides upload capability to JSF (Browser to portal server)Provides upload capability to JSF (Browser to portal server)

Page 10: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

JSF Grid BeansJSF Grid Beans Package ogce.gsf has the following:Package ogce.gsf has the following:

• ResourceBean: loads properties from ResourceBean: loads properties from resources.propertiesresources.properties

• ProxyManagerBean: stores the Grid credential.ProxyManagerBean: stores the Grid credential.• TaskBean: simple job submissionTaskBean: simple job submission• TaskGraphBean: creates composite task submissionsTaskGraphBean: creates composite task submissions• FactoryBean: manages multiple TaskBean and FactoryBean: manages multiple TaskBean and

TaskGraphBean instances for a single userTaskGraphBean instances for a single user• GridFTPManagerBean: file operations and file browsingGridFTPManagerBean: file operations and file browsing• ContextBean: client to the WS-Context server, provides ContextBean: client to the WS-Context server, provides

context browsing.context browsing. Described in more detail below.Described in more detail below.

Page 11: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Managed Beans (Again)Managed Beans (Again) All beans has own specific property values. All beans has own specific property values. There are also common properties among the There are also common properties among the

beans.beans. submitAction() method is common for all beans.submitAction() method is common for all beans.

• Returns “success” value that controls navigation.Returns “success” value that controls navigation. error and errorStatus properties are also common error and errorStatus properties are also common

for all beans.for all beans.• <h:outputText value="#{taskgraph.error}" <h:outputText value="#{taskgraph.error}"

rendered="#{taskgraph.errorStatus}" rendered="#{taskgraph.errorStatus}" style="color:red" />style="color:red" />

Error properties catch exceptions and Error properties catch exceptions and display message summary to the user.display message summary to the user.

Page 12: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Resource BeanResource Bean Resource bean works with resource bundles.Resource bean works with resource bundles.

• resource.properties should be on the classpath.resource.properties should be on the classpath.• For webapps its path is WEB-INF/classesFor webapps its path is WEB-INF/classes• For jars its path is the parent directory.For jars its path is the parent directory.• The following are example properties with associated get/set The following are example properties with associated get/set

methods.methods.

hostname = gf1.ucs.indiana.eduprovider = GT2taskname = testexecutable = PWSCF/pwscf#arguments = 120stdin = /tmp/pwscf_inputstdout = /tmp/outsource = gridftp://gf1.ucs.indiana.edu/home/manacar/altixtarget = gridftp://gf1.ucs.indiana.edu/home/manacar/outcontextURI = /tmp/vlab/manacarusername = manacarportNumber = 7512

Page 13: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Proxy Manager BeanProxy Manager Bean

Gets proxy from myproxy server.Gets proxy from myproxy server. Stores the proxy into session, since proxy Stores the proxy into session, since proxy

is sharable among portlets.is sharable among portlets. Its parameters taken by resource bean.Its parameters taken by resource bean. Action method of proxy bean is Action method of proxy bean is

authenticate.authenticate.

<h:commandButton id="submit“ action="#{ProxyManagerBean.authenticate}“ value="GetProxy"/>

Page 14: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Task BeanTask Bean Major task unit of Java COG abstractions.Major task unit of Java COG abstractions. Corresponds to GRAM job submissions.Corresponds to GRAM job submissions. Gets input parameters, prepares task and submit it.Gets input parameters, prepares task and submit it. Works with Factory Bean.Works with Factory Bean.

• Factory Bean manages multiple instances for a single user.Factory Bean manages multiple instances for a single user.• Each Factory Bean associated with Cookie/Session, so Tomcat Each Factory Bean associated with Cookie/Session, so Tomcat

and JSF manage Factory Beans for different users and JSF manage Factory Beans for different users So we only have to worry about multiple beans owned by same So we only have to worry about multiple beans owned by same

user.user. Tomcat distinguishes different users for us.Tomcat distinguishes different users for us.

All submitted tasks stored in the factory.All submitted tasks stored in the factory. TaskBean implements StatusListener to report status TaskBean implements StatusListener to report status

changeschanges <o:task id="task1" method="#{task.create}" <o:task id="task1" method="#{task.create}"

type="FileTransferInput" />type="FileTransferInput" /> <o:task id="task2" method="#{task.create}" <o:task id="task2" method="#{task.create}"

type="JobSubmit" /> type="JobSubmit" /> <o:task id="task3" method="#{task.create}" <o:task id="task3" method="#{task.create}"

type="FileTransferOutput" />type="FileTransferOutput" />

Page 15: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Task Submission FormTask Submission Form

<h:panelGrid columns="3" > <h:outputText value="Hostname (*) "/> <h:inputText value="#{task.hostname}"/> </h:panelGrid> <h:panelGrid columns="3" > <h:outputText value="Provider (*) "/> <h:inputText value="#{task.provider}"/></h:panelGrid>

Corresponding JSF snippets<o:taskGraph id="myGraph" method="#{taskgraph.test}" > <o:task id="task1" method="task.create" type="FileTransfer" /> <o:task id="task2" method="task.create" type="JobSubmit" /> <o:task id="task3" method="task.create" type="FileTransfer" /> <o:taskAdd name="task1" method="taskgraph.add" /> <o:taskAdd name="task2" depends="task1" method="taskgraph.add" /> <o:taskAdd name="task3" depends="task2" method="taskgraph.add" /> </o:taskGraph>

<h:panelGrid columns="2"> <h:commandButton id="submit" value="Submit" action="#{taskgraph.submitAction}"/> <h:commandButton value="Clear" type="Reset"/> </h:panelGrid>

Page 16: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Task Monitoring with JSF Task Monitoring with JSF Data ModelData Model

<h:dataTable value="#{jobData.jobs}" var="job"> <h:column> <f:facet name="header"> <h:outputText style="font-weight: bold" value="Job ID" /> </f:facet> <h:outputText value="#{job.jobId}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText style="font-weight: bold" value="Submit Date" /> </f:facet> <h:outputText value="#{job.submitDate}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText style="font-weight: bold" value="Finish Date" /> </f:facet> <h:outputText value="#{job.finishDate}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText style="font-weight: bold" value="Status" /> </f:facet> <h:outputText value="#{job.status}"/> </h:column> </h:dataTable>

Corresponding Java class.public class Job { private String jobId; private String status; private String submitDate; private String finishDate;}

Page 17: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Factory BeanFactory Bean Controls bean creations and listeners.Controls bean creations and listeners.

• Clones beans and stores bean instances in the session.Clones beans and stores bean instances in the session. Factory Bean contain three hashmaps to store task Factory Bean contain three hashmaps to store task

features.features.• Beans (TaskBean)Beans (TaskBean)• Graphs (TaskGraph)Graphs (TaskGraph)• Listeners (for both)Listeners (for both)

Java COG listeners propagates status changes to listeners Java COG listeners propagates status changes to listeners and beans.and beans.• status, finishDate properties changes accordingly.status, finishDate properties changes accordingly.

Monitoring actions are called by Factory BeanMonitoring actions are called by Factory Bean Factory Bean initiates stores data to JobData object that Factory Bean initiates stores data to JobData object that

shown by JSF pageshown by JSF page JobData has List to in data table.JobData has List to in data table. Action methods Action methods

• monitorAction() is for task beanmonitorAction() is for task bean• monitorGraph() is for taskgraph beanmonitorGraph() is for taskgraph bean

Page 18: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

TaskGraph BeanTaskGraph Bean TaskGraph Bean manages a workflow of tasks. TaskGraph Bean manages a workflow of tasks. It creates composite tasks using DAG.It creates composite tasks using DAG. User has to define tasks and their dependency.User has to define tasks and their dependency.

• Otherwise tasks runs independently.Otherwise tasks runs independently. TaskGraph can compose sub taskgraphs.TaskGraph can compose sub taskgraphs. TaskGraph Bean has two internal Java COG object. TaskGraph Bean has two internal Java COG object.

• Taskgraph object: defines taskgraph spec and paramaters.Taskgraph object: defines taskgraph spec and paramaters.• Handler object: works with StatusListener to get status Handler object: works with StatusListener to get status

changes.changes. TaskGraphBean has to implement StatusListener to report TaskGraphBean has to implement StatusListener to report

status changesstatus changes

Page 19: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

GridFTPManagerBeanGridFTPManagerBean Provides file browsing, download, upload and file removing.Provides file browsing, download, upload and file removing. Establish a gridftp connectionEstablish a gridftp connection

<h:commandButton id="submit" value="Submit" <h:commandButton id="submit" value="Submit" action="#{gftp.getConnection}"/>action="#{gftp.getConnection}"/>

Browse files with doList()Browse files with doList()doList() loads filelist. It is an internal method called by getConnection() doList() loads filelist. It is an internal method called by getConnection()

Delete files with delete()Delete files with delete()<h:commandButton value="Delete" action="#{gftp.delete}" <h:commandButton value="Delete" action="#{gftp.delete}"

actionListener="#{gftp.filename}"> actionListener="#{gftp.filename}"> <f:param id="finame" name="fname" value="#{file}"/> <f:param id="finame" name="fname" value="#{file}"/> </h:commandButton></h:commandButton>

Download files with download()Download files with download()<h:commandLink value="" action="#{gftp.download}" <h:commandLink value="" action="#{gftp.download}"

actionListener="#{gftp.filename}"> actionListener="#{gftp.filename}"> <h:graphicImage value="#{file.piclink}"/> <h:graphicImage value="#{file.piclink}"/> <f:param id="fname" name="fname" value="#{file}"/> <f:param id="fname" name="fname" value="#{file}"/> </h:commandLink></h:commandLink>

Page 20: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

ContextBeanContextBean ContextBean provides navigation on ws-ContextBean provides navigation on ws-

context server.context server. Session keys of context server are like Session keys of context server are like

below.below.• vlab://tmp/manacar/task1/timestampvlab://tmp/manacar/task1/timestamp• This is just a URI structured name conventionThis is just a URI structured name convention

vlab://tmp/ is the root for allvlab://tmp/ is the root for all Each user’s personal context follows.Each user’s personal context follows. Similar to linux directory structure. (Base Similar to linux directory structure. (Base

directory like below.)directory like below.)• vlab://tmp/manacar/blah/blah2/blah3vlab://tmp/manacar/blah/blah2/blah3

More detail later.More detail later.

Page 21: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Grid Faces TagsGrid Faces Tags All of the beans shown previously can be used in conventional All of the beans shown previously can be used in conventional

standalone JSF way.standalone JSF way. They are also associated with custom JSF tag extensions we They are also associated with custom JSF tag extensions we

developed:developed:• <o:task/>, <o:taskGraph/>, <o:taskAdd/> and <o:contextStore/><o:task/>, <o:taskGraph/>, <o:taskAdd/> and <o:contextStore/>

Purpose is to define composite actions that are associated with Purpose is to define composite actions that are associated with submit button clicks, etc.submit button clicks, etc.• That is, commandButton and commandLinkThat is, commandButton and commandLink

Taskgraph is parent tag and the others are child tags.Taskgraph is parent tag and the others are child tags.

<f:verbatim> <o:taskGraph id="myGraph" method="#{taskgraph.test}" binding="#{taskgraph.taskgr}" >

<o:task id="task1" method="#{task.create}" type="FileTransferInput" /><o:task id="task2" method="#{task.create}" type="JobSubmit" /> <o:task id="task3" method="#{task.create}" type="FileTransferOutput" /><o:taskAdd id="taskadd1" name="task1" depends="task2" method="taskgraph.add" /> <o:taskAdd id="taskadd1" name="task2" depends="task3" method="taskgraph.add" /><o:contextStore id="context" type="store" method="none" />

</o:taskGraph></f:verbatim>

Page 22: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Importing GSF TaglibsImporting GSF Taglibs Taglibs are defined in tld files.Taglibs are defined in tld files.

<component> <description>Taskgraph component</description> <component-type>taskGraph</component-type> <component-class>ogce.gsf.tags.UITaskGraph</component-class> </component>

• Corresponding components defined in faces-config.xml

<tag> <name>taskGraph</name> <tag-class>ogce.gsf.tags.TaskGraphTag</tag-class> <body-content>JSP</body-content> <attribute> <name>id</name> </attribute> <attribute> <name>method</name> </attribute> <attribute> <name>binding</name> </attribute> </tag>

Page 23: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Using WS-ContextUsing WS-Context

Page 24: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

WS-ContextWS-Context A context is a nugget of information with an associated name.A context is a nugget of information with an associated name.

• You can read/write contexts.You can read/write contexts.• You can store arbitrary byte arrays--but for VLAB we typically store You can store arbitrary byte arrays--but for VLAB we typically store

stringsstrings WS-Context server provides database access wrapped with web WS-Context server provides database access wrapped with web

services.services. We’ve developed smart clients to store contexts like unix file We’ve developed smart clients to store contexts like unix file

system.system.• Normally contexts are flat, associated only with UUID, not structuredNormally contexts are flat, associated only with UUID, not structured• We added the structure to use file system tree-like structure.We added the structure to use file system tree-like structure.

Basically there two concepts in WS-Context.Basically there two concepts in WS-Context.• Session keys (URI) are (hopefully) human comprehensible names.Session keys (URI) are (hopefully) human comprehensible names.

vlab://tmp/manacar/12506-041932/tr/vlab://tmp/manacar/12506-041932/tr/• Context keys (uuid) define the unique system name of the context.Context keys (uuid) define the unique system name of the context.

uuid:0A556090-7464-11DA-ABF3-E30096A3A69A-1135418397994uuid:0A556090-7464-11DA-ABF3-E30096A3A69A-1135418397994

Session keys to store branches (directories)Session keys to store branches (directories) Context keys to store contexts (files)Context keys to store contexts (files) A session can contain one or more session and contextsA session can contain one or more session and contexts

Page 25: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

WS-Context IIWS-Context II Storing information to context store is done by several beans. Storing information to context store is done by several beans.

• TaskGraph Bean creates a unique context URI for each job submissionTaskGraph Bean creates a unique context URI for each job submission• TaskListener stores changing values on runtime like status, finishDateTaskListener stores changing values on runtime like status, finishDate• Hpsearch stores output file location on remote site (needed for Hpsearch stores output file location on remote site (needed for

vizualization).vizualization). VLab monitoring pages involves context reading and browsing.VLab monitoring pages involves context reading and browsing. Browsing page takes user home directory on context service and Browsing page takes user home directory on context service and

allow users to navigate on their workspace.allow users to navigate on their workspace.<user-attribute> <user-attribute>

       <description>User Name</description>        <description>User Name</description>        <name>user.name</name>       <name>user.name</name>

</user-attribute> </user-attribute> Only storing to context is tagged by taglibs.Only storing to context is tagged by taglibs.

• <o:contextStore id="context" type="store" method="none" /><o:contextStore id="context" type="store" method="none" /> Context browsing is done by associated JSF pages and data tablesContext browsing is done by associated JSF pages and data tables

• ContextListBeanContextListBean• Context AttributesContext Attributes

Page 26: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Reading Context in JSFReading Context in JSF

<h:outputText value="Context Name "/><h:outputText value="Context Name "/><h:outputText value="#{context.contextName}" /><h:outputText value="#{context.contextName}" /> <h:outputText value="Context Value "/><h:outputText value="Context Value "/><h:outputText value="#{context.contextValue}" /><h:outputText value="#{context.contextValue}" />

<h:outputText value="Context Status "/><h:outputText value="Context Status "/><h:outputText value="#{context.contextStatus}" /> <h:outputText value="#{context.contextStatus}" />

<h:commandButton value="New Job Submit with Context <h:commandButton value="New Job Submit with Context Values“ action="#{context.contextAction}"/>Values“ action="#{context.contextAction}"/>

Page 27: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Browsing on contextBrowsing on context Context browsing provided by navigate(String parent) Context browsing provided by navigate(String parent)

method.method. Portlet gets user.name property and builds up user’s contextPortlet gets user.name property and builds up user’s context

• vlab://tmp is root context for vlab portalvlab://tmp is root context for vlab portal• User manacar will have context User manacar will have context

vlab://tmp/manacarvlab://tmp/manacar When reach to leaf node, It can access to contexts in it.When reach to leaf node, It can access to contexts in it. For example, vlab://tmp/manacar/task1/timestampFor example, vlab://tmp/manacar/task1/timestamp

• There are certain context in this location listed below.There are certain context in this location listed below.• Resource bean properties (with taskname)Resource bean properties (with taskname)• Status contextStatus context• SubmitDate contextSubmitDate context• FinishDate contextFinishDate context• Input file locationInput file location• Output file locationOutput file location• FSU location (transferring output file for viz. process)FSU location (transferring output file for viz. process)• Etc.Etc.

Page 28: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Using the Context NavigationUsing the Context Navigation<h:dataTable value="#{contextlist.contexts}" var="ctx"> <h:dataTable value="#{contextlist.contexts}" var="ctx"> <h:column><h:column> <f:facet name="header"><f:facet name="header"> <h:outputText style="font-weight: bold" value="Icon" /><h:outputText style="font-weight: bold" value="Icon" /> </f:facet></f:facet> <h:commandLink value="" action="#{context.navigate}" <h:commandLink value="" action="#{context.navigate}"

actionListener="#{context.contextName}"> actionListener="#{context.contextName}"> <h:graphicImage value="#{ctx.piclink}"/> <h:graphicImage value="#{ctx.piclink}"/> <f:param id="cname" name="cname" value="#{ctx}"/> <f:param id="cname" name="cname" value="#{ctx}"/> </h:commandLink></h:commandLink> </h:column></h:column> <h:column><h:column> <f:facet name="header"><f:facet name="header"> <h:outputText style="font-weight: bold" value="Context Name" /><h:outputText style="font-weight: bold" value="Context Name" /> </f:facet></f:facet> <h:outputText value="#{ctx.name}"/><h:outputText value="#{ctx.name}"/> </h:column> </h:column> </h:dataTable></h:dataTable>

Page 29: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Reading from contextReading from context

Methods from ContextBeanMethods from ContextBean navigate()navigate()

• Main method of context navigationMain method of context navigation• Prepares contextList to being display by Prepares contextList to being display by

navigation JSF page.navigation JSF page. getSessionDirectoryInfo(String parent)getSessionDirectoryInfo(String parent) getContextFromLeafSession(Vector getContextFromLeafSession(Vector

session_info)session_info) wipeOut(String user_session_key)wipeOut(String user_session_key) wipeOut(“%") deletes all sessions.wipeOut(“%") deletes all sessions.

Page 30: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Storing to contextStoring to context Context store tag wraps Context Bean Context store tag wraps Context Bean

storeContext method as taglib.storeContext method as taglib. ContextBean wraps context API with JSF pages.ContextBean wraps context API with JSF pages. ContextPublishClient is base API for ws-context ContextPublishClient is base API for ws-context

smart client.smart client. 3 methods to save a context3 methods to save a context

• SessionInfo[] find_session(String user_identifier, SessionInfo[] find_session(String user_identifier, String qualifier) String qualifier)

• URI find_session_key(String identifier, String URI find_session_key(String identifier, String qualifier)qualifier)

• ContextDetail saveContext(String user_identifier, ContextDetail saveContext(String user_identifier, URI session_key, byte [] URI session_key, byte [] context_byte_array)context_byte_array)

Page 31: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

properties.propertiesproperties.properties################################################################################################################################################### FTHPIS - Property file used to set parameters for UDDI-Extended# FTHPIS - Property file used to set parameters for UDDI-Extended# Information Service# Information Service# Web Site: http://grids.ucs.indiana.edu/~maktas/fthpis/index.html# Web Site: http://grids.ucs.indiana.edu/~maktas/fthpis/index.html####################################################################################################################################################

##################################################################################################################################################### Userid/passwords should not generally be stored in clear text# Userid/passwords should not generally be stored in clear text####################################################################################################################################################cgl.fthpis.jdbcUser = uddi_usercgl.fthpis.jdbcUser = uddi_usercgl.fthpis.jdbcPassword = changeItcgl.fthpis.jdbcPassword = changeIt

##################################################################################################################################################### The WSDL address for the inquiry and publishing API of the target# The WSDL address for the inquiry and publishing API of the target# UDDI-Extended Information Service# UDDI-Extended Information Service####################################################################################################################################################

#UDDI_Extended_WSDL = http://localhost:8080/uddi_wscontext/services/UDDI_Extended#UDDI_Extended_WSDL = http://localhost:8080/uddi_wscontext/services/UDDI_Extended#UDDI_WSContext_WSDL = http://localhost:8080/uddi_wscontext/services/UDDI_WSContext#UDDI_WSContext_WSDL = http://localhost:8080/uddi_wscontext/services/UDDI_WSContext

UDDI_Extended_WSDL = http://gf8.ucs.indiana.edu:4647/uddi_wscontext/services/UDDI_ExtendedUDDI_Extended_WSDL = http://gf8.ucs.indiana.edu:4647/uddi_wscontext/services/UDDI_ExtendedUDDI_WSContext_WSDL = http://gf8.ucs.indiana.edu:4647/uddi_wscontext/services/UDDI_WSContextUDDI_WSContext_WSDL = http://gf8.ucs.indiana.edu:4647/uddi_wscontext/services/UDDI_WSContext

################################################################################################################################################################

# NB Parameters. Please replace following NB parameters to point to your# NB Parameters. Please replace following NB parameters to point to your# Narada Broker# Narada Broker####################################################################################################################################################

############hostname = gf8.ucs.indiana.eduhostname = gf8.ucs.indiana.eduportnum = 4648portnum = 4648

These are properties in the client’s uuid_wscontext_beta.jar.

You will need to change if you ever need to contact another server.

To Do: needs to be taken out and added to project.properties of the portal maven build.

Page 32: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Ws-Context Ws-Context jarsjars

NaradaBrokering.jarNaradaBrokering.jar activation.jaractivation.jar axis-ant.jaraxis-ant.jar axis.jaraxis.jar commons-discovery.jarcommons-discovery.jar commons-logging.jarcommons-logging.jar jaxrpc.jarjaxrpc.jar jsp-api.jarjsp-api.jar jug-uuid.jarjug-uuid.jar junit.jarjunit.jar mail.jarmail.jar saaj.jarsaaj.jar servlet-api.jarservlet-api.jar uddi_wscontext_beta.jaruddi_wscontext_beta.jar wscontext.0_wtimestamwscontext.0_wtimestam

p.jarp.jar wsdl4j.jarwsdl4j.jar

Hpsearch

Context monitoring

Jar conflicts can lead to problems. Axis.jar is a known offender.

Page 33: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

JSF Portlets for JSF Portlets for GridSphere: Some GridSphere: Some

Supplemental SlidesSupplemental Slides

Mehmet NacarMehmet Nacar

Page 34: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

GridSphere 2.xGridSphere 2.x Deployment on Gridsphere requires some additional Deployment on Gridsphere requires some additional

configuration.configuration. Make sure CATALINA_HOME set.Make sure CATALINA_HOME set. GridSphere normally runs in Tomcat 5.0.2x. If you want to GridSphere normally runs in Tomcat 5.0.2x. If you want to

run in Tomcat 5.5.x, you should run in Tomcat 5.5.x, you should • a) install Tomcat 5.5's java 1.4.2 compatibility package as a) install Tomcat 5.5's java 1.4.2 compatibility package as

instructed above, and instructed above, and • b) copy ant.jar and ant-launcher.jar from Tomcat 5.0.2x's b) copy ant.jar and ant-launcher.jar from Tomcat 5.0.2x's

common/lib directory into 5.5.x's common/lib.common/lib directory into 5.5.x's common/lib. Also edit the tomcat-users.xml file in the jakarta-tomcat-Also edit the tomcat-users.xml file in the jakarta-tomcat-

5.5.x/conf directory to add the following role and user:5.5.x/conf directory to add the following role and user:• <?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <tomcat-users> <role rolename="manager"/> <role rolename="manager"/> <user username="gridsphere" password="gridsphere" <user username="gridsphere" password="gridsphere"

roles="manager"/> roles="manager"/> </tomcat-users> </tomcat-users>

Page 35: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

JSF Sample PortletJSF Sample Portlet Sample portlet is the Sun provided guessNumber portlet Sample portlet is the Sun provided guessNumber portlet

example available from the JSF source code distribution. It example available from the JSF source code distribution. It is packaged to work inside the GridSphere container.is packaged to work inside the GridSphere container.

Instructions:Instructions:• Set gridsphere environment variableSet gridsphere environment variable

gridsphere.home=/home/manacar/gridsphere-2.0.2gridsphere.home=/home/manacar/gridsphere-2.0.2 gridsphere.build=/home/manacar/gridsphere-2.0.2/buildgridsphere.build=/home/manacar/gridsphere-2.0.2/build

• ‘‘ant install’ makes it work on Gridsphereant install’ makes it work on Gridsphere To work with Tomcat 5.5.x, all commons jar files from Tomcat 5.0.2x To work with Tomcat 5.5.x, all commons jar files from Tomcat 5.0.2x

should be added to common/lib. Otherwise JSFportlets doesn’t work.should be added to common/lib. Otherwise JSFportlets doesn’t work. Move the following jar files from $CATALINA_HOME/server/lib to Move the following jar files from $CATALINA_HOME/server/lib to

$CATALINA_HOME/common/lib: (It is for only Tomcat 5.0.2x)$CATALINA_HOME/common/lib: (It is for only Tomcat 5.0.2x)• commons-beanutils.jarcommons-beanutils.jar• commons-digester.jarcommons-digester.jar

After deploying, start up GridSphere and create a group from Admin-After deploying, start up GridSphere and create a group from Admin->Groups with the "guessNumber" portlet in it. Then add yourself to the >Groups with the "guessNumber" portlet in it. Then add yourself to the group. if you don’t use predefined groups and tabs. (optional group.xml, group. if you don’t use predefined groups and tabs. (optional group.xml, layout.xml setup files)layout.xml setup files)

Page 36: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Gridsphere portletsGridsphere portlets

GridSphere portlet apps use the GridSphere portlet apps use the following files:following files:• web.xml (required) - specifies GS portlet web.xml (required) - specifies GS portlet

loader servletloader servlet• gridsphere-portlet.xml (required) - gridsphere-portlet.xml (required) -

specifies GS portlet loader portletspecifies GS portlet loader portlet• portlet.xml (required) - a portlet portlet.xml (required) - a portlet

descriptordescriptor• (optional) group.xml - a group descriptor(optional) group.xml - a group descriptor• (optional) layout.xml - a layout associated (optional) layout.xml - a layout associated

with the groupwith the group

Page 37: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

MyproxyManager PortletMyproxyManager Portlet The following steps for developing a JSF portlet:The following steps for developing a JSF portlet: Place source code into /src directoryPlace source code into /src directory

• ~/jsfMyproxyManager/src/proxymanager~/jsfMyproxyManager/src/proxymanager Place JSP files into /webapp directoryPlace JSP files into /webapp directory

• ~/jsfMyproxyManager/webapp~/jsfMyproxyManager/webapp Place config files into /webapp/WEB-INFPlace config files into /webapp/WEB-INF

• ~/jsfMyproxyManager/webapp/WEB-INF~/jsfMyproxyManager/webapp/WEB-INF Place required jars into /lib/extPlace required jars into /lib/ext

• ~/jsfMyproxyManager/lib~/jsfMyproxyManager/lib jsf-api.jar jsf-api.jar jsf-portlet.jar jsf-portlet.jar proxymanager-api-3-3.0.jarproxymanager-api-3-3.0.jar jsf-impl.jar jsf-impl.jar jstl.jarjstl.jar standard.jarstandard.jar

Page 38: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

web.xmlweb.xmlweb.xmlweb.xml<web-app><web-app> <display-name>JSF Proxy portlets</display-name><display-name>JSF Proxy portlets</display-name>

<description><description> Provides JSF Proxy portletsProvides JSF Proxy portlets </description></description>

<context-param><context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name><param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value><param-value>client</param-value> </context-param></context-param>

<context-param><context-param> <param-name>javax.faces.application.CONFIG_FILES</param-name><param-name>javax.faces.application.CONFIG_FILES</param-name> <param-value>/WEB-INF/faces-config.xml</param-value><param-value>/WEB-INF/faces-config.xml</param-value> </context-param></context-param>

<context-param><context-param> <param-name>com.sun.faces.portlet.INIT_VIEW</param-name><param-name>com.sun.faces.portlet.INIT_VIEW</param-name> <param-value>/ProxyManager.jsp</param-value><param-value>/ProxyManager.jsp</param-value> </context-param></context-param>

<context-param><context-param> <param-name>com.sun.faces.validateXml</param-name><param-name>com.sun.faces.validateXml</param-name> <param-value>true</param-value><param-value>true</param-value> </context-param></context-param>

Page 39: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

web.xml IIweb.xml II<!-- Faces Servlet --><!-- Faces Servlet --> <servlet><servlet> <servlet-name>Faces Servlet</servlet-name><servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class><servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup> 1 </load-on-startup><load-on-startup> 1 </load-on-startup> </servlet></servlet> <servlet><servlet> <servlet-name>PortletServlet</servlet-name><servlet-name>PortletServlet</servlet-name> <servlet-class>org.gridlab.gridsphere.provider.portlet.jsr.PortletServle<servlet-class>org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet</servlet-class>t</servlet-class> </servlet></servlet> <!-- Faces Servlet Mapping --><!-- Faces Servlet Mapping --> <servlet-mapping><servlet-mapping> <servlet-name>Faces Servlet</servlet-name><servlet-name>Faces Servlet</servlet-name> <url-pattern>/myproxy/*</url-pattern><url-pattern>/myproxy/*</url-pattern> </servlet-mapping></servlet-mapping> <servlet-mapping><servlet-mapping> <servlet-name>PortletServlet</servlet-name><servlet-name>PortletServlet</servlet-name> <url-pattern>/jsr/jsfMyproxyManager</url-pattern><url-pattern>/jsr/jsfMyproxyManager</url-pattern> </servlet-mapping></servlet-mapping></web-app></web-app>

Page 40: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

faces-config.xmlfaces-config.xml<faces-config><faces-config> <application><application> <locale-config><locale-config> <default-locale>en</default-locale><default-locale>en</default-locale> <supported-locale>de</supported-locale><supported-locale>de</supported-locale> <supported-locale>fr</supported-locale><supported-locale>fr</supported-locale> <supported-locale>es</supported-locale><supported-locale>es</supported-locale> </locale-config></locale-config> </application></application> <navigation-rule><navigation-rule> <description><description> The decision rule used by the NavigationHandler toThe decision rule used by the NavigationHandler to determine which view must be displayed after thedetermine which view must be displayed after the current view, greeting.jsp is processed.current view, greeting.jsp is processed. </description></description> <from-view-id>/ProxyManager.jsp</from-view-id><from-view-id>/ProxyManager.jsp</from-view-id> <navigation-case><navigation-case> <description><description> Indicates to the NavigationHandler that the response.jspIndicates to the NavigationHandler that the response.jsp view must be displayed if the Action referenced by a view must be displayed if the Action referenced by a UICommand component on the greeting.jsp view returns UICommand component on the greeting.jsp view returns the outcome "success".the outcome "success". </description></description> <from-outcome>success</from-outcome><from-outcome>success</from-outcome> <to-view-id>/GetProxy.jsp</to-view-id><to-view-id>/GetProxy.jsp</to-view-id> </navigation-case></navigation-case> </navigation-rule></navigation-rule>

Page 41: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

<navigation-rule><navigation-rule> <description><description> The decision rules used by the NavigationHandler toThe decision rules used by the NavigationHandler to determine which view must be displayed after thedetermine which view must be displayed after the current view, response.jsp is processed.current view, response.jsp is processed. </description></description> <from-view-id>/GetProxy.jsp</from-view-id><from-view-id>/GetProxy.jsp</from-view-id> <navigation-case><navigation-case> <description><description> Indicates to the NavigationHandler that the greeting.jspIndicates to the NavigationHandler that the greeting.jsp view must be displayed if the Action referenced by a view must be displayed if the Action referenced by a UICommand component on the response.jsp view returns UICommand component on the response.jsp view returns the outcome "success".the outcome "success". </description></description> <from-outcome>success</from-outcome><from-outcome>success</from-outcome> <to-view-id>/ViewAndDispose.jsp</to-view-id> <to-view-id>/ViewAndDispose.jsp</to-view-id> </navigation-case></navigation-case> </navigation-rule></navigation-rule> <navigation-rule><navigation-rule> <description><description> The decision rules used by the NavigationHandler toThe decision rules used by the NavigationHandler to determine which view must be displayed after thedetermine which view must be displayed after the current view, response.jsp is processed.current view, response.jsp is processed. </description></description> <from-view-id>/ViewAndDispose.jsp</from-view-id><from-view-id>/ViewAndDispose.jsp</from-view-id> <navigation-case><navigation-case> <description><description> Indicates to the NavigationHandler that the greeting.jspIndicates to the NavigationHandler that the greeting.jsp view must be displayed if the Action referenced by a view must be displayed if the Action referenced by a UICommand component on the response.jsp view returns UICommand component on the response.jsp view returns the outcome "success".the outcome "success". </description></description> <from-outcome>success</from-outcome><from-outcome>success</from-outcome> <to-view-id>/ProxyManager.jsp</to-view-id><to-view-id>/ProxyManager.jsp</to-view-id> </navigation-case></navigation-case> </navigation-rule> </navigation-rule> <managed-bean><managed-bean> <description><description> The "backing file" bean that backs up the guessNumber webappThe "backing file" bean that backs up the guessNumber webapp </description></description> <managed-bean-name>MyProxyBean</managed-bean-name><managed-bean-name>MyProxyBean</managed-bean-name> <managed-bean-class>proxymanager.MyProxyBean</managed-bean-class><managed-bean-class>proxymanager.MyProxyBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-bean-scope>session</managed-bean-scope> </managed-bean></managed-bean></faces-config></faces-config>

Page 42: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

portlet.xmlportlet.xml<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" vers<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocatiion="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xon="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">ml/ns/portlet/portlet-app_1_0.xsd"> <portlet><portlet> <description>JSF MyProxy Portlet</description><description>JSF MyProxy Portlet</description> <portlet-name>myproxyManager</portlet-name><portlet-name>myproxyManager</portlet-name> <display-name>JSF MyProxy Portlet</display-name><display-name>JSF MyProxy Portlet</display-name> <portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class><portlet-class>com.sun.faces.portlet.FacesPortlet</portlet-class>

<supports><supports> <mime-type>text/html</mime-type><mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode><portlet-mode>VIEW</portlet-mode> </supports></supports>

<portlet-info><portlet-info> <title>MyProxy Portlet</title><title>MyProxy Portlet</title> <short-title>myproxy</short-title><short-title>myproxy</short-title> </portlet-info></portlet-info> </portlet></portlet></portlet-app></portlet-app>

Page 43: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

group.xmlgroup.xml

<?xml version="1.0" encoding="UTF-8"?><?xml version="1.0" encoding="UTF-8"?>

<portlet-group><portlet-group> <group-name>jsfMyproxyManager</group-name><group-name>jsfMyproxyManager</group-name> <group-description>JSF MyProxy portlets</group-<group-description>JSF MyProxy portlets</group-

description>description> <group-visibility>PUBLIC</group-visibility><group-visibility>PUBLIC</group-visibility> <portlet-role-info><portlet-role-info> <portlet-<portlet-

class>jsfMyproxyManager#myproxyManager</portlet-class>jsfMyproxyManager#myproxyManager</portlet-class>class>

<required-role>USER</required-role><required-role>USER</required-role> </portlet-role-info></portlet-role-info></portlet-group></portlet-group>

Page 44: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

layout.xmllayout.xml<portlet-tabbed-pane><portlet-tabbed-pane> <portlet-tab label="JSF MyProxy Manager"><portlet-tab label="JSF MyProxy Manager"> <title lang="en">JSF MyProxy Manager</title><title lang="en">JSF MyProxy Manager</title> <portlet-tabbed-pane style="sub-menu"><portlet-tabbed-pane style="sub-menu"> <portlet-tab label="myproxyManager"><portlet-tab label="myproxyManager"> <title lang="en">MyProxy Portlet</title><title lang="en">MyProxy Portlet</title> <table-layout><table-layout> <row-layout><row-layout> <column-layout><column-layout> <portlet-frame label="proxyPF"><portlet-frame label="proxyPF"> <portlet-class>jsfMyproxyManager#myproxyManager <portlet-class>jsfMyproxyManager#myproxyManager

</portlet-class></portlet-class> </portlet-frame></portlet-frame> </column-layout></column-layout> </row-layout></row-layout> </table-layout></table-layout> </portlet-tab></portlet-tab> </portlet-tabbed-pane></portlet-tabbed-pane> </portlet-tab></portlet-tab></portlet-tabbed-pane></portlet-tabbed-pane>

Page 45: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

gridsphere-portlet.xml gridsphere-portlet.xml <portlet-app-collection><portlet-app-collection>

<portlet-app-def><portlet-app-def>

<portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet"><portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet"> <portlet-name>JSR Portlet Servlet</portlet-name><portlet-name>JSR Portlet Servlet</portlet-name> <servlet-name>PortletServlet</servlet-name><servlet-name>PortletServlet</servlet-name></portlet-app></portlet-app>

<concrete-portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletSer<concrete-portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet.1">vlet.1"> <concrete-portlet><concrete-portlet> <portlet-name>Portlet Servlet</portlet-name><portlet-name>Portlet Servlet</portlet-name> <default-locale>en</default-locale><default-locale>en</default-locale> <language locale="en"><language locale="en"> <title>Portlet Servlet</title><title>Portlet Servlet</title> <title-short>Portlet Servlet</title-short><title-short>Portlet Servlet</title-short> <description>A JSR Portlet Loader</description><description>A JSR Portlet Loader</description> <keywords>portlet servlet</keywords><keywords>portlet servlet</keywords> </language></language> </concrete-portlet></concrete-portlet></concrete-portlet-app></concrete-portlet-app>

</portlet-app-def></portlet-app-def>

</portlet-app-collection></portlet-app-collection>

Page 46: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Managed BeansManaged Beans

The most important features of a The most important features of a bean is are the properties that it bean is are the properties that it exposes. A exposes. A property property is any attribute is any attribute of the bean that hasof the bean that has• a namea name• a type (type should be a Java Object)a type (type should be a Java Object)• methods for getting and/or setting the methods for getting and/or setting the

property valueproperty value

Page 47: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

MyProxyBeanMyProxyBeanpublic class MyProxyBean {public class MyProxyBean {

private int SECS_PER_MIN = 60;private int SECS_PER_MIN = 60; private int SECS_PER_HOUR = 3600;private int SECS_PER_HOUR = 3600; private GSSCredential proxyCred=null;private GSSCredential proxyCred=null;

String userName = null;String userName = null; String hostName = null;String hostName = null; String passPhrase = null;String passPhrase = null; String proxyView = null;String proxyView = null; Integer lifetime = null;Integer lifetime = null; Integer portNumber = null;Integer portNumber = null; public MyProxyBean() {public MyProxyBean() { }} … …..

… ….. … …..

}}

Page 48: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

GetProxy.jspGetProxy.jsp<HTML><HTML> <HEAD> <title>Proxy Fetching Example</title> </HEAD><HEAD> <title>Proxy Fetching Example</title> </HEAD> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %><%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<body bgcolor="white"><body bgcolor="white"> <f:view><f:view> <h:form id="entryForm" ><h:form id="entryForm" >

<h3>Fill out the form to get your proxy credential</h3><h3>Fill out the form to get your proxy credential</h3>

<h:panelGrid columns="3"><h:panelGrid columns="3">

<h:outputLabel for="userSt"><h:outputLabel for="userSt"> <h:outputText value="User Name:"/><h:outputText value="User Name:"/> </h:outputLabel></h:outputLabel> <h:inputText id="userSt" <h:inputText id="userSt" required="true"required="true" value="#{MyProxyBean.userName}">value="#{MyProxyBean.userName}"> </h:inputText></h:inputText> <h:message id="junk1" for="userSt" <h:message id="junk1" for="userSt" showDetail="true"showDetail="true" errorStyle="color:red"/>errorStyle="color:red"/>

<h:outputLabel for="submit"><h:outputLabel for="submit"> <h:outputText value="Get Credential:"/><h:outputText value="Get Credential:"/> </h:outputLabel></h:outputLabel> <h:commandButton id="submit" <h:commandButton id="submit" action="#{MyProxyBean.authenticate}"action="#{MyProxyBean.authenticate}" value="GetProxy"/>value="GetProxy"/>

</h:panelGrid></h:panelGrid>

</h:form></h:form>

</f:view></f:view> </body></body>

</HTML> </HTML>

Page 49: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Standard JSF navigation rulesStandard JSF navigation rules Make sure MyProxyBean.authenticate returns a value “success” to match Make sure MyProxyBean.authenticate returns a value “success” to match

with navigationwith navigation<navigation-rule><navigation-rule> <description><description> The decision rule used by the NavigationHandler toThe decision rule used by the NavigationHandler to determine which view must be displayed after thedetermine which view must be displayed after the current view, greeting.jsp is processed.current view, greeting.jsp is processed. </description></description> <from-view-id>/<from-view-id>/ProxyManager.jspProxyManager.jsp</from-view-id></from-view-id> <navigation-case><navigation-case> <description><description> Indicates to the NavigationHandler that the response.jspIndicates to the NavigationHandler that the response.jsp view must be displayed if the Action referenced by a view must be displayed if the Action referenced by a UICommand component on the greeting.jsp view returns UICommand component on the greeting.jsp view returns the outcome "success".the outcome "success". </description></description> <from-outcome><from-outcome>successsuccess</from-outcome></from-outcome> <to-view-id>/<to-view-id>/GetProxy.jspGetProxy.jsp</to-view-id></to-view-id> </navigation-case></navigation-case> </navigation-rule></navigation-rule>

Page 50: JSF Custom Grid Tags Mehmet Nacar Tallahassee, FL March, 2006

Getting SessionGetting Session PortletSession gets session in the beanPortletSession gets session in the bean It’s allowed to store session to ProxyStore.It’s allowed to store session to ProxyStore. FacesContext facesContext = FacesContext facesContext =

FacesContext.getCurrentInstance();FacesContext.getCurrentInstance(); PortletSession portletSession = (PortletSession) PortletSession portletSession = (PortletSession)

facesContext.getExternalContext().getSession(falfacesContext.getExternalContext().getSession(false);se);

try {try { ProxyManager.addProxy(portletSession, ProxyManager.addProxy(portletSession,

proxyCred);proxyCred); GSSCredential proxy = (GSSCredential) GSSCredential proxy = (GSSCredential)

ProxyManager.getDefaultProxy(portletSession);ProxyManager.getDefaultProxy(portletSession); } catch(Exception ex) { }} catch(Exception ex) { }