001
014
015 package com.liferay.portal.security.exportimport;
016
017 import com.liferay.portal.model.User;
018 import com.liferay.registry.Registry;
019 import com.liferay.registry.RegistryUtil;
020 import com.liferay.registry.ServiceTracker;
021
022
028 public class UserImporterUtil {
029
030 public static User importUser(
031 long ldapServerId, long companyId, String emailAddress,
032 String screenName)
033 throws Exception {
034
035 return _getInstance().importUser(
036 ldapServerId, companyId, emailAddress, screenName);
037 }
038
039 public static User importUser(
040 long companyId, String emailAddress, String screenName)
041 throws Exception {
042
043 return _getInstance().importUser(companyId, emailAddress, screenName);
044 }
045
046 public static User importUserByScreenName(long companyId, String screenName)
047 throws Exception {
048
049 return _getInstance().importUserByScreenName(companyId, screenName);
050 }
051
052 public static void importUsers() throws Exception {
053 _getInstance().importUsers();
054 }
055
056 public static void importUsers(long companyId) throws Exception {
057 _getInstance().importUsers(companyId);
058 }
059
060 public static void importUsers(long ldapServerId, long companyId)
061 throws Exception {
062
063 _getInstance().importUsers(ldapServerId, companyId);
064 }
065
066 private static UserImporter _getInstance() {
067 return _instance._serviceTracker.getService();
068 }
069
070 private UserImporterUtil() {
071 Registry registry = RegistryUtil.getRegistry();
072
073 _serviceTracker = registry.trackServices(UserImporter.class);
074
075 _serviceTracker.open();
076 }
077
078 private static final UserImporterUtil _instance = new UserImporterUtil();
079
080 private final ServiceTracker<UserImporter, UserImporter> _serviceTracker;
081
082 }