import ext lib class to my schedule java agent - xpages

Is it possible to import com.ibm.xsp.extlib.util.ExtLibUtil.* class to my schedule java agent?
Thank you
leon

Yes, this is possible. Just unpack the updateSite ZIP file and import the JARs in the agent.
I don't know what you are trying to do, maybe this is going in the wrong direction (the most functionality uses the "XPages classes" etc).
Have a look here for a better idea:
Is it possible to use Java classes from the WEB-INF directory in Java agents

Related

Where to put custom java file of hazelcast custom mapstore implementation

I have implemented a custom MaStore for hazelcast. But I have no idea where to put this .java file ,so that hazelcast will build it and pick it.
Any help in this is appreciated.
Please see the sample here, see how the PersonMapStore class is located inside project hierarchy and it's mentioned in the configuration file.

SAP Cloud Platform Integration add dependencies

I need to use the #Grab in a Groovy script in SAP Cloud Platform Integration and it gives an error ClassNotFoundException: org.apache.ivy.core.report.ResolveReport .
Is there a way I can add this kind of dependency or can I load a jar on CPI in another way?
old thread, but basically you download the .jar (just google it) and upload it in the SAP CPI process. Just add it under Resources for the flow as an archive.
Then you just import it like all other libaries.
For example you can download Apache Commons Text 1.9 here:
https://commons.apache.org/proper/commons-text/download_text.cgi
(get the zip, extract the .jar, upload it in SAP CPI resource).
Then in your groovy script, just leave out the #grab and only do the import - for example:
import org.apache.commons.text.StringEscapeUtils;
That means you don't have ivy-XXX.jar in the classpath.
This library included into full groovy package, but it's not in the groovy-all-XXX.jar that is mainly used for groovy-enabled applications.
Just take ivy-XXX.jar from groovy package or download from maven central and put into classpath of your application/server.
hopefully, it will work

P4Connection class is unavailable in P4api.net

I am trying to use P4Connection class and the problem is that I could not find that class in the p4api.net library that I have downloaded recently.
Currently I am working with the use of Repository class which is not going well without the use of P4Connection class. And so, I need someone to assist me to proceed.
Thanks in advance.

Is it possible to use Java classes from the WEB-INF directory in Java agents

Currently I am busy with a brand new XPages project. I use Java and Managed Beans to access the data.
Till now I don't have to use Lotusscript ;-)
One of the last things is to create a scheduled agent to perform some backend stuff. There is already some logic in Java classes, who are in a directory in the WEB-INF directory.
I son't want rewrite these Java logic to Lotusscript, but reuse.
Is is possible to access these Java classes, from a (scheduled) Java agent??
Assuming that the WEB-INF directory that you are talking about is inside the NSF the answer is going to be NO.
Java Agents in Lotus Domino are self contained and can't see that part of the NSF. You could package those particular classes into a jar file and then attach the jar to the java agent or just copy the classes directly to the java agent. Either way you will have to maintain two sets of code.
Maybe another option for you. I'll post on Monday sample code how to use Eclipse jobs on Domino triggered from XPages. These jobs can run on behalf of the current user. The Eclipse jobs framework also allows scheduling them.
Both XPages and your Eclipse jobs run in the http process and you can access the jobs from your XPages. In other words jobs can use the same code in the WEB-INF directory.
Teaser: http://www.youtube.com/watch?v=uYgCfp1Bw8Q
Update: Posted the sample here http://www.openntf.org/Internal/home.nsf/blogEntry.xsp?permaLink=NHEF-8SJB2R
Yes, if the WEB-INF/classes is on the classpath when the java agent executes. The other way to do it would be to put the classes in there own jar, and distribute the jar with the webapp and the java agent code.

Java ME bundle Microlog jars with my midlet jar

I'm pretty new to Java ME and i'm trying to use Microlog to handle logging in my midlet.
In eclipse i can reference Microlog jars and it's all good in dev time,
but when i try to launch the application the jars aren't found on the device.
How can i bundle those referenced libs into my midlet?
Someone have any experience with using Microlog in a midlet?
Thanks.
The classes are not found, because they are not inside the final MIDlet suite you are trying to run run in the device. In fact, you can't add external jars directly inside your midlet jar file as J2ME class loader is much more simple than the one in desktop Java. It only loads the classes found inside the midlet jar.
So, you have to extract everything from the Microlog jar and put them into you midlet jar just like you put your own classes and other resources. Probably you can configure your build tool to do this automatically for you.
Eclipse is able to find the classes because you have added the jar into your project's classpath.
Just a little addition. If you are using Eclipse to export the midlet you are able to generate the jar-file including all the classes of the dependencies for you.
Select "Java Build Path" of your project and then "Order and Export". Make sure the microlog jar-files are checked in that list. This will bundle everything into one jar-file.
Hope this helps.
I would recommend to use ProGuard to reduce the size of the final jar. Please read this article to figure out how to do it with Microlog:
http://myossdevblog.blogspot.com/2009/06/using-proguard-to-shrink-microlog.html

Resources