当前位置: 首页>>代码示例>>Java>>正文


Java UserManager.getInstance方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.user.UserManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java UserManager.getInstance方法的具体用法?Java UserManager.getInstance怎么用?Java UserManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.user.UserManager的用法示例。


在下文中一共展示了UserManager.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializePlugin

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
    pluginManager = manager;
    sessionManager = SessionManager.getInstance();
    groupManager = GroupManager.getInstance();
    userManager = UserManager.getInstance();

    // Register as a component.
    componentManager = ComponentManagerFactory.getComponentManager();
    try {
        componentManager.addComponent(serviceName, this);
    }
    catch (Exception e) {
        Log.error(e.getMessage(), e);
    }
    PropertyEventDispatcher.addListener(this);
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:17,代码来源:BroadcastPlugin.java

示例2: SearchPlugin

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
public SearchPlugin() {
    serviceName = JiveGlobals.getProperty(SERVICENAME, "search");
    serviceEnabled = JiveGlobals.getBooleanProperty(SERVICEENABLED, true);
    exculudedFields = StringUtils.stringToCollection(JiveGlobals.getProperty(EXCLUDEDFIELDS, ""));
    
    serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
    userManager = UserManager.getInstance();
           
    // Some clients, such as Miranda, are hard-coded to search specific fields,
    // so we map those fields to the fields that Openfire actually supports.
    fieldLookup.put("jid", "Username");
    fieldLookup.put("username", "Username");
    fieldLookup.put("city", "City");
    fieldLookup.put("first", "Name");
    fieldLookup.put("last", "Name");
    fieldLookup.put("nick", "Name");
    fieldLookup.put("name", "Name");
    fieldLookup.put("email", "Email");
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:20,代码来源:SearchPlugin.java

示例3: formatJID

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
private String formatJID(boolean html, JID jid) {
    String formattedJID;
    if (html) {
        UserManager userManager = UserManager.getInstance();
        if (XMPPServer.getInstance().isLocal(jid) &&
            userManager.isRegisteredUser(jid.getNode())) {
            formattedJID = "<a href='/user-properties.jsp?username=" +
                jid.getNode() + "'>" + jid.toBareJID() + "</a>";
        }
        else {
            formattedJID = jid.toBareJID();
        }
    }
    else {
        formattedJID = jid.toBareJID();
    }
    return formattedJID;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:ConversationUtils.java

示例4: setUp

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
  
  URL url = this.getClass().getResource("/test-openfire.xml");
  File f = new File(url.getFile());
  JiveGlobals.setConfigName(f.getName());
  JiveGlobals.setHomeDirectory(f.getParent());
  JiveGlobals.setProperty("provider.user.className",
      "org.jivesoftware.openfire.plugin.TestUserProvider");
  
  offlineMessagesStore = new TestOfflineMessageStore();
  vCardManager = new TestVCardManager();
  privateStorage = null;
  userManager = UserManager.getInstance();
  rosterItemProvider = new TestRosterItemProvider();
  
  //Empty users
  List<User> l = new ArrayList<>(userManager.getUsers());
  for (User user : l ) {
    userManager.deleteUser(user);
    
  }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:Xep227ExporterTest.java

示例5: SearchPlugin

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
public SearchPlugin() {
    serviceName = JiveGlobals.getProperty(SERVICENAME, "search");
    serviceEnabled = JiveGlobals.getBooleanProperty(SERVICEENABLED, true);
    excludedFields = StringUtils.stringToCollection(JiveGlobals.getProperty(EXCLUDEDFIELDS, ""));
    groupOnly = JiveGlobals.getBooleanProperty(GROUPONLY);

    serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
    userManager = UserManager.getInstance();

    // Some clients, such as Miranda, are hard-coded to search specific fields,
    // so we map those fields to the fields that Openfire actually supports.
    fieldLookup.put("jid", "Username");
    fieldLookup.put("username", "Username");
    fieldLookup.put("first", "Name");
    fieldLookup.put("last", "Name");
    fieldLookup.put("nick", "Name");
    fieldLookup.put("name", "Name");
    fieldLookup.put("email", "Email");
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:20,代码来源:SearchPlugin.java

示例6: SearchPlugin

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
public SearchPlugin() {
	serviceName = JiveGlobals.getProperty(SERVICENAME, "search");
	serviceEnabled = JiveGlobals.getBooleanProperty(SERVICEENABLED, true);
	excludedFields = StringUtils.stringToCollection(JiveGlobals.getProperty(EXCLUDEDFIELDS, ""));
	groupOnly = JiveGlobals.getBooleanProperty(GROUPONLY);

	serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
	userManager = UserManager.getInstance();

	// Some clients, such as Miranda, are hard-coded to search specific fields,
	// so we map those fields to the fields that Openfire actually supports.
	fieldLookup.put("jid", "Username");
	fieldLookup.put("username", "Username");
	fieldLookup.put("first", "Name");
	fieldLookup.put("last", "Name");
	fieldLookup.put("nick", "Name");
	fieldLookup.put("name", "Name");
	fieldLookup.put("email", "Email");
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:20,代码来源:SearchPlugin.java

示例7: populateResponseFields

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
private void populateResponseFields(DataForm form, List<String> accounts) {
    FormField jidField = form.addField();
    jidField.setVariable("accountjids");

    FormField emailField = form.addField();
    emailField.setVariable("email");

    FormField nameField = form.addField();
    nameField.setVariable("name");

    UserManager manager = UserManager.getInstance();
    for(String account : accounts) {
        User user;
        try {
            JID jid = new JID(account);
            user = manager.getUser(jid.getNode());
        }
        catch (Exception ex) {
            continue;
        }

        jidField.addValue(account);
        emailField.addValue(user.getEmail());
        nameField.addValue(user.getName());
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:27,代码来源:UserProperties.java

示例8: createUser

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
/**
 * Checks to see if the user exists; if not, a new user is created.
 *
 * @param username the username.
 */
private static void createUser(String username) {
    // See if the user exists in the database. If not, automatically create them.
    UserManager userManager = UserManager.getInstance();
    try {
        userManager.getUser(username);
    }
    catch (UserNotFoundException unfe) {
        try {
            Log.debug("JDBCAuthProvider: Automatically creating new user account for " + username);
            UserManager.getUserProvider().createUser(username, StringUtils.randomString(8),
                    null, null);
        }
        catch (UserAlreadyExistsException uaee) {
            // Ignore.
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:23,代码来源:JDBCAuthProvider.java

示例9: LdapGroupProvider

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
/**
 * Constructs a new LDAP group provider.
 */
public LdapGroupProvider() {
    manager = LdapManager.getInstance();
    userManager = UserManager.getInstance();
    standardAttributes = new String[3];
    standardAttributes[0] = manager.getGroupNameField();
    standardAttributes[1] = manager.getGroupDescriptionField();
    standardAttributes[2] = manager.getGroupMemberField();
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:12,代码来源:LdapGroupProvider.java

示例10: Xep227Exporter

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
/**
 */
public Xep227Exporter() {
  offlineMessagesStore = XMPPServer.getInstance()
      .getOfflineMessageStore();
  serverName = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
  //TODO not yet implemented
  //privateStorage = XMPPServer.getInstance().getPrivateStorage();
  vCardManager = VCardManager.getInstance();
  
  userManager = UserManager.getInstance();
  rosterItemProvider = RosterManager.getRosterItemProvider();
  

}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:16,代码来源:Xep227Exporter.java

示例11: setUp

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
  
  URL url = this.getClass().getResource("/test-openfire.xml");
  File f = new File(url.getFile());
  JiveGlobals.setConfigName(f.getName());
  JiveGlobals.setHomeDirectory(f.getParent());
  JiveGlobals.setProperty("provider.user.className",
      "org.jivesoftware.openfire.plugin.TestUserProvider");
  
  userManager = UserManager.getInstance();
  rosterItemProvider = new TestRosterItemProvider();

}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:18,代码来源:OpenfireExporterTest.java

示例12: executeGet

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
public void executeGet(IQ packet, Workgroup workgroup) {
    IQ reply = IQ.createResultIQ(packet);

    // Retrieve the sound settings.
    String authRequired = workgroup.getProperties().getProperty("authRequired");

    Element returnPacket = reply.setChildElement("workgroup-properties",
            "http://jivesoftware.com/protocol/workgroup");
    if (ModelUtil.hasLength(authRequired)) {
        returnPacket.addElement("authRequired").setText(authRequired);
    }
    else {
        returnPacket.addElement("authRequired").setText("false");
    }

    Element iq = packet.getChildElement();
    Attribute attr = iq.attribute("jid");
    if (attr != null && ModelUtil.hasLength(iq.attribute("jid").getText())) {
        String jid = iq.attribute("jid").getText();
        UserManager userManager = UserManager.getInstance();
        try {
            User user = userManager.getUser(new JID(jid).getNode());
            String email = user.getEmail();
            String fullName = user.getName();
            returnPacket.addElement("email").setText(email);
            returnPacket.addElement("name").setText(fullName);
        }
        catch (UserNotFoundException e) {
            Log.error(e.getMessage(), e);
        }

    }


    workgroup.send(reply);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:37,代码来源:WorkgroupPropertiesProvider.java

示例13: initializePlugin

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {

	Log.info("ServerInfo - Starting plugin.");
	Log.debug("ServerInfo - Starting plugin.");

	pluginManager = manager;
	sessionManager = SessionManager.getInstance();
	String serverInfoPort = JiveGlobals.getProperty(SERVERINFOPORT, "4455");

	userManager = UserManager.getInstance();

	// Register as a component.
	componentManager = ComponentManagerFactory.getComponentManager();

	try {

		componentManager.addComponent(serviceName, this);
	}
	catch (Exception e) {

		Log.error(e.getMessage(), e);
	}

	PropertyEventDispatcher.addListener(this);

	Log.info("ServerInfo - Starting bind on port " + serverInfoPort + ".");
	Log.debug("ServerInfo - Starting bind on port " + serverInfoPort + ".");
	ofd_srv.startServer();
}
 
开发者ID:mhterres,项目名称:ServerInfo,代码行数:30,代码来源:ServerInfoPlugin.java

示例14: initializePlugin

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
@Override
public void initializePlugin(PluginManager manager, File pluginDirectory) {
	System.out.println("initialize BroadcastServicePlugin");
	pluginManager = manager;
	server = XMPPServer.getInstance();
	sessionManager = SessionManager.getInstance();
	groupManager = GroupManager.getInstance();
	userManager = UserManager.getInstance();
	presenceManager = server.getPresenceManager();
	secret = JiveGlobals.getProperty("plugin.broadcastservice.secret", "");
	// If no secret key has been assigned to the broadcast service yet,
	// assign a
	// random one.
	if (secret.equals("")) {
		secret = StringUtils.randomString(8);
		setSecret(secret);
	}

	// See if the service is enabled or not.
	enabled = JiveGlobals.getBooleanProperty("plugin.broadcastservice.enabled", false);

	// Register as a component.
	componentManager = ComponentManagerFactory.getComponentManager();
	try {
		componentManager.addComponent(serviceName, this);
	} catch (Exception e) {
		Log.error(e.getMessage(), e);
	}
	// Listen to system property events
	PropertyEventDispatcher.addListener(this);
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:32,代码来源:BroadcastServicePlugin.java

示例15: authenticate

import org.jivesoftware.openfire.user.UserManager; //导入方法依赖的package包/类
@Override
public void authenticate(String username, String password) throws UnauthorizedException {
    if (username.contains("@")) {
        // Check that the specified domain matches the server's domain
        int index = username.indexOf("@");
        String domain = username.substring(index + 1);
        if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
            username = username.substring(0, index);
        } else {
            // Unknown domain. Return authentication failed.
            throw new UnauthorizedException();
        }
    }
    try {
        // Some native authentication mechanisms appear to not handle high load
        // very well. Therefore, synchronize access to Shaj to throttle auth checks.
        synchronized (this) {
            if (!Shaj.checkPassword(domain, username, password)) {
                throw new UnauthorizedException();
            }
        }
    }
    catch (UnauthorizedException ue) {
        throw ue;
    }
    catch (Exception e) {
        throw new UnauthorizedException(e);
    }

    // See if the user exists in the database. If not, automatically create them.
    UserManager userManager = UserManager.getInstance();
    try {
        userManager.getUser(username);
    }
    catch (UserNotFoundException unfe) {
        try {
            Log.debug("Automatically creating new user account for " + username);
            // Create user; use a random password for better safety in the future.
            // Note that we have to go to the user provider directly -- because the
            // provider is read-only, UserManager will usually deny access to createUser.
            UserProvider provider = UserManager.getUserProvider();
            if (!(provider instanceof NativeUserProvider)) {
                Log.error("Error: not using NativeUserProvider so authentication with " +
                        "NativeAuthProvider will likely fail. Using: " +
                        provider.getClass().getName());
            }
            UserManager.getUserProvider().createUser(username, StringUtils.randomString(8),
                    null, null);
        }
        catch (UserAlreadyExistsException uaee) {
            // Ignore.
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:55,代码来源:NativeAuthProvider.java


注:本文中的org.jivesoftware.openfire.user.UserManager.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。