During my learning on shindig, i found out that shindig using guice a lot on its code. Of course, I try to find out what is this tool about. After a little bit searching, I found out that the it is a bit similar with Spring. However, the authors say that it is different. They say that guice is not container and it is too light to be container. Anyway, just cut the bullshit and try to find out what is this tool about.
The first impression on my side after trying this tool is simple. Well, yes... it is indeed very simple as a dependency injection framework. What you need to do is the annotation. It makes all the things very simple.
The things that you need to remember (well, at least on my simple try) on regard of guice-ing your codes is the injector. The injector will try to lookup what are the fields, methods or constructor which need to be injected with object. Then, guice will inject it for you.
Below is a little bit example on it:
public static void main(String[] args) {
// TODO Auto-generated method stub
Injector injector = Guice.createInjector();
Customer customer = injector.getInstance(Customer.class);
customer.changeItem("barangnya");
}
The method injector.getInstance(Customer.class) will give you a complete object of customer with the injected notifier object. Below is the class of Customer:
public class Customer {
@Inject
public Notifier notifier;
public void changeItem(String message)
{
notifier.sendNotification(message);
}
}
Notifier is an interface. Guice will lookup on this interface to find out what class implement Notifier interface. In order to know what class which implemet Notifier interface, the interface should define annotation to tell the guice. Below is the interface of Notifier.
@ImplementedBy(SendSms.class)
public interface Notifier {
public void sendNotification(String message);
}
Its easy, isnt it (well, at least for this try :P)?
Saturday, November 28, 2009
Guice-ing your code
Monday, November 16, 2009
Building and Running shindig source on eclipse
Well, running or debugging any java sources managed by maven inside eclipse is as easy as running any simple application in eclipse. The only thing that you need is maven integration plugin. This is a super power plugin when your application deal a lot with maven. I just started to fall in love with eclipse instead of his competitor, Intellije IDEA, which always falls on the error of classpath. I need to delete the current working space and then rebuild it again. Its very annoying.
Yeps, maybe better to tell you a bit story of using this IDEA, a very lame tool to develop your application. The slogan should not be "Develop with pleasure", but it should be "Develop with pressure" instead. Many people agree with this slogan. Perhaps, we really need to tell them this new slogan. I have been using this IDEA to develop and learn about Confluence and JIRA source. However, everyday, I restart my computer, it always fall on the classpath error. It says that it cannot find xxx class while yesterday i build it without any problem. Then, the only thing that I can do is to build it again. It takes a lot of time indeed. Thus, I recommend you for not using IDEA to develop your application. It will only give you pressure because you spend a lot of time to rebuild your source.
Anyway, back to eclipse. I am using this tool to build, running and debugging the source of shindig. Yeps, it is pretty much easy. You just need to install the plugin on this url:
http://m2eclipse.sonatype.org/update/
well, you should get the list of plugins need to be installed. Just pick the core and then installed and restart your eclipse after finishing the installation. After that, you can simply open debug configuration and then create a maven command to run your source. You can use any maven plugin, I have used jetty and tomcat for the tries.
Building and Running shindig source
I ve just tried to build the source of Shindig and running it on eclipse. Yes, as what most people expected, there will be problem face during this process.
First time I was experiencing the problem of not able to build the source of shindig. I saw the log of the process, it fails on the test code. Thus, I just skipped it and running the maven command mvn is success.
The problem is not stopped on this, if you try to run it on jetty using the following command (as what the doco said)
mvn clean install jetty:run -DrunType=full -Djetty.port=80
It will complain as in the following:
[INFO] The plugin 'org.apache.maven.plugins:maven-jetty-plugin' does not exist o r no valid version could be found
Thus, you need to run a complete maven command as in the following
mvn clean install org.mortbay.jetty:maven-jetty-plugin:6.0.1:run -DrunType=full -Djetty.port=8091
Even more, it will complain on the non-availability of the webapp directory as in the following:
[INFO] web.xml does not exist at location F:\software\shindig\src\main\webapp\WE B-INF\web.xml
Therefore, you need to run it on
http://localhost:8091/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml
You should see the following image on your browser.
Saturday, November 14, 2009
SSO (Single Sign On) for JIRA and Confluence
I just developed an SSO application which is built on mule. This SSO can be plugged in the application which is using seraph as its security framework. The 2 greats Atlassian's product which are Confluence and JIRA uses seraph, as its security framework. Thus, this SSO can be applied to these products.
Basically, the idea of this SSO are:
- to use a middleware to store a data on regard of user's authentication, The middleware that I use is mule as it is free and open source. So, people can use it.
- to use the existing user framework which is used in seraph to perform authentication. Seraph, by default, uses osuser as its user management framework. However, as we can customize and plug any authenticator to seraph. This would make the authentication is more dynamic to perform. The authentication definitely needs user management framework to perform its task by comparing the credential in database against the input that use provides.
Saturday, October 31, 2009
Unable to resolve JRE
Have you experienced this message on your eclipse after building your application using maven 2? I experience this problem after building mule source and the following are the things that I did to fix the problem:
# Check your JAVA_HOME to point to jdk instead of jre
# Check your pom.xml to point to the right jre. The following is the figure of my pom.xml which procudes the message above on the pom.xml
This is after the change:
The change that I did is only changing the name of your jre as my jre directory is jre1.5.0_07 and it is located at C:\Java\jre1.5.0_07.
Thursday, October 29, 2009
How to change maven repository
Well, yes... I experience the problem of not enough space on my drive C.... I believe many people experience the same thing as me. One of the causes is my maven repository is getting bigger and bigger. Yes.. it is the problem when you need to build the source and downloading the dependencies.
To get it changed, what I was thinking is where the configuration of maven located. Then, I was thinking about the installation directory (my maven installation directory is in F:\software\apache-maven-2.0.9). I was suspecting there should be some sort of configuration about this. Just go to the installation directory of maven, and then I found settings.xml inside the conf directory on my maven directory. Open it up and then I found about local repository configuration. The following is a figure of it.
Tuesday, October 27, 2009
Soap document Validation on webmethods
Today, I am experiencing the problem of dealing with webmethods on consuming service generated by processing wsdl of JIRA's application. Well, I definitely experience an error message on dealing with this. Here it is:
com.wm.app.b2b.server.ServiceException: [ISS.0088.9139] Output parameters do not conform to targetOutputSignature:
errorCode=VV-004
The above is caused by validation that is done by webmethods after receiving the object during the soap service calling. All the fields on the object will be validated and if the fields' value does not match (even, the value is empty or null). It will complain. It is very annoying if you receive an object which does not have any value or we can say it as null. it keeps poping up an error message as mentioned above.
However, I found weakness of this validation. It seems that webmethods is not trying to match between the object's fields and the document as reference for validation. Thus, if the fields in the object being retrieved does not exist in the document, then there will be no validation being done.
Friday, October 23, 2009
ConfluenceJira integration
It has been so long for not blogging. Yeps, I come back to blog on my integration of Confluence and JIRA using webmethods as the tool. The initialization of the project has been uploaded to my github repository.
* http://github.com/ariemurdianto/ConfluenceJiraWM
In order to integrate between these products of Atlassian. I use webservice which is provided by both Confluence and JIRA. Also, I use email notification which is sent every time certain event is happening on both application. The email notification that I extract the information is email which is generated from add comment and add page. I extract the information from those type of event and integrate Confluence and JIRA.
Let's pick Confluence as an example to describe the way the system that I juscet developed works, You can configure Confluence so that it will notify you when there is someone adding some comment to certain page. When this event happen, then Confluence will send an email notification to the subscriber (Every user can subscribe on certain available space in Confluen). Every certain period of time, the flow service that I developed, will check on the mailbox and then grab the email with certain pattern. If the email notification is adding a page, then the subject of the email will show us that the email is an adding page email. We can see the pattern of the email subject to determine the event being generated in Confluence. After grabbing the email and extract the information, the service will call the webservice of JIRA to create an issue. This process also happens in JIRA wise. When certain event is fired then the email notification will be sent... so on and so forth....
In fetching email from my inbox, I need to create a custom java service as I can not find any service which deals with imap server in developer documentation (I may be missing out some documentation). This custom service does fetch data based on the predefined regular expression and then extract it to be title, space, bodyContent. For detail on the code, it has been uploaded to my guthub repository.
Sunday, October 11, 2009
integrate Confluence and JIRA using webmethods
I am planning to integrate Confluence and JIRA. The basic idea of this integration is every time one of those products get updated, then the update will be taking effect to the other product. The updating that I mean is creating an issue in JIRA, giving a comment in JIRA.
The current thought of this integration is:
1. if user creates an issue in JIRA then Confluence should be created a page with the page content is the same as the description of the issue.
2. if user creates a page in Confluence, JIRA should be created an issue as well.
3. if user add a comment to some page in Confluence, JIRA should be able to get the comment added to the relevant isssue.
4. if user add a comment to some issue in JIRA, Confluence should be able to the the comment added to the relevant page.
The integration tool that I use is webmethods and mule.
On regard of the progress. let's see later on the next post.
Tuesday, September 15, 2009
Migrate MySQL to postgres
I just googled around on how to do migration from MySQL to postgresql. I ended up with unavailable script of phyton. However, I found Use mysql-postgresql-wizard of component EnterpriseDB which can be used to . You can download the source from here:
http://downloads.enterprisedb.com/src/mysql_pg_wizard_src.zip
You need to download Apache Ant to build the source. I use Apache Ant 1.7.0. Use the following command on how to build the jar file:
ant dist
Executing the above command will produce a jar file which is MigrationWizard.jar. To get the wizard of migrating the mysql to postgres, you need to execute the jar file using the following command in the
java -jar MigrationWizard.jar
The following wizard should be poped up once you execute the above command.
Tuesday, August 18, 2009
Event Handler on jQuery
Just tried to implement event handler in jQuery. The first impression that I have is simple, easy and straight forward. Yeps, what do you need to do is just binding event name with certain function and then of course, you need to trigger the event.
Below is an example on how to bind the certain object in javascript using jQuery:
$(document).bind('kampred.facebox', function(){
alert("si kampred");
});
The above will bind event named kampred.facebox to object document. In order to call this event and let the handler execute the function. What you need to do is to trigger it. Below is the example on how to do it.
$(document).trigger('kampred.facebox');
Calling the above line, will trigger the event kampred.facebox. Of course, it will prompt you an alert box. Its simple, isnt it.
Monday, July 27, 2009
facebook's box alike
After quite long doing research on how to display a popup like what is in facebook, I found a way to do so. It is a jquery plugin which name is facebox (you can google this). Basically, the basic functionalities of this plugin is poping up a window which contains an information from certain dom. Start from this understanding, it can be improved to insert an information from another page (using xhr). Of course, when i say using xhr, it can only fetching data from the same domain as xhr cannot be used to fetch data from different domain.
Well, in this blog, i would like to share the way it works in a bit high level for the operation of fetching data from another page. Basically, this plugin only fetch the data from another page and insert it in a dom. Of course, it will be hidden. After fetching the data, there will be a decorator manipulation which is the popup window itself and grab the information from the dom and put it in the popup window. Well, that's all. Its simple, isnt it? Of course, for my need, I tweak it a bit.
Below is the picture of my try where the information is grabbed from Twitter.
Sunday, July 26, 2009
Transaction, maintainability and performance
Transaction management strategies on high performance application. This is an interesting topic, I guess, since many of enterprise applications have such problem.
Most of the enterprise applications are having a problem of performance because they maintain ACID in every of their transaction. Thus, the transaction will be atomic. Imagine that we have a few transactions, 100 transactions maybe, that we need to maintain the atomic-ity of these transactions for only one action of user (clicking certain button). And definitely, the user of some applications are not only 1, so it will cost more slowness. The more users who access your application at the same time, the more slow of your application will be.
Sometime, we sacrifice performance for application's design. we usually choose to have a good design of the application rather than a high performance of application. For example, the use of ORM, let's say hibernate. Using this kind of ORM, definitely, will slow down your application. But, it will make your application more portable if you want to use another database and also, it will make the code of your application much more maintainable.
This kind of trade off cannot be avoided. It will always exist in every of software development. However, it needs to be assessed and evaluated so that those factors can benefit end user.
One thing that may come on your mind is the use of stored procedure to leverage the performance. Why does stored procedure can be used to leverage the performance instead of having plain sql? Because stored procedure is a precompiled sql statement and also less data being transferred between application and database server. Unfortunately, not many ORM fully support store procedure. The only ORM that I know which supports store procedure is Hibernate. For detail about store procedure can be seen on the link below:
http://docs.jboss.org/hibernate/stable/core/reference/en/html/querysql.html#sp_query
Saturday, July 25, 2009
YQL open data table
So that, you can use a service of YQL, you need to configure open data table. This table is in xml format which tells YQL what service that you want to expose and also it tells you also on how to use the service. Thus, this open data table will determine how is your query looks like.
YQL provides you 4 operations to deal with any public webservices, such as Twitter and Facebook. They are select, insert, update and delete. Yeps, pretty much similar with sql query. They are very powerful to deal with those public webservices.
I am gonna explain a little bit about those operations
- select, this operation is to fetch data from webservices that you point in YQL. The things that you need to be aware is the format that you expect YQL to send to you. The available format are JSON, XML and the combination of both.
- insert, this operation is to add/insert a new data through YQL.
- update, this operation is to update certain data through YQL
- delete, is to delete data in public webservice through YQL.
The parameter of YQL is specified inside tag inputs. The thing that you really need to be aware is about the paramType. It determines how is the behaviour of the variable. paramType variable means that the input is accessible in javascript as the above. Yeah!!! it is one of the interesting thing of YQL, it allows you to do javascript to tackle the problem of basic authentication. It's nice, isnt it?
For a complete referece, you can see on YQL documentation. Overall, Its a gift to know that YQL comes. It is really helpful service.
Thursday, July 16, 2009
YQL rocks
A few days ago, I was doing research on how to perform cross domain ajax. I was hitting a lot of problem as this method (as in cross domain) was not supported by xhr. This object will definitely hit into a problem of security as you are trying to do a cross domain ajax. However, after google around, I found that jquery has a plugin named flxhr. This plugin claims that it can do a cross domain. I read the documentation, it says that it uses flash as a proxy to do request. But, it needs a configuration file in the machine to be planted. I dont think, it is a good way to implement my plugin. Hence, I leave away this plugin.
That time, I really gave up to find a way on using xhr. It is definitely not the right way to get data from another domain. However, I found a way to fetch data from different domain. We can fetch data from domain using technique called JSONP. This technique is actually a script to create or inject another script dynamically. The destination website needs to provide a service in JSON format and wrap it in a function. By then, we can do JSONP. As I need to deal with twitter and I see twitter provides service in JSON format. Then, I can definitely use this way.
Again, all the things do not go as smooth as what I expected. Some of the provided services need basic authentication. Arrgghh, again, I cant use JSONP for this. Feel so damn curious on how to resolve this problem. Upon googling around (again, I dont want to use this word, actually :P). I found out about a new service provided by yahoo. This service is called as YQL. It stands for yahoo query language. It acts like a proxy for any open webservice provided by well known website such as facebook and twitter. Also, this service provides you a way on how to modify header of the request using javascrip. Finally, I can fetch data from twitter using the great YQL.
Here is the snippet of my javascript to use YQL webservice.
social repository Github
Today, I just got a way on how to checkout a code in github. well, let me introduce what is github actually. it is a repository for community. Yeah, you can sign up yourself in the following address:
http://github.com
I have registered myself in the following:
http://github.com/ariemurdianto
Well, you will see a few test project there. Well, as I am noob, it should be not a matter. :D
However, this repository is quite unique compare to the others. it provides you almost the same featurea as subversion, the only thing which makes this different is about the command. The command's name is different. Just a few things are the same.
The thing that I did is to clone a project of yql-tables from spullara and then try to perfom add and edit on this clone project. Well, it is successfully being updated there. What does this mean? it means I can start to develop my plugin as yahoo service can reach open table in github.
Yatta!!! the next plugin will be coming shortly.
Wednesday, July 8, 2009
Ajax Cross Site
Now, I am trying to develop a Confluence plugin which needs an Ajax cross site. This plugin is actually need a data from outside. It means that I need to open and maybe hold the connection during the data fetching process. If I do this in server side code, it will burden the server a lot. Thus, I need to distribute the burden among the client. Thus, Confluence will not be complained to be slow anymore.
Upon googling around, it seems that it is impossible. A lot of people hit into a security problem. As xhr (XmlHTTPRequest) does not allow any script crossing site. However, I was finding clue which reveal the script of doing cross site. JSONP!! Yeay... By using JSONP technique, it is possible to fetch data from outside using javascript. The idea of JSONP is actually to have a dynamic insertion on function. As you may know that we are allowed to import a script from outside. For example:
< type="text/javascript" src="http://vs1.pbworks.com/shared/statics/packed-v70340828.js">
But, the application which you want to fetch data from, should provide a way so that the json which is a return value of rpc, wrap the return value in certain function. The following is a piece of code which does JSONP:
var surl = baseurl + "&callback=?"
$.getJSON(surl, function(data) {
var res = '<>The data: '+data.screen_name+''
$("#result").html(res)
})
Monday, July 6, 2009
Releasing plugin using maven
I was having difficulties on how to release plugin in maven since this is the first time I develop plugin for open source. A new knowledge for me indeed. My plugin which is about RPC using JSON in Confluence, now has been released. You can have a look at the following page:
* http://confluence.atlassian.com/display/CONFEXT/Confluence+JSON+webservice
* http://www.customware.net/repository/display/AtlassianPlugins/Confluence+JSON+webservice
I hope that many feedback from Confluence users to this plugin.
Anyway, back to the topic. Releasing the plugin is a bit complicated work for beginner. First thing that you need to do is to configure your pom.xml so that it points to the right repos. The configuration that you need to aware of is distributionManagement. DistributionManagement will have a link to servers' configuration in settings.xml. The following pages may be better to explain more on distribution tag:
* http://maven.apache.org/pom.html#Distribution_Management
* http://maven.apache.org/settings.html#Servers
Just to sum up the 2 links above. The distributionManagement tag defines what server to be used as a remote repository (this configuration is defined in pom.xml) and servers tag specifies the credentials or anything so that maven can write and install plugin in the remote repository.
Tuesday, June 30, 2009
Merge dependencies in maven
I have a need to merge dependencies of my Confluence JSON webservice plugin because the plugin needs 2 libraries which are json-lib and ezmorph. There are a few ways on how to do this:
- A very naive way, by unjaring all the dependencies and my plugin together and then rejar it back. This is definitely not a good way since I want to make my plugin is installable via repository client.
- Maven, maven provides you a way on how to merge file. The idea is to unjar the dependencies before maven package the classes to be jar file. So, what I did was to unpack the dependencies to classes directory where maven allocate the classes of my plugin after compile them.
Saturday, June 27, 2009
installation of sharepoint
Sunday, June 21, 2009
NotificationMessage
Today, I asses the feasibility of NotificationMessage plugin that I want to develop. What does this plugin do is simple, just message ur team mates. The message itself can be email or message which is stored in local data.
One thing that I asses is about how to store the data in Confluence if it is in the form of message. If it is possible I dont really like to put it as property or more complex data. Usually, plugin developer will store the data in OS_PROPERTYENTRY (if the data is about property) or BANDANA (if the data is a more complex data, usually it is an object representative). I just want to put it as a normal page or news. Lucky me, that Confluence designs its object in a elegant way. News and Page are inherited from AbstractPage. I can foretell that Message class of mine can be inherited from the same AbstractPage. I just need to specify the content type. The same thing happens to user updates feature which people say as "Twitter a like".
I could not find any class to represent user update in Confluence core code, but I could find the entry of this class in the database. It must be somewhere in the plugin which represent this entry. I will do the same thing anyway.
Thursday, June 4, 2009
Sharepoint cannot display anything, just an error message
I just got an error message on my sharepoint. it does not give any clue, the message in the display is so useless. Then, i am trying to find the log which is usually located at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS. And again, such a useless log, not telling me anything about the cause.
Monday, June 1, 2009
Last night, I just finished up my testing and a few additional bugs on JIRA2JIRA plugin which will be used by Atlassian to transfer issues from https://support.atlassian.com to http:// jira.atlassian.com. which I just found that time. Ugghh..... A few things that I realize abouut JIRA implementation on issue is:
- During the execution of the method, if in case there is a problem of connection for a few seconds. Maybe, during adding a comment #2, for certain issue, it fails. This will make your issue incomplete and be added in half way. Of course, it will be a trash if it does happen.
- Its more effort to maintain both method in the implementation wise.
Saturday, May 30, 2009
Maven integration test
I m currently doing some functional tests using a great build tool Maven (this also has been used much by Atlassian developer) on my Confluence plugin. Yep, as usualy, i got a problem on my test :P. I found there is a "Class not found exception" on the log file. The class that could not be found is JSONObject which is from json-lib. I was wondering how could this be happening. Then, I checked the classpath of my integrationt test. Forgot to mention that I use cargo to startup Tomcat for my functional test.
TargetClassLoaderTransactionProxyFactoryBean vs TransactionProxyFactoryBean
I had an experience on some error which tells me that the Confluence cannot find the interface that I use for TransactionProxyFactoryBean, interface is needed by this class to perform transaction. I checked on my code and directory where my code is compiled, to see whether the interface that Confluence complains to, does actually exist or not.
Sunday, February 1, 2009
JQuery on JIRA
Yesterday, i did some learning about jquery in jira. Impressive, Jquery is an easy tool to get your site ajax enabled. The way they develop jquery makes the development of my site is independent each other (between client side script and server side script). As long as you can create a servlet which returns an xml to client, all of the thing neeeded to build an ajax enabled are done. Luckily, jira provides a way to build a servlet plugin. Thus, updating the process which happens in jira is done via servlet.
- Create servlet to give information needed by client side script.
- Create javascript to access the servlet. In this test, I created a progress bar to update the information of transferring process from 1 jira instance to another instance. There is actually a plugin but strange, I cannot make it work. Thus, I tried to develop my own progress bar (using their progress bar image :P) and it does work well. A very simple progress bar, but at least it does fulfill what I want.
Wednesday, January 14, 2009
setup a trading network
Has been long time for not blogging here as I need to blog a lot on company's wiki. Anyway, Yesterday, I was trying to setup trading network using sql server 2005 express. This is an experience that I want to share here. The first time, I tried to setup this, I always have an error about unable to retrieve data from PartnerUser. While, indeed this table does not exist in the WM database. I was googling and find that I need to setup a table for DB and of course I did that as someone's advise in some forum (definitely, WM forum).
Setting up tables do not work using a tool DB config. I am not really sure why was it happening and of course, the tables needed are not created. After struggling enough using this tool, I initiated myself to create the tables manually using the scripts which are provided with the distribution of this tool. Yeah, I could make. But.... hold on. There were a new error coming up. What the....... The error saying that it could not find an object named component_event.
I was checking on the WM database, and it was there. I was questioning myself "what's wrong with this expensive and enterprise tool? Is this really an enterprise tool?". I almost gave up. I tried to reinstall all of the stuffs in WM and try to recreate DB. All the things were nothing, just the same error. After long time thinking. I suspected collation problem in the DB. Yeah, indeed this was the culprit. I need to create a new database which collation is case insensitive. After doing this changes, creating script using db config was going so smooth like a charm. Trying to login to trading network is working so smooth as well without any error message.