public static Interest<InstanceInfo> forApplications(Operator operator, String... applicationNames) { if (applicationNames.length == 0) { return EmptyRegistryInterest.getInstance(); } if (applicationNames.length == 1) { return new ApplicationInterest(applicationNames[0], operator); } Interest[] interests = new Interest[applicationNames.length]; for (int i = 0; i < interests.length; i++) { interests[i] = new ApplicationInterest(applicationNames[i], operator); } return new MultipleInterests<InstanceInfo>(interests); }
public static Interest<InstanceInfo> forInstance(Operator operator, String... instanceIds) { if (instanceIds.length == 0) { return EmptyRegistryInterest.getInstance(); } if (instanceIds.length == 1) { return new InstanceInterest(instanceIds[0], operator); } Interest[] interests = new Interest[instanceIds.length]; for (int i = 0; i < interests.length; i++) { interests[i] = new InstanceInterest(instanceIds[i], operator); } return new MultipleInterests<InstanceInfo>(interests); }
@Override public ChangeNotification<T> call(T data) { return new ChangeNotification<>(Kind.Add, data); } };
public ChangeNotification<T> toBaseNotification() { return new ChangeNotification<>(getKind(), getData()); }
public ModifyNotification<T> toBaseNotification() { return new ModifyNotification<>(getData(), getDelta()); }
public Interest<InstanceInfo> toComposite() { if(interests.length == 0) { return Interests.forNone(); } if (interests.length > 1) { return new MultipleInterests<InstanceInfo>(interests); } return interests[0]; }
public static Interest<InstanceInfo> forSecureVips(Operator operator, String... secureVips) { if (secureVips.length == 0) { return EmptyRegistryInterest.getInstance(); } if (secureVips.length == 1) { return new SecureVipInterest(secureVips[0], operator); } Interest[] interests = new Interest[secureVips.length]; for (int i = 0; i < interests.length; i++) { interests[i] = new SecureVipInterest(secureVips[i], operator); } return new MultipleInterests<InstanceInfo>(interests); }
public static Interest<InstanceInfo> forVips(Operator operator, String... vips) { if (vips.length == 0) { return EmptyRegistryInterest.getInstance(); } if (vips.length == 1) { return new VipInterest(vips[0], operator); } Interest[] interests = new Interest[vips.length]; for (int i = 0; i < interests.length; i++) { interests[i] = new VipInterest(vips[i], operator); } return new MultipleInterests<InstanceInfo>(interests); }
@Override public Boolean call(InstanceInfo instanceInfo) { return instanceInfo != null && interest.matches(instanceInfo); } });
@Override public Boolean call(ChangeNotification<?> notification) { return notification.isDataNotification(); } };
@Override public String toString() { return "SourcedChangeNotification{" + "source=" + source + "} " + super.toString(); }
@Override public ChangeNotification<InstanceInfo> call(StreamStateNotification.BufferState state) { if (state == StreamStateNotification.BufferState.BufferEnd) { return new StreamStateNotification<>(state, interest); } return null; } })
@Override public final void onNext(ChangeNotification<T> notification) { // Since we pause notifications during iterator creation, we will not get an onNext when iterator creation is in progress. addNotification(notification); }
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },
@Override public String toString() { return "ModifyNotification{" + "delta=" + delta + "} " + super.toString(); } }
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Delete, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Delete, seed); } },
@Override public ChangeNotification<InstanceInfo> newNotification(InstanceInfo seed) { return new ChangeNotification<>(ChangeNotification.Kind.Add, seed); } },