Skip to content

Commit 0e53aa4

Browse files
committed
e
1 parent 49bc145 commit 0e53aa4

File tree

223 files changed

+4397
-2634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+4397
-2634
lines changed

modules/packed-incubator/packed-incubator-cli/src/main/java/app/packed/cli/CliCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.lang.annotation.RetentionPolicy;
2222
import java.lang.annotation.Target;
2323

24-
import app.packed.bean.scanning.BeanTrigger.AnnotatedMethodBeanTrigger;
24+
import app.packed.bean.scanning.BeanTrigger.OnAnnotatedMethod;
2525
import app.packed.namespace.sandbox.NamespaceOperation;
2626

2727
/**
@@ -31,7 +31,7 @@
3131
@Retention(RetentionPolicy.RUNTIME)
3232
@Documented
3333
@NamespaceOperation
34-
@AnnotatedMethodBeanTrigger(extension = CliExtension.class)
34+
@OnAnnotatedMethod(extension = CliExtension.class)
3535
public @interface CliCommand {
3636

3737
/**w

modules/packed-incubator/packed-incubator-cli/src/main/java/app/packed/cli/CliCommandHandle.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
final class CliCommandHandle extends OperationHandle<CliCommandConfiguration> {
3030

3131
CliCommand command;
32+
3233
final List<String> names = new ArrayList<>();
3334

3435
final CliNamespaceHandle namespace;

modules/packed-incubator/packed-incubator-cli/src/main/java/app/packed/cli/CliCommandMirror.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
import java.util.Collections;
1919
import java.util.List;
2020

21-
import app.packed.namespace.NamespaceOperationMirror;
21+
import app.packed.operation.OperationMirror;
2222

2323
/**
2424
* A mirror for a CLI command (operation).
2525
*/
26-
public class CliCommandMirror extends NamespaceOperationMirror {
26+
public class CliCommandMirror extends OperationMirror {
2727

2828
final CliCommandHandle handle;
2929

@@ -37,7 +37,6 @@ public List<String> names() {
3737
}
3838

3939
/** {@return the namespace this command is part of.} */
40-
@Override
4140
public CliNamespaceMirror namespace() {
4241
return handle.namespace.newNamespaceMirror();
4342
}

modules/packed-incubator/packed-incubator-cli/src/main/java/app/packed/cli/CliExtension.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
import java.util.function.Consumer;
2121

2222
import app.packed.assembly.Assembly;
23-
import app.packed.bean.scanning.BeanIntrospector;
24-
import app.packed.bean.scanning.BeanElement.BeanMethod;
2523
import app.packed.bean.InstanceBeanConfiguration;
24+
import app.packed.bean.scanning.BeanIntrospector;
2625
import app.packed.container.ContainerBuildLocal;
2726
import app.packed.container.ContainerConfiguration;
2827
import app.packed.container.ContainerHandle;
@@ -79,11 +78,11 @@ protected BeanIntrospector newBeanIntrospector() {
7978

8079
/** {@inheritDoc} */
8180
@Override
82-
public void onAnnotatedMethod(BeanMethod method, Annotation hook) {
81+
public void onAnnotatedMethod(Annotation hook, BeanIntrospector.OnMethod method) {
8382
if (hook instanceof CliCommand c) {
8483
ns().process(CliExtension.this, c, method);
8584
} else {
86-
super.onAnnotatedMethod(method, hook);
85+
super.onAnnotatedMethod(hook, method);
8786
}
8887
}
8988
};

modules/packed-incubator/packed-incubator-cli/src/main/java/app/packed/cli/CliNamespaceHandle.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.util.LinkedHashMap;
1919

2020
import app.packed.bean.BeanInstallationException;
21-
import app.packed.bean.scanning.BeanElement.BeanMethod;
21+
import app.packed.bean.scanning.BeanIntrospector;
2222
import app.packed.build.BuildActor;
2323
import app.packed.namespace.NamespaceHandle;
2424
import app.packed.namespace.NamespaceInstaller;
@@ -51,7 +51,7 @@ protected CliNamespaceConfiguration newNamespaceConfiguration(CliExtension e, Bu
5151
return new CliNamespaceConfiguration(this, e, actor);
5252
}
5353

54-
void process(CliExtension extension, CliCommand c, BeanMethod method) {
54+
void process(CliExtension extension, CliCommand c, BeanIntrospector.OnMethod method) {
5555
CliCommandHandle h = null;
5656
// For each name check that it doesn't exists in commands already
5757
if (isInApplicationLifetime(extension)) {
@@ -68,7 +68,6 @@ void process(CliExtension extension, CliCommand c, BeanMethod method) {
6868
// EntryPoint.LaunchLifetime
6969
}
7070

71-
// I think all this is stored in CliCommandConfiguration
7271
h.command = c;
7372
if (oldCommands.putIfAbsent(c.name()[0], h) != null) {
7473
throw new BeanInstallationException("Multiple cli commands with the same name, name = " + c.name());

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/Daemon.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import java.lang.annotation.RetentionPolicy;
2121
import java.lang.annotation.Target;
2222

23-
import app.packed.bean.scanning.BeanTrigger.AnnotatedMethodBeanTrigger;
23+
import app.packed.bean.scanning.BeanTrigger.OnAnnotatedMethod;
2424

2525
/**
2626
* Will have a dedicated thread.
2727
*/
2828
@Target(ElementType.METHOD)
2929
@Retention(RetentionPolicy.RUNTIME)
30-
@AnnotatedMethodBeanTrigger(allowInvoke = true, extension = ThreadExtension.class)
30+
@OnAnnotatedMethod(allowInvoke = true, extension = ThreadExtension.class)
3131
public @interface Daemon {
3232

3333
// resume->Never, Always, backoff policy

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/DaemonContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
import java.util.concurrent.TimeUnit;
1919

20+
import app.packed.bean.scanning.BeanTrigger.OnExtensionServiceBeanTrigger;
2021
import app.packed.context.Context;
21-
import app.packed.context.ContextualServiceProvider;
2222

2323
/**
2424
*
2525
*/
26-
@ContextualServiceProvider(extension = ThreadExtension.class, context = DaemonContext.class)
26+
@OnExtensionServiceBeanTrigger(extension = ThreadExtension.class, requiresContext = DaemonContext.class)
2727
public interface DaemonContext extends Context<ThreadExtension> {
2828

2929
boolean isShutdown();

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/ScheduleRecurrent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
import java.lang.annotation.RetentionPolicy;
2121
import java.lang.annotation.Target;
2222

23-
import app.packed.bean.scanning.BeanTrigger.AnnotatedMethodBeanTrigger;
23+
import app.packed.bean.scanning.BeanTrigger.OnAnnotatedMethod;
2424

2525
/**
2626
*
2727
*/
2828
@Target(ElementType.METHOD)
2929
@Retention(RetentionPolicy.RUNTIME)
30-
@AnnotatedMethodBeanTrigger(allowInvoke = true, extension = ThreadExtension.class)
30+
@OnAnnotatedMethod(allowInvoke = true, extension = ThreadExtension.class)
3131
public @interface ScheduleRecurrent {
3232
int millies();
3333
}

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/SchedulingContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package app.packed.concurrent;
22

3+
import app.packed.bean.scanning.BeanTrigger.OnExtensionServiceBeanTrigger;
34
import app.packed.context.Context;
4-
import app.packed.context.ContextualServiceProvider;
55

66
/**
77
* A context object available for scheduling.
88
*/
9-
@ContextualServiceProvider(extension = ThreadExtension.class, context = SchedulingContext.class)
9+
@OnExtensionServiceBeanTrigger(extension = ThreadExtension.class, requiresContext = SchedulingContext.class)
1010
public interface SchedulingContext extends Context<ThreadExtension> {
1111

1212
/** {@return cancel future invocation of the scheduled operations. In progress operations will be allowed to finish} */

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/ThreadExtension.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@
1717

1818
import java.lang.annotation.Annotation;
1919
import java.time.Duration;
20-
import java.util.Set;
2120
import java.util.function.Consumer;
2221

2322
import app.packed.bean.BeanConfiguration;
24-
import app.packed.bean.scanning.BeanElement.BeanMethod;
2523
import app.packed.bean.scanning.BeanIntrospector;
2624
import app.packed.binding.Key;
27-
import app.packed.binding.UnwrappedBindableVariable;
28-
import app.packed.context.Context;
2925
import app.packed.context.ContextTemplate;
3026
import app.packed.extension.ExtensionHandle;
3127
import app.packed.extension.ExtensionPoint;
@@ -101,17 +97,19 @@ protected BeanIntrospector newBeanIntrospector() {
10197
return new BeanIntrospector() {
10298

10399
@Override
104-
public void onContextualServiceProvision(Key<?> key, Class<?> actualHook, Set<Class<? extends Context<?>>> contexts, UnwrappedBindableVariable v) {
100+
public void onExtensionService(Key<?> key, OnExtensionService service) {
101+
OnVariableUnwrapped binding = service.binder();
102+
105103
Class<?> hook = key.rawType();
106104
if (hook == SchedulingContext.class || hook == DaemonContext.class) {
107-
v.bindInvocationArgument(1);
105+
binding.bindInvocationArgument(1);
108106
} else {
109-
super.onContextualServiceProvision(key, actualHook, contexts, v);
107+
super.onExtensionService(key, service);
110108
}
111109
}
112110

113111
@Override
114-
public void onAnnotatedMethod(BeanMethod on, Annotation hook) {
112+
public void onAnnotatedMethod(Annotation hook, BeanIntrospector.OnMethod on) {
115113
if (hook instanceof ScheduleRecurrent schedule) {
116114
// Parse the schedule
117115
ScheduleImpl s = new ScheduleImpl(Duration.ofMillis(schedule.millies()));
@@ -134,7 +132,7 @@ public void onAnnotatedMethod(BeanMethod on, Annotation hook) {
134132
// Configure the handle
135133
h.useVirtual = daemon.useVirtual();
136134
} else {
137-
super.onAnnotatedMethod(on, hook);
135+
super.onAnnotatedMethod(hook, on);
138136
}
139137
}
140138
};

0 commit comments

Comments
 (0)