Geertjan is a DZone Zone Leader and has posted 457 posts at DZone. You can read more from them at their website. View Full User Profile

Interview: Google Protocol Buffer Plugin for NetBeans IDE

01.30.2009
| 18715 views |
  • submit to reddit

One of the students in the recent NetBeans Platform Certified Training in Warsaw, Piotr Tabor, has been working on a very interesting certification project: treating NetBeans IDE as a tools platform, he's created features for working with Google Protocol Buffers.

Certification projects are, essentially, homework that students do after the course to prove that they have understood the material. They can choose the topic themselves, so long as it involves the usage of the NetBeans APIs in some way. Upon successful completion of this homework task, they become NetBeans Certified Engineers. Below follows an interview with Piotr, where he talks about his project, the things he learned, and the NetBeans Platform in general.

Hi Piotr, can you start by saying a bit about who you are? I'm a PhD student at the University of Warsaw. I am working on new ideas connected to object databases and database query languages (http://sbql.pl/). For a living, I'm working as a Java Architect and developer, creating infrastructures that enable the integration of web portals.

You created a NetBeans plugin for 'protocol buffers'. Why did you do that? I like "protocol buffers" and there was no support for this technology in IDEs (neither NetBeans IDE nor Eclipse). And I also had to do a project to finish the NetBeans Platform Certified Training. The plugin's project page is http://code.google.com/p/protobuf-netbeans-plugin/.

Can you say a few things to introduce us to 'protocol buffers', such as who uses them and why? Protocol buffers ("protobuf") is a technology by Google that has similar goals to XML: a data interchange  format that is hierarchical and independent of the platform and developer's environment. The problem with XML is that it is very slow in parsing and that it is space ineffective. There is no such drawback in protobuf, because of its binary format.

To use protobuf, you have to write a description of a message, in a simple but special language, and then use the "protoc" (protobuf compiler) program to generate serialize, deserialize and transport classes for Java, C++ and Python. There are also "unofficial" (not provided by Google) generators to other languages.

You can also generate an RPC service, based on the message format you created. That's a very effective alternative to Web Services.

So your plugin supports this language. Can you describe the main features? I provided editor support for *.proto files (message format description files), with syntax coloring, tree navigation through the code, error markers on the lines where the error is found, and context-aware code completion:

You also can regenerate code (using protoc), by selecting the "Regenerate" action from the context menu.

Finally, I created my own Update Center, which contains the modules that make up this plugin. Go here to see it, register it in the Plugin Manager, and you'll be able to install my project into your IDE.

Can you show some more screenshots?

Error marks in the editor:

Syntax navigation:

Generate Java code from Proto file in the editor:

Generate Java code from multiple Proto files in the explorer views:

Proto file template:

Options window extension for Protoc compiler:



Which feature was the most challenging to create?
Context aware code completion was the most complicated  part  of the code. There were two problems:

  • How to acquire ASTTree (parsing result of current code) from Schliemann. I found the sources of the "AST Browser" in NetBeans to learn how to do that.
  • How to know in which syntax construction the caret  is? The problem was connected to the fact that Schliemann recognizes whitespace chars (SKIP syntax tokens) as part of previous syntax construction.

What are the main NetBeans API classes that you used?

  • Schliemann
  • AST* from "General Language Framework" API
  • CodeCompletionProvider
  • FileObject
  • DataObject
  • Node
  • Annotation
  • OutputListener
  • NbProcessDescriptor.

Did you enjoy creating the plugin? What did you like most & least about creating it? Sure. It's quite simple compared to the usefulness of the results you acquire. There is only the general "huge API" problem: there are so many things available in the API that you never really know if the functionality you are coding is already available in existing NetBeans API libraries or not.

Do you have any tips for people beginning to use the NetBeans Platform?

  1. Search for tutorials via Google, in the NetBeans Developer FAQ, and on the NetBeans Platform Homepage.
  2. Look for similar functionality as you need in already existing plugins and in NetBeans IDE itself. Examine the sources and then write your code.
  3. Install "Tools" -> "Plugins" -> "Available Plugins" -> "NetBeans API Documentation". NetBeans code completion for NetBeans API classes is very helpful.

Are you going to continue developing this plugin and, if so, which features will be added next? Yes. At least I want to fix bugs and it would be cool to integrate code generation with the build process. I'm not sure if I should do that by coding in my plugin automatic tweaking  ./nbproject/build-impl.xml file or is there some layout.xml binding to provide my own build goal for "generate-sources" phase. (It works this way in Maven 2, to which I contributed some time ago ).

Any final thoughts? Thanks to Karol Harezlak, Toni Epple and Geertjan for the NetBeans Platform Certified Training in Warsaw, where I learned that creating plugins is relatively easy.

 

AttachmentSize
fig.png63.54 KB
contextCodeCompletion.jpeg156.37 KB
errorMarking.jpeg48.25 KB
navigator.jpeg140.09 KB
options.jpeg39.99 KB
regenerate1.jpeg54.88 KB
regenerateMulti.jpeg48.01 KB
template.jpeg71.72 KB
Published at DZone with permission of its author, Geertjan Wielenga.
Tags:

Comments

Bryan Low replied on Mon, 2012/12/24 - 10:58pm

Tanah Merah New Launch is also near top level educational institutions such as Anglican High University, St. Anthony’s Canossian Primary& Extra University and Temasek Younger Higher education. Tampines Younger Higher education, Temasek Polytechnic and World Higher education (East Campus) is also around in the place.

For vehicle business owners, it needs less than 25 minutes to generate to the business hub and amazing Orchard Road purchasing area, via Pan-Island Expressway (PIE) and Southern southern Shore Expressway (ECP).A amazing and exclusive way of way of way of life is looking forward to you.Please see urban vista venture details and floor programs for more details.

Bryan Low replied on Fri, 2013/02/01 - 10:11pm

Twin Fountains EC facilities provide full family entertainment needs for your family and loved ones. Indulge in a serene and tranquil lifestyle right in the heart of Woodlands.

Twin Fountains Woodlands

Eric Lim replied on Wed, 2013/03/06 - 8:21am

Thank you for sharing with us on Google Protocol Buffer Plugin for NetBeans IDE.

New launch  | Urban Vista 

Bryan Low replied on Mon, 2013/03/25 - 3:21am

Great Post. I have not been visiting the site recently. Took a visit again and there were some great comments on the site. Excellent post. Keep up the good work.

Belgravia Villas

Andy Man replied on Wed, 2013/04/03 - 10:52am

 Belgravia Villas  is going to launch in May. Located in Ang Mo Kio Ave 5, it is the one and only cluster along the road.

Matt Coleman replied on Mon, 2013/04/08 - 2:51am

great interview...it has a lot of insights

 buffalo logo design 

At Ppty replied on Sat, 2013/04/20 - 1:50am

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work 

Corals at Keppel Bay 

Bryan Low replied on Tue, 2013/04/23 - 2:25am

Great Post. I have not been visiting the site recently. Took a visit again and there were some great comments on the site. Excellent post. Keep up the good work.

Ecopolitan

At Ppty replied on Sun, 2013/04/28 - 11:11am

Great Post. I have not been visiting the site recently. Took a visit again and there were some great comments on the site. Excellent post. Keep up the good work.Corals at keppel bay 

Bryan Low replied on Tue, 2013/05/14 - 7:20am

J Gateway is also near elite schools such as Fuhua Primary School and St Anthony Primary School. Yuhua Primary School and Shuqun Secondary School are also around in the area. Jurong East Condo

At Ppty replied on Wed, 2013/05/15 - 12:00am

Thanks for your insight for your fantastic posting. I’m glad I have taken the time to see this. The Trilinq 

Bryan Low replied on Sat, 2013/05/25 - 12:34am

For vehicle owners, it takes less than 30 minutes to drive to the city area, via Central Expressway (CTE) and KPE (Kallang-Paya Lebar Expressway). A wonderful and unique lifestyle awaits you. Please see Jewel at Buangkok project details and units available for more information. Jewel at Buangkok Condo

Jimmy Lui replied on Mon, 2013/05/27 - 12:35pm

Its not my first time to go to see this site, i am visiting this website dailly and get fastidious facts from here all the time. Belgravia villas 

Bryan Low replied on Fri, 2013/05/31 - 1:27am

Coral Edge Residences is a 99-years leasehold Punggol EC development located at Punggol Walk in District 19. With expected completion in mid 2016, it comprises of TBA towers with TBA units and stands TBA storeys tall. It is situated right beside Punggol MRT Station. Future residents will be able to access the nearby Compass Point and Rivervale Mall which is a short drive away for some family fun and gatherings. A truly unique lifestyle awaits you. http://coraledge-residence.com

Bryan Low replied on Tue, 2013/06/04 - 12:41am

For vehicle owners, it takes less than 5 minutes to drive to the business hub and vibrant Orchard Road shopping district, via Pan Island Expressway (PIE) and Central   Expressway (CTE). DUO Residences

Toki Kim replied on Tue, 2013/06/11 - 10:27pm

 Thanks for the info given above. In the meanwhile, can you look at this a well.

http://tp180singapore.info/ 

www.propertyhive-sg.com 

riversailsofficial.com 

duo


Toki Kim replied on Tue, 2013/06/11 - 10:30pm

 Hi Thanks for all!

TP180 

Hive 

RS

duo

Bryan Low replied on Mon, 2013/06/17 - 12:40am

A wonderful and unique lifestyle awaits you. Please see Lush Acres EC project details and floor plans for more information. Fernvale EC

Bryan Low replied on Mon, 2013/06/24 - 1:32am

A wonderful and unique lifestyle awaits you at Woodlands. Please see Forestville EC project details and floor plans for more information. Woodlands EC

Bryan Low replied on Tue, 2013/07/02 - 8:56pm

Former Tai Keng Court will be accessible via Bartley MRT station on the Circle Line. Commuting to Toa Payoh and Paya Lebar area as well as the city area is therefore very convenient. It is also near to many eateries along the Upper Serangoon area as well as NEX shopping mall. Former Tai Keng Court

Bryan Low replied on Mon, 2013/07/08 - 9:13pm

Kensington Square is also near elite schools such as Cedar Primary School and St. Gabriel Secondary School. Paya Lebar Methodist Girls' School and DPS International School are also around in the area. http://kensingtonsq.org

The Tembusu replied on Fri, 2013/07/12 - 12:54am

THE TEMBUSU , the stunning architecture of this development is designed by multiple award winning architects Arc Studio Architecture + Urbanism, truly an iconic structure & beautiful facade along Tampines road with this eye-catching residential development. Residents of The Tembusu will also benefit from the well conceptualized design with both comfort & layout efficiency in mind and every unit will also be furnished with  the finest quality fixtures providing you a luxurious yet contemporary home that you deserve.

The Tembusu replied on Fri, 2013/07/12 - 12:56am

THE SKYWOODS  is located within an established private housing estate, enjoying good accessibility to major arterial roads and expressway such as Bukit Timah Expressway (BKE), Pan Island Expressway (PIE) and Upper Bukit Timah Road.

Bryan Low replied on Sat, 2013/07/13 - 6:44am

For vehicle owners, The Glades takes less than 25 minutes to drive to the business hub and vibrant Orchard Road shopping district, via Pan-Island Expressway (PIE) and East Coast Expressway(ECP). The Glades by Keppel

The Tembusu replied on Thu, 2013/07/25 - 12:50am

 The Tembusu, weaving nature into architecture, it is a piece of art that many will covet…

http://www.thetembusucondo.org 

The Skywoods replied on Fri, 2013/07/26 - 9:05am

The Skywoods  , a brand new luxurious residential development along Dairy Farm road, in the Upper Bukit Timah neighbourhood, will be adorned with lush greenery within and set with a picturesque backdrop of forested area with the likes of Dairy Farm Nature Park and Bukit Timah Nature Reserve catering to the affluent lifestyle of the locality.

 

The Skywoods replied on Fri, 2013/07/26 - 9:07am

The Skywoods  will have several layouts accommodating to the different profiles seeking a lifestyle living so near to the nature and yet only a few minutes walk to the future Hillview MRT Station (Downtown Line, Estimated Completion in 2015).

 

The Skywoods replied on Fri, 2013/07/26 - 9:08am

Mon Jervois  , is a very rare District 10 new launch development nestled in a prestigious and highly sought after residential neighbourhood at Jervois road, an exclusive prime location within close proximity of Good Class Bungalows and various embassy such as High Commission of Brunei Darussalam, High Commission of Malaysia and Embassy of Republic of Indonesia.

 

The Skywoods replied on Fri, 2013/07/26 - 9:10am

Heard of Jurong Lake District? Yes? No? If you have not heard of the Jurong Lake District Masterplan yet, you probably do not know that there will be an exponential growth with many ongoing & future exciting developments in our western regio. Jurong New Launch 

 

The Skywoods replied on Fri, 2013/07/26 - 9:14am

J GATEWAY , the 1st brand new condo development right in the heart of the biggest commercial hub outside city centre. A unique lakeside destination for business & leisure with a stunning new life in a spectacular new city.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.