Package org.apache.ambari.server.view.configuration

Examples of org.apache.ambari.server.view.configuration.ResourceConfig


    Collection<ViewSubResourceDefinition> resourceDefinitions = viewDefinition.getResourceDefinitions().values();
    for (ViewSubResourceDefinition resourceDefinition : resourceDefinitions) {

      Resource.Type  type           = resourceDefinition.getType();
      ResourceConfig resourceConfig = resourceDefinition.getResourceConfiguration();

      ViewResourceHandler viewResourceService = new ViewSubResourceService(type, viewInstanceDefinition);

      ClassLoader cl = viewDefinition.getClassLoader();

      Object service = getService(resourceConfig.getServiceClass(cl), viewResourceService, viewInstanceContext);

      if (resourceConfig.isExternal()) {
        externalSubResourceService.addResourceService(resourceConfig.getName(), service);
      } else {
        viewInstanceDefinition.addService(viewDefinition.getResourceDefinition(type).getPluralName(),service);
        viewInstanceDefinition.addResourceProvider(type,
            getProvider(resourceConfig.getProviderClass(cl), viewInstanceContext));
      }
    }

    setPersistenceEntities(viewInstanceDefinition);
View Full Code Here


  @Test
  public void testAddGetResourceConfiguration() throws Exception {
    ViewDefinition viewDefinition = getViewDefinition();

    ResourceConfig config = ResourceConfigTest.getResourceConfigs().get(0);

    Resource.Type type1 = new Resource.Type("myType");

    viewDefinition.addResourceConfiguration(type1, config);
View Full Code Here

    Assert.assertEquals("MY_VIEW/subresource", subResourceDefinitions.iterator().next().getType().name());
  }

  public static ViewSubResourceDefinition getViewSubResourceDefinition() throws Exception {
    ViewDefinition viewDefinition = ViewDefinitionTest.getViewDefinition();
    ResourceConfig resourceConfig = ResourceConfigTest.getResourceConfigs().get(0);

    return new ViewSubResourceDefinition(viewDefinition, resourceConfig);
  }
View Full Code Here

  @Test
  public void testGetSubResourceDefinitions() throws Exception {
    ViewDefinition viewDefinition = ViewDefinitionTest.getViewDefinition();
    ViewRegistry registry = ViewRegistry.getInstance();

    ResourceConfig config = ResourceConfigTest.getResourceConfigs().get(0);
    Resource.Type type1 = new Resource.Type("myType");

    ResourceProvider provider1 = createNiceMock(ResourceProvider.class);
    viewDefinition.addResourceProvider(type1, provider1);
View Full Code Here

    Collection<ViewSubResourceDefinition> resourceDefinitions = viewDefinition.getResourceDefinitions().values();
    for (ViewSubResourceDefinition resourceDefinition : resourceDefinitions) {

      Resource.Type  type           = resourceDefinition.getType();
      ResourceConfig resourceConfig = resourceDefinition.getResourceConfiguration();

      ViewResourceHandler viewResourceService =
          new ViewSubResourceService(type, viewDefinition.getName(), instanceConfig.getName());

      ClassLoader cl = viewDefinition.getClassLoader();

      Object service = getService(resourceConfig.getServiceClass(cl), viewResourceService, viewInstanceContext);

      if (resourceConfig.isExternal()) {
        externalSubResourceService.addResourceService(resourceConfig.getName(), service);
      } else {
        viewInstanceDefinition.addService(viewDefinition.getResourceDefinition(type).getPluralName(),service);
        viewInstanceDefinition.addResourceProvider(type,
            getProvider(resourceConfig.getProviderClass(cl), viewInstanceContext));
      }
    }

    viewDefinition.addInstanceDefinition(viewInstanceDefinition);
    ViewRegistry.getInstance().addInstanceDefinition(viewDefinition, viewInstanceDefinition);
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.view.configuration.ResourceConfig

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.