roryqi commented on code in PR #13801: URL: https://github.com/apache/gravitino/pull/13801#discussion_r4259352176
########## api/src/main/java/org/apache/gravitino/policy/TimeTrigger.java: ########## @@ -0,0 +1,125 @@ +/* + * 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.gravitino.policy; + +import com.google.common.base.Preconditions; +import java.util.Objects; +import java.util.regex.Pattern; +import javax.annotation.Nullable; +import org.apache.commons.lang3.StringUtils; + +/** + * Time-based policy trigger expressed as a Quartz cron. + * + * <p>{@code cronExpression} has either 6 fields ({@code seconds minutes hours day-of-month month + * day-of-week}) or 7 fields (optional trailing {@code year}). Time zone is the server default; this + * type does not carry a zone id. + * + * <p>{@link #validateCronExpression(String)} is a <strong>shape check</strong> only: field count + * plus allowed Quartz tokens. It does not enforce Quartz value ranges or cross-field rules. + */ +public final class TimeTrigger { + + /** Allowed charset / named tokens per Quartz cron field (shape only, not full Quartz parse). */ + private static final Pattern CRON_FIELD = Review Comment: Should u use lib instead of regrex expression? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
