Passive registration - #152
Conversation
26c9795 to
604fb09
Compare
| /** | ||
| * The name of the package.components file. | ||
| */ | ||
| private static final String COMPONENTS_FILE = "package.components"; //$NON-NLS-1$ |
There was a problem hiding this comment.
it should be .component (without s)
There was a problem hiding this comment.
Not really necessarily. Besides all the examples under libreoffice/odk/examples/DevelopersGuide/Components show it.
As a good example the file: JavaComponent.components
It appears that there can be two types of components:
- Simple components whose root of the XML document is the
<component>element. - Multiple components whose root of the XML document is the
<components>element.
I think the file extension follows this logic? At least that's what I thought.
| * {@inheritDoc} | ||
| */ | ||
| @Override | ||
| public IFile getComponentsFile() { |
|
I just tested creating a new Extension project and deploying it using a run configuration. |
|
I have not tested the creation of a new Project. I will do it. It is necessary to verify the presence and the content of the following files in the oxt extension file:
After testing, I had to clean the Eclipse plugin directory of any trace of LibreOffice and reinstall LOEclipse manually in order to be able to create a new project and for it to display the expected On the other hand, the model of the Java service that is created is not valid (it still contains the And finally when creating a project no I created issue #153 to reference this problem. |
|
If we want passive registration to be effective, we must answer the two questions posed by the issues: |
604fb09 to
894826b
Compare
|
The The
Thank you for your feedback. |
894826b to
26c2739
Compare
|
Looks good! Is this done from your POV? Will merge it then. |
|
Yes, it's done. The next logical step would be issue: #37 (comment) |
Here is a possible implementation of passive registration.
To be considered as a UNO service a Java Class must have:
com.sun.star.uno.XComponentContextas unique parameter.m_serviceNameof typeStringand having as value a literal (ie: the name of the UNO service). This field can be private, protected or public, it doesn't matter.All classes with these characteristics will be stored in the XML file
package.componentslocated at the root of the Eclipse project.This file will record the name of the implementation (ie: the full name of the class recognized as a UNO service) and the name of the UNO service (ie: the value of the
m_serviceNamefield).The
RegistrationHandler.java.tplfile has been updated and now only implements the__getComponentFactory(String implementation)method needed to create Java UNO services. For existing projects it is necessary to update this file with this RegistrationHandler.java.txt, moreover the RegistrationHandler.classes file can be deleted.Similarly, for a Python class to be considered a UNO service it must:
g_ImplementationHelperdeclared as follows:g_ImplementationHelper = unohelper.ImplementationHelper().g_ServiceNamedeclared as follows:g_ServiceName = 'com.sun.star.MyServiceName'.The use of global variable limits to one UNO service declared per Python source .py file.
As before, we will find in the
package.componentsfile the path of the Python source file as well as the name of the UNO service declared by the variableg_ServiceName.If during an update of the
package.componentsfile, for example following the modification of a UNO Java or Python service, the file does not exist then it will be created and checked if theMETA-INF/manifest.xmlfile correctly referencespackage.componentsfile.For a project using active registration, it will be necessary to save in Eclipse all Java and/or Python files declared as UNO Service in order to switch their registration to passive.
Unfortunately it will however be necessary to manually delete the old registration of these active components in the
META-INF/manifest.xmlfile. That is, lines like:If the extension's oxt file is built via Ant, it is also necessary to edit the
package.propertiesfile to include the newpackage.componentsfile located at the root of the project.