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.fukurou.transfer; 017 018import org.opengion.fukurou.util.StringUtil; 019 020/** 021 * 伝送要求に対してのHTTP経由で旧伝送DB(CB01)への登録を行います。 022 * 023 * 実行対象は、(データコード) (送り先) (テキスト種別) ([プロトコル]://[ホスト名]:[ポート番号]/[コンテキスト名]/) 024 * の形式で指定します。 025 * 026 * 例)実行対象 : 3 D9 B991 http://localhost:8824/gf/ 027 * 028 * 要求を受けた際の動作は_CB01と同じです。 029 * _CB01同様にCB01テーブル以外に次のテーブル及びシーケンスが必要です 030 * テーブル:CB02 031 * シーケンス:CB010001,CB010002 032 * 033 * その他の処理内容については、{@link org.opengion.fukurou.transfer.TransferExec_HTTP}及び 034 * {@link org.opengion.fukurou.transfer.TransferExec_CB01}のJavaDocを参照して下さい。 035 * 036 * @og.rev 5.4.4.1 (2012/02/02) HybsSystemExceptionは利用しない 037 * @og.group 伝送システム 038 * 039 * @version 5.0 040 * @author Hiroki.Nakamura 041 * @since JDK1.6 042 */ 043public class TransferExec_HTTP_CB01 extends TransferExec_HTTP { 044 045 private String remoteHost = null; // リモート接続先URL 046 private String remoteExecObj = null; // リモート接続先の実行対象 047 048 /** 049 * ローカルの実行対象を、リモート接続先の実行対象とリモート接続先URLに分解します。 050 * 051 * @param localExecObj ローカルの実行対象 052 */ 053 @Override 054 protected void splitExecObj( final String localExecObj ) { 055 String[] obj = StringUtil.csv2Array( localExecObj, ' ' ); 056 if( obj.length < 4 ) { 057 String errMsg = "実行対象は、(データコード) (送り先) (テキスト種別) ([プロトコル]://[ホスト名]:[ポート番号]/[コンテキスト名]/) の形式で指定して下さい。[EXECOBJ=" + localExecObj + "]"; 058 // throw new HybsSystemException( errMsg ); 059 throw new RuntimeException( errMsg ); // 5.4.4.1 (2012/02/02) 060 } 061 String hcdd = obj[0]; 062 String hto = obj[1]; 063 String hsyu = obj[2]; 064 remoteHost = obj[3]; 065 if( hcdd == null || hcdd.length() == 0 066 || hto == null || hto.length() == 0 067 || hsyu == null || hsyu.length() == 0 068 || remoteHost == null || remoteHost.length() == 0 ) { 069 String errMsg = "実行対象は、(データコード) (送り先) (テキスト種別) ([プロトコル]://[ホスト名]:[ポート番号]/[コンテキスト名]/) は必須です。[EXECOBJ=" + localExecObj + "]"; 070 throw new RuntimeException( errMsg ); 071 } 072 073 remoteExecObj = hcdd + " " + hto + " " + hsyu; 074 } 075 076 /** 077 * リモート接続先URLを返します。 078 * このメソッドは、{@link #splitExecObj(String)}の後に呼び出しする必要があります。 079 * 080 * @return リモート接続先URL 081 */ 082 @Override 083 public String getRemoteHost() { 084 if( remoteHost == null || remoteHost.length() == 0 ) { 085 String errMsg = "先に#splitExecObj(String)を実行して下さい"; 086 throw new RuntimeException( errMsg ); 087 } 088 return remoteHost; 089 } 090 091 /** 092 * リモート接続先の実行対象を返します。 093 * このメソッドは、{@link #splitExecObj(String)}の後に呼び出しする必要があります。 094 * 095 * @return 接続URL 096 */ 097 @Override 098 public String getRemoteExecObj() { 099 if( remoteExecObj == null || remoteExecObj.length() == 0 ) { 100 String errMsg = "先に#splitExecObj(String)を実行して下さい"; 101 throw new RuntimeException( errMsg ); 102 } 103 return remoteExecObj; 104 } 105}