@Override public List<String> versionIds() { return profileService.getVersions(); }
private Version getLatestVersion() { List<String> versions = profileService.getVersions(); IllegalStateAssertion.assertFalse(versions.isEmpty(), "No versions available"); String latestId = versions.get(versions.size() - 1); return profileService.getRequiredVersion(latestId); }
@Override public List<Map<String, Object>> versions(List<String> fields) { List<Map<String, Object>> answer = new ArrayList<Map<String, Object>>(); if( ID_AND_DEFAULT_VERSION.equals(Collections.unmodifiableSet(new HashSet<String>(fields)) )) { // profileService.getVersions() can be expensive, so lets avoid it if we can. // this path is something hawtio polls. for (String version : profileService.getVersions()) { HashMap<String, Object> obj = new HashMap<String, Object>(); obj.put("id", version); obj.put("defaultVersion", fabricService.getDefaultVersionId().equals(version)); answer.add(obj); } } else { for (String versionId : profileService.getVersions()) { answer.add(getVersion(versionId, fields)); } } return answer; }
/** * Returns the list of version ids */ @GET @Path("versions") public Map<String,String> versions() { FabricService fabricService = getFabricService(); if (fabricService != null) { ProfileService profileService = fabricService.adapt(ProfileService.class); List<String> versionIds = profileService.getVersions(); return mapToLinks(versionIds, "/version/"); } else { noFabricService(); } return Collections.emptyMap(); }
/** * Returns the list of version ids */ @GET @Path("versions") public Map<String,String> versions() { FabricService fabricService = getFabricService(); if (fabricService != null) { ProfileService profileService = fabricService.adapt(ProfileService.class); List<String> versionIds = profileService.getVersions(); return mapToLinks(versionIds, "/version/"); } else { noFabricService(); } return Collections.emptyMap(); }
@Override public int complete(String buffer, int cursor, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); ProfileService profileService = fabricService.adapt(ProfileService.class); List<String> versions = profileService.getVersions(); for (String version : versions) { delegate.getStrings().add(version); } return delegate.complete(buffer, cursor, candidates); }
@Override protected Object doExecute() throws Exception { Container[] containers = fabricService.getContainers(); List<String> versions = profileService.getVersions(); printVersions(containers, versions, fabricService.getDefaultVersionId(), System.out); return null; }
@Override public int complete(String buffer, int cursor, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); ProfileService profileService = fabricService.adapt(ProfileService.class); List<String> versions = profileService.getVersions(); for (String version : versions) { delegate.getStrings().add(version); } return delegate.complete(buffer, cursor, candidates); }
@Override public List<String> getVersions() { Permit<ProfileService> permit = permitManager.get().aquirePermit(ProfileService.PERMIT, false); try { ProfileService service = permit.getInstance(); return service.getVersions(); } finally { permit.release(); } }
@Override protected Object doExecute() throws Exception { List<Version> versions; ProfileService profileService = fabricService.adapt(ProfileService.class); if (versionId != null && !versionId.isEmpty()) { Version version = profileService.getRequiredVersion(versionId); versions = Collections.singletonList(version); } else if (allVersions) { versions = new ArrayList<>(); for (String versionId : profileService.getVersions()) { versions.add(profileService.getRequiredVersion(versionId)); } } else { versions = Collections.singletonList(fabricService.getRequiredDefaultVersion()); } username = username != null && !username.isEmpty() ? username : ShellUtils.retrieveFabricUser(session); password = password != null ? password : ShellUtils.retrieveFabricUserPassword(session); promptForJmxCredentialsIfNeeded(); for (Version version : versions) { fabricService.getPatchService().applyPatch(version, patch, username, password); } return null; }
for (String ver : profileService.getVersions()) { Version version = profileService.getVersion(ver); if (version != null) {
List<String> versions = profileService.getVersions(); if (versions.size() > 0) { latestVersion = versions.get(versions.size() - 1);
@Override public void deleteContainer(FabricService fabricService, String containerId) { assertValid(); try { if (curator.get() == null) { throw new IllegalStateException("Zookeeper service not available"); } // Wipe all config entries that are related to the container for all versions. ProfileService profileService = fabricService.adapt(ProfileService.class); for (String version : profileService.getVersions()) { deleteSafe(curator.get(), ZkPath.CONFIG_VERSIONS_CONTAINER.getPath(version, containerId)); } deleteSafe(curator.get(), ZkPath.CONFIG_CONTAINER.getPath(containerId)); deleteSafe(curator.get(), ZkPath.CONTAINER.getPath(containerId)); deleteSafe(curator.get(), ZkPath.CONTAINER_ALIVE.getPath(containerId)); deleteSafe(curator.get(), ZkPath.CONTAINER_DOMAINS.getPath(containerId)); deleteSafe(curator.get(), ZkPath.CONTAINER_PROVISION.getPath(containerId)); deleteSafe(curator.get(), ZkPath.CONTAINER_STATUS.getPath(containerId)); deleteSafe(curator.get(), ZkPath.AUTHENTICATION_CONTAINER.getPath(containerId)); } catch (Exception e) { throw FabricException.launderThrowable(e); } }