Skip to content

Commit

Permalink
Split AppConstants and remove duplicate class (frankframework#5343)
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsm5 authored Sep 7, 2023
1 parent 4aabe11 commit 9885738
Show file tree
Hide file tree
Showing 43 changed files with 785 additions and 952 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public CmisBinding getCmisBinding() {
public CmisBinding createCmisBinding() {

//Make sure cmisbridge properties are defined
if(APP_CONSTANTS.getResolvedProperty(RepositoryConnectorFactory.CMIS_BRIDGE_PROPERTY_PREFIX+"url") == null)
if(APP_CONSTANTS.getProperty(RepositoryConnectorFactory.CMIS_BRIDGE_PROPERTY_PREFIX+"url") == null)
throw new CmisConnectionException("no bridge properties found");

CmisSessionBuilder sessionBuilder = new CmisSessionBuilder();
Expand All @@ -80,7 +80,7 @@ public CmisBinding createCmisBinding() {

//Remove set from the method name
String setter = firstCharToLower(method.getName().substring(3));
String value = APP_CONSTANTS.getResolvedProperty(RepositoryConnectorFactory.CMIS_BRIDGE_PROPERTY_PREFIX+setter);
String value = APP_CONSTANTS.getProperty(RepositoryConnectorFactory.CMIS_BRIDGE_PROPERTY_PREFIX+setter);
if(value == null)
continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class IbisCacheManager {

private IbisCacheManager() {
Configuration cacheManagerConfig = new Configuration();
String cacheDir = AppConstants.getInstance().getResolvedProperty(CACHE_DIR_KEY);
String cacheDir = AppConstants.getInstance().getProperty(CACHE_DIR_KEY);
if (StringUtils.isNotEmpty(cacheDir)) {
log.debug("setting cache directory to [{}]", cacheDir);
DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class ConfigurationUtils {
private static final AppConstants APP_CONSTANTS = AppConstants.getInstance();
private static final boolean CONFIG_AUTO_DB_CLASSLOADER = APP_CONSTANTS.getBoolean("configurations.database.autoLoad", false);
private static final boolean CONFIG_AUTO_FS_CLASSLOADER = APP_CONSTANTS.getBoolean("configurations.directory.autoLoad", false);
private static final String CONFIGURATIONS = APP_CONSTANTS.getResolvedProperty("configurations.names.application");
private static final String CONFIGURATIONS = APP_CONSTANTS.getProperty("configurations.names.application");
public static final String DEFAULT_CONFIGURATION_FILE = "Configuration.xml";

private static final String DUMMY_SELECT_QUERY = "SELECT COUNT(*) FROM IBISCONFIG";
Expand All @@ -96,9 +96,9 @@ public static boolean isConfigurationStubbed(ClassLoader classLoader) {

public static String getConfigurationFile(ClassLoader classLoader, String currentConfigurationName) {
String configFileKey = "configurations." + currentConfigurationName + ".configurationFile";
String configurationFile = AppConstants.getInstance(classLoader).getResolvedProperty(configFileKey);
String configurationFile = AppConstants.getInstance(classLoader).getProperty(configFileKey);
if (StringUtils.isEmpty(configurationFile) && classLoader != null) {
configurationFile = AppConstants.getInstance(classLoader.getParent()).getResolvedProperty(configFileKey);
configurationFile = AppConstants.getInstance(classLoader.getParent()).getProperty(configFileKey);
}
if (StringUtils.isEmpty(configurationFile)) {
configurationFile = DEFAULT_CONFIGURATION_FILE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class HostnamePropertySourcePostProcessor extends CustomPropertySourcePos
@Override
protected void convertProperties(Properties props) {
AppConstants appConstants = AppConstants.getInstance();
String hostname = appConstants.getResolvedProperty(HOSTNAME_PROPERTY);
String hostname = appConstants.getProperty(HOSTNAME_PROPERTY);
if (StringUtils.isEmpty(hostname)) {
hostname = Misc.getHostname();
appConstants.setProperty(HOSTNAME_PROPERTY, hostname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public abstract class ClassLoaderBase extends ClassLoader implements IConfigurat
protected Logger log = LogUtil.getLogger(this);
private ReportLevel reportLevel = ReportLevel.ERROR;

private String instanceName = AppConstants.getInstance().getResolvedProperty("instance.name");
private String instanceName = AppConstants.getInstance().getProperty("instance.name");
private String basePath = null;

private boolean allowCustomClasses = AppConstants.getInstance().getBoolean("configurations.allowCustomClasses", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void configure(IbisContext ibisContext, String configurationName) throws

if (directory == null) {
AppConstants appConstants = AppConstants.getInstance();
String configurationsDirectory = appConstants.getResolvedProperty("configurations.directory");
String configurationsDirectory = appConstants.getProperty("configurations.directory");
if (configurationsDirectory == null) {
throw new ClassLoaderException("Could not find property configurations.directory");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected String adjustFirstStringPart(String firstStringPart, PipeLineSession s
throw new PipeRunException(this, "Exception configuring dummy query sender", e);
}

String slotId = AppConstants.getInstance().getResolvedProperty("instance.name") + "/" + session.get("operation");
String slotId = AppConstants.getInstance().getProperty("instance.name") + "/" + session.get("operation");
String selectMessageKeyResult = null;
try {
selectMessageKeyResult = selectMessageKey(slotId, messageId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
public class EsbJmsListener extends JmsListener implements ITransactionRequirements {

private static final AppConstants APP_CONSTANTS = AppConstants.getInstance();
private final String MSGLOG_KEYS = APP_CONSTANTS.getResolvedProperty("msg.log.keys");
private final String MSGLOG_KEYS = APP_CONSTANTS.getProperty("msg.log.keys");

private @Getter MessageProtocol messageProtocol = null;
private @Getter boolean copyAEProperties = false;
Expand Down Expand Up @@ -100,7 +100,7 @@ private void configureXPathLogging() {
return;
}
for (String name : StringUtil.split(logKeys)) {
String xPath = APP_CONSTANTS.getResolvedProperty("msg.log.xPath." + name);
String xPath = APP_CONSTANTS.getProperty("msg.log.xPath." + name);
if(xPath != null)
xPathLogMap.put(name, xPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class FxfPropertySourcePostProcessor extends CustomPropertySourcePostProc
@Override
protected void convertProperties(Properties props) {
AppConstants appConstants = AppConstants.getInstance();
String fxfDir = appConstants.getResolvedProperty("fxf.dir");
String fxfDir = appConstants.getProperty("fxf.dir");
if (fxfDir == null) {
// Use default location, see was.policy too
fxfDir = System.getProperty("APPSERVER_ROOT_DIR");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public void configure() throws ConfigurationException {
super.configure();
AppConstants rootAppConstants = AppConstants.getInstance();
if (getDirection()==Direction.WRAP) {
instanceName = rootAppConstants.getResolvedProperty("instance.name");
instanceName = rootAppConstants.getProperty("instance.name");
if (StringUtils.isEmpty(instanceName)) {
throw new ConfigurationException("instance.name not available");
}
instanceNameLowerCase = rootAppConstants.getResolvedProperty("instance.name.lc");
instanceNameLowerCase = rootAppConstants.getProperty("instance.name.lc");
if (StringUtils.isEmpty(instanceNameLowerCase)) {
throw new ConfigurationException("instance.name.lc not available");
}
environment = rootAppConstants.getResolvedProperty("dtap.stage");
environment = rootAppConstants.getProperty("dtap.stage");
if (StringUtils.isEmpty(environment) || environment.length() < 1) {
throw new ConfigurationException("dtap.stage not available");
}
Expand All @@ -116,7 +116,7 @@ public void configure() throws ConfigurationException {
if (!StringUtils.isEmpty(getFlowId())) {
throw new ConfigurationException("attribute flowId must not be specified");
}
fxfDir = AppConstants.getInstance(getConfigurationClassLoader()).getResolvedProperty("fxf.dir");
fxfDir = AppConstants.getInstance(getConfigurationClassLoader()).getProperty("fxf.dir");
if (fxfDir == null) {
throw new ConfigurationException("property fxf.dir has not been initialised");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class ApiCacheManager {
private static IApiCache cache = null;
private static AppConstants appConstants = AppConstants.getInstance();
private static String etagCacheType = appConstants.getProperty("etag.cache.type", "ehcache");
private static String instanceName = appConstants.getResolvedProperty("instance.name");
private static String dtapStage = appConstants.getResolvedProperty("dtap.stage");
private static String instanceName = appConstants.getProperty("instance.name");
private static String dtapStage = appConstants.getProperty("dtap.stage");

/**
* Get the etagCache, defaults to EhCache when no type has been specified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void createCache(AppConstants ac) {
}

String DiskStorePath = null;
String cacheDir = ac.getResolvedProperty("etag.ehcache.dir");
String cacheDir = ac.getProperty("etag.ehcache.dir");
if (StringUtils.isNotEmpty(cacheDir)) {
DiskStorePath = cacheDir;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected String getLogPrefix() {
public void configure() throws ConfigurationException {
super.configure();
if (StringUtils.isEmpty(getDatasourceName())) {
setDatasourceName(AppConstants.getInstance(getConfigurationClassLoader()).getResolvedProperty(JndiDataSourceFactory.DEFAULT_DATASOURCE_NAME_PROPERTY));
setDatasourceName(AppConstants.getInstance(getConfigurationClassLoader()).getProperty(JndiDataSourceFactory.DEFAULT_DATASOURCE_NAME_PROPERTY));
}
try {
if (getDatasource() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class JmsMessagingSourceFactory extends MessagingSourceFactory {
private static Map<String,MessagingSource> jmsMessagingSourceMap = new HashMap<>();
private JMSFacade jmsFacade;
private String applicationServerType = AppConstants.getInstance().getResolvedProperty(AppConstants.APPLICATION_SERVER_TYPE_PROPERTY);
private String applicationServerType = AppConstants.getInstance().getProperty(AppConstants.APPLICATION_SERVER_TYPE_PROPERTY);

public JmsMessagingSourceFactory(JMSFacade jmsFacade) {
this.jmsFacade = jmsFacade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private ClassPathXmlApplicationContext createClassPathApplicationContext() {
if (classLoader == null) throw new IllegalStateException("no ClassLoader found to initialize Spring from");
classPathApplicationContext.setConfigLocations(getSpringConfigurationFiles(classLoader));

String instanceName = APP_CONSTANTS.getResolvedProperty("instance.name");
String instanceName = APP_CONSTANTS.getProperty("instance.name");
classPathApplicationContext.setId(requireNonNull(instanceName));
classPathApplicationContext.setDisplayName("IbisApplicationContext [" + instanceName + "]");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@IbisInitializer
public class ShowLogDirectory {

private String defaultLogDirectory = AppConstants.getInstance().getResolvedProperty("logging.path").replace("\\\\", "\\");
private String defaultLogDirectory = AppConstants.getInstance().getProperty("logging.path").replace("\\\\", "\\");
private String defaultLogWildcard = AppConstants.getInstance().getProperty("logging.wildcard");
private boolean showDirectories = AppConstants.getInstance().getBoolean("logging.showdirectories", false);
private int maxItems = AppConstants.getInstance().getInt("logging.items.max", 500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
public class BrowseJdbcTable extends BusEndpointBase {

private static final String DB2XML_XSLT = "xml/xsl/BrowseJdbcTableExecute.xsl";
private static final String JDBC_PERMISSION_RULES = AppConstants.getInstance().getResolvedProperty("browseJdbcTable.permission.rules");
private static final String JDBC_PERMISSION_RULES = AppConstants.getInstance().getProperty("browseJdbcTable.permission.rules");
private static final String COLUMN_NAME = "COLUMN_NAME";
private static final String DATA_TYPE = "DATA_TYPE";
private static final String COLUMN_SIZE = "COLUMN_SIZE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private String toXml(AppConstants appConstants) {

XmlBuilder p = new XmlBuilder("property");
p.addAttribute("name", propName);
p.setValue(appConstants.getResolvedProperty(propName));
p.setValue(appConstants.getProperty(propName));
xml.addSubElement(p);
}
return xmlh.toXML();
Expand Down
20 changes: 10 additions & 10 deletions core/src/main/java/nl/nn/adapterframework/soap/WsdlGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ public WsdlGenerator(PipeLine pipeLine, String generationInfo) {
}
String fileName = getName();
AppConstants appConstants = AppConstants.getInstance(pipeLine.getAdapter().getConfigurationClassLoader());
String tns = appConstants.getResolvedProperty("wsdl." + getName() + ".targetNamespace");
String tns = appConstants.getProperty("wsdl." + getName() + ".targetNamespace");
if (tns == null) {
tns = appConstants.getResolvedProperty("wsdl.targetNamespace");
tns = appConstants.getProperty("wsdl.targetNamespace");
}
if (tns == null) {
if (inputValidator instanceof EsbSoapValidator) {
Expand Down Expand Up @@ -645,15 +645,15 @@ protected void portType(XMLStreamWriter w) throws XMLStreamException {

protected String getSoapAction(IListener<?> listener) {
AppConstants appConstants = AppConstants.getInstance(pipeLine.getAdapter().getConfiguration().getClassLoader());
String sa = appConstants.getResolvedProperty("wsdl." + getName() + "." + listener.getName() + ".soapAction");
String sa = appConstants.getProperty("wsdl." + getName() + "." + listener.getName() + ".soapAction");
if (sa != null) {
return sa;
}
sa = appConstants.getResolvedProperty("wsdl." + getName() + ".soapAction");
sa = appConstants.getProperty("wsdl." + getName() + ".soapAction");
if (sa != null) {
return sa;
}
sa = appConstants.getResolvedProperty("wsdl.soapAction");
sa = appConstants.getProperty("wsdl.soapAction");
if (sa != null) {
return sa;
}
Expand All @@ -665,11 +665,11 @@ protected String getSoapAction(IListener<?> listener) {

protected String getLocation(String defaultLocation) {
AppConstants appConstants = AppConstants.getInstance(pipeLine.getAdapter().getConfiguration().getClassLoader());
String sa = appConstants.getResolvedProperty("wsdl." + getName() + ".location");
String sa = appConstants.getProperty("wsdl." + getName() + ".location");
if (sa != null) {
return sa;
}
sa = appConstants.getResolvedProperty("wsdl.location");
sa = appConstants.getProperty("wsdl.location");
if (sa != null) {
return sa;
}
Expand Down Expand Up @@ -826,7 +826,7 @@ protected void jmsService(XMLStreamWriter w, JmsListener listener, String namePr
w.writeCharacters("externalJndiName-for-"
+ listener.getQueueConnectionFactoryName()
+ "-on-"
+ AppConstants.getInstance().getResolvedProperty("dtap.stage"));
+ AppConstants.getInstance().getProperty("dtap.stage"));
w.writeEndElement();
}
w.writeStartElement(ESB_SOAP_JMS_NAMESPACE, "targetAddress"); {
Expand All @@ -835,7 +835,7 @@ protected void jmsService(XMLStreamWriter w, JmsListener listener, String namePr
if (queueName == null) {
queueName = "queueName-for-"
+ listener.getDestinationName() + "-on-"
+ AppConstants.getInstance().getResolvedProperty("dtap.stage");
+ AppConstants.getInstance().getProperty("dtap.stage");
}
w.writeCharacters(queueName);
w.writeEndElement();
Expand Down Expand Up @@ -868,7 +868,7 @@ protected void writeEsbSoapJndiContext(XMLStreamWriter w, JmsListener listener)
warn("Could not encode queueConnectionFactoryName for listener '" + listener.getName() + "'", e);
}
}
String stage = AppConstants.getInstance().getResolvedProperty("dtap.stage");
String stage = AppConstants.getInstance().getProperty("dtap.stage");
if (StringUtils.isEmpty(stage)) {
warn("Property dtap.stage empty");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void configure() throws ConfigurationException {
super.configure();
AppConstants ac = AppConstants.getInstance();
if (directory==null) {
setDirectory(ac.getResolvedProperty("log.dir"));
setDirectory(ac.getProperty("log.dir"));
}
if (retentionDays<0) {
setRetentionDays(ac.getInt("statistics.retention",7));
Expand All @@ -56,7 +56,7 @@ public void end(XmlBuilder data) {

if (StringUtils.isNotEmpty(getDirectory())) {
AppConstants ac = AppConstants.getInstance();
String filenamePattern=ac.getResolvedProperty("instance.name.lc")+"-stats_";
String filenamePattern=ac.getProperty("instance.name.lc")+"-stats_";
String extension=".log";
File outfile=FileUtils.getWeeklyRollingFile(directory, filenamePattern, extension, retentionDays);

Expand Down
Loading

0 comments on commit 9885738

Please sign in to comment.