[ANN] DisplayTag 1.0 RC2 Released
Fabrizio, the main man behind the Display Tag, has been fixing bugs and adding features at breakneck speed. Early this morning, he released the final 1.0 candidate for the Display Tag. Good stuff - thanks Fabrizio!
The Angular Mini-Book is a
guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and
deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.
Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.
For book updates, follow @angular_book on Twitter.
The JHipster Mini-Book is a
guide to getting started with hip technologies today: Angular, Bootstrap, and Spring
Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.
This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.
For book updates, follow @jhipster-book on Twitter.
Fabrizio, the main man behind the Display Tag, has been fixing bugs and adding features at breakneck speed. Early this morning, he released the final 1.0 candidate for the Display Tag. Good stuff - thanks Fabrizio!
It's Saturday morning and I plan on learning more about Tapestry this morning. There's pretty light attendence in the room. Too bad - I bet if it was a JSF talk, the room would be packed. In this talk, we're actually going to build a real application on-the-fly.
Why another web framework?
Erik says its one of the few frameworks that embraces JavaScript so much. I dig this b/c I think JavaScript is important for web development. Look at what the GMail guys have done with JavaScript. It'd be wicked cool to have this sort of thing open-sourced so we could all create GMail-type interfaces.
Dirty Laundry
Workbench Demo - DatePicker component does do i18n (very cool!). Client-side validation does one-field at a time, like WebWork does. I prefer the "all messages in one pop-up" approach that Commons Validator has. Pallete component looks very cool - you can move and re-order items from a multi-select on the left to a multi-select on the right. Chart component looks pretty cool - you can generate graphs very easily. Unfortunately, it's not part of Tapestry, but you can see how to do it in the Workbench app. If you want to see an online version of the workbench, I have it setup on my server.
Repositories for components: Tacos, Tassel, T-Deli and a few mentioned on the wiki.
To bring a component to life, you simply add a "jwcid" to an HTML tag. You can specify initial values for page properties using <property-specification initial-value=""> tag in your template's .page file. The value is implicitly an OGNL expression, and you can define lists using "{'value1', 'value2', 'value3'}". This is great for prototyping before you have a backend or even a page class. To remove elements in a page, specify jwcid="$remove$" on an HTML element and it'll be removed at render time. The restriction is you can't have Tapestry components inside a $remove$ component.
If you don't want to use abstract methods (and hence classes) in your page class, you can use getProperty()/setProperty() methods. However, the recommended way is to use abstract methods.
Templates - two different types. You can put the @component stuff directly into your page - or you can use jwcid's and refer to a name that's defined as a <component> in your page-specification XML file. The Border component can be used to do page decoration like SiteMesh. You can use the Shell component to declare stylesheets/scripts on a per-page basis. This is something I do a fair amount, so it's nice to see it's built into Tapestry.
Internationalization - Resource bundles are component specific (one .properties per page). In a .page, you use <message-binding>. In a template (.html), you use attribute="message:key" or <span key="">. The "key" attribute can't be used on any ol' HTML element, only on the <span> tag. In .java, you use getMessage() and format(). You can also define a custom message source (i.e. read messages from a database). I'm impressed with how easy it is to do i18n in Tapestry. It's also cool that i18n is built-in for templates. Just include a locale extension on your page and it'll be rendered for users with that locale. For example, home_fr.html will show up for users with the French Locale.
Engine - gets all requests. Visit class - POJO that acts as like an HttpSession. You can configure it in the .application file. You can talk to your "Visit" class in a template using "ognl:visit". To call methods on it, just use "ognl:visit.method". Majority of services originate in the Engine. Generally override createXXX methods. Engines can be pooled or created on a per-session basis.
If you override the createXXX methods in Engine, you change the behavior for:
contrib:Table - to override use <tr jwcid="columnColumnValue@Block"> - where "column" is the name of the column. Using this, you can easily put links and such into a table cell. Built-in TableModel can be used to talk directly to a JDBC DataSource. The TableModel is smart in that it only brings back the rows it needs to display. Add an exclamation point to the beginning of a column name to turn off sorting for that column. i18n is built-in for headers - the name of the column is simply looked up as a key in the page's .properties file.
Exception handling - Bail out by throwing an ApplicationRuntimeException. This tosses you to the default exception page, which you can override and "pretty up".
Validation - it's robust, but it can only validate <input type="text">. Erik thinks that Tapestry's validation framework could be much simpler and easier to use.
Dynamic Templates - can implement a IDelegateSourceTemplate and pull templates from a database or content-management system. To register your new TemplateDelegate, you can just register an <extension> in the .application file and point it to your class.
Page Lifecycle - initialize(), PageRenderListener(), PageValidateListener(), PageDetachListener(). Can use an ExternalCallback and ICallback to set properties on one page from another. Callbacks look very cool and there's a lot of discussions about them on the mailing list. The VLib app has a fair amount of callback examples.
This was definitely a good Tapestry session - thanks Erik.
One of the major issues in XDoclet's JIRA has been the fact that XDoclet doesn't work with JDK 5.0 syntax. After many comments and lots of debate, Anton Adamansky has submitted a patch. If you want to use XDoclet with JDK 5.0 - you might want to give this patch a run for its money. Hopefully we can get it included in XDoclet in the near future.
You can learn Ruby in 4 hours. This talks isn't to learn Ruby, but rather to show facets of Ruby. Ruby has made programming fun again for Dave. It's also made him more productive.
Languages and tools make a difference
Ruby has variables, methods, but no types in methods. When Dave first started using Ruby, he had a strong typing background - and was terrified of Ruby's un-typed feature. He first thought Ruby was a toy language for hobbyists because of the lack of typing. Now, many years later, he really likes the lack of typing and hardly even has bugs relating to typing. He notes that with Java we store most of our data in Collections - and those are all Objects - so Java is essentially un-typed as well. How often do you get ClassCastExceptions? The rooms concensus is not not a whole lot. To make up for the lack of typing, Ruby developers tend to write a lot more unit tests.
ActiveRecord - Ruby O/R Mapping Library
Ruby on Rails - not a single line of XML. Uses intelligent defaults and allows you to override them. The following creates a wrapper around the "ranks" table.
class Rank < ActiveRecord::Base end
The original author of RoR thinks that every database table should be plural, so singular class names map to plural table names. It's even smart enough to change Person to a "people" database table. Apparently it has a bunch of the singular-to-plural mappings for the English language built-in. The key to Rails is clever defaulting - allow you to write a lot less code, but override if you really need to.
ActiveRecord has many lifecyle hooks (17) that you can override. For example, before_save, before_destroy, validate. For example
def before_save self.when_added ||= Time.now end
I wonder if Rails has any support for transactions and specifying propagation behavior on transactions? I asked Dave this question and it sounds like ActiveRecord has a rich support for transactions - and even wraps the "save" method with a transaction by default.
"Ruby is pretty damn good at web applications"
Simple CGI is a common choice. FastCGI and mod_ruby in Apache are other common choices. There are also a number of different web frameworks for Ruby:
Ruby on Rails - MVC Framework
Contoller - one method per view. Setup context (a.k.a. the model) for views. Views contain "rhtml" - HTML with embedded Ruby. Lots of helper functions. Can access model data (context) setup by Controller. The name of the method in the Controller determines the name of the view file. A "select" method will dispatch to a "select.rhtml" file. The method name to call in a Controller is determined by the URI - for example, /ranks/view calls the "view" method in the RanksController class. Pretty slick! I like the idea of smart defaults - IMO this should be used a lot more in webapps. I'd love to get away from mapping URLs in Struts, Spring and WebWork.
Rails has built-in support for configurable URLs - so you can change query strings to more slash-type URLs. What about things like client-side validation, success messages and sortable/pageable tables? Do those exist in Rails? I asked Dave and he said said they have good support for success messages with a "flash" concept and the post-to-redirect problem is almost non-existant because most controller invocations are redirects. Client-side validation and sortable/pageable tables don't exist in Rails.
Rails has Needles - and IoC framework similar to Pico. However, there's a fair amount of traffic on the mailing list and a lot of Ruby developers think they just don't need IoC. Dave's suggestion is to use Class Injection.
The largest Ruby application is probably Daves - 55,000 lines or code, couple hundred thousand users. There are entire companies who write all all their applications in Ruby. The founder of Rails wrote it so he could write Basecamp - which is only 4500 lines of code.
Good stuff Dave - and definitely a nice overview of Rails. Will I be digging in an using Rails anytime soon? Not this year, I'm going to have some fun with Tapestry and JSF first. Maybe next year.
SmartFactory - one factory for all factories. Allows developers to handle failures rather depending on various factories. Unfortunately, you will have to do Casts. Stuart things that Generics should've never been added and instead we should just have no casts. Instead, the compiler should inject the cast implicitly.
Document d = SmartFactory.getInstance();
Java might be a lot more powerful if we could return a different type from constructors - like Class Clusters in Objective-C. You can get a lot of dynamic features in Java using AspectJ. Java Developers have a lot of responsibility when they start using aspects.
Stuarts talk was 3 hours and I only attended the first half. He's a very good speaker and I enjoyed listening to him more a lot. The basic gist of his talk seemed to be that Java should be more dynamic, and using AspectJ, it can be. I thought he was going to recommend we switch languages - so I was surprised to here him recommend AOP. The last example he gave was how to interrupt a FileInputStream so you could test the condition in a unit test. I can see how this could be quite useful for causing network or database failures and seeing how your application behaves.
The first session I attended was Erik Hatcher's Ant Hacks talk. The first half of his talk was about Ant in general and was most of the stuff covered in Java Development with Ant. The good stuff was the 2nd half when he covered all the new stuff in Ant 1.6. Steve is working on an update to Java Development with Ant - shoujld will be a lot thinner. Below are some notes I took on what's new in 1.6.
I really liked Erik's talk because AppFuse was inspired by his Java Development
with Ant book. Its build.xml file was intially based on Erik's sample app
and therefore, the first half of his talk pretty much pointed out tips and
tricks that I'm currently using. The 2nd half of his talk was highlighting
the new features of 1.6 - which he's suggested I adopt in the past. I've
never had much desire (or time) to dig in and update AppFuse's build.xml
file to 1.6. However, after attending his talk - it seems like it should
be pretty easy to do. Good bye <antcall>, hello <macrodef>.
Later: One of the coolest things I saw in Erik's talk was how his Ant logging was color coded. I asked him about it and all your need to do is specify "-logger org.apache.tools.ant.listener.AnsiColorLogger" in an ANT_ARGS environment variable. Good stuff!
It's time for another NFJS conference. I attended the one in June and had an awesome experience. I doubt I'll cover it as much as I did last time, that's just a lot of work - not to mention my cell phone's data bill was $300! As I look through the sessions, I'm noticing that it's a great thing to attend 2 of these conferences - b/c you can skip all the sessions you saw the first time. Since there's usually 2-3 good ones per time slot, reducing that down to 1-2 is nice.
This afternoon, I'm planning to attend sessions by Erik Hatcher and Stuart Halloway. Erik for Ant 1.6 and Subversion (maybe even Lucene) and Stuart for "dynamic, reflective languages". Since much of AppFuse's build.xml is based on Erik's Java Dev with Ant sample app, it'd be nice to figure out how to take advantage of 1.6 features (especially since 1.6.2 is required). I've never seen Stuart speak before, but I've heard he's excellent.
Saturday I plan on learning more about Tapestry from Erik (in a 3-hour session!). Since adding Tapestry to AppFuse is my next open-source development effort, this weekend and ApacheCon are good opportunities to learn more about it. I know, I should just buck up and read the book (I made it to page 100 a couple of weeks ago, nothing since), but it's tough to find the time.
I'll probably skip out tomorrow afternoon and work on Spring Live since Chapter 10 is due by Monday and I'm not done yet. Sunday, I'll be talking about AppFuse making open-source easier. "Brain, get ready to be stuffed."
We're finally getting started at 6:25 and we were supposed to start at 5:50. Good ol' projector issues. This time it was a bent pin.
J2EE 1.4 introduced the first web services component type (SE) and augments EJB specification (2.1) to expose SLSBs as a web service endpoint.
Writing J2EE 1.4 web services ("endpoints")
Two J2EE components to implement a web service:
JSE is easier because it's (mostly) POJO based. EJB might be preferred if you already have EJBs or you need transaction management. However, the SOAP client calling the EJB web service does not participate in the transaction (at least the spec does not define it).
"Mandatory" transaction attribute not allowed in EJB endpoints because SOAP client can't propagate transaction.
JSEs are similar to servlets:
Steps to writing a web service JSE:
1. Write remote interface (the
service endpoint interface) - must extend java.rmi.Remote and throw
RemoteException
2. Write implementation class
3. WSDL Document
4.
Deployment Descriptors (web.xml and web-services.xml)
5. Create WAR File
J2EE 5 will allow you to turn any POJO into a web service - no interface needed. Apache Axis can be used to generate the WSDL for you with Ant. You map the implementation class as a servlet, with a servlet-mapping and everything. The difference b/w JSE's and servlets is you can only map one JSE to one URL.
Writing web service clients. Client model is defined by the JAX-PRC 1.1 spec. You can write web service clients using three JAX-RPC techniques:
1. Generated Stub - Easiest. Done at development time. JAX-RPC is invisible to your code. Stub classes hide it. Runtime implementation will be tied to a vendors JAR because vendor tool will generate class based on WSDL.
2. Dynamic Proxy - Most Portable. Done at runtime. Your code asks JAX-RPC factory to create stub at runtime that implements SEI (Service Endpoint Interface).
3. Dynamic Invocation Interface (DII) - No Stub Necessary. Useful for tools - e.g. dynamically retrieve WSDL then show user on a GUI what services are available and allow user to select what should be called. Client sets URL, methods to invoke and required parameters.
Future of J2EE web services. JAX-RPC 2.0 (JSR 224) in the works. The goals of JAX-RPC 2.0 are several:
Tom's presentation was quite good for his situation. There was a *ton* of technical issues and he had to show his presentation on Chris Huston's Powerbook. This meant no demos since he had JBoss 4.0 and everything else setup on his Windows laptop. After flailing about for the last hour - he admits its time to buy a Mac.
Apache Geronimo
1. Apache Software License
2. Uses other BSD-derived, open source
projects
3. Initial manifestation as a J2EE 1.4 application server 4.
J2EE 1.4 certified (in-progress)
Started a year ago in September. The main motivator for Geronimo was
there was no BSD-derived license for an open-source application server.
The GPL license requires you to contribute code back if you customize a
product. BSD allows you to do anything, you just have to give credit
back to the originator. Sounds like the proper license for AppFuse to
me.
The heart of Geronimo (the kernel) knows nothing about J2EE. It's
designed to do just about anything you want it to do - it's just a
configuration away. Jakarta project at Apache makes up a huge portion of
ASF projects. Many of these projects are pieces of the J2EE puzzle.
However, there wasn't any glue to hold it all together. Geronimo
re-uses a *lot* of existing (best of breed) open source projects.
Geronimo still doesn't support Tomcat. The main reason is because 3 of
the Jetty committers are part of the Geronimo team. Jetty was the first
component every deployed in Geronimo. According to Bruce, someone is
working on integrating Tomcat right now. You'd think this would be
pretty easy and only take a couple days to do. Maybe I'm wrong.
Geronimo is NOT another lightweight container, web framework, or AOP
framework.
It IS designed for long running servers. Its designed to tolerate partial
component failures. System oriented services.
Geronimo Kernel - Fundamental Core
Now Bruce is going on about Maven and how it works. ZZZzzzzz. Maven schmaven. He does have a good point though - it works great for building and managing multiple projects and their dependencies. Geronimo has 30 sub projects - yow.
A lot of concepts and architecture in Geronimo is derived from Maven. Hmmm,
I wonder if that means it's slow.
What are GBeans? They're a J2EE managed component (a JMX MBean), which are basically
simple objects plus some metadata. Used to bridge JSR-77 lifecycle requirements.
GBean wrappers allow just about anything to be plugged into be plugged into
Geronimo. Implement the GBeanLifecyle
interface: doStart(), doStop(), and doFail().
Bruce is now showing us the DerbySystemGBean that's used to stop and start GBean w/in Geronimo. Bruce has a lot of good things to say about Derby and thinks it's a much better database than both MySQL and PostgreSQL. That's a pretty strong statement, but since he met with Derby's architect last week, I tend to believe him. I'm assuming since I got AppFuse working with DB2 that using it with Derby would be pretty easy too.
Bruce says there's supposed to be a Geronimo release this week. I thought they were supposed to be done with Geronimo by this year's ApacheCon?
Now we're looking at an XML file that's a GBean configuration file. It looks like Spring is going to get some competition for long class names. And if you thought Spring's XML was verbose - Geronimo puts it to shame! I'm not saying this is a bad thing - it's just an observation.
GBean Archive - A JAR file that contains persisted GBean instances, GBean metadata. The Java classes in the GBean can reside in the JAR or be dependencies in a central repository.
GBean Descriptor - dependencies and configuration are defined in XML.
Repository: Structured collection of JARs. Designed to work in conjunction with Maven (pluggable implementation). Every JAR has a unique group and artifact id. Default repository is local file system, others allow auto-download.
Observation: Bruce's presentation is interesting - he seems to be targeting folks that want to dig into Geronimo and customize it. I think most developers just want to use it and would be more interested in seeing a demo of deploying an app on Geronimo, rather than how to integrate Derby or Jetty into the server. If it's so easy to plugin a component, why hasn't Tomcat been integrated? Maybe it's just me, I want to see it run and deploy apps to it - that's about all I want to do. In most cases, I shouldn't need to customize it. It's nice to know that it's an option though.
Basic Configuration Builder: Deployers are J2EE specific (JSR-88). If you have standards-compliant deployment descriptors - your application should deploy on Geronimo. Rather than calling them deployers, Geronimo uses "Builders". The Builders /deployers create configuration objects containing GBeans. Most complex Builder is J2EE deployer. It implements a JSR-88 deployment specification and accepts JARs, WARs, EARs, and RARs. You can also add in a deployment plan in XML. From this, a Geronimo Configuration ARchive (.car) is created. The nice things about these builder is you can do deploy-time optimizations, before the application is started.
Everything above the System Services and Kernel is hot swappable. You can remove the J2EE Configuration and replace it with something else like Pico or Spring. This means that you'll be able to swap out servlet containers w/o shutting down the server. That's pretty damn cool. If the system services and kernel are stable, and no JVM dumps occur - this means that your Geronimo server could be running forever. Sounds awesome.
High-availability (clustering, etc.) has not been built into Geronimo yet. This is primarily because this is not part of the J2EE spec. Developers are focusing on gaining 1.4 compliance, then they'll start looking at the fancy features.
Wow - good presentation Bruce. I feel like I know more about Geronimo than I ever wanted to know.
As I was getting ready to post the above transcript, I noticed that Geronimo 1.0 M3 was released. According to Bruce's presentation, this is the last release before 1.0. Nice work gents.
If you live in Denver, tonight looks to be another great DJUG meeting. Bruce will be talking about Geronimo and Tom will be speaking on J2EE's Web Services. The best part of these meetings is always the networking over beers afterwards. However, tonight there's an added bonus. Bruce is fun to heckle. Make sure and ask him tough questions and rag on the fact that he's using a Mac too.