armin
(Armin Griebler)
January 21, 2021, 8:44am
1
Hello, I have got a question about the activator class in my new module.
Is the activator class with the code, provided in openmrs-module-basicmodule/BasicModuleActivator.java at eec759d55dfed263eadf51ac487f12e535be2787 · openmrs/openmrs-module-basicmodule · GitHub enough or is there something to add?
It seems like that the activator class is never starting. Any thoughts about that? Is this due to a version problem?
My activator class looks like in the link given below.
armin
(Armin Griebler)
January 21, 2021, 9:02am
2
And therefore, what is the difference between writing the following:
public class ABC extends BaseModuleActivator implements ModuleActivator
public class BasicModuleActivator implements Activator
Is this due to different versions?
And how to write it in the platform-module? I red that the activator class was updated in the reference-application-module but what about the platform-module?
gcliff
(CLIFF GITA)
January 21, 2021, 10:22am
3
hello @armin
Every module in openmrs must implement the interface 'org.openmrs.module.ModuleActivator' to execute some needed logic upon each module start-up.
Also the activator interface was deprecated .
You can read about it here
armin
(Armin Griebler)
January 21, 2021, 10:46am
4
Which activator interface is deprecated?
This one: Module Activator - Documentation - OpenMRS Wiki
armin
(Armin Griebler)
January 21, 2021, 10:50am
5
So you mean that in my activator class I have to write org.openmrs.module.ModuleActivator instead of import org.openmrs.module.BaseModuleActivator;
Is the BaseModuleActivator outdated or do I need both of them?
armin
(Armin Griebler)
January 21, 2021, 10:54am
7
Alright. Thanks.
And what is the difference to import org.openmrs.module.BaseModuleActivator; ?
Is the BaseModuleActivator also outdated?
gcliff
(CLIFF GITA)
January 21, 2021, 10:59am
8
you should extend BaseModuleActivator instead of directly implementing this interface for forward compatibility of subclasses.
armin
(Armin Griebler)
January 21, 2021, 11:01am
9
Yes, so now my class looks like:
public class DeviceconnectorActivator extends BaseModuleActivator
Do I have to implement org.openmrs.module.ModuleActivator in addition to that that it looks like following?
public class DeviceconnectorActivator extends BaseModuleActivator implements ModuleActivator
gcliff
(CLIFF GITA)
January 21, 2021, 11:04am
10
not really,
the BaseModuleActivator is an abstract class that implements the ModuleActivator interface and must be extended by modules and referenced by the Module-Activator property in the module manifest
gcliff
(CLIFF GITA)
January 21, 2021, 11:06am
11
just simply extend the base module activator
public class DeviceconnectorActivator extends BaseModuleActivator
armin
(Armin Griebler)
January 21, 2021, 11:14am
12
@gcliff I understand. One more question.
What do you mean by the “ModuleActivator` interface and must be extended by modules and referenced by the Module-Activator property in the module manifest”
In which file do I have to add something?
armin
(Armin Griebler)
January 21, 2021, 11:17am
13
@gcliff Does my class public class DeviceconnectorController has to extend the ModuleActivator too that it can be recognized?
gcliff
(CLIFF GITA)
January 21, 2021, 11:29am
15
i do this in your module activator class
u can have a sample look at this in the fhir module
armin
(Armin Griebler)
January 21, 2021, 11:35am
16
But here is also just the public class FhirActivator extends BaseModuleActivator class an no public interface ModuleActivator right?
gcliff
(CLIFF GITA)
January 21, 2021, 11:42am
17
yes base module activator already implements the ModuleActivator interface in the background
armin
(Armin Griebler)
January 21, 2021, 11:49am
18
Alright, got it! Thank you!
1 Like
armin
(Armin Griebler)
January 21, 2021, 11:58am
19
@gcliff I am not sure if you would have time for that. But my own created module is still not working. So the module can not be find. There is always a http 404 error code, so the module cannot be shown and I do not know what is missing.
Maybe you could take a short look into my module?
I described the problem already here: Problem with Request Mapping and Controller in new created module
But no one could give me any advice.
Thanks in advance!
dkayiwa
(Daniel Kayiwa)
January 21, 2021, 8:12pm
20
I have commented on the other thread.