id
stringlengths
7
14
text
stringlengths
1
106k
223551095_1486
public HostRoleStatus getStatus() { return status; }
223551095_1487
public double getPercent() { return percent; }
223551095_1488
public static CalculatedStatus statusFromTaskEntities(Collection<HostRoleCommandEntity> tasks, boolean skippable) { int size = tasks.size(); Map<HostRoleStatus, Integer> taskStatusCounts = CalculatedStatus.calculateTaskEntityStatusCounts(tasks); HostRoleStatus status = calculateSummaryStatus(taskStatusCounts, siz...
223551095_1489
public static CalculatedStatus statusFromStageEntities(Collection<StageEntity> stages) { Collection<HostRoleStatus> stageStatuses = new HashSet<>(); Collection<HostRoleCommandEntity> tasks = new HashSet<>(); for (StageEntity stage : stages) { // get all the tasks for the stage Collection<HostRoleCommandEn...
223551095_1490
public static CalculatedStatus statusFromStages(Collection<Stage> stages) { Collection<HostRoleStatus> stageStatuses = new HashSet<>(); Collection<HostRoleCommand> tasks = new HashSet<>(); for (Stage stage : stages) { // get all the tasks for the stage Collection<HostRoleCommand> stageTasks = stage.getOrd...
223551095_1491
public static Map<HostRoleStatus, Integer> calculateStatusCounts(Collection<HostRoleStatus> hostRoleStatuses) { Map<HostRoleStatus, Integer> counters = new HashMap<>(); // initialize for (HostRoleStatus hostRoleStatus : HostRoleStatus.values()) { counters.put(hostRoleStatus, 0); } // calculate counts fo...
223551095_1492
@Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { for (Map<String, Object> map : request.getProperties()) { String cluster = (String) map.get(CLU...
223551095_1493
@Override public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { for (Map<String, Object> map : request.getProperties()) { String cluster = (String) map.get(CLU...
223551095_1494
@Override public RequestStatus updateResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { throw new UnsupportedOperationException("Cannot update a Configuration resource."); }
223551095_1495
@Override public RequestStatus deleteResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { throw new UnsupportedOperationException("Cannot delete a Configuration resource."); }
223551095_1496
public static ResourceProvider getResourceProvider(Resource.Type type, IvoryService service) { switch (type.getInternalType()) { case DRFeed: return new FeedResourceProvider(service); case DRTargetCluster: return new TargetClusterResourceProvider(...
223551095_1498
@Override public Set<String> getPropertyIds() { return propertyIds; }
223551095_1499
@Override public boolean isDryRunRequest() { return dryRun; }
223551095_1500
protected RequestStatus getRequestStatus(RequestStatusResponse response, Set<Resource> associatedResources) { return getRequestStatus(response, associatedResources, null); }
223551095_1501
protected Set<Map<String, Object>> getPropertyMaps(Predicate givenPredicate) { SimplifyingPredicateVisitor visitor = new SimplifyingPredicateVisitor(this); PredicateHelper.visit(givenPredicate, visitor); List<Predicate> predicates = visitor.getSimplifiedPredicates(); Set<Map<String, Object>> propertyMaps = new ...
223551095_1503
@Override public String toString() { return new StringBuilder() .append("actionName :").append(actionName) .append(", actionType :").append(actionType) .append(", inputs :").append(inputs) .append(", targetService :").append(targetService) .append(", targetComponent :").append(targetComponent) ...
223551095_1512
public Resource.Type guessOperationLevel(RequestResourceFilter filter) { Resource.Type result; if (filter == null) { // CLUSTER can be assumed to be the default level if no ResourceFilter // is specified, because for any other resource operation // a ResourceFilter is mandatory. result = Resource.Ty...
223551095_1513
public Set<String> filterHostsInMaintenanceState(Set<String> candidateHosts, HostPredicate condition) throws AmbariException { // Filter hosts that are in MS Set<String> removedHosts = new HashSet<>(); for (String hostname : candidateHosts) { if (condition.shouldHostBeRemoved(hostname)) { removedHos...
223551095_1526
public String getName() { return name; }
223551095_1527
public String getDescription() { return description; }
223551095_1528
public String getStatus() { return status; }
223551095_1529
public String getSchedule() { return schedule; }
223551095_1530
public String getSourceClusterName() { return sourceClusterName; }
223551095_1531
public String getSourceClusterStart() { return sourceClusterStart; }
223551095_1532
public String getSourceClusterEnd() { return sourceClusterEnd; }
223551095_1533
public String getSourceClusterLimit() { return sourceClusterLimit; }
223551095_1534
public String getSourceClusterAction() { return sourceClusterAction; }
223551095_1535
public String getTargetClusterName() { return targetClusterName; }
223551095_1536
public String getTargetClusterStart() { return targetClusterStart; }
223551095_1537
public String getTargetClusterEnd() { return targetClusterEnd; }
223551095_1538
public String getTargetClusterLimit() { return targetClusterLimit; }
223551095_1539
public String getTargetClusterAction() { return targetClusterAction; }
223551095_1540
public Map<String, String> getProperties() { return properties; }
223551095_1541
private ServiceComponent getServiceComponent ( ActionExecutionContext actionExecutionContext, RequestResourceFilter resourceFilter){ try { Cluster cluster = clusters.getCluster(actionExecutionContext.getClusterName()); Service service = cluster.getService(resource...
223551095_1542
public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure, boolean useLatestConfigs) throws AmbariException { String clusterName ...
223551095_1543
public void addServiceCheckAction(Stage stage, String hostname, String smokeTestRole, long nowTimestamp, String serviceName, String componentName, Map<String, String> actionParameters, boolean retryAllowed, boolean autoSkipFailure, boolean useLatestConfigs) throws AmbariException { String clusterName ...
223551095_1544
public void addExecutionCommandsToStage(ActionExecutionContext actionExecutionContext, Stage stage, Map<String, String> requestParams, ExecuteCommandJson executeCommandJson) throws AmbariException { List<RequestResourceFilter> resourceFilters = actionExecutionContext.getResourceFilters(); for (RequestResource...
223551095_1545
public boolean isTopologyRefreshRequired(String actionName, String clusterName, String serviceName) throws AmbariException { if (actionName.equals(START_COMMAND_NAME) || actionName.equals(RESTART_COMMAND_NAME)) { Cluster cluster = clusters.getCluster(clusterName); StackId stackId = null; if (serviceNa...
223551095_1546
private ServiceComponent getServiceComponent ( ActionExecutionContext actionExecutionContext, RequestResourceFilter resourceFilter){ try { Cluster cluster = clusters.getCluster(actionExecutionContext.getClusterName()); Service service = cluster.getService(resource...
223551095_1547
public AuthToLocalBuilder addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a princ...
223551095_1548
public AuthToLocalBuilder addRule(String principal, String localUsername) { if (!StringUtils.isEmpty(principal) && !StringUtils.isEmpty(localUsername)) { Principal p = new Principal(principal); if (p.getRealm() == null) { throw new IllegalArgumentException( "Attempted to add a rule for a princ...
223551095_1549
@Override public Object clone() throws CloneNotSupportedException { AuthToLocalBuilder copy = (AuthToLocalBuilder) super.clone(); /* **** Copy mutable members **** */ copy.setRules = new TreeSet<>(setRules); return copy; }
223551095_1550
@ApiModelProperty(name = "properties") public Map<String, String> getServiceProperties() { return serviceProperties; }
223551095_1551
@Override public final boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ServiceConfigVersionResponse)) return false; ServiceConfigVersionResponse that = (ServiceConfigVersionResponse) o; return new EqualsBuilder() .append(clusterName, that.clusterName) .append(serviceName, that....
223551095_1552
static void setSystemProperties(Configuration configs) { // modify location of temporary dir to avoid using default /tmp dir System.setProperty("java.io.tmpdir", configs.getServerTempDir()); if (configs.getJavaVersion() >= 8) { System.setProperty("jdk.tls.ephemeralDHKeySize", String.valueOf(configs.getTlsEphe...
223551095_1553
public static void setupProxyAuth() { final String proxyUser = System.getProperty("http.proxyUser"); final String proxyPass = System.getProperty("http.proxyPassword"); // to skip some hosts from proxy, pipe-separate names using, i.e.: // -Dhttp.nonProxyHosts=*.domain.com|host.internal.net if (null != proxyUse...
223551095_1554
protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); /* Configure web app context */...
223551095_1555
protected void configureHandlerCompression(ServletContextHandler context) { if (configs.isApiGzipped()) { FilterHolder gzipFilter = context.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST)); gzipFilter.setInitParameter("methods", "GET,POST,PUT,DELETE"); gzipFilter.setInitParame...
223551095_1556
protected void configureRootHandler(ServletContextHandler root) { configureHandlerCompression(root); configureAdditionalContentTypes(root); root.setContextPath(CONTEXT_PATH); root.setErrorHandler(injector.getInstance(AmbariErrorHandler.class)); root.setMaxFormContentSize(-1); /* Configure web app context */...
223551095_1557
protected Server configureJettyThreadPool(int acceptorThreads, String threadPoolName, int configuredThreadPoolSize) { int minumumAvailableThreads = 20; // multiply by two since there is 1 selector for every acceptor int reservedJettyThreads = acceptorThreads * 2; // this is the calculation used by Jetty i...
223551095_1558
protected void runDatabaseConsistencyCheck() throws Exception { if (System.getProperty("skipDatabaseConsistencyCheck") == null) { boolean fixIssues = (System.getProperty("fixDatabaseConsistency") != null); try { DatabaseConsistencyCheckResult checkResult = DatabaseConsistencyCheckHelper.runAllDBChecks(f...
223551095_1559
protected void runDatabaseConsistencyCheck() throws Exception { if (System.getProperty("skipDatabaseConsistencyCheck") == null) { boolean fixIssues = (System.getProperty("fixDatabaseConsistency") != null); try { DatabaseConsistencyCheckResult checkResult = DatabaseConsistencyCheckHelper.runAllDBChecks(f...
223551095_1560
protected void runDatabaseConsistencyCheck() throws Exception { if (System.getProperty("skipDatabaseConsistencyCheck") == null) { boolean fixIssues = (System.getProperty("fixDatabaseConsistency") != null); try { DatabaseConsistencyCheckResult checkResult = DatabaseConsistencyCheckHelper.runAllDBChecks(f...
223551095_1562
public String getSessionCookie() { return sessionHandler.getSessionCookieConfig().getName(); }
223551095_1566
public Map<RoleCommandPair, Set<RoleCommandPair>> getDependencies() { return dependencies; }
223551095_1567
public Map<RoleCommandPair, Set<RoleCommandPair>> getDependencies() { return dependencies; }
223551095_1568
public Map<RoleCommandPair, Set<RoleCommandPair>> getDependencies() { return dependencies; }
223551095_1569
public Map<RoleCommandPair, Set<RoleCommandPair>> getDependencies() { return dependencies; }
223551095_1570
public Map<RoleCommandPair, Set<RoleCommandPair>> getDependencies() { return dependencies; }
223551095_1572
public Set<Service> getTransitiveServices(Service service, RoleCommand cmd) throws AmbariException { Set<Service> transitiveServices = new HashSet<>(); Cluster cluster = service.getCluster(); Set<RoleCommandPair> allDeps = new HashSet<>(); for (ServiceComponent sc : service.getServiceComponents().values()) { ...
223551095_1573
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> children = new HashSet<>(); children.add(new SubResourceDefinition(Resource.Type.OperatingSystem)); children.add(new SubResourceDefinition(Resource.Type.StackService)); children.add(new SubResourceDefinition(Res...
223551095_1578
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> setChildren = new HashSet<>(); setChildren.add(new SubResourceDefinition(Resource.Type.Service)); setChildren.add(new SubResourceDefinition(Resource.Type.Host)); setChildren.add(new SubResourceDefinition(Resourc...
223551095_1585
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> subResourceDefinitions = new HashSet<>(); subResourceDefinitions.add(new SubResourceDefinition(Resource.Type.ViewInstance)); subResourceDefinitions.add(new SubResourceDefinition(Resource.Type.ViewPermission)); r...
223551095_1597
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { final Set<SubResourceDefinition> subResourceDefintions = new HashSet<>(); subResourceDefintions.add(new SubResourceDefinition(Resource.Type.RepositoryVersion)); return subResourceDefintions; }
223551095_1600
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> setChildren = new HashSet<>(); setChildren.add(new SubResourceDefinition(Resource.Type.DRInstance)); return setChildren; }
223551095_1604
@Override public List<PostProcessor> getPostProcessors() { List<PostProcessor> listProcessors = new ArrayList<>(); listProcessors.add(new BaseHrefPostProcessor()); return listProcessors; }
223551095_1605
@Override public Renderer getRenderer(String name) { if (name == null || name.equals("default")) { return new DefaultRenderer(); } else if (name.equals("minimal")) { return new MinimalRenderer(); } else if (name.contains("null_padding") || name.contains("no_padding") || name.contai...
223551095_1616
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> subResourceDefinitions = new HashSet<>(); subResourceDefinitions.add(new SubResourceDefinition(Resource.Type.RoleAuthorization)); return subResourceDefinitions; }
223551095_1619
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> setChildren = new HashSet<>(); setChildren.add(new SubResourceDefinition(Resource.Type.Job)); return setChildren; }
223551095_1629
public static ResourceDefinition getResourceDefinition(Resource.Type type, Map<Resource.Type, String> mapIds) { ResourceDefinition resourceDefinition; // Check to see if there is an external resource definition registered for the given type. if (resourceDefinitions.containsKey(type)) { return resourceDefiniti...
223551095_1630
public static ResourceDefinition getResourceDefinition(Resource.Type type, Map<Resource.Type, String> mapIds) { ResourceDefinition resourceDefinition; // Check to see if there is an external resource definition registered for the given type. if (resourceDefinitions.containsKey(type)) { return resourceDefiniti...
223551095_1632
public static ResourceDefinition getResourceDefinition(Resource.Type type, Map<Resource.Type, String> mapIds) { ResourceDefinition resourceDefinition; // Check to see if there is an external resource definition registered for the given type. if (resourceDefinitions.containsKey(type)) { return resourceDefiniti...
223551095_1633
public static ResourceDefinition getResourceDefinition(Resource.Type type, Map<Resource.Type, String> mapIds) { ResourceDefinition resourceDefinition; // Check to see if there is an external resource definition registered for the given type. if (resourceDefinitions.containsKey(type)) { return resourceDefiniti...
223551095_1634
public static ResourceDefinition getResourceDefinition(Resource.Type type, Map<Resource.Type, String> mapIds) { ResourceDefinition resourceDefinition; // Check to see if there is an external resource definition registered for the given type. if (resourceDefinitions.containsKey(type)) { return resourceDefiniti...
223551095_1635
public static ResourceDefinition getResourceDefinition(Resource.Type type, Map<Resource.Type, String> mapIds) { ResourceDefinition resourceDefinition; // Check to see if there is an external resource definition registered for the given type. if (resourceDefinitions.containsKey(type)) { return resourceDefiniti...
223551095_1641
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> subs = new HashSet<>(); subs.add(new SubResourceDefinition(Resource.Type.Component)); subs.add(new SubResourceDefinition(Resource.Type.Alert)); //todo: dynamic sub-resource definition subs.add(new SubResourceD...
223551095_1646
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { final Set<SubResourceDefinition> subResourceDefinitions = new HashSet<>(); subResourceDefinitions.add(new SubResourceDefinition(Resource.Type.UserAuthenticationSource)); subResourceDefinitions.add(new SubResourceDefinition(Resource.Type.Use...
223551095_1651
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> setChildren = new HashSet<>(); setChildren.add(new SubResourceDefinition(Resource.Type.TaskAttempt)); return setChildren; }
223551095_1652
@Override public Set<SubResourceDefinition> getSubResourceDefinitions() { Set<SubResourceDefinition> setChildren = new HashSet<>(); setChildren.add(new SubResourceDefinition(Resource.Type.StackConfiguration)); setChildren.add(new SubResourceDefinition(Resource.Type.StackServiceComponent)); setChildren.add(new S...
223551095_1664
@Override public Map<String, TemporalInfo> getFields() { Map<String, TemporalInfo> mapProperties; String partialResponseFields = m_uriInfo.getQueryParameters().getFirst(QueryLexer.QUERY_FIELDS); if (partialResponseFields == null) { mapProperties = Collections.emptyMap(); } else { Set<String> setMatches ...
223551095_1665
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1666
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1667
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1668
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1669
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1670
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1671
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1672
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1673
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1674
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1675
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1676
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1677
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1678
@Override public Set<RequestBody> parse(String body) throws BodyParseException { Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); if (body != null && body.length() != 0) { try { JsonNode root = mapper.readTree(ensureArrayFo...
223551095_1683
@Override public Object serialize(Result result) { try { ByteArrayOutputStream bytesOut = init(); if (result.getStatus().isErrorState()) { return serializeError(result.getStatus()); } TreeNode<Resource> treeNode = result.getResultTree(); processNode(treeNode); processResultMetadata(resul...
223551095_1684
@Override public Object serialize(Result result) { try { ByteArrayOutputStream bytesOut = init(); if (result.getStatus().isErrorState()) { return serializeError(result.getStatus()); } TreeNode<Resource> treeNode = result.getResultTree(); processNode(treeNode); processResultMetadata(resul...
223551095_1685
@Override public Object serialize(Result result) { try { ByteArrayOutputStream bytesOut = init(); if (result.getStatus().isErrorState()) { return serializeError(result.getStatus()); } TreeNode<Resource> treeNode = result.getResultTree(); processNode(treeNode); processResultMetadata(resul...
223551095_1686
@Override public Object serialize(Result result) { try { ByteArrayOutputStream bytesOut = init(); if (result.getStatus().isErrorState()) { return serializeError(result.getStatus()); } TreeNode<Resource> treeNode = result.getResultTree(); processNode(treeNode); processResultMetadata(resul...
223551095_1690
public void addResourceService(String resourceName, Object service) { resourceServiceMap.put(resourceName, service); }
223551095_1691
@PUT @Path("{originVersion}/{originInstanceName}") @ApiOperation(value = "Migrate view instance data", notes = "Migrates view instance persistence data from origin view instance specified in the path params.") @ApiResponses({ @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION), @ApiResponse(co...