Skip to content
Open

Dev #91

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified buildSrc/build/libs/buildSrc.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dependencies {
implementation(project(":kotlin-spring-framework-project:kotlin-spring-core"))
implementation(project(":kotlin-spring-framework-project:kotlin-spring-beans"))
compileOnly(project(":kotlin-spring-framework-project:kotlin-spring-aop"))
implementation(project(":kotlin-spring-framework-project:kotlin-spring-context"))
implementation(project(":kotlin-spring-framework-project:kotlin-spring-jcl"))
implementation("org.slf4j:slf4j-api:$slf4jApiVersion")
implementation(project(":kotlin-spring-framework-project:kotlin-spring-web"))
implementation(project(":kotlin-spring-boot-project:kotlin-spring-boot"))
implementation(project(":kotlin-spring-boot-project:kotlin-spring-boot-autoconfigure"))
implementation("org.slf4j:slf4j-api:$slf4jApiVersion")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.wanna.debugger.bistoury.instrument.proxy

import com.wanna.boot.autoconfigure.SpringBootApplication
import com.wanna.boot.runSpringApplication

/**
* Bistoury Proxy Application
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
@SpringBootApplication(proxyBeanMethods = false)
open class BistouryProxyApplication

fun main(vararg args: String) {
var applicationContext = runSpringApplication<BistouryProxyApplication>(*args)
println(applicationContext)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate

/**
* 描述了前端(UI)-Proxy, 或者是Proxy-Agent之间的数据传输的连接
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
interface Connection {


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate

import com.wanna.debugger.bistoury.instrument.proxy.communicate.agent.AgentConnection
import com.wanna.debugger.bistoury.instrument.proxy.communicate.ui.UIConnection

/**
* Session
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
open class DefaultSession : Session {



override fun getSessionId(): String {
TODO("Not yet implemented")
}

override fun getUIConnection(): UIConnection {
TODO("Not yet implemented")
}

override fun getAgentConnection(): AgentConnection {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate

/**
* NettyServer
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
interface NettyServer {

/**
* 启动NettyServer
*/
fun start()

/**
* 关闭NettyServer
*/
fun stop()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate

import com.wanna.debugger.bistoury.instrument.proxy.communicate.agent.AgentConnection
import com.wanna.debugger.bistoury.instrument.proxy.communicate.ui.UIConnection

/**
* 描述了从前端(UI)-Proxy-Agent的会话关系
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
interface Session {

/**
* 获取SessionId
*
* @return sessionId
*/
fun getSessionId(): String

/**
* 获取UIConnection(UI-Proxy之间的连接)
*
* @return UIConnection
*/
fun getUIConnection(): UIConnection

/**
* 获取AgentConnection(Proxy-Agent之间的连接)
*
* @return AgentConnection
*/
fun getAgentConnection(): AgentConnection
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate

import com.wanna.debugger.bistoury.instrument.proxy.communicate.ui.UIConnection

/**
* Session的Manager
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
interface SessionManager {

/**
* 根据sessionId去获取Session
*
* @param sessionId sessionId
* @return 获取到的Session(不存在该Session的话, 返回null)
*/
fun getSession(sessionId: String): Session?

/**
* 获取单个UIConnection对应的所有的Session
*
* @param uiConnection UIConnection
* @return 获取到的所有的Session列表
*/
fun getSessionsByUIConnection(uiConnection: UIConnection): Set<Session>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate.agent

import com.wanna.debugger.bistoury.instrument.proxy.communicate.Connection

/**
* AgentConnection
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
interface AgentConnection : Connection {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate.ui

import com.wanna.debugger.bistoury.instrument.proxy.communicate.Connection

/**
* UIConnection
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
interface UIConnection : Connection {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.wanna.debugger.bistoury.instrument.proxy.communicate.ui.command

/**
* UI和Proxy之间沟通的命令
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
class CommunicateCommand {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.wanna.debugger.bistoury.instrument.proxy.generator

/**
* ID生成器
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
interface IdGenerator {

/**
* 生成ID
*
* @return 生成的ID
*/
fun generateId(): String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.wanna.debugger.bistoury.instrument.proxy.generator

import com.wanna.framework.context.stereotype.Component
import java.util.concurrent.atomic.AtomicInteger

/**
* UI-Proxy-Agent之间建立的Session的IdGenerator
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
@Component
class SessionIdGenerator : IdGenerator {

companion object {
/**
* 自增ID
*/
@JvmStatic
private val AUTO_INCREMENT_ID = AtomicInteger()
}

override fun generateId(): String {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.wanna.debugger.bistoury.instrument.proxy.startup

import com.wanna.framework.context.stereotype.Component

/**
* NettyServer Manager
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/22
*/
@Component
class NettyServerManager {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.wanna.debugger.bistoury.instrument.remoting.codec

/**
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
open class AgentDecoder {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.wanna.debugger.bistoury.instrument.remoting.codec

/**
*
* @author jianchao.jia
* @version v1.0
* @date 2023/6/24
*/
open class AgentEncoder {

}
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package com.wanna.framework.beans.factory

import com.wanna.framework.core.MethodParameter
import com.wanna.framework.lang.Nullable
import java.lang.reflect.Field

/**
* 这是一个依赖的注入点, 它的常见实现是DependencyDescriptor
*
* @param field 字段
* @param parameter 方法参数
*/
open class InjectionPoint(private val field: Field? = null, private val parameter: MethodParameter? = null) {
open class InjectionPoint(
private val field: Field? = null,
private val parameter: MethodParameter? = null
) {
/**
* 获取方法参数/构造器参数/字段上的注解列表
*/
Expand All @@ -22,7 +29,11 @@ open class InjectionPoint(private val field: Field? = null, private val paramete

/**
* 获取指定的注解, 如果是一个方法参数, 那么从方法参数当中获取注解; 如果是一个字段, 从字段当中获取注解
*
* @param annotationClass 要去进行寻找的注解类型
* @return 寻找到的注解, 如果没有合适的, 那么return null
*/
@Nullable
open fun <T : Annotation> getAnnotation(annotationClass: Class<T>): T? {
if (field != null) {
return field.getAnnotation(annotationClass)
Expand All @@ -33,11 +44,28 @@ open class InjectionPoint(private val field: Field? = null, private val paramete
return null
}

/**
* 获取到字段, 如果描述的是一个方法参数, 那么return null
*
* @return Field
*/
@Nullable
open fun getField(): Field? = this.field


/**
* 获取方法参数, 如果这描述的是一个字段, 那么return null
*
* @return MethodParameter
*/
@Nullable
open fun getMethodParameter(): MethodParameter? = this.parameter

/**
* 获取方法参数MethodParameter
*
* @return MethodParameter
*/
open fun obtainMethodParameter(): MethodParameter {
return this.parameter ?: throw IllegalStateException("MethodParameter cannot be null")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,23 @@ open class DefaultListableBeanFactory : ConfigurableListableBeanFactory, BeanDef
}

/**
* 多个元素的DependencyDescriptor
* 增加泛型参数的嵌套级别的DependencyDescriptor, 包装一层, 修改当前DependencyDescriptor的嵌套级别
*
* @param descriptor 待增加嵌套级别的依赖描述符
*/
private open class NestedDependencyDescriptor(descriptor: DependencyDescriptor) : DependencyDescriptor(descriptor) {
init {
// 增加嵌套级别
this.increaseNestingLevel()
}
}

/**
* 需要去注入多个元素的DependencyDescriptor(Map/List/...)
*
* @param descriptor 原始的Descriptor
*/
private class MultiElementDescriptor(descriptor: DependencyDescriptor) : DependencyDescriptor(
descriptor.getField(), descriptor.getMethodParameter(), descriptor.isRequired(), descriptor.isEager()
)
private class MultiElementDescriptor(descriptor: DependencyDescriptor) : NestedDependencyDescriptor(descriptor)

/**
* 解析多个Bean的情况, 比如Collection/Map/Array等类型的依赖的解析, 有可能会需要用到Converter去完成类型的转换
Expand Down
Loading