<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lotushints &#187; Java</title>
	<atom:link href="http://www.lotushints.com/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lotushints.com</link>
	<description>Lotus Notes tips &#38; tricks you always hoped you will not need</description>
	<lastBuildDate>Thu, 29 Dec 2011 09:47:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Are Notes really built for Java?</title>
		<link>http://www.lotushints.com/2009/08/are-notes-really-built-for-java/</link>
		<comments>http://www.lotushints.com/2009/08/are-notes-really-built-for-java/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 06:00:36 +0000</pubDate>
		<dc:creator>Vladimir Kocjancic</dc:creator>
				<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Upgrades]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.lotushints.com/?p=419</guid>
		<description><![CDATA[This is what I came to ask myself constantly this past few months. Lately, I&#8217;ve been noticing that vast majority of all erra on server is due to some java library error. For example, we experience an annoying issue, when at certain point, Notes decide that some Crypto library is missing and doesn&#8217;t load up [...]]]></description>
			<content:encoded><![CDATA[<p>This is what I came to ask myself constantly this past few months. Lately, I&#8217;ve been noticing that vast majority of all erra on server is due to some java library error. For example, we experience an annoying issue, when at certain point, Notes decide that some Crypto library is missing and doesn&#8217;t load up successfully. Not until you restart the server that is. IBMs suggestion was to reinstall the server, as apparently corresponding jar file got corrupted somewhere during upgrade (WTF?!). All fine and well, but this is a production server. A server that hosts thousand users daily. A server that quite frankly has no other issue but this one. There is definitely not going to be any reinstall taking place in near future.</p>
<p>Are Notes really built for Java? Because at this point it certainly fails to look so.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lotushints.com/2009/08/are-notes-really-built-for-java/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Java classes from LotusScript</title>
		<link>http://www.lotushints.com/2009/02/calling-java-classes-from-lotusscript/</link>
		<comments>http://www.lotushints.com/2009/02/calling-java-classes-from-lotusscript/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 08:00:19 +0000</pubDate>
		<dc:creator>Vladimir Kocjancic</dc:creator>
				<category><![CDATA[Best practices]]></category>
		<category><![CDATA[Code optimization]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Object-oriented development]]></category>
		<category><![CDATA[adapter]]></category>
		<category><![CDATA[custom classes]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[LotusScript]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[object-oriented]]></category>
		<category><![CDATA[user registration]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.lotushints.com/?p=210</guid>
		<description><![CDATA[Have you ever wondered how you could call already written and quite useful Java classes in your LotusScript code? To me, this moment was, when I was trying to implement other department&#8217;s code into my own. Unfortunately I wasn&#8217;t skilled enough in ways of object development, LS2J  and googling back then to actually figure out [...]]]></description>
			<content:encoded><![CDATA[<p><span>Have you ever wondered how you could call already written and quite useful Java classes in your <span>LotusScript</span> code? To me, this moment was, when I was trying to implement other department&#8217;s code into my own. Unfortunately I wasn&#8217;t skilled enough in ways of object development, LS2J  and googling back then to actually figure out that was possible. I remember thinking: &#8220;IBM implemented Java in Lotus Notes, they must have done some adaptor for it.&#8221;, but was unable to figure it out. Until couple of years back, when I got a </span><a href="http://www.randsinrepose.com/archives/2002/07/10/the_dark_underbelly_of_holy_shit.html">Holy shit!</a> moment, finding <a href="http://www.nsftools.com/blog/blog-11-2004#11-19-04">this blog post</a>.</p>
<p><span id="more-210"></span><strong>But why would I need that?</strong></p>
<p><span>As you can see from the above examples, you can implement Java functionality to your <span>LotusScript</span> code. This can be good if your Java programming skills aren&#8217;t that great or you already have some code in <span>LotusScript</span> and you wish to add functionality. For me, it would do fine in cases where I converted documents in a database to PDF on user request, or when I needed an agent to <span>login</span> user to notes via web in the background, or as I mentioned, when I needed to implement some functionality from other department in my already existing code. Instead, I re-wrote several agents into Java, which in the end didn&#8217;t prove to be that bad of a decision, but about that some other day.</span></p>
<p><strong>But how do I do that?</strong></p>
<p>There is a functionality called <strong>LS2J </strong><span>that does exactly that for you. If you will, you can imagine it as an adaptor for <span>LotusScript</span> that allows you to call Java classes. I will give you a small example. It is based on my user <span>login</span> class, although, there is really no code there to log in the user.</span></p>
<p><span>First you need to create/obtain a java library that does what you want. I named that library <span>jclass</span>:<span>UserLogin</span>.</span></p>
<pre><span>public class CUserLogin {
   String m_strUsername;
   String m_strPassword;

   public void Initialize(String strUsername, String strPassword) {
      if ((strUsername.length() == 0) ||
          (strPassword.length() == 0))
         return;

      m_strUsername = strUsername;
      m_strPassword = strPassword;
   }

   public boolean run() {
      // add code that will perform auto-login
      return true;
   }
}</span></pre>
<p><span>Then, I strongly suggest you create a <span>LotusScript</span> library, containing a class that will do actual Java to <span>LotusScript</span> conversion. Why? So you have to do it only once.</span><br />
My script library called class:UserLogin is depicted below.</p>
<pre><span><span>Uselsx</span> "*<span>javacon</span>"</span>
<span>Use "<span>jclass</span>:<span>UserLogin</span>"</span>

<span>Class <span>CUserLogin</span></span>
<span>	<span>loginObj</span> As <span>JavaObject</span></span>

<span>	Sub New (<span>strUsername</span> As String, <span>strPassword</span> As String)</span>
		Dim js As New JAVASESSION
<span>		Dim <span>loginClass</span> As JAVACLASS</span>

<span>		Set <span>loginClass</span> = <span>js</span>.<span>GetClass</span> ("<span>CUserLogin</span>")</span>
<span>		Set <span>loginObj</span> = <span>loginClass</span>.<span>CreateObject</span> ()</span>

<span>		Call <span>loginObj</span>.Initialize (<span>strUsername</span>, <span>strPassword</span>)</span>
	End Sub

	Function run() As Boolean
<span>		run = <span>loginObj</span>.run()</span>
	End Function
End Class</pre>
<p><span>And that is it. Now all you have to do, is use this script library in your code. Where you need it. I created a simple agent that will pop-up a window with text depicting <span>login</span> success.</span></p>
<pre><span>Use "class:<span>UserLogin</span>"</span>

Sub Initialize
<span>	Dim <span>userLogin</span> As <span>CUserLogin</span></span>

<span>	Set <span>userLogin</span> = New <span>CUserLogin</span> ("test", "test123")</span>
	If (userLogin.run()) Then
<span>		<span>Messagebox</span> "<span>Login</span> succeeded"</span>
	Else
<span>		<span>Messagebox</span> "<span>Login</span> failed!"</span>
	End If
End Sub</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lotushints.com/2009/02/calling-java-classes-from-lotusscript/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Web Services on ND8 vs ND7</title>
		<link>http://www.lotushints.com/2009/01/web-services-on-nd8-vs-nd7/</link>
		<comments>http://www.lotushints.com/2009/01/web-services-on-nd8-vs-nd7/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 08:00:21 +0000</pubDate>
		<dc:creator>Vladimir Kocjancic</dc:creator>
				<category><![CDATA[Lotus Domino]]></category>
		<category><![CDATA[Lotus Notes]]></category>
		<category><![CDATA[Object-oriented development]]></category>
		<category><![CDATA[Upgrades]]></category>
		<category><![CDATA[Web services]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[LotusScript]]></category>

		<guid isPermaLink="false">http://www.lotushints.com/?p=160</guid>
		<description><![CDATA[One would think, creating and running web services on ND8 should not be incompatible with ND7 process. Wrong. There are a few quite important differences when creating web services on ND8 instead of ND7. You can now create clients. The one we&#8217;ve all been waiting for since ND7 came out. Web services created/built on ND8 [...]]]></description>
			<content:encoded><![CDATA[<p>One would think, creating and running web services on ND8 should not be incompatible with ND7 process. Wrong. There are a few quite important differences when creating web services on ND8 instead of ND7.</p>
<ol>
<li>You can now create clients. The one we&#8217;ve all been waiting for since ND7 came out.</li>
<li>Web services created/built on ND8 don&#8217;t work on ND7 anymore! So, keep in mind that if you are running web services on ND7, you shouldn&#8217;t upgrade your designer to release 8 just yet.</li>
<li>You can now use Java libraries when creating web services in Java. You couldn&#8217;t in ND7.</li>
<li>You can now have port class defined in a script library when creating web services using LotusScript. This was not possible in ND7.</li>
<li>You can now return empty array. if you wanted to do this in ND7, you had to create a class, containing an array and then return object of that class.</li>
<li>More SOAP error handling elements.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.lotushints.com/2009/01/web-services-on-nd8-vs-nd7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

