Saturday, December 18, 2010

IntelliJ Plugin Development, [Personal Log]

 Log entry 1.0.0

I've been working with IntelliJ for a few years now, actually started using it back
in college, I think I was version 4.5.
But really working with IntelliJ only comes when you work more then a few hours a day with it,
so after years of close encountering all of IntelliJ little perks and corks I came across a requirement in my work place for a plugin.

The scenario :
We created an annotation that posses a value of an id, let's call it "Id"
This Id's value corresponds to a Xml element that has an attribute named Id with the same value as the annotation's one.
(The XML file will probably have multiple Id elements, in them is some content which isn't important for the plugin's purpose)

let's illustrate it for clearance :

The XML file :
<queries>

   <query id="exampleId">
                SELECT * FROM CLIENTS
   query>

   <query id="anotherExampleId">
                SELECT * FROM CLIENTS where CLIENT_NAME=@CLIENT_NAME
   query>

</queries>

The CLASS file :
@RefId(Id = "exampleId")
public interface MockForTesting {
}

The language behind the xml & annotation is not important for the plugin development, so will not be further elaborated.

The requirement was that on mouse-click or keyboard-shortcut on the Id, on either the class
file or xml file, the cursor will jump to the corresponding Id.

So I started digging a bit in jetbrains' plugin repository and try to find a plugin that does exactly that or at least close to it.
well I found the JumpToUsage plugin which is pretty cool one, all sources are included &
it pretty straight-forward, so understanding the code wasn't hard, the thing is the IntelliJ openApi
is filled with Factories & Utilities that can do practically everything, but! how the hell you suppose to find the right Factory or utility class the meets your needs?

Well it's hard, that's the answer :)

A few tips for starting a plugin development:
  1. Try to find an open source plugin that provides a similar activity for your needs, you may have to change a lot of the code, but it will give a great start getting familiar with the provided tools.
  2. Download Jetbrains OpenApi sources, and attach them to your project, you soon find out that most of the classes are not placed in the proper packages.
    So there's a lot of work to do here if you want all the classes arranged properly, but no need, just move the classes to their right packages when you need to see their sources.
  3. After understanding the basics of the plugin development from an example project,
    create a new plugin project, construct a small activity or component and debug it,
    the first time you do this - IntelliJ will open a new instance (like after a fresh installation)
    so configure and let it run your plugin, if you have a Breakpoint placed in a proper place, you get to see if it all worked, and you're set for starting some real coding.

End of Log entry 1.0.0

Tuesday, November 16, 2010

Knowing the RIGHT languages, my objective POV

There are so many programming languages out there, one in his thirties should ask him/her self a few questions when working in this hectic industry.
Am I working with the right language, am I getting myself familiar with the languages that will take me to the place that I want to eventually be?

Well, I'm in that place in life, as a Java programmer, and former .NET programmer, I want to know that the language that I learn and specialize more & more everyday will get me the the place that I so desire to be, which I actually don't know what it is...yet!

One field in the programming realm that always excited me, is the Gaming world. I just came across another nice Open API for Game developing, Unity3D is the name, which provides
nice interface and an API that works under (or above) C#, Javascript or BOO.

So my current work place (that I develop solely on Java) doesn't help me a lot there.
My knowledge in .NET and specifically in C# is pretty good, but it's not near my Java knowledge which accumulated during the past 3 years, even though I had a few side projects in C# during the last years, they were on my own, so the requirements and guidance was lacking, and it shows :)

Is the future of us programmers to dwell in the Blogs and forums for an answer ?
well, I guess for me, for now, it is...cause I live in a country that the possibilities in game developing are so small, they practically don't exist.

And the work in a field that is not so exciting, can be a downer, maybe not at the beginning but someday, sometimes.
For now, just continue enriching your knowledge & expertise, maybe an answer will find you :)

Saturday, October 23, 2010

Party of Five - A Tale Of Java Servers

PROLOGUE

I've been working with a few JBoss servers which, or should I use the word Who instead..well who are responsible for all Distribution processes in my Company, Distribution means - sending all wanted material from the System to the out side world.

The outside world means - Printers,Fax Server, Email (Mail Server) and any kinda of a Network repository storage place you can imagine.
The servers also take part in building & constructing the data it suppose to distribute, like fetching data from the DataBase, and invoking all kinds of reports generating tools that construct documents as a result. all the data is finally converted to PDFs and then makes the it to the final stop - the Distribution final destination (Printer, Fax Server etc').

Well it's all sound really interesting doesn't ? well actually it is, and the thing that can be really interesting, is to see this family of servers servicing a roughly 1000 clients in real-time, with many of different requests and factors that influence the construction phase of the data in a myriad of ways. not to forget the fact that running in multiple threading environment that it is massive as this can be really fascinating to observe and learn from.

So after a few years of watching and encountering many scenarios and solving many problems I thought, why not put it on paper...or the Internet, which is the same thing our days, for the benefit of others, well if nobody will read this, no matter, at least I had fun writing it.

Now the Tale of the Family of servers begins, I'll start the story & end this prologue introducing the family -
  • There's the 2 Big Brothers who are responsible mostly on producing a big piece of the documents and placing them in Storage. we call them the "Storage brothers".
  • There's Printery who constructs data (PDFs documents) and zip them for delivery to an outside printery that will print & deliver the documents to the clients.
  • The Printing Server handles requests sent to local (In house) Printers, there are about 120 of them, most of them HP, some Lexmark and Xenon.
  • Last but not least, there's the Non-Printing Server, with a respect to his name handles all the other stuff, like Faxes,Emailing,Sms sending and more.
So this is the family, the party of five

Sunday, October 17, 2010

Spring's Expression languge (SpEL) not just a lexical parser

I've been messing around with Spring 3.0 biggest new feature the SpEL (Spring expression language) and like all Spring's tools, it's a real treat to use & test.
At my work place I was asked to write a presentation to show the people it's wonders, so I've decided to share it with the rest of the world :)

* I've written a lot of test cases, but haven't uploaded them yet, hopefully I'll find the time to upload it in the near future.

I would like to mention Craid Walls whom I took some ideas for my presentation.
As well as Dhruba Bandopadhyay who wrote a great article that explains some of SpEL's extensive features - spring-expression-language-spel-primer

Saturday, March 27, 2010

Java calling Powershell Script via C# & JNI

I've been messing around with JNI for a few weeks now, all started for one little purpose, executing Powershell script from Java.
Well the journey started using Java's Runtime object, but problems with the socket opened to the Powershell process forced me to choose another way.
Well I do come from a .NET background and I love C# so I ventured a bit on the options C# have interacting with Powershell and found the best way (for me :) ) to make it so.

More information + some code examples and free source code can
be found under my project in google-code :
http://code.google.com/p/jnicsharp
Love to get any thoughts, improvements, or even silly notes about it, enjoy :-)