Package com.google.enterprise.connector.dctm.dfcwrap

Examples of com.google.enterprise.connector.dctm.dfcwrap.IClientX


  DmDocument document;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    IClientX dctmClientX;
    IClient localClient;

    ILoginInfo loginInfo;
    dctmClientX = new DmClientX();
    localClient = dctmClientX.getLocalClient();
    sessionManager = localClient.newSessionManager();
    loginInfo = dctmClientX.getLoginInfo();
    loginInfo.setUser(DmInitialize.DM_LOGIN_OK1);
    loginInfo.setPassword(DmInitialize.DM_PWD_OK1);
    sessionManager.setIdentity(DmInitialize.DM_DOCBASE, loginInfo);

    session = sessionManager.getSession(DmInitialize.DM_DOCBASE);
    object =
        (ISysObject) session.getObject(dctmClientX.getId(DmInitialize.DM_ID1));
    document = createNewDocument(session);
  }
View Full Code Here


  @Override
  protected void setUp() throws Exception {
    super.setUp();

    IClientX dctmClientX;

    IClient localClient = null;

    dctmClientX = new DmClientX();

    localClient = dctmClientX.getLocalClient();

    sessionManager = localClient.newSessionManager();
    loginInfo = dctmClientX.getLoginInfo();
    loginInfo.setUser(user);

    loginInfo.setPassword(password);

    sessionManager.setIdentity(docbase, loginInfo);
View Full Code Here

  IFormat dctmForm;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    IClientX dctmClientX = new DmClientX();

    IClient localClient = dctmClientX.getLocalClient();

    ISessionManager sessionManager = localClient.newSessionManager();

    ISession session = null;

    ILoginInfo loginInfo = dctmClientX.getLoginInfo();
    loginInfo.setUser(DmInitialize.DM_LOGIN_OK1);
    loginInfo.setPassword(DmInitialize.DM_PWD_OK1);
    sessionManager.setIdentity(DmInitialize.DM_DOCBASE, loginInfo);
    try {
      session = sessionManager.newSession(DmInitialize.DM_DOCBASE);
      IId id = dctmClientX.getId(DmInitialize.DM_ID1);
      ISysObject object = (ISysObject) session.getObject(id);
      dctmForm = (DmFormat) object.getFormat();
    } finally {
      if (session != null) {
        sessionManager.release(session);
View Full Code Here

  @Override
  public ConfigureResponse getConfigForm(Locale language) {
    ResourceBundle resource = getResources(language);
    try {
      IClientX cl = getClientX();
      return new ConfigureResponse("",
          makeValidatedForm(null, resource, cl, null));
    } catch (RepositoryException e) {
      // If we can't connect to DFC at all, return just an error message.
      logger.log(Level.SEVERE,
View Full Code Here

        configData.put(ADVANCEDCONF, "off");

      ISession sess = null;
      ISessionManager sessMag = null;
      boolean isCoreConfigValid = false;
      IClientX cl = null;
      try {
        cl = getClientX();
        sessMag = getSessionManager(cl, configData);

        ILoginInfo myinfo = sessMag.getIdentity(configData.get(DOCBASENAME));
        String user = myinfo.getUser();
        logger.config("login user: " + user);

        sess = getSession(configData, sessMag);

        logger.fine("test connection to the repository: " + sess);
        logger.info("DFC " + cl.getDFCVersion()
            + " connected to Content Server " + sess.getServerVersion());
        isCoreConfigValid = true;

        testWebtopUrl(configData.get(DISPLAYURL));

        // Display the form again when the advanced conf checkbox is
        // checked and a JavaScript action submitted the form.
        if (configData.get(ADVANCEDCONF).equals("on")
            && configData.get(ACTIONUPDATE).equals("redisplay")) {
          logger.config("Redisplay the configuation form");
          String form = makeValidatedForm(configData, resource, cl, sess);
          return new ConfigureResponse("", form);
        }

        checkWhereClause(configData, cl, sess, connectorFactory);
      } catch (RepositoryException e) {
        logger.log(Level.SEVERE,
            "RepositoryException thrown in validateConfig: ", e);

        if (!isCoreConfigValid) {
          // If there's a problem with the core configuration, we will
          // turn the advanced configuration off until the user fixes
          // the problem.
          configData.put(ADVANCEDCONF, "off");
          logger.config("ADVANCEDCONF reset to off");
        }

        if (cl == null) {
          // If we can't connect to DFC at all, return just an error message.
          return createErrorResponse(e, resource, ErrorStyle.VALIDATE_CONFIG);
        }

        // Return the config form with an error message.
        return createErrorResponse(configData, e, resource, cl, sess,
            ErrorStyle.VALIDATE_CONFIG);
      } finally {
        if (sess != null) {
          sessMag.release(sess);
          logger.fine("Release sessionConfig");
        }
      }

      // There's no need to persist action_update.
      configData.remove(ACTIONUPDATE);

      return null;
    } else {
      if (!missing.equals(DISPLAYURL)) {
        // If there's a problem with the core configuration, we will
        // turn the advanced configuration off until the user fixes
        // the problem.
        configData.put(ADVANCEDCONF, "off");
        logger.config("ADVANCEDCONF reset to off");
      }

      // Return the config form with an error message indicating the
      // name of the missing parameter.
      String form;
      try {
        IClientX cl = getClientX();
        form = makeValidatedForm(configData, resource, cl, null);
      } catch (RepositoryException e) {
        form = "";
      }
      return new ConfigureResponse(resource.getString(missing + "_error"),
View Full Code Here

    ConfigureResponse result = null;

    // We use the session here to validate the username, password, and
    // docbase. We will also need it later in makeValidatedForm if the
    // advanced config is turned on.
    IClientX cl = null;
    ISessionManager sessMag = null;
    ISession sess = null;
    try {
      cl = getClientX();
      sessMag = getSessionManager(cl, configMap);
View Full Code Here

    FormSnippet snippet = builder.build(configMap, resource, cl, sess);
    return snippet.render();
  }

  private IClientX getClientX() throws RepositoryException {
    IClientX cl;
    try {
      cl = (IClientX) Class.forName(clientXclassName).newInstance();
    } catch (InstantiationException e) {
      Throwable cause = e.getCause();
      if (cause instanceof RepositoryException)
View Full Code Here

import junit.framework.TestCase;

public class MockMockListTest extends TestCase {
  public void testMockMockList() {
    IClientX dctmClientX = new MockDmClientX();
    IClient localClient = null;
    try {
      localClient = dctmClientX.getLocalClient();
    } catch (RepositoryException e) {
      assertTrue(false);
    }
    ISessionManager sessionManager = localClient.newSessionManager();
    ILoginInfo ili = new MockDmLoginInfo();
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    super.setUp();

    IClientX dctmClientX = new MockDmClientX();
    IClient localClient = dctmClientX.getLocalClient();
    ISessionManager sessionManager = localClient.newSessionManager();
    ILoginInfo ili = new MockDmLoginInfo();
    ili.setUser("mark");
    ili.setPassword("mark");
    sessionManager.setIdentity(DmInitialize.DM_DOCBASE, ili);
    ISession sess7 = sessionManager.getSession(DmInitialize.DM_DOCBASE);

    IId id = dctmClientX.getId(DmInitialize.DM_ID2);
    object = (ISysObject) sess7.getObject(id);
  }
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.dctm.dfcwrap.IClientX

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.