Skip to content

Commit

Permalink
Merge branch 'master' of https://git.oschina.net/youseries/urule
Browse files Browse the repository at this point in the history
  • Loading branch information
jacky6024 committed Dec 4, 2017
2 parents 85c5abb + 210765c commit 9adda2d
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 107 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea/
*.iml
urule-console/target/
urule-core/target/
urule-springboot/target/
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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<String,Object> map=new Hashtable<String,Object>();
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<String, KnowledgePackage> map = new ConcurrentHashMap<String, KnowledgePackage>();

@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);
}
}
165 changes: 85 additions & 80 deletions urule-springboot/pom.xml
Original file line number Diff line number Diff line change
@@ -1,84 +1,89 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bstek.urule</groupId>
<artifactId>urule-springboot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.7</java.version>
<tomcat.version>8.5.5</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Gaojie</name>
<email>[email protected]</email>
<organization>Bstek</organization>
<organizationUrl>http://www.bstek.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>https://github.com/youseries/urule.git</connection>
<developerConnection>https://github.com/youseries/urule.git</developerConnection>
<url>https://github.com/youseries/urule</url>
</scm>
<organization>
<name>Bstek</name>
<url>http://www.bstek.com</url>
</organization>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.bstek.urule</groupId>
<artifactId>urule-console</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bstek.urule</groupId>
<artifactId>urule-springboot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.7</java.version>
<tomcat.version>8.5.5</tomcat.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>Gaojie</name>
<email>[email protected]</email>
<organization>Bstek</organization>
<organizationUrl>http://www.bstek.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>https://github.com/youseries/urule.git</connection>
<developerConnection>https://github.com/youseries/urule.git</developerConnection>
<url>https://github.com/youseries/urule</url>
</scm>
<organization>
<name>Bstek</name>
<url>http://www.bstek.com</url>
</organization>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.bstek.urule</groupId>
<artifactId>urule-console</artifactId>
<version>2.1.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>

<name>Urule Springboot Project</name>
<url>https://github.com/youseries/urule/tree/master/urule-springboot</url>
<issueManagement>
<url>https://github.com/youseries/urule/issues</url>
</issueManagement>
<description>Urule Springboot Project</description>
<name>Urule Springboot Project</name>
<url>https://github.com/youseries/urule/tree/master/urule-springboot</url>
<issueManagement>
<url>https://github.com/youseries/urule/issues</url>
</issueManagement>
<description>Urule Springboot Project</description>
</project>
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 9adda2d

Please sign in to comment.