Sorry for bothering you.
I'm trying to define a SpaceSpecification to create an instance of a custom space which extends the AbstractEventSpace. However I'm having some troubles in determining how to instantiate the space (which requires a SpaceParticipantListener).
Following the example of the specifications implemented in Janus, I've tried to define my space specification as follows:
class MySpaceSpecification implements SpaceSpecification<ExceptionSpace> {
val injector : Injector
val loggingService : LoggingService
val spaceParticipantListenerFactory : SpaceParticipantListenerFactory
val defaultSpace : OpenEventSpace
new (injector : Injector, defaultSpace : OpenEventSpace,
spaceParticipantListenerFactory : SpaceParticipantListenerFactory,
logger : LoggingService) {
this.injector = injector;
this.defaultSpace = defaultSpace
this.spaceParticipantListenerFactory = spaceParticipantListenerFactory
this.loggingService = logger
}
def create(id : SpaceID, params : Object*) : MySpace {
val logger = this.loggingService.getKernelLogger
val listener = this.spaceParticipantListenerFactory.create(this.defaultSpace, logger)
val ^space = new MySpaceImpl(id, listener, this.loggingService)
if (this.defaultSpace === null) { // Only useful for the default space of the default context
listener.defaultSpace = ^space;
}
this.injector.injectMembers(^space)
return ^space
}
However, if I try to use it inside an agent to instantiate the space I get a NoSuchMethodException concerning the MySpaceSpecification constructor.
I'm not sure I have fully understood the interaction between SARL and Janus.