Technology
A Java compliant WSDL file for Zimbra Admin’s SOAP API
by jeshurun on Dec.18, 2011, under Technology
Not too long ago I had to interface with Zimbra‘s admin API for one of my projects, and quickly realized that it is er.. a little weird. You see, Zimbra has a SOAP (and also a limited REST) API, but does not does not publish a WSDL for them. Neither is an xsd or DTD available to validate your requests against or to generate client stubs. To make things worse, the only documentation available is a lengthy but simple text file which lists the available operation names as tags and the attributes / elements that go with each of them. In case you are interested in this file, you can find it in the docs folder of your Zimbra installation.
(continue reading…)
JAX-WS Web Services with Spring and Apache CXF
by jeshurun on Nov.28, 2011, under Technology
I recently had to evaluate CXF to expose existing services in a Spring project. I thought I would jot down my thoughts and conclusions from my experiments with the technology, and log my experience as a quick tutorial for fellow coders.
Bitten by the Java TreeMap removeAll bug
by jeshurun on Apr.14, 2011, under Technology
I had to learn the hard way today about the nasty issue surrounding Java’s TreeSet / TreeMap implementations. The problem is that the removeAll method doesn’t always do what it says it does: remove all elements present in the collection called on that are present in the collection passed as the argument.
Supposedly the problem occurs when the equals and compareTo method in the type contained in the Collections aren’t consistent with each other, and the sizes of the collections compared aren’t equal. Look at the following link for an example
JDK Bug 6394757 : (coll) AbstractSet.removeAll is surprisingly dependent on relative collection sizes.
Anyways, the rule of thumb for me from now is if need be to implement a SortedSet Set that will have either removeAll or retainAll called on, use an HashSet instead, and later use Collections.sort
Set<MyType> mySet = new HashSet<MyType>(); // add some elements, do some operations mySet.removeAll(anotherCollection); List<MyType> myList = new ArrayList<MyType>(mySet); Collections.sort(myList);
PHPBB Admin Panel Access Denied
by jeshurun on Dec.20, 2010, under Technology
There seems to be a bug with the latest version of PHPBB3. After a fresh install, if you log out, log back in and try to access the administrative panel you might get the message “Access to the Administration Control Panel is not allowed as you do not have administrative permissions”.
I’m not sure why this happens (and I haven’t had time to dig into the source, perhaps I will file a bug report when time permits), but to get around this the following steps worked:
- Make sure you have remove the install directory.
- Login to the front end.
- Click on the “members” link on the top right and then click on the site admin’s username.
- Right beside the username you should see a link which says [ Administrate user ]. Click on the link.
- Re-authenticate yourself.
- Click on proceed to acp.
- You should now be looking at the admin panel.
Did this work for you? Do let me know in the comments below!
Zimbra – Releasing quarantined emails and attachments
by jeshurun on Dec.15, 2010, under Technology
If you are reading this post, chances are you administer a Zimbra mail server, and you need to recover an email that was blocked by amavisd for one of your users. This might have happened for a variety of reasons, including your spam score being too high, you have blocks based on file types, or if the email contained an attachment that was encrypted. What you would have quickly found out though, is that there is no quick and easy way of recovering a blocked email and forwarding it on to the intended recipient (at least in the community edition, I’m not sure of the network edition).
There presently seem to be at least three ways of doing this, and following is the low down on the easiest way I’ve found so far. If you just need to view the email, please skip to end of this post.
Modifying a JasperReports chart at run time
by jeshurun on Nov.06, 2010, under Technology
To modify a report at run time, it is imperative to understand the overall process of how a jrxml ends up in its final form as an image / pdf / etc. The following steps briefly outline this process.
1. The .jrxml file is loaded into memory using a variant of JRXmlLoader’s loadXML() methods, passing it the location of the file as an argument. This method returns a JasperDesign object, which is the in-memory representation of the input jrxml, on which all the run-time modifications to the report would be made.
2. After the necessary modifications have been made, the JasperDesign file is validated and compiled using one of JasperCompileManager’ compile methods. Depending on the arguments passed, this method returns a JasperReport object or saves the generated .jasper file to the location specified as the second argument to the method. Note that when dynamic modifications of the report is not required, the jrxml could be directly compiled into a JasperReport object / .jasper file using the appropriate compile method.
3. The application then prepares the data necessary for the report as JRDataSource objects, and then calls a suitable method in the JasperFillManager class, passing it the data source and the previously compiled JasperReport object / .jasper file. The output of this step would be a JasperPrint object, which could be exported to various other user-friendly formats such as PDF and Html or serialized to disk.