protected AbstractContainerCreateAction(FabricService fabricService, ZooKeeperClusterService clusterService) { this.fabricService = fabricService; this.profileService = fabricService.adapt(ProfileService.class); this.clusterService = clusterService; }
ContainerInfoAction(FabricService fabricService, RuntimeProperties runtimeProperties) { this.fabricService = fabricService; this.dataStore = fabricService.adapt(DataStore.class); this.runtimeProperties = runtimeProperties; }
ProfileDownloadArtifactsAction(FabricService fabricService) { this.fabricService = fabricService; this.profileService = fabricService.adapt(ProfileService.class); }
public ContainerImpl(Container parent, String id, FabricService fabricService) { this.parent = parent; this.id = id; this.fabricService = fabricService; this.dataStore = fabricService.adapt(DataStore.class); }
protected Map<String, String> getDataStoreProperties() { ProfileRegistry profileRegistry = fabricService.adapt(ProfileRegistry.class); Map<String, String> options = new HashMap<String, String>(profileRegistry.getDataStoreProperties()); if (dataStoreOption != null) { for (String opt : dataStoreOption) { String[] parts = opt.trim().split(" +"); options.put(parts[0], parts[1]); } } return options; }
ProfileEditAction(FabricService fabricService, ConfigurationAdmin configurationAdmin, EditorFactory editorFactory) { this.profileService = fabricService.adapt(ProfileService.class); this.fabricService = fabricService; this.configurationAdmin = configurationAdmin; this.editorFactory = editorFactory; // TODO: Karaf 2.4 has a bug to lookup this class, so we bind it manually - Karaf 2.4.1 should have this fixed this.editorFactory.bind("simple", SimpleConsoleEditor.class); }
protected ProfileService getProfileService() { FabricService fabricService = getFabricService(); ProfileService profileService = null; if (fabricService != null) { profileService = fabricService.adapt(ProfileService.class); } return profileService; } }
protected ProfileService getProfileService() { FabricService fabricService = getFabricService(); ProfileService profileService = null; if (fabricService != null) { profileService = fabricService.adapt(ProfileService.class); } return profileService; } }
@Override public String resolve(FabricService fabricService, Map<String, Map<String, String>> configs, String pid, String key, String value) { CuratorFramework curator = fabricService.adapt(CuratorFramework.class); return resolveValue(curator, value); }
@Override public String resolve(FabricService fabricService, Map<String, Map<String, String>> configs, String pid, String key, String value) { try { return new String(ZkPath.loadURL(fabricService.adapt(CuratorFramework.class), value), "UTF-8"); } catch (KeeperException.NoNodeException e) { LOGGER.warn("Could not load property value: {}. Ignoring.", value, e); return ""; } catch (Exception e) { throw FabricException.launderThrowable(e); } } }
public static Map<String, File> getJavaContainerArtifactsFiles(FabricService fabricService, List<Profile> profileList, DownloadManager downloadManager) throws Exception { Map<String, File> answer = new HashMap<String, File>(); ProfileService profileService = fabricService.adapt(ProfileService.class); for (Profile profile : profileList) { Profile overlay = profileService.getOverlayProfile(profile); Map<String, Parser> profileArtifacts = AgentUtils.getProfileArtifacts(fabricService, downloadManager, overlay); appendMavenDependencies(profileArtifacts, profile); Set<String> rawUrls = profileArtifacts.keySet(); downloadArtifactUrls(downloadManager, rawUrls, answer); } return answer; }
private String getAlgorithm(FabricService fabricService) { try { return getStringData(fabricService.adapt(CuratorFramework.class), AUTHENTICATION_CRYPT_ALGORITHM.getPath()); } catch (Exception e) { throw FabricException.launderThrowable(e); } }
public static boolean agentConfigurationEquals(FabricService fabricService, Profile thisProfile, Profile otherProfile) { ProfileService profileService = fabricService.adapt(ProfileService.class); Profile thisOverlay = profileService.getOverlayProfile(thisProfile); Profile otherOverlay = profileService.getOverlayProfile(otherProfile); return thisOverlay.getConfiguration(Constants.AGENT_PID).equals(otherOverlay.getConfiguration(Constants.AGENT_PID)); }
@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 { ProfileService profileService = fabricService.adapt(ProfileService.class); Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion(); Profile profile = version.getProfile(profileName); if (profile != null) { Profiles.refreshProfile(fabricService, profile); } else { System.out.println("Profile " + profileName + " not found."); } return null; } }
private String getPassword(FabricService fabricService) { try { String pw = getStringData(fabricService.adapt(CuratorFramework.class), AUTHENTICATION_CRYPT_PASSWORD.getPath()); // the password may be encoded, so we need to decode if needed return PasswordEncoder.decode(pw); } catch (Exception e) { throw FabricException.launderThrowable(e); } }
public static void copyProfile(FabricService fabricService, String versionId, String sourceId, String targetId, boolean force) { ProfileService profileService = fabricService.adapt(ProfileService.class); Profile sourceProfile = profileService.getRequiredProfile(versionId, sourceId); LOGGER.info("copyProfile: {} => {}", sourceProfile, targetId); // [TODO] delete/create profile must be done in an atomic operation maybeDeleteProfile(fabricService, versionId, targetId, force); ProfileBuilder builder = ProfileBuilder.Factory.createFrom(sourceProfile); profileService.createProfile(builder.identity(targetId).getProfile()); }
@Override protected Object doExecute() throws Exception { ProfileService profileService = fabricService.adapt(ProfileService.class); Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion(); List<Profile> profiles = version.getProfiles(); profiles = sortProfiles(profiles); printProfiles(profileService, profiles, System.out); return null; }
/** * Get the effective profile, which is the overlay profile with substituted configurations. */ public static Profile getEffectiveProfile(FabricService fabricService, Profile profile) { ProfileService profileService = fabricService.adapt(ProfileService.class); Profile overlayProfile = profileService.getOverlayProfile(profile); Map<String, Map<String, String>> configurations = overlayProfile.getConfigurations(); ProfileBuilder builder = ProfileBuilder.Factory.createFrom(overlayProfile); builder.setConfigurations(fabricService.substituteConfigurations(configurations)); return builder.getProfile(); }
/** * Get the effective profile, which is the overlay profile with substituted configurations. */ public static Profile getEffectiveProfile(FabricService fabricService, Profile profile) { ProfileService profileService = fabricService.adapt(ProfileService.class); Profile overlayProfile = profileService.getOverlayProfile(profile); Map<String, Map<String, String>> configurations = overlayProfile.getConfigurations(); ProfileBuilder builder = ProfileBuilder.Factory.createFrom(overlayProfile); builder.setConfigurations(fabricService.substituteConfigurations(configurations, overlayProfile.getId())); return builder.getProfile(); }