You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/11 07:02:17 UTC

[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a diff in pull request #2103: Support annotation job

TeslaCN commented on code in PR #2103:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/2103#discussion_r1045182407


##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/core/scanner/JobScannerConfiguration.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.elasticjob.lite.spring.core.scanner;
+
+import lombok.Getter;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
+import org.springframework.util.Assert;
+
+/**
+ * BeanDefinitionRegistryPostProcessor that searches recursively starting from a base package for interfaces.
+ *
+ */
+@Getter
+public class JobScannerConfiguration implements BeanDefinitionRegistryPostProcessor, InitializingBean {
+
+    private final String[] basePackages;
+
+    public JobScannerConfiguration(final String[] basePackages) {

Review Comment:
   This could be simplified by `@RequiredArgsConstructor`.



##########
elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-namespace/src/main/resources/META-INF/namespace/elasticjob.xsd:
##########
@@ -21,76 +21,87 @@
             xmlns:beans="http://www.springframework.org/schema/beans"
             targetNamespace="http://shardingsphere.apache.org/schema/elasticjob"
             elementFormDefault="qualified">
-    <xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
-    
+    <xsd:import namespace="http://www.springframework.org/schema/beans"
+                schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd"/>
+
+    <xsd:element name="job-scanner">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="beans:identifiedType">
+                    <xsd:attribute name="base-package" type="xsd:string" use="required"/>
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
     <xsd:element name="job">
         <xsd:complexType>
             <xsd:complexContent>
                 <xsd:extension base="beans:identifiedType">
                     <xsd:all>
                         <xsd:element ref="beans:props" minOccurs="0" />
                     </xsd:all>
-                    <xsd:attribute name="job-ref" type="xsd:string" />
-                    <xsd:attribute name="job-type" type="xsd:string" />
-                    <xsd:attribute name="registry-center-ref" type="xsd:string" use="required" />
-                    <xsd:attribute name="sharding-total-count" type="xsd:string" use="required" />
-                    <xsd:attribute name="cron" type="xsd:string" />
-                    <xsd:attribute name="time-zone" type="xsd:string" />
-                    <xsd:attribute name="sharding-item-parameters" type="xsd:string" />
-                    <xsd:attribute name="job-parameter" type="xsd:string" />
-                    <xsd:attribute name="monitor-execution" type="xsd:string" default="true" />
-                    <xsd:attribute name="max-time-diff-seconds" type="xsd:string" default="-1" />
-                    <xsd:attribute name="failover" type="xsd:string" default="false" />
-                    <xsd:attribute name="reconcile-interval-minutes" type="xsd:string" default="10" />
-                    <xsd:attribute name="misfire" type="xsd:string" default="true" />
-                    <xsd:attribute name="job-sharding-strategy-type" type="xsd:string" />
-                    <xsd:attribute name="job-executor-service-handler-type" type="xsd:string" />
-                    <xsd:attribute name="job-error-handler-type" type="xsd:string" />
-                    <xsd:attribute name="job-listener-types" type="xsd:string" />
-                    <xsd:attribute name="tracing-ref" type="xsd:string" />
-                    <xsd:attribute name="description" type="xsd:string" />
-                    <xsd:attribute name="disabled" type="xsd:string" default="false" />
-                    <xsd:attribute name="overwrite" type="xsd:string" default="false" />
-                    <xsd:attribute name="label" type="xsd:string" />
-                    <xsd:attribute name="static-sharding" type="xsd:string" default="false" />
+                    <xsd:attribute name="job-ref" type="xsd:string"/>
+                    <xsd:attribute name="job-type" type="xsd:string"/>
+                    <xsd:attribute name="registry-center-ref" type="xsd:string" use="required"/>
+                    <xsd:attribute name="sharding-total-count" type="xsd:string" use="required"/>
+                    <xsd:attribute name="cron" type="xsd:string"/>
+                    <xsd:attribute name="time-zone" type="xsd:string"/>
+                    <xsd:attribute name="sharding-item-parameters" type="xsd:string"/>
+                    <xsd:attribute name="job-parameter" type="xsd:string"/>
+                    <xsd:attribute name="monitor-execution" type="xsd:string" default="true"/>
+                    <xsd:attribute name="max-time-diff-seconds" type="xsd:string" default="-1"/>
+                    <xsd:attribute name="failover" type="xsd:string" default="false"/>
+                    <xsd:attribute name="reconcile-interval-minutes" type="xsd:string" default="10"/>
+                    <xsd:attribute name="misfire" type="xsd:string" default="true"/>
+                    <xsd:attribute name="job-sharding-strategy-type" type="xsd:string"/>
+                    <xsd:attribute name="job-executor-service-handler-type" type="xsd:string"/>
+                    <xsd:attribute name="job-error-handler-type" type="xsd:string"/>
+                    <xsd:attribute name="job-listener-types" type="xsd:string"/>
+                    <xsd:attribute name="tracing-ref" type="xsd:string"/>
+                    <xsd:attribute name="description" type="xsd:string"/>
+                    <xsd:attribute name="disabled" type="xsd:string" default="false"/>
+                    <xsd:attribute name="overwrite" type="xsd:string" default="false"/>
+                    <xsd:attribute name="label" type="xsd:string"/>
+                    <xsd:attribute name="static-sharding" type="xsd:string" default="false"/>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
     </xsd:element>
-    
+
     <xsd:element name="zookeeper">
         <xsd:complexType>
             <xsd:complexContent>
                 <xsd:extension base="beans:identifiedType">
-                    <xsd:attribute name="server-lists" type="xsd:string" use="required" />
-                    <xsd:attribute name="namespace" type="xsd:string" use="required" />
-                    <xsd:attribute name="base-sleep-time-milliseconds" type="xsd:string" />
-                    <xsd:attribute name="max-sleep-time-milliseconds" type="xsd:string" />
-                    <xsd:attribute name="max-retries" type="xsd:string" />
-                    <xsd:attribute name="session-timeout-milliseconds" type="xsd:string" />
-                    <xsd:attribute name="connection-timeout-milliseconds" type="xsd:string" />
-                    <xsd:attribute name="digest" type="xsd:string" />
+                    <xsd:attribute name="server-lists" type="xsd:string" use="required"/>
+                    <xsd:attribute name="namespace" type="xsd:string" use="required"/>
+                    <xsd:attribute name="base-sleep-time-milliseconds" type="xsd:string"/>
+                    <xsd:attribute name="max-sleep-time-milliseconds" type="xsd:string"/>
+                    <xsd:attribute name="max-retries" type="xsd:string"/>
+                    <xsd:attribute name="session-timeout-milliseconds" type="xsd:string"/>
+                    <xsd:attribute name="connection-timeout-milliseconds" type="xsd:string"/>
+                    <xsd:attribute name="digest" type="xsd:string"/>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
     </xsd:element>
-    
+
     <xsd:element name="rdb-tracing">
         <xsd:complexType>
             <xsd:complexContent>
                 <xsd:extension base="beans:identifiedType">
-                    <xsd:attribute name="data-source-ref" type="xsd:string" use="required" />
+                    <xsd:attribute name="data-source-ref" type="xsd:string" use="required"/>
                 </xsd:extension>
             </xsd:complexContent>
         </xsd:complexType>
     </xsd:element>
-    
+
     <xsd:element name="snapshot">
         <xsd:complexType>
             <xsd:complexContent>
                 <xsd:extension base="beans:identifiedType">
-                    <xsd:attribute name="registry-center-ref" type="xsd:string" use="required" />
-                    <xsd:attribute name="dump-port" type="xsd:string" use="required" />

Review Comment:
   Please revert these format changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org