Package org.apache.uima.collection.impl.base_cpm.container

Examples of org.apache.uima.collection.impl.base_cpm.container.ServiceConnectionException


                    new Object[] { Thread.currentThread().getName(), aService,
                        String.valueOf(maxCount) });
          }
          throw new ResourceInitializationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE, new Object[] {
              Thread.currentThread().getName(), aService, String.valueOf(maxCount) },
                  new ServiceConnectionException("Unable to connect to service :::" + aService));
        }
      }

    }
    // Connected to the service so add tap to Cas Processor
View Full Code Here


        if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
                  "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
                  new Object[] { Thread.currentThread().getName(), name });
        }
        throw new ResourceProcessException(new ServiceConnectionException(Thread.currentThread()
                .getName()
                + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                        "UIMA_CPM_EXP_service_down__WARNING", new Object[] {
                            Thread.currentThread().getName(), name })));
      }
View Full Code Here

        if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
                  "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
                  new Object[] { Thread.currentThread().getName(), name });
        }
        throw new ResourceProcessException(new ServiceConnectionException("Service::" + name
                + " appears to be down"));
      }

      if (resourceMetadata == null) {
        resourceMetadata = textAnalysisProxy.getAnalysisEngineMetaData();
View Full Code Here

        if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
                  "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
                  new Object[] { Thread.currentThread().getName(), name });
        }
        throw new ResourceProcessException(new ServiceConnectionException(Thread.currentThread()
                .getName()
                + CpmLocalizedMessage.getLocalizedMessage(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                        "UIMA_CPM_EXP_service_down__WARNING", new Object[] {
                            Thread.currentThread().getName(), name })));
      }
View Full Code Here

        if (UIMAFramework.getLogger().isLoggable(Level.INFO)) {
          UIMAFramework.getLogger(this.getClass()).logrb(Level.INFO, this.getClass().getName(),
                  "process", CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_service_down__INFO",
                  new Object[] { Thread.currentThread().getName(), name });
        }
        throw new ResourceProcessException(new ServiceConnectionException("Service::" + name
                + " appears to be down"));
      }

      if (resourceMetadata == null) {
        resourceMetadata = textAnalysisProxy.getAnalysisEngineMetaData();
View Full Code Here

  public void processCas(CAS aCAS) throws ResourceProcessException {
    try {
      // delegate analysis of the CAS to remote object
      transport.process(socket, aCAS);
    } catch (SocketException e) {
      throw new ResourceProcessException(new ServiceConnectionException(e));
    } catch (Exception e) {
      throw new ResourceProcessException(e);
    }
  }
View Full Code Here

      for (int i = 0; i < aCASes.length; i++) {
        // delegate analysis of the CASes to remote object
        transport.process(socket, aCASes[i]);
      }
    } catch (SocketException e) {
      throw new ResourceProcessException(new ServiceConnectionException(e));
    } catch (SocketTimeoutException e) {
      throw new ResourceProcessException(e);
    }
  }
View Full Code Here

        UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
                "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                "UIMA_CPM_vns_not_provided__SEVERE",
                new Object[] { Thread.currentThread().getName() });
      }
      throw new ServiceConnectionException(CpmLocalizedMessage.getLocalizedMessage(
              CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_vinci_vns_cfg_invalid__WARNING",
              new Object[] { Thread.currentThread().getName() }));
    }

    System.setProperty("VNS_HOST", getVNSHost());
    System.setProperty("VNS_PORT", getVNSPort());

    try {
      if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(this.getClass()).logrb(
                Level.FINEST,
                this.getClass().getName(),
                "initialize",
                CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                "UIMA_CPM_locating_service__FINEST",
                new Object[] { Thread.currentThread().getName(), aServiceName,
                    System.getProperty("VNS_HOST"), System.getProperty("VNS_PORT") });
      }
      // Override vinci default VNS settings
      VinciContext vctx = new VinciContext(InetAddress.getLocalHost().getCanonicalHostName(), 0);
      vctx.setVNSHost(getVNSHost());
      vctx.setVNSPort(Integer.parseInt(getVNSPort()));

      if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(this.getClass()).log(
                Level.FINEST,
                Thread.currentThread().getName() + " Connecting to::" + aServiceName
                        + " VinciContext.getVNSHost():" + vctx.getVNSHost()
                        + " VinciContext.getVNSPort():" + vctx.getVNSPort()); // getVNSHost());
      }
      // establish connection to service
      conn = new VinciClient(aServiceName, vctx);
      conn.setSocketTimeout(timeout);
      conn.setRetry(false);
      if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
        UIMAFramework.getLogger(this.getClass()).logrb(
                Level.FINEST,
                this.getClass().getName(),
                "initialize",
                CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                "UIMA_CPM_set_service_timeout__FINEST",
                new Object[] { Thread.currentThread().getName(),
                    aServiceName + ":" + String.valueOf(timeout) });
      }
      serviceHost = conn.getHost();
      servicePort = String.valueOf(conn.getPort());
      serviceName = aServiceName;
      // Sucessfull connection. Return
      return;

    } catch (Exception e) {
      if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
        UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
                "initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
                "UIMA_CPM_connection_failed__WARNING",
                new Object[] { Thread.currentThread().getName(), aServiceName, "" });

        UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                Thread.currentThread().getName(), e);
      }
    }

    // If we are here there was a problem connecting to Vinci service
    throw new ServiceConnectionException(CpmLocalizedMessage.getLocalizedMessage(
            CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_unable_to_connect_toservice__WARNING",
            new Object[] { Thread.currentThread().getName(), aServiceName }));
  }
View Full Code Here

              new Object[] { Thread.currentThread().getName(), conn.getHost(),
                  String.valueOf(conn.getPort()) });
      UIMAFramework.getLogger(this.getClass()).log(Level.WARNING, Thread.currentThread().getName(),
              sde);
      conn.close();
      throw new ServiceConnectionException(sde.getMessage());
    } catch (ServiceException sde) {
      UIMAFramework.getLogger(this.getClass()).logrb(
              Level.WARNING,
              this.getClass().getName(),
              "process",
              CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_failed_service_request__WARNING",
              new Object[] { Thread.currentThread().getName(), conn.getHost(),
                  String.valueOf(conn.getPort()) });
      UIMAFramework.getLogger(this.getClass()).log(Level.WARNING, Thread.currentThread().getName(),
              sde);
      if (sde.getMessage().equals("Unknown command") && aFrame != null) {
        UIMAFramework.getLogger(this.getClass()).log(Level.INFO, aFrame.toXML());
      }
      throw new ServiceConnectionException(sde.getMessage());
    } catch (IOException e) {
      UIMAFramework.getLogger(this.getClass()).logrb(
              Level.WARNING,
              this.getClass().getName(),
              "process",
              CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_failed_service_request__WARNING",
              new Object[] { Thread.currentThread().getName(), conn.getHost(),
                  String.valueOf(conn.getPort()) });
      UIMAFramework.getLogger(this.getClass()).log(Level.WARNING, Thread.currentThread().getName(),
              e);
      conn.close();
      if (System.getProperty("TEST_BEFORE_SEND") != null) {
        testAndReconnect();
      }
      if (e instanceof SocketTimeoutException) {
        UIMAFramework.getLogger(this.getClass()).log(Level.WARNING,
                Thread.currentThread().getName() + "  Exception Cause::" + e.getClass().getName());
        throw new ServiceConnectionException(e);
      }
      throw new ServiceConnectionException(CpmLocalizedMessage.getLocalizedMessage(
              CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_service_timeout__WARNING",
              new Object[] { Thread.currentThread().getName(), conn.getHost(),
                  String.valueOf(conn.getPort()), String.valueOf(currentTimeout) }));
    } catch (Exception e) {
      UIMAFramework.getLogger(this.getClass()).logrb(
View Full Code Here

                    new Object[] { Thread.currentThread().getName(), aService,
                        String.valueOf(maxCount) });
          }
          throw new ResourceInitializationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE, new Object[] {
              Thread.currentThread().getName(), aService, String.valueOf(maxCount) },
                  new ServiceConnectionException("Unable to connect to service :::" + aService));
        }
      }

    }
    // Connected to the service so add tap to Cas Processor
View Full Code Here

TOP

Related Classes of org.apache.uima.collection.impl.base_cpm.container.ServiceConnectionException

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.