• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Engine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.floreysoft.jmte.Engine的典型用法代码示例。如果您正苦于以下问题:Java Engine类的具体用法?Java Engine怎么用?Java Engine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Engine类属于com.floreysoft.jmte包,在下文中一共展示了Engine类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ConfigServer

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Inject
public ConfigServer(HBaseFrameworkConfig hbaseFrameworkConfig,
    IPersistentStateStore persistenceStore) {
  this.hbaseFrameworkConfig = hbaseFrameworkConfig;
  this.persistenceStore = persistenceStore;
  engine = new Engine();
  server = new Server(hbaseFrameworkConfig.getConfigServerPort());
  ResourceHandler resourceHandler = new ResourceHandler();
  resourceHandler.setResourceBase(hbaseFrameworkConfig.getExecutorPath());
  HandlerList handlers = new HandlerList();
  handlers.setHandlers(new Handler[]{
      resourceHandler, new ServeHbaseConfigHandler()});
  server.setHandler(handlers);

  try {
    server.start();

  } catch (Exception e) {
    final String msg = "Unable to start jetty server";
    log.error(msg, e);
    throw new ConfigServerException(msg, e);
  }
}
 
开发者ID:jan-zajic,项目名称:mesos-hbase,代码行数:24,代码来源:ConfigServer.java


示例2: format

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Override
public String format(Locale locale) {
	final ResourceBundle messages = ResourceBundle.getBundle(baseName, locale);
	final String frameTemplate = getTemplate(messages, frameCode, "${prefix} ${location}: ${message}");
	final String prefixTemplate = getTemplate(messages, prefixCode, "");
	final String locationTemplate = getTemplate(messages, locationCode, "");
	final String messageTemplate = getTemplate(messages, messageCode, "");
	
	Engine engine = new Engine();
	engine.setErrorHandler(new InternalErrorHandler());
	argumentModel.put("prefix", engine.transform(prefixTemplate, argumentModel));
	argumentModel.put("location", engine.transform(locationTemplate, argumentModel));
	argumentModel.put("message", engine.transform(messageTemplate, argumentModel));
	
	String transformed = engine.transform(frameTemplate, argumentModel);
	return transformed;

}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:19,代码来源:ResourceBundleMessage.java


示例3: getStaticErrors

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Override
public List<ErrorEntry> getStaticErrors() {
    final Engine engine = new Engine();
    final JournalingErrorHandler errorHandler = new JournalingErrorHandler();
    engine.setErrorHandler(errorHandler);
    final ScopedMap scopedMap = new ScopedMap(Collections.EMPTY_MAP);
    final Locale locale = Locale.getDefault();
    this.context = new TemplateContext(this.template, locale, this.sourceName, scopedMap,
            new DefaultModelAdaptor(), engine, errorHandler, null);
    transformPure(this.context);

    final List<ErrorEntry> staticErrors = new ArrayList<>();
    for (ErrorEntry entry: errorHandler.entries) {
        if (entry.errorMessage.isStatic) {
            staticErrors.add(entry);
        }
    }
    return staticErrors;
}
 
开发者ID:DJCordhose,项目名称:jmte,代码行数:20,代码来源:InterpretedTemplate.java


示例4: send

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Override
public void send(Message message) throws InterruptedException {
    Iterator messageFields = message.getFields().entrySet().iterator();
    Map<String, Object> model = new HashMap<>();
    while (messageFields.hasNext()) {
        Map.Entry pair = (Map.Entry) messageFields.next();
        model.put(String.valueOf(pair.getKey()), String.valueOf(pair.getValue()));
    }
    Engine engine = new Engine();
    String queryString = engine.transform(configuration.getString(Neo4jOutput.CK_NEO4J_QUERY), model);
    List<HashMap<String, String>> query = parseQuery(queryString);

    postQuery(query);
}
 
开发者ID:mariussturm,项目名称:graylog-plugin-output-neo4j,代码行数:15,代码来源:Neo4JHttpTransport.java


示例5: formatPlain

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Override
public String formatPlain(Locale locale) {
	final ResourceBundle messages = ResourceBundle.getBundle(baseName, locale);
	final String messageTemplate = getTemplate(messages, messageCode, "");
	
	Engine engine = new Engine();
	engine.setErrorHandler(new InternalErrorHandler());
	String transformed = engine.transform(messageTemplate, argumentModel);
	return transformed;
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:11,代码来源:ResourceBundleMessage.java


示例6: InterpretedTemplate

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
public InterpretedTemplate(String template, String sourceName, Engine engine) {
	this.template = template;
	this.engine = engine;
	this.sourceName = sourceName;
	tokenStream = new TokenStream(sourceName, template, engine
			.getExprStartToken(), engine.getExprEndToken());
	tokenStream.prefill();
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:9,代码来源:InterpretedTemplate.java


示例7: transform

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static String transform(File template, File propertiesFile,
		String charsetName) throws UnsupportedEncodingException,
		FileNotFoundException, IOException {
	if (!template.exists()) {
		throw new IllegalArgumentException(String.format(
				"Tempalte file '%s' does not exist", template
						.getCanonicalPath()));
	}
	if (!propertiesFile.exists()) {
		throw new IllegalArgumentException(String.format(
				"Properties file '%s' does not exist", propertiesFile
						.getCanonicalPath()));
	}
	FileInputStream stream = null;
	try {
		String input = Util.fileToString(template, charsetName);
		Engine engine = new Engine();

		Properties properties = new Properties();
		stream = new FileInputStream(propertiesFile);
		properties.load(stream);

		Map model = properties;
		String transformed = engine.transform(input, model);
		return transformed;
	} finally {
		try {
			stream.close();
		} catch (IOException e) {
		}
	}
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:34,代码来源:Tool.java


示例8: getUsedVariableDescriptions

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Override
public List<VariableDescription> getUsedVariableDescriptions() {
	final List<VariableDescription> variableDescriptions = new ArrayList<>();
	final Engine engine = new Engine();
	engine.setErrorHandler(new JournalingErrorHandler());
	final ScopedMap scopedMap = new ScopedMap(Collections.EMPTY_MAP);

	final ProcessListener processListener = new ProcessListener() {

		@Override
		public void log(TemplateContext context, Token token, Action action) {
			if (token instanceof ExpressionToken) {
				final String name = ((ExpressionToken) token).getExpression();
				String renderer = null;
				String pattern = null;
				VariableDescription.Context variableContext = null;
				if (token instanceof StringToken) {
					renderer = ((StringToken) token).getRendererName();
					pattern = ((StringToken) token).getParameters();
					variableContext = VariableDescription.Context.TEXT;
				} else if (token instanceof IfToken) {
					variableContext = VariableDescription.Context.IF;
				} else if (token instanceof ForEachToken) {
					variableContext = VariableDescription.Context.FOR_EACH;
				}
				if (!InterpretedTemplate.isLocal(context, name)) {
					variableDescriptions.add(new VariableDescription(name, renderer, pattern, variableContext));
				}
			}
		}

	};
	final Locale locale = Locale.getDefault();
	this.context = new TemplateContext(this.template, locale, this.sourceName, scopedMap,
			new DefaultModelAdaptor(), engine, engine.getErrorHandler(), processListener);
	transformPure(this.context);

	return variableDescriptions;
}
 
开发者ID:DJCordhose,项目名称:jmte,代码行数:40,代码来源:InterpretedTemplate.java


示例9: init

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.audit4j.core.Initializable#init()
 */
@Override
public void init() throws InitializationException {
    engine = Engine.createCachingEngine();
    JMTEDateRendrer dateRendrer = new JMTEDateRendrer();
    dateRendrer.setDateFormat(dateFormat);
    engine.registerRenderer(Date.class, dateRendrer);
}
 
开发者ID:audit4j,项目名称:audit4j-core,代码行数:13,代码来源:CustomizableLayout.java


示例10: MediaEntityExporter

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
protected MediaEntityExporter(Path templatePath, TemplateType type) throws Exception {
  templateDir = templatePath;

  // check if template exists and is valid
  if (!Files.isDirectory(templateDir)) {
    throw new Exception("illegal template path");
  }

  Path configFile = templateDir.resolve("template.conf");
  if (!Files.exists(configFile)) {
    throw new Exception("illegal template config");
  }

  // load settings from template
  properties = new Properties();
  BufferedInputStream stream = new BufferedInputStream(new FileInputStream(configFile.toFile()));
  properties.load(stream);
  stream.close();

  // check needed settings
  String typeInConfig = properties.getProperty("type");
  if (!typeInConfig.equalsIgnoreCase(type.name())) {
    throw new Exception("illegal template");
  }

  String listTemplateFile = properties.getProperty("list");
  if (StringUtils.isBlank(listTemplateFile)) {
    throw new Exception("illegal template");
  }

  // get other settings
  String detailTemplateFile = properties.getProperty("detail");
  fileExtension = properties.getProperty("extension");
  if (StringUtils.isBlank(fileExtension)) {
    fileExtension = "html";
  }

  // set up engine
  engine = Engine.createCachingEngine();

  if (fileExtension.equalsIgnoreCase("html")) {
    engine.setEncoder(new HtmlEncoder()); // special char replacement
  }
  if (fileExtension.equalsIgnoreCase("xml")) {
    engine.setEncoder(new XMLEncoder()); // special char replacement
  }

  // load list template from File
  listTemplate = Utils.readFileToString(templateDir.resolve(listTemplateFile));
  if (StringUtils.isNotBlank(detailTemplateFile)) {
    detailTemplate = Utils.readFileToString(templateDir.resolve(detailTemplateFile));
  }
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:54,代码来源:MediaEntityExporter.java


示例11: AbstractCompiledTemplate

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
public AbstractCompiledTemplate(Engine engine) {
	this.engine = engine;
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:4,代码来源:AbstractCompiledTemplate.java


示例12: setEngine

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
public void setEngine(Engine engine) {
	this.engine = engine;
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:4,代码来源:AbstractCompiledTemplate.java


示例13: getEngine

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
public Engine getEngine() {
	return engine;
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:4,代码来源:AbstractCompiledTemplate.java


示例14: SlackAlarmCallback

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Inject
public SlackAlarmCallback(Engine templateEngine) {
    this.templateEngine = templateEngine;
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:5,代码来源:SlackAlarmCallback.java


示例15: setUp

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
@Before
public void setUp() {
    alarmCallback = new SlackAlarmCallback(Engine.createDefaultEngine());
}
 
开发者ID:graylog-labs,项目名称:graylog-plugin-slack,代码行数:5,代码来源:SlackAlarmCallbackTest.java


示例16: compile

import com.floreysoft.jmte.Engine; //导入依赖的package包/类
public Template compile(String template, String sourceName, Engine engine); 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:2,代码来源:TemplateCompiler.java



注:本文中的com.floreysoft.jmte.Engine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ISOMLayout类代码示例发布时间:2022-05-21
下一篇:
Java Type类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap