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     */
016    package org.opengion.fukurou.transfer;
017    
018    import 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     */
043    public 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    }