Package org.apache.ambari.server.controller.predicate

Examples of org.apache.ambari.server.controller.predicate.AndPredicate


      if (m_userPredicate != null) {
        predicate = m_userPredicate;
      }
    } else {
      predicate = (m_userPredicate == null ? internalPredicate :
          new AndPredicate((BasePredicate) m_userPredicate, internalPredicate));
    }
    return predicate;
  }
View Full Code Here


    }

    if (setPredicates.size() == 1) {
      return setPredicates.iterator().next();
    } else if (setPredicates.size() > 1) {
      return new AndPredicate(setPredicates.toArray(new BasePredicate[setPredicates.size()]));
    } else {
      return null;
    }
  }
View Full Code Here

      if (m_userPredicate != null) {
        predicate = m_userPredicate;
      }
    } else {
      predicate = (m_userPredicate == null ? internalPredicate :
          new AndPredicate((BasePredicate) m_userPredicate, internalPredicate));
    }
    return predicate;
  }
View Full Code Here

    }

    if (setPredicates.size() == 1) {
      return setPredicates.iterator().next();
    } else if (setPredicates.size() > 1) {
      return new AndPredicate(setPredicates.toArray(new Predicate[setPredicates.size()]));
    } else {
      return null;
    }
  }
View Full Code Here

      if (userPredicate != null) {
        predicate = userPredicate;
      }
    } else {
      predicate = (userPredicate == null ? internalPredicate :
          new AndPredicate(userPredicate, internalPredicate));
    }
    return predicate;
  }
View Full Code Here

    Predicate stackNamePredicate = new EqualsPredicate<String>
        (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name");
    Predicate stackVersionPredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version");

    Predicate andPredicate = new AndPredicate(namePredicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);

    //mock expectations
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
        "dep_comp_name", "comp_name")).andReturn(dependencyInfo);
View Full Code Here

    Predicate stackNamePredicate = new EqualsPredicate<String>
        (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name");
    Predicate stackVersionPredicate = new EqualsPredicate<String>(
        StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version");

    Predicate andPredicate1 = new AndPredicate(namePredicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);
    Predicate andPredicate2 = new AndPredicate(name2Predicate, depServicePredicate,
        depCompPredicate, stackNamePredicate, stackVersionPredicate);
    Predicate orPredicate = new OrPredicate(andPredicate1, andPredicate2);

    //mock expectations
    expect(metaInfo.getComponentDependency("stack_name", "stack_version", "dep_service_name",
View Full Code Here

    Map<String, String> requestInfo = new HashMap<String, String>();
    requestInfo.put("context", "Install and start all services");
    Request installRequest = new RequestImpl(null, Collections.singleton(installProperties), requestInfo, null);
    Predicate statePredicate = new EqualsPredicate<String>(SERVICE_SERVICE_STATE_PROPERTY_ID, "INIT");
    Predicate clusterPredicate = new EqualsPredicate<String>(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
    Predicate installPredicate = new AndPredicate(statePredicate, clusterPredicate);

    final Request startRequest;
    Predicate startPredicate;
    try {
      LOG.info("Installing all services");
      requestStages = doUpdateResources(null, installRequest, installPredicate);
      notifyUpdate(Resource.Type.Service, installRequest, installPredicate);

      Map<String, Object> startProperties = new HashMap<String, Object>();
      startProperties.put(SERVICE_SERVICE_STATE_PROPERTY_ID, "STARTED");
      startRequest = new RequestImpl(null, Collections.singleton(startProperties), requestInfo, null);
      Predicate installedStatePredicate = new EqualsPredicate<String>(SERVICE_SERVICE_STATE_PROPERTY_ID, "INSTALLED");
      Predicate serviceClusterPredicate = new EqualsPredicate<String>(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
      startPredicate = new AndPredicate(installedStatePredicate, serviceClusterPredicate);

      LOG.info("Starting all services");
      doUpdateResources(requestStages, startRequest, startPredicate);
      notifyUpdate(Resource.Type.Service, startRequest, startPredicate);
      requestStages.persist();
View Full Code Here

    }

    if (setPredicates.size() == 1) {
      return setPredicates.iterator().next();
    } else if (setPredicates.size() > 1) {
      return new AndPredicate(setPredicates.toArray(new BasePredicate[setPredicates.size()]));
    } else {
      return null;
    }
  }
View Full Code Here

      if (m_userPredicate != null) {
        predicate = m_userPredicate;
      }
    } else {
      predicate = (m_userPredicate == null ? internalPredicate :
          new AndPredicate((BasePredicate) m_userPredicate, internalPredicate));
    }
    return predicate;
  }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.predicate.AndPredicate

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.