📄 gazetteermanagerfactorybean.java
字号:
package com.esri.solutions.jitk.common.gazetteer;
import org.apache.log4j.Logger;
import java.util.Map;
/**
* Class used for configuring the Gazetteer Manager Factory class and
* all configured Gazetteer services via a JSF faces-config file.
*/
public class GazetteerManagerFactoryBean {
/**
* {@link Logger} used to log messages for this class.
*/
private static final Logger _logger = Logger.getLogger(GazetteerManagerFactoryBean.class);
/**
* Fully qualified classpath name of the
* {@link IGazetteerManagerFactory}.
*/
private String m_factoryClass = null;
/**
* {@link Map} of configured Gazetteer services.
*
* <p>
* Key: ID of the Gazetteer service
* Value: Name of the Gazetteer service.
* </p>
*/
private Map<String, String> m_configuredServices = null;
/**
* Reference to the {@link IGazetteerManagerFactory} object.
*/
private IGazetteerManagerFactory m_factory = null;
/**
* Default no-args constructor.
*/
public GazetteerManagerFactoryBean() {
}
/**
* Gets the fully qualified classpath name of the
* {@link IGazetteerManagerFactory}.
*
* @return {@link String} fully qualified classpath name of the
* {@link IGazetteerManagerFactory}.
*/
public String getFactoryClass() {
return m_factoryClass;
}
/**
* Sets the fully qualified classpath name of the
* {@link IGazetteerManagerFactory}.
*
* @param clazz {@link String} fully qualified classpath name of the
* {@link IGazetteerManagerFactory}.
*/
public void setFactoryClass(String clazz) {
m_factoryClass = clazz;
}
/**
* Gets the {@link Map} of configured Gazetteer services.
*
* <p>
* Key: ID of the Gazetteer service.
* Value: Name of the Gazetteer service.
* </p>
*
* @return {@link Map} of configured Gazetteer services.
*/
public Map<String, String> getConfiguredServices() {
return m_configuredServices;
}
/**
* Sets the {@link Map} of configured Gazetteer services.
*
* <p>
* Key: ID of the Gazetteer service.
* Value: Name of the Gazetteer service.
* </p>
*
* @param services {@link Map} of configured Gazetteer services.
*/
public void setConfiguredServices(Map<String, String> services) {
m_configuredServices = services;
}
/**
* Gets a reference to the {@link IGazetteerManagerFactory} used for creating/getting
* the {@link IGazetteerManager} via {@link IGazetteerManagerFactory#getGazetteerManager()}.
*
* @return
*/
public IGazetteerManagerFactory getFactory() {
if (m_factory == null) {
try {
m_factory = (IGazetteerManagerFactory) Class.forName(m_factoryClass)
.newInstance();
m_factory.setConfiguredServices(getConfiguredServices());
} catch (ClassNotFoundException ex) {
_logger.warn("Unable to find concrete factory implementation class.",
ex);
} catch (IllegalAccessException ex) {
_logger.warn("Unable to create CSW Manager factory", ex);
} catch (InstantiationException ex) {
_logger.warn("Unable to create CSW Manager factory", ex);
}
}
return m_factory;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -