Examples of ResourceDefinition


Examples of civquest.map.resource.ResourceDefinition

      if (physUnit == null) {
        throw new RulesetException("While loading resource-definitions: "
                       + physUnitString + " is not a valid "
                       + "unit-identifier! (definitions.ruleset)");
      } else {
        resourceDefinitions.put(name, new ResourceDefinition(name, physUnit));

        messages.info("MapData-Config", "ResourceConf", "Adding resource " + name);
        messages.info("MapData-Config", "ResourceConf", "    --> StandardUnit: "
                + physUnit);
      }
View Full Code Here

Examples of civquest.map.resource.ResourceDefinition

  private void constructResDefs(LoadingStep step) throws Exception {
    resourceDefinitions  = new HashMap<String, ResourceDefinition>();
    Set<LoadedData> resDefSet = loadedData.getLoadedDataHashSet(RES_DEFS);
    for (LoadedData resDefData : resDefSet) {
      ResourceDefinition newDef = new ResourceDefinition(resDefData, step);
      resourceDefinitions.put(newDef.getName(), newDef);
    }
  }
View Full Code Here

Examples of civquest.map.resource.ResourceDefinition

     
      if (!(mapConfig.resourceExists(resourceName))) {
        throw new ConfigurationException(resourceName + " is not a valid "
                         + "resource name!");
      } else {
        ResourceDefinition resourceDef = mapConfig.getResourceDefinition(resourceName);
        PhysicalAmount.PhysicalUnit standardUnit = resourceDef.getStandardUnit();
       
        if ((!amount.getUnit().canTransform(standardUnit))) {
          String msg = "Can't transform unit " + amount.getUnit() +
            " into standard unit for resource " + resourceName +
            ", which is " + standardUnit;
View Full Code Here

Examples of com.gatehill.apibms.core.model.ResourceDefinition

                // add resource headers
                final Map<String, String> parentHeaders = new HashMap<>();
                parentHeaders.putAll(asMap(astResource.getHeaders()));

                // build resource
                final ResourceDefinition resource = new ResourceDefinition(astResource.getName());
                resource.setName(astResource.getName());
                resource.setUrl(astResource.getUriTemplate());

                for (AstAction astAction : astResource.getActions()) {
                    // add action headers
                    parentHeaders.putAll(asMap(astAction.getHeaders()));
View Full Code Here

Examples of org.apache.ambari.server.api.resources.ResourceDefinition

  /**
   * Finalize properties for entire query tree before executing query.
   */
  private void finalizeProperties() {
    ResourceDefinition rootDefinition = this.resourceDefinition;

    QueryInfo rootQueryInfo = new QueryInfo(rootDefinition, this.requestedProperties);
    TreeNode<QueryInfo> rootNode = new TreeNodeImpl<QueryInfo>(
        null, rootQueryInfo, rootDefinition.getType().name());

    TreeNode<QueryInfo> requestedPropertyTree = buildQueryPropertyTree(this, rootNode);

    mergeFinalizedProperties(renderer.finalizeProperties(
        requestedPropertyTree, isCollectionResource()), this);
View Full Code Here

Examples of org.apache.ambari.server.api.resources.ResourceDefinition

   *
   * @return query info tree
   */
  private TreeNode<QueryInfo> buildQueryPropertyTree(QueryImpl query, TreeNode<QueryInfo> node) {
    for (QueryImpl subQuery : query.requestedSubResources.values()) {
      ResourceDefinition childResource = subQuery.resourceDefinition;

      QueryInfo queryInfo = new QueryInfo(childResource, subQuery.requestedProperties);
      TreeNode<QueryInfo> childNode = node.addChild(queryInfo, childResource.getType().name());
      buildQueryPropertyTree(subQuery, childNode);
    }
    return node;
  }
View Full Code Here

Examples of org.apache.ambari.server.api.resources.ResourceDefinition

    // currently not exposing temporal information to renderer
    query.requestedProperties.addAll(finalizedProperties);

    for (TreeNode<Set<String>> child : node.getChildren()) {
      Resource.Type childType = Resource.Type.valueOf(child.getName());
      ResourceDefinition parentResource = query.resourceDefinition;
      Set<SubResourceDefinition> subResources = parentResource.getSubResourceDefinitions();
      String subResourceName = null;
      for (SubResourceDefinition subResource : subResources) {
        if (subResource.getType() == childType) {
          ResourceDefinition resource = ResourceInstanceFactoryImpl.getResourceDefinition(
              subResource.getType(), query.keyValueMap);
          subResourceName = getSubResourceName(resource, subResource);
          break;
        }
      }
View Full Code Here

Examples of org.apache.ambari.server.api.resources.ResourceDefinition

  // This is the case where the service can determine that only a category was provided because it contained
  // a trailing '/'
  @Test
  public void testAddProperty__localCategory_categoryNameOnly() throws Exception {
    ResourceInstance resource = createNiceMock(ResourceInstance.class);
    ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class);
    Schema schema = createNiceMock(Schema.class);

    Map<String, Set<String>> mapSchemaProps = new HashMap<String, Set<String>>();
    Set<String> setProps = new HashSet<String>();
    setProps.add("property");
    setProps.add("property2");
    mapSchemaProps.put("category", setProps);
    Set<String> setInnerProps = new HashSet<String>();
    setInnerProps.add("property3");
    setInnerProps.add("property4");
    mapSchemaProps.put("category/nestedCategory", setInnerProps);
    mapSchemaProps.put(null, Collections.singleton("property5"));

    //expectations
    expect(resource.getResourceDefinition()).andReturn(resourceDefinition).anyTimes();

    expect(resourceDefinition.getType()).andReturn(Resource.Type.Service).anyTimes();

    expect(m_controller.getSchema(Resource.Type.Service)).andReturn(schema).anyTimes();
    expect(schema.getCategoryProperties()).andReturn(mapSchemaProps).anyTimes();

    replay(m_controller, resource, resourceDefinition, schema);
View Full Code Here

Examples of org.apache.ambari.server.api.resources.ResourceDefinition

  }

  @Test
  public void testAddProperty__localSubCategory() throws Exception {
    ResourceInstance resource = createNiceMock(ResourceInstance.class);
    ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class);
    Schema schema = createNiceMock(Schema.class);

    Map<String, Set<String>> mapSchemaProps = new HashMap<String, Set<String>>();
    Set<String> setProps = new HashSet<String>();
    setProps.add("property");
    setProps.add("property2");
    mapSchemaProps.put("category", setProps);
    Set<String> setInnerProps = new HashSet<String>();
    setInnerProps.add("property3");
    setInnerProps.add("property4");
    mapSchemaProps.put("category/nestedCategory", setInnerProps);
    mapSchemaProps.put(null, Collections.singleton("property5"));

    //expectations
    expect(resource.getResourceDefinition()).andReturn(resourceDefinition).anyTimes();

    expect(resourceDefinition.getType()).andReturn(Resource.Type.Service).anyTimes();

    expect(m_controller.getSchema(Resource.Type.Service)).andReturn(schema).anyTimes();
    expect(schema.getCategoryProperties()).andReturn(mapSchemaProps).anyTimes();

    replay(m_controller, resource, resourceDefinition, schema);
View Full Code Here

Examples of org.apache.ambari.server.api.resources.ResourceDefinition

  }

  @Test
  public void testAddProperty__localCategorySubPropsOnly() throws Exception {
    ResourceInstance resource = createNiceMock(ResourceInstance.class);
    ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class);
    Schema schema = createNiceMock(Schema.class);

    Map<String, Set<String>> mapSchemaProps = new HashMap<String, Set<String>>();
    Set<String> setInnerProps = new HashSet<String>();
    setInnerProps.add("property3");
    setInnerProps.add("property4");
    mapSchemaProps.put("category/nestedCategory", setInnerProps);
    mapSchemaProps.put(null, Collections.singleton("property5"));

    //expectations
    expect(resource.getResourceDefinition()).andReturn(resourceDefinition).anyTimes();

    expect(resourceDefinition.getType()).andReturn(Resource.Type.Service).anyTimes();

    expect(m_controller.getSchema(Resource.Type.Service)).andReturn(schema).anyTimes();
    expect(schema.getCategoryProperties()).andReturn(mapSchemaProps).anyTimes();

    replay(m_controller, resource, resourceDefinition, schema);
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.