Ein paar Dateien vergessen.

git-svn-id: https://svn.libreccm.org/ccm/trunk@750 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2011-02-15 10:29:48 +00:00
parent b0f365bddf
commit 44bf556993
3 changed files with 184 additions and 0 deletions

View File

@ -0,0 +1,110 @@
/*
* Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.globalization;
import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.StringUtils;
import com.arsdigita.util.parameter.StringParameter;
import com.arsdigita.util.parameter.StringArrayParameter;
import com.arsdigita.util.parameter.Parameter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
/**
* A configuration record for configuration of the core globalization package
*
* Accessors of this class may return null. Developers should take care
* to trap null return values in their code.
*
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
* @version $Id: $
*/
public class GlobalizationConfig extends AbstractConfig {
/** A logger instance. */
private static final Logger s_log = Logger.getLogger(GlobalizationConfig.class);
/** Singelton config object. */
private static GlobalizationConfig s_conf;
/**
* Gain a UIConfig object.
*
* Singelton pattern, don't instantiate a lifecacle object using the
* constructor directly!
* @return
*/
public static synchronized GlobalizationConfig getConfig() {
if (s_conf == null) {
s_conf = new GlobalizationConfig();
s_conf.load();
}
return s_conf;
}
/**
* Default character set for locales not explicitly listed above in the
* locales parameter.
* This parameter is read each time the system starts. Therefore, modifications
* will take effect after a CCM restart.
*/
// In OLD initializer: DEFAULT_CHARSET as String
private final Parameter m_defaultCharset =
new StringParameter(
"core.globalization.default_charset",
Parameter.REQUIRED, "UTF-8");
/**
* Constructs an empty RuntimeConfig object.
*
*/
public GlobalizationConfig() {
// pboy: According to the comment for the getConfig() method a singleton
// pattern is to be used. Therefore the constructor should be changed to
// private!
// private GlobalizationConfig() {
register(m_defaultCharset);
loadInfo();
}
/**
* Retrieve the default char set to be used for locales not explicitly
* listed in the supported locales list.
*
* @return root page url
*/
public String getDefaultCharset() {
return (String)get(m_defaultCharset) ;
}
}

View File

@ -0,0 +1,4 @@
core.globalization.default_charset.title=Default Charset
core.globalization.default_charset.purpose=Default character set for locales not explicitly listed in the locales parameter.
core.globalization.default_charset.example="UTF-8"
core.globalization.default_charset.format=[String]

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.globalization;
// import com.arsdigita.runtime.ContextInitEvent;
import com.arsdigita.runtime.DomainInitEvent;
// import com.arsdigita.runtime.ConfigError;
import org.apache.log4j.Logger;
/**
*
* @author pb
*/
public class Initializer extends com.arsdigita.runtime.GenericInitializer {
/** Creates a s_logging category with name = to the full name of class */
private static Logger s_log = Logger.getLogger(Initializer.class);
/** Config object for the UI package */
private static GlobalizationConfig s_conf = GlobalizationConfig.getConfig();
/**
* Constructor
*/
public Initializer() {
}
/**
* Implementation of the {@link Initializer#init(DomainInitEvent)}
* method.
*
* @param evt The domain init event.
*/
@Override
public void init(DomainInitEvent evt) {
s_log.debug("Core globalization domain initialization started.");
LocaleNegotiator.setApplicationLocaleProvider(
new ApplicationLocaleProvider());
LocaleNegotiator.setClientLocaleProvider(new ClientLocaleProvider());
LocaleNegotiator.setSystemLocaleProvider(new SystemLocaleProvider());
String defaultCharset = s_conf.getDefaultCharset();
Globalization.setDefaultCharset(defaultCharset);
s_log.debug("Core globalization domain initialization completed");
}
}