Browse Source

青涩知夏->删除无用内容,修改README.md

青涩知夏 4 years ago
parent
commit
3f366914af

+ 82 - 0
README.md

@@ -46,3 +46,85 @@ https://git.nosum.cn/nosum/nosum-gateway.git
 root@git.nosum.cn:nosum/nosum-gateway.git
 ```
 
+## 关于扩展
+
+> 参与`dubbo`中的`SPI`
+>
+> > 所有具备`@SPI`注解的接口,可以在`resources/META-INF/gateway`中新建以接口名为文件名的文件进行扩展
+
+## 内置扩展
+
+> `cn.nosum.common.extension.ExtensionFactory`
+>
+> > 扩展点工厂类,默认使用`adaptive`
+
+```properties
+adaptive=cn.nosum.common.extension.factory.AdaptiveExtensionFactory
+spi=cn.nosum.common.extension.factory.SpiExtensionFactory
+```
+
+>`cn.nosum.gateway.container.GateWayContainer`
+>
+>> 网关容器,默认使用`netty`
+
+```properties
+netty=cn.nosum.gateway.container.NettyGateWayContainer
+```
+
+> `cn.nosum.gateway.handler.build.HandlerBuilder`
+>
+> > 容器`handler`构建器,默认使用`context`
+
+```properties
+context=cn.nosum.gateway.handler.build.ContextHandlerBuilder
+```
+
+> `cn.nosum.gateway.slot.build.SlotChainBuilder`
+>
+> > 处理槽构建器,默认使用`context`
+
+```properties
+context=cn.nosum.gateway.slot.build.LinkSlotChainBuilder
+```
+
+> `cn.nosum.gateway.slot.ProcessorSlotChain`
+>
+> > 处理槽链路类型,默认使用`link`
+
+```properties
+link=cn.nosum.gateway.slot.LinkProcessorSlotChain
+```
+
+## `application.properties`
+
+> 项目核心配置文件
+
+```properties
+# 容器端口号
+container.port = 8888
+request.file.save.folder.name = /usr/local/gateway/request/file
+# 示例配置,即使不配置也是默认使用这些
+cn.nosum.common.extension.ExtensionFactory = adaptive
+cn.nosum.gateway.container.GateWayContainer = netty
+cn.nosum.gateway.handler.build.HandlerBuilder = context
+cn.nosum.gateway.slot.build.SlotChainBuilder = context
+cn.nosum.gateway.slot.LinkProcessorSlotChain = link
+```
+
+## `GateWay `启动入口
+
+```java
+public class NoSumGateWayStart {
+    public static void main(String[] args) {
+        GateWayContainer container = ExtensionLoader
+                    .getExtensionLoader(GateWayContainer.class)
+                    .getAdaptiveExtension();
+        container.start();
+    }
+}
+```
+
+## 未实现的功能
+
+> 负载均衡、熔断、缓存、限流、鉴权
+

+ 0 - 30
src/main/java/cn/nosum/common/annotation/Activate.java

@@ -1,30 +0,0 @@
-package cn.nosum.common.annotation;
-
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-public @interface Activate {
-
-    /**
-     * 所属的组,一般是类名
-     */
-    String group() default "";
-
-    /**
-     * 是否激活
-     */
-    boolean value() default false;
-
-    /**
-     * 用于控制链路排序
-     */
-    int order() default 0;
-
-}

+ 0 - 68
src/main/java/cn/nosum/common/annotation/Extension.java

@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 cn.nosum.common.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker for extension interface
- * <p/>
- * Changes on extension configuration file <br/>
- * Use <code>Protocol</code> as an example, its configuration file 'META-INF/dubbo/com.xxx.Protocol' is changes from: <br/>
- * <pre>
- *     com.foo.XxxProtocol
- *     com.foo.YyyProtocol
- * </pre>
- * <p>
- * to key-value pair <br/>
- * <pre>
- *     xxx=com.foo.XxxProtocol
- *     yyy=com.foo.YyyProtocol
- * </pre>
- * <br/>
- * The reason for this change is:
- * <p>
- * If there's third party library referenced by static field or by method in extension implementation, its class will
- * fail to initialize if the third party library doesn't exist. In this case, dubbo cannot figure out extension's id
- * therefore cannot be able to map the exception information with the extension, if the previous format is used.
- * <p/>
- * For example:
- * <p>
- * Fails to load Extension("mina"). When user configure to use mina, dubbo will complain the extension cannot be loaded,
- * instead of reporting which extract extension implementation fails and the extract reason.
- * </p>
- *
- * @deprecated because it's too general, switch to use {@link org.apache.dubbo.common.extension.SPI}
- */
-@Deprecated
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface Extension {
-
-    /**
-     * @deprecated
-     */
-    @Deprecated
-    String value() default "";
-
-}

+ 0 - 1
src/main/java/cn/nosum/common/extension/ExtensionLoader.java

@@ -1,6 +1,5 @@
 package cn.nosum.common.extension;
 
-import cn.nosum.common.annotation.Activate;
 import cn.nosum.common.annotation.Adaptive;
 import cn.nosum.common.annotation.DisableInject;
 import cn.nosum.common.annotation.SPI;