public class ServiceLoader extends jp.co.sds_corp.util.daemon.core.AbstractDaemon implements IReceiver
+---------------+ +---------+ | |<-IFilter-| ISource |<-外部ソース | | +---------+ | | | |-IFilter->+---------+ | ServiceLoader | | IMixer | | |<---------+---------+ | | | | +---------+ | |-IFilter->| IOutput |-ILayout->出力先 +---------------+ +---------+ServiceLoaderがXMLを読み込んで、全てのインスタンスの生成と管理 初期化・処理開始等を制御します。
ISource
から受け取ったデータは、一度IMixer
に送られます。
IMixer
では複数の${ISource}のデータを処理し
ServiceLoaderにデータを送り返します。
IMixer
から送られたデータは、OutputとAdapterに送られ
指定された出力先に送信されます。
XMLは以下の形式です。
<Daemon name="ServiceLoader" class="jp.co.sds-corp.co.jp.transfer.ServiceLoader">
Mixer要素は、IMixer
クラスを指定します。
IMixer
は、複数のISource
からデータ受信イベントを受け取り
ServiceLoaderにデータを返します。
<Mixer name="Mixer" class="jp.co.sds_corp.co.jp.transfer.source.SimpleMixer"> </Mixer>
Source要素は、データの取得元ISource
を指定します。
子要素については個別のクラスの説明を参照してください。
<Source name="Source" class="jp.co.sds_corp.co.jp.transfer.source.XXSource"> <url>http://www.sds-corp.co.jp/vfx/servlet/ForwardFeed</url> <filter class="jp.co.sds_corp.transfer.filter.SanityFilter"/> <filter class="jp.co.sds_corp.transfer.filter.SanityFilter"> <ccypair>USDJPY</ccypair> </filter> </Source>
Output要素は、データの出力先IOutput
を指定します。
子要素については個別のクラスの説明を参照してください。
<Output name="File" class="jp.co.sds-corp.co.jp.transfer.output.FileOutput"> <file>data.hist</file> <format>%C %c %T %B %A %U{yyyy/MM/dd HH:mm:ss}</format> </Output> <Output name="Db" class="jp.co.sds_corp.co.jp.transfer.output.DbOutput"> <sql>update table set bid=%b where ccy1=%C</sql> </Output></Daemon>
コンストラクタと説明 |
---|
ServiceLoader() |
修飾子とタイプ | メソッドと説明 |
---|---|
protected void |
addFilter(IFilterable obj,
jp.co.sds_corp.util.config.IConfiguration config)
|
void |
addReceiveListener(IDataKey key,
IReceiveListener l)
データ受信を受け取るオブジェクトを追加します。
|
void |
addReceiveListener(IReceiveListener l)
データ受信を受け取るオブジェクトを追加します。
|
protected IMixer |
createMixer(jp.co.sds_corp.util.config.IConfiguration config)
指定された
IMixer を生成します。 |
protected Map<String,IMixer> |
createMixerMap(jp.co.sds_corp.util.config.IConfiguration config)
指定された初期情報で、全ての
IMixer を生成します。 |
protected IOutput |
createOutput(jp.co.sds_corp.util.config.IConfiguration config)
指定された
IOutput を生成します。 |
protected Map<String,IOutput> |
createOutputMap(jp.co.sds_corp.util.config.IConfiguration config)
指定された初期情報で、全ての
IOutput を生成します。 |
protected ISource |
createSource(jp.co.sds_corp.util.config.IConfiguration config)
指定された
ISource を生成します。 |
protected Map<String,ISource> |
createSourceMap(jp.co.sds_corp.util.config.IConfiguration config)
指定された初期情報で、全ての
ISource を生成します。 |
void |
fireReceive(ReceiveEvent e)
データ受信イベントを通知します。
|
void |
fireStatusChange(StatusChangeEvent e)
状態変更イベントを通知します。
|
Collection<IData> |
getCurrent(IDataKey key)
現在のデータを返します。
|
static ServiceLoader |
getInstance()
VM内のServiceLoaderインスタンスを返します。
|
void |
init(jp.co.sds_corp.util.config.IConfiguration config)
指定された初期情報で、ServiceLoaderを初期化します。
|
void |
joinAll()
全てのThreadの終了を待ちます。
|
protected void |
recvMixerEvent(ReceiveEvent e)
Mixerからデータ受信イベントを通知します。
|
protected void |
recvMixerStatus(StatusChangeEvent e)
Mixerから状態変更イベントを通知します。
|
protected void |
recvSourceEvent(ReceiveEvent e)
Sourceからデータ受信イベントを通知します。
|
protected void |
recvSourceStatus(StatusChangeEvent e)
Sourceから状態変更イベントを通知します。
|
void |
removeReceiveListener(IDataKey key,
IReceiveListener l)
データ受信を受け取るオブジェクトを削除します。
|
void |
removeReceiveListener(IReceiveListener l)
データ受信を受け取るオブジェクトを削除します。
|
void |
start()
ServiceLoaderの処理を開始します。
|
void |
terminate()
このクラスに属する全てのサービスを停止します。
|
String |
toString()
このデーモンの文字列表現
|
addFilter, addStatusChangeListener, createAllFilter, createFilter, fireStatusChange, getFilterList, getName, getService, getStatus, getStatusString, isAlive, isDebug, isValid, removeFilter, removeStatusChangeListener, saveConfig, setDebug, setName, setService, setStatus, setStatus
public static ServiceLoader getInstance()
public void init(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
init
インタフェース内 jp.co.sds_corp.util.config.IConfigurable
init
クラス内 jp.co.sds_corp.util.daemon.core.AbstractDaemon
config
- 初期情報Exception
protected Map<String,IMixer> createMixerMap(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
IMixer
を生成します。config
- 初期情報Exception
protected IMixer createMixer(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
IMixer
を生成します。config
- 初期情報Exception
protected Map<String,ISource> createSourceMap(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
ISource
を生成します。config
- 初期情報Exception
protected ISource createSource(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
ISource
を生成します。config
- 初期情報Exception
protected void addFilter(IFilterable obj, jp.co.sds_corp.util.config.IConfiguration config) throws Exception
obj
- 設定するソースconfig
- 初期情報Exception
protected Map<String,IOutput> createOutputMap(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
IOutput
を生成します。config
- 初期情報Exception
protected IOutput createOutput(jp.co.sds_corp.util.config.IConfiguration config) throws Exception
IOutput
を生成します。Exception
public void start()
start
インタフェース内 jp.co.sds_corp.util.daemon.core.IDaemon
public void terminate()
terminate
インタフェース内 jp.co.sds_corp.util.daemon.core.ITerminatable
public void joinAll()
joinAll
インタフェース内 jp.co.sds_corp.util.daemon.core.ITerminatable
public String toString()
toString
クラス内 jp.co.sds_corp.util.daemon.core.AbstractDaemon
protected void recvSourceEvent(ReceiveEvent e) throws Exception
e
- データ受信イベントException
protected void recvSourceStatus(StatusChangeEvent e) throws Exception
e
- 状態変更イベントException
protected void recvMixerEvent(ReceiveEvent e) throws Exception
e
- データ受信イベントException
protected void recvMixerStatus(StatusChangeEvent e) throws Exception
e
- 状態変更イベントException
public Collection<IData> getCurrent(IDataKey key)
public void addReceiveListener(IReceiveListener l)
addReceiveListener
インタフェース内 IReceiver
l
- データ受信を受け取るオブジェクトpublic void removeReceiveListener(IReceiveListener l)
removeReceiveListener
インタフェース内 IReceiver
l
- データ受信を受け取るオブジェクトpublic void addReceiveListener(IDataKey key, IReceiveListener l)
key
- 対象のキーl
- データ受信を受け取るオブジェクトpublic void removeReceiveListener(IDataKey key, IReceiveListener l)
key
- 対象のキーl
- データ受信を受け取るオブジェクトpublic void fireReceive(ReceiveEvent e) throws Exception
fireReceive
インタフェース内 IReceiver
e
- データ受信イベントException
public void fireStatusChange(StatusChangeEvent e) throws Exception
fireStatusChange
インタフェース内 IReceiver
e
- 状態変更イベントException
Copyright © 2021 S.D.S Co.,Ltd.. All rights reserved.