org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider Java Examples

The following examples show how to use org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AHSWebApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(AHSWebServices.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(ApplicationBaseProtocol.class).toInstance(historyClientService);
  bind(TimelineDataManager.class).toInstance(timelineDataManager);
  route("/", AHSController.class);
  route(pajoin("/apps", APP_STATE), AHSController.class);
  route(pajoin("/app", APPLICATION_ID), AHSController.class, "app");
  route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), AHSController.class,
    "appattempt");
  route(pajoin("/container", CONTAINER_ID), AHSController.class, "container");
  route(
    pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), AHSController.class, "logs");
}
 
Example #2
Source File: AHSWebApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Override
public void setup() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(AHSWebServices.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(ApplicationBaseProtocol.class).toInstance(historyClientService);
  bind(TimelineDataManager.class).toInstance(timelineDataManager);
  route("/", AHSController.class);
  route(pajoin("/apps", APP_STATE), AHSController.class);
  route(pajoin("/app", APPLICATION_ID), AHSController.class, "app");
  route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), AHSController.class,
    "appattempt");
  route(pajoin("/container", CONTAINER_ID), AHSController.class, "container");
  route(
    pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
      CONTAINER_LOG_TYPE), AHSController.class, "logs");
}
 
Example #3
Source File: AMSWebApp.java    From ambari-metrics with Apache License 2.0 5 votes vote down vote up
@Override
public void setup() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(TimelineMetricStore.class).toInstance(timelineMetricStore);
  route("/", AMSController.class);
}
 
Example #4
Source File: TestTimelineWebServices.java    From ambari-metrics with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureServlets() {
  bind(YarnJacksonJaxbJsonProvider.class);
  bind(TimelineWebServices.class);
  bind(GenericExceptionHandler.class);
  try {
    metricStore = new TestTimelineMetricStore();
  } catch (Exception e) {
    Assert.fail();
  }
  bind(TimelineMetricStore.class).toInstance(metricStore);
  serve("/*").with(GuiceContainer.class);
}
 
Example #5
Source File: TestTimelineWebServices.java    From ambari-metrics with Apache License 2.0 5 votes vote down vote up
public TestTimelineWebServices() {
  super(new WebAppDescriptor.Builder(
    "org.apache.ambari.metrics.webapp")
    .contextListenerClass(GuiceServletConfig.class)
    .filterClass(com.google.inject.servlet.GuiceFilter.class)
    .contextPath("jersey-guice-filter")
    .servletPath("/")
    .clientConfig(new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
    .build());
}
 
Example #6
Source File: TestTimelineWebServices.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public TestTimelineWebServices() {
  super(new WebAppDescriptor.Builder(
      "org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
      .contextListenerClass(GuiceServletConfig.class)
      .filterClass(com.google.inject.servlet.GuiceFilter.class)
      .contextPath("jersey-guice-filter")
      .servletPath("/")
      .clientConfig(
          new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
      .build());
}
 
Example #7
Source File: TestTimelineWebServices.java    From big-c with Apache License 2.0 5 votes vote down vote up
public TestTimelineWebServices() {
  super(new WebAppDescriptor.Builder(
      "org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
      .contextListenerClass(GuiceServletConfig.class)
      .filterClass(com.google.inject.servlet.GuiceFilter.class)
      .contextPath("jersey-guice-filter")
      .servletPath("/")
      .clientConfig(
          new DefaultClientConfig(YarnJacksonJaxbJsonProvider.class))
      .build());
}
 
Example #8
Source File: TimelineClientImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
protected void serviceInit(Configuration conf) throws Exception {
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
  UserGroupInformation realUgi = ugi.getRealUser();
  if (realUgi != null) {
    authUgi = realUgi;
    doAsUser = ugi.getShortUserName();
  } else {
    authUgi = ugi;
    doAsUser = null;
  }
  ClientConfig cc = new DefaultClientConfig();
  cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
  connConfigurator = newConnConfigurator(conf);
  if (UserGroupInformation.isSecurityEnabled()) {
    authenticator = new KerberosDelegationTokenAuthenticator();
  } else {
    authenticator = new PseudoDelegationTokenAuthenticator();
  }
  authenticator.setConnectionConfigurator(connConfigurator);
  token = new DelegationTokenAuthenticatedURL.Token();

  connectionRetry = new TimelineClientConnectionRetry(conf);
  client = new Client(new URLConnectionClientHandler(
      new TimelineURLConnectionFactory()), cc);
  TimelineJerseyRetryFilter retryFilter = new TimelineJerseyRetryFilter();
  client.addFilter(retryFilter);

  if (YarnConfiguration.useHttps(conf)) {
    resURI = URI
        .create(JOINER.join("https://", conf.get(
            YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
            YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS),
            RESOURCE_URI_STR));
  } else {
    resURI = URI.create(JOINER.join("http://", conf.get(
        YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS),
        RESOURCE_URI_STR));
  }
  LOG.info("Timeline service address: " + resURI);
  super.serviceInit(conf);
}
 
Example #9
Source File: TimelineClientImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
protected void serviceInit(Configuration conf) throws Exception {
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
  UserGroupInformation realUgi = ugi.getRealUser();
  if (realUgi != null) {
    authUgi = realUgi;
    doAsUser = ugi.getShortUserName();
  } else {
    authUgi = ugi;
    doAsUser = null;
  }
  ClientConfig cc = new DefaultClientConfig();
  cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
  connConfigurator = newConnConfigurator(conf);
  if (UserGroupInformation.isSecurityEnabled()) {
    authenticator = new KerberosDelegationTokenAuthenticator();
  } else {
    authenticator = new PseudoDelegationTokenAuthenticator();
  }
  authenticator.setConnectionConfigurator(connConfigurator);
  token = new DelegationTokenAuthenticatedURL.Token();

  connectionRetry = new TimelineClientConnectionRetry(conf);
  client = new Client(new URLConnectionClientHandler(
      new TimelineURLConnectionFactory()), cc);
  TimelineJerseyRetryFilter retryFilter = new TimelineJerseyRetryFilter();
  client.addFilter(retryFilter);

  if (YarnConfiguration.useHttps(conf)) {
    resURI = URI
        .create(JOINER.join("https://", conf.get(
            YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
            YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS),
            RESOURCE_URI_STR));
  } else {
    resURI = URI.create(JOINER.join("http://", conf.get(
        YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS),
        RESOURCE_URI_STR));
  }
  LOG.info("Timeline service address: " + resURI);
  super.serviceInit(conf);
}