I will be attending my first Lotusphere this year. It was quite a surprise because our development team hasn’t sent anyone for over four years.
My manager has approved of the sessions that I signed up for but we agreed on a “hidden agenda.” There are a couple of things I want to try and learn how to do while I’m at Lotusphere. I’m hoping I can find other developers/administrators who have solved the same problems or a third-party vendor who can help.
Here are the issues I will be looking to solve:
- Get CoreID working with the Domino 8 web servers
- Find a better way to do TIBCO integration with Domino. We currently are using ASP.NET dll’s on our server to do TIBCO integration
- Learn more about peoples experience with mixed (Domino 8 servers and Domino 6.5 clients) environments
I have finished the “Hello World!” of connecting to Amazon S3 with LotusScript. I have basically completed a “ListAllMyBuckets” call.
I wish I could post all of my code but I’m still waiting to hear back from Julian Robichaux. I can always try and find him at Lotusphere.
The ListMyBuckets Agent:
Function FormatDateToISO8601(aDate As NotesDateTime) As String
' Thanks to Joel Litton http://www.joelitton.net/A559B2/home.nsf/d6plinks/JLIN-5UU4B2
Dim dtLocal As NotesDateTime
Dim dtGMT As NotesDateTime
Set dtGMT = New NotesDateTime( Left$(aDate.GMTTime, 22) )
FormatDateToISO8601= Format$(dtGMT.LSLocalTime, "yyyy-mm-ddThh:nn:ss.000Z")
End Function
Sub Initialize
Const mysecretkey = PUT YOUR SECRET KEY HERE
Const myAccessKey = PUT YOUR ACCESS KEY HERE
Dim myS3 As New AmazonS3_n3()
Dim mydate As New XSD_DATETIME
Dim mykey As New XSD_STRING
Dim mysig As New XSD_STRING
Dim dateTime As New NotesDateTime( "" )
Dim hmacbuilder As String
Dim formattedDate As String
Call dateTime.SetNow
Dim mybuckets As ListAllMyBucketsResult_n3
formattedDate = FormatDateToISO8601(dateTime)
Call mydate.setValueFromString(formattedDate)
Call mykey.setValueFromString(myaccesskey)
HMACBuilder = "AmazonS3ListAllMyBuckets" + formattedDate
Call mysig.setValueFromString(HMAC_SHA1_B64(mysecretkey,HMACBuilder))
Set mybuckets = myS3.ListAllMyBuckets(mykey,mydate,mysig)
End Sub
You basically send Amazon three things in the web service. Your Access Key, the date, and then a signature which is a HMAC_SHA1 encoded concatenation of “AmazonS3″ + the function you’re running + the date.
I had to tweak Joel Litton’s ISO8601 date a bit to add extra zeros for precision.
The hardest code part was the HMAC_SHA1 encoding. I found HMAC code and I found SHA1 but combining the two seemed to be harder than I thought. Paul Johnston’s Javascript code made the most sense to me so I ported a lot of his code to LotusScript. I used a fair chunk of Julian Robichaux’s SHA1 script also (hence the need to get Julian’s permission to post). I spent a lot of time shifting bits and worrying about signed and unsigned operations.
In the end… Amazon likes my scripts because it actually returns something. I am slightly worried about these Web Services in Domino 8. When my scripts were wrong and a fault was returned. I expected the fault codes to populate correctly in the object and they were not. I’m not sure who’s fault that is. We’ll keep experimenting.
What’s next? I want to use Amazon to store files straight from Domino and I would love to load files (images?) from S3 on the fly.
Creating ICS (iCalendar) files can be handy especially in environments where Lotus Notes is not the main email/scheduling system. There are many ways to create the ICS file but it has to maintain this format. Ellie Harmon wrote a sample and description of the format here.
BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:MAILTO:
DTSTART:
DTEND:
LOCATION:
TRANSP:OPAQUE
SEQUENCE:0
UID:
DTSTAMP:
DESCRIPTION:
SUMMARY:
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASS:PUBLIC
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
DESCRIPTION:Reminder
END:VALARM
END:VEVENT
END:VCALENDAR
The one trick with Lotus Notes is the date formats. Use this script to format your dates:
Call parentDoc.AppendItemValue( "icsStartDate", Format(item.DateTimeValue.LSGMTTime, "yyyymmdd\Thhmmss\Z"))
If you don’t need a time, replace “hhmmss” with “000000.”"
In once scenario… I allowed users to download an ICS based on a document they were viewing on the web. If you want to try that… print this code as the first line of your agent:
Print |Content-Type:text/calendar| &Chr(13) & Chr(10)|
I’m sure this is a re-run for most but to me it is something entirely new. The [unfinished] LotusScript Book By Julian Robichaux. I’ve used it a lot lately with my conversion of the HMAC_SHA1 script.
Julian’s book is great and I probably would have purchased it back in 2002 but I think it’s lacking two major concepts. It’s missing a section on Web Development and it needed probably 2-3 chapters on Object-Oriented Development. If (five years ago) we (the Notes developers) took Object-Oriented Development seriously maybe Lotus would have given us a stronger IDE. It wasn’t until August 2007 that Jake (Codestore) started speaking about the benefits of OO.
I will admit that I didn’t start utilizing OO until it was necessary. My friend and I worked in a hostile environment of dreadfully small estimates and too much project management. Code reuse was a necessity not a “nice to have.”
Is it worth finishing the book now? I don’t think so. I’ve seen too many of my friends leave to join .Net teams and there seriously are not that many developers left. I could be wrong… and maybe I will find this out at Lotusphere (my first time attending) this year.
I hope I’m wrong.
Why is it that almost all of my Lotus Notes developer/friends have converted to .Net developers instead of Java developers?
I open up 2008 with a bit of the flu. My kid complained that his stomach (I almost said tummy) hurt when I put him to bed… we’ll see how tonight goes.
Anyway… I think I found the last (I hope) stumbling block to my Amazon S3 problem. I was sending a hex’ed signature instead of a base64 signature. When you spend so much time on one part of the process you forget the some of the details.
I found Julian Robichaux’s Base64 conversion but I need to send an array. I’ll probably convert Paj’s function when I feel a little better.