diff --git a/.gitignore b/.gitignore index 02cfcc9..824ab1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .* gradlew* build -gradle !.gitignore \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4355845..b1eda40 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,12 @@ buildscript { ext { - kotlin_version = '1.3.72' + kotlin_version = '1.7.0' + spring_version = "2.7.0" } repositories { mavenLocal() - maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } mavenCentral() } @@ -15,40 +16,38 @@ buildscript { } allprojects { + ext { + version '2.0' + } + group 'com.synebula' version version } subprojects { - ext { - version '0.13.1' - spring_version = "2.3.0.RELEASE" - } - buildscript { repositories { mavenLocal() - maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } mavenCentral() } } repositories { mavenLocal() - maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } + maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } mavenCentral() } apply plugin: 'idea' apply plugin: 'java' apply plugin: 'kotlin' - apply plugin: 'maven' apply plugin: 'maven-publish' dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" - testCompile group: 'junit', name: 'junit', version: '4.12' + api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + testApi group: 'junit', name: 'junit', version: '4.12' } sourceCompatibility = 1.8 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..87b738c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d494b61 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon May 18 17:21:26 CST 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index 42a6a35..55f9af1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'myths.gaea' +rootProject.name = 'gaea' include 'src:gaea' include 'src:gaea.app' include 'src:gaea.mongo' diff --git a/src/gaea.app/build.gradle b/src/gaea.app/build.gradle index 9333a61..e4d0ae6 100644 --- a/src/gaea.app/build.gradle +++ b/src/gaea.app/build.gradle @@ -7,16 +7,16 @@ buildscript { apply plugin: 'kotlin-spring' dependencies { - compile project(":src:gaea") - compile("org.springframework.boot:spring-boot-starter-web:$spring_version") - compile("org.springframework.boot:spring-boot-starter-aop:$spring_version") - compile("org.springframework.boot:spring-boot-starter-mail:$spring_version") - compile("org.springframework.boot:spring-boot-starter-security:$spring_version") - compile group: 'net.sf.dozer', name: 'dozer', version: '5.5.1' - compile group: 'org.apache.poi', name: 'poi-ooxml', version: '5.0.0' - compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6' - compile group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' - compile group: 'com.auth0', name: 'java-jwt', version: '3.14.0' + api project(":src:gaea") + api("org.springframework.boot:spring-boot-starter-web:$spring_version") + api("org.springframework.boot:spring-boot-starter-aop:$spring_version") + api("org.springframework.boot:spring-boot-starter-mail:$spring_version") + api("org.springframework.boot:spring-boot-starter-security:$spring_version") + api group: 'net.sf.dozer', name: 'dozer', version: '5.5.1' + api group: 'org.apache.poi', name: 'poi-ooxml', version: '5.0.0' + api group: 'com.google.code.gson', name: 'gson', version: '2.8.6' + api group: 'com.google.guava', name: 'guava', version: '30.1.1-jre' + api group: 'com.auth0', name: 'java-jwt', version: '3.14.0' } publishing { diff --git a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/LazyCommandApp.kt b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/LazyCommandApp.kt index 46abef3..da637dd 100644 --- a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/LazyCommandApp.kt +++ b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/cmd/LazyCommandApp.kt @@ -2,9 +2,7 @@ package com.synebula.gaea.app.cmd import com.synebula.gaea.data.serialization.json.IJsonSerializer import com.synebula.gaea.domain.model.IAggregateRoot -import com.synebula.gaea.domain.service.ICommand import com.synebula.gaea.domain.service.ILazyService -import com.synebula.gaea.domain.service.IService import com.synebula.gaea.log.ILogger import javax.annotation.Resource diff --git a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/Logger.kt b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/Logger.kt index ec4150d..b86ac2e 100644 --- a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/Logger.kt +++ b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/Logger.kt @@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap /** * 使用 log4j進行日志记录。 * - * @author reize + * @author alex * @version 0.0.1 * @since 2016年9月18日 下午2:13:43 */ diff --git a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/aop/AppAspect.kt b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/aop/AppAspect.kt index ed07e8b..1c82838 100644 --- a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/aop/AppAspect.kt +++ b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/aop/AppAspect.kt @@ -72,11 +72,10 @@ abstract class AppAspect { } } var message = "$moduleName - $funcName 异常" - if (ex is NoticeUserException) { - message = "$message: ${ex.message}" + message = if (ex is NoticeUserException) { + "$message: ${ex.message}" } else { - message = "$message。" - + "$message。" } logger.error( ex, diff --git a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/EventBus.kt b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/bus/EventBus.kt similarity index 66% rename from src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/EventBus.kt rename to src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/bus/EventBus.kt index 8448054..7d26813 100644 --- a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/EventBus.kt +++ b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/bus/EventBus.kt @@ -1,14 +1,14 @@ -package com.synebula.gaea.app.component +package com.synebula.gaea.app.component.bus import com.google.common.eventbus.AsyncEventBus import com.google.common.eventbus.EventBus -import com.synebula.gaea.event.IEvent -import com.synebula.gaea.event.IEventBus +import com.synebula.gaea.bus.IMessage +import com.synebula.gaea.bus.IMessageBus import org.springframework.stereotype.Component import java.util.concurrent.Executors @Component -class EventBus : IEventBus { +class EventBus : IMessageBus { /** * 同步事件总线 @@ -30,12 +30,12 @@ class EventBus : IEventBus { asyncEventBus.unregister(obj) } - override fun publish(event: IEvent) { - eventBus.post(event) + override fun publish(message: IMessage) { + eventBus.post(message) } - override fun publishAsync(event: IEvent) { - asyncEventBus.post(event) + override fun publishAsync(message: IMessage) { + asyncEventBus.post(message) } } diff --git a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/EventBusSubscriberProcessor.kt b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/bus/EventBusSubscriberProcessor.kt similarity index 83% rename from src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/EventBusSubscriberProcessor.kt rename to src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/bus/EventBusSubscriberProcessor.kt index 98226c4..6360801 100644 --- a/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/EventBusSubscriberProcessor.kt +++ b/src/gaea.app/src/main/kotlin/com/synebula/gaea/app/component/bus/EventBusSubscriberProcessor.kt @@ -1,7 +1,7 @@ -package com.synebula.gaea.app.component +package com.synebula.gaea.app.component.bus import com.google.common.eventbus.Subscribe -import com.synebula.gaea.event.IEventBus +import com.synebula.gaea.bus.IMessageBus import org.springframework.beans.BeansException import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.config.BeanPostProcessor @@ -14,7 +14,7 @@ class EventBusSubscriberProcessor : BeanPostProcessor { // 事件总线bean由Spring IoC容器负责创建,这里只需要通过@Autowired注解注入该bean即可使用事件总线 @Autowired - var eventBus: IEventBus? = null + var messageBus: IMessageBus? = null @Throws(BeansException::class) override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any { @@ -28,13 +28,13 @@ class EventBusSubscriberProcessor : BeanPostProcessor { val methods: Array = bean.javaClass.methods for (method in methods) { // check the annotations on that method - val annotations: Array = method.getAnnotations() + val annotations: Array = method.annotations for (annotation in annotations) { - // if it contains the Subscribe annotation + // if it contains Subscribe annotation if (annotation.annotationClass == Subscribe::class) { // 如果这是一个Guava @Subscribe注解的事件监听器方法,说明所在bean实例 // 对应一个Guava事件监听器类,将该bean实例注册到Guava事件总线 - eventBus?.register(bean) + messageBus?.register(bean) return bean } } diff --git a/src/gaea.mongo/build.gradle b/src/gaea.mongo/build.gradle index 1ba6df0..f0a51c4 100644 --- a/src/gaea.mongo/build.gradle +++ b/src/gaea.mongo/build.gradle @@ -1,6 +1,6 @@ dependencies { - compile project(":src:gaea") - compile("org.springframework.boot:spring-boot-starter-data-mongodb:$spring_version") + api project(":src:gaea") + api("org.springframework.boot:spring-boot-starter-data-mongodb:$spring_version") } publishing { diff --git a/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt b/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt index 1c1349f..c75d204 100644 --- a/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt +++ b/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/MongoExt.kt @@ -55,7 +55,7 @@ fun Query.where( list.add(tryRangeWhere(param.key, value, onFieldType)) } else { //判断执行查询子元素还是本字段 - val field = if (where.children.isEmpty()) key else where.children + val field = where.children.ifEmpty { key } var criteria = Criteria.where(field) criteria = when (where.operator) { Operator.eq -> criteria.`is`(value) diff --git a/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/query/MongoQuery.kt b/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/query/MongoQuery.kt index c32a19e..01bd5f6 100644 --- a/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/query/MongoQuery.kt +++ b/src/gaea.mongo/src/main/kotlin/com/synebula/gaea/mongo/query/MongoQuery.kt @@ -92,7 +92,7 @@ open class MongoQuery(var template: MongoTemplate, var logger: ILogger? = null) if (!validViewCollection || this.template.collectionExists(name)) name else { - throw RuntimeException("找不到名为[$table]的集合") + throw RuntimeException("找不到名为[${clazz.name}]的集合") } } } diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/bus/IMessage.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/bus/IMessage.kt new file mode 100644 index 0000000..e560295 --- /dev/null +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/bus/IMessage.kt @@ -0,0 +1,3 @@ +package com.synebula.gaea.bus + +interface IMessage \ No newline at end of file diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/event/IEventBus.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/bus/IMessageBus.kt similarity index 62% rename from src/gaea/src/main/kotlin/com/synebula/gaea/event/IEventBus.kt rename to src/gaea/src/main/kotlin/com/synebula/gaea/bus/IMessageBus.kt index c0b6850..0f435e2 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/event/IEventBus.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/bus/IMessageBus.kt @@ -1,6 +1,6 @@ -package com.synebula.gaea.event +package com.synebula.gaea.bus -interface IEventBus { +interface IMessageBus { /** * 注册事件Listener @@ -16,13 +16,13 @@ interface IEventBus { /** * 同步发布事件 - * @param event 事件 + * @param message 事件 */ - fun publish(event: IEvent) + fun publish(message: IMessage) /** * 异步发布事件 - * @param event 事件 + * @param message 事件 */ - fun publishAsync(event: IEvent) + fun publishAsync(message: IMessage) } \ No newline at end of file diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/DateCode.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/DateCode.kt index 4afe5e4..a21d4c1 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/DateCode.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/DateCode.kt @@ -11,13 +11,13 @@ import java.util.* * 参数:年=y,月=M,日=d,时=H,分=m,秒=s,毫秒=S。位数最好使用默认最大长度。 */ class DateCode(pattern: String = "yyyyMMdd") : ICodeGenerator { - var formator = SimpleDateFormat() + var formatter = SimpleDateFormat() init { - formator.applyPattern(pattern) + formatter.applyPattern(pattern) } override fun generate(): Long { - return java.lang.Long.parseLong(formator.format(Date())) + return java.lang.Long.parseLong(formatter.format(Date())) } } diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/FixedRandomCode.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/FixedRandomCode.kt index 001657b..4adceac 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/FixedRandomCode.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/FixedRandomCode.kt @@ -1,6 +1,7 @@ package com.synebula.gaea.data.code import java.util.* +import kotlin.math.pow /** * 固定长度随机编号生成。 @@ -9,8 +10,8 @@ import java.util.* * @since 2016年10月24日 上午10:58:05 */ class FixedRandomCode( - //生成的随机编号长度。 - var length: Int + //生成的随机编号长度。 + var length: Int, ) : ICodeGenerator { /** @@ -32,12 +33,12 @@ class FixedRandomCode( var format = String.format("%s%d%dd", "%", 0, calcMaxLength) val count = this.length / calcMaxLength for (i in 0 until count) { - buffer.append(String.format(format, (random.nextDouble() * Math.pow(10.0, calcMaxLength.toDouble())).toInt())) + buffer.append(String.format(format, (random.nextDouble() * 10.0.pow(calcMaxLength.toDouble())).toInt())) } val last = this.length % calcMaxLength if (last != 0) { format = String.format("%s%d%dd", "%", 0, last) - buffer.append(String.format(format, (random.nextDouble() * Math.pow(10.0, last.toDouble())).toInt())) + buffer.append(String.format(format, (random.nextDouble() * 10.0.pow(last.toDouble())).toInt())) } return buffer.toString() } diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/SnowflakeCode.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/SnowflakeCode.kt index 3e1c6f1..faa5ea7 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/SnowflakeCode.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/data/code/SnowflakeCode.kt @@ -13,7 +13,7 @@ package com.synebula.gaea.data.code * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000

* 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0

* 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)

- * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序Snowflake类的twepoch属性)。

+ * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序Snowflake类的origin属性)。

* 41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69

* 10位的数据机器位,可以部署在1024个节点,包括5位datacenter和5位worker

* 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号

@@ -35,7 +35,7 @@ open class SnowflakeCode( /** * 开始时间截 (2018-01-01) */ - private val twepoch = 1514736000000L + private val origin = 1514736000000L /** * 机器id所占的位数 @@ -142,7 +142,7 @@ open class SnowflakeCode( lastTimestamp = current //移位并通过或运算拼到一起组成64位的ID - return (current - twepoch shl timestampLeftShift + return (current - origin shl timestampLeftShift or (datacenter shl datacenterShift) or (worker shl workerShift) or sequence) diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/data/date/DateTime.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/data/date/DateTime.kt index 053b4a9..ef6ee10 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/data/date/DateTime.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/data/date/DateTime.kt @@ -275,7 +275,6 @@ class DateTime() : Comparable { * @return true or false */ fun isBetween(start: DateTime, end: DateTime): Boolean { - //return this in start..end return start.dateNoTime.compareTo(this.dateNoTime) * this.dateNoTime.compareTo(end.dateNoTime) >= 0 } diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/AggregateRecord.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/AggregateRecord.kt deleted file mode 100644 index 77b1c3f..0000000 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/AggregateRecord.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.synebula.gaea.domain.model - -import java.util.* - -/** - * 记录聚合根 - * 聚合根外添加了创建和修改的人\时间信息 - */ -abstract class AggregateRecord : AggregateRoot() { - var creator: String? = null - var creatorName: String? = null - var created: Date = Date() - set(value) { - field = value - modified = value - } - - var modifier: String? = null - var modifierName: String? = null - var modified: Date = Date() -} \ No newline at end of file diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/ComplexAggregateRoot.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/ComplexAggregateRoot.kt deleted file mode 100644 index 48e25fc..0000000 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/ComplexAggregateRoot.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.synebula.gaea.domain.model.complex - -abstract class ComplexAggregateRoot : ComplexEntity(), IComplexAggregateRoot diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/ComplexEntity.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/ComplexEntity.kt deleted file mode 100644 index 4d734e9..0000000 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/ComplexEntity.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.synebula.gaea.domain.model.complex - - -abstract class ComplexEntity : IComplexEntity { -} diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/IComplexAggregateRoot.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/IComplexAggregateRoot.kt deleted file mode 100644 index 487dc15..0000000 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/IComplexAggregateRoot.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.synebula.gaea.domain.model.complex - -/** - * 继承本接口,说明对象为聚合根。 - * - * @param 主键的类型。 - * @author alex - */ -interface IComplexAggregateRoot : IComplexEntity diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/IComplexEntity.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/IComplexEntity.kt deleted file mode 100644 index 0bbca4d..0000000 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/model/complex/IComplexEntity.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.synebula.gaea.domain.model.complex - -import com.synebula.gaea.domain.model.IEntity - -interface IComplexEntity : IEntity { - var secondary: TSecond? -} diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/record/Record.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/record/Record.kt new file mode 100644 index 0000000..61ad642 --- /dev/null +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/record/Record.kt @@ -0,0 +1,21 @@ +package com.synebula.gaea.domain.record + +import java.util.* + + +/** + * 记录信息 + * 添加了创建和修改的人\时间信息 + */ +abstract class Record { + + //记录增加信息 + var creator: String? = null + var creatorName: String? = null + var createTime: Date = Date() + + //记录修改信息 + var modifier: String? = null + var modifierName: String? = null + var modifyTime: Date = Date() +} \ No newline at end of file diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Command.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Command.kt index 2c07161..6ac0eb1 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Command.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/Command.kt @@ -8,5 +8,6 @@ package com.synebula.gaea.domain.service * @since 2020-05-15 */ open class Command : ICommand { + override var payload = "" override var timestamp = 0L } diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/ICommand.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/ICommand.kt index 41e4512..fe3543b 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/ICommand.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/ICommand.kt @@ -8,6 +8,12 @@ package com.synebula.gaea.domain.service * @since 2020-05-15 */ interface ICommand { + + /** + * 命令载荷, 实际的业务数据 + */ + var payload: String + /** * 时间戳。 */ diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/LazyService.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/LazyService.kt index a0f6f4b..2e49652 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/LazyService.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/domain/service/LazyService.kt @@ -1,6 +1,5 @@ package com.synebula.gaea.domain.service -import com.synebula.gaea.data.IObjectConverter import com.synebula.gaea.data.message.DataMessage import com.synebula.gaea.data.message.Message import com.synebula.gaea.domain.model.IAggregateRoot diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/event/IEvent.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/event/IEvent.kt deleted file mode 100644 index 59132cb..0000000 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/event/IEvent.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.synebula.gaea.event - -interface IEvent { -} \ No newline at end of file diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassPath.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassPath.kt index 7aa60b5..90cbd6f 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassPath.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassPath.kt @@ -34,10 +34,11 @@ object ClassPath { // 判断路径最后一个字符是不是"/",如果不是加上 path = if (path.lastIndexOf("/") != path.length - 1) "$path/" else path - var resources: Enumeration? = null + val resources: Enumeration? try { resources = ClassLoaderContext.get().getResources(path) - } catch (e: IOException) { + } catch (ex: IOException) { + throw RuntimeException(ex) } while (resources!!.hasMoreElements()) { diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassScanner.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassScanner.kt index 3b03ef0..1cb3474 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassScanner.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/io/scan/ClassScanner.kt @@ -30,7 +30,8 @@ class ClassScanner(private var packageName: String) { /** * 文件过滤器 */ - private val fileFilter = FileFilter { file -> file.isDirectory || file.name.endsWith(".class") || file.name.endsWith(".jar") } + private val fileFilter = + FileFilter { file -> file.isDirectory || file.name.endsWith(".class") || file.name.endsWith(".jar") } /** @@ -81,12 +82,15 @@ class ClassScanner(private var packageName: String) { val files = scanDirectory(realPath) for (file in files) { val fileName = file.toString() - if (fileName.contains(".jar") && !fileName.endsWith(".class")) + if (fileName.contains(".jar") && !fileName.endsWith(".class")) { scanJar(file) - else if (fileName.endsWith(".class")) - scanClass(realPath, file) + } +// else if (fileName.endsWith(".class")) { +// } + scanClass(realPath, file) } - } catch (e: UnsupportedEncodingException) { + } catch (ex: UnsupportedEncodingException) { + throw ex } } } @@ -145,6 +149,7 @@ class ClassScanner(private var packageName: String) { } jar.close() } catch (ex: Throwable) { + throw ex } } @@ -191,7 +196,7 @@ class ClassScanner(private var packageName: String) { } } } catch (ex: Throwable) { - + throw ex } } diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/log/Level.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/log/Level.kt index 429ad23..e636cf5 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/log/Level.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/log/Level.kt @@ -2,25 +2,28 @@ package com.synebula.gaea.log /** * 日志等级 - * @author Looly */ enum class Level { /** * 'TRACE' log level. */ TRACE, + /** * 'DEBUG' log level. */ DEBUG, + /** * 'INFO' log level. */ INFO, + /** * 'WARN' log level. */ WARN, + /** * 'ERROR' log level. */ diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IDebugLogger.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IDebugLogger.kt index 5a1cbb1..ba80a59 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IDebugLogger.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IDebugLogger.kt @@ -3,7 +3,6 @@ package com.synebula.gaea.log.logger /** * DEBUG级别日志接口 * - * @author Looly */ interface IDebugLogger { /** diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IErrorLogger.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IErrorLogger.kt index c561a55..5fb200c 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IErrorLogger.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IErrorLogger.kt @@ -2,7 +2,6 @@ package com.synebula.gaea.log.logger /** * ERROR级别日志接口 - * @author Looly */ interface IErrorLogger { /** diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IInfoLogger.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IInfoLogger.kt index fed35bd..453ade2 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IInfoLogger.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IInfoLogger.kt @@ -2,7 +2,6 @@ package com.synebula.gaea.log.logger /** * INFO级别日志接口 - * @author Looly */ interface IInfoLogger { /** diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/ITraceLogger.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/ITraceLogger.kt index ed29589..c4b89c8 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/ITraceLogger.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/ITraceLogger.kt @@ -3,7 +3,6 @@ package com.synebula.gaea.log.logger /** * TRACE级别日志接口 * - * @author Looly */ interface ITraceLogger { /** diff --git a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IWarnLogger.kt b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IWarnLogger.kt index 803aded..731e21a 100644 --- a/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IWarnLogger.kt +++ b/src/gaea/src/main/kotlin/com/synebula/gaea/log/logger/IWarnLogger.kt @@ -2,7 +2,6 @@ package com.synebula.gaea.log.logger /** * WARN级别日志接口 - * @author Looly */ interface IWarnLogger { /**