/** * Returns the ZooKeeper client or throwns an exception if its not configured properly */ protected CuratorFramework getCurator() { CuratorFramework curator = fabricService.adapt(CuratorFramework.class); notNull(curator, "curator"); return curator; }
@Override public boolean isValidProvider() { // child provider isn't valid in OpenShift environment FabricService service = getFabricService(); if (service != null) { // lets disable child if in docker or openshift environments String environment = service.getEnvironment(); if (Objects.equal(environment, "docker") || Objects.equal(environment, "openshift") || Objects.equal(environment, "kubernetes")) { return false; } } boolean openshiftFuseEnv = Strings.notEmpty(System.getenv("OPENSHIFT_FUSE_DIR")); boolean openshiftAmqEnv = Strings.notEmpty(System.getenv("OPENSHIFT_AMQ_DIR")); return !(openshiftFuseEnv || openshiftAmqEnv); }
public static <T extends Comparable<T>> int compare(List<T> a, List<T> b) { if (a == b) { return 0; } else if (a == null) { return -1; } else if (b == null) { return 1; } int size = a.size(); int answer = size - b.size(); if (answer == 0) { for (int i = 0; i < size; i++) { answer = compare(a.get(i), b.get(i)); if (answer != 0) { break; } } } return answer; }
public void start() { missingChecksums.clear(); Objects.notNull(fabricService, "fabricService"); fabricService.get().trackConfiguration(fabricConfigureChangeRunnable); // start the watch thread if (running.compareAndSet(false, true)) { if (watchURLs.size() > 0) { Thread thread = new Thread(this); thread.start(); } } }
/** * Returns true if the objects are equal; by comparing their JSON marshalled strings */ public static boolean equal(FabricRequirements a, FabricRequirements b) throws IOException { String json1 = toJSON(a); String json2 = toJSON(b); return Objects.equal(json1, json2); } }
@Activate void activate() throws Exception { Objects.notNull(fabricService, "fabricService"); Objects.notNull(profileService, "profileService"); mqService = createMQService(fabricService, runtimeProperties); if (mbeanServer != null) { StandardMBean mbean = new StandardMBean(this, MQManagerMXBean.class); JMXUtils.registerMBean(mbean, mbeanServer, OBJECT_NAME); } }
boolean addBundleDependencies = Objects.equal("bundle", rootDependency.getType()) || isKarafContainer; if (addBundleDependencies && requirements.isUseResolver()) {
@Activate void activate(BundleContext bundleContext) throws Exception { this.bundleContext = bundleContext; bundleUtils = new BundleUtils(bundleContext); Objects.notNull(metaTypeService, "metaTypeService"); Objects.notNull(bundleContext, "bundleContext"); if (mbeanServer != null) { StandardMBean mbean = new StandardMBean(this, MetaTypeFacadeMXBean.class); JMXUtils.registerMBean(mbean, mbeanServer, OBJECT_NAME); } }
if (!Objects.equal(current, webContextPath)) { contextPathConfig.put(key, webContextPath); builder.addConfiguration(Constants.WEB_CONTEXT_PATHS_PID, contextPathConfig);
@Override public DeployResults deployProjectJson(String requirementsJson) throws Exception { ProjectRequirements requirements = DtoHelper.getMapper().readValue(requirementsJson, ProjectRequirements.class); Objects.notNull(requirements, "ProjectRequirements"); return deployProject(requirements); }
Objects.notNull(containerProvider, "No ContainerProvider available for scheme: " + containerProviderScheme); if (!containerProvider.isValidProvider()) { throw new IllegalArgumentException("ContainerProvider for scheme: " + containerProviderScheme + " is not valid in current environment");