<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>lekkimworld.comjava</title>
    <link>http://lekkimworld.com/tags/java/</link>
    <description>IBM Lotus Notes/Domino, Websphere, IBM Connections, mobile, web, JavaScript, Java...</description>
    <language>en</language>
    <copyright>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</copyright>
    <pubDate>Sat, 19 May 2012 06:50:25 GMT</pubDate>
    <dc:creator>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</dc:creator>
    <dc:date>2012-05-19T06:50:25Z</dc:date>
    <dc:language>en</dc:language>
    <dc:rights>Mikkel Flindt Heisterberg (mh [at] intravision [dot] dk</dc:rights>
    <image>
      <title>lekkimworld.comjava</title>
      <url>http://lekkimworld.com/tags/java/</url>
    </image>
    <item>
      <title>Joda Time comment</title>
      <link>http://lekkimworld.com/2012/05/11/joda_time_comment.html</link>
      <content:encoded>&lt;p&gt;
Ulrich Krause has an interesting post (&lt;a href="http://www.eknori.de/2012-05-09/joda-to-the-rescue/"&gt;Joda to the rescue&lt;/a&gt;) and I just had to comment on as I - probably to no surprise to many - work a lot with dates for the OnTime Suite. Ulrich is using the Joda Time library to compare two dates to see if they are on the same day by first stripping the time component which isn't easily possible using java.util.Date. My comment is to remember that the Java Date object is just a wrapper about a UTC long so math can do the trick. Below is my comment. 
&lt;/p&gt;
&lt;i&gt;
&lt;p&gt;
While Joda Time is a great library there is an easier way to accomplish what you are trying to do. Simply remove the time component by doing a simple modulus calculation. I am not trying to be smart about it but we do this quite a lot at OnTime :) Code could look like so:
&lt;pre&gt;
Date d = new Date();
long lngTime = d.getTime();
lngTime -= lngTime % TimeUnit.DAYS.toMillis(1);
Date dNoTime = new Date(lngTime);
&lt;/pre&gt;
The latter date object creation isn't actually necessary for the comparison. An utility function could be like so:
&lt;pre&gt;
private boolean isSameDay(Date d1, Date d2) {
  long lngTime1 = d1.getTime();
  lngTime1 -= lngTime1 % TimeUnit.DAYS.toMillis(1);

  long lngTime2 = d2.getTime();
  lngTime2 -= lngTime2 % TimeUnit.DAYS.toMillis(1);

  return lngTime1 == lngTime2;
}
&lt;/pre&gt;
Hope it helps and it helps remove the dependency on Joda Time if that's all you're using it for. 
&lt;/p&gt;
&lt;/i&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <pubDate>Fri, 11 May 2012 06:14:09 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2012-05-11:default/1336716849393</guid>
      <dc:date>2012-05-11T06:14:09Z</dc:date>
    </item>
    <item>
      <title>Authenticating a web service request</title>
      <link>http://lekkimworld.com/2012/04/10/authenticating_a_web_service_request.html</link>
      <content:encoded>&lt;p&gt;
In my current project I needed to place an authenticated web services request from Lotus Domino to an Oracle SOA endpoint. Turned out to be extremely easy using the Lotus Domino web services consumer feature as I just used the setCredentials(String, String) method which then adds the necessary Authorization header to the HTTP call. Below is an example.
&lt;pre&gt;
MyEchoServiceLocator l = new MyEchoServiceLocator();
MyEcho u = l.getDomino();
u.setCredentials("Domino Admin", "password");
String result = u.echo("HelloWorld");
System.out.println("Result: " + result);
&lt;/pre&gt;
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/domino/">domino</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/lotus/">lotus</category>
      <category domain="http://lekkimworld.com/tags/web_services/">web_services</category>
      <category domain="http://lekkimworld.com/tags/ws/">ws</category>
      <pubDate>Tue, 10 Apr 2012 13:08:50 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2012-04-10:default/1334063330925</guid>
      <dc:date>2012-04-10T13:08:50Z</dc:date>
    </item>
    <item>
      <title>The Java native2ascii tool (also important for you XPages geeks)</title>
      <link>http://lekkimworld.com/2012/03/21/the_java_native2ascii_tool_also_important_for_you_xpages_geeks.html</link>
      <content:encoded>&lt;p&gt;
To prepare for our upcoming trip to Tokyo I've been working on a Japanese translation of our OnTime Group Calendar 2011 client for Notes based on Java plugins. The internationalization engine (i18n) was already in place so it was merely a matter of doing the translation (thanks to Google Translate and friends) and then adding language files to our API. In that process one becomes very thankful of UTF-8 and the fact that Java works natively in UTF-8. 
&lt;/p&gt;
&lt;p&gt;
Please note that the approach discussed in this post translates (excuse the pun) directly to making translation files for XPages as well.
&lt;/p&gt;
&lt;p&gt;
Using the Japanese translation the GUI looks like the below screen shot (cropped of course).
&lt;/p&gt;
&lt;p align="center"&gt;
&lt;a href="http://lekkimworld.com/images/ontime/notes2011/2.0.0/notes2011japanese_gui_large.jpg" target="_new"&gt;&lt;img src="http://lekkimworld.com/images/ontime/notes2011/2.0.0/notes2011japanese_gui.jpg" border="0" /&gt;&lt;/a&gt;
&lt;br/&gt;
(click the image for a large version)
&lt;/p&gt;
&lt;p&gt;
The funny thing about most non-Latin languages is that even though you have the translations it's hard to impossible to write the characters yourself. And once you have the words getting them into the language files which are mere property files. Take the weekdays in Japanese as an example:
&lt;br/&gt;
&amp;#26376;&amp;#26332;&amp;#26085;&lt;br/&gt;
&amp;#28779;&amp;#26332;&amp;#26085;&lt;br/&gt;
&amp;#27700;&amp;#26332;&amp;#26085;&lt;br/&gt;
&amp;#26408;&amp;#26332;&amp;#26085;&lt;br/&gt;
&amp;#37329;&amp;#26332;&amp;#26085;&lt;br/&gt;
&amp;#22303;&amp;#26332;&amp;#26085;&lt;br/&gt;
&amp;#26085;&amp;#26332;&amp;#26085;
&lt;/p&gt;
&lt;p&gt;
Because we're running the OnTime Group Calendar out of Notes and because Notes is fully double-byte compatible we could actually just add the Japanese characters directly to the translation document. Instead however we opted to use the Java way that is the native2ascii tool.
&lt;/p&gt;
&lt;p&gt;
The native2ascii tool is shipped with the JDK and lets you translate a file containing native characters to their UTF-8 equivalent escape sequences. So having my Japanese characters in japanese_source.txt and wanting to store the result in japanese_result.txt I simply ran the following command:
&lt;pre&gt;
native2ascii -encoding japanese_source.txt japanese_result.txt
&lt;/pre&gt;
The encoding parameter specifies the character encoding of the source file (here japanese_source.txt). The result is something like this:
&lt;br /&gt;
\u6708\u66dc\u65e5&lt;br/&gt;
\u706b\u66dc\u65e5&lt;br/&gt;
\u6c34\u66dc\u65e5&lt;br/&gt;
\u6728\u66dc\u65e5&lt;br/&gt;
\u91d1\u66dc\u65e5&lt;br/&gt;
\u571f\u66dc\u65e5&lt;br/&gt;
\u65e5\u66dc\u65e5
&lt;/p&gt;
&lt;p&gt;
Chose escape sequences go directly into the language property file and when read into a Java property file they are automatically translated into Japanese. Sweet!
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/notes2011/">notes2011</category>
      <category domain="http://lekkimworld.com/tags/ontime/">ontime</category>
      <category domain="http://lekkimworld.com/tags/xpages/">xpages</category>
      <pubDate>Wed, 21 Mar 2012 07:59:25 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2012-03-21:default/1332316765046</guid>
      <dc:date>2012-03-21T07:59:25Z</dc:date>
    </item>
    <item>
      <title>SOAP Headers in Lotus Domino web service consumers and providers</title>
      <link>http://lekkimworld.com/2012/02/08/soap_headers_in_lotus_domino_web_service_consumers_and_providers.html</link>
      <content:encoded>&lt;p&gt;
In a current project we're using the web service consumer and web server provider capability of Lotus Domino quite heavily. During the development the need to process the SOAP request headers which are provided in a section above the SOAP body. Problem is that these are not exposed through the proxy classes generated for you when you import the WSDL. Searching Google I came across the blog of Elena Neroslavskaya and more importantly the post that &lt;a href="http://enerosweb.wordpress.com/2010/07/28/lotusdomino-8-5-webservice-provider-manipulating-soap-header/"&gt;helped me out&lt;/a&gt;. Using the MessageContext class described in that blog post helped me crack the nut and now I can both iterate through the SOAP headers sent to me in the request and send SOAP headers back in the response. Sweet!
&lt;/p&gt;
&lt;p&gt;
Below are two code snippets - one for iterating through request headers and one for sending headers back. Home it may help someone out there.
&lt;/p&gt;
&lt;h3&gt;Iterate received headers&lt;/h3&gt;
&lt;pre class="prettyprint"&gt;
private void recurseHeaders(Iterator ite) { 
  while (ite.hasNext()) { 
    MessageElement elem = (MessageElement)ite.next(); 
    String nsUri = elem.getNamespaceURI(); 
    String name = elem.getName(); 
    String value = elem.getValue();
    System.out.println("SOAP Header - ns &lt;" + 
      nsUri + "&gt;, name &lt;" + name + "&gt;, value &lt;" + 
      value + "&gt;"); 
    this.recurseHeaders(elem.getChildElements()); 
  } 
} 

public com.example.FooResponseType foo(
  com.example.FooRequestType req) throws Exception { 
  
  MessageContext mc = MessageContext.getCurrentContext(); 
  SOAPEnvelope envelope = mc.getRequestMessage()
    .getSOAPEnvelope(); 
  this.recurseHeaders(
    envelope.getHeader().getChildElements()); 
}
&lt;/pre&gt;
&lt;h3&gt;Send back headers&lt;/h3&gt;
&lt;pre class="prettyprint"&gt;
import lotus.domino.axis.message.SOAPHeaderElement;
import lotus.domino.axis.message.MessageElement;

MessageElement elemGuid = 
  new MessageElement("http://lekkimworld.com", "Guid"); 
elemGuid.addTextNode("GuidXYZ"); 

MessageElement elemUser = 
  new MessageElement("http://lekkimworld.com", "User"); 
elemUser.addTextNode("UserXYZ"); 

SOAPHeaderElement elemHeader = 
  new SOAPHeaderElement("http://lekkimworld.com", "TopElem"); 
elemHeader.addChild(elemGuid); 
elemHeader.addChild(elemUser); 

mc.getResponseMessage()
  .getSOAPEnvelope().addHeader(elemHeader); 
&lt;/pre&gt;
&lt;link href="http://lekkimworld.com/files/prettyprint/prettify.css" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="http://lekkimworld.com/files/prettyprint/prettify.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
prettyPrint();
&lt;/script&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/webservices/">webservices</category>
      <category domain="http://lekkimworld.com/tags/wsdl/">wsdl</category>
      <pubDate>Wed, 08 Feb 2012 14:41:06 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2012-02-08:default/1328712066968</guid>
      <dc:date>2012-02-08T14:41:06Z</dc:date>
    </item>
    <item>
      <title>Show 'n Tell Thursday: Maximizing tabs in DDE (20 October 2011)</title>
      <link>http://lekkimworld.com/2011/10/20/show_n_tell_thursday_maximizing_tabs_in_dde_20_october_2011.html</link>
      <content:encoded>&lt;p&gt;
&lt;img src="http://lekkimworld.com/images/domino/show-n-tell/showandtellthursdays_small.jpg" style="float: right; margin: -10px 0 10px 10px;" /&gt;
It has been a looooooooooooooooong time since I did a SnTT but I found it fitting for this week. The tip is short and very straight forward but will make it easier and more productive for you to work in Domino Designer on Eclipse (DDE). 
&lt;/p&gt;
&lt;p&gt;
If you are like me like the navigator in DDE is on the left, and the outline/controls/data views are on the right. You realize that you do not have much space left for code in the center editor. Bummer! :-( To help remedy that you may either minimize or close the views on the right but that really isn't ideal as it takes time and some times you need the views e.g. for XPages work. As an alternative you could figure out which views you use for what tasks and create custom perspectives in DDE for those tasks which isn't for the Eclipse-superuser. You could also choose the easy solution - simply maximize the editor.
&lt;/p&gt;
&lt;p&gt;
Maximizing the editor is easy. You simply double-click the tab or press Ctrl-M to make the editor go fullscreen. When done you simply double-click the tab again or press Ctrl-M to return it to being "in the middle". Easy and quick.
&lt;/p&gt;
&lt;p&gt;
Hope it works as nicely for you as it does for me.
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/categories/java/">Java</category>
      <category domain="http://lekkimworld.com/categories/sntt/">SnTT</category>
      <category domain="http://lekkimworld.com/tags/dde/">dde</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/show-n-tellthursday/">show-n-tellthursday</category>
      <category domain="http://lekkimworld.com/tags/sntt/">sntt</category>
      <pubDate>Thu, 20 Oct 2011 07:24:20 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2011-10-20:default/1319095460375</guid>
      <dc:date>2011-10-20T07:24:20Z</dc:date>
    </item>
    <item>
      <title>Configure Eclipse 3.5 for Notes 8.5.3</title>
      <link>http://lekkimworld.com/2011/10/08/configure_eclipse_3_5_for_notes_8_5_3.html</link>
      <content:encoded>&lt;p&gt;
For completeness sake I just updated my guide to manually configuring Eclipse 3.5 for Notes plugin development to work with Notes 8.5.3 which went Gold the other day. Please find a like to the guide below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://lekkimworld.com/pages/eclipse35_notes853.html"&gt;Configuring Eclipse 3.5 for Notes 8.5.3&lt;/a&gt;.
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/eclipse/">eclipse</category>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/notes8/">notes8</category>
      <category domain="http://lekkimworld.com/tags/notes85/">notes85</category>
      <category domain="http://lekkimworld.com/tags/notes853/">notes853</category>
      <pubDate>Sat, 08 Oct 2011 09:33:14 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2011-10-08:default/1318066394078</guid>
      <dc:date>2011-10-08T09:33:14Z</dc:date>
    </item>
    <item>
      <title>OSGi, OSGi, OSGi - OSGi everywhere...</title>
      <link>http://lekkimworld.com/2011/09/05/osgi_osgi_osgi_osgi_everywhere.html</link>
      <content:encoded>&lt;p&gt;
As mentioned in my OSGi presentation at &lt;a href="http://www.auslug.org"&gt;AusLUG&lt;/a&gt; OSGi is a key technology for you if you dabble in IBM/Lotus products. Among other things it forms the basis for Lotus Expeditor (and therefore Notes, Sametime and Symphony), XPages and the XPages Extensibility Library. OSGi is now also part of Java application servers such as Websphere Application and the free and open source JBoss AS 7. The &lt;a href="http://vimeo.com/27155228"&gt;JBoss AS7 OSGi Full Presentation + Demo&lt;/a&gt; highlights OSGi in JBoss and has a nice introduction to OSGi. Highly recommended.
&lt;/p&gt;
&lt;p&gt;
&lt;i&gt;"JBoss AS7 (jboss.org/&amp;#8203;as7) is a game-changer for both Java EE developers as well as application server administrators. And while JBoss is best known for being a Java EE container, in this session, we will focus on the OSGi capabilities of the new JBoss AS7. Starting with background information on OSGi in general, Thomas Diesler introduces the main objectives of this technology and explains the unique JBoss OSGi vision. Combining the best of two worlds we show how modern Java EE applications on AS7 can use the OSGi component model and vice versa."&lt;/i&gt;
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <category domain="http://lekkimworld.com/tags/osgi/">osgi</category>
      <pubDate>Mon, 05 Sep 2011 10:43:30 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2011-09-05:default/1315219410703</guid>
      <dc:date>2011-09-05T10:43:30Z</dc:date>
    </item>
    <item>
      <title>Java Magazine - available for FREE!</title>
      <link>http://lekkimworld.com/2011/08/22/java_magazine_available_for_free.html</link>
      <content:encoded>&lt;p&gt;
The premiere issue of the &lt;a href="http://www.oracle.com/technetwork/java/javamagazine/index.html"&gt;Java Magazine&lt;/a&gt; from Oracle is now available. The magazine is FREE!!! and contains a load of cool interesting articles. 
&lt;/p&gt;
&lt;p align="center"&gt;
&lt;img src="http://www.oracle.com/ocom/groups/public/@otn/documents/digitalasset/454681.jpg" /&gt;
&lt;/p&gt;</content:encoded>
      <category domain="http://lekkimworld.com/tags/java/">java</category>
      <pubDate>Mon, 22 Aug 2011 08:33:54 GMT</pubDate>
      <guid isPermaLink="false">tag:lekkimworld.com,2011-08-22:default/1314002034046</guid>
      <dc:date>2011-08-22T08:33:54Z</dc:date>
    </item>
  </channel>
</rss>


