Package org.apache.manifoldcf.core.interfaces

Examples of org.apache.manifoldcf.core.interfaces.ManifoldCFException


        // This can in theory throw an IOException, so it is possible it is doing socket
        // communication.  In practice, it's unlikely that there's any real IO, so I'm
        // NOT putting it in a background thread for now.
        session.close();
      } catch (InterruptedIOException e) {
        throw new ManifoldCFException(e.getMessage(),e,ManifoldCFException.INTERRUPTED);
      } catch (IOException e) {
        Logging.agents.warn("HDFS: Error closing connection: "+e.getMessage(),e);
        // Eat the exception
      } finally {
        session = null;
View Full Code Here


  /** Set up a session */
  protected HDFSSession getSession() throws ManifoldCFException, ServiceInterruption {
    if (session == null) {
      String nameNodeHost = params.getParameter(ParameterEnum.namenodehost.name());
      if (nameNodeHost == null)
        throw new ManifoldCFException("Namenodehost must be specified");

      String nameNodePort = params.getParameter(ParameterEnum.namenodeport.name());
      if (nameNodePort == null)
        throw new ManifoldCFException("Namenodeport must be specified");
     
      String user = params.getParameter(ParameterEnum.user.name());
      if (user == null)
        throw new ManifoldCFException("User must be specified");
     
      String nameNode = "hdfs://"+nameNodeHost+":"+nameNodePort;
      //System.out.println("Namenode = '"+nameNode+"'");

      /*
       * make Configuration
       */
      Configuration config = null;
      ClassLoader ocl = Thread.currentThread().getContextClassLoader();
      try {
        Thread.currentThread().setContextClassLoader(org.apache.hadoop.conf.Configuration.class.getClassLoader());
        config = new Configuration();
        config.set("fs.default.name", nameNode);
      } finally {
        Thread.currentThread().setContextClassLoader(ocl);
      }
     
      /*
       * get connection to HDFS
       */
      GetSessionThread t = new GetSessionThread(nameNode,config,user);
      try {
        t.start();
        t.finishUp();
      } catch (InterruptedException e) {
        t.interrupt();
        throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
      } catch (java.net.SocketTimeoutException e) {
        handleIOException(e);
      } catch (InterruptedIOException e) {
        t.interrupt();
        handleIOException(e);
View Full Code Here

  /** Handle URISyntaxException */
  protected static void handleURISyntaxException(URISyntaxException e)
    throws ManifoldCFException, ServiceInterruption
  {
    Logging.agents.error("Namenode URI is malformed: "+e.getMessage(),e);
    throw new ManifoldCFException("Namenode URI is malformed: "+e.getMessage(),e);
  }
View Full Code Here

  /** Handle JSONException */
  protected static void handleJSONException(JSONException e)
    throws ManifoldCFException, ServiceInterruption
  {
    Logging.agents.error("JSON parsing error: "+e.getMessage(),e);
    throw new ManifoldCFException("JSON parsing error: "+e.getMessage(),e);
  }
View Full Code Here

  /** Handle IOException */
  protected static void handleIOException(IOException e)
    throws ManifoldCFException, ServiceInterruption
  {
    if (!(e instanceof java.net.SocketTimeoutException) && (e instanceof InterruptedIOException)) {
      throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
    }
    long currentTime = System.currentTimeMillis();
    Logging.agents.warn("HDFS output connection: IO exception: "+e.getMessage(),e);
    throw new ServiceInterruption("IO exception: "+e.getMessage(), e, currentTime + 300000L, currentTime + 3 * 60 * 60000L,-1,false);
  }
View Full Code Here

    try {
      t.start();
      t.finishUp();
    } catch (InterruptedException e) {
      t.interrupt();
      throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
    } catch (java.net.SocketTimeoutException e) {
      handleIOException(e);
    } catch (InterruptedIOException e) {
      t.interrupt();
      handleIOException(e);
View Full Code Here

    try {
      t.start();
      t.finishUp();
    } catch (InterruptedException e) {
      t.interrupt();
      throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
    } catch (java.net.SocketTimeoutException e) {
      handleIOException(e);
    } catch (InterruptedIOException e) {
      t.interrupt();
      handleIOException(e);
View Full Code Here

      t.start();
      t.finishUp();
      return;
    } catch (InterruptedException e) {
      t.interrupt();
      throw new ManifoldCFException("Interrupted: " + e.getMessage(), e, ManifoldCFException.INTERRUPTED);
    } catch (java.net.SocketTimeoutException e) {
      handleIOException(e);
    } catch (InterruptedIOException e) {
      t.interrupt();
      handleIOException(e);
View Full Code Here

    if (session != null) {
      try {
        AuthenticationUtils.endSession();
      } catch (Exception e) {
        Logging.connectors.error("Alfresco: error disconnect:"+e.getMessage(), e);
        throw new ManifoldCFException("Alfresco: error disconnect:"+e.getMessage(), e);
      }
      session = null;
      lastSessionFetch = -1L;
    }
View Full Code Here

  protected void getSession() throws ManifoldCFException, ServiceInterruption {
    if (session == null) {
      // Check for parameter validity

      if (StringUtils.isEmpty(username))
        throw new ManifoldCFException("Parameter " + AlfrescoConfig.USERNAME_PARAM
            + " required but not set");

      if (Logging.connectors.isDebugEnabled())
        Logging.connectors.debug("Alfresco: Username = '" + username + "'");

      if (StringUtils.isEmpty(password))
        throw new ManifoldCFException("Parameter " + AlfrescoConfig.PASSWORD_PARAM
            + " required but not set");

      Logging.connectors.debug("Alfresco: Password exists");

      if (StringUtils.isEmpty(protocol))
        throw new ManifoldCFException("Parameter " + AlfrescoConfig.PROTOCOL_PARAM
            + " required but not set");
     
      if (StringUtils.isEmpty(server))
        throw new ManifoldCFException("Parameter " + AlfrescoConfig.SERVER_PARAM
            + " required but not set");
     
      if (StringUtils.isEmpty(port))
        throw new ManifoldCFException("Parameter " + AlfrescoConfig.PORT_PARAM
            + " required but not set");
     
      if (StringUtils.isEmpty(path))
        throw new ManifoldCFException("Parameter " + AlfrescoConfig.PATH_PARAM
            + " required but not set");
   
    endpoint = protocol+"://"+server+":"+port+path;
    try {
   
      WebServiceFactory.setEndpointAddress(endpoint);
      WebServiceFactory.setTimeoutMilliseconds(socketTimeout);
      AuthenticationUtils.startSession(username, password);
      session = AuthenticationUtils.getAuthenticationDetails();
     
    }catch (AuthenticationFault e) {
        Logging.connectors.warn(
            "Alfresco: Error during authentication. Username: "+username + ", endpoint: "+endpoint+". "
                + e.getMessage(), e);
        handleIOException(e);
      } catch (WebServiceException e){
        Logging.connectors.warn(
            "Alfresco: Error during trying to authenticate the user. Username: "+username + ", endpoint: "+endpoint
            +". Please check the connector parameters. "
            + e.getMessage(), e);
        throw new ManifoldCFException("Alfresco: Error during trying to authenticate the user. Username: "+username + ", endpoint: "+endpoint
            +". Please check the connector parameters. "
            + e.getMessage(), e);
      }
   
    lastSessionFetch = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of org.apache.manifoldcf.core.interfaces.ManifoldCFException

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.