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    }