Package com.google.enterprise.apis.client

Examples of com.google.enterprise.apis.client.GsaClient


     * in this function, the function attempts to cache the queried feeds in a map.
     * The entries in each feed were also themselves stored in a maps after the GData call,
     * in order to speed up subsequent refresh logic. 
     */
    Map<String, Map<String, GsaEntry>> feedMap = new HashMap<String, Map<String, GsaEntry>>();
    GsaClient client = rowData.client;

    try {
      for (int i = 0; i < columnPropList.size(); i++) {

        // do not refresh hostname column or the selection box column
        if ((i == HOST_COLUMN_INDEX) || (i == SELECTION_BOX_COLUMN_INDEX))
          continue;

        ColumnProps colProps = columnPropList.get(i);
        if ((colProps.feedName == null) || (colProps.entryId == null)) {
          continue;
        }

        if (!feedMap.containsKey(colProps.feedName)) {
          // Create another set in the map.
          GsaFeed feed = null;
          feed = client.getFeed(colProps.feedName);
          Map<String, GsaEntry> entryMap = new HashMap<String, GsaEntry>();
          for (GsaEntry entry : feed.getEntries()) {
            String entryID = entry.getGsaContent("entryID");
            entryMap.put(entryID, entry);
          }
View Full Code Here


   *
   * @throws AuthenticationException if failed to authenticate.
   */
  private void initClient() throws AuthenticationException {
    if (gsaClient == null) {
      gsaClient = new GsaClient(optionMap.get("protocol"),
                                optionMap.get("hostname"),
                                Integer.parseInt(optionMap.get("port")),
                                optionMap.get("username"),
                                optionMap.get("password"));
     }
View Full Code Here

      if (password.equals("-")) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        password = in.readLine();
      }
      System.out.println("Start import");
      gsaClient = new GsaClient(address, user, password);
      System.out.println("Login to " + address);
     
      // clear all old rules if required
      if (isReplaceAll) {
        clearAllRules();
View Full Code Here

        notesConnectorSession.getConnector().getGoogleConnectorName(),
        id.toString());

    // Get the GSA client.
    NotesConnector connector = notesConnectorSession.getConnector();
    GsaClient client = null;
    try {
      client = getGsaClient(connector);
    } catch (AuthenticationException e) {
      return false;
    }

    // Delete any existing ACL rules for this database.
    if (!deletePolicyAcl(client, urlPattern)) {
      return false;
    }

    boolean hasUsers = (permitUsers != null && permitUsers.size() > 0);
    boolean hasGroups = (permitGroups != null && permitGroups.size() > 0);

    // If there are no allowed users or groups, we're done.
    if (!(hasUsers || hasGroups)) {
      if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
            "No new users/groups for " + urlPattern);
      }
      return true;
    }

    // Build and add new ACL.
    StringBuilder acl = new StringBuilder();

    // Add groups. getGsaGroups handles URL-encoding.
    if (hasGroups) {
      permitGroups = GsaUtil.getGsaGroups(permitGroups,
          notesConnectorSession.getGsaGroupPrefix());
      for (String group : permitGroups) {
        acl.append("group:").append(group).append(" ");
      }
    }

    // Resolve the Notes names to the PVIs and add users.
    if (hasUsers) {
      permitUsers = notesConnectorSession.getUserGroupManager()
          .mapNotesNamesToGsaNames(notesSession, permitUsers, false);
      for (String user : permitUsers) {
        acl.append("user:").append(user).append(" ");
      }
    }

    // If the acl is empty, pvi lookup must have failed for all users.
    if (acl.length() == 0) {
      LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD,
          "No ACL to send for url pattern: " + urlPattern);
      return false;
    }

    // Send ACL to GSA.
    if (LOGGER.isLoggable(Level.FINE)) {
      LOGGER.logp(Level.FINE, CLASS_NAME, METHOD,
          "Sending ACL for url pattern: " + urlPattern + " with values "
          + acl.toString());
    }
    try {
      GsaEntry entry = new GsaEntry();
      entry.addGsaContent(Terms.PROPERTY_URL_PATTERN, urlPattern);
      entry.addGsaContent(Terms.PROPERTY_POLICY_ACL, acl.toString());
      client.insertEntry(Terms.FEED_POLICY_ACLS, entry);
      LOGGER.logp(Level.FINER, CLASS_NAME, METHOD, "Sent ACL");
    } catch (AuthenticationException e) {
      LOGGER.logp(Level.WARNING, CLASS_NAME, METHOD, e.toString());
      return false;
    } catch (ServiceException e) {
View Full Code Here

          "Connecting to GSA: " + connector.getGsaProtocol() + "://"
          + connector.getGoogleFeedHost() + ":" + connector.getGsaPort()
          + " as " + connector.getGsaUsername());
    }
    try {
      return new GsaClient(connector.getGsaProtocol(),
          connector.getGoogleFeedHost(), connector.getGsaPort(),
          connector.getGsaUsername(), connector.getGsaPassword());
    } catch (AuthenticationException e) {
      LOGGER.logp(Level.FINER, CLASS_NAME, METHOD,
          "Failed to connect to GSA", e);
View Full Code Here

TOP

Related Classes of com.google.enterprise.apis.client.GsaClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.