<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Dru Devore&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/" />
<modified>2008-03-01T20:47:43Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/ddevore/305</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, ddevore</copyright>
<entry>
<title>Call for reasonable Java hosting</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2008/03/call_for_reason.html" />
<modified>2008-03-01T20:47:43Z</modified>
<issued>2008-03-01T20:45:38Z</issued>
<id>tag:weblogs.java.net,2008:/blog/ddevore/305.9297</id>
<created>2008-03-01T20:45:38Z</created>
<summary type="text/plain">Java can compete against other languages, scripting or not, even for small sites, but it needs the support of the industry and the availability of reasonable hosting to do so. 
</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>Java can compete against other languages, scripting or not, even for small sites, but it needs the support of the industry and the availability of reasonable hosting to do so. I know that Java is not the same as PHP and other scripting languages but I would think that the hosting could at least keep up a little better than it has.</p>

<p><br />
<h2>Question</h2><br />
Java has been around for a long time, has a large following, and was created, at least in part, for the web. So where are the hosts that are reasonably priced and current? </p>

<p><br />
<h2>My Experience</h2><br />
Years ago I tried out a Java enabled Go Daddy site and found it difficult at best. Recently I had the desire to create site and found that Go Daddy has reasonable prices and supports Java. Since I need a site anyway I decided to go ahead and get it and give it a whirl, figuring that they would have updated the Java support by now  I was wrong. Today I decided to put something on it to see what happens, now I remember why I stopped using it a couple of years ago. </p>

<p><br />
<h2>Problems</h2><br />
The problem with Go Daddy is that they are using Tomcat 5.0.27 on a shared server. They restart the server every night at 1:00 am Arizona time to reload any changes in the deployed applications, which would be fine for a stable site. My use of the site is considerably little less than production ready release on a schedule so this doesn't work well for me.</p>

<p><br />
<h2>The Need</h2><br />
My need and I am sure many others is for a site with more control at a reasonable price that I can put an application on for testing, something that is not on my home server because my ISP might get mad if people start hitting me. I need a site to put my programming musings, similar to the ones found in this blog but with less words.</p>

<p><br />
<h2>The Call</h2><br />
I have searched for Java enabled sites for years and have never found anything within reason for a reasonable price. I would like to see someone offering a site with JEE 5, Glassfish would be nice, and a reasonable amount of space for a good price. Something like what Go Daddy is doing but with a more resent server and hot deploy enabled. </p>

<p><br />
So who else would like to see something like this and how can we as a Java community do to get someone to do it? </p>

<p>I think that Sun should do something like this for small sites and offer it for free for development, demos, and Open Source projects. Like what SourceForge does but for Java deployment. Just think of the Java promotion this would provide.</p>]]>

</content>
</entry>
<entry>
<title>Web Service Creation error with Glassfish 2</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2008/02/web_service_cre.html" />
<modified>2008-02-29T01:47:37Z</modified>
<issued>2008-02-29T01:40:54Z</issued>
<id>tag:weblogs.java.net,2008:/blog/ddevore/305.9290</id>
<created>2008-02-29T01:40:54Z</created>
<summary type="text/plain">Workaround for a Glassfish bug where WSDLs are not created correctly when two web services in the same package have the same operation names. </summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>Lately I have been working with EJB 3.0, and I love it. For quick tests and to see what is being returned I threw web services around them. The services ended up being a really nice and easy test though it pointed out a bug in Glassfish 2. The bug has beenentered as an issue in Glassfish <a href="https://glassfish.dev.java.net/issues/show_bug.cgi?id=4267">here</a> if you are interested. Basically the problem is that if you have two services with operations that have the same name the WSDL generation becomes confused and creates the WSDL definition for one of the operations and uses it for both of the services. This leads to a problem that one of the operations will always throw an exception. If this isn't bad enough the duplicated operation is not always the same one, this took a while to track down why my service was erroring because sometimes it would throw an exception and sometimes it wouldn't.</p>

<p>Anyway I posted the problem to the Glassfish mail group and Bhakti Mehta replied and confirmed the bug and submitted it as an issue for me. He also found a workaround for me. So if you are having a problem simply add the following two annotations to the operations that are having the problem. </p>

<p>@RequestWrapper(className="servicetwoRequest")@ResponseWrapper(className="servicetwoResponse") </p>

<p>Thanks Bhakti for the help.</p>]]>

</content>
</entry>
<entry>
<title>JSF Tables with POJOs in NetBeans 6.0</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2008/02/jsf_tables_with_2.html" />
<modified>2008-02-13T03:31:49Z</modified>
<issued>2008-02-13T03:24:04Z</issued>
<id>tag:weblogs.java.net,2008:/blog/ddevore/305.9190</id>
<created>2008-02-13T03:24:04Z</created>
<summary type="text/plain">A continuation of working with JSF Tables with databases to include JSF  Tables being populated by POJOs.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[This is an addition to the JSF Visual Web JavaServer Faces in NetBeans Tutorial. For this information to be useful to you, you will have to have a JSF Visual Web JavaServer Faces project created. To create the project please refer to the <a href="http://weblogs.java.net/blog/ddevore/archive/2008/02/jsf_visual_web_1.html">earlier blog</a>. Also, this tutorial is basically a continuation of the <a href="http://weblogs.java.net/blog/ddevore/archive/2008/02/jsf_tables_with_1.html">JSF Tables with databases in NetBeans 6.0</a> so you may want to also take a look at that it.
<h2>Useful Data</h2>
I know that a lot of people out there in the Java world will agree that the table and other components, such that are found in JSF, are not useful in larger installations if the data only comes directly from a database. Most larger installations will require a MVC architecture and will even hide the data behind services and data access layers. Because of this I will now show you how to bind the table used in the last blog to an array as might be returned by a service.
<h2>Data Model</h2>
First we must have a data object to work with so lets make one for the address. First I made a package named model under the existing jsf.tutorial package then a class Address with all the same fields as in the database, just to keep things consistent. If you are really observant you will see that I changed the structure of my address to be more international, I changed the zip to postalCode and added a countryCode. The following is the Address class that I will use. 
<br/>
<pre>
package jsf.tutorial.model;

public class Address {
    private int id;
    private int type;
    private String line1;
    private String line2;
    private String city;
    private String state;
    private String postalCode;
    private int countryCode;
    private String note;

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public int getCountryCode() {
        return countryCode;
    }

    public void setCountry(int countryCode) {
        this.countryCode = countryCode;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getLine1() {
        return line1;
    }

    public void setLine1(String line1) {
        this.line1 = line1;
    }

    public String getLine2() {
        return line2;
    }

    public void setLine2(String line2) {
        this.line2 = line2;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }
    
}
</pre><br/>
As a side note you must love the auto generation provided by IDEs. 
<br/>
Next we will put an array of the Addresses in the SessionBean1. 
<br/>
<pre>
private Address[] addressArray;

public Address[] getAddressArray() {
    return addressArray;
}

public void setAddressArray(Address[] addressArray) {
    this.addressArray = addressArray;
}
</pre>
<br/>
Once we have done this we can then switch over to the Designer of Page1 and change the binding of the table to addressArray. If you right click on the table and select Bind to Data you will not see the addressArray though, which is a bug. For it to show up in the dropdown list in the Bind to Data dialog you must clean and build the project, do this now. Once it is cleaned and built you can then right click on the table and select Bind to Data and drop the list down and you will see addressArray (SessionBean1). Selecting this will give you a list of tables in alphabetical order which is not that hard to change, simply select the column and move it up or down. In this dialog you can also select which rows you do and do not want shown. <br/>
<img src="http://weblogs.java.net/blog/ddevore/bindData.jpg" width="434" height="303" alt="" border="0">
<br/>
<h2>Other things you can do</h2>
<br/>You can select each column and change the header text to capitalize the first chars if you would wish, this being the most noticeable at first. But you can change just about any property from the property editor upon selecting the column or table. If you would like you can also go into the JSP selection to modify it directly but that isn't nearly as fun as doing it in the designer. The property I like the most is the pagination settings on the table itself. You can add pagination to the table easily and give the user control that would normally require a lot of work. 
<br/><br/>
This is supposed to be able to work with Lists also but I have not seen it work yet. If anyone can confirm that it works with Lists and what build it works with please let me know.
<br/><br/>
That is it for now I hope you have enjoyed working with the tables with POJOs.
<br/>]]>

</content>
</entry>
<entry>
<title>JSF Tables with databases in NetBeans 6.0</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2008/02/jsf_tables_with_1.html" />
<modified>2008-02-08T01:27:13Z</modified>
<issued>2008-02-06T02:42:36Z</issued>
<id>tag:weblogs.java.net,2008:/blog/ddevore/305.9145</id>
<created>2008-02-06T02:42:36Z</created>
<summary type="text/plain">A tutorial for working with JSF tables populated from databases in NetBeans 6.0</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: NetBeans</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[This is an addition to the JSF Visual Web JavaServer Faces in NetBeans Tutorial. For this information to be useful to you you will have to have a JSF Visual Web JavaServer Faces project created. To create the project please refer to the <a href="http://weblogs.java.net/blog/ddevore/archive/2008/02/jsf_visual_web_1.html">earlier blog</a>. This is the project I will be working with in this tutorial.
<h2>Empty Table</h2>
This is what you would do to start with most of the components in JSF. First open Page1.jsp and you will see the Design selected with the nice grid.
<br/><br/>
<img src="http://weblogs.java.net/blog/ddevore/openPage1.jpg" width="727" height="324" alt="" border="0">
<br/><br/>
The next step is to select the Table from the Palette and click in the Designer. At this point you will have a page that looks like this.
<br/><br/>
<img src="http://weblogs.java.net/blog/ddevore/defaultTable.jpg" width="791" height="434" alt="" border="0">
<br/><br/>
If you run the project at this point you will get a page that looks just like the Designer above. This is because the default table data object DefaultTableDataProvider provides some data by default. The next step is to put some data into the table that is not simply the default. 
<h2>Database data in Table</h2>
For this part you will need a database connection defined, <a href="http://www.netbeans.org/kb/60/ide/mysql.html">please check here to create a connection</a>. Once the database is defined open the page designer with the table in it and select the Services tab. For this tutorial I have a database named JSFTutorial in MySQL with a table named address.
<br/><br/>
<img src="http://weblogs.java.net/blog/ddevore/tableBefore.jpg" width="790" height="254" alt="" border="0">
<br/><br/>
I will be using the address table, since it is the only table I currently have defined. To bind the JSF table to the address table simply drag and drop the table from the Services tab to the JSF table in the designer. You will now be asked to choose a target, select table1. Once do this you will see the table change to reflect the same number of rows as the address table with the same names as the columns.
<br/><br/>
<img src="http://weblogs.java.net/blog/ddevore/tableAfter.jpg" width="746" height="314" alt="" border="0">
<br/><br/>
That is all there is to binding a database to a JSF Table in NetBeans 6.0.
<br/><br/>
You can now change the column names and the table name by simply clicking on them or selecting the JSP tab of Page1 and change the headerText attributes. You can also select the table and check out the properties and see what they do, pagination is really cool. Next time I will discuss how to use different types of data for the table.]]>

</content>
</entry>
<entry>
<title>JSF Visual Web JavaServer Faces in NetBeans Tutorial</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2008/02/jsf_visual_web_1.html" />
<modified>2008-02-02T15:39:28Z</modified>
<issued>2008-02-02T15:38:19Z</issued>
<id>tag:weblogs.java.net,2008:/blog/ddevore/305.9119</id>
<created>2008-02-02T15:38:19Z</created>
<summary type="text/plain">Create a Visual Web JavaServer Faces project in NetBeans for use with other tutorials on using JSF components.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: NetBeans</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[I recently started working with JSF for more than simply messing around with the components. In performing this work I have found that some of the information needed to develop JSF seems to be missing or hard to find. Because of this I have decided to write up what I have found to pass along the joy of JSF.
<br><br>
Because the tutorials for working with Visual Web JavaServer Faces in NetBeans will require a project I will start by describing how to create a project. This should work in pre 6.0 but I have used 6.0 and the latest 6.1 dev version for this blog.
<br><br>
<h2>Create the Project</h2> 
Select File -> New Project. In the dialog select Web category and Web Application project then click Next.
<br><br>
<img alt="Choose a Project" src="http://weblogs.java.net/blog/ddevore/chooseProject.jpg" width="728" height="496" border="0">
<br><br>
In the next dialog give the project a name, I named mine JSFTableTutorial, and keep the default for Server, Java EE Verion, and Context Path. Then click Next.
<br><br>
<img src="http://weblogs.java.net/blog/ddevore/nameProject.jpg" width="728" height="496" alt="Name the Project" border="0">
<br><br>
In the final dialog select Visual Web JavaServer Faces for the framework and please change the Default Java Package, mine is com.jsf.tutorial yes I know it is not a good package name but it is better then the default jsftabletutorial. The rest leave as the defaults.
<br><br>
<img src="http://weblogs.java.net/blog/ddevore/frameworks.jpg" width="728" height="496" alt="Choose the Frameworks" border="0">
<br><br>
When you get done you will have a view in NetBeans similar to this. 
<br><br>
<img src="http://weblogs.java.net/blog/ddevore/projectView.jpg" width="691" height="232" alt="Project View" border="0">
<br><br>
This view shows the designer and the palette also in case you are unfamiliar with the NetBeans designer.
<br><br>
If you didn't get here from one of the tutorials on using JSF components you may be wondering why I wrote this. The reason is because I am writing multiple tutorials on using JSF components which all will need a project so here it is. 
<br><br>
Please check back for a list of tutorials on using JSF components.
<br><br>]]>

</content>
</entry>
<entry>
<title>EclipseZone writes about NetBeans winning &quot;bossie&quot; award</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2007/09/eclipsezone_wri_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-09-19T16:12:33Z</issued>
<id>tag:weblogs.java.net,2007:/blog/ddevore/305.8279</id>
<created>2007-09-19T16:12:33Z</created>
<summary type="text/plain">There is a good article at EclipseZone on NetBeans winning the bossie award. It is a fair article and was an interesting read.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[EclipseZone has an article on NetBeans winning the bossie award which ended up being a better article than I expected. The article can be found <a href=http://www.eclipsezone.com/eclipse/forums/t101384.html>here</a> the <a href=http://www.infoworld.com/article/07/09/10/37FE-boss-software-development_1.html>bossie article can be found here</a>.
<br/><br/>
I have been a long time NetBeans user and have used Eclipse in the past. My preference is NetBeans though I know Eclipse is a good ide also. The reason my preference has become NetBeans is because it has more out of the box than Eclipse and I would like getting as much as I can from the original and not have to worry about plugins. Some of the comments on the article were that Eclipse has more plugins and I can see why they would. First it has a larger user base and second it has less out of the box so it needs them. Another said that Eclipse beats NetBeans hands down for basic Java editing because of code editing, refactoring, and compile-on-save "feature". I don't think that the editing and refactoring are basically the same until NetBeans 6.0 is released. The compile-on-save is more of a nuisance to me than anything else. How many times have you saved a file and had Eclipse go into the world of not responding? 
<br/><br/>
I am done commenting on their comments you can read them yourself <a href=http://www.eclipsezone.com/eclipse/forums/t101384.html>here</a>. What I think the IDE wars will come down to is the people ingrained in one or the other will stay with it unless thy meet someone who has a very strong conviction on the other convinces them to give it a try. They may try it but will not likely change for good. Then you have the people on the fence they will change from one to the other and will not end up using either significantly more than the other. 
<br/><br/>
The only way I can see this scenario changing is if something happens to one of them that either spring boards them well above the other or one of the companies goes out of business, both very unlikely. If NetBeans wants to be have the larger market share they will have to get partners involved to promote NetBeans as the base of their tools. Eclipse does this which is where some of their share comes from. Personally I would rather be a leader than a follower but to increase numbers of users exposed to the wonderful features of NetBeans they will have to do something and this has worked for others. 
<br/><br/>
Now go read the <a href=http://www.eclipsezone.com/eclipse/forums/t101384.html>article</a> and let me know what you think.]]>

</content>
</entry>
<entry>
<title>Declare Variables Inside or Outside a Loop</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/08/declare_variabl_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-08-22T05:22:07Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.5404</id>
<created>2006-08-22T05:22:07Z</created>
<summary type="text/plain">This blog walks through the byte code for different scenarios of putting variables inside and outside a loop. Describing what is happening from the byte code level and which method is better.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Performance</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[The question has been asked many times by many different people. Is it better to declare variables inside or outside a loop. I did a search for this recently to find support for which is better. What I found was a lot of opinions with very little actual support for either position. My position has always been that it was more readable and better for performance and memory to declare variables outside loops.  
<h1>Overview</h1>
The question of readability is more religious but does have a little to do with performance. The question about memory and performance goes hand in hand and can be shown definitively. I am going to go through both questions and show the difference from the byte code level using javap. I am not a byte code expert but I will do my best to explain the code properly. If there is an error in my explanation please let me know. 
<h1>Primitives</h1>
For this example I will use the following methods: <br/>
<br/><code>
&nbsp;&nbsp;&nbsp;&nbsp;    public void testPrimitives1(int count) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        int a = 0;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (int i = 0; i < count; i++) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            a = i;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    }<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    public void testPrimitives2(int count) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        int a;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (int i = 0; i < count; i++) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            a = i;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    }<br/>
    <br/>
&nbsp;&nbsp;&nbsp;&nbsp;    public void testPrimitives3(int count) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (int i = 0; i < count; i++) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            int a = i;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    }<br/>
</code><br/>
Yes the examples are very simple. I did not want to get caught up in a lot of code in the byte codeup As you can see I am using 2 methods with the variable declared outside the loop. The reason for this will be apparent once we get to the byte code.<br/>
<br/><code>
public void testPrimitives1(int);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;  Code:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   0:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   1:	 istore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   2:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   3:	 istore_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   4:	 iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   5:	 iload_1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   6:	 if_icmpge	17<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   9:	 iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   10: istore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   11: iinc	3, 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   14: goto	4<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   17: return<br/>
</code><br/>
Looking at the first method above you can see the first 2 lines are iconst_0 and istore_2 this is the declaration and initialization of the loop variable, you will see it in the other 2 methods also. <br/>
The next 2 lines are iconst_0 and istore_3 these are the declaration and initialization of the int a = 0 variable.<br/>
The next 3 lines are the loading of the count parameter and the loop variable and the comparison of the two. <br/>
The next 2 lines are the loading of the loop variable and storing it to the a variable.<br/>
The next line is for incrementing the loop variable.<br/>
The only thing left is the goto for the loop and the return from the method.<br/>
You can see from this example that there is not a whole lot going on here. In long hand listing you have:<br/>
<ul>
<li>Declaration and initialization of the loop variable.</li>
<li>Declaration and initialization of the primitive variable.</li>
<li><b>Load the input parameter and loop variable and compare them.</b></li>
<li>Load the loop variable and store it to the primitive variable.</li>
<li>Increment the loop variable.</li>
<li><b>Goto the beginning of the loop.</b></li>
</ul><br/>
Lets now look at the next example.<br/>
<br/><code>
public void testPrimitives2(int);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;  Code:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   0:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   1:	 istore_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   2:	 iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   3:	 iload_1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   4:	 if_icmpge	15<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   7:	 iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   8:	 istore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   9:	 iinc	3, 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   12: goto 2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   15: return<br/>
</code><br/>
Looking at this method you can see the following, in the long hand listing method: <br/>
<ul>
<li>Declaration and initialization of the loop variable.</li>
<li><b>Load the input parameter and loop variable and compare them.</b></li>
<li>Load the loop variable and store it to the primitive variable.</li>
<li>Increment the loop variable.</li>
<li><b>Goto the beginning of the loop.</b></li>
</ul><br/>
The next example is:<br/>
<br/><code>
public void testPrimitives3(int);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;  Code:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   0:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   1:	 istore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   2:	 iload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   3:	 iload_1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   4:	 if_icmpge	15<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   7:	 iload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   8:	 istore_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   9:	 iinc	2, 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   12: goto	2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   15: return<br/>
</code><br/>
This one is exactly as the previous one with the exception of the storage location within the current frame. This is due to not initializing the variable in the previous one therefore not requiring the istore_&lt;x&gt; command. The storage locations in the current frame is because the variables are declared in a different order.<p/>
<h2>Primitive Conclusion</h2>
<h3>Performance and Memory</h3>
The second and third methods are functionally identical because I didn't initialize the variable in the second. Comparing them with the first method we have the only difference being the initialization of the primitive used. So you can say that they are all essentially the same with the first method having the initialization of the primitive. Now if you like are like me and like variables declared outside the loop you can do it with no real fear of a performance hit. If you like it declared outside the loop and want the best possible performance you can declare it outside and not initialize it. Since I don't like uninitialized variables I will take the small performance hit to have my variables declared outside the loop. 
<h3>Readability</h3>
I have always liked my variables declared outside the loop because I like the ability to look at the top of the loop to see what is used within the loop instead of looking through the loop. I do understand the arguments for declaring them inside the loop but would rather not make that change, see conclusion for explanation. What I do is if I am modifying existing code with variables inside a loop I will not change it but if I am writing the loop I will declare them outside the loop.<p/>
<h1>Objects</h1>
For the Object test I will use the StringBuffer with the following methods: 
<br/><code>
&nbsp;&nbsp;&nbsp;&nbsp;    public void testObjects1(int count) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        StringBuffer sb = new StringBuffer();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (int i = 0; i < count; i++) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            sb.setLength(0);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            sb.append(i);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    }<br/>
<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    public void testObjects2(int count) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        StringBuffer sb;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (int i = 0; i < count; i++) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            sb = new StringBuffer();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            sb.append(i);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    }<br/>
    <br/>
&nbsp;&nbsp;&nbsp;&nbsp;    public void testObjects3(int count) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        for (int i = 0; i < count; i++) {<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            StringBuffer sb = new StringBuffer();<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;            sb.append(i);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br/>
&nbsp;&nbsp;&nbsp;&nbsp;    }<br/>
</code><br/>
Like the primitives these test methods are very simple also. For those of you who are not familiar with StringBuffer the method setLength(0) sets the length of the character sequence to 0. StringBuffer is used in these examples because it has this method which is basically a reset method so you can reuse the object.<br/>
Now on with the byte code:<br/>
<br/><code>
public void testObjects1(int);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;  Code:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   0:	 new	#2; //class java/lang/StringBuffer<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   3:	 dup<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   4:	 invokespecial	#3; //Method java/lang/StringBuffer."&lt;init&gt;":()V<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   7:	 astore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   8:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   9:	 istore_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   10: iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   11: iload_1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   12: if_icmpge	32<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   15: aload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   16: iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   17: invokevirtual	#4; //Method java/lang/StringBuffer.setLength:(I)V<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   20: aload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   21: iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   22: invokevirtual	#5; //Method java/lang/StringBuffer.append:(I)Ljava/lang/StringBuffer;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   25: pop<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   26: iinc	3, 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   29: goto	10<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   32: return<br/>
</code><br/>
Looking at this first method you can see the following. The first 4 lines are for declaring and initializing the StringBuffer. The next 2 are for declaring and initializing the loop variable. The next 3 are for loading the loop variable and parameter and comparing them. The next 3 are for resetting the character array. Then we load the character array and loop variable. Next the loop variable is stored to the StringBuffer and the append method is popped off the stack. Then we increment the loop variable and return to the top of the loop. In the long hand listing method as used above it looks like this:<br/>
<ul>
<li>Declaration and initialization of the StringBuffer.</li>
<li>Declaration and initialization of the loop variable.</li>
<li><b>Load the input parameter and loop variable and compare them.</b></li>
<li>Reset the character array in the StringBuffer.</li>
<li>Load the character array and loop variable.</li>
<li>Store the loop variable to the StringBuffer and pop the append method.</li>
<li>Increment the loop variable.</li>
<li><b>Goto the beginning of the loop.</b></li>
</ul><br/>
Now lets look at the next example:<br/>
<br/><code>
public void testObjects2(int);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;  Code:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   0:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   1:	 istore_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   2:	 iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   3:	 iload_1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   4:	 if_icmpge	27<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   7:	 new	#2; //class java/lang/StringBuffer<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   10: dup<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   11: invokespecial	#3; //Method java/lang/StringBuffer."&lt;init&gt;:()V<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   14: astore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   15: aload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   16: iload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   17: invokevirtual	#5; //Method java/lang/StringBuffer.append:(I)Ljava/lang/StringBuffer;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   20: pop<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   21: iinc	3, 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   24: goto	2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   27: return<br/>
</code><br/>
This example is very similar to the last one and as in the primitives example exactly the same as the third example:<br>
<br/><code>
public void testObjects3(int);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;  Code:<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   0:	 iconst_0<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   1:	 istore_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   2:	 iload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   3:	 iload_1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   4:	 if_icmpge	27<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   7:	 new	#2; //class java/lang/StringBuffer<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   10: dup<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   11: invokespecial	#3; //Method java/lang/StringBuffer."&lt;init&gt;":()V<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   14: astore_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   15: aload_3<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   16: iload_2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   17: invokevirtual	#5; //Method java/lang/StringBuffer.append:(I)Ljava/lang/StringBuffer;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   20: pop<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   21: iinc	2, 1<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   24: goto	2<br/>
&nbsp;&nbsp;&nbsp;&nbsp;   27: return<br/>
</code><br/>
The long hand listing of these 2 examples are as follows:<br/>
<ul>
<li>Declaration and initialization of the loop variable.</li>
<li><b>Load the input parameter and loop variable and compare them.</b></li>
<li>Initialization of the StringBuffer.</li>
<li>Load the character array and loop variable.</li>
<li>Store the loop variable to the StringBuffer and pop the append method.</li>
<li>Increment the loop variable.</li>
<li><b>Goto the beginning of the loop.</b></li>
</ul><br/>
In these two examples you can see the exact same code as the first example with the exception of the order of the code and the reset method call in the first example. The big difference between the first and the other 2 is that the initialization of the StringBuffer object which creates a new object and allocates the memory for this object in the heap which is performed inside the loop. So declaring a new object inside a loop will allocate memory for the object and initializes it every time the loop is executed.<br/>
<h2>Object Conclusion</h2>
<h3>Memory and Performance</h3>
If an object is declared inside a loop the memory for the object is allocated each time and the initialization for the object is performed. The initialization may not take that much time but the memory allocation will be. In some cases you may not be able to get beyond creating a new object with every loop but if possible it is better to reset the object and reuse it. 
<h3>Readability</h4>
As in the primitive example I prefer declaring my variables outside the loop and if  possible resetting the object inside the loop instead of creating a new one. If the object being used is small and the loop will not execute too many times then this question may not matter as much but it will matter so be careful with this one. 
<h1>Conclusion</h1>
As you can see there is a difference when declaring objects inside opposed to outside a loop though with primitives it is more of a personal choice. What I consider is that when an object can be reused inside a loop it is better to do so. So in the interest of being consistent I believe it is better to declare the variables outside the loop so when you can reuse the objects you don't have to change the way you commonly declare variables.]]>

</content>
</entry>
<entry>
<title>Where is development with Java going?</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/07/where_is_develo.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-07-16T20:40:55Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.5194</id>
<created>2006-07-16T20:40:55Z</created>
<summary type="text/plain">Which technologies are worth integrating in a Java centric system? </summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Deployment</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>Technologies have come and gone over time. Is the latest round of technologies getting the hype worth integrating into a Java system? I am interested in hearing the feedback of the Java community about the latest and greatest technologies. <br />
<p/><br />
Reciently I found myself looking for work. Being a Java guy I was searching for positions for a Java person. During this search I found many different positions with other languages listed right along with Java. Some of the positions I considered to a HR person posting a position without knowing what they were actually looking for, or what they can get. Like someone with 8 years of .net, 10 years of Java, 10 years of VB, 4 years of PHP, 6 years of Struts, 9 years of J2EE. There are also posts which were reasonable and have the new tech in it like <a href='http://www.php.net/'>PHP</a>, <a href='http://en.wikipedia.org/wiki/AJAX'>AJAX</a>, and <a href='http://www.rubyonrails.org/'>Ruby on Rails</a>. What I would like to ask the Java community is; are these technologies actually used in the real world with Java and if so how?<br />
<p/><br />
Are these other technologies something that the Java community should embrace? I have never thought that there was one solution or a generic correct solution for all situations but is integrating these with Java the way we need to be moving?</p>]]>

</content>
</entry>
<entry>
<title>Self Describing Data Object (SDDO)</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/04/self_describing.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-04-26T21:51:24Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4581</id>
<created>2006-04-26T21:51:24Z</created>
<summary type="text/plain">I have created an object to pass dynamic data to and from Web Services. I am blogging it because I want to know how others feel about this type of object. The Need Versioning of Web Services is difficult with...</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>I have created an object to pass dynamic data to and from Web Services. I am blogging it because I want to know how others feel about this type of object.</p>

<h1>The Need</h1>
Versioning of Web Services is difficult with many different factors to consider, which is beyond the scope of this blog. Lets say it is safe to say that you need to make Web Services backwards compatible for as long as possible. To do this you cannot change an existing operation, parameter, or return object. Also, you want to keep a concise operation list. So if you had an operation named getXYZ() which returns an object which you are certian will change to meet the business needs how do you do this? 

<h1>Options</h1>
I considered a couple of different options. Some listed below. 
<ul><li>Empty Fields</li>
<li>Array of Strings</li>
<li>An array of String with the attribute, name, and value delimited within it</li>
<li>2D Array</li>
<li>2 Arrays of String</li>
<li>Collection</li>
<li>SDO (<a href=http://www.jcp.org/en/jsr/detail?id=235>JSR-235</a>)</li></ul></br>
Each didn't work for one reason or another.<p/>

<p><b>Empty Fields</b> - How many do you add and what do you name them because they will never be the name of the data you will need. Besides that it's just a bad idea.<br />
<b>Array of Strings</b> - They would always have to be in the same order and there is the possibility of getting an index out of bounds exception, I don't like exceptions.<br />
<b>An array of String with the attribute, name, and value delimited within it</b> - What do you use as a delimiter that you know for a fact will never show up in a String representation of an object.<br />
<b>2D Array</b> - Same as above but doubled and not supported by JAX-RPC.<br />
<b>Collection</b> - Not supported by JAX-RPC. <br />
<b>SDO</b> - Too much overhead and didn't like it. </p>

<h1>Solution</h1>
Self Describing Data Object (SDDO)
This object uses a Map, HashMap to be exact, to hold the data and an array of KVData (Key Value Data) Objects which is used to fake out the XML parser to think that the data is an array. In the get method for the data array it converts the values in the Map to KVData objects and puts them into an array and returns them. In the set method for the data array it simply puts the data back into the Map for easier data access.<p/>

<p>The KVData object is a simple object which only holds 3 Strings key, value, and dataType. The key is the key name for the data, the value is the data value, and the dataType is the value.getClass().getName(). To instantiate the data on the other side I use reflection to create the object and set the data using the getDeclaredConstructor(String.class) method. Using this method you can recreate any object that can be created with the same String value the object returns from the toString() method. Since Calendar and Date are JAX-RPC data objects and they do not have a String constructor I had to treat these as special cases. </p>

<p>To insure proper operations and to avoid null pointers I choose to return a blank String if a requested key value is not found. This allows you to even remove data from the object without worrying about this object getting null pointers. This is a safe guard for the unexpected. We have created a Web Service Contract which all Web Services must abide by. </p>

<p>"A Web Service cannot remove or change existing operations. A Web Service cannot remove or change parameters, or return values."</p>

<p>Considering that the SDDO is not changed and the attributes within the SDDO are only added to making an addition to the SDDO attributes does not break this contract. </p>

<p>We also create Web Service Clients for our Web Services for use internally. With the SDDO a client will operate correctly as long as the contract is adhered to. In fact with a little care the client will operate correctly even if attributes are removed from the SDDO.</p>

<h1>The Good</h1>
This object solves a couple of difficult problems with Web Services without versioning the service.
<ul><li>You can dynamically add data to Web Service parameters or return values.</li>
<li>You can remove data from a Web Service parameter or return value. This is dangerous though because you don't know what the clients are doing with this data.</li>
<li>Client code does not have to be changed to account for additional attributes added to the SDDO if the client does not care about the additional data.</li>
<li>This eases versioning changes due to data changes when the SDDO is used.</li>
<li>You can create wrappers for the SDDO for a set of attributes, such as an account, and have it still look like a pojo.</li>
<li>A wrapper can act as the attribute documentation of the SDDO.</li></ul>

<h1>The Bad</h1>
With all good there is the bad.
<ul><li>XML size is close to trippled for the SDDO because the need of passing the key and dataType values.</li>
<li>An SDDO without an clearly defined set of attributes will be very difficult to understand, this is a design issue though.</li>
<li>If you use a wrapper to make the SDDO look like a pojo it will take some extra work, using an IDE such as NetBeans though you can minimize that work.</li></ul>

<h1>Other Considerations</h1>
This object is not meant to be used with a set of data such as an address. An address has a clearly defined set of fields which do not change and therefor does not need a dynamic object such as this. An SDDO is not meant to be a replacement for good object design.

<h2>Voice your opinion</h2>
Please voice your opinion by commenting to this topic. If there is enough interest in seeing the source I will post it also. 
]]>

</content>
</entry>
<entry>
<title>JBoss - The Basics</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/04/jboss_the_basic_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-04-20T21:52:17Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4544</id>
<created>2006-04-20T21:52:17Z</created>
<summary type="text/plain">This is the basics of working with JBoss. It is intended for the JBoss beginner not the experienced user.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>This is not for the experienced JBoss application server user. It is meant to give the JBoss beginner the basics to running and deploying applications to JBoss 4.0.3 SP1. There is also information on how to improve efficiency when working with NetBeans and Creator. </p>

<h1>JBoss Layout</h1>
JBoss is easy to understand if you know the way the directories are setup and how to work with them. First everything you will do to JBoss is in the install directory.

<h2>bin directory</h2>
The most important one here is the run.bat or run.sh. This will run the application server and display debug and information messages to the user in the session it is started in. To start JBoss simply use the run command from this directory. To stop the server do a CTRL-C in the session it was started in. There are also some other files there but this is the basics only so I will not discuss them. 

<h2>lib directory</h2>
This is the "root" server lib directory. You don't usually have to nor want to do anything with these libs. 

<h2>server directory</h2>
This is where the directories for the server instances are. This is where you will do most of your work. 

<h3>default directory</h3>
The default directory is the directory for the default instance. This is the instance which is started if you do not specify an instance. If you are in need of multiple instances then you will need to duplicate this directory. So if you think that you will need more instances do yourself a favor and make a backup of this directory before doing anything else. 

<p>I will go through this directory and tell you a little about it and give you a little information which may come in handy in the future. </p>

<h4>conf</h4>
This is where all the configuration files for the paticular instance reside. These are more or less needed but you don't need to do much with them to work with the server. The only one I have changed in this directory is the log4j.xml because I wanted to add some different appenders to keep more concise logs. 

<h4>data</h4>
This directory I have never done anything in and never even navigated to tell I decided to write this. The only think I could see of any interest is the wsdl directory which will hold a sub directory for each archive which holds a web service which holds the wsdl and wsdd files for each service. 

<h4>deploy</h4>
This is the most important directory. It contains all the deployed applications archive files and the jbossweb-tomcat55.sar directory, if you ready my other blogs you will see references to the jbossweb-tomcat55.sar directory. The most important thing in the jbossweb-tomcat55.sar directory is the server.xml. This is the file which will need to be modified if you are going to have multiple instances running. If you do run multiple instances make sure you change the listening ports in the server.xml, refeer to the <a href=http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigureServerPorts>JBoss</a> site for information on changing ports. To run a server with a different name use this command run -c <i>instance_name</i>. The next important directory is lib. It is where the archive files need to be put for the instance to find them. For instance if you are going to be using databases the database lib goes here. The log directory is next, it is where the logs for the instance get put. The temp and work are where the applications get expanded to and run from. 

<h4>others</h4>
There are other directories but these are all you really need to worry about when getting started. 

<h4>JBoss Deployment</h4> 
Under my normal development I use NetBeans and Creator with JBoss. I don't normally use the deploy ability of NetBeans, Creator does not currently support JBoss, because of the ease of doing a manual deployment. I have found that if I open a command prompt and run the copy command it is faster to deploy than through NetBeans. Since JBoss hot deploys new applications it works very will for me. I simply build the project and then use a script to deploy it from a command prompt. If you are going to use this method do not have the command prompt open in the dist directory because it will lock the directory and cause a Clean and Build to fail.

<p>If you have any questions or need any more information please see <a href=jboss.org>JBoss.org</a> or add a comment.</p>]]>

</content>
</entry>
<entry>
<title>Databases with JBoss</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/04/databases_with.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-04-20T15:48:05Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4539</id>
<created>2006-04-20T15:48:05Z</created>
<summary type="text/plain">Setting up a Database connection in JBoss is not hard but I wanted to have it included to help make a more complete Enterprise Guide for JBoss, NetBeans, and Creator. </summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>This is not a difficult topic but one which I needed to include to have a more complete JBoss enterprise setup. </p>

<h1>Needed Information</h1>
JNDI Name<br/>
Connection URL<br/>
&nbsp;&nbsp;&nbsp;&nbsp;Server Name<br/>
&nbsp;&nbsp;&nbsp;&nbsp;Port<br/>
&nbsp;&nbsp;&nbsp;&nbsp;Database Name<br/>
Driver Class<br/>
User Name<br/>
Password<p/>

<h1>The ???-ds.xml file</h1>
JBoss provides all kinds of ???-ds.xml files ready to be customized in the <i>JBOSS_INSTALL</i>/docs/examples/jca directory. There is one for just about every database you would ever need. For the most part they use the information mentioned above with some of them needing a little more. JBoss did a good job with giving descriptive names where the XML does not explicitly state what it is looking for. They all have the standard start of the Connection URL also such as jdbc:oracle:thin:@ for Oracle and jdbc:mysql:// for MySQL as well as the default port. So if you don't change the default port on the database all you need to do is change the Server Name, Database Name, Driver Class, User Name, and Password and in most cases the Driver Class will not need to be changed either. Once this information is correct put the ???-ds.xml file in the deploy directory for the server you need the Database connection on.<p/>

<h1>The Library</h1>
You will need to add the jar for the Database you are using in the lib directory for the server you need the Database connection on. This is in the <br/>
<i>JBOSSS_INSTALL</i>/server/<i>SERVER_INSTANCE</i>/lib directory. <br/>

<h2>Happy Connections</h2>
You should now have a connection to the Database you need. ]]>

</content>
</entry>
<entry>
<title>DataSources with Sun Java System Creator and JBoss</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/04/datasources_wit_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-04-19T22:15:57Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4533</id>
<created>2006-04-19T22:15:57Z</created>
<summary type="text/plain">How To use databases configured within Sun Java Creator deployed to JBoss.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Enterprise</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>We are currently using Creator to create a testing and QA front end for the enterprise application we are developing. After success with working with services we finally needed to hit a configuration database to show all the configuration options available to different applications and users.</p>

<h1>The Data Source</h1>
We started by putting 2 simple drop down on the screen and tried to attach a data source to them. Since we are using MySQL for this configuration database we had to add the data source, which is very simple. Select the Servers tab and right click on the Data Sources and you will see an Edit... button to the right of the drop down for the Server Type select this and in the dialogue which comes up select New on the bottom left. Then simply browse to the jar file for the data source you are adding, for us it is mysql-connector-java-3.1.12-bin.jar, and select Open. Give it a name and for MySQL put in com.mysql.jdbc.Driver for the Driver Class Name, if you select suggest it will suggest an older driver named org.gjt.mm.mysql.Driver. In the URL Template put in the following jdbc:mysql://#HOSTNAME:3306/#DATABASE changing the 3306 to the appropriate port and select close. Give the data source a name and fill in the fields with the proper information and select Add.<p/>

<h1>The JBoss XML</h1>
For JBoss to work correctly with your datasources from Creator you need to tell JBoss the references for the data sources. To do this you need a jboss-web.xml file in the <i>creator_project</i>/web/WEB-INF directory. Create this file, or download below, and put it in the <i>creator_project</i>/web/WEB-INF directory.

<p><code><br />
&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;jboss-web&gt;<br />
&nbsp&nbsp&lt;resource-ref&gt;<br />
&nbsp&nbsp&nbsp&nbsp&lt;res-ref-name&gt;jdbc/myDataSource&lt/res-ref-name&gt;<br />
&nbsp&nbsp&nbsp&nbsp&lt;jndi-name&gt;java:/myDataSource&lt/jndi-name&gt;<br />
&nbsp&nbsp&lt;/resource-ref&gt;<br />
&lt;/jboss-web&gt;<br />
</code><p/></p>

<p>Make sure to change the myDataSource name to the actual jndi name in your JBoss configuration. Don't forget the "/" in the front of the datasource without this it will not work correctly. </p>

<h1>The Binding</h1>
Once this is done you are ready to bind the data to the drop down. Simply put a drop down on your page and right click in and select Bind to Data.. Select Add Data Provider and select the proper table from your data source. Make sure that it selected the correct value and display fields and select OK. <p/>

<h1>Clean and Build</h1>
If you have not gotten any errors up to this point you should be able to clean and build the project and deploy to your JBoss directory. If you get errors under deploying make sure you set the data source correctly in JBoss <a href=http://weblogs.java.net/blog/ddevore/archive/2006/04/databases_with.html>Databases with JBoss</a> and setup JBoss to work with creator <a href=http://weblogs.java.net/blog/ddevore/archive/2006/01/how_to_setup_jb_1.html>How to setup JBoss to work with Sun Java Studio Creator</a><p/>

<h2>Happy Creating</h2>

<p><a href="http://weblogs.java.net/blog/ddevore/archive/jboss-web.xml">Download jboss-web.xml file</a></p>]]>

</content>
</entry>
<entry>
<title>Maven Repository with NetBeans 5.0</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/02/maven_repositor_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-02-17T16:21:38Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4149</id>
<created>2006-02-17T16:21:38Z</created>
<summary type="text/plain">Learn how to utilize a Maven repository from NetBeans 5.0 saving you from storing libs in CVS.</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>This entry is for using a Maven repository in NetBeans with the ant build process. I have seen a lot of discussion over Maven and its repositories. Personally I would like to use Maven in the NetBeans build but there currently is no direct integration of Maven in the NetBeans. Before you post a comment about the Mevenide, yes I know about that project <a href=http://mevenide.codehaus.org/>http://mevenide.codehaus.org/</a> and <a href=http://docs.codehaus.org/display/MEVENIDE/MevenideNetbeans2.0>http://docs.codehaus.org/display/MEVENIDE/MevenideNetbeans2.0</a> but the last time I checked it was not integrated into the current build process. I would like to see NetBeans have a switch that would allow you to choose between ant and Maven for building. Until then I am going to stick with the ant build process because NetBeans does such a good job with it. </p>

<p>Now on with adding a Maven repositories into the ant build process within NetBeans. If you are not familiar with Maven please look here for more information about Maven <a href=http://maven.apache.org/>http://maven.apache.org/</a>. </p>

<p>If you are familiar with Maven or have read the above link you will know that there was a version 1 and now a version 2 Maven. Each version has its own repository and setup which is outside of this blog. I will save that discussion for another day. For more information on repositories please see the following links.<br />
<a href=http://maven.apache.org/guides/introduction/introduction-to-artifact-resolution.html>Introduction to Repository definitions and artifact resolution</a><br />
<a href=http://maven.apache.org/guides/introduction/introduction-to-repositories.html>Introduction to Repositories</a></p>

<p>In integrating Maven I kept the build clean for 2 reasons. First I wanted to make it easily movable from project to project without a lot of modifications. Second it was written so that it could be removed easily because it tries to download the repository files each time you do a build. So on with the files.</p>

<p>There are 3 files needed for this integration. First is the maven-artifact-ant-2.0.2-dep.jar which can be downloaded from <a href=http://maven.apache.org/download.html>here</a>. Second is a POM or Project Object Model which is the build file for Maven. Third is a repository xml file, created originally by someone else that I modified to fit better in the NetBeans build, which is imported into the build.xml. </p>

<p><b>POM</b><br />
The POM which we are using is a scaled down version from a complete Maven POM, it is only the dependencies section. </p>

<p><code><br />
&lt;project&gt;<br />
&nbsp&nbsp&nbsp&nbsp&lt;modelVersion&gt;3.0.0&lt;/modelVersion&gt;<br />
&nbsp&nbsp&nbsp&nbsp&lt;groupId&gt;BMGCH&lt;/groupId&gt;<br />
&nbsp&nbsp&nbsp&nbsp&lt;artifactId&gt;core_lib&lt;/artifactId&gt;<br />
&nbsp&nbsp&nbsp&nbsp&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&lt;dependencies&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;dependency&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;groupId&gt;log4j&lt;/groupId&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;artifactId&gt;log4j&lt;/artifactId&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;version&gt;1.2.9&lt;/version&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/dependency&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;dependency&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;groupId&gt;j2ee&lt;/groupId&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;artifactId&gt;j2ee&lt;/artifactId&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;version&gt;1.4.2&lt;/version&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/dependency&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&lt;/dependencies&gt;<br><br />
&lt;/project&gt;<br />
</code></p>

<p>The first section; modelVersion, goupId, artifactId, and version are settings for the project and do not have any affect on the build except for they must be there. If you want more information about these fields please see the Maven links above. To be honest I just wanted to get this working so I didn't really care what those values were since they didn't make a difference to the build. The next section is the dependencies section. This is where you define what you are downloading. If you look in a Maven repository it is setup with a directory which coorlates to the groupId, the artifactId is the first part of the jar file name with the dash before the version number. So for instance the log4j dependency listed above is in the directory log4j off the root of the repository then there is a jar directory with the file log4j-1.2.9.jar in it. Now most of the time you will not browsing the repository but we don't have a repository directory setup so I need to. </p>

<p><b>repository.xml</b><br />
The repository.xml is where the work actually happens in this process. It looks like the following. </p>

<p><code><br />
&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br><br />
&lt;!--<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;Document   : repository.xml<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;Created on : September 30, 2005, 8:15 AM<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;Author     : ddevore<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;Description:<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;This is a ant scripting document for utilizing the repository <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;functionality included in Maven2. To use this correctly you must have<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;the maven-artifact-ant jar file in the maven.lib.dir location. The libs<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;downloaded will be located in the lib.dir location. The lib.dir will <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;be removed with the clean target for the project.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;For this file to be run correctly you must import it into the main <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;build.xml with the following line.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;&lt;import file="repository.xml"/&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;The downloading can be called independently of the build process by <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;using the download-libs tagret.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;Upon first checking out a project from CVS which uses the repository <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;you will get unresolved references. To fix this simply do a build or<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;download-libs on the project, which will download the libs in the proper<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;directory. <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;NOTE: The libs still need to be added to the NetBeans project. <br><br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;This script is setup for the NetBeans build scripts and is dependent <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;on them so it will not work without them.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;Properties:<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;lib.dir = The directory for the dependent libs.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;maven.lib.dir = The directory for the maven ant jar file.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;maven.lib.jar = The name of the maven ant jar file.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;maven.remote.repository = The remote repository name to use.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;maven.repository.type = The type of repository. Valid values are<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;legacy = Maven 1 repository.<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;default = Maven 2 repository.<br />
--&gt;<br><br />
&lt;project name="core_lib-repository" default="default" basedir="." <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;xmlns:artifact="urn:maven-artifact-ant-batch"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;description&gt;Downloads dependent libs defined in the pom.xml.&lt;/description&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;property name="lib.dir" value="build/dependent_libs"/&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;property name="maven.lib.dir" value="src/lib"/&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;property name="maven.lib.jar" <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;value="maven-artifact-ant-2.0.2-dep.jar"/&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;property name="maven.remote.repository" <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;value="http://dev.columbiahouse.com/maven"/&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;property name="maven.repository.type" value="legacy"/&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;typedef resource="org/apache/maven/artifact/ant/antlib.xml" <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;uri="urn:maven-artifact-ant-batch"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;classpath&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;pathelement location="${maven.lib.dir}/${maven.lib.jar}" /&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/classpath&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/typedef&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;target name="download-libs" depends="init"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;artifact:pom id="maven.project" file="pom.xml" /&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;artifact:dependencies pathId="dependency.classpath" <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;filesetId="dependency.fileset"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;pom refid="maven.project"/&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;remoteRepository url="${maven.remote.repository}" <br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp;layout="${maven.repository.type}" /&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/artifact:dependencies&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;copy todir="${lib.dir}" flatten="true"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;fileset refid="dependency.fileset" /&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/copy&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/target&gt;<br><br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;target name="-pre-compile" depends="download-libs"/&gt;<br><br />
&lt;/project&gt;<br><br />
</code></p>

<p>What this all means is this. First the project name attribute. I put the project name with a -repository at the end to make it unique, if you don't do this you will get a warning running the project because the name is already declared. The properties are fairly easy to see. The lib.dir is where where the libs will be downloaded to, I put them in the build directory so they will not be put into CVS. The maven.lib.dir and maven.lib.jar is the directory and file name for the maven-artifact-ant jar file. The maven.remote.repository is the location of the repository with the maven.repository.type being the type, legacy means it is a Maven 1 repository. After that it is defining and running the task. The last target is telling the NetBeans build process to download the libs before doing a compile. </p>

<p>To get this to be included in the build you must include it in the build.</p>

<p><code><br />
&lt;import file="repository.xml"/&gt;<br />
&lt;import file="nbproject/build-impl.xml"/&gt;<br />
</code></p>

<p>The repository.xml must be before the build-impl import or it will not be imported. </p>

<p><b>maven-artifact-ant-2.0.2-dep.jar</b><br />
The only thing left is to put the maven-artifact-ant-2.0.2-dep.jar in the proper place. From my repository.xml you can see that I put it in the src/lib directory. Put it in the proper directory and you will be good to go. </p>

<p><b>Good and Bad</b><br />
This allows you to pull libs from a Maven repository so you don't have to store them in CVS and you always have the latest. There are 3 problems with this though.<br />
1. When you check out a project you will have unresolved dependencies so you will have to either run the download-libs target or do a build.<br />
2. Wnen you clean you will again get unresolved dependencies. This is a problem with where I put the libs. If you put them outside the build or dist directory you won't loose them upon a clean but NB will then want to put them into CVS.<br />
3. It wants to download them each and every time you build which is not that big of a problem unless you have a large project or a lot of dependent projects then it could take some time. This can be fixed by either removing the import for the repository.xml from the build, which will remove the repository capabilities completely, or take out the -pre-compile target from the repository.xml. Taking out the -pre-compile would be the safest since you can still run the download-libs target with this method.</p>]]>

</content>
</entry>
<entry>
<title>Sun Java Studio Creator 2 Released</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/01/sun_java_studio_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-01-27T04:05:53Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4012</id>
<created>2006-01-27T04:05:53Z</created>
<summary type="text/plain">Sun Java Studio Creator 2 has been released</summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>I have been a part of the Creator 2 EA program for about 3 months now and have loved testing it out. This IDE makes web development using JSF as easy as drawing a page on a white board. </p>

<p>If you have not tried it do what I am doing right now and download it. Give it a try and you will see that it is by far the best IDE for web page design available today. </p>

<p><a href="http://developers.sun.com/prodtech/javatools/jscreator/downloads/">http://developers.sun.com/prodtech/javatools/jscreator/downloads/</a></p>

<p>Also, let me know what you think about it and how it works. As I work with it I will be blogging my experiences. If there is something you would like to say comment here.</p>]]>

</content>
</entry>
<entry>
<title>How To Refresh Web Services in Creator 2</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/ddevore/archive/2006/01/how_to_refresh.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2006-01-26T14:14:23Z</issued>
<id>tag:weblogs.java.net,2006:/blog/ddevore/305.4002</id>
<created>2006-01-26T14:14:23Z</created>
<summary type="text/plain">Developing Web Services with Creator 2 as the testing tool can be difficult since it does not pick up changes to the service. This blog will tell you how to remove all references to the old service so you can insure that you are working with the newest version. </summary>
<author>
<name>ddevore</name>

<email>ddevore@duckhouse.us</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/ddevore/">
<![CDATA[<p>If you are developing a front end for Web Services in Creator 2 and need to make a change to the Web Service currently there is no automatic way to tell Creator to refresh the Web Service and regenerate the libs for the service. This document will walk you through refreshing the web service so that you can see the changes made to the Web Service.</p>

<p><b>Remove the Web Service from the Project</b><br />
First you must remove all references to the Web Service from the pages which currently use it. To do this you must remove the references to the service from each page which uses it. First select the page and select the Outline tab on the lower half of the left side of the screen. Find the reference to the service and delete it. Then select the Java button to open the Java source for the page. Since the reference for the service has been deleted the references to the service should show as an error, comment out all references to the service. Once you have done this for allpages which reference the service click on the Servers and select the Web Services section and delete the reference to the service from the list of services. Once all references to the service are removed clean the project and shut down Creator. </p>

<p><b>Remove the libs</b><br />
Next you must remove the libs from the lib directory. To do this go to the project directory and expand the lib/webservice_clients directory, this is where all generated Web Service libs are held. The libs for the Web Service will begin with the service name for the service I am working with it is ChangeofAddress so my files are named like this: </p>

<p>ChangeofAddress-1133983181995.jar<br />
ChangeofAddress-1133983181995DesignTime.jar</p>

<p>Remove these files. </p>

<p><b>Remove references from project properties</b><br />
Next we must remove the references from the projects properties. Go to the project directory and expand the nbproject directory. Edit the project.properties file and search for the lines with the service name. You will find 3 references to the libs. The first is easy simply remove the lines. The second and third you must modify the line above it for the project to properly open. The following is a list of the references and how to modify them to remove them from the project properly. </p>

<p>1. Remove these lines</p>

<p>file.reference.ChangeofAddress-1133983181995.jar<br />
=lib/webservice_clients/ChangeofAddress-1133983181995.jar<br />
file.reference. ChangeofAddress-1133983181995DesignTime.jar<br />
=lib/webservice_clients/ChangeofAddress-1133983181995DesignTime.jar</p>

<p>2. Modify as follows</p>

<p>&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}:\<br />
&nbsp&nbsp&nbsp&nbsp${file.reference.ChangeofAddress-1133983181995.jar}:\<br />
&nbsp&nbsp&nbsp&nbsp${file.reference.ChangeofAddress-1133983181995DesignTime.jar}<br />
# Space-separated list of extra javac options</p>

<p>Modify like this </p>

<p>&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}<br />
# Space-separated list of extra javac options</p>

<p>Keep in mind that if there are more services being referenced there may be more jar files listed. The important thing to remember is that if this is the last in the list REMOVE the :\ at the end before the # Space-separated list of extra javac options line. </p>

<p>3. Modify as follows</p>

<p>&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}:\<br />
&nbsp&nbsp&nbsp&nbsp${file.reference.ChangeofAddress-1133983181995.jar}:\<br />
war.ear.name=LibTest.war</p>

<p><br />
Modify like this</p>

<p>&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}<br />
war.ear.name=LibTest.war</p>

<p>Once again keep in mind that if there are more services being referenced there may be more jar files listed. The important thing to remember is that if this is the last in the list REMOVE the :\ at the end before the war.ear.name=LibTest.war line. </p>

<p>Next edit the project.xml file and remove the references to the libs there. There are 2 references in this file and can be simply removed. The following is the example for the service I am removing. </p>

<p>The first is a reference to both jar files, remove them with the library files begin and end tags. </p>

<p>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;library files="1"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;file&gt;${file.reference.ChangeofAddress-1133983181995.jar}&lt;/file&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/library&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;library files="1"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;file&gt;${file.reference.ChangeofAddress-1133983181995DesignTime.jar}&lt;/file&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/library&gt;</p>

<p>The second is a reference to the actual service client jar file, remove it with the library files begin and end tags.</p>

<p>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;library files="1"&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;file&gt;${file.reference.ChangeofAddress-1133983181995.jar}&lt;/file&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;path-in-war&gt;WEB-INF/lib&lt;/path-in-war&gt;<br />
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&lt;/library&gt;</p>

<p><br />
<b>Resume Development</b><br />
Once those are removed youcan continue development. Start Creator, add the service back to the Servers | Web Services, add it back to the pages which need it and uncomment the code commented out while removing it from the project. Once this is done you will see the changes. Please note that when you add a service to a page a second time it may change the object reference like this changeofAddressClient2 instead of changeofAddressClient1 so you may need to modify some of the code you commented out to reflect this change.</p>

<p><b>Notes</b><br />
I have been told that they are working on this problem but since I have run into it I figured that some other prople would have also and they might want to know how to insure they were working on the latest version. </p>]]>

</content>
</entry>

</feed>