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.util;
017    
018    import java.io.File;
019    
020    /**
021     * HybsLoaderを生成するため?、設定情報を管?るため?クラスです?
022     *
023     * @og.rev 5.1.1.0 (2009/12/01) 新規作?
024     * @og.group 業務ロジ?
025     *
026     * @version 5.0
027     * @author Hiroki Nakamura
028     * @since JDK1.6,
029     */
030    public class HybsLoaderConfig {
031            private final String srcDir;
032            private final String classDir;
033    //      private final boolean isAutoCompile;
034    //      private final boolean isHotDeploy;
035            private final boolean useAutoCompile;           // 5.1.8.0 (2010/07/01) メソ?名と同じフィールド名なので、変更
036            private final boolean useHotDeploy;                     // 5.1.8.0 (2010/07/01) メソ?名と同じフィールド名なので、変更
037            private final String classPath;
038    
039            /**
040             * ソース?レクトリとクラス?レクトリのみを指定し、HybsLoaderの設定情報を構築します?
041             * こ?場合?AutoCompile機?、HotDeploy機?は無効になります?
042             *
043             * @param sDir ソース?レクトリ
044             * @param cDir クラス?レクトリ
045             */
046    //      public HybsLoaderConfig( final String sDir, final String cDir, final boolean isDebug ) {
047            public HybsLoaderConfig( final String sDir, final String cDir ) {
048                    this( sDir, cDir, false, false, null );
049            }
050    
051            /**
052             * HybsLoaderの設定情報を構築します?
053             *
054             * @param sDir ソース?レクトリ
055             * @param cDir クラス?レクトリ
056             * @param acom AutoCompile機?を有効にする?
057             * @param hdep HotDeploy機?を有効にする?
058             * @param clsPath コンパイル時?クラスパス
059             */
060            public HybsLoaderConfig( final String sDir, final String cDir
061                            ,final boolean acom, final boolean hdep, final String clsPath ) {
062                    srcDir = sDir.charAt( sDir.length() -1 ) == File.separatorChar ? sDir : sDir + File.separator;
063                    classDir = cDir.charAt( cDir.length() -1 ) == File.separatorChar ? cDir : cDir + File.separator;
064    
065                    useAutoCompile = acom;
066                    useHotDeploy = hdep;
067                    classPath  = clsPath;
068            }
069    
070            /**
071             * ソース?レクトリを取得します?
072             *
073             * @return ソース?レクトリ
074             */
075            public String getSrcDir() {
076                    return srcDir;
077            }
078    
079            /**
080             * クラス?レクトリを取得します?
081             *
082             * @return クラス?レクトリ
083             */
084            public String getClassDir() {
085                    return classDir;
086            }
087    
088            /**
089             * AutoCompileが有効化ど?を取得します?
090             *
091             * @return AutoCompileが有効?
092             */
093            public boolean isAutoCompile() {
094                    return useAutoCompile;
095            }
096    
097            /**
098             * HotDeployが有効化ど?を取得します?
099             *
100             * @return HotDeployが有効?
101             */
102            public boolean isHotDeploy() {
103                    return useHotDeploy;
104            }
105    
106            /**
107             * コンパイルのためのクラスパスを返します?
108             * コンストラクタで?のクラスパスが指定された場合?
109             * ここで返されるクラスパスは?;'区?のクラスパスになります?
110             *
111             * @return クラスパス
112             */
113            public String getClassPath() {
114                    return classPath;
115            }
116    }