Skip to content

Commit cbdfc56

Browse files
committed
wer
1 parent a318bbd commit cbdfc56

File tree

16 files changed

+75
-215
lines changed

16 files changed

+75
-215
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
*/
1616
package app.packed.concurrent;
1717

18-
import app.packed.component.ComponentRealm;
19-
import app.packed.extension.BaseExtension;
20-
import app.packed.namespaceold.OldNamespaceConfiguration;
21-
import app.packed.namespaceold.OldNamespaceHandle;
2218
import app.packed.service.ProvidableBeanConfiguration;
2319

2420
/**
@@ -27,11 +23,7 @@
2723
// Can you have more than 1 compute in a JobNamespace
2824
// Can you have multiple lifetimes in a JobNamespace? Or only 1?
2925
// I think multiple is fine. I mean we support transient jobs which is kind of limited lifetimes
30-
public class JobNamespaceConfiguration extends OldNamespaceConfiguration<BaseExtension> {
31-
32-
protected JobNamespaceConfiguration(OldNamespaceHandle<BaseExtension, ?> namespace, BaseExtension extension, ComponentRealm actor) {
33-
super(namespace, extension, actor);
34-
}
26+
public class JobNamespaceConfiguration {
3527

3628

3729
// Ideen er vel at man kan injected det et sted

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/annotations/ScheduleJob.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import app.packed.bean.BeanTrigger.OnAnnotatedMethod;
2828
import app.packed.concurrent.JobExtension;
2929
import app.packed.concurrent.job2.impl.ScheduledOperationHandle;
30-
import internal.app.packed.concurrent.ThreadNamespaceHandle;
3130
import internal.app.packed.concurrent.old.ScheduleImpl;
3231

3332
/**
@@ -74,11 +73,8 @@ public void onAnnotatedMethod(Annotation hook, BeanIntrospector.OnMethod on) {
7473
// Parse the schedule
7574
ScheduleImpl s = new ScheduleImpl(Duration.ofMillis(schedule.withFixedDelay()));
7675

77-
// Find the namespace we are installing the operation into
78-
ThreadNamespaceHandle namespace = null;// main();
79-
8076
// Install the operation
81-
ScheduledOperationHandle h = on.newOperation().install(namespace,
77+
ScheduledOperationHandle h = on.newOperation().install(
8278
ScheduledOperationHandle::new);
8379

8480
// Configure the handle

modules/packed-incubator/packed-incubator-concurrent/src/main/java/app/packed/concurrent/job2/impl/ScheduledOperationHandle.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import app.packed.concurrent.oldscheduling.ScheduledOperationMirror;
2222
import app.packed.lifecycle.Initialize;
2323
import app.packed.operation.OperationInstaller;
24-
import internal.app.packed.concurrent.ThreadNamespaceHandle;
2524
import internal.app.packed.concurrent.ThreadedOperationHandle;
2625
import internal.app.packed.concurrent.old.ScheduleImpl;
2726

@@ -36,8 +35,8 @@ public final class ScheduledOperationHandle extends ThreadedOperationHandle<Sche
3635
/**
3736
* @param installer
3837
*/
39-
public ScheduledOperationHandle(OperationInstaller installer, ThreadNamespaceHandle namespace) {
40-
super(installer, namespace);
38+
public ScheduledOperationHandle(OperationInstaller installer) {
39+
super(installer);
4140
}
4241

4342
@Override

modules/packed-incubator/packed-incubator-concurrent/src/main/java/internal/app/packed/concurrent/AbstractJobOperationHandle.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public class AbstractJobOperationHandle<T extends JobConfiguration> extends Thre
3232

3333
public ThreadKind threadKind;
3434

35-
protected AbstractJobOperationHandle(OperationInstaller installer, ThreadNamespaceHandle namespace) {
36-
super(installer, namespace);
35+
protected AbstractJobOperationHandle(OperationInstaller installer) {
36+
super(installer);
3737
}
3838

3939
@Override

modules/packed-incubator/packed-incubator-concurrent/src/main/java/internal/app/packed/concurrent/daemon/DaemonJobOperationHandle.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@
2525
import app.packed.extension.BaseExtension;
2626
import app.packed.operation.OperationInstaller;
2727
import internal.app.packed.concurrent.AbstractJobOperationHandle;
28-
import internal.app.packed.concurrent.ThreadNamespaceHandle;
2928

3029
/** An operation handle for a daemon operation. */
3130
public final class DaemonJobOperationHandle extends AbstractJobOperationHandle<DaemonJobConfiguration> {
3231

3332
public boolean restart;
3433

35-
private DaemonJobOperationHandle(OperationInstaller installer, ThreadNamespaceHandle namespace) {
36-
super(installer, namespace);
34+
private DaemonJobOperationHandle(OperationInstaller installer) {
35+
super(installer);
3736
}
3837

3938
/** {@inheritDoc} */
@@ -50,14 +49,13 @@ protected DaemonJobMirror newOperationMirror() {
5049

5150
public static void onDaemonJobAnnotation(BeanIntrospector<BaseExtension> introspector, BeanIntrospector.OnMethod method, DaemonJob annotation) {
5251
// Lazy install the sidehandle and runtime manager
53-
SidehandleBeanConfiguration<DaemonJobSidehandle> sideBean = introspector.applicationBase().installSidebeanIfAbsent(DaemonJobSidehandle.class, SidehandleTargetKind.OPERATION, _ -> {
54-
introspector.applicationBase().install(DaemonJobRuntimeManager.class).provide();
55-
});
52+
SidehandleBeanConfiguration<DaemonJobSidehandle> sideBean = introspector.applicationBase().installSidebeanIfAbsent(DaemonJobSidehandle.class,
53+
SidehandleTargetKind.OPERATION, _ -> {
54+
introspector.applicationBase().install(DaemonJobRuntimeManager.class).provide();
55+
});
5656

57-
ThreadNamespaceHandle namespace = ThreadNamespaceHandle.mainHandle(introspector.extensionHandle());
58-
59-
DaemonJobOperationHandle handle = method.newOperation().addContext(DaemonJobContext.class).attachToSidebean(sideBean).install(namespace,
60-
DaemonJobOperationHandle::new);
57+
DaemonJobOperationHandle handle = method.newOperation().addContext(DaemonJobContext.class).attachToSidebean(sideBean)
58+
.install(DaemonJobOperationHandle::new);
6159
handle.threadKind = annotation.threadKind();
6260
handle.interruptOnStop = annotation.interruptOnStop();
6361
}

modules/packed-incubator/packed-incubator-concurrent/src/main/java/internal/app/packed/concurrent/daemon/JobNamespaceHandle.java

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

modules/packed/src/main/java/app/packed/concurrent/ThreadNamespaceConfiguration.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@
1515
*/
1616
package app.packed.concurrent;
1717

18-
import app.packed.component.ComponentRealm;
19-
import app.packed.extension.BaseExtension;
20-
import app.packed.namespaceold.OldNamespaceConfiguration;
21-
import app.packed.namespaceold.OldNamespaceHandle;
22-
import internal.app.packed.concurrent.ThreadNamespaceHandle;
23-
2418
/**
2519
* A thread namespace defines policies that used for all daemons and scheduled jobs defined within the same namespace.
2620
*/
@@ -29,17 +23,7 @@
2923
// Fyldt med Thread factories/pools
3024
// Hvad med extensions??? Vi vil gerne kunne configure deres.
3125
// Maaske deler vi en enkelt. Maaske har vi noget hierrakisk hvor vi nedarver settings
32-
public final class ThreadNamespaceConfiguration extends OldNamespaceConfiguration<BaseExtension> {
33-
34-
final ThreadNamespaceHandle handle;
35-
36-
/**
37-
* @param handle
38-
*/
39-
public ThreadNamespaceConfiguration(OldNamespaceHandle<BaseExtension, ?> handle, BaseExtension extension, ComponentRealm actor) {
40-
super(handle, extension, actor);
41-
this.handle = (ThreadNamespaceHandle) handle;
42-
}
26+
public final class ThreadNamespaceConfiguration {
4327

4428
// public DaemonOperationConfiguration addDaemon(Consumer<DaemonContext> action) {
4529
// throw new UnsupportedOperationException();

modules/packed/src/main/java/app/packed/extension/BaseExtension.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import app.packed.container.ContainerHandle;
1313
import app.packed.container.ContainerInstaller;
1414
import app.packed.container.Wirelet;
15+
import app.packed.extension.Extension.Props;
1516
import app.packed.extension.ExtensionPoint.ExtensionPointHandle;
1617
import app.packed.operation.Op;
1718
import app.packed.service.ProvidableBeanConfiguration;
@@ -20,6 +21,7 @@
2021
import internal.app.packed.bean.PackedBeanInstaller;
2122
import internal.app.packed.bean.PackedBeanInstaller.ProvidableBeanHandle;
2223
import internal.app.packed.container.PackedContainerInstaller;
24+
import internal.app.packed.extension.BaseExtensionNamespace;
2325
import internal.app.packed.service.util.PackedServiceLocator;
2426
import sandbox.app.packed.bean.BeanSynthesizer;
2527

@@ -47,20 +49,26 @@
4749
// Service
4850
//// export require provide transform/rewrite??? depends on 1 or two interfaces
4951

52+
@Props(extensionNamespace = BaseExtensionNamespace.class)
5053
public final class BaseExtension extends FrameworkExtension<BaseExtension> {
5154

5255
// We use an initial value for now, because we share FromLinks and the boolean fields
5356
// But right now we only have a single field
5457
static final ContainerBuildLocal<FromLinks> FROM_LINKS = ContainerBuildLocal.of(FromLinks::new);
5558

59+
final BaseExtensionNamespace namespace;
60+
5661
/**
5762
* All your base are belong to us.
5863
*
64+
* @param namespace
65+
* the extension's namespace
5966
* @param handle
6067
* the extension's handle
6168
*/
62-
BaseExtension(ExtensionHandle<BaseExtension> handle) {
69+
BaseExtension(BaseExtensionNamespace namespace, ExtensionHandle<BaseExtension> handle) {
6370
super(handle);
71+
this.namespace = namespace;
6472
}
6573

6674
/**
@@ -295,18 +303,9 @@ protected void onConfigured() {
295303

296304
/** {@return the container's main service namespace} */
297305
public ServiceNamespaceConfiguration services() {
298-
return services("main");
299-
}
300-
301-
public ServiceNamespaceConfiguration services(String name) {
302-
// Will automatically create one with default settings
303306
throw new UnsupportedOperationException();
304307
}
305308

306-
protected ServiceNamespaceConfiguration services(String name, Consumer<?> newConfiguration) {
307-
return services("main");
308-
}
309-
310309
// transformAllBeans() <-- includes extension beans... (Must be open)
311310
@SuppressWarnings("exports")
312311
public Runnable transformAllBeans(Consumer<? super BeanSynthesizer> transformer) {

modules/packed/src/main/java/app/packed/extension/Extension.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import app.packed.service.ProvidableBeanConfiguration;
4040
import app.packed.util.TreeView;
4141
import internal.app.packed.container.ContainerSetup;
42+
import internal.app.packed.extension.BaseExtensionNamespace;
4243
import internal.app.packed.extension.ExtensionSetup;
4344
import internal.app.packed.extension.PackedExtensionHandle;
4445
import internal.app.packed.extension.PackedExtensionPointHandle;
@@ -123,6 +124,11 @@ public void invoke_Extension_OnAssemblyClose(Extension<?> extension) {
123124
public void invoke_Extension_OnNew(Extension<?> extension) {
124125
extension.onNew();
125126
}
127+
128+
@Override
129+
public BaseExtension create_BaseExtension(BaseExtensionNamespace namespace, ExtensionHandle<BaseExtension> handle) {
130+
return new BaseExtension(namespace, handle);
131+
}
126132
});
127133
}
128134

modules/packed/src/main/java/app/packed/lifecycle/sandbox/errorhandling/ErrorHandlingNamespaceConfiguration.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,9 @@
1515
*/
1616
package app.packed.lifecycle.sandbox.errorhandling;
1717

18-
import app.packed.component.ComponentRealm;
19-
import app.packed.extension.BaseExtension;
20-
import app.packed.namespaceold.OldNamespaceConfiguration;
21-
import app.packed.namespaceold.OldNamespaceHandle;
22-
2318
/**
2419
*
2520
*/
26-
public final class ErrorHandlingNamespaceConfiguration extends OldNamespaceConfiguration<BaseExtension> {
27-
28-
/**
29-
* @param namespace
30-
* @param extension
31-
* @param actor
32-
*/
33-
protected ErrorHandlingNamespaceConfiguration(OldNamespaceHandle<BaseExtension, ?> namespace, BaseExtension extension, ComponentRealm actor) {
34-
super(namespace, extension, actor);
35-
}
21+
public final class ErrorHandlingNamespaceConfiguration {
3622

3723
}

0 commit comments

Comments
 (0)