Java EE 7 SDK

# Sample Applications Development Process

The process for checking out workspace, developing, testing, documenting, and checking in the sample application into glassfish-samples project is as follows:

1. Get developer access to glassfish-samples project by sending email to dev@glassfish-samples.java.net with your GlassFish user id. Once you are granted the developer access, you will be able to check out from and check in to the samples workspace.
2. Check out the glassfish-samples project of java.net with a Subversion client using the following command. Note: replace the last username with your own username.
   `svn checkout https://glassfish-samples.java.net/svn/glassfish-samples/trunk glassfish-samples --username username`
3. There are separate directories for each version of Java EE. The samples for Java EE 7 are under the `ws/javaee7` directory and the samples for previous Java EE versions are under similarly named directories.
4. Each Java EE 7 samples is to be a maven module (or set of maven modules) that can be built with a simple "mvn" command with the standard goals. Since IDEs support opening and running maven modules, IDE support is provided through the use of maven modules.
5. While the tutorial uses "use case study" type examples that mimic a real world usage (such as "Duke's Bookstore"), the samples should be more technology focused. The sample does not need to justify the use of a feature through some real world use case. The samples should be named after the technology that they demonstrate. If there are code fragments in the specification showing how a particular new feature is to be used, then that is a good source for a sample. Expand the code fragment to make it compilable and runnable, thereby including all of the details that were left out of the specification for clarity.
   If the specification has a "What's new for Java EE 7" section, with a bullet list of new features, then that bullet list is a good source for creating samples. Create one sample for each bullet item in the list. However, the samples should demonstrate something that is non-obvious; if a new feature is completely obvious from the description in the specification, then a sample is not needed. This part of the sample design is really a judgment call.
6. The Java EE 7 samples should:

- Use only Java EE standard APIs. 3rd party frameworks or implementation-specific features must not be used.
- Use good programming practices:

1. Add comments to explain your code.
2. Format your code correctly.
3. Use descriptive names for classes, fields, and methods.
4. Make sure IDEs such as Eclipse and NetBeans don't show errors when opening up the project (editor should be "green" in NetBeans)

- Show discreet major features. It's better to have three samples, each showing a single major feature, than a single sample that shows three major features.
- Make the sample as simple as possible. Samples aren't case-studies, and don't need to mimic real-world examples.
- Show off the Java EE 7 platform. Avoid using outdated technologies (like JSP). Don't configure the sample in deployment descriptors if annotations can be used instead. If a Java EE 7 API can be used to ease development, use it! For example, use session beans to provide the business logic in a sample, use CDI beans instead of JSF managed beans in web applications, and use Bean Validation constraints when validating input.

7. Samples should be similar to each other where possible. Before writing a simple, familiarize yourself with the other Java EE 7 samples so that your sample is similar to other samples.
8. It is important that each sample application is provided with appropriate documentation.
9. Refer to the existing representative sample `message-board-war` under the `javaee7/rest` directory to understand the directory structure, build scripts, test code, documentation.
10. For guidelines on documenting the sample, refer to the representative sample `hello-stateless-ejb`, which is documented using the sample_doc_template.html file.
11. Each sample application needs one or more test cases so that the sample applications go through some regular testing like glassfish to notice any regressions and for the purposes of promoting the samples bundle. Refer to the test directory of representative sample `hello-stateless-ejb` for information.
12. For setup of database and usage of JDBC resources, refer to TBD
13. Make sure that the sample works with Netbeans IDE.
14. Once the sample application development, testing and documentation is complete, get it reviewed by a domain expert or a colleague before checking it in.

Copyright © 1997-2013 Oracle and/or its affiliates. All rights reserved.