map) {
- this.map = map;
- }
-
- public DemoType getEnumType() {
- return enumType;
- }
-
- public void setEnumType(DemoType enumType) {
- this.enumType = enumType;
- }
-
- @Override
- public String toString() {
- return "DemoConfig{" + "intField=" + intField + ", strField='" + strField + '\'' + ", pojoField=" + pojoField
- + ", shortArr=" + Arrays.toString(shortArr) + ", longList=" + longList + ", map=" + map + ", enumType="
- + enumType + "} " + super.toString();
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/config/DemoPojo.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/config/DemoPojo.java
deleted file mode 100644
index 559fd32..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/config/DemoPojo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.config;
-
-import com.huaweicloud.sermant.core.config.common.ConfigFieldKey;
-
-/**
- * 插件配置中的复杂对象示例
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-11-16
- */
-public class DemoPojo {
- /**
- * 普通属性
- */
- private int intField;
-
- /**
- * 起别名的属性,将作为检验别名是否生效的依据
- */
- @ConfigFieldKey("strField") // 修改参数名称后缀
- private String str;
-
- public int getIntField() {
- return intField;
- }
-
- public void setIntField(int intField) {
- this.intField = intField;
- }
-
- public String getStr() {
- return str;
- }
-
- public void setStr(String str) {
- this.str = str;
- }
-
- @Override
- public String toString() {
- return "DemoPojo{"
- + "intField=" + intField
- + ", str='" + str + '\''
- + '}';
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/config/DemoType.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/config/DemoType.java
deleted file mode 100644
index e39e062..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/config/DemoType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.config;
-
-/**
- * 示例枚举
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public enum DemoType {
- /**
- * 示例枚举
- */
- DEMO
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoAnnotationDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoAnnotationDeclarer.java
deleted file mode 100644
index 53277ed..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoAnnotationDeclarer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoConstInterceptor;
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-import com.huawei.example.demo.interceptor.DemoStaticInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 通过注解方式定位到拦截点的增强定义,本示例将测试构造函数、静态方法和示例方法三种拦截点
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoAnnotationDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.isAnnotatedWith("com.huawei.example.demo.service.DemoAnnotation");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[]{
- InterceptDeclarer.build(MethodMatcher.isStaticMethod(), new DemoStaticInterceptor()),
- InterceptDeclarer.build(MethodMatcher.isConstructor(), new DemoConstInterceptor()),
- InterceptDeclarer.build(MethodMatcher.isMemberMethod(), new DemoMemberInterceptor())
- };
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoBootstrapDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoBootstrapDeclarer.java
deleted file mode 100644
index 90a34ab..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoBootstrapDeclarer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoConstInterceptor;
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-import com.huawei.example.demo.interceptor.DemoStaticInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 以Thread为例测试启动类加载器加载的类的增强情况
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-27
- */
-public class DemoBootstrapDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.nameEquals("java.lang.Thread");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[]{
- InterceptDeclarer.build(MethodMatcher.nameEquals("getAllStackTraces"),
- new DemoStaticInterceptor()), // 测试静态方法
- InterceptDeclarer.build(MethodMatcher.isConstructor().and(MethodMatcher.paramCountEquals(0)),
- new DemoConstInterceptor()), // 测试无参构造函数
- InterceptDeclarer.build(MethodMatcher.nameEquals("setName"),
- new DemoMemberInterceptor()), // 测试实例方法
- };
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoCheckEnableDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoCheckEnableDeclarer.java
deleted file mode 100644
index 8b8576f..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoCheckEnableDeclarer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoCheckEnableInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 测试插件自身按实际情况决定是否要增强声明的拦截点
- *
- * @author lilai
- * @version 1.0.0
- * @since 2022-08-13
- */
-public class DemoCheckEnableDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.nameEquals("com.huawei.example.demo.service.DemoCheckEnableService");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[]{
- InterceptDeclarer.build(MethodMatcher.nameEquals("exampleFunc"), new DemoCheckEnableInterceptor())
- };
- }
-
- /**
- * 测试插件自身按实际情况决定是否要增强声明的拦截点
- *
- * @return 是否需要增强
- */
- @Override
- public boolean isEnabled() {
- return false;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameDeclarer.java
deleted file mode 100644
index 5066cd4..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameDeclarer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.common.DemoBeanPropertyApi;
-import com.huawei.example.demo.common.DemoInterfaceApi;
-import com.huawei.example.demo.common.DemoInterfaceImpl;
-import com.huawei.example.demo.interceptor.DemoConfigInterceptor;
-import com.huawei.example.demo.interceptor.DemoFieldSetInterceptor;
-import com.huawei.example.demo.interceptor.DemoInterfaceInterceptor;
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-import com.huawei.example.demo.interceptor.DemoServiceInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.SuperTypeDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 通过名称定位到拦截点的增强定义,本示例处理测试构造函数、静态方法和示例方法三种拦截点外,还会测试日志功能和统一配置
- * 本示例直接使用名称完全匹配的方式定位,其他名称相关的定位方式有:
- *
- * 1. {@link ClassMatcher#nameEquals(String)}完全匹配
- * 2. {@link ClassMatcher#nameContains} 多重匹配
- * 3. {@link ClassMatcher#namePrefixedWith(String)} 前缀匹配
- * 4. {@link ClassMatcher#nameSuffixedWith(String)} 后缀匹配
- * 5. {@link ClassMatcher#nameInfixedWith(String)} 内容包含
- * 6. {@link ClassMatcher#nameMatches(String)} 正则匹配
- *
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoNameDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.nameEquals("com.huawei.example.demo.service.DemoNameService");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[]{
- InterceptDeclarer.build(MethodMatcher.nameEquals("serviceFunc"), new DemoServiceInterceptor()),
- InterceptDeclarer.build(MethodMatcher.nameEquals("configFunc"), new DemoConfigInterceptor()),
- InterceptDeclarer.build(MethodMatcher.nameEquals("fieldFunc"),
- new DemoFieldSetInterceptor(),new DemoMemberInterceptor()),
- InterceptDeclarer.build(MethodMatcher.isMemberMethod().and(MethodMatcher.nameEquals("interfaceFunc")),
- new DemoInterfaceInterceptor())
- };
- }
-
- @Override
- public SuperTypeDeclarer[] getSuperTypeDeclarers() {
- return new SuperTypeDeclarer[]{
- SuperTypeDeclarer.ForImplInstance.build(DemoInterfaceApi.class, new DemoInterfaceImpl()),
- SuperTypeDeclarer.ForBeanProperty.build(DemoBeanPropertyApi.class)
- };
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameInfixDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameInfixDeclarer.java
deleted file mode 100644
index 7a516e0..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameInfixDeclarer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 通过类名称内缀定位到拦截点的增强定义
- *
- * @author luanwenfei
- * @since 2022-04-07
- */
-public class DemoNameInfixDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.nameInfixedWith("example.demo.service");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[]{
- InterceptDeclarer.build(MethodMatcher.isAnnotatedWith("com.huawei.example.demo.service.DemoAnnotation"),
- new DemoMemberInterceptor())
- };
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNamePrefixDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNamePrefixDeclarer.java
deleted file mode 100644
index 3b742ff..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNamePrefixDeclarer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 通过类名称前缀定位到拦截点的增强定义
- *
- * @author luanwenfei
- * @since 2022-04-07
- */
-public class DemoNamePrefixDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.namePrefixedWith("com.huawei.example.demo.service.DemoName");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[] {
- InterceptDeclarer.build(MethodMatcher.resultTypeEquals(long.class), new DemoMemberInterceptor())};
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameSuffixDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameSuffixDeclarer.java
deleted file mode 100644
index 140c49e..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoNameSuffixDeclarer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 通过类名称后缀定位到拦截点的增强定义
- *
- * @author luanwenfei
- * @since 2022-04-07
- */
-public class DemoNameSuffixDeclarer extends AbstractPluginDeclarer {
- private static final int PARAMS_COUNT = 2;
-
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.nameSuffixedWith("DemoNameService");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[] {
- InterceptDeclarer.build(MethodMatcher.and(MethodMatcher.paramCountEquals(PARAMS_COUNT),
- MethodMatcher.paramTypesEqual(String.class, int.class)), new DemoMemberInterceptor())};
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoSuperTypeDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoSuperTypeDeclarer.java
deleted file mode 100644
index 829b34f..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoSuperTypeDeclarer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoMemberInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 通过超类方式定位到拦截点的增强定义,本示例将测试构造函数、静态方法和示例方法三种拦截点
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoSuperTypeDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.isExtendedFrom("com.huawei.example.demo.service.DemoInterface");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[] {
- InterceptDeclarer.build(MethodMatcher.nameEquals("memberFunc"), new DemoMemberInterceptor()),
- InterceptDeclarer.build(MethodMatcher.nameSuffixedWith("Suffix"), new DemoMemberInterceptor()),
- InterceptDeclarer.build(MethodMatcher.namePrefixedWith("prefix"), new DemoMemberInterceptor()),
- InterceptDeclarer.build(MethodMatcher.nameInfixedWith("Infix"), new DemoMemberInterceptor())};
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoTraceDeclarer.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoTraceDeclarer.java
deleted file mode 100644
index 35d9e80..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/declarer/DemoTraceDeclarer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.declarer;
-
-import com.huawei.example.demo.interceptor.DemoTraceConsumerInterceptor;
-import com.huawei.example.demo.interceptor.DemoTraceNormalInterceptor;
-import com.huawei.example.demo.interceptor.DemoTraceProviderInterceptor;
-
-import com.huaweicloud.sermant.core.plugin.agent.declarer.AbstractPluginDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.declarer.InterceptDeclarer;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.ClassMatcher;
-import com.huaweicloud.sermant.core.plugin.agent.matcher.MethodMatcher;
-
-/**
- * 用于测试链路功能的增强定义
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoTraceDeclarer extends AbstractPluginDeclarer {
- @Override
- public ClassMatcher getClassMatcher() {
- return ClassMatcher.nameEquals("com.huawei.example.demo.service.DemoTraceService");
- }
-
- @Override
- public InterceptDeclarer[] getInterceptDeclarers(ClassLoader classLoader) {
- return new InterceptDeclarer[] {
- InterceptDeclarer.build(MethodMatcher.nameEquals("provider"), new DemoTraceProviderInterceptor()),
- InterceptDeclarer.build(MethodMatcher.nameEquals("normal"), new DemoTraceNormalInterceptor()),
- InterceptDeclarer.build(MethodMatcher.nameEquals("consumer"), new DemoTraceConsumerInterceptor())};
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoCheckEnableInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoCheckEnableInterceptor.java
deleted file mode 100644
index 3ebb780..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoCheckEnableInterceptor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-
-import java.util.Locale;
-
-/**
- * 用于测试插件内部增强开关是否生效
- *
- * @author lilai
- * @version 1.0.0
- * @since 2022-08-13
- */
-public class DemoCheckEnableInterceptor extends AbstractInterceptor {
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoCheckEnableInterceptor]before, class: %s, method: %s.",
- context.getRawCls().getName(), context.getMethod().getName()));
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoCheckEnableInterceptor]after, class: %s, method: %s.",
- context.getRawCls().getName(), context.getMethod().getName()));
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoConfigInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoConfigInterceptor.java
deleted file mode 100644
index 436a96c..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoConfigInterceptor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-import com.huawei.example.demo.config.DemoConfig;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-import com.huaweicloud.sermant.core.plugin.config.PluginConfigManager;
-
-/**
- * 统一配置功能的拦截器示例,在本示例中,将展示如何在插件端获取统一配置
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoConfigInterceptor extends AbstractInterceptor {
- private DemoConfig config;
-
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- DemoLogger.println(context.getRawCls().getSimpleName() + ": [DemoConfigInterceptor]-before");
- config = PluginConfigManager.getPluginConfig(DemoConfig.class);
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- final String clsName = context.getRawCls().getSimpleName();
- DemoLogger.println(clsName + ": " + config);
- DemoLogger.println(clsName + ": [DemoConfigInterceptor]-after");
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoConstInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoConstInterceptor.java
deleted file mode 100644
index 2c3283d..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoConstInterceptor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-
-import java.util.Locale;
-
-/**
- * 构造函数的拦截器示例,本示例将展示如何对构造函数进行增强
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoConstInterceptor extends AbstractInterceptor {
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoConstInterceptor]before, class: %s.",
- context.getRawCls().getName()));
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoConstInterceptor]after, class: %s.",
- context.getRawCls().getName()));
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoFieldSetInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoFieldSetInterceptor.java
deleted file mode 100644
index ca75b16..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoFieldSetInterceptor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2021-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-
-/**
- * 用于测试局部变量、成员变量和全局变量的写入和读取
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2022-01-22
- */
-public class DemoFieldSetInterceptor extends AbstractInterceptor {
- private static final String LOCALFIELDNAME = "testLocal";
- private static final String MEMEBERFIELDNAME = "testMember";
- private static final String STATICFIELDNAME = "testStatic";
-
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- final Object localField = context.getLocalFieldValue(LOCALFIELDNAME);
- final int newLocalField = localField == null ? 1 : Integer.parseInt(localField.toString()) + 1;
- context.setLocalFieldValue(LOCALFIELDNAME, newLocalField);
- final Object memberField = context.getMemberFieldValue(MEMEBERFIELDNAME);
- final int newMemberField = memberField == null ? 1 : Integer.parseInt(memberField.toString()) + 1;
- context.setMemberFieldValue(MEMEBERFIELDNAME, newMemberField);
- final Object staticField = context.getStaticFieldValue(STATICFIELDNAME);
- final int newStaticField = staticField == null ? 1 : Integer.parseInt(staticField.toString()) + 1;
- context.setStaticFieldValue(STATICFIELDNAME, newStaticField);
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- DemoLogger.println("[DemoFieldSetInterceptor]-testLocal: " + context.getLocalFieldValue(LOCALFIELDNAME));
- DemoLogger.println("[DemoFieldSetInterceptor]-testMember: " + context.getMemberFieldValue(MEMEBERFIELDNAME));
- DemoLogger.println("[DemoFieldSetInterceptor]-testStatic: " + context.getStaticFieldValue(STATICFIELDNAME));
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoInterfaceInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoInterfaceInterceptor.java
deleted file mode 100644
index 610825f..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoInterfaceInterceptor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2021-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoBeanPropertyApi;
-import com.huawei.example.demo.common.DemoInterfaceApi;
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-
-/**
- * 用于测试对被增强类的接口实现
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2022-01-22
- */
-public class DemoInterfaceInterceptor extends AbstractInterceptor {
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- final Object object = context.getObject();
- if (object instanceof DemoInterfaceApi) {
- ((DemoInterfaceApi) object).foo();
- }
- if (object instanceof DemoBeanPropertyApi) {
- final DemoBeanPropertyApi demoBeanPropertyApi = (DemoBeanPropertyApi) object;
- demoBeanPropertyApi.setFoo("foo field string");
- demoBeanPropertyApi.setBar(1);
- }
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- final Object object = context.getObject();
- if (object instanceof DemoBeanPropertyApi) {
- final DemoBeanPropertyApi demoBeanPropertyApi = (DemoBeanPropertyApi) object;
- DemoLogger.println("[DemoInterfaceInterceptor]-foo: " + demoBeanPropertyApi.getFoo());
- DemoLogger.println("[DemoInterfaceInterceptor]-bar: " + demoBeanPropertyApi.getBar());
- }
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoMemberInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoMemberInterceptor.java
deleted file mode 100644
index bbf8c3b..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoMemberInterceptor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-
-import java.util.Locale;
-
-/**
- * 实例方法的拦截器示例,本示例将展示如何对实例方法进行增强
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoMemberInterceptor extends AbstractInterceptor {
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoMemberInterceptor]before, class: %s, method: %s.",
- context.getRawCls().getName(), context.getMethod().getName()));
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoMemberInterceptor]after, class: %s, method: %s.",
- context.getRawCls().getName(), context.getMethod().getName()));
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoServiceInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoServiceInterceptor.java
deleted file mode 100644
index fc825ee..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoServiceInterceptor.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-import com.huawei.example.demo.service.DemoComplexService;
-import com.huawei.example.demo.service.DemoSimpleService;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-import com.huaweicloud.sermant.core.plugin.service.PluginServiceManager;
-
-/**
- * 插件服务的拦截器示例,在本示例中,将展示如何在拦截器中使用插件服务
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoServiceInterceptor extends AbstractInterceptor {
- private DemoSimpleService simpleService;
- private DemoComplexService complexService;
-
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- DemoLogger.println(context.getRawCls().getSimpleName() + ": [DemoServiceInterceptor]-before");
- simpleService = PluginServiceManager.getPluginService(DemoSimpleService.class);
- complexService = PluginServiceManager.getPluginService(DemoComplexService.class);
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- DemoLogger.println(context.getRawCls().getSimpleName() + ": [DemoServiceInterceptor]-after");
- simpleService.activeFunc();
- complexService.activeFunc();
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoStaticInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoStaticInterceptor.java
deleted file mode 100644
index 8201a16..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoStaticInterceptor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-
-import java.util.Locale;
-
-/**
- * 静态函数的拦截器示例,本示例将展示如何对静态函数进行增强
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoStaticInterceptor extends AbstractInterceptor {
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoStaticInterceptor]before, class: %s, method: %s.",
- context.getRawCls().getName(), context.getMethod().getName()));
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- DemoLogger.println(String.format(Locale.ROOT, "[DemoStaticInterceptor]after, class: %s, method: %s.",
- context.getRawCls().getName(), context.getMethod().getName()));
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceConsumerInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceConsumerInterceptor.java
deleted file mode 100644
index e64ea04..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceConsumerInterceptor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-import com.huaweicloud.sermant.core.service.ServiceManager;
-import com.huaweicloud.sermant.core.service.tracing.api.InjectService;
-import com.huaweicloud.sermant.core.service.tracing.api.TracingService;
-import com.huaweicloud.sermant.core.service.tracing.common.SpanEvent;
-import com.huaweicloud.sermant.core.service.tracing.common.SpanEventContext;
-import com.huaweicloud.sermant.core.service.tracing.common.TracingHeader;
-import com.huaweicloud.sermant.core.service.tracing.common.TracingRequest;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Optional;
-
-/**
- * 链路监控功能的拦截器示例,本示例将展示如何在插件端使用链路监控功能
- * 该拦截器拦截consumer数据,provider数据见{@link DemoTraceProviderInterceptor}
- *
- * @author luanwenfei
- * @version 1.0.0
- * @since 2022-03-18
- */
-public class DemoTraceConsumerInterceptor extends AbstractInterceptor {
- TracingService tracingService = ServiceManager.getService(TracingService.class);
-
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- TracingRequest request =
- new TracingRequest(context.getRawCls().getName(), context.getMethod().getName());
- InjectService> injectService = (spanEvent, carrier) -> {
- carrier.put(TracingHeader.TRACE_ID.getValue(), spanEvent.getTraceId());
- carrier.put(TracingHeader.PARENT_SPAN_ID.getValue(), spanEvent.getSpanId());
- carrier.put(TracingHeader.SPAN_ID_PREFIX.getValue(), spanEvent.getNextSpanIdPrefix());
- };
- tracingService.onConsumerSpanStart(request, injectService, (HashMap)context.getResult());
- Optional spanEventContextOptional = tracingService.getContext();
- if (spanEventContextOptional.isPresent()) {
- SpanEvent spanEvent = spanEventContextOptional.get().getSpanEvent();
- DemoLogger.println(String.format(Locale.ROOT, "ConsumerSpanEvent TraceId: %s, SpanId: %s.",
- spanEvent.getTraceId(), spanEvent.getSpanId()));
- }
- tracingService.onSpanFinally();
- return context;
- }
-
- @Override
- public ExecuteContext onThrow(ExecuteContext context) throws Exception {
- tracingService.onSpanError(context.getThrowable());
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceNormalInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceNormalInterceptor.java
deleted file mode 100644
index 6ddad37..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceNormalInterceptor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-import com.huaweicloud.sermant.core.service.ServiceManager;
-import com.huaweicloud.sermant.core.service.tracing.api.TracingService;
-import com.huaweicloud.sermant.core.service.tracing.common.SpanEvent;
-import com.huaweicloud.sermant.core.service.tracing.common.SpanEventContext;
-import com.huaweicloud.sermant.core.service.tracing.common.TracingRequest;
-
-import java.util.Locale;
-import java.util.Optional;
-
-/**
- * 链路监控功能的拦截器实例,本示例将展示如何在插件端使用链路监控功能
- *
- * @author luanwenfei
- * @since 2022-04-07
- */
-public class DemoTraceNormalInterceptor extends AbstractInterceptor {
- TracingService tracingService = ServiceManager.getService(TracingService.class);
-
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- TracingRequest request = new TracingRequest(context.getRawCls().getName(), context.getMethod().getName());
- tracingService.onNormalSpanStart(request);
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- Optional spanEventContextOptional = tracingService.getContext();
- if (spanEventContextOptional.isPresent()) {
- SpanEvent spanEvent = spanEventContextOptional.get().getSpanEvent();
- DemoLogger.println(String.format(Locale.ROOT, "NormalSpanEvent TraceId: %s, SpanId: %s.",
- spanEvent.getTraceId(), spanEvent.getSpanId()));
- }
- tracingService.onSpanFinally();
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceProviderInterceptor.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceProviderInterceptor.java
deleted file mode 100644
index 1f8e463..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/interceptor/DemoTraceProviderInterceptor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.interceptor;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
-import com.huaweicloud.sermant.core.plugin.agent.interceptor.AbstractInterceptor;
-import com.huaweicloud.sermant.core.service.ServiceManager;
-import com.huaweicloud.sermant.core.service.tracing.api.ExtractService;
-import com.huaweicloud.sermant.core.service.tracing.api.TracingService;
-import com.huaweicloud.sermant.core.service.tracing.common.SpanEvent;
-import com.huaweicloud.sermant.core.service.tracing.common.SpanEventContext;
-import com.huaweicloud.sermant.core.service.tracing.common.TracingHeader;
-import com.huaweicloud.sermant.core.service.tracing.common.TracingRequest;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Optional;
-
-/**
- * 链路监控功能的拦截器示例,本示例将展示如何在插件端使用链路监控功能
- * 该拦截器拦截provider数据,consumer数据见{@link DemoTraceConsumerInterceptor}
- *
- * @author luanwenfei
- * @version 1.0.0
- * @since 2022-03-18
- */
-public class DemoTraceProviderInterceptor extends AbstractInterceptor {
- private final TracingService tracingService = ServiceManager.getService(TracingService.class);
-
- @Override
- public ExecuteContext before(ExecuteContext context) throws Exception {
- TracingRequest request =
- new TracingRequest(context.getRawCls().getName(), context.getMethod().getName());
- ExtractService> extractService = (tracingRequest, carrier) -> {
- tracingRequest.setTraceId(carrier.get(TracingHeader.TRACE_ID.getValue()));
- tracingRequest.setParentSpanId(carrier.get(TracingHeader.PARENT_SPAN_ID.getValue()));
- tracingRequest.setSpanIdPrefix(carrier.get(TracingHeader.SPAN_ID_PREFIX.getValue()));
- };
- tracingService.onProviderSpanStart(request, extractService, (HashMap)context.getArguments()[0]);
- return context;
- }
-
- @Override
- public ExecuteContext after(ExecuteContext context) throws Exception {
- Optional spanEventContextOptional = tracingService.getContext();
- if (spanEventContextOptional.isPresent()) {
- SpanEvent spanEvent = spanEventContextOptional.get().getSpanEvent();
- DemoLogger.println(String.format(Locale.ROOT, "ProviderSpanEvent TraceId: %s, SpanId: %s.",
- spanEvent.getTraceId(), spanEvent.getSpanId()));
- }
- tracingService.onSpanFinally();
- return context;
- }
-
- @Override
- public ExecuteContext onThrow(ExecuteContext context) throws Exception {
- tracingService.onSpanError(context.getThrowable());
- return context;
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoComplexService.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoComplexService.java
deleted file mode 100644
index 519b1a5..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoComplexService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.service;
-
-import com.huaweicloud.sermant.core.plugin.service.PluginService;
-
-/**
- * 复杂服务的接口示例
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-11-16
- */
-public interface DemoComplexService extends PluginService {
- /**
- * 主动调用的方法,将调用{@link DemoSimpleService#passiveFunc()}方法
- */
- void activeFunc();
-
- /**
- * 被动调用的方法,将被{@link DemoSimpleService#activeFunc()}方法调用
- */
- void passiveFunc();
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoDynaConfService.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoDynaConfService.java
deleted file mode 100644
index c17bc34..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoDynaConfService.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.service;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.service.PluginService;
-import com.huaweicloud.sermant.core.service.ServiceManager;
-import com.huaweicloud.sermant.core.service.dynamicconfig.DynamicConfigService;
-import com.huaweicloud.sermant.core.service.dynamicconfig.common.DynamicConfigEvent;
-import com.huaweicloud.sermant.core.service.dynamicconfig.common.DynamicConfigListener;
-
-/**
- * 动态配置示例
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-11-26
- */
-public class DemoDynaConfService implements PluginService {
- private DynamicConfigService service;
-
- /**
- * 如果是zookeeper实现,修改{@code /sermant/demo/test}的值以观察动态配置效果
- */
- @Override
- public void start() {
- service = ServiceManager.getService(DynamicConfigService.class);
- service.addConfigListener("demo/test", "sermant", new DynamicConfigListener() {
- @Override
- public void process(DynamicConfigEvent event) {
- DemoLogger.println("[DemoDynaConfService]-" + event.toString());
- }
- });
- }
-
- @Override
- public void stop() {
- service.stop();
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoHeartBeatService.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoHeartBeatService.java
deleted file mode 100644
index 3c0f98f..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoHeartBeatService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.service;
-
-import com.huaweicloud.sermant.core.plugin.service.PluginService;
-import com.huaweicloud.sermant.core.service.ServiceManager;
-import com.huaweicloud.sermant.core.service.heartbeat.api.ExtInfoProvider;
-import com.huaweicloud.sermant.core.service.heartbeat.api.HeartbeatService;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * 本示例中,将展示如何在插件服务中使用心跳功能
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoHeartBeatService implements PluginService {
- @Override
- public void start() {
- final HeartbeatService service = ServiceManager.getService(HeartbeatService.class);
- service.setExtInfo(new ExtInfoProvider() {
- @Override
- public Map getExtInfo() {
- return Collections.singletonMap("exampleKey", "exampleValue");
- }
- });
- }
-
- @Override
- public void stop() {
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoSimpleService.java b/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoSimpleService.java
deleted file mode 100644
index d0a4dd6..0000000
--- a/sermant-template/template/template-plugin/src/main/java/com/huawei/example/demo/service/DemoSimpleService.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.service;
-
-import com.huawei.example.demo.common.DemoLogger;
-
-import com.huaweicloud.sermant.core.plugin.service.PluginService;
-import com.huaweicloud.sermant.core.plugin.service.PluginServiceManager;
-
-/**
- * 示例服务,本示例中将展示如何编写一个插件服务
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-10-25
- */
-public class DemoSimpleService implements PluginService {
- @Override
- public void start() {
- DemoLogger.println("[DemoSimpleService]-start");
- }
-
- @Override
- public void stop() {
- DemoLogger.println("[DemoSimpleService]-stop");
- }
-
- /**
- * 主动调用的方法,将调用{@link DemoComplexService#passiveFunc()}方法
- */
- public void activeFunc() {
- DemoLogger.println("[DemoSimpleService]-activeFunc");
- final DemoComplexService service = PluginServiceManager.getPluginService(DemoComplexService.class);
- service.passiveFunc();
- }
-
- /**
- * 被动调用的方法,将被{@link DemoComplexService#activeFunc()}方法调用
- */
- public void passiveFunc() {
- DemoLogger.println("[DemoSimpleService]-passiveFunc");
- }
-}
diff --git a/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.agent.declarer.PluginDeclarer b/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.agent.declarer.PluginDeclarer
deleted file mode 100644
index f0ce197..0000000
--- a/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.agent.declarer.PluginDeclarer
+++ /dev/null
@@ -1,8 +0,0 @@
-com.huawei.example.demo.declarer.DemoAnnotationDeclarer
-com.huawei.example.demo.declarer.DemoNameDeclarer
-com.huawei.example.demo.declarer.DemoSuperTypeDeclarer
-com.huawei.example.demo.declarer.DemoTraceDeclarer
-com.huawei.example.demo.declarer.DemoBootstrapDeclarer
-com.huawei.example.demo.declarer.DemoNameInfixDeclarer
-com.huawei.example.demo.declarer.DemoNamePrefixDeclarer
-com.huawei.example.demo.declarer.DemoNameSuffixDeclarer
\ No newline at end of file
diff --git a/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.config.PluginConfig b/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.config.PluginConfig
deleted file mode 100644
index fe60189..0000000
--- a/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.config.PluginConfig
+++ /dev/null
@@ -1 +0,0 @@
-com.huawei.example.demo.config.DemoConfig
\ No newline at end of file
diff --git a/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.service.PluginService b/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.service.PluginService
deleted file mode 100644
index 119dfa6..0000000
--- a/sermant-template/template/template-plugin/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.service.PluginService
+++ /dev/null
@@ -1,3 +0,0 @@
-com.huawei.example.demo.service.DemoSimpleService
-com.huawei.example.demo.service.DemoHeartBeatService
-com.huawei.example.demo.service.DemoDynaConfService
\ No newline at end of file
diff --git a/sermant-template/template/template-service/pom.xml b/sermant-template/template/template-service/pom.xml
deleted file mode 100644
index 47923f7..0000000
--- a/sermant-template/template/template-service/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
- com.huaweicloud.sermant.examples
- template
- 1.0.0
-
- 4.0.0
-
- template-service
-
-
- com.huaweicloud.sermant
- sermant-agentcore-core
- 0.7.0
- provided
-
-
- com.huaweicloud.sermant.examples
- template-plugin
- 1.0.0
- provided
-
-
- org.slf4j
- slf4j-api
- 1.7.30
- provided
-
-
-
-
-
- ${pom.basedir}/../..
- template
- service
- 8
- 8
-
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
-
-
-
-
\ No newline at end of file
diff --git a/sermant-template/template/template-service/src/main/java/com/huawei/example/demo/config/DemoServiceConfig.java b/sermant-template/template/template-service/src/main/java/com/huawei/example/demo/config/DemoServiceConfig.java
deleted file mode 100644
index 39e97da..0000000
--- a/sermant-template/template/template-service/src/main/java/com/huawei/example/demo/config/DemoServiceConfig.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.config;
-
-import com.huaweicloud.sermant.core.plugin.config.PluginConfig;
-
-/**
- * 插件服务包中定义的插件配置示例,该示例较{@link com.huawei.example.demo.config.DemoConfig}较为简单
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-11-16
- */
-public class DemoServiceConfig implements PluginConfig { // 没有设定类别名的情况,将使用类的全限定名
- private String testField;
-
- public String getTestField() {
- return testField;
- }
-
- public void setTestField(String testField) {
- this.testField = testField;
- }
-
- @Override
- public String toString() {
- return "DemoServiceConfig{" +
- "testField='" + testField + '\'' +
- '}';
- }
-}
diff --git a/sermant-template/template/template-service/src/main/java/com/huawei/example/demo/service/DemoComplexServiceImpl.java b/sermant-template/template/template-service/src/main/java/com/huawei/example/demo/service/DemoComplexServiceImpl.java
deleted file mode 100644
index c24440d..0000000
--- a/sermant-template/template/template-service/src/main/java/com/huawei/example/demo/service/DemoComplexServiceImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2021-2021 Huawei Technologies Co., Ltd. All rights reserved.
- *
- * 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.huawei.example.demo.service;
-
-import com.huawei.example.demo.config.DemoConfig;
-import com.huawei.example.demo.config.DemoServiceConfig;
-
-import com.huaweicloud.sermant.core.plugin.config.PluginConfigManager;
-import com.huaweicloud.sermant.core.plugin.service.PluginServiceManager;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * 复杂服务示例实现
- *
- * @author HapThorin
- * @version 1.0.0
- * @since 2021-11-16
- */
-public class DemoComplexServiceImpl implements DemoComplexService {
- private static final Logger LOGGER = LoggerFactory.getLogger("slf4j.test");
-
- @Override
- public void start() {
- LOGGER.error("[DemoComplexService]-start");
- }
-
- @Override
- public void stop() {
- LOGGER.error("[DemoComplexService]-stop");
- }
-
- @Override
- public void activeFunc() {
- LOGGER.error("[DemoComplexService]-activeFunc");
- final DemoSimpleService service = PluginServiceManager.getPluginService(DemoSimpleService.class);
- service.passiveFunc();
- }
-
- @Override
- public void passiveFunc() {
- LOGGER.error("[DemoComplexService]-passiveFunc");
- final DemoServiceConfig serviceConfig = PluginConfigManager.getPluginConfig(DemoServiceConfig.class);
- LOGGER.error(getClass().getSimpleName() + ": " + serviceConfig);
- final DemoConfig demoConfig = PluginConfigManager.getPluginConfig(DemoConfig.class);
- LOGGER.error(getClass().getSimpleName() + ": " + demoConfig);
- }
-}
diff --git a/sermant-template/template/template-service/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.config.PluginConfig b/sermant-template/template/template-service/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.config.PluginConfig
deleted file mode 100644
index 197d5e3..0000000
--- a/sermant-template/template/template-service/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.config.PluginConfig
+++ /dev/null
@@ -1 +0,0 @@
-com.huawei.example.demo.config.DemoServiceConfig
\ No newline at end of file
diff --git a/sermant-template/template/template-service/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.service.PluginService b/sermant-template/template/template-service/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.service.PluginService
deleted file mode 100644
index 34c2f47..0000000
--- a/sermant-template/template/template-service/src/main/resources/META-INF/services/com.huaweicloud.sermant.core.plugin.service.PluginService
+++ /dev/null
@@ -1 +0,0 @@
-com.huawei.example.demo.service.DemoComplexServiceImpl
\ No newline at end of file