cancel
Showing results for 
Search instead for 
Did you mean: 

Cycle in component usage definitions problem

Former Member
0 Kudos

Hi,

I've a problem i can't figure out. I have 3 components. 1 main, 1 utility and 1 servicelocator. The main component has a reference to both utility and servicelocator component. The utility has a reference to the servicelocator and the servicelocator to the utility. I tried to build this by letting the main component instanciate the usages for the servicelocator and utility component.


//@@begin wdDoInit()
//create component instance for webservice locator component usage
wdThis.wdGetWebserviceLocatorCompInstComponentUsage().createComponent();
wdThis.wdGetUtilityCompInstComponentUsage().createComponent();
    
//call public component interface method of used orders UI components and pass reference to the model
//component usage, so that it can enter it in referencing mode
wdThis.wdGetWebserviceLocatorCompInstInterface().referenceUtilityComponent(wdThis.wdGetUtilityCompInstComponentUsage());
wdThis.wdGetUtilityCompInstInterface().referenceWebserviceLocatorComponent(wdThis.wdGetWebserviceLocatorCompInstComponentUsage());
	

then setting the usages as references to both components. I set both the lifecycles of the referenced components to manual.

But when i rebuild the application, i get the error: Cycle in component usage definitions : for both the utility and servicelocator component.....

Can anyone tell me what i'm doing wrong?

much thanks & regards,

Hugo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Utility and service locator are in cyclic reference.. A refers B .. B refers A.. A refers B .. B refers A...

Why do u want it to be like this ? Are you passing data from both A to B and B to A ?

In this case make only one direction of reference and use external context mapping..

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/66/a5384162316532e10000000a1550b0/frameset.htm">External Context Mapping</a>

Regards

Bharathwaj

Former Member
0 Kudos

Hi,

I understand but the servicelocator makes use of some utility methods in the Utility component and the utility has some methods which make use of Servicelocator methods. Im not gonna put them in the same component because they have different responsibilities and i want to seperate them because of that. Why can't they reference eachother when i set the usages manually??

I can have a reference of class A to B and vice versa......

regards,

Hugo

Former Member
0 Kudos

Hugo,

If your concern is separation of concerns (no pun then you need to make one step further in your decomposition -- add 4th component (U-Common). Place here functionality of Utilities (U) that is required by Service Locator (SL).

This way SL refers U-Common, U refers U-Common and SL. Application component(s) refers U, U-Common and SL. Also you may re-export functionality of U-Common via U (so U just merely delegates to corresponding functions of U-Common), so Application component(s) will refer only U and SL.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Valery,

like you said...no phun

This makes me leaning towards putting the few utility methods in the resourcelocator to avoid creating another component just to re-route the calls......

I feel a little discomfort here though because of how it works. Make me wonder....

Thanks explaining though!

regards,

Hugo

Answers (0)