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);
}
}
}
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();
}
}
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);
}
}
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);
}
}
}
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);
}
}
Aggregations