修改为token认证方式
This commit is contained in:
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
import java.lang.reflect.Method
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
import com.synebula.gaea.exception.NoticeUserException
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
import java.lang.reflect.Method
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Guava Authors
|
||||
*
|
||||
* 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 License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.synebula.gaea.bus
|
||||
|
||||
import com.synebula.gaea.data.message.messageTopic
|
||||
|
||||
@@ -7,8 +7,68 @@ package com.synebula.gaea.data.cache
|
||||
* @version 0.0.1
|
||||
* @since 2016年8月15日 下午4:53:19
|
||||
*/
|
||||
interface ICache {
|
||||
fun add(key: String, value: CacheEntity)
|
||||
interface ICache<K, V> {
|
||||
|
||||
operator fun get(key: String): CacheEntity?
|
||||
/**
|
||||
* 添加一条缓存记录
|
||||
*
|
||||
* @param key 缓存key
|
||||
* @param value 需要缓存的值
|
||||
*/
|
||||
fun add(key: K, value: V)
|
||||
|
||||
/**
|
||||
* 添加多条缓存记录
|
||||
*
|
||||
* @param entries 需要添加的多条缓存记录Map
|
||||
*/
|
||||
fun add(entries: Map<K, V>)
|
||||
|
||||
/**
|
||||
* 尝试获取缓存记录值
|
||||
*
|
||||
* @param key 缓存key
|
||||
*/
|
||||
operator fun get(key: K): V?
|
||||
|
||||
/**
|
||||
* 获取给出列表key中存在的缓存元素
|
||||
*
|
||||
* @param keys 尝试获取的key列表
|
||||
*/
|
||||
fun get(keys: Iterable<K>): Map<K, V>
|
||||
|
||||
/**
|
||||
* 清除所有缓存记录
|
||||
*/
|
||||
fun clear()
|
||||
|
||||
|
||||
/**
|
||||
* 清除给出key的缓存
|
||||
*
|
||||
* @param key 需要清楚的缓存key
|
||||
*/
|
||||
fun remove(key: K)
|
||||
|
||||
/**
|
||||
* 清除给出列表key的缓存
|
||||
*
|
||||
* @param keys 需要清楚的缓存key列表
|
||||
*/
|
||||
fun remove(keys: Iterable<K>)
|
||||
|
||||
/**
|
||||
* 判断key是否存在
|
||||
*
|
||||
* @param key 需要判断的key
|
||||
*/
|
||||
fun exists(key: K): Boolean
|
||||
|
||||
/**
|
||||
* 判断keys是否存在
|
||||
*
|
||||
* @param keys 需要判断的缓存key列表
|
||||
*/
|
||||
fun exists(keys: Iterable<K>): Map<K, Boolean>
|
||||
}
|
||||
|
||||
@@ -3,28 +3,24 @@ package com.synebula.gaea.data.message
|
||||
import com.synebula.gaea.data.serialization.json.IJsonSerializer
|
||||
|
||||
|
||||
class HttpMessage() : DataMessage<Any>() {
|
||||
class HttpMessage(private var serializer: IJsonSerializer) : DataMessage<Any>() {
|
||||
|
||||
var serializer: IJsonSerializer? = null
|
||||
|
||||
constructor(data: Any, serializer: IJsonSerializer? = null) : this() {
|
||||
constructor(data: Any, serializer: IJsonSerializer) : this(serializer) {
|
||||
this.data = data
|
||||
this.serializer = serializer
|
||||
}
|
||||
|
||||
constructor(status: Int, message: String, serializer: IJsonSerializer? = null) : this() {
|
||||
constructor(status: Int, message: String, serializer: IJsonSerializer) : this(serializer) {
|
||||
this.status = status
|
||||
this.message = message
|
||||
this.serializer = serializer
|
||||
}
|
||||
|
||||
constructor(status: Int, data: Any, message: String, serializer: IJsonSerializer? = null) : this(
|
||||
constructor(status: Int, data: Any, message: String, serializer: IJsonSerializer) : this(
|
||||
status,
|
||||
message,
|
||||
serializer
|
||||
) {
|
||||
this.data = data
|
||||
this.serializer = serializer
|
||||
}
|
||||
|
||||
fun load(msg: DataMessage<*>) {
|
||||
@@ -34,6 +30,6 @@ class HttpMessage() : DataMessage<Any>() {
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return serializer?.serialize(this) ?: super.toString()
|
||||
return serializer.serialize(this)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.synebula.gaea.data.message
|
||||
|
||||
import com.synebula.gaea.data.serialization.json.IJsonSerializer
|
||||
|
||||
class HttpMessageFactory(private var serializer: IJsonSerializer) {
|
||||
|
||||
fun create(): HttpMessage {
|
||||
return HttpMessage(serializer)
|
||||
}
|
||||
|
||||
fun create(data: Any): HttpMessage {
|
||||
return HttpMessage(data, serializer)
|
||||
}
|
||||
|
||||
fun create(status: Int, message: String): HttpMessage {
|
||||
return HttpMessage(status, message, serializer)
|
||||
}
|
||||
|
||||
fun create(status: Int, data: Any, message: String): HttpMessage {
|
||||
return HttpMessage(status, data, message, serializer)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user