@Override public Filter getDescriptorFilter() { return BuilderHelper.allFilter(); }
@Override public Filter getDescriptorFilter() { return BuilderHelper.allFilter(); }
/** * Dumps all descriptors in this ServiceLocator to the given PrintStream * * @param locator The non-null locator to dump * @param output The non-null PrintStream to print the descriptors to */ public static void dumpAllDescriptors(ServiceLocator locator, PrintStream output) { if (locator == null || output == null) throw new IllegalArgumentException(); List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); for (ActiveDescriptor<?> d : all) { output.println(d.toString()); } }
/** * Dumps all descriptors in this ServiceLocator to the given PrintStream * * @param locator The non-null locator to dump * @param output The non-null PrintStream to print the descriptors to */ public static void dumpAllDescriptors(ServiceLocator locator, PrintStream output) { if (locator == null || output == null) throw new IllegalArgumentException(); List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); for (ActiveDescriptor<?> d : all) { output.println(d.toString()); } }
/** * Dumps all descriptors in this ServiceLocator to the given PrintStream * * @param locator The non-null locator to dump * @param output The non-null PrintStream to print the descriptors to */ public static void dumpAllDescriptors(ServiceLocator locator, PrintStream output) { if (locator == null || output == null) throw new IllegalArgumentException(); List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); for (ActiveDescriptor<?> d : all) { output.println(d.toString()); } }
/** * Dumps all descriptors in this ServiceLocator to the given PrintStream * * @param locator The non-null locator to dump * @param output The non-null PrintStream to print the descriptors to */ public static void dumpAllDescriptors(ServiceLocator locator, PrintStream output) { if (locator == null || output == null) throw new IllegalArgumentException(); List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); for (ActiveDescriptor<?> d : all) { output.println(d.toString()); } }
private void dumpContracts(StringBuilder sb) { // Probably not very efficient but it is not a factor for this rarely-used // user-called command... sb.append("\n*********** Sorted List of all Registered Contracts in the Habitat **************\n"); List<ActiveDescriptor<?>> allDescriptors = serviceLocator.getDescriptors(BuilderHelper.allFilter()); SortedSet<String> allContracts = new TreeSet<String>(); for (ActiveDescriptor<?> aDescriptor : allDescriptors) { allContracts.addAll(aDescriptor.getAdvertisedContracts()); } // now the contracts are sorted... Iterator<String> it = allContracts.iterator(); for (int i = 1; it.hasNext(); i++) { sb.append("Contract-" + i + ": " + it.next() + "\n"); } }
private void dumpTypes(StringBuilder sb) { sb.append("\n\n*********** Sorted List of all Types in the Habitat **************\n\n"); List<ActiveDescriptor<?>> allDescriptors = serviceLocator.getDescriptors(BuilderHelper.allFilter()); HashSet<String> allTypes = new HashSet<String>(); for (ActiveDescriptor<?> aDescriptor : allDescriptors) { allTypes.add(aDescriptor.getImplementation()); } Iterator<String> it = allTypes.iterator(); if (it == null) //PP (paranoid programmer) return; SortedSet<String> types = new TreeSet<String>(); while (it.hasNext()) { types.add(it.next()); } // now the types are sorted... it = types.iterator(); for (int i = 1; it.hasNext(); i++) { sb.append("Type-" + i + ": " + it.next() + "\n"); } }
private void dumpInhabitantsImplementingContractPattern(String pattern, StringBuilder sb) { sb.append("\n*********** List of all services for contract named like " + contract + " **************\n"); List<ActiveDescriptor<?>> allDescriptors = serviceLocator.getDescriptors(BuilderHelper.allFilter()); HashSet<String> allContracts = new HashSet<String>(); for (ActiveDescriptor<?> aDescriptor : allDescriptors) { allContracts.addAll(aDescriptor.getAdvertisedContracts()); } Iterator<String> it = allContracts.iterator(); while (it.hasNext()) { String cn = it.next(); if (cn.toLowerCase(Locale.ENGLISH).indexOf(pattern.toLowerCase(Locale.ENGLISH)) < 0) continue; sb.append("\n-----------------------------\n"); for ( ActiveDescriptor<?> descriptor : serviceLocator.getDescriptors(BuilderHelper.createContractFilter(cn))) { sb.append("Inhabitant-Metadata: " + descriptor.getMetadata()); sb.append("\n"); boolean isStarted = Boolean.parseBoolean(started); if (isStarted) { ServiceHandle<?> handle = serviceLocator.getServiceHandle(descriptor); sb.append((handle.isActive() ? " started" : " not started")); } } } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
List<ActiveDescriptor<?>> allValidatedDescriptors = getDescriptors(BuilderHelper.allFilter());