diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..5976042b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +*.iml +urule-console/target/ +urule-core/target/ +urule-springboot/target/ diff --git a/urule-core/src/main/java/com/bstek/urule/runtime/cache/MemoryKnowledgeCache.java b/urule-core/src/main/java/com/bstek/urule/runtime/cache/MemoryKnowledgeCache.java index 15f750e9..f032c758 100644 --- a/urule-core/src/main/java/com/bstek/urule/runtime/cache/MemoryKnowledgeCache.java +++ b/urule-core/src/main/java/com/bstek/urule/runtime/cache/MemoryKnowledgeCache.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright 2017 Bstek - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -15,32 +15,37 @@ ******************************************************************************/ package com.bstek.urule.runtime.cache; -import java.util.Hashtable; -import java.util.Map; - import com.bstek.urule.runtime.KnowledgePackage; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + /** * @author Jacky.gao * @since 2015年1月28日 */ -public class MemoryKnowledgeCache implements KnowledgeCache{ - private Map map=new Hashtable(); - public KnowledgePackage getKnowledge(String packageId) { - if(packageId.startsWith("/")){ - packageId=packageId.substring(1,packageId.length()); - } - return (KnowledgePackage)map.get(packageId); - } +public class MemoryKnowledgeCache implements KnowledgeCache { + + private Map map = new ConcurrentHashMap(); + + @Override + public KnowledgePackage getKnowledge(String packageId) { + if (packageId.startsWith("/")) { + packageId = packageId.substring(1, packageId.length()); + } + return map.get(packageId); + } - public void putKnowledge(String packageId,KnowledgePackage knowledgePackage) { - if(packageId.startsWith("/")){ - packageId=packageId.substring(1,packageId.length()); - } - map.put(packageId, knowledgePackage); - } + @Override + public void putKnowledge(String packageId, KnowledgePackage knowledgePackage) { + if (packageId.startsWith("/")) { + packageId = packageId.substring(1, packageId.length()); + } + map.put(packageId, knowledgePackage); + } - public void removeKnowledge(String packageId) { - map.remove(packageId); - } + @Override + public void removeKnowledge(String packageId) { + map.remove(packageId); + } } diff --git a/urule-springboot/pom.xml b/urule-springboot/pom.xml index ab4ecdca..d93edf3e 100644 --- a/urule-springboot/pom.xml +++ b/urule-springboot/pom.xml @@ -1,84 +1,89 @@ - 4.0.0 - com.bstek.urule - urule-springboot - 0.0.1-SNAPSHOT - - 1.7 - 8.5.5 - UTF-8 - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - Gaojie - jacky.gao@bstek.com - Bstek - http://www.bstek.com - - - - https://github.com/youseries/urule.git - https://github.com/youseries/urule.git - https://github.com/youseries/urule - - - Bstek - http://www.bstek.com - - - org.springframework.boot - spring-boot-starter-parent - 1.5.8.RELEASE - - - - org.springframework.boot - spring-boot-starter-web - - - com.bstek.urule - urule-console - 2.1.1-SNAPSHOT - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + com.bstek.urule + urule-springboot + 0.0.1-SNAPSHOT + + 1.7 + 8.5.5 + UTF-8 + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + Gaojie + jacky.gao@bstek.com + Bstek + http://www.bstek.com + + + + https://github.com/youseries/urule.git + https://github.com/youseries/urule.git + https://github.com/youseries/urule + + + Bstek + http://www.bstek.com + + + org.springframework.boot + spring-boot-starter-parent + 1.5.8.RELEASE + + + + org.springframework.boot + spring-boot-starter-web + + + com.bstek.urule + urule-console + 2.1.1-SNAPSHOT + + + org.slf4j + slf4j-jdk14 + + + + + javax.servlet + servlet-api + 2.5 + provided + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + - - javax.servlet - servlet-api - 2.5 - provided - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2 + + - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - - Urule Springboot Project - https://github.com/youseries/urule/tree/master/urule-springboot - - https://github.com/youseries/urule/issues - - Urule Springboot Project + Urule Springboot Project + https://github.com/youseries/urule/tree/master/urule-springboot + + https://github.com/youseries/urule/issues + + Urule Springboot Project \ No newline at end of file diff --git a/urule-springboot/src/main/java/com/bstek/urule/springboot/Application.java b/urule-springboot/src/main/java/com/bstek/urule/springboot/Application.java index 5c771a95..3ab04ab0 100644 --- a/urule-springboot/src/main/java/com/bstek/urule/springboot/Application.java +++ b/urule-springboot/src/main/java/com/bstek/urule/springboot/Application.java @@ -1,16 +1,14 @@ package com.bstek.urule.springboot; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ImportResource; /** * @author Jacky.gao * @since 2016年10月12日 */ -@ComponentScan -@EnableAutoConfiguration +@SpringBootApplication @ImportResource({"classpath:urule-console-context.xml"}) public class Application { public static void main(String[] args) {