use of org.walkmod.ChainWalker in project walkmod-core by walkmod.
the class DefaultChainWalkerInvocation method invoke.
@Override
public void invoke() throws WalkModException {
ChainWalker walker = walkerAdapter.getWalker();
if (walker != null) {
try {
walker.execute();
} catch (Exception e) {
throw new WalkModException("An exeception has been produced during the " + walkerAdapter.getName() + " transformation", e);
}
}
LOG.debug("The transformation [" + walkerAdapter.getName() + "] has been executed");
}
use of org.walkmod.ChainWalker 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);
}
Aggregations