--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/4b5255eb-629a-40c9-ae75-9cecdf5618f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
FWIW, I would avoid the extra complexity. Typically, there’s not much overhead in including the needed classes in each of the dependent plugins. I prefer all my plugins to be “stand-alone” capable. For example, if several plugins require my “ContentletUtility” class, I just include a copy of ContentletUtility.java in each plugin package. If a global change is needed to that class, a simple copy-paste in eclipse will do it rather easily. Then recompile, redeploy. While typically I would tend to avoid this kind of redundancy, the benefit of easy “stand-alone” plugins outweighs my concern.
OSGI can be tricky enough without relying on external dependencies.
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CALDe1GPh%3DVa3f9AxNyfGJHvwDGtVSp%3D82_D0f00DgorED34wQA%40mail.gmail.com.
To post to this group, send email to do...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/4b5255eb-629a-40c9-ae75-9cecdf5618f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Proceed as you want. I’m just giving you my opinion based on my experience writing OSGI plugins.
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/0c7868b1-f553-45ba-b966-3d604b5135c8%40googlegroups.com.
No offense taken. Just trying to help. I have over 10 years experience with dotCMS and I wouldn’t do it that way personally.
Is what they are suggesting possible? Yes, but personally I don’t think it’s worth the headaches.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/eebe771a-57e1-4a8f-9fe7-e6b7a7cb5389%40googlegroups.com.
#2. Add the source code of the package or classes directly to each plugin. (To avoid namespace conflicts adopt the package name of the specific plugin.)
For example by class:
edu.gettysburg.nkeiter.transportation.utilities.ContentletUtility.java
edu.gettysburg.nkeiter.admissions.utilities.ContentletUtility.java
Or by package
edu.gettysburg.nkeiter.transportation.utilities.content.services
edu.gettysburg.nkeiter.admissions.utilities.content.services
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/37c6b05c-b811-43df-9f24-9429de9078ef%40googlegroups.com.
Cool. For a more concrete example, every plugin I write now uses a custom logger class if applicable:
Now depending on where it’s deployed the server names would be a little different, so it’s not the purest example, but should give the general idea. In a pure example, the source would be identical across all plugins. Unfortunately I don’t have any example code loaded on GitHub demonstrating that, but here in our private repos I have many such examples.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/623b9316-a4a6-41e0-813e-0d3b3a850419%40googlegroups.com.
Here’s another example. A copy of this class is in every plugin which runs queries against an Oracle database. It’s a helper method which parses the string value returned to a Java date object.
https://gist.github.com/nkeiter/4652d4aadddb6ce00434fc2b01174f82
Nathan I. Keiter
|
Lead Network Applications Programmer
|
Benefits Advisory Council Member
|
I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/f15ccc7c45e64149883da87c268112a0%40exch13c.ms.gettysburg.edu.
Here’s one of my personal favorites. This adds useful shortcuts to commonly used functions for any plugin which uses the contentletAPI.
So then I can just use shortcuts like ContentletUtility.checkout( contentlet );
Or ContentletUtility.findContentletByIdentifer( identifier );
https://gist.github.com/nkeiter/604d27e17c492a826079a71ba7746a05
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/34fba8d1634b4fc2b9543944f8729688%40exch13c.ms.gettysburg.edu.
If you are just putting the commonly used libraries in a jar and placing that in the /libs/ folder of the plugin, that would probably work.
/libs/CommonUtilities.jar
This would require build.gradle changes to include the libs, and preclude source code access at the plugin level.
Note: You cannot put a dotCMS plugin jar in this location. (Then you’d have a plugin inside a plugin.)
I just find it simpler to have a standard build.gradle and include the source itself. Then it’s a simple build process.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/1566fc66-47e2-4830-bf2a-59155b26a36c%40googlegroups.com.