chore(v0.11): 全路径纳入版本库与走查整改

- .gitignore:显式放行全部 maven-*、scripts、dev-support、frontend、反1、artifacts、历史导出目录
- 新增跟踪:device-manager/device-sdk/legacy-public、davinci-manager、cwos-*、cwos-resource 等源码与附属资源
- davinci FileStorageManagerImpl:Feign Response 关闭、绝对 URL 拉流 SSRF 校验(协议/主机/解析地址)
- davinci OuterCallFeignClient:补充契约说明
- cwos-common-aks AksConstant:final 类 + 私有构造防误实例化
- device-manager DeviceConstant:沿用 DEFAULT_APPLICATIONID 拼写修正

Made-with: Cursor
This commit is contained in:
反编译工作区
2026-04-24 23:54:05 +08:00
parent de6245a492
commit 0a34c76a82
3193 changed files with 227337 additions and 1 deletions
@@ -0,0 +1,430 @@
/* */ package cn.cloudwalk.event;
/* */
/* */ import cn.cloudwalk.cwos.client.event.EventClient;
/* */ import cn.cloudwalk.cwos.client.event.event.BaseEvent;
/* */ import cn.cloudwalk.cwos.client.event.event.CustomEvent;
/* */ import cn.cloudwalk.cwos.client.event.event.EventType;
/* */ import cn.cloudwalk.cwos.client.event.handler.EventListener;
/* */ import cn.cloudwalk.event.annotation.ConsumerGroup;
/* */ import cn.cloudwalk.event.annotation.CustomTopic;
/* */ import cn.cloudwalk.event.annotation.EventTopicSuffix;
/* */ import cn.cloudwalk.event.autoconfig.EventProperties;
/* */ import cn.cloudwalk.event.handler.CustomEventHandler;
/* */ import cn.cloudwalk.event.handler.EventHandler;
/* */ import cn.cloudwalk.event.handler.EventHandlerMapping;
/* */ import cn.cloudwalk.event.handler.EventHandlerWorker;
/* */ import cn.cloudwalk.event.handler.NamedThreadFactory;
/* */ import cn.cloudwalk.event.listener.CloudwalkEventListener;
/* */ import cn.cloudwalk.event.listener.GroupEventListener;
/* */ import cn.cloudwalk.event.listener.GroupListnerClassMapping;
/* */ import com.google.common.collect.Lists;
/* */ import com.google.common.collect.Sets;
/* */ import java.lang.reflect.ParameterizedType;
/* */ import java.lang.reflect.Type;
/* */ import java.util.ArrayList;
/* */ import java.util.HashMap;
/* */ import java.util.LinkedList;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */ import java.util.Set;
/* */ import java.util.concurrent.SynchronousQueue;
/* */ import java.util.concurrent.ThreadFactory;
/* */ import java.util.concurrent.ThreadPoolExecutor;
/* */ import java.util.concurrent.TimeUnit;
/* */ import java.util.regex.Matcher;
/* */ import java.util.regex.Pattern;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */ import org.springframework.beans.BeansException;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.boot.CommandLineRunner;
/* */ import org.springframework.context.ApplicationContext;
/* */ import org.springframework.core.env.Environment;
/* */ import org.springframework.util.CollectionUtils;
/* */ import org.springframework.util.StringUtils;
/* */
/* */ public class CloudwalkEventInitializing
/* */ implements CommandLineRunner {
/* 48 */ private static final Logger LOGGER = LoggerFactory.getLogger(CloudwalkEventInitializing.class);
/* */
/* */ @Autowired(required = false)
/* */ private List<EventHandler> eventHandlers;
/* */
/* */ @Autowired
/* */ private CloudwalkEventManager cloudwalkEventManager;
/* */
/* */ @Autowired
/* */ private Environment environment;
/* */
/* 59 */ private static final Pattern pattern = Pattern.compile("^\\$\\{(.*?)\\}$");
/* */
/* */
/* */ private static final String DEFAULT_SUFFIX = "";
/* */
/* */
/* */ private String defaultGroup;
/* */
/* */
/* */ private EventClient defaultEventClient;
/* */
/* 70 */ private Map<String, EventClient> eventClientMap = new HashMap<>();
/* */
/* */ private EventProperties eventProperties;
/* */
/* */ private static boolean isHandlerEnable = false;
/* */
/* */
/* */ public void run(String... args) throws Exception {
/* 78 */ init();
/* */ }
/* */
/* */ public void init() throws Exception {
/* 82 */ initEventClient();
/* 83 */ initHandlerMapping();
/* 84 */ initHandlerExecutor();
/* 85 */ subscribeEvent();
/* */ }
/* */
/* */ public CloudwalkEventInitializing(EventProperties eventProperties) {
/* 89 */ this.eventProperties = eventProperties;
/* */ }
/* */
/* */
/* */ private void initEventClient() throws ClassNotFoundException {
/* 94 */ String[] groupIds = this.eventProperties.getGroupId().split(",");
/* */
/* 96 */ if (groupIds.length == 0) {
/* 97 */ throw new IllegalArgumentException("消费组ID不能为空");
/* */ }
/* */
/* 100 */ Map<String, String> listenerClassMap = this.eventProperties.getListenerClass();
/* */
/* 102 */ GroupListnerClassMapping groupListnerClassMapping = new GroupListnerClassMapping();
/* */
/* 104 */ for (int i = 0; i < groupIds.length; i++) {
/* 105 */ Class<? extends EventListener> listenerClass; boolean isFirst = (i == 0);
/* 106 */ String groupId = groupIds[i];
/* */
/* */
/* */
/* 110 */ if (null == listenerClassMap || StringUtils.isEmpty(listenerClassMap.get(groupId))) {
/* 111 */ if (isFirst) {
/* 112 */ Class<CloudwalkEventListener> clazz = CloudwalkEventListener.class;
/* */ } else {
/* 114 */ throw new IllegalArgumentException(String.format("groupId[%s]缺少listener-class的配置", new Object[] { groupId }));
/* */ }
/* */ } else {
/* 117 */ listenerClass = (Class)Class.forName(listenerClassMap.get(groupId));
/* */ }
/* */
/* 120 */ initEventClient(this.eventProperties.getBootstrapServers(), groupId, listenerClass, isFirst);
/* 121 */ groupListnerClassMapping.register(listenerClass, groupId);
/* */ }
/* */
/* 124 */ this.cloudwalkEventManager.setGroupListnerClassMapping(groupListnerClassMapping);
/* 125 */ this.cloudwalkEventManager.setEventClient(this.defaultEventClient);
/* */ }
/* */
/* */ @Autowired
/* */ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
/* 130 */ GroupEventListener.applicationContext = applicationContext;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ private List<String> extractGroupIds(EventHandler eventHandler) {
/* 138 */ if (eventHandler.getClass().isAnnotationPresent((Class)ConsumerGroup.class)) {
/* 139 */ ConsumerGroup consumerGroup = eventHandler.getClass().<ConsumerGroup>getAnnotation(ConsumerGroup.class);
/* */
/* 141 */ List<String> groupIds = new LinkedList<>();
/* 142 */ for (String groupId : consumerGroup.groupIds()) {
/* 143 */ Matcher matcher = pattern.matcher(groupId);
/* 144 */ if (matcher.find()) {
/* 145 */ String propertyKey = groupId.substring(2, groupId.length() - 1).trim();
/* 146 */ String propertyValue = this.environment.getProperty(propertyKey);
/* 147 */ if (!StringUtils.isEmpty(propertyValue)) {
/* 148 */ groupId = propertyValue;
/* */ }
/* */ }
/* 151 */ groupIds.add(groupId);
/* */ }
/* */
/* 154 */ return groupIds;
/* */ }
/* 156 */ return Lists.newArrayList((Object[])new String[] { this.defaultGroup });
/* */ }
/* */
/* */
/* */
/* */
/* */ private void initHandlerMapping() {
/* 163 */ if (CollectionUtils.isEmpty(this.eventHandlers)) {
/* */ return;
/* */ }
/* */
/* 167 */ isHandlerEnable = true;
/* */
/* 169 */ EventHandlerMapping eventHandlerMapping = new EventHandlerMapping();
/* */
/* 171 */ for (EventHandler<BaseEvent> handler : this.eventHandlers) {
/* 172 */ if (handler.getClass().isAnnotationPresent((Class)EventTopicSuffix.class)) {
/* 173 */ Type type = handler.getClass().getGenericInterfaces()[0];
/* 174 */ ParameterizedType p = (ParameterizedType)type;
/* 175 */ Class<BaseEvent> eventClass = (Class)p.getActualTypeArguments()[0];
/* 176 */ EventTopicSuffix eventTopicSuffix = handler.getClass().<EventTopicSuffix>getAnnotation(EventTopicSuffix.class);
/* */
/* 178 */ registerHandlerMapping(eventHandlerMapping, handler, eventClass, eventTopicSuffix.value()); continue;
/* 179 */ } if (handler.getClass().isAnnotationPresent((Class)CustomTopic.class)) {
/* 180 */ CustomTopic customTopic = handler.getClass().<CustomTopic>getAnnotation(CustomTopic.class);
/* 181 */ String topic = customTopic.topic();
/* 182 */ if (StringUtils.isEmpty(topic)) {
/* */ continue;
/* */ }
/* 185 */ registerCustomHandlerMapping(eventHandlerMapping, (EventHandler)handler, topic, customTopic.suffix());
/* */ }
/* */ }
/* 188 */ this.cloudwalkEventManager.setEventHandlerMapping(eventHandlerMapping);
/* */ }
/* */
/* */
/* */
/* */
/* */ private void initHandlerExecutor() {
/* 195 */ if (isHandlerEnable) {
/* 196 */ EventHandlerWorker eventHandlerWorker = new EventHandlerWorker();
/* 197 */ EventProperties.HandlerExecutorConfig handlerExecutorConfig = this.eventProperties.getHandlerExecutorConfig();
/* 198 */ eventHandlerWorker.setPoolExecutor(new ThreadPoolExecutor(handlerExecutorConfig.getCorePoolSize().intValue(), handlerExecutorConfig
/* 199 */ .getMaximumPoolSize().intValue(), 1000L, TimeUnit.MILLISECONDS, new SynchronousQueue<>(), (ThreadFactory)new NamedThreadFactory(this.eventProperties
/* 200 */ .getWorkerNamePrefix()), new ThreadPoolExecutor.CallerRunsPolicy()));
/* 201 */ this.cloudwalkEventManager.setEventHandlerWorker(eventHandlerWorker);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private EventType getEventType(Class<? extends BaseEvent> eventClass) {
/* 212 */ for (EventType eventType : EventType.values()) {
/* 213 */ if (eventType.getEventClass().getClass().equals(eventClass)) {
/* 214 */ return eventType;
/* */ }
/* */ }
/* 217 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */ private void subscribeEvent() throws IllegalAccessException, InstantiationException {
/* 224 */ EventHandlerMapping eventHandlerMapping = this.cloudwalkEventManager.getEventHandlerMapping();
/* */
/* 226 */ Map<String, Map<EventType, Set<String>>> subscribedMap = new HashMap<>();
/* */
/* 228 */ for (Map.Entry<String, Map<EventType, Map<String, List<EventHandler>>>> entry : (Iterable<Map.Entry<String, Map<EventType, Map<String, List<EventHandler>>>>>)eventHandlerMapping.getHandlerMap().entrySet()) {
/* 229 */ for (Map.Entry<EventType, Map<String, List<EventHandler>>> eventTypeMapEntry : (Iterable<Map.Entry<EventType, Map<String, List<EventHandler>>>>)((Map)entry.getValue()).entrySet()) {
/* 230 */ for (String serviceCode : ((Map)eventTypeMapEntry.getValue()).keySet()) {
/* 231 */ subscribe(subscribedMap, entry.getKey(), eventTypeMapEntry.getKey(), serviceCode);
/* */ }
/* */ }
/* */ }
/* */
/* 236 */ Map<String, Map<String, Set<String>>> customSubscribedMap = new HashMap<>();
/* */
/* 238 */ for (Map.Entry<String, Map<String, Map<String, List<CustomEventHandler>>>> entry : (Iterable<Map.Entry<String, Map<String, Map<String, List<CustomEventHandler>>>>>)eventHandlerMapping.getCustomHandlerMap().entrySet()) {
/* 239 */ for (Map.Entry<String, Map<String, List<CustomEventHandler>>> subEntry : (Iterable<Map.Entry<String, Map<String, List<CustomEventHandler>>>>)((Map)entry.getValue()).entrySet()) {
/* 240 */ for (Map.Entry<String, List<CustomEventHandler>> handlerEntry : (Iterable<Map.Entry<String, List<CustomEventHandler>>>)((Map)subEntry.getValue()).entrySet()) {
/* 241 */ for (CustomEventHandler customEventHandler : handlerEntry.getValue()) {
/* 242 */ Type type = customEventHandler.getClass().getGenericInterfaces()[0];
/* 243 */ ParameterizedType p = (ParameterizedType)type;
/* 244 */ Class<? extends CustomEvent> eventClass = (Class)p.getActualTypeArguments()[0];
/* 245 */ customSubscribe(customSubscribedMap, entry.getKey(), subEntry.getKey(), handlerEntry
/* 246 */ .getKey(), eventClass);
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void subscribe(Map<String, Map<EventType, Set<String>>> subscribedMap, String groupId, EventType eventType, String serviceCode) {
/* 265 */ if (StringUtils.isEmpty(groupId)) {
/* 266 */ groupId = this.defaultGroup;
/* */ }
/* */
/* 269 */ Map<EventType, Set<String>> eventTypeServiceCodeMap = subscribedMap.get(groupId);
/* 270 */ if (null != eventTypeServiceCodeMap) {
/* 271 */ Set<String> serviceCodesSet = eventTypeServiceCodeMap.get(eventType);
/* 272 */ if (CollectionUtils.isEmpty(serviceCodesSet)) {
/* 273 */ eventTypeServiceCodeMap.put(eventType, Sets.newHashSet((Object[])new String[] { serviceCode }));
/* */ } else {
/* 275 */ serviceCodesSet.add(serviceCode);
/* */ }
/* */ } else {
/* 278 */ eventTypeServiceCodeMap = new HashMap<>();
/* 279 */ eventTypeServiceCodeMap.put(eventType, Sets.newHashSet((Object[])new String[] { serviceCode }));
/* 280 */ subscribedMap.put(groupId, eventTypeServiceCodeMap);
/* */ }
/* 282 */ ((EventClient)this.eventClientMap.get(groupId)).subEvent(eventType, serviceCode);
/* */ }
/* */
/* */
/* */
/* */ private void customSubscribe(Map<String, Map<String, Set<String>>> customSubscribedMap, String groupId, String topic, String serviceCode, Class<? extends CustomEvent> eventClass) throws IllegalAccessException, InstantiationException {
/* 288 */ if (StringUtils.isEmpty(groupId)) {
/* 289 */ groupId = this.defaultGroup;
/* */ }
/* */
/* 292 */ Map<String, Set<String>> topicServiceCodeMap = customSubscribedMap.get(groupId);
/* 293 */ if (null != topicServiceCodeMap) {
/* 294 */ Set<String> serviceCodesSet = topicServiceCodeMap.get(topic);
/* 295 */ if (CollectionUtils.isEmpty(serviceCodesSet)) {
/* 296 */ topicServiceCodeMap.put(topic, Sets.newHashSet((Object[])new String[] { serviceCode }));
/* */ } else {
/* 298 */ serviceCodesSet.add(serviceCode);
/* */ }
/* */ } else {
/* 301 */ topicServiceCodeMap = new HashMap<>();
/* 302 */ topicServiceCodeMap.put(topic, Sets.newHashSet((Object[])new String[] { serviceCode }));
/* 303 */ customSubscribedMap.put(groupId, topicServiceCodeMap);
/* */ }
/* 305 */ EventClient eventClient = this.eventClientMap.get(groupId);
/* 306 */ if (null == eventClient) {
/* 307 */ throw new IllegalArgumentException(String.format("没有找到groupId[%s]对应的配置,请检查 ${cloudwalk.event.group-id} 配置", new Object[] { groupId }));
/* */ }
/* */
/* 310 */ eventClient.subEvent(topic, serviceCode, eventClass.newInstance());
/* */ }
/* */
/* */
/* */
/* */ private void initEventClient(String bootstrapServers, String groupId, Class<? extends EventListener> listenerClass, boolean isDefault) {
/* 316 */ EventClient eventClient = this.eventClientMap.get(groupId);
/* */
/* 318 */ if (null == eventClient) {
/* 319 */ eventClient = EventClient.getInstance(bootstrapServers, groupId);
/* 320 */ eventClient.init();
/* 321 */ if (null != this.eventProperties.getFetchDataWorkerNumber()) {
/* 322 */ eventClient.setWorkNum(this.eventProperties.getFetchDataWorkerNumber());
/* */ }
/* 324 */ eventClient.setListenerClass(listenerClass);
/* */
/* 326 */ this.eventClientMap.put(groupId, eventClient);
/* */ }
/* */
/* 329 */ if (isDefault) {
/* 330 */ this.defaultGroup = groupId;
/* 331 */ this.defaultEventClient = eventClient;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private <E extends BaseEvent> void registerHandlerMapping(EventHandlerMapping eventHandlerMapping, EventHandler<E> handler, Class<E> eventClass, String[] suffixes) {
/* 349 */ List<String> groupIds = extractGroupIds(handler);
/* 350 */ EventType eventType = getEventType(eventClass);
/* */
/* 352 */ for (String groupId : groupIds) {
/* 353 */ Map<String, List<EventHandler>> handlers = eventHandlerMapping.getServiceCodeHandlerListMap(groupId, eventType);
/* */
/* 355 */ if (CollectionUtils.isEmpty(handlers)) {
/* 356 */ handlers = new HashMap<>();
/* 357 */ if (null == suffixes || suffixes.length == 0) {
/* 358 */ handlers.put("", Lists.newArrayList((Object[])new EventHandler[] { handler }));
/* */ } else {
/* 360 */ for (String suffix : suffixes) {
/* 361 */ handlers.put(suffix, Lists.newArrayList((Object[])new EventHandler[] { handler }));
/* */ }
/* */ }
/* */
/* 365 */ eventHandlerMapping.registerHandlers(groupId, eventType, handlers); continue;
/* */ }
/* 367 */ if (null == suffixes || suffixes.length == 0) {
/* 368 */ List<EventHandler> currentHandlers = handlers.get("");
/* 369 */ if (CollectionUtils.isEmpty(currentHandlers)) {
/* 370 */ currentHandlers = new ArrayList<>();
/* */ }
/* 372 */ currentHandlers.add(handler);
/* 373 */ handlers.put("", currentHandlers); continue;
/* */ }
/* 375 */ for (String suffix : suffixes) {
/* 376 */ List<EventHandler> currentHandlers = handlers.get(suffix);
/* 377 */ if (CollectionUtils.isEmpty(currentHandlers)) {
/* 378 */ currentHandlers = new ArrayList<>();
/* */ }
/* 380 */ currentHandlers.add(handler);
/* 381 */ handlers.put(suffix, currentHandlers);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ private void registerCustomHandlerMapping(EventHandlerMapping eventHandlerMapping, EventHandler<? extends CustomEvent> handler, String topic, String serviceCode) {
/* 392 */ List<String> groupIds = extractGroupIds(handler);
/* */
/* 394 */ for (String groupId : groupIds) {
/* */
/* */
/* 397 */ Map<String, List<CustomEventHandler>> customHandlers = eventHandlerMapping.getServiceCodeCustomHandlerListMap(groupId, topic);
/* */
/* 399 */ if (null == customHandlers) {
/* 400 */ customHandlers = new HashMap<>();
/* 401 */ if (StringUtils.isEmpty(topic)) {
/* 402 */ customHandlers.put("", Lists.newArrayList((Object[])new CustomEventHandler[] { (CustomEventHandler)handler }));
/* */ } else {
/* 404 */ customHandlers.put(serviceCode, Lists.newArrayList((Object[])new CustomEventHandler[] { (CustomEventHandler)handler }));
/* */ }
/* 406 */ eventHandlerMapping.registerCustomHandlers(groupId, topic, customHandlers); continue;
/* */ }
/* 408 */ if (StringUtils.isEmpty(serviceCode)) {
/* 409 */ List<CustomEventHandler> list = customHandlers.get("");
/* 410 */ if (CollectionUtils.isEmpty(list)) {
/* 411 */ list = new ArrayList<>();
/* */ }
/* 413 */ list.add((CustomEventHandler)handler);
/* 414 */ customHandlers.put("", list); continue;
/* */ }
/* 416 */ List<CustomEventHandler> currentHandlers = customHandlers.get(serviceCode);
/* 417 */ if (CollectionUtils.isEmpty(currentHandlers)) {
/* 418 */ currentHandlers = new ArrayList<>();
/* */ }
/* 420 */ currentHandlers.add((CustomEventHandler)handler);
/* 421 */ customHandlers.put(serviceCode, currentHandlers);
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\CloudwalkEventInitializing.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,112 @@
/* */ package cn.cloudwalk.event;
/* */
/* */ import cn.cloudwalk.cwos.client.event.EventClient;
/* */ import cn.cloudwalk.cwos.client.event.event.BaseEvent;
/* */ import cn.cloudwalk.cwos.client.event.event.CustomEvent;
/* */ import cn.cloudwalk.event.handler.CustomEventHandler;
/* */ import cn.cloudwalk.event.handler.EventHandler;
/* */ import cn.cloudwalk.event.handler.EventHandlerMapping;
/* */ import cn.cloudwalk.event.handler.EventHandlerWorker;
/* */ import cn.cloudwalk.event.listener.GroupEventListener;
/* */ import cn.cloudwalk.event.listener.GroupListnerClassMapping;
/* */ import cn.cloudwalk.event.task.EventHandleTask;
/* */ import java.util.List;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */ import org.springframework.util.CollectionUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class CloudwalkEventManager
/* */ {
/* 30 */ private static final Logger LOGGER = LoggerFactory.getLogger(CloudwalkEventManager.class);
/* */
/* */
/* */
/* */ private EventHandlerMapping eventHandlerMapping;
/* */
/* */
/* */ private EventHandlerWorker eventHandlerWorker;
/* */
/* */
/* */ private GroupListnerClassMapping groupListnerClassMapping;
/* */
/* */
/* */ private EventClient eventClient;
/* */
/* */
/* */
/* */ public void handle(Class<? extends GroupEventListener> eventListnerClass, BaseEvent baseEvent) {
/* 48 */ String groupId = this.groupListnerClassMapping.getGroupId(eventListnerClass);
/* */
/* 50 */ if (baseEvent instanceof CustomEvent) {
/* */
/* */
/* 53 */ List<CustomEventHandler> customEventHandlers = (List<CustomEventHandler>)this.eventHandlerMapping.getServiceCodeCustomHandlerListMap(groupId, ((CustomEvent)baseEvent).getTopic()).get(baseEvent.getServiceCode());
/* 54 */ eventHandle(baseEvent, customEventHandlers);
/* */
/* */ return;
/* */ }
/* */
/* 59 */ List<EventHandler> handlerList = (List<EventHandler>)this.eventHandlerMapping.getServiceCodeHandlerListMap(groupId, baseEvent.getClass()).get(baseEvent.getServiceCode());
/* 60 */ eventHandle(baseEvent, handlerList);
/* */ }
/* */
/* */ private <H extends EventHandler> void eventHandle(BaseEvent baseEvent, List<H> handlers) {
/* 64 */ if (CollectionUtils.isEmpty(handlers)) {
/* 65 */ LOGGER.error("没有相应的事件处理程序");
/* */ return;
/* */ }
/* 68 */ for (EventHandler eventHandler : handlers) {
/* 69 */ this.eventHandlerWorker.work(new EventHandleTask(baseEvent, eventHandler));
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void publish(BaseEvent baseEvent) {
/* 79 */ this.eventClient.pubEvent(baseEvent);
/* */ }
/* */
/* */ public void setEventHandlerMapping(EventHandlerMapping eventHandlerMapping) {
/* 83 */ this.eventHandlerMapping = eventHandlerMapping;
/* */ }
/* */
/* */ public EventHandlerMapping getEventHandlerMapping() {
/* 87 */ return this.eventHandlerMapping;
/* */ }
/* */
/* */ public void setEventHandlerWorker(EventHandlerWorker eventHandlerWorker) {
/* 91 */ this.eventHandlerWorker = eventHandlerWorker;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void setEventClient(EventClient eventClient) {
/* 100 */ this.eventClient = eventClient;
/* */ }
/* */
/* */ public void setGroupListnerClassMapping(GroupListnerClassMapping groupListnerClassMapping) {
/* 104 */ this.groupListnerClassMapping = groupListnerClassMapping;
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\CloudwalkEventManager.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,21 @@
package cn.cloudwalk.event;
import cn.cloudwalk.event.autoconfig.EventConfiguration;
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;
import org.springframework.context.annotation.Import;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import({EventConfiguration.class})
public @interface EnableCloudwalkEvent {}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\EnableCloudwalkEvent.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,20 @@
package cn.cloudwalk.event.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;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ConsumerGroup {
String[] groupIds() default {};
}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\annotation\ConsumerGroup.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,25 @@
package cn.cloudwalk.event.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;
import org.springframework.core.annotation.AliasFor;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EventTopicSuffix
public @interface CustomTopic {
String topic();
@AliasFor(annotation = EventTopicSuffix.class)
String suffix() default "";
}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\annotation\CustomTopic.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,25 @@
package cn.cloudwalk.event.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;
import org.springframework.core.annotation.AliasFor;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface EventTopicSuffix {
@AliasFor(attribute = "suffix")
String[] value() default {};
@AliasFor(attribute = "value")
String[] suffix() default {};
}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\annotation\EventTopicSuffix.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,35 @@
/* */ package cn.cloudwalk.event.autoconfig;
/* */
/* */ import cn.cloudwalk.event.CloudwalkEventInitializing;
/* */ import cn.cloudwalk.event.CloudwalkEventManager;
/* */ import org.springframework.boot.context.properties.EnableConfigurationProperties;
/* */ import org.springframework.context.annotation.Bean;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @EnableConfigurationProperties({EventProperties.class})
/* */ public class EventConfiguration
/* */ {
/* */ @Bean
/* */ public CloudwalkEventManager cloudwalkEventManager() {
/* 22 */ return new CloudwalkEventManager();
/* */ }
/* */
/* */ @Bean
/* */ public CloudwalkEventInitializing CloudwalkEventInitializing(EventProperties eventProperties) {
/* 27 */ return new CloudwalkEventInitializing(eventProperties);
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\autoconfig\EventConfiguration.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,131 @@
/* */ package cn.cloudwalk.event.autoconfig;
/* */
/* */ import java.util.Map;
/* */ import org.springframework.boot.context.properties.ConfigurationProperties;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @ConfigurationProperties(prefix = "cloudwalk.event")
/* */ public class EventProperties
/* */ {
/* */ protected static final String CONF_PREFIX = "cloudwalk.event";
/* */ private String bootstrapServers;
/* */ private String groupId;
/* */ private Map<String, String> listenerClass;
/* */ private Integer fetchDataWorkerNumber;
/* */ private String workerNamePrefix;
/* 49 */ private HandlerExecutorConfig handlerExecutorConfig = new HandlerExecutorConfig(Integer.valueOf(5), Integer.valueOf(10));
/* */
/* */ public static class HandlerExecutorConfig
/* */ {
/* */ private Integer corePoolSize;
/* */ private Integer maximumPoolSize;
/* */
/* */ public HandlerExecutorConfig(Integer corePoolSize, Integer maximumPoolSize) {
/* 57 */ this.corePoolSize = corePoolSize;
/* 58 */ this.maximumPoolSize = maximumPoolSize;
/* */ }
/* */
/* */ public Integer getCorePoolSize() {
/* 62 */ return this.corePoolSize;
/* */ }
/* */
/* */ public void setCorePoolSize(Integer corePoolSize) {
/* 66 */ this.corePoolSize = corePoolSize;
/* */ }
/* */
/* */ public Integer getMaximumPoolSize() {
/* 70 */ return this.maximumPoolSize;
/* */ }
/* */
/* */ public void setMaximumPoolSize(Integer maximumPoolSize) {
/* 74 */ this.maximumPoolSize = maximumPoolSize;
/* */ }
/* */ }
/* */
/* */ public String getBootstrapServers() {
/* 79 */ return this.bootstrapServers;
/* */ }
/* */
/* */ public void setBootstrapServers(String bootstrapServers) {
/* 83 */ this.bootstrapServers = bootstrapServers;
/* */ }
/* */
/* */ public String getGroupId() {
/* 87 */ return this.groupId;
/* */ }
/* */
/* */ public void setGroupId(String groupId) {
/* 91 */ this.groupId = groupId;
/* */ }
/* */
/* */ public Map<String, String> getListenerClass() {
/* 95 */ return this.listenerClass;
/* */ }
/* */
/* */ public void setListenerClass(Map<String, String> listenerClass) {
/* 99 */ this.listenerClass = listenerClass;
/* */ }
/* */
/* */ public Integer getFetchDataWorkerNumber() {
/* 103 */ return this.fetchDataWorkerNumber;
/* */ }
/* */
/* */ public void setFetchDataWorkerNumber(Integer fetchDataWorkerNumber) {
/* 107 */ this.fetchDataWorkerNumber = fetchDataWorkerNumber;
/* */ }
/* */
/* */ public HandlerExecutorConfig getHandlerExecutorConfig() {
/* 111 */ return this.handlerExecutorConfig;
/* */ }
/* */
/* */ public void setHandlerExecutorConfig(HandlerExecutorConfig handlerExecutorConfig) {
/* 115 */ this.handlerExecutorConfig = handlerExecutorConfig;
/* */ }
/* */
/* */ public String getWorkerNamePrefix() {
/* 119 */ return this.workerNamePrefix;
/* */ }
/* */
/* */ public void setWorkerNamePrefix(String workerNamePrefix) {
/* 123 */ this.workerNamePrefix = workerNamePrefix;
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\autoconfig\EventProperties.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,63 @@
/* */ package cn.cloudwalk.event.client;
/* */
/* */ import cn.cloudwalk.cwos.client.event.event.EventType;
/* */ import cn.cloudwalk.event.handler.EventHandler;
/* */ import java.util.List;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class EventSubscribeHandlers
/* */ {
/* */ private EventType eventType;
/* */ private String serviceCode;
/* */ private List<EventHandler> eventHandlerList;
/* */
/* */ public EventType getEventType() {
/* 35 */ return this.eventType;
/* */ }
/* */
/* */ public void setEventType(EventType eventType) {
/* 39 */ this.eventType = eventType;
/* */ }
/* */
/* */ public String getServiceCode() {
/* 43 */ return this.serviceCode;
/* */ }
/* */
/* */ public void setServiceCode(String serviceCode) {
/* 47 */ this.serviceCode = serviceCode;
/* */ }
/* */
/* */ public List<EventHandler> getEventHandlerList() {
/* 51 */ return this.eventHandlerList;
/* */ }
/* */
/* */ public void setEventHandlerList(List<EventHandler> eventHandlerList) {
/* 55 */ this.eventHandlerList = eventHandlerList;
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\client\EventSubscribeHandlers.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,9 @@
package cn.cloudwalk.event.handler;
public interface CustomEventHandler<E extends cn.cloudwalk.cwos.client.event.event.CustomEvent> extends EventHandler<E> {}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\handler\CustomEventHandler.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,11 @@
package cn.cloudwalk.event.handler;
public interface EventHandler<E extends cn.cloudwalk.cwos.client.event.event.BaseEvent> {
void onEvent(E paramE);
}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\handler\EventHandler.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,126 @@
/* */ package cn.cloudwalk.event.handler;
/* */
/* */ import cn.cloudwalk.cwos.client.event.event.BaseEvent;
/* */ import cn.cloudwalk.cwos.client.event.event.EventType;
/* */ import cn.cloudwalk.cwos.client.event.handler.EventListener;
/* */ import java.util.HashMap;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class EventHandlerMapping
/* */ {
/* 26 */ private final Map<String, Map<EventType, Map<String, List<EventHandler>>>> handlerMap = new HashMap<>();
/* */
/* */
/* */
/* */
/* */
/* 32 */ private final Map<String, Map<String, Map<String, List<CustomEventHandler>>>> customHandlerMap = new HashMap<>();
/* */
/* */
/* */
/* */
/* */
/* 38 */ private final Map<Class<? extends EventListener>, String> listenerClassGroupMap = new HashMap<>();
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void registerHandlers(String groupId, EventType eventType, Map<String, List<EventHandler>> handlers) {
/* 48 */ Map<EventType, Map<String, List<EventHandler>>> map = this.handlerMap.get(groupId);
/* 49 */ if (null == map) {
/* 50 */ map = new HashMap<>();
/* 51 */ map.put(eventType, handlers);
/* 52 */ this.handlerMap.put(groupId, map);
/* */ } else {
/* 54 */ map.put(eventType, handlers);
/* */ }
/* */ }
/* */
/* */
/* */ public Map<String, List<EventHandler>> getServiceCodeHandlerListMap(String groupId, Class<? extends BaseEvent> eventClass) {
/* 60 */ for (EventType eventType : EventType.values()) {
/* 61 */ if (eventType.getEventClass().getClass().equals(eventClass)) {
/* 62 */ return getServiceCodeHandlerListMap(groupId, eventType);
/* */ }
/* */ }
/* 65 */ throw new IllegalArgumentException("没有找到合适的事件类型");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Map<String, List<EventHandler>> getServiceCodeHandlerListMap(String groupId, EventType eventType) {
/* 76 */ Map<EventType, Map<String, List<EventHandler>>> map = this.handlerMap.get(groupId);
/* 77 */ if (null != map) {
/* 78 */ return map.get(eventType);
/* */ }
/* 80 */ return null;
/* */ }
/* */
/* */ public Map<String, List<CustomEventHandler>> getServiceCodeCustomHandlerListMap(String groupId, String topic) {
/* 84 */ Map<String, Map<String, List<CustomEventHandler>>> map = this.customHandlerMap.get(groupId);
/* 85 */ if (null != map) {
/* 86 */ return map.get(topic);
/* */ }
/* 88 */ return null;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void registerCustomHandlers(String groupId, String topic, Map<String, List<CustomEventHandler>> handlers) {
/* 99 */ Map<String, Map<String, List<CustomEventHandler>>> map = this.customHandlerMap.get(groupId);
/* 100 */ if (null == map) {
/* 101 */ map = new HashMap<>();
/* 102 */ map.put(topic, handlers);
/* 103 */ this.customHandlerMap.put(groupId, map);
/* */ } else {
/* 105 */ map.put(topic, handlers);
/* */ }
/* */ }
/* */
/* */ public Map<String, Map<EventType, Map<String, List<EventHandler>>>> getHandlerMap() {
/* 110 */ return this.handlerMap;
/* */ }
/* */
/* */ public Map<String, Map<String, Map<String, List<CustomEventHandler>>>> getCustomHandlerMap() {
/* 114 */ return this.customHandlerMap;
/* */ }
/* */
/* */ public Map<Class<? extends EventListener>, String> getListenerClassGroupMap() {
/* 118 */ return this.listenerClassGroupMap;
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\handler\EventHandlerMapping.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,41 @@
/* */ package cn.cloudwalk.event.handler;
/* */
/* */ import cn.cloudwalk.event.task.EventHandleTask;
/* */ import java.util.concurrent.Callable;
/* */ import java.util.concurrent.Future;
/* */ import java.util.concurrent.ThreadPoolExecutor;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class EventHandlerWorker
/* */ {
/* */ private ThreadPoolExecutor poolExecutor;
/* */
/* */ public void setPoolExecutor(ThreadPoolExecutor poolExecutor) {
/* 24 */ this.poolExecutor = poolExecutor;
/* */ }
/* */
/* */ public Future<String> work(final EventHandleTask task) {
/* 28 */ return this.poolExecutor.submit(new Callable<String>()
/* */ {
/* */ public String call() throws Exception {
/* 31 */ return task.start();
/* */ }
/* */ });
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\handler\EventHandlerWorker.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,62 @@
/* */ package cn.cloudwalk.event.handler;
/* */
/* */ import java.util.concurrent.ThreadFactory;
/* */ import java.util.concurrent.atomic.AtomicInteger;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class NamedThreadFactory
/* */ implements ThreadFactory
/* */ {
/* */ private static final String DEFAULT_POOL_NAME = "cloudwalk-common-event";
/* 19 */ protected static final AtomicInteger POOL_SEQ = new AtomicInteger(1);
/* */
/* 21 */ private final AtomicInteger threadNumber = new AtomicInteger(1);
/* */
/* */
/* */ private final String namePrefix;
/* */
/* */
/* */ private final ThreadGroup threadGroup;
/* */
/* */
/* */ public NamedThreadFactory() {
/* 31 */ this("cloudwalk-common-event");
/* */ }
/* */
/* */ public NamedThreadFactory(String namePrefix) {
/* 35 */ SecurityManager s = System.getSecurityManager();
/* 36 */ this.threadGroup = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
/* 37 */ if (null == namePrefix || "".equals(namePrefix.trim())) {
/* 38 */ namePrefix = "cloudwalk-common-event";
/* */ }
/* 40 */ this.namePrefix = namePrefix + "-" + POOL_SEQ.getAndIncrement() + "-thread-";
/* */ }
/* */
/* */
/* */
/* */ public Thread newThread(Runnable r) {
/* 46 */ Thread t = new Thread(this.threadGroup, r, this.namePrefix + this.threadNumber.getAndIncrement(), 0L);
/* */
/* 48 */ if (t.isDaemon()) {
/* 49 */ t.setDaemon(false);
/* */ }
/* 51 */ if (t.getPriority() != 5) {
/* 52 */ t.setPriority(5);
/* */ }
/* 54 */ return t;
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\handler\NamedThreadFactory.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,9 @@
package cn.cloudwalk.event.listener;
public class CloudwalkEventListener extends GroupEventListener {}
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\listener\CloudwalkEventListener.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,41 @@
/* */ package cn.cloudwalk.event.listener;
/* */
/* */ import cn.cloudwalk.cwos.client.event.event.BaseEvent;
/* */ import cn.cloudwalk.cwos.client.event.handler.EventListener;
/* */ import cn.cloudwalk.event.CloudwalkEventManager;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */ import org.springframework.context.ApplicationContext;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract class GroupEventListener
/* */ implements EventListener
/* */ {
/* */ public static ApplicationContext applicationContext;
/* 23 */ private static final Logger LOGGER = LoggerFactory.getLogger(CloudwalkEventListener.class);
/* */
/* */
/* */ public void messageListener(BaseEvent baseEvent) throws RuntimeException {
/* */ try {
/* 28 */ CloudwalkEventManager cloudwalkEventManager = (CloudwalkEventManager)applicationContext.getBean(CloudwalkEventManager.class);
/* 29 */ cloudwalkEventManager.handle(getClass(), baseEvent);
/* 30 */ } catch (Exception e) {
/* 31 */ LOGGER.error("事件处理出现异常,原因:", e);
/* 32 */ throw new RuntimeException(e);
/* */ }
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\listener\GroupEventListener.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,42 @@
/* */ package cn.cloudwalk.event.listener;
/* */
/* */ import cn.cloudwalk.cwos.client.event.handler.EventListener;
/* */ import java.util.HashMap;
/* */ import java.util.Map;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class GroupListnerClassMapping
/* */ {
/* 23 */ private final Map<Class<? extends EventListener>, String> mapping = new HashMap<>();
/* */
/* */ public void register(Class<? extends EventListener> eventListnerClass, String groupId) {
/* 26 */ if (this.mapping.containsKey(eventListnerClass)) {
/* 27 */ throw new IllegalArgumentException(String.format("eventListnerClass[%s]已经存在,不允许重复", new Object[] { eventListnerClass
/* 28 */ .toString() }));
/* */ }
/* 30 */ this.mapping.put(eventListnerClass, groupId);
/* */ }
/* */
/* */ public String getGroupId(Class<? extends EventListener> eventListnerClass) {
/* 34 */ return this.mapping.get(eventListnerClass);
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\listener\GroupListnerClassMapping.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/
@@ -0,0 +1,58 @@
/* */ package cn.cloudwalk.event.task;
/* */
/* */ import cn.cloudwalk.cwos.client.event.event.BaseEvent;
/* */ import cn.cloudwalk.event.handler.EventHandler;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class EventHandleTask<E extends BaseEvent>
/* */ {
/* */ private E event;
/* */ private EventHandler<E> handler;
/* */
/* */ public EventHandleTask(E event, EventHandler<E> handler) {
/* 28 */ this.event = event;
/* 29 */ this.handler = handler;
/* */ }
/* */
/* */ public String start() {
/* 33 */ this.handler.onEvent((BaseEvent)this.event);
/* 34 */ return this.event.getMessageId();
/* */ }
/* */
/* */ public E getEvent() {
/* 38 */ return this.event;
/* */ }
/* */
/* */ public void setEvent(E event) {
/* 42 */ this.event = event;
/* */ }
/* */
/* */ public EventHandler<E> getHandler() {
/* 46 */ return this.handler;
/* */ }
/* */
/* */ public void setHandler(EventHandler<E> handler) {
/* 50 */ this.handler = handler;
/* */ }
/* */ }
/* Location: D:\星中心\cw-elevator-application-V1.0.0.20211103\cw-elevator-application-V1.0.0.20211103\lib\cloudwalk-common-event-3.7.2-Brussels-SRX.jar!\cn\cloudwalk\event\task\EventHandleTask.class
* Java compiler version: 7 (51.0)
* JD-Core Version: 1.1.3
*/