\WEB-INF フォルダを開きます。もし Lotus Greenhouse の Sametime サーバーに接続するのであれば、XPagesSBT.nsf の faces-config.xmlの内容をご自身のアプリケーションへコピーすればよいです。Sametime への接続には「PwdStore」 と 「greenhouseSametime」の二つの managed-bean の定義が必要です。
<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
<!--
Password store physical implementation.
-->
<managed-bean>
<managed-bean-name>PwdStore</managed-bean-name>
<managed-bean-class>com.ibm.xsp.extlib.sbt.security.password.store.BANSFPasswordStore
</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
<managed-property>
<property-name>database</property-name>
<value>WebSecurityStore.nsf</value>
</managed-property>
</managed-bean>
<!--
Greenhouse Sametime
-->
<managed-bean>
<managed-bean-name>greenhouseSametime</managed-bean-name>
<managed-bean-class>com.ibm.xsp.extlib.sbt.services.client.endpoints.SameTimeEndpoint
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>url</property-name>
<value>https://greenhouse.lotus.com</value>
</managed-property>
<managed-property>
<property-name>passwordStore</property-name>
<value>PwdStore</value>
</managed-property>
<managed-property>
<property-name>authenticationPage</property-name>
<value>_BasicLogin?endpoint=greenhouseSametime</value>
</managed-property>
</managed-bean>
</faces-config>
ここで定義した endpoint を xsp.properties ファイルにも登録します。faces-config.xml と同じフォルダにある xsp.properties を開き、以下の行を追加して保存します。
extlib.endpoint.sametime=greenhouseSametime
再利用する XPage とカスタムコントロールをコピーする
XPagesSBT.nsf サンプルアプリケーションは再利用可能な XPage とカスタムコントロールを含んでおり、それは Sametime への接続機能の開発に利用することができます以下の再利用可能なコンポーネントをご自身のアプリケーションにコピーするとよいでしょう。
<表>
アプリケーションに Sametime コントロールを追加する
準備が整ったので、アプリケーションへ Sametime のコントロールを追加します、このセクションでは以下の4つについて説明します。
Sametime へのログインページの追加
計算結果フィールドコントロールを使用した Livename コンポーネントの追加
Sametime Widget コントロールを使用した Livename コンポーネントの追加
Sametime Widget コントロールを使用した Web クライアントの追加
どの場合でも Sametime クライアントを生成するために、 Sametime Client コントロールも追加する必要があります。このコントロールは Web ページ上で表示される Sametime コントロールで使用されるパラメータを保持します。もしこのコントロールがページ上になかったり適切に生成されていないと、そのほかの Sametime コントロールは Sametime サーバーに接続していないような状態になります。
Sametime へのログインページの追加
Social Enabler の Sametime 接続機能は、アプリケーションが、ユーザー名とパスワードによるベーシック認証でSametime サーバーにログインできるようにします。以下に示す3つのカスタムコントロールのひとつを使用して、自身の XPages アプリケーションに Sametime へのログインページを追加できます。
"BasicAuthenticationPanel" カスタムコントロール
このカスタムコントロールを使用するときには、以下のカスタムプロパティを指定します。
endpoint
<画像>Basic Authentication リンク
http://www-10.lotus.com/ldd/ddwiki.nsf/xsp/.ibmmodres/persistence/DominoDoc-17239-content/02_basic_login_usernamepassword_1355242009644.png
<画像
Basic Authentication ログインページ
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:sametimeClient id="sametimeClient1" autoLogin="true"
clientScriptFile="livename" autoTunnelURI="true">
</xe:sametimeClient>
<xc:BasicAuthenticationPanel endpoint="sametime"></xc:BasicAuthenticationPanel>
</xp:view>
「sbtLoginDialog」カスタムコントロール
このカスタムコントロールを使用するときには、以下のカスタムプロパティを指定します。
dialogTitle
Label
endpoint
<画像>Login Dialog
http://www-10.lotus.com/ldd/ddwiki.nsf/xsp/.ibmmodres/persistence/DominoDoc-17239-content/04_dialog_login_usernamepassword_1355242187188.png
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:sametimeClient id="sametimeClient1" autoLogin="true"
clientScriptFile="livename" autoTunnelURI="true">
</xe:sametimeClient>
Login Dialog:
<xc:sbtLoginDialog id="loginDialog" dialogTitle="Login To Sametime"
endpoint="sametime" label="Login To Sametime">
</xc:sbtLoginDialog>
</xp:view>
「sbtLoginSection」カスタムコントロール
このカスタムコントロールを使用するときには、以下のカスタムプロパティを指定します。
dialogTitle
Label
endpoint
<画像>Login Section
http://www-10.lotus.com/ldd/ddwiki.nsf/xsp/.ibmmodres/persistence/DominoDoc-17239-content/05_section_login_usernamepassword_1355242283705.png
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:sametimeClient id="sametimeClient1" autoLogin="true"
clientScriptFile="livename" autoTunnelURI="true">
</xe:sametimeClient>
Login Section:
<xc:sbtLoginSection id="sbtLoginSection1"
sectionTitle="Login To Sametime" endpoint="sametime" label="Login To Sametime">
</xc:sbtLoginSection>
</xp:view>
計算結果フィールドコントロールを使用した Livename コンポーネントの追加
計算結果フィールドコントロールは contentType="xs:st.livename" 属性を設定することで Sametime Livename を表示できます。
<xp:text escape="true" id="computedField8" contentType="xs:st.livename">
<xp:this.value><![CDATA[#{"UserID|Display Name"}]]></xp:this.value>
</xp:text>
あるいは
<xp:text escape="true" id="computedField7"
contentType="xs:st.livename">
<xp:this.value><![CDATA[#{javascript:"UserID|Display Name"}]]></xp:this.value>
</xp:text>
「value」の書式は "Sametimeユーザー ID | 表示名" です。
ログインしているユーザー自身の ID を取得するには、以下のスクリプトのように @Endpoint("sametime").getUserIdentity() を使用します。
<xp:text escape="true" id="computedField3" contentType="xs:st.livename">
<xp:this.value><![CDATA[#{javascript:@Endpoint("sametime").getUserIdentity()+"|[user display name]"}]]></xp:this.value>
</xp:text>
完全な XPage のコードは以下のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:sametimeClient id="sametimeClient1" autoLogin="true"
clientScriptFile="livename" autoTunnelURI="true">
</xe:sametimeClient>
Here is an example with the id and a display name set:
<xp:text escape="true" id="computedField3" contentType="xs:st.livename">
<xp:this.value><![CDATA[#{javascript:@Endpoint("sametime").getUserIdentity()+"|[user display name]"}]]></xp:this.value>
</xp:text>
</xp:view>
Sametime Widget コントロールを使用した Livename コンポーネントの追加
Sametime Livename は Sametime Widget Control を使って表示することもできます。
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xe:sametimeClient id="sametimeClient1" autoLogin="true"
clientScriptFile="livename" autoTunnelURI="true">
</xe:sametimeClient>
Here is an example using a sametime widget:
<xe:sametimeWidget id="sametimeWidget1" dojoType="sametime.LiveName">
<xe:this.dojoAttributes>
<xp:dojoAttribute name="userId">
<xp:this.value><![CDATA[#{javascript:@Endpoint("sametime").getUserIdentity()}]]></xp:this.value>
</xp:dojoAttribute>
</xe:this.dojoAttributes>
</xe:sametimeWidget>
<xp:br></xp:br>
</xp:view>
Sametime Widget コントロールを使用した Web クライアントの追加
Ssmetimg Widget コントロールで dojoType="sametime.WebClient" を指定することで Sametime Web クライアントを表示します。
<画像>Sametime Web Client
http://www-10.lotus.com/ldd/ddwiki.nsf/xsp/.ibmmodres/persistence/DominoDoc-17239-content/07_WebClient_1355242501060.png
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:br></xp:br>
<xe:sametimeClient id="sametimeClient1" autoLogin="true"
autoTunnelURI="true" clientScriptFile="widgets">
</xe:sametimeClient>
Sametime WebClient:
<xp:br />
<xe:sametimeWidget id="sametimeWidget1" dojoType="sametime.WebClient"></xe:sametimeWidget>
<xp:br></xp:br>
</xp:view>