Пример #1
0
    /**
     * Gets the actual XMPP transport
     *
     * @param <T> the generic type
     * @param <V> the value type
     * @param params the params
     * @param handle the handle
     * @return the xmpp transport
     */
    public <T extends Capability, V> XmppTransport get(
        final ObjectNode params, final Handler<V> handle) {
      final Handler<Receiver> newHandle = Transport.TYPEUTIL.inject(handle);
      final XmppTransportConfig config = XmppTransportConfig.decorate(params);
      final URI address = config.getAddress();
      XmppTransport result = instances.get(address);

      if (result == null) {
        result = new XmppTransport(config, newHandle, this);
        instances.put(address, result);
      } else {
        result.getHandle().update(newHandle);
      }
      return result;
    }
Пример #2
0
 @Override
 public XmppTransport build() {
   if (singleton == null) {
     singleton = new XmppService();
     singleton.doesShortcut = XmppTransportConfig.decorate(getParams()).getDoShortcut();
   }
   return singleton.get(getParams(), getHandle());
 }