--- /dev/null
+/**\r
+ * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.\r
+ *\r
+ * This library is free software; you can redistribute it and/or modify it under\r
+ * the terms of the GNU Lesser General Public License as published by the Free\r
+ * Software Foundation; either version 2.1 of the License, or (at your option)\r
+ * any later version.\r
+ *\r
+ * This library is distributed in the hope that it will be useful, but WITHOUT\r
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\r
+ * details.\r
+ */\r
+\r
+package com.liferay.portal.security.ldap;\r
+\r
+import com.liferay.portal.kernel.log.Log;\r
+import com.liferay.portal.kernel.log.LogFactoryUtil;\r
+import com.liferay.portal.security.pacl.PACLClassLoaderUtil;\r
+import com.liferay.portal.util.PropsValues;\r
+\r
+/**\r
+ * @author Brian Wing Shun Chan\r
+ */\r
+public class ENTAttributesTransformerFactory {\r
+\r
+ public static ENTAttributesTransformer getInstance() {\r
+ \r
+ if (_attributesTransformer == null) {\r
+ if (_log.isDebugEnabled()) {\r
+ _log.debug(\r
+ "Instantiate " + PropsValues.LDAP_ATTRS_TRANSFORMER_IMPL);\r
+ }\r
+ \r
+ ClassLoader classLoader =\r
+ PACLClassLoaderUtil.getPortalClassLoader();\r
+\r
+ try {\r
+ _attributesTransformer =\r
+ (ENTAttributesTransformer)classLoader.loadClass(\r
+ PropsValues.LDAP_ATTRS_TRANSFORMER_IMPL).newInstance();\r
+ }\r
+ catch (Exception e) {\r
+ _log.error(e, e);\r
+ }\r
+ }\r
+\r
+ if (_log.isDebugEnabled()) {\r
+ _log.debug("Return " + _attributesTransformer.getClass().getName());\r
+ }\r
+ \r
+ return _attributesTransformer;\r
+ }\r
+\r
+ public static void setInstance(\r
+ ENTAttributesTransformer attributesTransformer) {\r
+\r
+ if (_log.isDebugEnabled()) {\r
+ _log.debug("Set " + attributesTransformer.getClass().getName());\r
+ }\r
+\r
+ _attributesTransformer = attributesTransformer;\r
+ }\r
+\r
+ private static Log _log = LogFactoryUtil.getLog(\r
+ ENTAttributesTransformerFactory.class);\r
+\r
+ private static ENTAttributesTransformer _attributesTransformer;\r
+\r
+}
\ No newline at end of file