2 * ================================================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ================================================================================
\r
20 package org.openecomp.portalapp.scheduler;
\r
22 import java.util.ArrayList;
\r
23 import java.util.List;
\r
25 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
\r
26 import org.openecomp.portalsdk.core.scheduler.Registerable;
\r
27 import org.openecomp.portalsdk.core.util.SystemProperties;
\r
28 import org.quartz.Trigger;
\r
29 import org.springframework.beans.factory.annotation.Autowired;
\r
30 import org.springframework.context.annotation.DependsOn;
\r
31 import org.springframework.stereotype.Component;
\r
34 @DependsOn({ "logRegistry", "systemProperties" })
\r
35 public class Register implements Registerable {
\r
37 EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class);
\r
39 private List<Trigger> scheduleTriggers = new ArrayList<Trigger>();
\r
40 Trigger trigger[] = new Trigger[1];
\r
43 private LogRegistry logRegistry;
\r
46 public Trigger[] getTriggers() {
\r
47 return getScheduleTriggers().toArray(trigger);
\r
51 public void registerTriggers() {
\r
52 // if the property value is not available; the cron will not be added
\r
53 // and can be ignored. its safe to ignore the exceptions
\r
55 if (SystemProperties.getProperty(SystemProperties.LOG_CRON) != null)
\r
56 getScheduleTriggers().add(logRegistry.getTrigger());
\r
57 } catch (IllegalStateException ies) {
\r
58 logger.info(EELFLoggerDelegate.debugLogger, ("Log Cron not available"));
\r
63 public List<Trigger> getScheduleTriggers() {
\r
64 return scheduleTriggers;
\r
67 public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
\r
68 this.scheduleTriggers = scheduleTriggers;
\r