cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to structure Business Logic

Former Member
0 Kudos

Hi Experts,

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?

Thanks,

JP

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi JP,

Whether you put some parts of your business logic in a separate project or in the same EJB module project as the CAF application services depends mainly on how much you will reuse it in other projects. If it's only to be used in this CAF EJB module, you can also keep everything therein together.

Regarding the second part of your question - in 7.1 instead of creating a J2EE Server Library you use a normal (standard) Java EE application project to bundle your library jars. More information can be found in this <a href="/people/community.user/blog/2006/10/24/applications-and-shared-libraries.

HTH!

-- Vladimir

Former Member
0 Kudos

Hi Vladimir,

Thanks for the reply. The blog helped a lot (though I had to improvise a bit as I am using Development Components instead of regular projects). I have, however, not gotten it to work just yet. When I try and run the application Service which uses my Java DC, I receive the following error:

java.lang.NoClassDefFoundError: com/test/lib/Calc

My package is com.test.lib and my class is named Calc. This seems like a reference problem to me, but I'm unsure of how to add the reference to my CAF DC. I didn't do the whole 'application-j2ee-engine' part of the blog, as that only applies to a JEE application project, whereas I'm calling the library from the CAF. What do I need to do to be able to reference that project (I didn't create a Public Part for the Enterprise Application, only for the Java DC, as I have no idea what to add to the former's Public Part)?

Also, assuming everything works, can I call portal services from this Java DC. For instance, let's say I want to have a single library which accesses the KM content, will I be able to create a Java DC which can call the required portal services?

Thanks a lot,

JP

Former Member
0 Kudos

Nevermind my first question; I managed to get it working by adding the reference to the 'ear' project. So, all I'd still like to know is whether I'd be able to use all the portal services (such as KM, user authentication, collaboration rooms) from within my Java DC project?

Vlado
Advisor
Advisor
0 Kudos

AFAIK there's nothing specific you need to declare in an EJB project, for example, in order to access a portal service (just the regular reference stuff), so it should work also the same way from a plain Java DC project.

Former Member
0 Kudos

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?

Finally, how about Web Dynpro classes (like com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser): I'm not sure if it will ever be necessary, but can they be accessed from Java DCs?

Vlado
Advisor
Advisor
0 Kudos

Hi JP,

> When you refer to "regular reference stuff" I take it

> you mean the application/library references in your

> 'application-j2ee-engine.xml' file?

Correct.

> 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

> com.sap.tc.webdynpro.services.sal.um.api.IWDClientUser

> 😞 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.

HTH!

-- Vladimir

Former Member
0 Kudos

Thanks Vladimir.

Answers (0)