Search in sources :

Example 1 with ServiceException

use of jp.ossc.nimbus.lang.ServiceException in project nimbus by nimbus-org.

the class WeakReferenceCodeMasterService method codeMasterRefresh.

/**
 * マスター更新
 * Message は MapMessageとし、<br>
 * nameとvalueの組み合わせは、<br>
 * "key" (String)  | [マスター名] (String)<br>
 * "date" (String) | [データ有効日時](long)<br>
 * で設定すること<br>
 * 指定した日付以降の日付が既に設定されていれば、該当するマスタデータを無効にする
 * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
 */
private void codeMasterRefresh(String[] flowNames, Date date) {
    for (int i = 0; i < flowNames.length; i++) {
        String bfname = flowNames[i];
        final BeanFlowInvoker invoker = mBFInvokerFactory.createFlow(bfname);
        if (invoker == null) {
            // BeanFlowInvokerFactoryは無効キーでNULLを返す
            throw new ServiceException("WeakReferenceCodeMasterService004", "Cannot specify Invoker with key ->" + bfname);
        }
        TimeManageMaster tmgr = (TimeManageMaster) this.mMaster.get(bfname);
        // 無かった場合新しく登録を行う
        if (tmgr == null) {
            // 時系列管理マスタテーブルを作成
            tmgr = new TimeManageMaster();
            tmgr.setMasterName(bfname);
            // マスタに登録
            synchronized (mMaster) {
                this.mMaster.put(bfname, tmgr);
            }
        }
        Object outMaster = null;
        try {
            // BeanFlowを実行する
            outMaster = invoker.invokeFlow(null);
        } catch (Exception e) {
            throw new ServiceException("WeakReferenceCodeMasterService005", "Exception occured in Invoker with key ->" + bfname, e);
        }
        if (outMaster == null) {
            throw new ServiceException("WeakReferenceCodeMasterService006", "Return codemaster is null : key ->" + bfname);
        }
        final TimeManageMaster newTm = tmgr.cloneOwn();
        // マスタを登録(内部でキャッシュ参照に変換される)
        newTm.addMaster(date, outMaster);
        // 現在時刻で不要なマスタを削除
        newTm.clear();
        synchronized (this.mMaster) {
            this.mMaster.put(bfname, newTm);
        }
    }
}
Also used : ServiceException(jp.ossc.nimbus.lang.ServiceException) BeanFlowInvoker(jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvoker) ServiceException(jp.ossc.nimbus.lang.ServiceException)

Example 2 with ServiceException

use of jp.ossc.nimbus.lang.ServiceException in project nimbus by nimbus-org.

the class NumericSequenceService method setFormat.

// NumericSequenceServiceMBean のJavaDoc
public void setFormat(String format) {
    synchronized (this) {
        // formatを桁区切りで分解する
        CsvArrayList parser = new CsvArrayList();
        parser.split(format, C_SEMICORON);
        if (parser.size() != 2) {
            throw new ServiceException("NUMERICSEQ001", "fromat is invalid format = " + format);
        // $NON-NLS-1$ //$NON-NLS-2$
        }
        mMin = parser.getStr(0);
        mMax = parser.getStr(1);
        if (!StringOperator.isNumeric(mMin)) {
            throw new ServiceException("NUMERICSEQ002", "MIN is not numeric min = " + mMin);
        // $NON-NLS-1$ //$NON-NLS-2$
        }
        if (!StringOperator.isNumeric(mMax)) {
            throw new ServiceException("NUMERICSEQ003", "MAX is not numeric max = " + mMax);
        // $NON-NLS-1$ //$NON-NLS-2$
        }
        StringBuilder tmpFormat = new StringBuilder();
        for (int cnt = 0; cnt < mMax.length(); cnt++) {
            tmpFormat.append(C_ZERO_WITH_COMMMA);
            tmpFormat.append(C_NINE);
            if (cnt != mMax.length() - 1) {
                tmpFormat.append(C_SEMICORON);
            }
        }
        mFormat = tmpFormat.toString();
    }
}
Also used : ServiceException(jp.ossc.nimbus.lang.ServiceException) CsvArrayList(jp.ossc.nimbus.util.CsvArrayList)

Example 3 with ServiceException

use of jp.ossc.nimbus.lang.ServiceException in project nimbus by nimbus-org.

the class CashedClassLoader method setupDirPropList.

// 
/**
 * Method ディレクトリ指定でクラス名を抽出する.
 * @param item
 */
protected void setupDirPropList(URL item) {
    String dirPath = StringOperator.replaceString(item.getFile(), C_BK_SRASH, C_SRASH);
    if (!item.getFile().endsWith(C_SRASH)) {
        dirPath = dirPath + C_SRASH;
    }
    RecurciveSearchFile file = new RecurciveSearchFile(dirPath);
    ExtentionFileFilter filter = new ExtentionFileFilter(C_CLASS_EXT, true);
    File[] list = file.listAllTreeFiles(filter);
    for (int cnt = 0; cnt < list.length; cnt++) {
        String path = list[cnt].getAbsolutePath();
        // int pos = item.getFile().length();
        // 2003.11.13 Hirokado -1追加
        int pos = item.getFile().length() - 1;
        path = path.substring(pos, path.length() - C_CLASS_EXT.length());
        path = StringOperator.replaceString(path, C_SRASH, C_DOT);
        Class cls = null;
        try {
            cls = this.loadClass(path);
        } catch (ClassNotFoundException e) {
            // $NON-NLS-1$//$NON-NLS-2$
            throw new ServiceException("CASHCLASSLODER003", "ClassNotFoundException clsename = " + path, e);
        }
        mClassHash.put(path, cls);
    }
}
Also used : RecurciveSearchFile(jp.ossc.nimbus.io.RecurciveSearchFile) ServiceException(jp.ossc.nimbus.lang.ServiceException) RecurciveSearchFile(jp.ossc.nimbus.io.RecurciveSearchFile) JarFile(java.util.jar.JarFile) File(java.io.File) ExtentionFileFilter(jp.ossc.nimbus.io.ExtentionFileFilter)

Example 4 with ServiceException

use of jp.ossc.nimbus.lang.ServiceException in project nimbus by nimbus-org.

the class CachedPerformanceStatisticsService method entry.

// 
/**
 *	パフォーマンスエントリメソッド<BR>
 *	パフォーマンスオブジェクトのエントリを行う。<BR>
 * @param key	スタティスティクス名
 * @param msec	パフォーマンス時間
 */
public void entry(String key, long msec) {
    synchronized (this) {
        PerformanceRecordOperator performanceObj = null;
        performanceObj = (PerformanceRecordOperator) mHash.get(key);
        if (performanceObj != null) {
            performanceObj.entry(msec);
        } else {
            try {
                performanceObj = (PerformanceRecordOperator) mClsRec.newInstance();
            } catch (InstantiationException e) {
                throw new ServiceException("PEFORMANCE001", "InstantiationException", e);
            } catch (IllegalAccessException e) {
                throw new ServiceException("PEFORMANCE001", "IllegalAccessException", e);
            }
            performanceObj.setResourceId(key);
            performanceObj.entry(msec);
            mHash.put(key, performanceObj);
        }
    }
}
Also used : ServiceException(jp.ossc.nimbus.lang.ServiceException)

Example 5 with ServiceException

use of jp.ossc.nimbus.lang.ServiceException in project nimbus by nimbus-org.

the class ResourceBundlePropertiesFactoryService method setupDirPropList.

// 
/**
 * Method ディレクトリ指定でプロパティファイルを抽出する.
 * @param item
 */
protected void setupDirPropList(String item) {
    String dirPath = StringOperator.replaceString(item, C_BK_SRASH, C_SRASH);
    if (!item.endsWith(C_SRASH)) {
        dirPath = dirPath + C_SRASH;
    }
    File dirPathFile = new File(dirPath);
    int pos = dirPathFile.getAbsolutePath().length();
    RecurciveSearchFile file = new RecurciveSearchFile(dirPath);
    ExtentionFileFilter filter = new ExtentionFileFilter(C_PROP_EXT, true);
    File[] list = file.listAllTreeFiles(filter);
    for (int cnt = 0; cnt < list.length; cnt++) {
        FileInputStream stream;
        try {
            stream = new FileInputStream(list[cnt]);
        } catch (FileNotFoundException e) {
            // $NON-NLS-1$ //$NON-NLS-2$
            throw new ServiceException("PROPFACTORY002", "FileNotFoundException name = " + list[cnt], e);
        }
        ArrayProperties prop = new ArrayProperties(mEncode);
        try {
            prop.load(stream);
        } catch (IOException e) {
            // $NON-NLS-1$ //$NON-NLS-2$
            throw new ServiceException("PROPFACTORY003", "IOException filename = " + list[cnt], e);
        }
        try {
            stream.close();
        } catch (IOException e) {
            // $NON-NLS-1$ //$NON-NLS-2$
            throw new ServiceException("PROPFACTORY004", "IOException filename = " + list[cnt], e);
        }
        String path = list[cnt].getAbsolutePath();
        path = path.substring(pos + 1, path.length() - C_PROP_EXT.length());
        path = StringOperator.replaceString(path, C_BK_SRASH, C_DOT);
        path = StringOperator.replaceString(path, C_SRASH, C_DOT);
        mPropHash.put(path, prop);
    }
}
Also used : RecurciveSearchFile(jp.ossc.nimbus.io.RecurciveSearchFile) ServiceException(jp.ossc.nimbus.lang.ServiceException) ArrayProperties(jp.ossc.nimbus.util.ArrayProperties) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) JarFile(java.util.jar.JarFile) File(java.io.File) RecurciveSearchFile(jp.ossc.nimbus.io.RecurciveSearchFile) ExtentionFileFilter(jp.ossc.nimbus.io.ExtentionFileFilter) FileInputStream(java.io.FileInputStream)

Aggregations

ServiceException (jp.ossc.nimbus.lang.ServiceException)11 JarFile (java.util.jar.JarFile)4 IOException (java.io.IOException)3 Date (java.util.Date)3 BeanFlowInvoker (jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvoker)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 Enumeration (java.util.Enumeration)2 ZipEntry (java.util.zip.ZipEntry)2 ExtentionFileFilter (jp.ossc.nimbus.io.ExtentionFileFilter)2 RecurciveSearchFile (jp.ossc.nimbus.io.RecurciveSearchFile)2 ArrayProperties (jp.ossc.nimbus.util.ArrayProperties)2 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ListIterator (java.util.ListIterator)1 CsvArrayList (jp.ossc.nimbus.util.CsvArrayList)1