Skip to content

Commit 8926b37

Browse files
committed
a
a
1 parent 6345b14 commit 8926b37

File tree

101 files changed

+1059
-1043
lines changed

Some content is hidden

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

101 files changed

+1059
-1043
lines changed

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

Lines changed: 0 additions & 44 deletions
This file was deleted.

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
*/
1616
package app.packed.cli;
1717

18+
import java.lang.annotation.Annotation;
1819
import java.lang.annotation.Documented;
1920
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
2122
import java.lang.annotation.RetentionPolicy;
2223
import java.lang.annotation.Target;
2324

25+
import app.packed.bean.scanning.BeanIntrospector;
2426
import app.packed.bean.scanning.BeanTrigger.OnAnnotatedMethod;
2527
import app.packed.namespace.sandbox.NamespaceOperation;
2628

@@ -31,7 +33,7 @@
3133
@Retention(RetentionPolicy.RUNTIME)
3234
@Documented
3335
@NamespaceOperation
34-
@OnAnnotatedMethod(introspector = CliBeanIntrospector.class)
36+
@OnAnnotatedMethod(introspector = CliCommandBeanIntrospector.class)
3537
public @interface CliCommand {
3638

3739
/**
@@ -63,3 +65,12 @@
6365
//
6466
// }
6567
}
68+
69+
final class CliCommandBeanIntrospector extends BeanIntrospector<CliExtension> {
70+
71+
/** {@inheritDoc} */
72+
@Override
73+
public void onAnnotatedMethod(Annotation annotation, BeanIntrospector.OnMethod method) {
74+
extension().ns().process(extension(), (CliCommand) annotation, method);
75+
}
76+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
public class CliCommandConfiguration extends OperationConfiguration {
2828

2929
/** The handle for the command. */
30-
private final CliCommandHandle handle;
30+
private final CliCommandOperationHandle handle;
3131

3232
/**
3333
* @param handle
3434
*/
35-
CliCommandConfiguration(CliCommandHandle handle) {
35+
CliCommandConfiguration(CliCommandOperationHandle handle) {
3636
this.handle = requireNonNull(handle);
3737
super(handle);
3838
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
*/
2626
public class CliCommandMirror extends OperationMirror {
2727

28-
final CliCommandHandle handle;
28+
final CliCommandOperationHandle handle;
2929

30-
CliCommandMirror(CliCommandHandle handle) {
30+
CliCommandMirror(CliCommandOperationHandle handle) {
3131
super(handle);
3232
this.handle = handle;
3333
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
*
2828
*/
29-
final class CliCommandHandle extends OperationHandle<CliCommandConfiguration> {
29+
final class CliCommandOperationHandle extends OperationHandle<CliCommandConfiguration> {
3030

3131
CliCommand command;
3232

@@ -37,7 +37,7 @@ final class CliCommandHandle extends OperationHandle<CliCommandConfiguration> {
3737
/**
3838
* @param installer
3939
*/
40-
CliCommandHandle(OperationInstaller installer, CliNamespaceHandle namespace) {
40+
CliCommandOperationHandle(OperationInstaller installer, CliNamespaceHandle namespace) {
4141
super(installer);
4242
this.namespace = requireNonNull(namespace);
4343
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class CliNamespaceHandle extends NamespaceHandle<CliExtension, CliNamespac
3737
static final NamespaceTemplate<CliNamespaceHandle> TEMPLATE = NamespaceTemplate.of(CliNamespaceHandle.class, CliNamespaceHandle::new);
3838

3939
/** All the commands within the namespace. */
40-
final LinkedHashMap<String, CliCommandHandle> commands = new LinkedHashMap<>();
40+
final LinkedHashMap<String, CliCommandOperationHandle> commands = new LinkedHashMap<>();
4141

4242
final List<CliOptionMirror> options = new ArrayList<>();
4343

@@ -57,7 +57,7 @@ protected CliNamespaceMirror newNamespaceMirror() {
5757
}
5858

5959
void process(CliExtension extension, CliCommand c, BeanIntrospector.OnMethod method) {
60-
CliCommandHandle h = null;
60+
CliCommandOperationHandle h = null;
6161
for (String n : c.name()) {
6262
if (commands.containsKey(n)) {
6363
throw new BeanInstallationException("Multiple cli commands with the same name, name = " + c.name());
@@ -66,7 +66,7 @@ void process(CliExtension extension, CliCommand c, BeanIntrospector.OnMethod met
6666

6767
// For each name check that it doesn't exists in commands already
6868
if (isInApplicationLifetime(extension)) {
69-
h = method.newOperation(OperationTemplate.defaults()).install(i -> new CliCommandHandle(i, this));
69+
h = method.newOperation(OperationTemplate.defaults()).install(i -> new CliCommandOperationHandle(i, this));
7070

7171
// OperationTemplate.
7272
// h.namespace(this)

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,24 @@
1515
*/
1616
package app.packed.cli;
1717

18+
import java.lang.annotation.Annotation;
19+
20+
import app.packed.bean.scanning.BeanIntrospector;
1821
import app.packed.bean.scanning.BeanTrigger;
1922
import app.packed.namespace.sandbox.NamespaceOperation;
2023

2124
/**
2225
*
2326
*/
2427
@NamespaceOperation
25-
@BeanTrigger.OnAnnotatedVariable(introspector = CliBeanIntrospector.class)
26-
public @interface CliOption {
28+
@BeanTrigger.OnAnnotatedVariable(introspector = CliOptionBeanIntrospector.class)
29+
public @interface CliOption {}
30+
31+
final class CliOptionBeanIntrospector extends BeanIntrospector<CliExtension> {
2732

28-
}
33+
/** {@inheritDoc} */
34+
@Override
35+
public void onAnnotatedVariable(Annotation annotation, OnVariable onVariable) {
36+
extension().ns().process(extension(), (CliOption) annotation, onVariable);
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package app.packed.concurrent.annotations;
22

3+
import app.packed.bean.scanning.BeanIntrospector;
34
import app.packed.bean.scanning.BeanTrigger.AutoInject;
45
import app.packed.concurrent.other.ScheduledJobExtension;
56
import app.packed.context.Context;
67

7-
@AutoInject(introspector = ScheduledJobExtension.ScheduledJobBeanIntrospector.class, requiresContext = ScheduledJobContext.class)
8+
@AutoInject(introspector = ScheduledJobContextBeanIntrospector.class, requiresContext = ScheduledJobContext.class)
89
public interface ScheduledJobContext extends Context<ScheduledJobExtension> {
910

1011
void pause();
@@ -13,3 +14,7 @@ public interface ScheduledJobContext extends Context<ScheduledJobExtension> {
1314

1415
void cancel();
1516
}
17+
18+
final class ScheduledJobContextBeanIntrospector extends BeanIntrospector<ScheduledJobExtension> {
19+
20+
}

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/job/DaemonJob.java

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import app.packed.bean.scanning.BeanTrigger.OnAnnotatedMethod;
2727
import app.packed.binding.Key;
2828
import app.packed.concurrent.ThreadKind;
29-
import app.packed.concurrent.job.DaemonJob.Daemonintrospector;
30-
import app.packed.extension.BaseExtension;
29+
import internal.app.packed.bean.scanning.IntrospectorOnContextService;
3130
import internal.app.packed.concurrent.daemon.DaemonOperationHandle;
31+
import internal.app.packed.extension.BaseExtensionBeanIntrospector;
3232

3333
/**
3434
* Will have a dedicated thread.
@@ -52,7 +52,7 @@
5252
// SupportJob
5353
@Target(ElementType.METHOD)
5454
@Retention(RetentionPolicy.RUNTIME)
55-
@OnAnnotatedMethod(allowInvoke = true, introspector = Daemonintrospector.class)
55+
@OnAnnotatedMethod(allowInvoke = true, introspector = DaemonJobBeanIntrospector.class)
5656
public @interface DaemonJob {
5757

5858
String startup() default "When-exactly-are we starting";
@@ -77,27 +77,23 @@
7777
* @see DaemonMirror#threadKind()
7878
*/
7979
ThreadKind threadKind() default ThreadKind.DAEMON_THREAD;
80+
}
8081

81-
final class Daemonintrospector extends BeanIntrospector<BaseExtension> {
82+
final class DaemonJobBeanIntrospector extends BaseExtensionBeanIntrospector {
8283

83-
/** {@inheritDoc} */
84-
@Override
85-
public void onAnnotatedMethod(Annotation annotation, BeanIntrospector.OnMethod method) {
86-
if (annotation instanceof DaemonJob daemon) {
87-
DaemonOperationHandle.installFromAnnotation(this, method, daemon);
88-
} else {
89-
super.onAnnotatedMethod(annotation, method);
90-
}
91-
}
84+
/** {@inheritDoc} */
85+
@Override
86+
public void onAnnotatedMethod(Annotation annotation, BeanIntrospector.OnMethod method) {
87+
DaemonOperationHandle.installFromAnnotation(this, method, (DaemonJob) annotation);
88+
}
9289

93-
/** {@inheritDoc} */
94-
@Override
95-
public void onExtensionService(Key<?> key, OnContextService service) {
96-
if (service.matchNoQualifiers(DaemonJobContext.class)) {
97-
service.binder().bindInvocationArgument(1);
98-
} else {
99-
super.onExtensionService(key, service);
100-
}
90+
/** {@inheritDoc} */
91+
@Override
92+
public void onExtensionService(Key<?> key, IntrospectorOnContextService service) {
93+
if (service.matchNoQualifiers(DaemonJobContext.class)) {
94+
service.binder().bindInvocationArgument(1);
95+
} else {
96+
super.onExtensionService(key, service);
10197
}
10298
}
10399
}
@@ -107,9 +103,9 @@ public void onExtensionService(Key<?> key, OnContextService service) {
107103

108104
interface DaemonJobAction {
109105

110-
// The one problem here is cleanup...
111-
// Do we want a stop method? Probably not
112-
static DaemonJobAction sleep(long duration, TimeUnit timeUnit) {
113-
throw new UnsupportedOperationException();
114-
}
106+
// The one problem here is cleanup...
107+
// Do we want a stop method? Probably not
108+
static DaemonJobAction sleep(long duration, TimeUnit timeUnit) {
109+
throw new UnsupportedOperationException();
110+
}
115111
}

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/job/DaemonJobContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
*/
2929
// I think we need a bit understand about where we are in the shutdown process, early, vs late
30-
@AutoInject(introspector = DaemonJob.Daemonintrospector.class, requiresContext = DaemonJobContext.class)
30+
@AutoInject(introspector = DaemonJobBeanIntrospector.class, requiresContext = DaemonJobContext.class)
3131
public sealed interface DaemonJobContext extends Context<BaseExtension> permits DaemonSideBean {
3232

3333
/**

0 commit comments

Comments
 (0)