001/* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016package org.opengion.hayabusa.servlet; 017 018import org.opengion.fukurou.system.OgRuntimeException ; // 6.4.2.0 (2016/01/29) 019import java.io.File; 020import java.io.IOException; 021import java.io.PrintWriter; 022import java.lang.reflect.Field; 023import java.net.URL; 024import java.util.Enumeration; 025import java.util.Map; 026import java.util.concurrent.ConcurrentMap; // 6.4.3.3 (2016/03/04) 027import java.util.jar.JarEntry; 028import java.util.jar.JarFile; 029 030import javax.servlet.ServletContext; 031import javax.servlet.ServletException; 032import javax.servlet.http.HttpServlet; 033import javax.servlet.http.HttpServletRequest; 034import javax.servlet.http.HttpServletResponse; 035import javax.servlet.http.HttpSession; 036 037import org.opengion.fukurou.db.ConnectionFactory; 038import org.opengion.fukurou.util.Attributes; 039import org.opengion.fukurou.util.HybsEntry; 040import org.opengion.fukurou.util.StringUtil; 041import org.opengion.fukurou.system.BuildNumber; // 6.4.2.0 (2016/01/29) hayabusa.common.BuildNumber → fukurou.system.BuildNumber に移動 042import org.opengion.fukurou.system.Closer ; // 5.5.2.6 (2012/05/25) 043import org.opengion.hayabusa.common.HybsSystem; 044import org.opengion.hayabusa.common.SystemManager; 045import org.opengion.hayabusa.common.SystemParameter; 046import org.opengion.hayabusa.common.UserSummary; 047import static org.opengion.fukurou.system.HybsConst.CR ; // 6.1.0.0 (2014/12/26) 048import static org.opengion.fukurou.system.HybsConst.BUFFER_MIDDLE; // 6.1.0.0 (2014/12/26) refactoring 049 050import org.opengion.hayabusa.resource.ResourceFactory; // 5.9.1.0 (2015/10/02) 051import org.opengion.hayabusa.resource.UserInfo; // 5.9.1.0 (2015/10/02) 052 053import javax.servlet.ServletRegistration; // 6.3.4.0 (2015/08/01) 054import javax.servlet.FilterRegistration; // 6.3.4.0 (2015/08/01) 055 056/** 057 * サーバー管理情報を取得するAdminサーブレットです。 058 * 059 * 引数(URL)に応じて、サーバーの状態結果を返します。 060 * 一般には、http://サーバー:ポート/システムID/jsp/admin?COMMAND=コマンド の 061 * 形式のURL でアクセスします。 062 * 063 * ・COMMAND=infomation 064 * 【サーバー情報】 065 * OS情報 = Windows 7 Service Pack 1 x86 (32) 066 * サーバー名 = 10374232-0004 ( 172.27.26.164 ) 067 * サーブレット = Apache Tomcat/8.0.22 068 * TOMCAT_HOME = C:\opengionV6\apps\tomcat8.0.22 069 * JDKバージョン = Java HotSpot(TM) Server VM 1.8.0_45-b15 070 * JAVA_HOME = C:\opengionV6\apps\jdk180u45\jre 071 * 【実行環境】 072 * REAL_PATH = C:/opengionV6/uap/webapps/gf/ 073 * バージョンNo = openGion 6.2.4.0 Release6 Builds (2015142) 074 * 作成日時 = 2015/05/22 15:31:53 075 * 【ログイン情報】 076 * ログイン人数 = 2 名 ( 明細情報 ) 077 * 【メモリ情報】 078 * 空きメモリ = 129 [MByte] 079 * 合計メモリ = 209 [MByte] 080 * 使用率 = 38 [%] 081 * 【ディスク情報】 082 * 083 * ・COMMAND=close 084 * リソース情報のキャッシュを全てクリアします。 085 * 086 * ・COMMAND=loginUser 087 * 現在のログインユーザーの明細情報を表示します。 088 * SORT=[JNAME,ID,ROLES,IPADDRESS,LOGINTIME] ソートキー 089 * DIREC=[true,false] true:昇順/false:降順 090 * 091 * ・COMMAND=plugin 092 * 現在のプラグインのバージョン情報を表示します。 093 * 094 * ・COMMAND=systemResource 095 * 現在のシステムリソースの設定情報を表示します。 096 * 097 * ・COMMAND=AccessStop&stop=[true/false] 098 * アクセスストップフィルターの制御(停止、許可)を行います。 099 * 100 * ※ 6.4.4.1 (2016/03/18) 101 * ・COMMAND=commonMessage&type=[set/clear]&message=共通情報 102 * 共通情報を登録します。errorMessageタグに表示されます。 103 * 104 * ・common/gamen/01_ADMIN/parameter.jsp 105 * 現在のシステムリソースの設定情報を表示します。 106 * 107 * ・common/gamen/01_ADMIN/systemInfo.jsp 108 * システム定数のシステム起動情報を表示します。 109 * 110 * @og.rev 3.5.3.0 (2003/10/27) Admin JSP を Servlet化して、エンジンと共に供給します。 111 * @og.rev 4.0.0.0 (2005/08/31) プラグインのバージョン情報の表示機能を追加 112 * @og.group その他機能 113 * 114 * @version 4.0 115 * @author Kazuhiko Hasegawa 116 * @since JDK5.0, 117 */ 118public final class HybsAdmin extends HttpServlet { 119 private static final long serialVersionUID = 624120150522L ; // 6.2.4.1 (2015/05/22) 120 121 private static final String JSP = HybsSystem.sys( "JSP" ); // jspフォルダの正規パス 122 123 private static final long MB = 1024*1024 ; // 6.2.4.1 (2015/05/22) 124 private static final long GB = 1024*1024*1024 ; // 6.2.4.1 (2015/05/22) 125 126 private static final String HEADER = 127 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + CR + 128 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"" + CR + 129 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + CR + 130 "<html xmlns=\"http://www.w3.org/1999/xhtml\" >" + CR + 131 "<head>" + CR + 132 " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" + CR + 133 " <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />" + CR + 134 " <link rel=\"stylesheet\" href=\"" + JSP + "/common/default.css\" type=\"text/css\" />" + CR + 135 " <link rel=\"stylesheet\" href=\"" + JSP + "/custom/custom.css\" type=\"text/css\" />" + CR + 136 " <title>Hybs Admin</title>" + CR + 137 "</head>" + CR; 138 139 // 3.5.3.1 (2003/10/31) User情報のテーブルの設定を、システムリソース より行う。 140 private static final String TABLE_HEADER = getTableHeaderTag() ; 141 142 private static final String SERVER_INFO = HybsSystem.sys( "SERVER_INFO" ); // 10374232-0004 ( 200.1.50.239 ) 143 private static final String SERVLET_INFO = HybsSystem.sys( "SERVLET_INFO" ); // Apache Tomcat/7.0.39 144 private static final String REAL_PATH = HybsSystem.sys( "REAL_PATH" ); // C:/opengion/uap/webapps/gf/ 145 private static final String TOMCAT_HOME = HybsSystem.sys( "TOMCAT_HOME" ); // C:/opengion/apps/tomcat5.5.17 146 private static final String JAVA_HOME = HybsSystem.sys( "JAVA_HOME" ); // C:/opengion/apps/jdk170u25/jre 147 148 // 5.6.6.0 (2013/07/05) getLoginUser( String,boolean ) で、指定するキーを配列で持っておきます。 149 // キーは、SystemManager.getRunningUserSummary 処理内で大文字化されるため、この配列は、表示用と兼用します。 150 private static final String[] USER_KEYS = { "ID","Jname","Roles","IPAddress","LoginTime","LastAccess","LastGamenNm" }; 151 152 // 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 153 private static final String TABLE_WAKU = "<table style=\"margin: 0px 0px 0px 20px;\" frame=\"box\" border=\"1px\" cellspacing=\"0px\" cellpadding=\"0px\" " ; 154 private static final String TABLE_END = "</table>" + CR ; 155 156 // 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 157 // 6.4.9.4 (2016/09/02) アドレスが、/gf/jsp/admin だったので、他のシステムで動かなかった。 158 private static final String COMMON_MESSAGE = "【共通メッセージを表示する場合は、このテキストフィールドに入力してください。】<br />" + CR + 159 "<form method=\"GET\" action=\"admin\" target=\"RESULT\" >" + CR + 160 " <input name=\"message\" size=\"50\" /> " + CR + 161 " <button type=\"submit\" name=\"type\" value=\"set\" >Set</button> " + CR + 162 " <button type=\"submit\" name=\"type\" value=\"clear\" >Clear</button>" + CR + 163 " <input type=\"hidden\" name=\"COMMAND\" value=\"commonMessage\" />" + CR + 164 "</form><br /><br />" + CR ; 165 166 /** 167 * GET メソッドが呼ばれたときに実行します。 168 * 169 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 170 * @og.rev 3.5.4.1 (2003/12/01) getAdminLink() メソッドを追加 171 * @og.rev 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 172 * @og.rev 5.9.1.0 (2015/10/02) UserInfoセット機能追加 173 * @og.rev 6.3.8.3 (2015/10/03) Servlet/Filter 情報を作成。 174 * @og.rev 6.3.9.1 (2015/11/27) 3項演算子を || or && で簡素化できる(PMD)。 175 * @og.rev 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 176 * 177 * @param req HttpServletRequestオブジェクト 178 * @param res HttpServletResponseオブジェクト 179 * 180 * @throws ServletException サーブレット関係のエラーが発生した場合、throw されます。 181 * @throws IOException 入出力エラーが発生したとき 182 */ 183 @Override 184 public void doGet( final HttpServletRequest req, final HttpServletResponse res) 185 throws ServletException, IOException { 186 187 req.setCharacterEncoding( "UTF-8" ); // 6.4.4.1 (2016/03/18) 188 res.setContentType( "text/html; charset=UTF-8" ); 189 final PrintWriter out = res.getWriter(); 190 191 final String command = req.getParameter( "COMMAND" ); 192 193 out.println( HEADER ); 194 out.println("<body>"); 195 196 out.print("<h2>"); 197 out.print( req.getServerName() ); 198 out.print( ":" ); 199 out.print( req.getServerPort() ); 200 out.print( req.getContextPath() ); 201 out.println("</h2>"); 202 203 if( "infomation".equalsIgnoreCase( command ) ) { 204 out.print( getInfomation() ); 205 } 206 else if( "close".equalsIgnoreCase( command ) ) { 207 out.print( getCloseMessage( req.getSession() ) ); 208 } 209 else if( "loginUser".equalsIgnoreCase( command ) ) { 210 final String sort = req.getParameter( "sort" ); 211 final String direc = req.getParameter( "direc" ); 212 // 6.3.9.1 (2015/11/27) 3項演算子を || or && で簡素化できる(PMD)。 213 final boolean dir = direc == null || Boolean.parseBoolean( direc ); // 6.3.9.1 (2015/11/27) 214 215 out.print( COMMON_MESSAGE ); // 6.4.4.1 (2016/03/18) 216 out.print( getLoginUser(sort,dir) ); 217 } 218 // 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 219 else if( "commonMessage".equalsIgnoreCase( command ) ) { 220 final String type = req.getParameter( "type" ); 221 final String message = req.getParameter( "message" ); 222 out.print( setCommonMessage( type , message , req.getSession() ) ); 223 } 224 else if( "plugin".equalsIgnoreCase( command ) ) { 225 out.print( getPlugInInfo() ); 226 } 227 else if( "taglib".equalsIgnoreCase( command ) ) { 228 out.print( getTaglibInfo() ); 229 } 230 else if( "systemResource".equalsIgnoreCase( command ) ) { 231 out.print( getSystemResource() ); 232 } 233 // 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 234 else if( "AccessStop".equalsIgnoreCase( command ) ) { 235 out.print( getAccessStop( req.getParameter( "stop" ) ) ); // 6.3.8.0 (2015/09/11) 236 } 237 // 5.9.1.0 (2015/10/02) UserInfoセット機能追加 238 else if( "UserInfo".equalsIgnoreCase( command ) ){ // 5.9.1.0 (2015/10/02) 239 out.print( setUserinfo( req ) ); 240 } 241 // 6.3.8.3 (2015/10/03) Servlet/Filter 情報を作成。 242 else if( "registrationInfo".equalsIgnoreCase( command ) ) { 243 out.print( getRegistrationMessage( req.getSession() ) ); 244 } 245 else { 246 out.print( getAdminLink() ); // 3.5.4.1 (2003/12/01) 追加 247 } 248 249 out.println("</body></html>"); 250 } 251 252 /** 253 * infomation 情報を作成します。 254 * 255 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 256 * @og.rev 5.6.7.3 (2013/08/23) TOMCAT_WORKは、TOMCAT_HOME に置き換えます。 257 * @og.rev 6.2.4.1 (2015/05/22) ディスク容量を求めます。 258 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 259 * @og.rev 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 260 * @og.rev 6.5.0.1 (2016/10/21) ENGINE_INFO は、直接、BuildNumber から取得する。 261 * 262 * @return infomation情報 263 * @og.rtnNotNull 264 */ 265 private String getInfomation() { 266 // 4.0.0 (2005/01/31) ログイン数の取得方法の変更。 267 final int loginCount = SystemManager.getRunningCount() ; 268 269 final long freeMemory = Runtime.getRuntime().freeMemory()/MB ; // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 270 final long totalMemory = Runtime.getRuntime().totalMemory()/MB; // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 271 final long useMemoryRatio = (totalMemory-freeMemory)*100/totalMemory ; // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 272 final String bgCls = useMemoryRatio <= 50 ? "OK" : useMemoryRatio <= 80 ? "CAUT" : "NG" ; // 6.9.7.0 (2018/05/14) PMD Useless parentheses. 273 274 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ); 275 276 rtn.append( "<table border = \"0px\" >" ); 277 tableTr1( rtn,"サーバー情報" ); 278 tableTr( rtn,"OS情報" , BuildNumber.OS_INFO ); // 6.5.0.1 (2016/10/21) 279 tableTr( rtn,"サーバー名" , SERVER_INFO ); 280 tableTr( rtn,"サーブレット" , SERVLET_INFO ); 281 tableTr( rtn,"TOMCAT_HOME" , TOMCAT_HOME ); // 5.6.7.3 (2013/08/23) 282 tableTr( rtn,"JDKバージョン" , BuildNumber.JDK_INFO ); // 6.5.0.1 (2016/10/21) 283 tableTr( rtn,"JAVA_HOME" , JAVA_HOME ); 284 285 tableTr1( rtn,"実行環境" ); 286 tableTr( rtn,"REAL_PATH" , REAL_PATH ); 287 tableTr( rtn,"バージョンNo" , BuildNumber.ENGINE_INFO ); // 6.5.0.1 (2016/10/21) 288 tableTr( rtn,"作成日時" , BuildNumber.TIMESTAMP ); 289 290 tableTr1( rtn,"ログイン情報" ); 291 tableTr( rtn,"ログイン人数" , String.valueOf( loginCount )," 名 ","( <a href=\"admin?COMMAND=loginUser\">明細情報</a> )" ); 292 293 tableTr1( rtn,"メモリ情報" ); 294 tableTr( rtn,"空きメモリ" , String.valueOf( freeMemory ) , " [MByte]" ); // 6.2.4.1 (2015/05/22) 単位を MB に変更 295 tableTr( rtn,"合計メモリ" , String.valueOf( totalMemory ) , " [MByte]" ); // 6.2.4.1 (2015/05/22) 単位を MB に変更 296 tableTr( rtn,"使用率" , String.valueOf( useMemoryRatio ) , " [%]" ); 297 rtn.append( TABLE_END ) 298 // 6.2.4.1 (2015/05/22) default.css で、memory、disc、discTD を定義 299 .append( TABLE_WAKU ).append( "width=\"300px\" >" ).append( CR ) 300 .append( "\t<tr><td class=\"memory " ).append( bgCls ).append( "\" style=\"width:" ) 301 .append( useMemoryRatio ).append( "%;\" >" ).append( useMemoryRatio ).append( "%</td>" ) 302 .append( "<td class=\"BIT\">" ).append( 100-useMemoryRatio ).append( "%</td></tr>" ).append( CR ) 303 .append( TABLE_END ) 304 305 // 6.2.4.1 (2015/05/22) ディスク容量を求めます。 306 .append( "<table border=\"0px\" >" ).append( CR ); 307 tableTr1( rtn,"ディスク情報" ); 308 rtn.append( TABLE_END ) 309 310 .append( TABLE_WAKU ).append( "width=\"500px\" >" ).append( CR ) 311 .append( "<th>名前</th><th>合計サイズ</th><th>空き領域</th><th>使用率</th></tr>" ).append( CR ); 312 313 final File[] driv = File.listRoots(); 314 for( final File file : driv ) { 315 // 6.3.9.0 (2015/11/06) 整数値演算なので、Math.round 不要 316 final long total = file.getTotalSpace()/GB ; // パーティションのサイズ 317 final long usable = file.getUsableSpace()/GB ; // 仮想マシンが利用できるバイト数 318 tableTr2( rtn, file.getPath() , total , usable ); // ディスク容量専用3 319 } 320 rtn.append( TABLE_END ) 321 322 // information 323 .append( "<hr />" ).append( CR ) 324 .append( "<pre>" ).append( CR ) 325 .append( ConnectionFactory.information() ).append( CR ) 326 .append( "</pre>" ).append( CR ); 327 328 return rtn.toString(); 329 } 330 331 /** 332 * infomation 情報を作成します。 333 * 334 * @og.rev 5.6.6.0 (2013/07/05) </td></tr>漏れ追加 335 * @og.rev 5.6.7.3 (2013/08/23) 前後に、【】を付けます。 336 * 337 * @param buf 情報登録用のStringBuilder 338 * @param key キー 339 * 340 * @return infomation情報(入力bufと同じオブジェクト) 341 * @og.rtnNotNull 342 */ 343 private StringBuilder tableTr1( final StringBuilder buf, final String key ) { 344// buf.append( "\t<tr><td colspan=\"4\"><b>【" ).append( key ).append( "】</b></td></tr>" ).append( CR ); // 【】追加 345// return buf ; 346 return buf.append( "\t<tr><td colspan=\"4\"><b>【" ).append( key ).append( "】</b></td></tr>" ).append( CR ); // 【】追加 347 } 348 349 /** 350 * infomation 情報を作成します。 351 * 352 * @og.rev 5.6.6.0 (2013/07/05) 最初の td に、全角スペース2個 追加 353 * 354 * @param buf 情報登録用のStringBuilder 355 * @param key キー 356 * @param val 値の可変長引数 357 * 358 * @return infomation情報(入力bufと同じオブジェクト) 359 * @og.rtnNotNull 360 */ 361 private StringBuilder tableTr( final StringBuilder buf, final String key, final String... val ) { 362 buf.append( "\t<tr><td width=\"20px\"> </td><td>" ).append( key ).append( "</td><td> = </td><td>" ); // 段を作成する為に、width指定 追加 363 for( int i=0; i<val.length; i++ ) { 364 buf.append( val[i] ); 365 } 366// buf.append( "</td></tr>" ).append( CR ); 367// return buf ; 368 return buf.append( "</td></tr>" ).append( CR ); 369 } 370 371 /** 372 * infomation 情報を作成します。 373 * 374 * @og.rev 6.2.4.1 (2015/05/22) ディスク容量専用 375 * @og.rev 6.2.4.2 (2015/05/29) total が 0 の場合の対応 376 * 377 * @param buf 情報登録用のStringBuilder 378 * @param name ドライブ名 379 * @param total パーティションのサイズ(GB) 380 * @param usable 仮想マシンが利用できるサイズ(GB) 381 * 382 * @return infomation情報(入力bufと同じオブジェクト) 383 * @og.rtnNotNull 384 */ 385 private StringBuilder tableTr2( final StringBuilder buf, final String name, final long total, final long usable ) { 386 final long useRatio = total == 0L ? 0L : (total-usable)*100/total ; // 6.3.9.0 (2015/11/06) findBugs 387 388// final String bgCls = useRatio <= 50 ? "OK" : ( useRatio <= 80 ? "CAUT" : ( useRatio <= 95 ? "WARN" : "NG" ) ) ; 389 final String bgCls = useRatio <= 50 ? "OK" : useRatio <= 80 ? "CAUT" : useRatio <= 95 ? "WARN" : "NG" ; // 6.9.7.0 (2018/05/14) PMD Useless parentheses. 390 391// buf.append( "\t<tr><td class=\"BIT\">" ).append( name ).append( "</td>" ) 392 return buf.append( "\t<tr><td class=\"BIT\">" ).append( name ).append( "</td>" ) 393 .append( "<td class=\"S9\" >" ).append( total ).append( " GB</td>" ) 394 .append( "<td class=\"S9\" >" ).append( usable ).append( " GB</td>" ).append( CR ) 395 .append( "\t\t<td class=\"discTD\" ><span class=\"disc " ).append( bgCls ) 396 .append( "\" style=\"width:" ).append( useRatio ).append( "%;\" >" ) 397 .append( useRatio ).append( "%</span> </td></tr>" ).append( CR ); 398// return buf ; 399 } 400 401 /** 402 * close 情報を作成します。 403 * 404 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 405 * @og.rev 3.6.0.0 (2004/09/17) CalendarFactory.clear() を追加します。 406 * @og.rev 4.0.0.0 (2005/01/31) Cleanable インターフェースによる初期化処理 407 * @og.rev 4.1.0.2 (2008/01/29) UserInfoをsessionから消去する(超暫定対応) 408 * @og.rev 5.6.6.0 (2013/07/05) UserSummary の削除処理は、SystemManager から行う。 409 * @og.rev 6.3.7.0 (2015/09/04) ファイナライズを呼び出します。 410 * 411 * @param session HttpSessionオブジェクト 412 * 413 * @return close情報 414 * @og.rtnNotNull 415 */ 416 private String getCloseMessage( final HttpSession session ) { 417 418 // 4.0.0 (2005/01/31) Cleanable インターフェースによる初期化処理 419 SystemManager.allClear( false ) ; 420 421 final ServletContext context = session.getServletContext(); 422 final Map<String,String> param = SystemParameter.makeSystemParameter( context ); 423 HybsSystem.setInitialData( param ); // 4.0.0 (2005/01/31) 424 425 // 5.6.6.0 (2013/07/05) UserSummary の削除処理は、SystemManager から行う。 426 SystemManager.removeSession( session ) ; 427 428 // 6.3.7.0 (2015/09/04) ファイナライズを呼び出します。 429 System.runFinalization(); 430 // System.gc(); // 取りあえず、GCは呼びません。 431 432// final String rtn = "<pre>" 433 return "<pre>" 434 + "キャッシュ情報をクリアしました。" + CR 435 + "ユーザー情報の初期化に関しては、ブラウザを閉じて、再ログインが必要です。" + CR 436 + ConnectionFactory.information() 437 + "</pre>" ; 438// return rtn ; 439 } 440 441 /** 442 * loginUser 情報を作成します。 443 * 444 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 445 * @og.rev 3.8.5.3 (2006/08/07) ユーザー情報をソートするためのキー情報を追加 446 * @og.rev 3.8.7.0 (2006/12/15) USER.LASTACCESS情報を追加します。 447 * @og.rev 4.0.0.0 (2005/01/31) DBColumn の 属性(CLS_NM)から、DBTYPEに変更 448 * @og.rev 4.4.0.1 (2009/08/08) 最終ログイン画面名称を追加 449 * @og.rev 5.6.6.0 (2013/07/05) table作成処理を、変更します。 450 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 451 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 452 * 453 * @param sort ソートするキー項目を指定 454 * @param direc ソートする方向 [true:昇順/false:降順] 455 * 456 * @return loginUser情報 457 * @og.rtnNotNull 458 */ 459 private String getLoginUser( final String sort,final boolean direc ) { 460 // 4.0.0 (2005/01/31) ログイン数の取得方法の変更。 461 final int loginCount = SystemManager.getRunningCount() ; 462 463 // 4.0.0 (2005/01/31) 464 final UserSummary[] userInfos = SystemManager.getRunningUserSummary( sort,direc ); 465 466 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 467 .append( "現在 " ).append( loginCount ).append( " 名の方がログイン中です。" ).append( CR ) 468 .append( "<table " ).append( TABLE_HEADER ).append( " >" ) 469 .append( "<thead><tr><th>No</th>" ); 470 471 // 5.6.6.0 (2013/07/05) table作成処理を、変更します。 472 for( final String sortKey : USER_KEYS ) { 473 rtn.append( "<th><a href=\"?COMMAND=loginUser&sort=" ).append( sortKey ) 474 .append( "&direc=" ).append( !direc ) 475 .append( "\">" ).append( sortKey ).append( "</a></th>" ); 476 } 477 478 rtn.append( "</tr></thead>" ).append( CR ) 479 // 5.9.1.2 (2015/10/23) 自己終了警告対応 480 .append( "<colgroup class=\"S9\" ><!-- --></colgroup>" ) 481 .append( "<colgroup class=\"X\" span=\"6\" ><!-- --></colgroup>" ) 482 .append( CR ); 483 484 for( int i=0; i<userInfos.length; i++ ) { 485 final UserSummary userInfo = userInfos[i] ; 486 rtn.append( " <tr class=\"row_" ).append( i%2 ).append( "\" >" ) 487 .append( "<td>" ).append( String.valueOf( i+1 ) ).append( "</td>" ) 488 .append( "<td>" ).append( userInfo.getUserID() ).append( "</td>" ) 489 .append( "<td>" ).append( userInfo.getJname() ).append( "</td>" ) 490 .append( "<td>" ).append( userInfo.getRoles() ).append( "</td>" ) 491 .append( "<td>" ).append( userInfo.getIPAddress() ).append( "</td>" ) 492 .append( "<td>" ).append( HybsSystem.getDate( userInfo.getLoginTime() ) ).append( "</td>" ) 493 .append( "<td>" ).append( userInfo.getAttribute( "LASTACCESS") ).append( "</td>" ) 494 .append( "<td>" ).append( StringUtil.nval( userInfo.getAttribute( "LASTGAMENNM"), "" ) ).append( "</td>" ) // 4.4.0.1 (2009/08/08) 495 .append( " </tr>" ).append( CR ); 496 } 497// rtn.append( TABLE_END ); 498 return rtn.append( TABLE_END ).toString(); 499 500// return rtn.toString() ; 501 } 502 503 /** 504 * PlugIn 情報を作成します。 505 * 506 * @og.rev 4.0.0.0 (2005/08/31) 新規作成 507 * @og.rev 5.6.6.0 (2013/07/05) "DBConstValue","Daemon","JspCreate" を、追加します。 508 * 509 * @return PlugIn情報 510 * @og.rtnNotNull 511 */ 512 private String getPlugInInfo() { 513 514 final String[] pluginType = new String[] { 515 "Query","Renderer","Editor","DBType","ViewForm", 516 "TableReader","TableWriter","TableFilter","ChartWriter","CalendarQuery", 517 "DBConstValue","Daemon","JspCreate" // 5.6.6.0 (2013/07/05) 追加 518 } ; 519 520 final ClassInfo info = new ClassInfo(); 521 522 for( int j=0; j<pluginType.length; j++ ) { 523 final String type = pluginType[j] ; 524 final HybsEntry[] names = HybsSystem.sysEntry( type + "_" ); 525 for( int i=0; i<names.length; i++ ) { 526 final String key = names[i].getKey().substring( type.length()+1 ); 527 final String clsName = names[i].getValue(); 528 info.addLine( type,key,clsName ); 529 } 530 } 531 return info.getClassInfoData() ; 532 } 533 534 /** 535 * Taglib 情報を作成します。 536 * 537 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 538 * @og.rev 5.3.6.0 (2011/06/01) Taglib クラス名の求め方を変更します。(jar版のみ) 539 * @og.rev 5.5.2.6 (2012/05/25) JarFile を、Closer#zipClose( ZipFile ) メソッドを利用して、close します。 540 * @og.rev 6.8.5.1 (2018/01/15) ファイル名は、##バージョン番号を変換しておく必要がある。 541 * 542 * @return Taglib情報 543 * @og.rtnNotNull 544 */ 545 private String getTaglibInfo() { 546 final ClassInfo info = new ClassInfo(); 547 548 // 5.5.2.6 (2012/05/25) findbugs対応 549 JarFile jarFile = null; 550 try { 551 final ClassLoader loader = Thread.currentThread().getContextClassLoader(); 552 final Enumeration<URL> enume = loader.getResources( "org/opengion/hayabusa/taglib/" ); // 4.3.3.6 (2008/11/15) Generics警告対応 553 while( enume.hasMoreElements() ) { 554 final URL url = enume.nextElement(); // 4.3.3.6 (2008/11/15) Generics警告対応 555 // jar:file:/実ディレクトリ または、file:/実ディレクトリ 556// final String dir = url.getFile(); 557 final String dir = url.getFile().replaceAll( "%23%23","##" ); // 6.8.5.1 (2018/01/15) 558 if( "jar".equals( url.getProtocol() ) ) { 559 // dir = file:/G:/webapps/gf/WEB-INF/lib/hayabusa4.0.0.jar!/org/opengion/hayabusa/taglib 形式です。 560 final String jar = dir.substring(dir.indexOf( ':' )+1,dir.lastIndexOf( '!' )); 561 // jar = /G:/webapps/gf/WEB-INF/lib/hayabusa4.0.0.jar 形式に切り出します。 562 jarFile = new JarFile( jar ); 563 final Enumeration<JarEntry> en = jarFile.entries() ; // 4.3.3.6 (2008/11/15) Generics警告対応 564 while( en.hasMoreElements() ) { 565 final JarEntry ent = en.nextElement(); // 4.3.3.6 (2008/11/15) Generics警告対応 566 final String file = ent.getName(); 567 if( ! ent.isDirectory() && file.endsWith( "Tag.class" ) ) { 568 final String type = "Taglib_jar"; 569 // 5.3.6.0 (2011/06/01) Taglib クラス名の求め方を変更します。(jar版のみ) 570 final String key = file.substring( file.lastIndexOf( '/' )+1,file.length()-6 ); // -6 は、.class 分 571 final String clsName = file.replace( '/','.' ).substring( 0,file.length()-6 ); 572 info.addLine( type,key,clsName ); 573 } 574 } 575 Closer.zipClose( jarFile ); // 5.5.2.6 (2012/05/25) findbugs対応 576 jarFile = null; // 正常終了時に、close() が2回呼ばれるのを防ぐため。 577 } 578 else { 579 // dir = /G:/webapps/gf/WEB-INF/classes/org/opengion/hayabusa/taglib/ 形式です。 580 final File[] list = new File( dir ).listFiles(); 581 // 6.3.9.0 (2015/11/06) null になっている可能性がある(findbugs) 582 if( list != null ) { 583 for( final File file : list ) { 584 final String name = file.getName() ; 585 if( file.isFile() && name.endsWith( "Tag.class" ) ) { 586 final String type = "Taglib_file"; 587 final String key = name.substring( 0,name.length()-6 ); 588 final String clsName = "org.opengion.hayabusa.taglib." + key ; 589 info.addLine( type,key,clsName ); 590 } 591 } 592 } 593 } 594 } 595 } 596 catch( final IOException ex ) { 597 final String errMsg = "taglibファイル読み取りストリームを失敗しました。" 598 + CR + ex.getMessage(); 599 throw new OgRuntimeException( errMsg,ex ); 600 } 601 finally { 602 Closer.zipClose( jarFile ); // 5.5.2.6 (2012/05/25) findbugs対応 603 } 604 605 return info.getClassInfoData() ; 606 } 607 608 /** 609 * クラス情報を表示するためのデータを管理します。 610 * ここでは、引数に渡された、分類(Classify)、名称(Key Name)、クラス名(Class Name)、 611 * バージョン(Version)情報をテーブル形式で表示します。 612 * バージョン情報は、クラス名から、インスタンスを作成して、private static final String VERSION 613 * フィールドの値を読み取ります。 614 * 615 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 616 */ 617 private static final class ClassInfo { 618 private final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ); 619 private int cnt; 620 621 /** 622 * コンストラクター 623 * 624 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 625 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 626 */ 627 public ClassInfo() { 628 629 // 5.9.1.2 (2015/10/23) 自己終了警告対応。ついでに、append連結しておきます。 630 rtn.append( "<table " ).append( TABLE_HEADER ).append( " >" ).append( CR ) 631 .append( " <thead><tr><th>No</th><th>Classify</th><th>Key Name</th><th>Class Name</th><th>Version</th></tr></thead>" ).append( CR ) 632 .append( " <colgroup class=\"S9\" ><!-- --></colgroup>") 633 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 634 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 635 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 636 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 637 .append( " <colgroup class=\"X\" ><!-- --></colgroup>" ) 638 .append( CR ); 639 } 640 641 /** 642 * テーブル表示用のデータを追加します。 643 * 644 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 645 * 646 * @param type タイプ属性 647 * @param key キー属性 648 * @param clsName クラス名(このクラス名からインスタンス化します。) 649 */ 650 public void addLine( final String type, final String key, final String clsName ) { 651 final String version = getFieldValue( clsName ); 652 653 final boolean isCustom = version.compareTo( BuildNumber.VERSION_NO ) > 0 654 || version.indexOf( "Pache" ) >= 0 655 || version.indexOf( "Nightly" ) >= 0 ; 656 657 final String trType = isCustom ? "warning" : String.valueOf( cnt%2 ); 658 659 rtn.append( "<tr class=\"row_" ).append( trType ).append( "\" >" ) 660 .append( "<td>" ).append( cnt++ ).append( "</td>" ) 661 .append( "<td>" ).append( type ).append( "</td>" ) 662 .append( "<td>" ).append( key ).append( "</td>" ) 663 .append( "<td>" ).append( clsName ).append( "</td>" ) 664 .append( "<td>" ).append( version ).append( "</td>" ) 665 .append( "</tr>" ).append( CR ); 666 } 667 668 /** 669 * すべての内部のデータを文字列化して返します。 670 * 671 * @og.rev 4.0.0.0 (2006/01/31) 新規作成 672 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 673 * 674 * @return 作成されたテーブルデータ 675 * @og.rtnNotNull 676 */ 677 public String getClassInfoData() { 678// rtn.append( TABLE_END ); 679// return rtn.toString() ; 680 return rtn.append( TABLE_END ).toString(); 681 } 682 683 /** 684 * 指定のオブジェクトの VERSION staticフィールドの値を取得します。 685 * 686 * @og.rev 4.0.0.0 (2005/08/31) 新規作成 687 * @og.rev 6.4.3.3 (2016/03/04) HybsSystem#newInstance(String) ではなく、直接Class#forName(String)から、求めます。 688 * 689 * @param clsName 指定のクラスを表す名称 690 * @return VERSIONフィールドの値(エラー時は、そのメッセージ) 691 */ 692 private String getFieldValue( final String clsName ) { 693 String rtn ; 694 try { 695 final Field fld = Class.forName( clsName ).getDeclaredField( "VERSION" ) ; 696 697 // privateフィールドの取得には、accessibleフラグを trueにする必要があります。 698 fld.setAccessible( true ); 699 700 rtn = (String)fld.get( null ); 701 } 702 catch( final Throwable ex ) { 703 rtn = ex.getMessage(); 704 } 705 return rtn ; 706 } 707 } 708 709 /** 710 * systemResource 情報を作成します。 711 * 712 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 713 * @og.rev 4.0.0.0 (2005/01/31) DBColumn の 属性(CLS_NM)から、DBTYPEに変更 714 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 715 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 716 * @og.rev 6.4.3.3 (2016/03/04) 配列返しではなく、Map を返します。 717 * 718 * @return systemResource情報 719 * @og.rtnNotNull 720 */ 721 private String getSystemResource() { 722 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 723 .append( "<table " ).append( TABLE_HEADER ).append( " >" ).append( CR ) 724 .append( "<thead><tr><th>No</th><th>Key</th><th>Value</th></tr></thead>" ).append( CR ) 725 // 5.9.1.2 (2015/10/23) 自己終了警告対応 726 .append( "<colgroup class=\"S9\" ><!-- --></colgroup>" ) 727 .append( "<colgroup class=\"X\" span=\"2\" ><!-- --></colgroup>" ) 728 .append( CR ); 729 730 // 6.4.3.3 (2016/03/04) 配列返しではなく、Map を返します。 731 final ConcurrentMap<String,String> rscMap = HybsSystem.getSystemResourceMap(); 732 int i=0; 733 for( final Map.Entry<String,String> entry : rscMap.entrySet() ) { 734 rtn.append( "<tr class=\"row_" ).append( i%2 ).append( "\" >" ).append( CR ) 735 .append( "<td>" ).append( ++i ).append( "</td>" ) 736 .append( "<td>" ).append( entry.getKey() ).append( "</td>" ) 737 .append( "<td>" ).append( entry.getValue() ).append( "</td>" ) 738 .append( "</tr>" ).append( CR ); 739 } 740 return rtn.append( TABLE_END ).toString(); 741 } 742 743 /** 744 * AccessStop 情報を作成します。 745 * 746 * @og.rev 3.5.3.1 (2003/10/31) 機能ごとにメソッドを呼び出すように修正します。 747 * @og.rev 4.0.0.0 (2007/11/29) AccessStopFilter#getStopFilter() ⇒ isStopFilter() に変更 748 * @og.rev 6.1.1.0 (2015/01/17) パッケージを import するのと、ロジック見直し。 749 * @og.rev 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 750 * 751 * @param isStop true:停止/false:実行 752 * @return AccessStop情報 753 * @og.rtnNotNull 754 */ 755 private String getAccessStop( final String isStop ) { 756 757 final boolean flag = Boolean.parseBoolean( isStop ); // 6.3.8.0 (2015/09/11) 758 // AccessStopFilter.setStopFilter( flag ); 759 760 return flag ? "Webアプリケーションのサービスを停止します。" 761 : "Webアプリケーションのサービスを開始します。"; 762 } 763 764 /** 765 * application オブジェクトに関連付ける 共通メッセージを設定します。 766 * 767 * 取り出しは、errorMessageタグで行います。これは、個々のrequest.jsp に組み込まれている 768 * メッセージなので、ここで登録したメッセージは、同時に、すべてのアクセスしているユーザーが 769 * 見ることになります。 770 * 771 * @og.rev 6.4.4.1 (2016/03/18) application オブジェクトに関連付ける 共通メッセージを設定します。 772 * @og.rev 6.8.5.0 (2018/01/09) 共通メッセージで、strongタグのバグ修正と、class="common_msg" 追加。 773 * 774 * @param type [set/clear] を指定します。 775 * @param message 共通メッセージを指定します。 776 * @param session HttpSessionオブジェクト 777 * 778 * @return Servlet/Filter情報 779 * @og.rtnNotNull 780 */ 781 private String setCommonMessage( final String type , final String message , final HttpSession session ) { 782 final ServletContext context = session.getServletContext(); 783 784 String rtMsg = ""; 785 if( "set".equalsIgnoreCase( type ) && message != null && message.length() > 0 ) { 786 rtMsg = "<strong class=\"common_msg\">" + message + "</strong><br />"; // 6.8.5.0 (2018/01/09) 787 context.setAttribute( HybsSystem.COMMON_MSG_KEY,rtMsg ); 788 } 789 else if( "get".equalsIgnoreCase( type ) ) { 790 rtMsg = (String)context.getAttribute( HybsSystem.COMMON_MSG_KEY ); 791 } 792 else if( "clear".equalsIgnoreCase( type ) ) { 793 context.removeAttribute( HybsSystem.COMMON_MSG_KEY ); 794 } 795 796 return rtMsg; 797 } 798 799 /** 800 * Servlet/Filter 情報を作成します。 801 * 802 * @og.rev 6.3.8.3 (2015/10/03) Servlet/Filter 情報を作成。 803 * @og.rev 5.9.1.2 (2015/10/23) 自己終了警告対応 804 * 805 * @param session HttpSessionオブジェクト 806 * 807 * @return Servlet/Filter情報 808 * @og.rtnNotNull 809 */ 810 private String getRegistrationMessage( final HttpSession session ) { 811 final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 812 .append( "<table " ).append( TABLE_HEADER ).append( " >" ) 813 .append( "<thead><tr><th>No</th><th>Type</th><th>Key</th><th>Class</th><th>Mappings</th></tr></thead>" ) 814 // 5.9.1.2 (2015/10/23) 自己終了警告対応 815 .append( "<colgroup class=\"S9\" ><!-- --></colgroup>" ) 816 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 817 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 818 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 819 .append( "<colgroup class=\"X\" ><!-- --></colgroup>" ) 820 .append( CR ); 821 822 int no = 0; 823 final ServletContext context = session.getServletContext(); 824 for( final ServletRegistration reg : context.getServletRegistrations().values() ) { 825 rtn.append( "<tr class=\"row_" ).append( no%2 ).append( "\" >" ) 826 .append( "<td>" ).append( String.valueOf( ++no ) ).append( "</td>" ) 827 .append( "<td>Servlet</td>" ) 828 .append( "<td>" ).append( reg.getName() ).append( "</td>" ) 829 .append( "<td>" ).append( reg.getClassName() ).append( "</td>" ) 830 .append( "<td>" ).append( reg.getMappings() ).append( "</td>" ) 831 .append( "</tr>" ).append( CR ); 832 } 833 834 for( final FilterRegistration reg : context.getFilterRegistrations().values() ) { 835 rtn.append( "<tr class=\"row_" ).append( no%2 ).append( "\" >" ) 836 .append( "<td>" ).append( String.valueOf( ++no ) ).append( "</td>" ) 837 .append( "<td>Filter</td>" ) 838 .append( "<td>" ).append( reg.getName() ).append( "</td>" ) 839 .append( "<td>" ).append( reg.getClassName() ).append( "</td>" ) 840 .append( "<td>" ).append( reg.getUrlPatternMappings() ).append( "</td>" ) 841 .append( "</tr>" ).append( CR ); 842 } 843 844// rtn.append( TABLE_END ); 845// return rtn.toString(); 846 return rtn.append( TABLE_END ).toString(); 847 } 848 849 /** 850 * admin リンク情報を作成します。 851 * 簡易メソッドなので、国際化対応していません。 852 * 853 * @og.rev 3.5.4.1 (2003/12/01) 新規作成 854 * @og.rev 5.1.1.2 (2009/12/10) 画面IDを変更 855 * @og.rev 5.6.3.4 (2013/04/26) クイックリファレンス 画面を追加 856 * @og.rev 6.3.6.1 (2015/08/28) <table> 枠の指定と、</table> の static final String 化 857 * @og.rev 6.3.8.0 (2015/09/11) AccessStop を外部から制御できるように、コマンドと状態を受けるようにする。 858 * @og.rev 6.9.2.1 (2018/03/12) リンクが横に長くなってきたので、2段に折り返します。 859 * 860 * @return アドミンリンク情報 861 * @og.rtnNotNull 862 */ 863 private String getAdminLink() { 864// final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE ) 865 return new StringBuilder( BUFFER_MIDDLE ) 866 .append( "<table><tr>" ) 867 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=infomation\" target=\"RESULT\" >状況表示</a>]</td>" ) 868 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=close\" target=\"RESULT\" >プール削除</a>]</td>" ) 869 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=loginUser\" target=\"RESULT\" >ログインユーザー</a>]</td>" ) 870 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=plugin\" target=\"RESULT\" >プラグイン情報</a>]</td>" ) 871 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=taglib\" target=\"RESULT\" >タグリブ情報</a>]</td>" ) 872 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=registrationInfo\" target=\"RESULT\" >Servlet/Filter情報</a>]</td>" ) 873 // .append( "</tr><tr>" ) 874 .append( "<td width=\"10px\"/><td>[<a href=\"common/quickReference.html\" target=\"RESULT\" >クイックリファレンス</a>]</td>" ) // 5.6.3.4 (2013/04/26) 875 .append( "<td width=\"10px\"/><td>[<a href=\"admin?COMMAND=systemResource\" target=\"RESULT\" >システムリソース</a>]</td>" ) // 6.3.8.0 (2015/09/11) 876 .append( "<td width=\"10px\"/><td>アクセス制限[<a href=\"admin?COMMAND=AccessStop&stop=true\" target=\"RESULT\" >停止</a>]/" ) 877 .append( "[<a href=\"admin?COMMAND=AccessStop&stop=false\" target=\"RESULT\" >開始</a>]</td>" ) 878 .append( "<td width=\"10px\"/><td>[<a href=\"common/gamen/01_ADMIN/parameter.jsp?GAMENID=01_ADMIN\" target=\"RESULT\" >パラメータ</a>]</td>" ) 879 .append( "<td width=\"10px\"/><td>[<a href=\"common/gamen/01_ADMIN/systemInfo.jsp?GAMENID=01_ADMIN\" target=\"RESULT\" >システム状況</a>]</td>" ) 880 .append( "</tr>" ).append( TABLE_END ) 881 .toString(); 882 883// return rtn.toString(); 884 } 885 886 /** 887 * DBTableModel から テーブルのタグ文字列を作成して返します。 888 * 889 * @og.rev 3.5.3.1 (2003/10/31) User情報のテーブルの設定を、システムリソース より行う。 890 * @og.rev 5.2.2.0 (2010/11/01) SystemData 見直し漏れの対応。 891 * 892 * @return テーブルのタグ文字列 893 * @og.rtnNotNull 894 */ 895 private static String getTableHeaderTag() { 896 // 6.1.1.0 (2015/01/17) Attributesの連結記述 897 return new Attributes() 898 .set( "id" ,"viewTable" ) // 3.6.0.5 (2004/10/18) 899 .set( "summary" ,"layout" ) // サマリー 900 .getAttribute(); 901 } 902 903 /** 904 * userInfo 情報をセットします。 905 * 現状、このメソッドではLANGのみ設定可能です。 906 * (予約語以外のセットはuserInfoタグで行う) 907 * 908 * LANGではuserInfoを切り替えた後にユーザのGUIInfoを再ロードします。 909 * 910 * @og.rev 5.9.1.0 (2015/10/02) 新規作成 911 * 912 * @param req HttpServletRequestオブジェクト 913 * @return 結果情報 914 */ 915 private String setUserinfo( final HttpServletRequest req ) { 916 final HttpSession session = req.getSession(); 917 final UserInfo userInfo = (UserInfo)(session.getAttribute( HybsSystem.USERINFO_KEY )); 918 919 final String infoLang = req.getParameter( "LANG" ); 920 921 String rtn = null ; 922 if( userInfo != null && infoLang != null && infoLang.length() > 0) { 923 userInfo.setLang( infoLang ); 924 ResourceFactory.newInstance( userInfo.getLang() ).makeGUIInfos( userInfo ); 925 rtn = "User language : " + infoLang; 926 } 927 928 if( rtn == null || rtn.length() == 0 ) { 929 rtn = "Error"; 930 } 931 932 return rtn ; 933 } 934}