private static boolean matchesPattern(String pattern, ActiveDescriptor<?> descriptor) { if (pattern == null) return true; StringTokenizer st = new StringTokenizer(pattern, "|"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (descriptor.getImplementation().contains(token)) { return true; } for (String contract : descriptor.getAdvertisedContracts()) { if (contract.contains(token)) { return true; } } } return false; }
private static boolean matchesPattern(String pattern, ActiveDescriptor<?> descriptor) { if (pattern == null) return true; StringTokenizer st = new StringTokenizer(pattern, "|"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (descriptor.getImplementation().contains(token)) { return true; } for (String contract : descriptor.getAdvertisedContracts()) { if (contract.contains(token)) { return true; } } } return false; }
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 static boolean doTrace(ActiveDescriptor<?> desc) { if (BIND_TRACING_PATTERN == null) return false; if ("*".equals(BIND_TRACING_PATTERN)) return true; if (desc.getImplementation() == null) return true; // Null here matches everything StringTokenizer st = new StringTokenizer(BIND_TRACING_PATTERN, "|"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (desc.getImplementation().contains(token)) { return true; } for (String contract : desc.getAdvertisedContracts()) { if (contract.contains(token)) return true; } } return false; }
private static boolean doTrace(ActiveDescriptor<?> desc) { if (BIND_TRACING_PATTERN == null) return false; if ("*".equals(BIND_TRACING_PATTERN)) return true; if (desc.getImplementation() == null) return true; // Null here matches everything StringTokenizer st = new StringTokenizer(BIND_TRACING_PATTERN, "|"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (desc.getImplementation().contains(token)) { return true; } for (String contract : desc.getAdvertisedContracts()) { if (contract.contains(token)) return true; } } return false; }
private static boolean doTrace(ActiveDescriptor<?> desc) { if (BIND_TRACING_PATTERN == null) return false; if ("*".equals(BIND_TRACING_PATTERN)) return true; if (desc.getImplementation() == null) return true; // Null here matches everything StringTokenizer st = new StringTokenizer(BIND_TRACING_PATTERN, "|"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (desc.getImplementation().contains(token)) { return true; } for (String contract : desc.getAdvertisedContracts()) { if (contract.contains(token)) return true; } } return false; }
private static boolean doTrace(ActiveDescriptor<?> desc) { if (BIND_TRACING_PATTERN == null) return false; if ("*".equals(BIND_TRACING_PATTERN)) return true; if (desc.getImplementation() == null) return true; // Null here matches everything StringTokenizer st = new StringTokenizer(BIND_TRACING_PATTERN, "|"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (desc.getImplementation().contains(token)) { return true; } for (String contract : desc.getAdvertisedContracts()) { if (contract.contains(token)) return true; } } return false; }
private static List<String> getAllContracts(ActiveDescriptor<?> desc) { LinkedList<String> allContracts = new LinkedList<String>(desc.getAdvertisedContracts()); allContracts.addAll(desc.getQualifiers()); String scope = (desc.getScope() == null) ? PerLookup.class.getName() : desc.getScope() ; allContracts.add(scope); return allContracts; }
private static List<String> getAllContracts(ActiveDescriptor<?> desc) { LinkedList<String> allContracts = new LinkedList<String>(desc.getAdvertisedContracts()); allContracts.addAll(desc.getQualifiers()); String scope = (desc.getScope() == null) ? PerLookup.class.getName() : desc.getScope() ; allContracts.add(scope); return allContracts; }
private static List<String> getAllContracts(ActiveDescriptor<?> desc) { LinkedList<String> allContracts = new LinkedList<String>(desc.getAdvertisedContracts()); allContracts.addAll(desc.getQualifiers()); String scope = (desc.getScope() == null) ? PerLookup.class.getName() : desc.getScope() ; allContracts.add(scope); return allContracts; }
private static List<String> getAllContracts(ActiveDescriptor<?> desc) { LinkedList<String> allContracts = new LinkedList<String>(desc.getAdvertisedContracts()); allContracts.addAll(desc.getQualifiers()); String scope = (desc.getScope() == null) ? PerLookup.class.getName() : desc.getScope() ; allContracts.add(scope); return allContracts; }
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")); } } } }
for (String contract : descriptor.getAdvertisedContracts()) { if (NOT_INTERCEPTED.contains(contract)) return EMTPY_INTERCEPTORS;
for (String contract : descriptor.getAdvertisedContracts()) { if (NOT_INTERCEPTED.contains(contract)) return EMTPY_INTERCEPTORS;
for (String contract : descriptor.getAdvertisedContracts()) { if (NOT_INTERCEPTED.contains(contract)) return EMTPY_INTERCEPTORS;
for (String contract : descriptor.getAdvertisedContracts()) { if (NOT_INTERCEPTED.contains(contract)) return EMTPY_INTERCEPTORS;
selfDescriptor.getAdvertisedContracts().contains( ClassAnalyzer.class.getName())) { String descriptorAnalyzerName = selfDescriptor.getName();
selfDescriptor.getAdvertisedContracts().contains( ClassAnalyzer.class.getName())) { String descriptorAnalyzerName = selfDescriptor.getName();
selfDescriptor.getAdvertisedContracts().contains( ClassAnalyzer.class.getName())) { String descriptorAnalyzerName = selfDescriptor.getName();
selfDescriptor.getAdvertisedContracts().contains( ClassAnalyzer.class.getName())) { String descriptorAnalyzerName = selfDescriptor.getName();