001
014
015 package com.liferay.portal.security.auth;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.InstanceFactory;
020 import com.liferay.portal.security.pacl.PACLClassLoaderUtil;
021 import com.liferay.portal.util.PropsValues;
022
023
026 public class FullNameGeneratorFactory {
027
028 public static FullNameGenerator getInstance() {
029 if (_fullNameGenerator == null) {
030 if (_log.isDebugEnabled()) {
031 _log.debug(
032 "Instantiate " + PropsValues.USERS_FULL_NAME_GENERATOR);
033 }
034
035 ClassLoader classLoader =
036 PACLClassLoaderUtil.getPortalClassLoader();
037
038 try {
039 _fullNameGenerator =
040 (FullNameGenerator)InstanceFactory.newInstance(
041 classLoader, PropsValues.USERS_FULL_NAME_GENERATOR);
042 }
043 catch (Exception e) {
044 _log.error(e, e);
045 }
046 }
047
048 if (_log.isDebugEnabled()) {
049 _log.debug("Return " + _fullNameGenerator.getClass().getName());
050 }
051
052 return _fullNameGenerator;
053 }
054
055 public static void setInstance(FullNameGenerator fullNameValidator) {
056 if (_log.isDebugEnabled()) {
057 _log.debug("Set " + fullNameValidator.getClass().getName());
058 }
059
060 _fullNameGenerator = fullNameValidator;
061 }
062
063 private static Log _log = LogFactoryUtil.getLog(
064 FullNameValidatorFactory.class);
065
066 private static FullNameGenerator _fullNameGenerator;
067
068 }