Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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:

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!

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937

Question asked: Mar 28 '12, 4:21 p.m.

Question was seen: 5,308 times

Last updated: Mar 28 '12, 4:21 p.m.

Confirmation Cancel Confirm