GithubHelp home page GithubHelp logo

nlpchina / jcoder Goto Github PK

View Code? Open in Web Editor NEW
148.0 33.0 69.0 12.78 MB

Java Dynamic code or JAR , publish you Api or Schedule in flying

Java 27.57% JavaScript 59.84% PLpgSQL 0.22% CSS 5.84% HTML 6.52% Shell 0.01%
scheduled-tasks java jar

jcoder's Introduction

Welcome to the Jcoder


In this project you can fast publish your API and schedule task, dynamic edit you java class and add or remove jar !

  • Getting Started
  • about config on startup

    you can make a config file named coder.conf

    #only localhost can visit Management background
    host=localhost 
    # default port is 8080
    port=8080
    # home path .default is ~/.jcoder
    #home=~/.jcoder 
    # mvn exepath , it is a full path like /home/maven/bin/mvn
    maven=mvn
    # log path 
    log=log/jcoder.log
    

    now you can use it by : java -jar jcoder-[version].war -f=coder.conf

    Of course you can take these by args :java -jar jcoder-[version].war --home=~/.jcoder --port=9090 --host=localhost

  • Publish a API

    Click Test->Create-Task

    https://raw.githubusercontent.com/wiki/NLPchina/Jcoder/1.png

    Code :

    package org.nlpcn.jcoder.run.java;
    
    import org.apache.log4j.Logger;
    import org.nlpcn.jcoder.run.annotation.DefaultExecute;
    import org.nutz.ioc.loader.annotation.Inject;
    
    public class TestRun {
    
    	@Inject
    	private Logger log;
    
    	@DefaultExecute
    	public String defaultTest(String name) throws InterruptedException {
    		return "Hello Jcoder " + name;
    	}
    
    }
    

    select TaskType : Active and write some word to description now Click Save button

    now you can use you api by : http://localhost:8080/api/TestRun?name=ansj

  • Publish a schedule task

    Click Test->Create-Task

    https://raw.githubusercontent.com/wiki/NLPchina/Jcoder/2.png

    Code:

    package org.nlpcn.jcoder.run.java;
    
    
    
    import java.util.Date;
    
    import org.apache.log4j.Logger;
    import org.nlpcn.jcoder.run.annotation.DefaultExecute;
    import org.nlpcn.jcoder.util.DateUtils;
    import org.nutz.ioc.loader.annotation.Inject;
    
    public class CronTest {
    	
    	@Inject
    	private Logger log ;
    
    	@DefaultExecute
    	public void execute() throws InterruptedException {
        Thread.sleep(10000L);
    		log.info(DateUtils.formatDate(new Date(), DateUtils.SDF_FORMAT));
    	}
    
    }
    

    select TaskType : Active and write some word to description Write Corn 0/5 * * * * ? now Click Save button

    now your job every 5`s run once!

    https://raw.githubusercontent.com/wiki/NLPchina/Jcoder/3.png

  • how to use example by action
     package org.nlpcn.jcoder.run.java;
     
     import org.nlpcn.jcoder.run.annotation.Cache;
     
     /**
      * this is a api example
      * 
      * @author ansj
      *
      */
     @Single(false) // default is true
     public class ApiExampleAction {
     	
     	@Inject
     	private Logger log ;
     	
     	@Inject
     	private Dao dao ;
     
     	@Execute // publish this function to api !
     				// use url is
     				// http://host:port/[className]/methodName?field=value
     				// http//localhost:8080/ApiExampleAction/method?name=heloo&hello_word=hi
     	public Object function(HttpServletRequest req, HttpServerResponse rep, String name, @Param("hello_word") Integer helloWord) {
     		dosomething..
     	}
     
     	@DefaultExecute // publish this function to api !
     	//http://localhost:8080/ApiExampleAction?user.name=aaa&user.passowrd=bbb
     	//http://localhost:8080/ApiExampleAction/function2?user.name=aaa&user.passowrd=bbb
     	//more about http://www.nutzam.com/core/mvc/http_adaptor.html
     	@Execute(methods={"get","post"},restful=true, rpc=true) //methods default all , restufl,rpc default true 
     	@Cache(time=10,size=1000,block=false) // time SECONDS , block if false use asynchronous
     	public Object function2(@Param("..") User user) {
     
     		dosomething..
     	}
     
     }
     
    
  • road map
    • auto backup database export and import
    • system properties view and manager
    • publish socket api by netty
    • add a util for testing task
    • incremental update task from jcoder server
    • publish a restful api by db table
    • Perfect the documents
    • add Dasboard page view task use time ,times ,err or other system info

jcoder's People

Contributors

ansjsun avatar shi-yuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jcoder's Issues

沙发

一直关注大神的动态 沙发 o(*≧▽≦)ツ

Build and change language from Chinese to English

Screenshots of the interface are in English, however, when I build locally the application starts with the Chinese language set. How do I change it? Are the language sets part of master?

Appreciate your feedback.

项目功能的疑惑

开始看放在nlp目录下,以为是nlp相关配置,例如自定义分词之类的功能,自己部署运行了才知道这个功能和语义没有任何关系,只是一个动态jar加载,类似ogsi的那种

寻找源码的全类名问题

该项目中的代码需要格式化之后才能运行?

public static String findClassName(String sourceCode) {

	try (BufferedReader br = new BufferedReader(new StringReader(sourceCode))) {
		String temp = null;

		while ((temp = br.readLine()) != null) {
			if (StringUtil.isBlank(temp)) {
				continue;
			}
			Matcher matcher = PAT.matcher(temp);

			if (matcher.find()) {
				temp = temp.split("[\\s+?;{]")[2];
				return temp;
			}
		}
	} catch (IOException e) {
		e.printStackTrace();
	}

	return null;
}

针对都是一行的代码是无法找出正确的类名的。
如 :
String code = "package com.test; public class Test {public static void main(String[] args) {String hello = "Hello World!!!";System.out.println(hello);}}";
使用反捕获的方式可能是个不错的选择。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.