Esempio n. 1
0
  public SipXVCardProvider() {
    super();

    defaultProvider = new DefaultVCardProvider();

    String clientConfig = getConfDir() + MONGO_CLIENT_CONFIG;
    try {
      UnfortunateLackOfSpringSupportFactory.initialize(clientConfig);
      if (new File("/tmp/sipx.properties").exists()) {
        System.getProperties().load(new FileInputStream(new File("/tmp/sipx.properties")));
      }

    } catch (Exception e) {
      logger.error(e);
    }

    String cacheName = "SipXVCardCache";
    vcardCache = CacheFactory.createCache(cacheName);

    logger.info(this.getClass().getName() + " starting XML RPC server ...");
    try {
      VCardRpcServer vcardRpcServer = new VCardRpcServer(ContactInfoHandlerImp.class);
      vcardRpcServer.start();
      logger.info(this.getClass().getName() + " initialized");
    } catch (Exception ex) {
      logger.error(ex);
    }
  }
  public Collection<String> getGroupNames(JID user) {
    Cache<JID, Collection<String>> userMembershipCache =
        CacheFactory.createCache(USER_MEMBERSHIP_CACHE_NAME);
    Collection<String> groups = userMembershipCache.get(user);
    if (groups != null) {
      return groups;
    }

    try {
      groups = manager.getUserGroups(user.getNode());
      userMembershipCache.put(user, groups);
      return groups;
    } catch (RemoteException re) {
      LOG.error("Failure to load the groups of user:" + String.valueOf(user), re);
    }

    userMembershipCache.put(user, new ArrayList<String>());
    return Collections.emptyList();
  }
  private void init() {
    // Register the trust manager to use when using HTTPS
    Protocol easyhttps =
        new Protocol("https", (ProtocolSocketFactory) new SSLProtocolSocketFactory(this), 443);
    Protocol.registerProtocol("https", easyhttps);

    // Convert XML based provider setup to Database based
    JiveGlobals.migrateProperty("clearspace.uri");
    JiveGlobals.migrateProperty("clearspace.sharedSecret");

    // Make sure that all Clearspace components are set up, unless they were overridden
    // Note that the auth provider is our way of knowing that we are set up with Clearspace,
    // so don't bother checking to set it.
    if (isEnabled()) {
      if (JiveGlobals.getProperty("provider.user.className") == null) {
        JiveGlobals.setProperty(
            "provider.user.className",
            "org.jivesoftware.openfire.clearspace.ClearspaceUserProvider");
      }
      if (JiveGlobals.getProperty("provider.group.className") == null) {
        JiveGlobals.setProperty(
            "provider.group.className",
            "org.jivesoftware.openfire.clearspace.ClearspaceGroupProvider");
      }
      if (JiveGlobals.getProperty("provider.vcard.className") == null) {
        JiveGlobals.setProperty(
            "provider.vcard.className",
            "org.jivesoftware.openfire.clearspace.ClearspaceVCardProvider");
      }
      if (JiveGlobals.getProperty("provider.lockout.className") == null) {
        JiveGlobals.setProperty(
            "provider.lockout.className",
            "org.jivesoftware.openfire.clearspace.ClearspaceLockOutProvider");
      }
      if (JiveGlobals.getProperty("provider.securityAudit.className") == null) {
        JiveGlobals.setProperty(
            "provider.securityAudit.className",
            "org.jivesoftware.openfire.clearspace.ClearspaceSecurityAuditProvider");
      }
      if (JiveGlobals.getProperty("provider.admin.className") == null) {
        JiveGlobals.setProperty(
            "provider.admin.className",
            "org.jivesoftware.openfire.clearspace.ClearspaceAdminProvider");
      }
    }

    this.uri = properties.get("clearspace.uri");
    if (uri != null) {
      if (!this.uri.endsWith("/")) {
        this.uri = this.uri + "/";
      }
      // Updates the host/port attributes based on the uri
      updateHostPort();
    }
    sharedSecret = properties.get("clearspace.sharedSecret");

    // Creates the cache maps
    userIDCache = new DefaultCache<String, Long>("clearspace.userid", 1000, JiveConstants.DAY);
    groupIDCache = new DefaultCache<String, Long>("clearspace.groupid", 1000, JiveConstants.DAY);
    usernameCache = new DefaultCache<Long, String>("clearspace.username", 1000, JiveConstants.DAY);

    if (Log.isDebugEnabled()) {
      StringBuilder buf = new StringBuilder();
      buf.append("Created new ClearspaceManager() instance, fields:\n");
      buf.append("\t URI: ").append(uri).append("\n");
      buf.append("\t sharedSecret: ").append(sharedSecret).append("\n");

      Log.debug("ClearspaceManager: " + buf.toString());
    }

    // Init nonce cache
    nonceCache = CacheFactory.createCache("Clearspace SSO Nonce");
    // Init nonce generator
    nonceGenerator = new Random();
  }
 /** Default constructor creates the cache. */
 public DefaultFileTransferManager() {
   super("File Transfer Manager");
   fileTransferMap = CacheFactory.createCache(CACHE_NAME);
   InterceptorManager.getInstance().addInterceptor(new MetaFileTransferInterceptor());
 }
Esempio n. 5
0
 private PrivacyListManager() {
   // Create the cache of privacy lists
   String cacheName = "Privacy Lists";
   listsCache = CacheFactory.createCache(cacheName);
 }
 /** Constructs a new offline message store. */
 public OfflineMessageStore() {
   super("Offline Message Store");
   sizeCache = CacheFactory.createCache("Offline Message Size");
 }