001// Generated by delombok at Mon Oct 12 22:59:35 BST 2020 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020package org.apache.isis.extensions.commandreplay.secondary.config; 021 022import java.util.List; 023import javax.inject.Named; 024import javax.validation.constraints.NotNull; 025import org.springframework.core.annotation.Order; 026import org.springframework.stereotype.Service; 027import org.apache.isis.applib.annotation.OrderPrecedence; 028import org.apache.isis.core.config.IsisConfiguration; 029 030@Service 031@Named("isisExtensionsCommandReplaySecondary.SecondaryConfig") 032@Order(OrderPrecedence.MIDPOINT) 033public class SecondaryConfig { 034 @java.lang.SuppressWarnings("all") 035 private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(SecondaryConfig.class); 036 final String primaryUser; 037 final String primaryPassword; 038 final String primaryBaseUrlRestful; 039 final String primaryBaseUrlWicket; 040 final int batchSize; 041 final String quartzUser; 042 final List<String> quartzRoles; 043 044 public SecondaryConfig(@NotNull final IsisConfiguration isisConfiguration) { 045 final org.apache.isis.core.config.IsisConfiguration.Extensions.CommandReplay config = isisConfiguration.getExtensions().getCommandReplay(); 046 final org.apache.isis.core.config.IsisConfiguration.Extensions.CommandReplay.PrimaryAccess primaryAccess = config.getPrimaryAccess(); 047 primaryUser = primaryAccess.getUser().orElse(null); 048 primaryPassword = primaryAccess.getPassword().orElse(null); 049 primaryBaseUrlRestful = primaryAccess.getBaseUrlRestful().orElse(null); 050 primaryBaseUrlWicket = primaryAccess.getBaseUrlWicket().orElse(null); 051 batchSize = config.getBatchSize(); 052 quartzUser = config.getQuartzSession().getUser(); 053 quartzRoles = config.getQuartzSession().getRoles(); 054 } 055 056 public boolean isConfigured() { 057 return primaryUser != null && primaryPassword != null && primaryBaseUrlRestful != null && quartzUser != null && quartzRoles != null; 058 } 059 060 @java.lang.SuppressWarnings("all") 061 public String getPrimaryUser() { 062 return this.primaryUser; 063 } 064 065 @java.lang.SuppressWarnings("all") 066 public String getPrimaryPassword() { 067 return this.primaryPassword; 068 } 069 070 @java.lang.SuppressWarnings("all") 071 public String getPrimaryBaseUrlRestful() { 072 return this.primaryBaseUrlRestful; 073 } 074 075 @java.lang.SuppressWarnings("all") 076 public String getPrimaryBaseUrlWicket() { 077 return this.primaryBaseUrlWicket; 078 } 079 080 @java.lang.SuppressWarnings("all") 081 public int getBatchSize() { 082 return this.batchSize; 083 } 084 085 @java.lang.SuppressWarnings("all") 086 public String getQuartzUser() { 087 return this.quartzUser; 088 } 089 090 @java.lang.SuppressWarnings("all") 091 public List<String> getQuartzRoles() { 092 return this.quartzRoles; 093 } 094}