Examples of PropertyProvider


Examples of com.google.gwt.dev.cfg.PropertyProvider

  private static final SortedSet<ConfigurationProperty> configProperties = new TreeSet<ConfigurationProperty>();

  public void testNoFallback() throws UnableToCompleteException {
    BindingProperty bp = new BindingProperty("doesNotUseFallback");
    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);
    bp.setProvider(provider);
    StandardSelectionProperty property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider(logger,
        configProperties));

    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);
    bp.setProvider(provider);
    property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_MULTIFALLBACK_EMPTY, property.getPropertyProvider(
        logger, configProperties));
  }
View Full Code Here

Examples of com.google.gwt.dev.cfg.PropertyProvider

  }

  public void testPropertyProviderGenerator() throws UnableToCompleteException {
    BindingProperty bp = new BindingProperty("providerGenerator");
    bp.setFallback(FBV);
    PropertyProvider provider = new PropertyProvider("bad");
    bp.setProvider(provider);
    bp.setProviderGenerator(MyProviderGenerator.class);
    StandardSelectionProperty property = new StandardSelectionProperty(bp);
    assertEquals("good " + FBV, property.getPropertyProvider(logger,
        configProperties));
View Full Code Here

Examples of com.google.gwt.dev.cfg.PropertyProvider

  }

  public void testWithFallback() throws UnableToCompleteException {
    BindingProperty bp = new BindingProperty("doesUseFallback");
    bp.setFallback(FBV);
    PropertyProvider provider = new PropertyProvider(PROVIDER_NOFALLBACK);
    bp.setProvider(provider);
    StandardSelectionProperty property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_NOFALLBACK, property.getPropertyProvider(logger,
        configProperties));

    provider = new PropertyProvider(PROVIDER_MULTIFALLBACK);
    bp.setProvider(provider);
    property = new StandardSelectionProperty(bp);
    assertEquals(PROVIDER_MULTIFALLBACK_FBV, property.getPropertyProvider(
        logger, configProperties));
  }
View Full Code Here

Examples of com.google.gwt.dev.cfg.PropertyProvider

  public void testBuildPropertyProviderRegistrator() throws UnableToCompleteException {
    // Sets up environment.
    Set<String> allRootTypes = Sets.newHashSet();
    Properties properties = new Properties();
    BindingProperty userAgentProperty = properties.createBinding("user.agent");
    userAgentProperty.setProvider(new PropertyProvider("return navigator.userAgent;"));
    userAgentProperty.addTargetLibraryDefinedValue(userAgentProperty.getRootCondition(), "mozilla");
    userAgentProperty.addTargetLibraryDefinedValue(userAgentProperty.getRootCondition(), "webkit");
    BindingProperty flavorProperty = properties.createBinding("flavor");
    flavorProperty.setProvider(new PropertyProvider("return window.properties.flavor;"));
    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Vanilla");
    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Chocolate");
    ConfigurationProperty emulateStackProperty =
        properties.createConfiguration("emulateStack", false);
    emulateStackProperty.setValue("TRUE");
View Full Code Here

Examples of com.google.gwt.dev.cfg.PropertyProvider

    for (Iterator iter = moduleProps.iterator(); iter.hasNext();) {
      Property prop = (Property) iter.next();
      String activeValue = prop.getActiveValue();
      if (activeValue == null) {
        // Emit a provider function, defined by the user in module config.
        PropertyProvider provider = prop.getProvider();
        assert (provider != null) : "expecting a default property provider to have been set";
        String js = provider.getBody().toSource();
        pw.print("providers['" + prop.getName() + "'] = function() ");
        pw.print(js);
        pw.println(";");

        // Emit a map of allowed property values as an object literal.
View Full Code Here

Examples of com.google.gwt.dev.cfg.PropertyProvider

      String activeValue = prop.getActiveValue();
      if (activeValue == null) {
        // This is a call to a property provider function; we need it to
        // select the script.
        //
        PropertyProvider provider = prop.getProvider();
        assert (provider != null) : "expecting a default property provider to have been set";
        // When we call the provider, we supply a bogus argument to indicate
        // that it should throw an exception if the property is a bad value.
        // The absence of arguments (as in hosted mode) tells it to return null.
        pw.print("[");
View Full Code Here

Examples of org.apache.ambari.server.controller.spi.PropertyProvider

          response.getActualConfigs(), requestedIds);
      setResourceProperty(resource, HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID,
          Boolean.valueOf(response.isStaleConfig()), requestedIds);
     
      String componentName = (String)resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
      PropertyProvider propertyProvider = HOST_COMPONENT_PROPERTIES_PROVIDER.get(componentName);
      if (propertyProvider != null) {
        Set<Resource> resourcesToPopulate = new HashSet<Resource>();
        resourcesToPopulate.add(resource);
        propertyProvider.populateResources(resourcesToPopulate, request, predicate);
      }
     
      resources.add(resource);
    }
    return resources;
View Full Code Here

Examples of org.apache.ambari.server.controller.spi.PropertyProvider

        setResourceProperty(resource, HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID,
            response.getMaintenanceState(), requestedIds);
      }

      String componentName = (String) resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
      PropertyProvider propertyProvider = HOST_COMPONENT_PROPERTIES_PROVIDER.get(componentName);
      if (propertyProvider != null) {
        Set<Resource> resourcesToPopulate = new HashSet<Resource>();
        resourcesToPopulate.add(resource);
        propertyProvider.populateResources(resourcesToPopulate, request, predicate);
      }

      resources.add(resource);
    }
    return resources;
View Full Code Here

Examples of org.apache.ambari.server.controller.spi.PropertyProvider

          if (m.getType().equals("ganglia")) {
            gangliaMap.put(componentName, getPropertyInfo(m));
          } else if (m.getType().equals("jmx")) {
            jmxMap.put(componentName, getPropertyInfo(m));
          } else {
            PropertyProvider pp = getDelegate(m);
            if (null != pp)
              additional.add(pp);
          }
        }
      }
       
      if (gangliaMap.size() > 0) {
        GangliaPropertyProvider gpp = type.equals (Resource.Type.Component) ?
          new GangliaComponentPropertyProvider(gangliaMap,
              streamProvider, sslConfig, gangliaHostProvider,
              clusterNamePropertyId, componentNamePropertyId) :
          new GangliaHostComponentPropertyProvider(gangliaMap,
              streamProvider, sslConfig, gangliaHostProvider,
              clusterNamePropertyId, hostNamePropertyId, componentNamePropertyId);
         
          gpp.populateResources(resources, request, predicate);
      } else {
        defaultGanglia.populateResources(resources, request, predicate);
      }
     
      if (jmxMap.size() > 0) {
        JMXPropertyProvider jpp = new JMXPropertyProvider(jmxMap, streamProvider,
            jmxHostProvider, clusterNamePropertyId, hostNamePropertyId,
            componentNamePropertyId, jmxStatePropertyId, Collections.singleton("STARTED"));
       
        jpp.populateResources(resources, request, predicate);
      } else {
        defaultJmx.populateResources(resources, request, predicate);
      }
     
      for (PropertyProvider pp : additional) {
        pp.populateResources(resources, request, predicate);
      }

    } catch (Exception e) {
      e.printStackTrace();
      throw new SystemException("Error loading deferred resources", e);
View Full Code Here

Examples of org.apache.ambari.server.controller.spi.PropertyProvider

          response.getActualConfigs(), requestedIds);
      setResourceProperty(resource, HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID,
          Boolean.valueOf(response.isStaleConfig()), requestedIds);
     
      String componentName = (String)resource.getPropertyValue(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID);
      PropertyProvider propertyProvider = HOST_COMPONENT_PROPERTIES_PROVIDER.get(componentName);
      if (propertyProvider != null) {
        Set<Resource> resourcesToPopulate = new HashSet<Resource>();
        resourcesToPopulate.add(resource);
        propertyProvider.populateResources(resourcesToPopulate, request, predicate);
      }
     
      resources.add(resource);
    }
    return resources;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.