2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.vid.scheduler;
23 import java.util.ArrayList;
24 import java.util.List;
26 import org.quartz.Trigger;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.context.annotation.DependsOn;
29 import org.springframework.stereotype.Component;
31 import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
32 import org.openecomp.portalsdk.core.scheduler.Registerable;
33 import org.openecomp.portalsdk.core.util.SystemProperties;
37 @DependsOn({"logRegistry", "myLoginsFeedRegistry", "systemProperties"})
38 public class Register implements Registerable {
40 EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class);
43 private List<Trigger> scheduleTriggers = new ArrayList<Trigger>();
44 Trigger trigger[] = new Trigger[1];
48 private LogRegistry logRegistry;
51 private MyLoginsFeedRegistry myLoginsFeedRegistry;
54 public Trigger[] getTriggers() {
55 return getScheduleTriggers().toArray(trigger);
59 public void registerTriggers() {
60 // if the property value is not available; the cron will not be added and can be ignored. its safe to ignore the exceptions
62 if(SystemProperties.getProperty(SystemProperties.LOG_CRON) != null)
63 getScheduleTriggers().add(logRegistry.getTrigger());
65 } catch(IllegalStateException ies) {
66 logger.info(EELFLoggerDelegate.errorLogger, ("Log Cron not available"));
70 if(SystemProperties.getProperty(SystemProperties.MYLOGINS_FEED_CRON) != null)
71 getScheduleTriggers().add(myLoginsFeedRegistry.getTrigger());
73 } catch(IllegalStateException ies) {
74 logger.info(EELFLoggerDelegate.errorLogger, ("MyLogins Cron not available"));
80 public List<Trigger> getScheduleTriggers() {
81 return scheduleTriggers;
84 public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
85 this.scheduleTriggers = scheduleTriggers;