use of io.kestra.core.storages.StorageInterface in project kestra by kestra-io.
the class Delete method run.
@Override
public Delete.Output run(RunContext runContext) throws Exception {
StorageInterface storageInterface = runContext.getApplicationContext().getBean(StorageInterface.class);
URI render = URI.create(runContext.render(this.uri));
boolean delete = storageInterface.delete(render);
if (errorOnMissing && !delete) {
throw new NoSuchElementException("Unable to find file '" + render + "'");
}
return Output.builder().uri(render).deleted(delete).build();
}
use of io.kestra.core.storages.StorageInterface in project kestra by kestra-io.
the class PluginScanner method scanClassLoader.
@SuppressWarnings({ "unchecked", "rawtypes" })
private RegisteredPlugin scanClassLoader(final ClassLoader classLoader, ExternalPlugin externalPlugin, Manifest manifest) {
List<Class<? extends Task>> tasks = new ArrayList<>();
List<Class<? extends AbstractTrigger>> triggers = new ArrayList<>();
List<Class<? extends Condition>> conditions = new ArrayList<>();
List<Class<? extends StorageInterface>> storages = new ArrayList<>();
List<Class<?>> controllers = new ArrayList<>();
final SoftServiceLoader<BeanIntrospectionReference> definitions = SoftServiceLoader.load(BeanIntrospectionReference.class, classLoader);
if (manifest == null) {
manifest = getManifest(classLoader);
}
for (ServiceDefinition<BeanIntrospectionReference> definition : definitions) {
if (definition.isPresent()) {
final BeanIntrospectionReference ref = definition.load();
Class beanType = ref.getBeanType();
if (Modifier.isAbstract(beanType.getModifiers())) {
continue;
}
if (Task.class.isAssignableFrom(beanType)) {
tasks.add(beanType);
}
if (AbstractTrigger.class.isAssignableFrom(beanType)) {
triggers.add(beanType);
}
if (Condition.class.isAssignableFrom(beanType)) {
conditions.add(beanType);
}
if (StorageInterface.class.isAssignableFrom(beanType)) {
storages.add(beanType);
}
if (beanType.isAnnotationPresent(Controller.class)) {
controllers.add(beanType);
}
}
}
return RegisteredPlugin.builder().externalPlugin(externalPlugin).manifest(manifest).classLoader(classLoader).tasks(tasks).triggers(triggers).conditions(conditions).controllers(controllers).storages(storages).build();
}
use of io.kestra.core.storages.StorageInterface in project kestra by kestra-io.
the class Size method run.
@Override
public Size.Output run(RunContext runContext) throws Exception {
StorageInterface storageInterface = runContext.getApplicationContext().getBean(StorageInterface.class);
URI render = URI.create(runContext.render(this.uri));
Long size = storageInterface.size(render);
return Output.builder().size(size).build();
}
Aggregations