Thursday, November 17, 2011

Creating an Outlook task in Java using webDAV

I've recently come across this interesting task. In Java, create MS Exchange tasks with assigned reminders and custom task body. I was told that PoC (proof of concept) had been successfully concluded and it was just a matter of integration. To be honest, the PoC came up with this idea - create a web application which would utilize jIntegra DCOM wrapper (as the web would be running in Linux so no COM there) and remotely access MS Outlook installed somewhere and from there it would create tasks in Exchange. As you can imagine, the level of complexity of this approach is enormous. This solution would do a round trip around the world just to access an Exchange server and create a task there. Still this solution would eventually fail because of Outlooks scripting protection (see it here) and would require someone permanently logged in Outlook so DCOM calls would be possible.
What other (if any) solutions are out there. One pretty straight forward and surprisingly Java friendly too. Long time ago someone invented this extension to HTTP called webDAV. Yes, it's still around - alive and kicking. As webDAV is generally speaking just a collection of additional HTTP verbs (methods) it can be easily invoked from any language as long as the program can access HTTP (i.e. all).
Below's how I did it. You only need to download Jackrabbit jar ( freely available from Apache) and run the code. It internally performs a webDAV call that creates a new Exchange task. Tested with Exchange 2003 SP2 but should work with any 2003+ version. Additional files can be found under the main one. It's just a small tweak to Jackrabbit's own PropPatch method (adding PropPatch call with the XML in a String) and HtmlEncode helper (not my invention!) class to allow html task body encoding.

More info and source can be found at these URLs:
package uk.co.mo.webDAV.utils;

import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;

import java.util.Date;


public class TaskCreator {

    public static void main(String[] args) throws Exception {

        // create a httpclient config
        String uri = "http://xxx.yyy.zzz/exchange/";
        // String uri = "http://xxx.yyy.zzz/exchange/";
        HostConfiguration hostConfig = new HostConfiguration();
        hostConfig.setHost(uri);

        HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
        HttpConnectionManagerParams params = new HttpConnectionManagerParams();
        int maxHostConnections = 20;
        params.setMaxConnectionsPerHost(hostConfig, maxHostConnections);
        connectionManager.setParams(params);

        HttpClient client = new HttpClient(connectionManager);
        client.setHostConfiguration(hostConfig);

        // set authentication (most exchange servers accept nt challenge-response)
        Credentials creds = new NTCredentials("admin_username", "password", "ip", "domain");
        // Credentials creds = new NTCredentials("username", "password", "domain controller", "domain");
        client.getState().setCredentials(AuthScope.ANY, creds);

        PropPatchMethodPro pPatch = new uk.co.mo.webDAV.utils.PropPatchMethodPro("http://xxx.yyy.zzz/exchange/user/Tasks/nameOfThetask" + new Date().getTime() + ".eml", getMessage());
        // PropPatchMethodPro pPatch = new uk.co.mo.webDAV.utils.PropPatchMethodPro ("http://xxx.yyy.zzz/exchange/user/Tasks/nameOftheTask") new Date().getTime() + ".eml", getMessage());

        pPatch.setRequestHeader("Content-type", "text/xml; charset=UTF-8");

        // call exchange
        client.executeMethod(pPatch);

        // is everything OK
        if (!pPatch.isSuccess(pPatch.getStatusCode())) {
            // we've got a problem
            System.out.println("PROBLEM");
            System.out.println(pPatch.getStatusCode());
            System.out.println(pPatch.getStatusText());
            System.out.println(pPatch.getStatusLine());
        } else {
            // processed
            System.out.println("OK");
        }
    }

    private static String getMessage() {
        return new StringBuilder("<?xml version=\"1.0\"?>\n")
                .append("<g:propertyupdate xmlns:g=\"DAV:\"\n")
                .append("xmlns:e=\"http://schemas.microsoft.com/exchange/\"\n")
                .append("xmlns:mapi=\"http://schemas.microsoft.com/mapi/\"\n")
                .append("xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\"\n")
                .append("xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\"\n")
                .append("xmlns:h=\"http://schemas.microsoft.com/mapi/id/{00062003-0000-0000-C000-000000000046}/\"\n")
                .append("xmlns:i=\"http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/\"\n")
                .append("xmlns:header=\"urn:schemas:mailheader:\"\n")
                .append("xmlns:sql=\"urn:schemas-microsoft-com:mapping-schema\"\n")
                .append("xmlns:mail=\"urn:schemas:httpmail:\"\n")
                .append("xmlns:t=\"http://schemas.microsoft.com/exchange/tasks/\">\n")
                .append("<g:set>\n")
                .append("<g:prop>\n")
                .append("<g:contentclass>urn:content-classes:task</g:contentclass>\n")
                .append("<e:outlookmessageclass>IPM.Task</e:outlookmessageclass>\n") // we're creating a task
                .append("<mail:subject>Test Task</mail:subject>\n") //subject line of the task
                .append("<mail:htmldescription>") // html message - needs to html encoded
                .append(HtmlEncode.text("Task Test<br/><b>test bold</b><pre>test pre</pre><a href='www.google.com'>www.google.com</a>"))
                .append("</mail:htmldescription>\n")
                .append("<h:0x8104 dt:dt=\"dateTime.tz\">2011-11-20T01:00:00.00Z</h:0x8104>\n") //start date
                .append("<h:0x8105 dt:dt=\"dateTime.tz\">2011-11-21T01:00:00.00Z</h:0x8105>\n") //due date
                .append("<i:0x8516 dt:dt=\"dateTime.tz\">2011-11-20T01:00:00.00Z</i:0x8516>\n") //start date
                .append("<i:0x8517 dt:dt=\"dateTime.tz\">2011-11-21T01:00:00.00Z</i:0x8517>\n") //due date
                .append("<i:0x8502 dt:dt=\"dateTime.tz\">2011-11-20T15:50:00.00Z</i:0x8502>\n") // reminder date
                .append("<h:0x811C dt:dt=\"boolean\">0</h:0x811C>\n")  // completed
                .append("<h:0x8101 dt:dt=\"int\">0</h:0x8101>\n") // status
                .append("<h:0x8102 dt:dt=\"float\">0</h:0x8102>\n") //completed %
                .append("<i:0x8503 dt:dt=\"boolean\">1</i:0x8503>\n")  // reminder enabled
                .append("<header:to>apollosystem</header:to>\n") // task destination
                .append("</g:prop>\n")
                .append("</g:set>\n")
                .append("</g:propertyupdate>").toString();
    }
}
package uk.co.mo.webDAV.utils;

import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.jackrabbit.webdav.DavConstants;
import org.apache.jackrabbit.webdav.DavMethods;
import org.apache.jackrabbit.webdav.client.methods.DavMethodBase;
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet;
import org.apache.jackrabbit.webdav.property.DavPropertyName;
import org.apache.jackrabbit.webdav.property.DavPropertyNameIterator;
import org.apache.jackrabbit.webdav.DavServletResponse;
import org.apache.jackrabbit.webdav.MultiStatus;
import org.apache.jackrabbit.webdav.MultiStatusResponse;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.Status;
import org.apache.jackrabbit.webdav.xml.DomUtil;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.HttpConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import java.io.IOException;

public class PropPatchMethodPro extends DavMethodBase implements DavConstants {
    private static Logger log = LoggerFactory.getLogger(PropPatchMethodPro.class);

    private final DavPropertyNameSet propertyNames = new DavPropertyNameSet();

    private DavException responseException;

    /**
     * @param uri
     * @throws IOException
     */
    public PropPatchMethodPro(String uri, Document document) throws IOException {
        super(uri);
        setRequestBody(document);
    }

    public PropPatchMethodPro(String uri, String document) throws IOException {
        super(uri);
        setRequestBodyText(document);
    }

    public void setRequestBodyText(String requestBody) {
        setRequestEntity(new StringRequestEntity(requestBody));
    }


    private Element getPropElement(Element propUpdate, boolean isSet) {
        Element updateEntry = DomUtil.addChildElement(propUpdate, (isSet) ? XML_SET : XML_REMOVE, NAMESPACE);
        return DomUtil.addChildElement(updateEntry, XML_PROP, NAMESPACE);
    }

    //---------------------------------------------------------< HttpMethod >---

    /**
     * @see org.apache.commons.httpclient.HttpMethod#getName()
     */
    @Override
    public String getName() {
        return DavMethods.METHOD_PROPPATCH;
    }

    //------------------------------------------------------< DavMethodBase >---

    /**
     * @param statusCode
     * @return true if status code is {@link DavServletResponse#SC_MULTI_STATUS 207 (Multi-Status)}.
     *         For compliance reason {@link DavServletResponse#SC_OK 200 (OK)} is
     *         interpreted as successful response as well.
     */
    @Override
    protected boolean isSuccess(int statusCode) {
        return statusCode == DavServletResponse.SC_MULTI_STATUS || statusCode == DavServletResponse.SC_OK;
    }

    /**
     * @param multiStatus
     * @param httpState
     * @param httpConnection
     */
    @Override
    protected void processMultiStatusBody(MultiStatus multiStatus, HttpState httpState, HttpConnection httpConnection) {
        // check of OK response contains all set/remove properties
        MultiStatusResponse[] resp = multiStatus.getResponses();
        if (resp.length != 1) {
            log.warn("Expected a single multi-status response in PROPPATCH.");
        }
        boolean success = true;
        // only check the first ms-response
        for (int i = 0; i < 1; i++) {
            DavPropertyNameSet okSet = resp[i].getPropertyNames(DavServletResponse.SC_OK);
            if (okSet.isEmpty()) {
                log.debug("PROPPATCH failed: No 'OK' response found for resource " + resp[i].getHref());
                success = false;
            } else {
                DavPropertyNameIterator it = propertyNames.iterator();
                while (it.hasNext()) {
                    DavPropertyName pn = it.nextPropertyName();
                    success = okSet.remove(pn);
                }
            }
            if (!okSet.isEmpty()) {
                StringBuffer b = new StringBuffer("The following properties outside of the original request where set or removed: ");
                DavPropertyNameIterator it = okSet.iterator();
                while (it.hasNext()) {
                    b.append(it.nextPropertyName().toString()).append("; ");
                }
                log.warn(b.toString());
            }
        }
        // if  build the error message
        if (!success) {
            Status[] st = resp[0].getStatus();
            // TODO: respect multiple error reasons (not only the first one)
            for (int i = 0; i < st.length && responseException == null; i++) {
                switch (st[i].getStatusCode()) {
                    case DavServletResponse.SC_FAILED_DEPENDENCY:
                        // ignore
                        break;
                    default:
                        responseException = new DavException(st[i].getStatusCode());
                }
            }
        }
    }

    /**
     * @return
     * @throws IOException
     */
    @Override
    public DavException getResponseException() throws IOException {
        checkUsed();
        if (getSuccess()) {
            String msg = "Cannot retrieve exception from successful response.";
            log.warn(msg);
            throw new IllegalStateException(msg);
        }
        if (responseException != null) {
            return responseException;
        } else {
            return super.getResponseException();
        }
    }
}
package uk.co.mo.webDAV.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * Encodes text and URL strings in various ways resulting HTML-safe text.
 * All methods are <code>null</code> safe.
 */
public class HtmlEncode {

    protected static String EMPTY_STRING = "";

    protected static final char[][] TEXT = new char[64][];
    protected static final char[][] BLOCK = new char[64][];
    protected static final char[][] URL = new char[256][];

    /**
     * Creates HTML lookup tables for faster encoding.
     */
    static {
        for (int i = 0; i < 64; i++) {
            TEXT[i] = new char[]{(char) i};
        }
        for (char c = 0; c < 256; c++) {
            try {
                URL[c] = URLEncoder.encode(String.valueOf(c),
                        "ISO-8859-1").toCharArray();
            } catch (UnsupportedEncodingException ueex) {
                ueex.printStackTrace();
            }
        }

        // special HTML characters
        TEXT['\''] = "'".toCharArray(); // apostrophe (''' doesn't work - it is not by the w3 specs)
        TEXT['"'] = """.toCharArray(); // double quote
        TEXT['&'] = "&".toCharArray(); // ampersand
        TEXT['<'] = "<".toCharArray(); // lower than
        TEXT['>'] = ">".toCharArray(); // greater than

        // text table
        System.arraycopy(TEXT, 0, BLOCK, 0, 64);
        BLOCK['\n'] = "<br>".toCharArray(); // ascii 10, new line
        BLOCK['\r'] = "<br>".toCharArray(); // ascii 13, carriage return
    }

    // ---------------------------------------------------------------- encode

    public static String text(Object object) {
        if (object == null) {
            return EMPTY_STRING;
        }
        return text(object.toString());
    }

    /**
     * Encodes a string to HTML-safe text. The following characters are replaced:
     * <ul>
     * <li>' with &#039; (&apos; doesn't work)</li>
     * <li>" with &quot;</li>
     * <li>& with &amp;</li>
     * <li>< with &lt;</li>
     * <li>> with &gt;</li>
     * </ul>
     *
     * @see #block(String)
     */
    public static String text(String text) {
        int len;
        if ((text == null) || ((len = text.length()) == 0)) {
            return EMPTY_STRING;
        }
        StringBuilder buffer = new StringBuilder(len + (len >> 2));
        for (int i = 0; i < len; i++) {
            char c = text.charAt(i);
            if (c < 64) {
                buffer.append(TEXT[c]);
            } else {
                buffer.append(c);
            }
        }
        return buffer.toString();
    }

    // ---------------------------------------------------------------- enocde text

    public static String block(Object object) {
        if (object == null) {
            return EMPTY_STRING;
        }
        return block(object.toString());
    }

    /**
     * Encodes text into HTML-safe block preserving paragraphes. Besides the {@link #text(String) default
     * special characters} the following are replaced, too:
     * <ul>
     * <li>\n with <br></li>
     * <li>\r with <br></li>
     * </ul>
     * <p/>
     * <p/>
     * Method accepts any of CR, LF, or CR+LF as a line terminator.
     */
    public static String block(String text) {
        int len;
        if ((text == null) || ((len = text.length()) == 0)) {
            return EMPTY_STRING;
        }
        StringBuilder buffer = new StringBuilder(len + (len >> 2));
        char c, prev = 0;
        for (int i = 0; i < len; i++, prev = c) {
            c = text.charAt(i);
            if ((c == '\n') && (prev == '\r')) {
                continue; // previously '\r' (CR) was encoded, so skip '\n' (LF)
            }
            if (c < 64) {
                buffer.append(BLOCK[c]);
            } else {
                buffer.append(c);
            }
        }
        return buffer.toString();
    }

    // ---------------------------------------------------------------- encode text strict

    public static String strict(Object object) {
        if (object == null) {
            return EMPTY_STRING;
        }
        return strict(object.toString());
    }

    /**
     * Encodes text int HTML-safe block and preserves format using smart spaces.
     * Additionaly to {@link #block(String)}, the following characters are replaced:
     * <p/>
     * <ul>
     * <li>\n with <br></li>
     * <li>\r with <br></li>
     * </ul>
     * <p/>
     * This method preserves the format as much as possible, using the combination of
     * not-breakable and common spaces.
     */
    public static String strict(String text) {
        int len;
        if ((text == null) || ((len = text.length()) == 0)) {
            return EMPTY_STRING;
        }
        StringBuilder buffer = new StringBuilder(len + (len >> 2));
        char c, prev = 0;
        boolean prevSpace = false;
        for (int i = 0; i < len; i++, prev = c) {
            c = text.charAt(i);

            if (c == ' ') {
                if (prev != ' ') {
                    prevSpace = false;
                }
                if (prevSpace == false) {
                    buffer.append(' ');
                } else {
                    buffer.append(" ");
                }
                prevSpace = !prevSpace;
                continue;
            }
            if ((c == '\n') && (prev == '\r')) {
                continue; // previously '\r' (CR) was encoded, so skip '\n' (LF)
            }
            if (c < 64) {
                buffer.append(BLOCK[c]);
            } else {
                buffer.append(c);
            }
        }
        return buffer.toString();
    }
}
Enjoy while it lasts!

Monday, March 20, 2006

Java UK06

It was great to be there but in general, nothing new. The upcoming trends are well known:
  • EJB 3
  • JSF
  • JAXB
  • AJAX
    It means - everyone should pay attention to this topic if wants to be part of the main-stream.
    What surprised me at most was a fact, that the SOA seems to be dead. You probably remember the hype around SOA but when it comes to reality, there is a silence of the lambs ...
    Just a small example: at Java UK06 there was a track 3 and track 4. Track three objectives concerned the JSF and AJAX and took place at middle-size side-room. Track four was about SOA and took place at the main conference hall. And while track three was literally overcrowded, there were just about 10 people who waited for an SOA experience. And when I looked to the empty hall I spoke to myself - SOA is dead ...
  • Tuesday, March 14, 2006

    Java UK06 London

    I'm going to visit Java UK06 today. It will be my first pure java community experience and I just can't wait :-) I hope I'll find some of Glassfish guys out there. Anyway, the program looks pretty good (check it out). I'm interested especially in Java EE 5, but I'll certainly take on look on some SOA stuff (just because of the hype around)and Web development (it will be mostly about JSF however it is good to know my enemy :-))
    Finally, I'll be back on Thursday and I'll definitely write an article on my trip to London Java UK06

    Sunday, March 12, 2006

    Progress information

    Weekend is gone so here's the current status of my EJB3 vs. Wicket effort:
    Work on all parts is in progress ie. database is running, ejb tier basically works, wicker layer is working. More in-depth view on all technologies involved
  • Database: tables are ready and database generation script done as well.
  • EJB: persitent beans are finished, other beans basically works but there is still a lot of work ahead. Skeleton of webservice, which is just an interface between session beans and logic hidden behind, is completed.
  • Wicket: web layer is working too. Most of the panels are unfinished so the application could be rather called a torso application, however the main idea is already apparent.
    You can download tarball of the application from here and here. Note that required libraries (axis and wicket) are not supplied !
  • Saturday, March 11, 2006

    The easiest way to create a webservice in EJB3

    As you certainly already know, webservoces rules the world. You can call them from almost anywehere means any platform, any technology. To create a webservice in the world of EJB2.1 and related technologies used to be a tough task. The upcoming EJB3 is changing a lot in this area. From the developer's point of view, the main change is that to create a webservice he/she doesn't need to be a guru. For demostration purpose I've created a tiny Webservice. Actually it doesn't do anything useful just calls to underlaying EJB.
    The very basic principle of creation of webservice is to develop class that is an EJB (stateless or stateful) and mark it as a webservice. It means annotate class as @Stateless and @WebService. If you do that, you've got a webservice but unfortunetaly without any accessible method. To publish a method as a web method simply annotate a method with @WebMethod annotation. And here is the example of WebService:
    package org.defectus.ejb3.ws;

    import javax.ejb.Stateless;
    import javax.jws.WebMethod;
    import javax.jws.WebService;

    @Stateless
    @WebService(serviceName = "ResultService")
    public class Service {

    @WebMethod(operationName="TestResult")
    public long testResult (long id {
    return id;
    }

    @WebMethod(operationName="StringResult")
    public String stringResult (String id) {
    if (id == null)
    return "null";
    return id;
    }
    }
    The next step is to deploy such webservice. It should be an easy thing but for me it's not like that. I don't know why but to successfuly deploy webservice I have to call WSGEN manually. Manually in my particular case means to call an ant's task. For example like this:
    <target name="generate-wsdl" depends="compile-ejb">
    <mkdir dir="${build.dir}/generated/wsdl" />
    <mkdir dir="${build.dir}/service" />
    <exec executable="${appserver.dir}/bin/wsgen" failonerror="true">
    <arg line="-extension -cp ${build.dir} -d ${build.dir} -r ${build.dir}/generated/wsdl -wsdl org.defectus.ejb3.papp.ws.ResultService" />
    </exec>
    </target>

    After you deploy the webservice don't forget to use a nice feature of glassfish - webservice tester. Just locate the webservice in administration console adn click the Test button.
    And that's all for now. I'll try to find another feature to explain latter ...

    Thursday, March 09, 2006

    Several of links to opensource friendly corporate sites

    Logica
    IBM
    Thoughtworks
    I'll find more but these are good example of how even big corporations participate on open source and community initiative.

    Tuesday, March 07, 2006

    EJB3 and Wicket

    It's been a long time I posted something new to the blog you're reading and now it's finaly time to write about my progress on a technology field.
    First of all - my EJB 3.0 example in this blog was mentioned in official Glassfish blog. I was really surprised ! And I will proudly work hard to make a lot of new achievements that can be displayed on a frontpage of some well respected blogs.
    In EJB3 is still water mow - nothing revolutional is going on - everyone work hard to stabilized source code. I don't have any information that in near future there will be same major changes in specification and/or implementation of EJB 3.0. For myself I have to say I'm working on a new project - it would be some kind of time-tracker or something like that - I'm not sure if I will be able to finish this work but hopefuly I will ... If not, there will be another torso of example application .-)
    With Wicket I have no progress and it makes me unhappy. Wicket team have just announced version 1.2 beta so it's good time to restart my attempt to create something meaningful using the framework. Here is my idea (vision) from the used technologies point of view:
    Database is Oracle, actually without any logic in PL/SQL (would be added latter but it requires some kind of mapping tool - iBatis could fit my needs)
    Logic will be encapsulated in Glassfish. EJB3 persistence will handle database layer (there would be a number of native query as I really like SQL), above it will be a number of stateless beans acting as facade and even higher will be a webservice managing all the stuff.
    The client side would be done in Wicket. This application will run on Tomcat and using Apache Axis it will call Glassfish backend.
    Right now I have a database model, persitence layer without queries, sample facade bean and sample webservice. I also have a skeleton of Wicket app - means build.xml.
    In upcoming weeks I expect a significant progress because after that I have to prepare myself to another certification - and that costs time and huge amount of brain energy .-)

    Wednesday, March 01, 2006

    Don't use resource injection for anything stateful in Java EE 5 !

    EJB3 has an impressive feature - a resource injection. You can mark class attribute by annottation @Resource or @EJB and application server will inject requested resource at runtime. So far so good, but imagine servlet that uses stateful EJB. When you run this servlet in single-threaded model then there is only one instance of servlet with only one injected resource - so as the result, everyone who calls the servlet uses just one stateful bean ! And mostly, this is not what you want allow, mostly you want bind one servlet session to one stateful bean. The same trouble is for example with @PersistenceProvider. However in this case things are even complicated - your application should run smoothly but from time to time you'll experience serious troubles concerns threading and transactions. This is a side effect of fact that @PersitanceManager is not thread safe and can't manage multiply transactions.
    Do you want to know more ? Click here !

    Monday, February 20, 2006

    Way for SJCP certification

    There're many people trying to prepare themself for the SCJP. That's a good idea to put yourself to the test although the problem is where to find resources. If you've decided to make (and even pass) SCJP 5 you'll find that there is only limited number of mock exams, user experience and so on.
    For this purpose here is my list of sites, tools and tutorials which are worth to take or just explore. Remember - every mock test you pass, everything you try to program, everything what you read - it counts ! Finally bear in mind - reading is NOT enough - you need hands on experience as most of the questions troubleshoot java code.
    SCJP 5 is dedicated to Java 5 and basically is more defficult then SCJP 1.4.
    First step you definitely must take is visiting Sun's Java certification site. Read carefully certification objectives and try to prepare only for objectives mentioned there - stay focused on a target and everything will be all right !
    Next, read this PDF - it contains a lot of useful information on the test - but until you feel you're ready don't complete questions. Save them for last week before assesment and be noticed that many of questions indicates wrong number if correct answers so it's better to find correct answer by compiling given code.
    There is a list of useful links to many mock exams on Javaranch Almost all of them are very easy even if their authors claim them to be tough !
    A huge community is around Java black belt site. Worth to take some question specifically some from SCJP section. Note that these question are mantained by volunteer so the quality of questions (except for my question) differ from one another !
    It's good to take some questions at Examulator. After your correct answer on question of the day, you can take comprehensive test of 60 more questions. But they're quite easy ...
    And that's all folks. If you want to score high and willing to spend some money ($59) download exam simulator from Whizlab. Many questions are buggy but the difficulty level is very close to the real test ! It's good to make at least 80%.
    So, let's get certified :-)

    I'm certified :-)

    At last, I'm certified. It took me almost two months, lot of dreamless nights, weekends in front of computer etc. but finally it paid off. And what to do next ? On friday I'll give a presetantion on Java EE 5 (specificaly EJB3 and beyond).
    And my next challanges ?
    1)Wicket - as I said before, I really like it and want to get more and more from this fantastic framework.
    2)OCA - I'd like to achieve Oracle certified associate. Hopefuly I'll be certified in three to four months (at june/july).
    For now on - there is Java EE 5 and then Wicket. Means lot of work and no time for boring :-)

    Tuesday, February 14, 2006

    Now I'm running 80% ! And more on my progress with Wicket ...

    Yes, it's been a week you don't listen from me. But now the waiting is over .-) I'm still prepering for SJCP5 certification test and as a sideeffect I've recently gained Java yellow belt - After all the misery with Whizlab's test suite I'm passing on roughly 80 % - it could quarantee 90% at real tests, but who knows. I know, I have my weaknesses though hopefully I'll pass the test. Anyway, the JavaBlackBelt initiative is quite impressive - check it out at http://www.javablackbelt.org/! I'm sure you'll find many interesting issues you don't even know about Java language !
    Now for the Wicket framework. It's really what I want. I'm definitely surprised - those guys doing things the way I would do. Of course - to learn a new framerk as Wicket is painful and means to spend a lot of night sleepless but the result is fantastic. I'll keep on learning and I'll surely post some code snippets from my application. If you want to know more on Wicket proceed here.
    So enough for today, I'll keep the rest for tomorrow :-)

    Friday, February 10, 2006

    Still running on 50 %

    Mock test. These from Whizlab are tough one. I don't know why, but I can pass any test, but this. The questeions are difficult and what's more - they're artificialy difficult. Most of the questions are poorly formated so even to recognize code take a lot of time. That's why I hate them and why I hope that the real question will be better to understand and if they will even harder then the hardnest will be managed by clearer approach - no fog over the code. For example take a look at this snippet:


    interface Counter {
    private int countToFive ()
    {
    int a;
    for (a = 1;a<5;a++)
    System.out.printf("counting" + a);
    }

    }
    class Beta
    {
    public static void main (String ... args)
    Counter c = new Counter () {
    public countToFive () {
    for (int a = 0;a<6;a++)
    System.out.printf("counting" + a);
    }
    }; c.countToFive();
    }}
    What a mess !

    Tuesday, February 07, 2006

    Preparing for certification

    Sometimes you may consider yourself as a good programmer. So as I. And that was the reason why I have desided to put myself to the test. But after three crucial weeks of preparation I realize how hard is to answer all the qestions. of course, I'm using mock question from all over the globe (mostly located on JavaRanch) and for "close to reality" or even "harder then reality" I'm using mock question provided by Whizlab. Thay give a 150% pass certification garantee - it's only trick. When you ask people "god like difficult" question you can be sure, that those who will pass the test for them the real test will be a child game :-) Now I know my weaknesses (generics, formatters & scanners, exceptions) and I'm learning. And I'll be ready for test two weeks later hopefully ... :-) Till that - good bye Wicket, bye bye EJB3 !