AbstractService getService() calling scope
Hi,
i have a few operation Participants (server side) and for reasons like maintenance and easy learning (for me and others developers) i'm trying to create global layers (i.e SCMUtils, WIUtils).
So, when i try to split those operations through diferent classes i found a problem that stopped whole work...
Today my code looks like this:
The first thing i try to do was declaring "IRepositoryItemService itemService" as an instance variable just to avoid redeclaring inside methods...
This second scenario doesn't work, and the "Check <prerequisites> in plugin.xml" error appears, but my plugin.xml have all the prerequisites because the first code works.. it seems that for architectural/performance reasons, the services i need are only avaiable when the run() method is called.. not at class instantiation..
I would like to know if anyone has a suggestion/solution for this problem, such as a plugin configuration (dependencies, etc..)
tks all!
i have a few operation Participants (server side) and for reasons like maintenance and easy learning (for me and others developers) i'm trying to create global layers (i.e SCMUtils, WIUtils).
So, when i try to split those operations through diferent classes i found a problem that stopped whole work...
Today my code looks like this:
public class DefaultFolderStructureParticipant extends AbstractService implements IOperationParticipant {
public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
itemService.doSomething()...
}
public void checkSomething() {
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
itemService.doSomethingElse()...
}
}
..............
The first thing i try to do was declaring "IRepositoryItemService itemService" as an instance variable just to avoid redeclaring inside methods...
public class DefaultFolderStructureParticipant extends AbstractService implements IOperationParticipant {
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
itemService.doSomething()...
}
public void checkSomething() {
itemService.doSomethingElse()...
}
}
This second scenario doesn't work, and the "Check <prerequisites> in plugin.xml" error appears, but my plugin.xml have all the prerequisites because the first code works.. it seems that for architectural/performance reasons, the services i need are only avaiable when the run() method is called.. not at class instantiation..
I would like to know if anyone has a suggestion/solution for this problem, such as a plugin configuration (dependencies, etc..)
tks all!