@Override public String toString() { return "ServiceImpl{ Service class " + serviceName + " with filter " + filter.value() + '}'; }
@Override public Registration<T> select(Annotation... qualifiers) { if (qualifiers == null) { throw new IllegalArgumentException("You can't pass null array" + " of qualifiers"); } String filter = FilterGenerator.makeFilter( Arrays.asList(qualifiers)).value(); return null; }
/** * Produce a {@link Filter} annotation from another filter and a string. * This string may be a valid LDAP filter. * <p/> * @param old the old filter to update. * @param filter the LDAP filter to use. * @return a {@link Filter} annotation from old filter and string. * @see FilterAnnotation */ public static Filter makeFilter(Filter old, String filter) { logger.trace("Entering FilterGenerator : " + "makeFilter() with parameters {} | {}", new Object[] {old, filter}); Set<String> tokens = new HashSet<String>(); if (old != null && old.value() != null && old.value().length() > 0) { tokens.add(old.value()); } if (filter != null && filter.length() > 0) { tokens.add(filter); } return make(tokens); }
@Override public int hashCode() { int result = getTypes().hashCode(); result = 31 * result + filter.value().hashCode(); result = 31 * result + getQualifiers().hashCode(); return result; }
@Override public int hashCode() { int result = getTypes().hashCode(); result = 31 * result + filter.value().hashCode(); result = 31 * result + getQualifiers().hashCode(); return result; }
/** * Produce a {@link Filter} annotation from another filter and a * {@link Properties}. Each {@link Property} may be a valid LDAP filter * name/value pair. * <p/> * @param old the old filter to update. * @param annotations the qualifiers to use. * @return a {@link Filter} annotation from old filter and tokenized * annotations. * @see FilterAnnotation */ public static Filter makeFilter(Filter old, Collection<Annotation> annotations) { logger.trace("Entering FilterGenerator : " + "makeFilter() with parameters {} | {}", new Object[] {old, annotations}); Set<String> tokens = new HashSet<String>(); if (old != null && old.value() != null && old.value().length() > 0) { tokens.add(old.value()); } tokens.addAll(tokenize(annotations)); return make(tokens); }
result = 31 * result + filter.value().hashCode(); result = 31 * result + qualifiers.hashCode(); result = 31 * result + (int) timeout; && filter.value() != null && filter.value().length() > 0) { ServiceReference[] refs = ctx.getServiceReferences(name, filter.value()); if (refs != null && refs.length > 0) { reference = refs[0];
private Annotation[] filteredServicesQualifiers(AbstractServiceEvent event, SpecificationAnnotation specific) { Set<Annotation> eventQualifiers = new HashSet<Annotation>(); eventQualifiers.add(specific); for (Annotation annotation : extension.getObservers()) { String value = ((Filter) annotation).value(); try { org.osgi.framework.Filter filter = context.createFilter(value); if (filter.match(event.getReference())) { eventQualifiers.add(new FilterAnnotation(value)); } } catch(InvalidSyntaxException ex) { //ex.printStackTrace(); } } return eventQualifiers.toArray(new Annotation[eventQualifiers.size()]); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof OSGiServiceProducerBean)) { return false; } OSGiServiceProducerBean that = (OSGiServiceProducerBean) o; if (!filter.value().equals(that.filter.value())) { return false; } if (!getTypes().equals(that.getTypes())) { return false; } if (!getQualifiers().equals(that.getQualifiers())) { return false; } return true; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof OSGiServiceBean)) { return false; } OSGiServiceBean that = (OSGiServiceBean) o; if (!filter.value().equals(that.filter.value())) { return false; } if (!getTypes().equals(that.getTypes())) { return false; } if (!getQualifiers().equals(that.getQualifiers())) { return false; } return true; }
if (annotation.annotationType().equals(Filter.class)) { Filter old = (Filter) annotation; if (old.value() != null && old.value().length() > 0) { result.add(old.value()); if (annotation.annotationType().isAnnotationPresent(Filter.class)) { Filter old = annotation.annotationType().getAnnotation(Filter.class); result.add(old.value());
private Annotation[] filteredServicesQualifiers(AbstractServiceEvent event, SpecificationAnnotation specific, Instance<Object> instance) { Set<Annotation> eventQualifiers = new HashSet<Annotation>(); eventQualifiers.add(specific); WeldOSGiExtension extension = instance.select(WeldOSGiExtension.class).get(); for (Annotation annotation : extension.getObservers()) { String value = ((Filter) annotation).value(); try { org.osgi.framework.Filter filter = context.createFilter(value); if (filter.match(event.getReference())) { eventQualifiers.add(new FilterAnnotation(value)); } } catch(InvalidSyntaxException ex) { //ex.printStackTrace(); } } return eventQualifiers.toArray(new Annotation[eventQualifiers.size()]); }
private Annotation[] filteredServicesQualifiers(AbstractServiceEvent event, SpecificationAnnotation specific, Instance<Object> instance) { logger.trace("Entering ExtensionActivator : " + "filteredServicesQualifiers() with parameters {} | {} | {}", new Object[] {event, specific, instance}); Set<Annotation> eventQualifiers = new HashSet<Annotation>(); eventQualifiers.add(specific); WeldOSGiExtension extension = instance.select(WeldOSGiExtension.class).get(); for (Annotation annotation : extension.getObservers()) { String value = ((Filter) annotation).value(); try { org.osgi.framework.Filter filter = context.createFilter(value); if (filter.match(event.getReference())) { eventQualifiers.add(new FilterAnnotation(value)); } } catch(InvalidSyntaxException ex) { //ignore } } return eventQualifiers.toArray(new Annotation[eventQualifiers.size()]); }