All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alogic.vfs.service.VFSSourceReport Maven / Gradle / Ivy

package com.alogic.vfs.service;

import java.util.HashMap;
import java.util.Map;

import com.logicbus.backend.message.YamlMessage;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import com.alogic.vfs.context.FileSystemSource;
import com.logicbus.backend.AbstractServant;
import com.logicbus.backend.Context;
import com.logicbus.backend.message.JsonMessage;
import com.logicbus.backend.message.XMLMessage;
import com.logicbus.models.servant.ServiceDescription;

/**
 * 来源报告
 * 
 * @author duanyy
 * @version 1.6.12.27 [20190403 duanyy] 
* - 增加对yaml的支持
*/ public class VFSSourceReport extends AbstractServant { @Override protected void onDestroy() { // nothing to do } @Override protected void onCreate(ServiceDescription sd) { // nothing to do } @Override protected int onXml(Context ctx){ XMLMessage msg = (XMLMessage) ctx.asMessage(XMLMessage.class); Document doc = msg.getDocument(); Element root = msg.getRoot(); Element eleSource = doc.createElement("source"); FileSystemSource src = FileSystemSource.get(); src.report(eleSource); root.appendChild(eleSource); return 0; } @Override protected int onJson(Context ctx){ JsonMessage msg = (JsonMessage)ctx.asMessage(JsonMessage.class); Map map = new HashMap(); // NOSONAR FileSystemSource src = FileSystemSource.get(); src.report(map); msg.getRoot().put("source", map); return 0; } @Override protected int onYaml(Context ctx){ YamlMessage msg = (YamlMessage)ctx.asMessage(YamlMessage.class); Map map = new HashMap(); // NOSONAR FileSystemSource src = FileSystemSource.get(); src.report(map); msg.getRoot().put("source", map); return 0; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy