Adding Multiple Initial Context Factories
You can add multiple initial context factories in the newly created plug-in project.
Before you begin Newly created plug-in project is displayed on the
Project Explorer pane.
- Procedure
- Double-click the
Activator.java
file from thesrc
folder of the plug-in project.Activator.java
file is opened. By default, there aregetProvider()
andgetProviders()
methods are present in theActivator.java
file. - Uncomment the
getProviders()
method. - Create another copy of the
CustomJMSProvider.java
file from thesrc
folder in the same folder. You can rename the copy file. - Double-click the newly copied file.
Newly created Java file is opened.
- In the
getInitialContextFactory()
method, remove the existing context factory and add the name of an initial context factory that is to be supported. - Open the
Activator.java
file and create an object of a newly created class. - Add the object to the AbstractJMSProvider array.
- Expand the
OSGI-INF
directory to see theCustomJMSProvider.xml
file. - Create copy of the
CustomJMSProvider.xml
file with the same name as given to the newly created copy of theCustomJMSProvider.java
file. - Double-click the newly created copy of the
CustomJMSProvider.xml
file.Newly created XML file is opened. - Replace an existing class name with the new class name in the
<implementation class>
attribute. - Expand the
MetaINF
folder to see theMANIFEST.MF
file. - Add an entry of the newly created XML file in the
service-implement
attribute in the formOSGI-INF/<class name>.xml
- Save all the open files.
Note: If you want to add more context factories, repeat the procedure.