• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LocaleUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jivesoftware.util.LocaleUtils的典型用法代码示例。如果您正苦于以下问题:Java LocaleUtils类的具体用法?Java LocaleUtils怎么用?Java LocaleUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocaleUtils类属于org.jivesoftware.util包,在下文中一共展示了LocaleUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getLastPresenceStatus

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
public String getLastPresenceStatus(User user) {
    String username = user.getUsername();
    String presenceStatus = null;
    String presenceXML = offlinePresenceCache.get(username);
    if (presenceXML == null) {
        loadOfflinePresence(username);
    }
    presenceXML = offlinePresenceCache.get(username);
    if (presenceXML != null) {
        // If the cached answer is no data, return null.
        if (presenceXML.equals(NULL_STRING)) {
            return null;
        }
        // Otherwise, parse out the status from the XML.
        try {
            // Parse the element
            Document element = DocumentHelper.parseText(presenceXML);
            presenceStatus = element.getRootElement().elementTextTrim("status");
        }
        catch (DocumentException e) {
            Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        }
    }
    return presenceStatus;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:26,代码来源:PresenceManagerImpl.java


示例2: newMailReceived

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * @see org.openymsg.network.event.SessionAdapter#newMailReceived(org.openymsg.network.event.SessionNewMailEvent)
 */
public void newMailReceived(SessionNewMailEvent event) {
    if (JiveGlobals.getBooleanProperty("plugin.gateway.yahoo.mailnotifications", true) && (emailInitialized || event.getMailCount() > 0)) {
        if (!emailInitialized) {
            getSession().getTransport().sendMessage(
                    getSession().getJID(),
                    getSession().getTransport().getJID(),
                    LocaleUtils.getLocalizedString("gateway.yahoo.mail", "kraken", Arrays.asList(Integer.toString(event.getMailCount()))),
                    Message.Type.headline
            );
        }
        else {
            getSession().getTransport().sendMessage(
                    getSession().getJID(),
                    getSession().getTransport().getJID(),
                    LocaleUtils.getLocalizedString("gateway.yahoo.newmail", "kraken"),
                    Message.Type.headline
            );
        }
    }
    emailInitialized = true;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:25,代码来源:YahooListener.java


示例3: handleFlapPacket

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
@Override
    protected void handleFlapPacket(FlapPacketEvent e) {
//        Log.debug("OSCAR bos flap packet received: "+e);
        FlapCommand cmd = e.getFlapCommand();

        if (cmd instanceof CloseFlapCmd) {
            CloseFlapCmd cfc = (CloseFlapCmd)cmd;
            if (cfc.getCode() == CloseFlapCmd.CODE_LOGGED_IN_ELSEWHERE) {
                getMainSession().setFailureStatus(ConnectionFailureReason.LOCKED_OUT);
                getMainSession().sessionDisconnectedNoReconnect(LocaleUtils.getLocalizedString("gateway.oscar.multilogin", "kraken"));
            }
            else {
                getMainSession().setFailureStatus(ConnectionFailureReason.UNKNOWN);                
                getMainSession().sessionDisconnected(LocaleUtils.getLocalizedString("gateway.oscar.disconnected", "kraken"));
            }
        }
        super.handleFlapPacket(e);
    }
 
开发者ID:coodeer,项目名称:g3server,代码行数:19,代码来源:BOSConnection.java


示例4: startModules

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * <p>Following the loading and initialization of all the modules
 * this method is called to iterate through the known modules and
 * start them.</p>
 */
private void startModules() {
    for (Module module : modules.values()) {
        boolean started = false;
        try {
            module.start();
        }
        catch (Exception e) {
            if (started && module != null) {
                module.stop();
                module.destroy();
            }
            Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:21,代码来源:XMPPServer.java


示例5: start

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
@Override
public void start() {
    // Check that the service is enabled
    if (!isServiceEnabled()) {
        return;
    }
    super.start();
    // Add the route to this service
    routingTable.addComponentRoute(getAddress(), this);
    // Start the pubsub engine
    engine.start(this);
    ArrayList<String> params = new ArrayList<>();
    params.clear();
    params.add(getServiceDomain());
    Log.info(LocaleUtils.getLocalizedString("startup.starting.pubsub", params));
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:PubSubModule.java


示例6: addStageInformation

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
@Override
protected void addStageInformation(SessionData data, Element command) {
    DataForm form = new DataForm(DataForm.Type.form);
    form.setTitle(LocaleUtils.getLocalizedString("pubsub.command.pending-subscriptions.title"));
    form.addInstruction(
            LocaleUtils.getLocalizedString("pubsub.command.pending-subscriptions.instruction"));

    FormField formField = form.addField();
    formField.setVariable("pubsub#node");
    formField.setType(FormField.Type.list_single);
    formField.setLabel(
            LocaleUtils.getLocalizedString("pubsub.command.pending-subscriptions.node"));
    for (Node node : service.getNodes()) {
        if (!node.isCollectionNode() && node.isAdmin(data.getOwner())) {
            formField.addOption(null, node.getNodeID());
        }
    }
    // Add the form to the command
    command.add(form.getElement());
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:PendingSubscriptionsCommand.java


示例7: updateRegistration

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * Updates a registration via the web interface.
 *
 *
 * @param registrationID ID number associated with registration to modify.
 * @param legacyUsername User's updated username on the legacy service.
 * @param legacyPassword User's updated password on the legacy service, null if no change.
 * @param legacyNickname User's updated nickname on the legacy service.
 * @return Error message or null on success.
 */
public String updateRegistration(Integer registrationID, String legacyUsername, String legacyPassword, String legacyNickname) {
    PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();
    KrakenPlugin plugin = (KrakenPlugin)pluginManager.getPlugin("kraken");
    try {
        Registration reg = new Registration(registrationID);
        if (!plugin.getTransportInstance(reg.getTransportType().toString()).isEnabled()) {
            return LocaleUtils.getLocalizedString("gateway.web.registrations.notenabled", "kraken");
        }
        reg.setUsername(legacyUsername);
        if (legacyPassword != null) {
            reg.setPassword(legacyPassword);
        }
        reg.setNickname(legacyNickname);
        return null;
    }
    catch (NotFoundException e) {
        // Ok, nevermind.
        Log.error("Not found while editing id "+registrationID, e);
        return LocaleUtils.getLocalizedString("gateway.web.registrations.regnotfound", "kraken");
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:32,代码来源:ConfigManager.java


示例8: MSNSession

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * Create a MSN Session instance.
 *
 * @param registration Registration information used for logging in.
 * @param jid JID associated with this session.
 * @param transport Transport instance associated with this session.
 * @param priority Priority of this session.
 */
public MSNSession(Registration registration, JID jid, MSNTransport transport, Integer priority) {
    super(registration, jid, transport, priority);
    setSupportedFeature(SupportedFeature.chatstates);
    setSupportedFeature(SupportedFeature.attention);

    if (Email.parseStr(registration.getUsername()) == null) {
        Message m = new Message();
        m.setType(Message.Type.error);
        m.setTo(getJID());
        m.setFrom(getTransport().getJID());
        m.setBody(LocaleUtils.getLocalizedString("gateway.msn.illegalaccount", "kraken")+" "+registration.getUsername());
        getTransport().sendPacket(m);
        // TODO: this should probably be generic and done within base transport for -all- transports
        // TODO: Also, this Email.parseStr could be used in the "is this a valid username" check
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:25,代码来源:MSNSession.java


示例9: getLastActivity

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
public long getLastActivity(User user) {
    String username = user.getUsername();
    long lastActivity = NULL_LONG;
    Long offlineDate = lastActivityCache.get(username);
    if (offlineDate == null) {
        loadOfflinePresence(username);
    }
    offlineDate = lastActivityCache.get(username);
    if (offlineDate != null) {
        // If the cached answer is no data, return -1.
        if (offlineDate == NULL_LONG) {
            return NULL_LONG;
        }
        else {
            try {
                lastActivity = (System.currentTimeMillis() - offlineDate);
            }
            catch (NumberFormatException e) {
                Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
            }
        }
    }
    return lastActivity;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:25,代码来源:PresenceManagerImpl.java


示例10: getItemCount

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
public int getItemCount(String username) {
    int count = 0;
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(COUNT_ROSTER_ITEMS);
        pstmt.setString(1, username);
        rs = pstmt.executeQuery();
        if (rs.next()) {
            count = rs.getInt(1);
        }
    }
    catch (SQLException e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
    }
    finally {
        DbConnectionManager.closeConnection(rs, pstmt, con);
    }
    return count;
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:23,代码来源:DefaultRosterItemProvider.java


示例11: deleteDispatcherInfo

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * Deletes the DispatcherInfo Object from the given RequestQueue.
 * @param queueID the id of the RequestQueue.
 * @throws UnauthorizedException thrown if the user is not allowed to delete from the db.
 */
public void deleteDispatcherInfo(long queueID) throws UnauthorizedException {
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(DELETE_DISPATCHER);
        pstmt.setLong(1, queueID);
        pstmt.executeUpdate();
    }
    catch (SQLException e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
        throw new UnauthorizedException();
    }
    finally {
        DbConnectionManager.closeConnection(pstmt, con);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:23,代码来源:DbDispatcherInfoProvider.java


示例12: start

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
@Override
public void start() {
       // Check that the service is enabled
       if (!isServiceEnabled()) {
           return;
       }
       super.start();
       // Add the route to this service
       routingTable.addComponentRoute(getAddress(), this);
       // Start the pubsub engine
       engine.start(this);
       ArrayList<String> params = new ArrayList<String>();
       params.clear();
       params.add(getServiceDomain());
       Log.info(LocaleUtils.getLocalizedString("startup.starting.pubsub", params));
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:PubSubModule.java


示例13: getLastActivity

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
@Override
public long getLastActivity(User user) {
    String username = user.getUsername();
    long lastActivity = NULL_LONG;
    Long offlineDate = lastActivityCache.get(username);
    if (offlineDate == null) {
        loadOfflinePresence(username);
    }
    offlineDate = lastActivityCache.get(username);
    if (offlineDate != null) {
        // If the cached answer is no data, return -1.
        if (offlineDate == NULL_LONG) {
            return NULL_LONG;
        }
        else {
            try {
                lastActivity = (System.currentTimeMillis() - offlineDate);
            }
            catch (NumberFormatException e) {
                Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
            }
        }
    }
    return lastActivity;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:PresenceManagerImpl.java


示例14: run

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * Close outgoing server sessions that have been idle for a long time.
 */
@Override
public void run() {
    // Do nothing if this feature is disabled
    int idleTime = SessionManager.getInstance().getServerSessionIdleTime();
    if (idleTime == -1) {
        return;
    }
    final long deadline = System.currentTimeMillis() - idleTime;
    for (RoutableChannelHandler route : routes.values()) {
        // Check outgoing server sessions
        if (route instanceof OutgoingServerSession) {
            Session session = (Session) route;
            try {
                if (session.getLastActiveDate().getTime() < deadline) {
                    session.close();
                }
            }
            catch (Throwable e) {
                Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:27,代码来源:LocalRoutingTable.java


示例15: run

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
       * Close outgoing server sessions that have been idle for a long time.
       */
      @Override
public void run() {
          // Do nothing if this feature is disabled
          int idleTime = SessionManager.getInstance().getServerSessionIdleTime();
          if (idleTime == -1) {
              return;
          }
          final long deadline = System.currentTimeMillis() - idleTime;
          for (RoutableChannelHandler route : routes.values()) {
              // Check outgoing server sessions
              if (route instanceof OutgoingServerSession) {
                  Session session = (Session) route;
                  try {
                      if (session.getLastActiveDate().getTime() < deadline) {
                          session.close();
                      }
                  }
                  catch (Throwable e) {
                      Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
                  }
              }
          }
      }
 
开发者ID:coodeer,项目名称:g3server,代码行数:27,代码来源:LocalRoutingTable.java


示例16: getUsernames

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
@Override
public Iterator<String> getUsernames(String jid) {
    List<String> answer = new ArrayList<>();
    Connection con = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        con = DbConnectionManager.getConnection();
        pstmt = con.prepareStatement(LOAD_USERNAMES);
        pstmt.setString(1, jid);
        rs = pstmt.executeQuery();
        while (rs.next()) {
            answer.add(rs.getString(1));
        }
    }
    catch (SQLException e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
    }
    finally {
        DbConnectionManager.closeConnection(rs, pstmt, con);
    }
    return answer.iterator();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:24,代码来源:DefaultRosterItemProvider.java


示例17: process

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
/**
 * Handle presence updates that affect roster subscriptions.
 *
 * @param presence The presence presence to handle
 * @throws PacketException if the packet is null or the packet could not be routed.
 */
public void process(Presence presence) throws PacketException {
    try {
        process((Packet)presence);
    }
    catch (UnauthorizedException e) {
        try {
            LocalSession session = (LocalSession) sessionManager.getSession(presence.getFrom());
            presence = presence.createCopy();
            if (session != null) {
                presence.setFrom(new JID(null, session.getServerName(), null, true));
                presence.setTo(session.getAddress());
            }
            else {
                JID sender = presence.getFrom();
                presence.setFrom(presence.getTo());
                presence.setTo(sender);
            }
            presence.setError(PacketError.Condition.not_authorized);
            deliverer.deliver(presence);
        }
        catch (Exception err) {
            Log.error(LocaleUtils.getLocalizedString("admin.error"), err);
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:32,代码来源:PresenceUpdateHandler.java


示例18: processPacket

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
public void processPacket(Packet packet) {
    if (!isServiceEnabled()) {
        return;
    }
    // The MUC service will receive all the packets whose domain matches the domain of the MUC
    // service. This means that, for instance, a disco request should be responded by the
    // service itself instead of relying on the server to handle the request.
    try {
        // Check if the packet is a disco request or a packet with namespace iq:register
        if (packet instanceof IQ) {
            if (process((IQ)packet)) {
                return;
            }
        }
        // The packet is a normal packet that should possibly be sent to the room
        JID receipient = packet.getTo();
        String roomName = receipient != null ? receipient.getNode() : null;
        getChatUser(packet.getFrom(), roomName).process(packet);
    }
    catch (Exception e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:24,代码来源:MultiUserChatServiceImpl.java


示例19: passwordReset

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
private IQ passwordReset(String password, IQ packet, String username, Session session)
        throws UnauthorizedException
{
    IQ response;
    // Check if users can change their passwords and a password was specified
    if (!registerHandler.canChangePassword() || password == null || password.length() == 0) {
        throw new UnauthorizedException();
    }
    else {
        try {
            userManager.getUser(username).setPassword(password);
            response = IQ.createResultIQ(packet);
            List<String> params = new ArrayList<String>();
            params.add(username);
            params.add(session.toString());
            Log.info(LocaleUtils.getLocalizedString("admin.password.update", params));
        }
        catch (UserNotFoundException e) {
            throw new UnauthorizedException();
        }
    }
    return response;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:24,代码来源:IQAuthHandler.java


示例20: closeConnection

import org.jivesoftware.util.LocaleUtils; //导入依赖的package包/类
private void closeConnection() {
    release();
    try {
        if (tlsStreamHandler == null) {
            socket.close();
        }
        else {
            // Close the channels since we are using TLS (i.e. NIO). If the channels implement
            // the InterruptibleChannel interface then any other thread that was blocked in
            // an I/O operation will be interrupted and an exception thrown
            tlsStreamHandler.close();
        }
    }
    catch (Exception e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error.close")
                + "\n" + this.toString(), e);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:SocketConnection.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Stream类代码示例发布时间:2022-05-23
下一篇:
Java OAuth2AuthenticationManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap