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

com.scudata.expression.mfn.channel.Fetch Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.expression.mfn.channel;

import com.scudata.common.MessageManager;
import com.scudata.common.RQException;
import com.scudata.dm.Context;
import com.scudata.dm.FileObject;
import com.scudata.expression.ChannelFunction;
import com.scudata.resources.EngineMessage;

/**
 * Ϊ?ܵ????屣???ܵ???ǰ??????Ϊ???????????
 * ch.fetch()
 * @author RunQian
 *
 */
public class Fetch extends ChannelFunction {
	public Object calculate(Context ctx) {
		if (param == null) {
			return channel.fetch();
		} else if (param.isLeaf()) {
			FileObject fo;
			Object obj = param.getLeafExpression().calculate(ctx);
			if (obj instanceof String) {
				fo = new FileObject((String)obj);
			} else if (obj instanceof FileObject) {
				fo = (FileObject)obj;
			} else {
				MessageManager mm = EngineMessage.get();
				throw new RQException("fetch" + mm.getMessage("function.paramTypeError"));
			}
			
			return channel.fetch(fo);
		} else {
			MessageManager mm = EngineMessage.get();
			throw new RQException("fetch" + mm.getMessage("function.invalidParam"));
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy