本文整理汇总了Java中org.springframework.extensions.config.ConfigService类的典型用法代码示例。如果您正苦于以下问题:Java ConfigService类的具体用法?Java ConfigService怎么用?Java ConfigService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigService类属于org.springframework.extensions.config包,在下文中一共展示了ConfigService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConfigService
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
private void setConfigService(final String mimetypes)
{
ConfigSource configSource = new ConfigSource()
{
@Override
public List<ConfigDeployment> getConfigDeployments()
{
String xml =
"<alfresco-config area=\"mimetype-map\">" +
" <config evaluator=\"string-compare\" condition=\"Mimetype Map\">" +
" <mimetypes>" +
mimetypes +
" </mimetypes>" +
" </config>" +
"</alfresco-config>";
List<ConfigDeployment> configs = new ArrayList<ConfigDeployment>();
configs.add(new ConfigDeployment("name", new ByteArrayInputStream(xml.getBytes())));
return configs;
}
};
ConfigService configService = new XMLConfigService(configSource);
((XMLConfigService) configService).initConfig();
((MimetypeMap)mimetypeService).setConfigService(configService);
}
示例2: getLanguage
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Return the configured language Locale for the application context
*
* @param ctx
* the application context
* @return Current language Locale set or the VM default if none set - never null
*/
public static Locale getLanguage(ApplicationContext ctx)
{
// get from web-client config - the first item in the configured list of languages
Config config = ((ConfigService) ctx.getBean(Application.BEAN_CONFIG_SERVICE)).getConfig("Languages");
LanguagesConfigElement langConfig = (LanguagesConfigElement) config
.getConfigElement(LanguagesConfigElement.CONFIG_ELEMENT_ID);
List<String> languages = langConfig.getLanguages();
if (languages != null && languages.size() != 0)
{
return I18NUtil.parseLocale(languages.get(0));
}
else
{
// failing that, use the server default locale
return Locale.getDefault();
}
}
示例3: getErrorPage
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Retrieves the configured error page for the application
*
* @param context The Spring context
* @return The configured error page or null if the configuration is missing
*/
public static String getErrorPage(ApplicationContext context)
{
String errorPage = null;
ConfigService svc = (ConfigService)context.getBean(BEAN_CONFIG_SERVICE);
ClientConfigElement clientConfig = (ClientConfigElement)svc.getGlobalConfig().
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
if (clientConfig != null)
{
errorPage = clientConfig.getErrorPage();
}
return errorPage;
}
示例4: getLoginPage
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Retrieves the configured login page for the application
*
* @param context The Spring contexr
* @return The configured login page or null if the configuration is missing
*/
public static String getLoginPage(ApplicationContext context)
{
String loginPage = null;
ConfigService svc = (ConfigService)context.getBean(BEAN_CONFIG_SERVICE);
ClientConfigElement clientConfig = (ClientConfigElement)svc.getGlobalConfig().
getConfigElement(ClientConfigElement.CONFIG_ELEMENT_ID);
if (clientConfig != null)
{
loginPage = clientConfig.getLoginPage();
}
return loginPage;
}
示例5: getDialogContainers
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Retrieves the list of configured dialog container pages
*
* @param context FacesContext
* @return The container pages
*/
protected List<String> getDialogContainers(FacesContext context)
{
if ((this.dialogContainers == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
{
this.dialogContainers = new ArrayList<String>(2);
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null)
{
this.dialogContainers.add(globalConfig.getConfigElement("dialog-container").getValue());
this.dialogContainers.add(globalConfig.getConfigElement("plain-dialog-container").getValue());
}
}
return this.dialogContainers;
}
示例6: getWizardContainers
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Retrieves the list of configured wizard container pages
*
* @param context FacesContext
* @return The container page
*/
protected List<String> getWizardContainers(FacesContext context)
{
if ((this.wizardContainers == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
{
this.wizardContainers = new ArrayList<String>(2);
ConfigService configSvc = Application.getConfigService(context);
Config globalConfig = configSvc.getGlobalConfig();
if (globalConfig != null)
{
this.wizardContainers.add(globalConfig.getConfigElement("wizard-container").getValue());
this.wizardContainers.add(globalConfig.getConfigElement("plain-wizard-container").getValue());
}
}
return this.wizardContainers;
}
示例7: init
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
*
* @deprecated
*/
public void init()
{
// TODO - see JIRA Task AR-1715 - refactor calling modules to inject webClientConfigService, and use init-method="register" directly
// (instead of init-method="init"). Can then remove applicationContext and no longer implement ApplicationContextAware
if (this.applicationContext.containsBean("webClientConfigService") == true)
{
ConfigService configService = (ConfigService)this.applicationContext.getBean("webClientConfigService");
if (configService != null)
{
setConfigService(configService);
register();
}
}
}
示例8: getOtherPropertiesPresent
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Determines whether this document has any other properties other than the
* default set to display to the user.
*
* @return true of there are properties to show, false otherwise
*/
public boolean getOtherPropertiesPresent()
{
if ((this.hasOtherProperties == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
{
// we need to use the config service to see whether there are any
// editable properties configured for this document.
ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
Config configProps = configSvc.getConfig(this.editableNode);
PropertySheetConfigElement propsToDisplay = (PropertySheetConfigElement)configProps.
getConfigElement("property-sheet");
if (propsToDisplay != null && propsToDisplay.getEditableItemNamesToShow().size() > 0)
{
this.hasOtherProperties = Boolean.TRUE;
}
else
{
this.hasOtherProperties = Boolean.FALSE;
}
}
return this.hasOtherProperties.booleanValue();
}
示例9: getInlineEditableMimeTypes
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
protected List<String> getInlineEditableMimeTypes()
{
if ((this.inlineEditableMimeTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
{
this.inlineEditableMimeTypes = new ArrayList<String>(8);
// get the create mime types list from the config
ConfigService svc = Application.getConfigService(FacesContext.getCurrentInstance());
Config wizardCfg = svc.getConfig("Content Wizards");
if (wizardCfg != null)
{
ConfigElement typesCfg = wizardCfg.getConfigElement("create-mime-types");
if (typesCfg != null)
{
for (ConfigElement child : typesCfg.getChildren())
{
String currentMimeType = child.getAttribute("name");
this.inlineEditableMimeTypes.add(currentMimeType);
}
}
}
}
return this.inlineEditableMimeTypes;
}
示例10: MimetypeMap
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
@Deprecated
public MimetypeMap(ConfigService configService)
{
logger.warn("MimetypeMap(ConfigService configService) has been deprecated. "
+ "Use the default constructor and property 'configService'");
this.configService = configService;
}
示例11: init
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* @see javax.servlet.GenericServlet#init()
*/
@Override
public void init(ServletConfig sc) throws ServletException
{
super.init(sc);
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(sc.getServletContext());
this.configService = (ConfigService)ctx.getBean("webClientConfigService");
}
示例12: getDialogConfig
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Returns the dialog configuration object for the given dialog name.
* If there is a node in the dispatch context a lookup is performed using
* the node otherwise the global config section is used.
*
*
* @param name The name of dialog being launched
* @param dispatchContext The node being acted upon
* @return The DialogConfig for the dialog or null if no config could be found
*/
protected DialogConfig getDialogConfig(FacesContext context, String name, Node dispatchContext)
{
DialogConfig dialogConfig = null;
ConfigService configSvc = Application.getConfigService(context);
Config config = null;
if (dispatchContext != null)
{
if (logger.isDebugEnabled())
logger.debug("Using dispatch context for dialog lookup: " +
dispatchContext.getType().toString());
// use the node to perform the lookup (this will include the global section)
config = configSvc.getConfig(dispatchContext);
}
else
{
if (logger.isDebugEnabled())
logger.debug("Looking up dialog in global config");
// just use the global
config = configSvc.getGlobalConfig();
}
if (config != null)
{
DialogsConfigElement dialogsCfg = (DialogsConfigElement)config.getConfigElement(
DialogsConfigElement.CONFIG_ELEMENT_ID);
if (dialogsCfg != null)
{
dialogConfig = dialogsCfg.getDialog(name);
}
}
return dialogConfig;
}
示例13: getWizardConfig
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* Returns the wizard configuration object for the given wizard name.
* If there is a node in the dispatch context a lookup is performed using
* the node otherwise the global config section is used.
*
* @param name The name of wizard being launched
* @param dispatchContext The node being acted upon
* @return The WizardConfig for the wizard or null if no config could be found
*/
protected WizardConfig getWizardConfig(FacesContext context, String name, Node dispatchContext)
{
WizardConfig wizardConfig = null;
ConfigService configSvc = Application.getConfigService(context);
Config config = null;
if (dispatchContext != null)
{
if (logger.isDebugEnabled())
logger.debug("Using dispatch context for wizard lookup: " +
dispatchContext.getType().toString());
// use the node to perform the lookup (this will include the global section)
config = configSvc.getConfig(dispatchContext);
}
else
{
if (logger.isDebugEnabled())
logger.debug("Looking up wizard in global config");
// just use the global
config = configSvc.getGlobalConfig();
}
if (config != null)
{
WizardsConfigElement wizardsCfg = (WizardsConfigElement)config.getConfigElement(
WizardsConfigElement.CONFIG_ELEMENT_ID);
if (wizardsCfg != null)
{
wizardConfig = wizardsCfg.getWizard(name);
}
}
return wizardConfig;
}
示例14: getEncoding
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
/**
* @return Returns the encoding currently selected
*/
public String getEncoding()
{
if (encoding == null)
{
ConfigService configSvc = Application.getConfigService(FacesContext.getCurrentInstance());
Config config = configSvc.getConfig("Import Dialog");
if (config != null)
{
ConfigElement defaultEncCfg = config.getConfigElement("default-encoding");
if (defaultEncCfg != null)
{
String value = defaultEncCfg.getValue();
if (value != null)
{
encoding = value.trim();
}
}
}
if (encoding == null || encoding.length() == 0)
{
// if not configured, set to a sensible default for most character sets
encoding = "UTF-8";
}
}
return encoding;
}
示例15: getEncodings
import org.springframework.extensions.config.ConfigService; //导入依赖的package包/类
public List<SelectItem> getEncodings()
{
if ((this.encodings == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance())))
{
FacesContext context = FacesContext.getCurrentInstance();
this.encodings = new ArrayList<SelectItem>(3);
ConfigService svc = Application.getConfigService(context);
Config cfg = svc.getConfig("Import Dialog");
if (cfg != null)
{
ConfigElement typesCfg = cfg.getConfigElement("encodings");
if (typesCfg != null)
{
for (ConfigElement child : typesCfg.getChildren())
{
String encoding = child.getAttribute("name");
if (encoding != null)
{
this.encodings.add(new SelectItem(encoding, encoding));
}
}
}
else
{
logger.warn("Could not find 'encodings' configuration element");
}
}
else
{
encodings = UICharsetSelector.getCharsetEncodingList();
}
}
return this.encodings;
}