Is OSGi something for us?

October 24, 2006 | In Java | No Comments

Our software is a Java web application. Administrators can upload XML files containing descriptions of user interfaces and logic. The XML describes something like small applications executed in a runtime environment that is the web application.

When the XML files get executed (by a user selecting a certain “sub application”) the runtime will instantiate the needed Java objects and load different kinds of templates and resources. They will mostly use code from the runtime, but sometimes an XML file calls for custom code, that needs to be provided separately. Ideally the administrators should be able to supply additional jar files containing logic and resources, without the need to restart the web application.

We let users outside of our organization develop extension and reference those from their XML files. Sometimes extensions has dependencies on third party libraries. We sometimes end up with a situation where two extensions require different versions of a dependecy. “Jar hell”.

An analogy would be a set of Excel workbooks requiring different DLL:s.

Will OSGi apply to our situation? Will we be able to add new classes and resources to a running application? Will we be able to handle conflicting dependencies?

Axis and .NET

October 23, 2006 | In Java | 1 Comment

I have been banging my head against a SOAP service deployed on .NET.

First the service used SOAP headers for authentication, instead of simple Basic Authentication. Axis doesn’t seem to generate code to add the extra headers so I had to manually add it to the call:

SOAPHeaderElement auth = new SOAPHeaderElement("http://svc/","AuthenticationHeader");
auth.addChildElement("Username").addTextNode("foo");
auth.addChildElement("Passwd").addTextNode("bar");

But the .NET service did not accept this. The code generated from WSDL with Axis (wsdl2java) adds namespace attributes to all elements:

<mew:AuthenticationHeader>
  <mew:Username>foo</mew:Username>
  <mew:Passwd>bar</mew:Passwd>
</mew:AuthenticationHeader>

If I manually removed the namespace attributes, authentication works:

<mew:AuthenticationHeader>
  <Username>foo</Username>
  <Passwd>bar</Passwd>
</mew:AuthenticationHeader>

I took a look at the WSDL file and found this in the XML Schema part:

<s:schema elementFormDefault="qualified” targetNamespace=”http://MEW/”>

Qualified means that you need to add namespaces to the elements. It seems to me that .NET has messed this up. If I change the WSDL to

<s:schema elementFormDefault="unqualified” targetNamespace=”http://MEW/”>

The Axis client works fine and the generated SOAP request does not include the namespace for Username and Passwd is removed.

Who is to blame, Axis or .NET?

Backing up my server to Amazon S3

October 3, 2006 | In Uncategorized | 7 Comments

I have tried a few different backup strategies for my Linux servers. Before I used rdiff-backup to mirror directories to a backup server. I have also tried a home built shell script that builds tar archives, encrypts them with gpg and upload them to a backup area with ftp.

This time I feel I have a better solution. I use the tool duplicity and the Amazon S3 web service.

It wcould be easier to setup. Duplicity only recently got support for S3 so I had to get the code from CVS. Then I needed to hunt down the BitBucket Python library to get the S3 connection working. But now it works really well.

Duplicity uses the same library as rdiff-backup so it will only transfer the data that really has changed. So if a file grew from 2 to 3 Mb, only the new Mb will be transfered.

S3, for you who have been living without Internet the last six months, is a storage service from Amazon. You register with them and receive an user id and password (but Amazon have some strange names for them). Then you use a web service to send and recieve data into “buckets”. The buckets gets stored on Amazon’s big storage network. The data is encrypted with your key, but Duplicity can also encrypt or sign the data before you send it.

Amazon charges for the data you store and the amount of data you transfer. And the prices are really competitive. 20 Gb with 2 Gb monthly transfer will cost you USD3.40. I think we will end up closer to $15 after the first six months. I intend to burn DVD:s every second month or so and store them somewhere safe. No need to keep the whole history on S3 - just the current stuff.

So with everything working I write a list of directories I want to backup. Duplicity has really powerful include/exclude syntax so you can be really selective if you want to save money. Then I put it into the crontab and let it do its magic every night.

Don’t forget to test recovery now and then so you know that the backup is working.

Entries and comments feeds. Valid XHTML and CSS. ^Top^