Search in sources :

Example 1 with ChainWalkerAdapter

use of org.walkmod.ChainWalkerAdapter in project walkmod-core by walkmod.

the class DefaultChainInvocation method invoke.

@Override
public void invoke() throws WalkModException {
    ChainWalkerAdapter wa = chainAdapter.getWalkerAdapter();
    ChainWalkerInvocation wi = new DefaultChainWalkerInvocation();
    wi.init(wa);
    wi.invoke();
}
Also used : ChainWalkerInvocation(org.walkmod.ChainWalkerInvocation) ChainWalkerAdapter(org.walkmod.ChainWalkerAdapter)

Example 2 with ChainWalkerAdapter

use of org.walkmod.ChainWalkerAdapter in project walkmod-core by walkmod.

the class DefaultChainAdapter method prepare.

@Override
public void prepare() throws WalkModException {
    setName(ac.getName());
    ReaderConfig readerConfig = ac.getReaderConfig();
    WriterConfig writerConfig = ac.getWriterConfig();
    String modelName = readerConfig.getPath();
    String modelType = readerConfig.getType();
    ChainReader reader = readerConfig.getModelReader();
    if (reader == null) {
        try {
            reader = (ChainReader) ac.getConfiguration().getBean(modelType, readerConfig.getParameters());
        } catch (Exception e2) {
            throw new WalkModException("The model " + modelName + ", whose type is " + modelType + "in the architecture " + getName() + " cannot be loaded ", e2);
        }
    }
    readerConfig.setModelReader(reader);
    reader.setPath(readerConfig.getPath());
    reader.setExcludes(readerConfig.getExcludes());
    reader.setIncludes(readerConfig.getIncludes());
    try {
        setResource(reader.read());
        LOG.debug("Model " + modelName + " loaded");
    } catch (Exception e2) {
        throw new WalkModException("The model " + modelName + ", whose type is " + modelType + "in the architecture " + getName() + " cannot be read ", e2);
    }
    WalkerConfig wc = ac.getWalkerConfig();
    ChainWalkerAdapter wa = new DefaultChainWalkerAdapter();
    setWalkerAdapter(wa);
    ChainWalker walker = wc.getWalker();
    if (walker == null) {
        walker = (ChainWalker) ac.getConfiguration().getBean(wc.getType(), wc.getParams());
    }
    wc.setWalker(walker);
    wa.setWalker(walker);
    wa.setWalkerConfig(wc);
    wa.setArchitectureProxy(this);
    wa.setWalkerInvocation(new DefaultChainWalkerInvocation());
    ChainWriter writer = writerConfig.getModelWriter();
    if (writer == null) {
        try {
            writer = (ChainWriter) ac.getConfiguration().getBean(writerConfig.getType(), writerConfig.getParams());
        } catch (Exception e2) {
            throw new WalkModException("The writer " + ", whose type is " + writerConfig.getType() + "in the architecture " + getName() + " cannot be read ", e2);
        }
    }
    writerConfig.setModelWriter(writer);
    writer.setPath(writerConfig.getPath());
    setChainWriter(writer);
    wa.prepare();
    ai.init(this);
}
Also used : ChainWalker(org.walkmod.ChainWalker) ChainWriter(org.walkmod.ChainWriter) WalkModException(org.walkmod.exceptions.WalkModException) ChainReader(org.walkmod.ChainReader) WalkerConfig(org.walkmod.conf.entities.WalkerConfig) ReaderConfig(org.walkmod.conf.entities.ReaderConfig) ChainWalkerAdapter(org.walkmod.ChainWalkerAdapter) WalkModException(org.walkmod.exceptions.WalkModException) WriterConfig(org.walkmod.conf.entities.WriterConfig)

Aggregations

ChainWalkerAdapter (org.walkmod.ChainWalkerAdapter)2 ChainReader (org.walkmod.ChainReader)1 ChainWalker (org.walkmod.ChainWalker)1 ChainWalkerInvocation (org.walkmod.ChainWalkerInvocation)1 ChainWriter (org.walkmod.ChainWriter)1 ReaderConfig (org.walkmod.conf.entities.ReaderConfig)1 WalkerConfig (org.walkmod.conf.entities.WalkerConfig)1 WriterConfig (org.walkmod.conf.entities.WriterConfig)1 WalkModException (org.walkmod.exceptions.WalkModException)1