Best way to structure Business Logic
I am using Web Dynpro for my front-end and application services for the back-end. Which of these is the recommended way to structure the layout of my business logic:
1) Keep everything in the 'src' folder of the CAF ejbmodule. Structure through the use of packages.
2) Create an external Java DC, keep all code in there and call the code from the application services. Structure code through both packages and the use of multiple DCs.
3) Create a child Java DC in the CAF ejbmodule project, keep the code there. Structure code through both packages and the use of multiple DCs.
4) Some other way which I do not know of???
I think that (2) is the best way to to this, but I'm not sure and I also don't know how to make the code in the Java DC accessible from the CAF in 7.1. In 7.0 one was required to assemble the Java DC into a J2EE Server Library project and then create the required dependencies. How does this work in 7.1?
Vladimir Pavlov replied
> When you refer to "regular reference stuff" I take it
> you mean the application/library references in your
> 'application-j2ee-engine.xml' file?
> Is there an easy way to discover which
> application/library to reference, for example, if I
> wanted to make use of 'com.sap.security.api.IUser'?
> It was always very difficult to find the correct DC
> containing the required classes in 7.0 (usually one
> had to use a JAR class finder). Is there an easier
> way in 7.1?
Hmm, I guess it would be a rather tough task to have a mapping between all classes (or even packages) and DCs. However it should be fairly intuitive to infer the DC from the class / package name. If still in doubt, you can search for its usage on help.sap.com - most probably you'll find the DC name as well therein.
> Finally, how about Web Dynpro classes (like
> ): I'm not sure if it will ever be necessary, but can
> they be accessed from Java DCs?
According to the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/javadocs">NW public javadocs</a>, the classes in the com.sap.tc.webdynpro.* packages are "Services in the Web Dynpro runtime environment that can be called by custom coding in Web Dynpro applications", so they're not intended for general use in any type of app.