void removeRange(RowCursor min, RowCursor max, Predicate<RowCursor> predicate, @Service BackupKelp backup, Result<Boolean> cont);
private String serviceAddress(Class<?> type) { Service service = type.getAnnotation(Service.class); if (service != null && ! service.value().isEmpty()) { return service.value(); } for (Annotation ann : type.getAnnotations()) { service = ann.annotationType().getAnnotation(Service.class); if (service != null && ! service.value().isEmpty()) { return service.value(); } } return ""; }
void update(RowCursor minCursor, RowCursor maxCursor, EnvKelp envKelp, UpdateKelp update, @Service BackupKelp backup, Result<Integer> result);
/** * Watch this file for changes. * * @param watch */ void watch(@Service Watch watch, Result<Cancel> result); }
private String tableName(Class<T> type, Asset table, Service serviceTable) { String tableName; if (serviceTable != null && ! serviceTable.value().isEmpty()) { tableName = serviceTable.value(); tableName = tableName.substring(1); tableName = tableName.replace('/', '_'); } else if (table != null && !table.value().isEmpty()) { tableName = table.value(); } else { tableName = type.getSimpleName(); } return tableName; }
/** * Interface PipeBrokerSync is a synchronous interface to PipeBroker * * @see PipeBroker */ @Service("pipe:///{name}") public interface PipeBrokerSync<T> extends PipeBroker<T> { Void send(T value); }
public String address() { Service service = getService(); if (service == null) return null; String address = service.value(); if (address == null) { String name = getType().getSimpleName(); if (name.endsWith("Impl")) name = name.substring(0, name.length() - 4); address = "/" + name; } return address; } }
/** * Watch this file for changes. * * @param watch */ Cancel watch(@Service Watch watch); }
@Service public interface DatabaseKrakenSync extends DatabaseKraken { Object execute(String sql, Object... params); ResultSetKraken query(String sql, Object... params); }
private <T> void introspectService(WebBuilder builder, Method method, Supplier<Object> beanFactory) { Service service = method.getAnnotation(Service.class); Api api = method.getAnnotation(Api.class); String address = service.value(); /* if (address.isEmpty()) { address = "/" + apiClass.getSimpleName(); } */ Class<T> type = (Class<T>) method.getReturnType(); Supplier<T> supplier = ()->(T) newInstance(beanFactory,method); ServiceBuilder serviceBuilder = builder.service(type, supplier); if (api != null) { serviceBuilder.api(api.value()); } if (! address.isEmpty()) { serviceBuilder.address(address); } Workers workers = method.getAnnotation(Workers.class); if (workers != null) { serviceBuilder.workers(workers.value()); } }
void replace(RowCursor cursor, EnvKelp envKelp, UpdateKelp update, @Service BackupKelp backup, Result<Integer> result);
private void addAssetConverter(Class<?> api) { TypeRef resourceRef = TypeRef.of(api).to(Vault.class); Class<?> idType = resourceRef.param(0).rawClass(); Class<?> itemType = resourceRef.param(1).rawClass(); Service service = api.getAnnotation(Service.class); String address = ""; if (service != null) { address = service.value(); } if (address.isEmpty()) { address = "/" + itemType.getSimpleName(); } TypeRef convertRef = TypeRef.of(Convert.class, String.class, itemType); Convert<String,?> convert = new ConvertAsset(address, itemType); bean(convert).to(Key.of(convertRef.type())); }
/** * Set a watch callback on a database to be notified when the row changes. * * @param watch callback for change events to the row * @param sql the watch query to select rows to watch * @param param parameters for the query * @return true on success */ boolean watch(@Service DatabaseWatch watch, String sql, Object ...param); //boolean unwatch(@Service DatabaseWatch watch, String sql, Object ...param);
@Override public <T> Provider<T> provider(Injector manager, InjectionPoint<T> ip) { Service service = ip.annotation(Service.class); Class<T> rawClass = ip.key().rawClass(); if (service == null) { service = metaService(ip.key()); } if (service == null) { service = rawClass.getAnnotation(Service.class); } if (service == null) { return null; } String address = getManager().address(rawClass, service.value()); if (address != null && ! address.isEmpty()) { T proxy = getManager().service(address).as(rawClass); return ()->proxy; } else { return null; } }
/** * Interface */ @Service public interface DatabaseKraken { void execute(Result<Object> result, String sql, Object... params); void query(Result<ResultSetKraken> result, String sql, Object... params); }
if (_address == null && service.value().length() > 0) { addressAuto(serviceClass);
public void bind(String path, @Service FileServiceBind subFile) { //System.out.println("BIND: " + path + " " + subFile); }