Wednesday, 19 August 2009 13:05

Exploiting Patterns in Java

Why Patterns Are Important A pattern is a proven solution to a software problem enabling reuse of software at the design level. The purpose of a pattern is to conceptually pair a problem with its design solution and then apply the solution to similar problems. Code-level reuse of software is desirable, but design-level reuse is far more flexible. Patterns are one of the greatest resources you will have in the design of object-oriented software. They will definitely help you to master the Java programming language, be more productive, and develop effective Java solutions. Building Patterns with Design Principles At the core of any pattern is a collection of design principles. This section looks at a simple and unconventional approach to building patterns from the ground up. The approach is to start with a simple design and gradually make changes so the design is more flexible. Each step uses the object-oriented tools available to you in Java, as well as one or more of the design principles discussed in the previous section. Each design change becomes a step in building more complex design patterns. By following the exercises in this section, it will be clear how applying design principles makes software…
Wednesday, 19 August 2009 11:24

Key Java Language Features and Libraries

  Language Features Added in Java 5   Several useful syntactic elements were introduced in Java 5. All these features are supported by an updated compiler, and all translate to already defined Java bytecode, meaning that virtual machines can execute these features with no need for an update: ❑ Generics: A way to make classes type-safe that are written to work on any arbitrary object type, such as narrowing an instance of a collection to hold a specific object type and eliminating the need to cast objects when taking an object out of the collection. ❑ Enhanced for loop: Acleaner and less error-prone version of the for loop for use with iterators. ❑ Variable arguments: Support for passing an arbitrary number of parameters to a method. ❑ Boxing/unboxing: Direct language support for automatic conversion between primitive types and their reference types (such as int and Integer). ❑ Type-safe enumerations: Clean syntax for defining and using enumerations, supported at the language level. ❑ Static import: Ability to access static members from a class without need to qualify them with a class name. ❑ Metadata: Coupled with new tools developed by third-party companies, saves developers the effort of writing boilerplate code by…
Saturday, 12 September 2009 12:21

Agile Java Development - Runtime Technologies

Runtime Technologies  This section provides a brief description of the runtime technologies. Runtime technologies are used to run the application after it is deployed, versus development tools, which are used to develop the application. Figure 1.1 provides a visual representation of how these technologies fit together to provide a complete runtime solution.   Java Platform, Standard Edition (Java SE) Development Kit (JDK) We will use the latest version of the JDK (for example, 1.5) available from the java.sun.com website. Note that as long as we have JDK 1.4 or later, the technologies covered in this book (Hibernate and Spring, for example) will work just fine. The Spring Framework (springframework.org) The Spring Framework contains a large number of classes and packages, but it is designed as a modular framework that can be phased gradually into a project by using only the features needed (for example, web framework). Spring complements Java/JEE by providing an Inversion of Control (IoC) container (explained later in book), a web framework, a transaction management abstraction layer, JDBC helper classes, job scheduling APIs, email capabilities, and more. Spring has been around since 2002 and has gained considerable momentum and support from the community, including commercial vendors such as…
Wednesday, 19 August 2009 09:58

Doing Portal Administration

Using the Admin Portlet Liferay provides a useful application called Admin that helps you perform several administrative tasks. Such tasks involve monitoring resource utilization to ensure optimal portal performance, logging messages from various classes in the system to get insight into what’s happening under the hood, checking the various system and portal properties, monitoring server instances, shutting down the server, and so on. You will now learn to use the Admin portlet. First, you need to install this portlet on your ISI portal. For this, you will create a private page in your own community. Users without administrator privileges will not be able to use the portlet, but it’s still a good idea to put it on a private page rather than a public page. Perform these steps to create a private page: 325 1. Log on to the portal using your Administrator account. 2. Open the drop-down Welcome menu. 3. Navigate to the Private Pages menu item of the Fundamental Analysts community that you created previously 4. Click the new-page icon on the right side of the menu item This opens the Manage Pages screen, which lets you create a new page 5. Enter Administration as the page name.…
Configuring the Journal Application Now we will study the configuration settings for the Journal portlet at the application level. When you click the application-configuration icon, you will see four tabbed options:   • Setup: Lets you set various e‑mail formats • Permissions: Lets you set permissions for different user roles • Export/Import: Facilitates the export and import of data • Sharing: Facilitates application sharing Setup Under the Setup option , you can set up the formats for various e‑mail messages, such as these:   • Email From • Article Denied Email • Article Granted Email • Article Requested Email • Article Review Email   Email From In the Email From tabbed option, you can set the sender information for all the applicationgenerated e‑mail messages. In particular, you enter the sender’s name and e‑mail ID. Article Denied Email The Article Denied Email tab allows you to set the format for the e‑mail message that communicates an article rejection. If you decide to reject an article because its contents are unsuitable, the application sends an automated message to the author using the format specified on this screen (see Figure 10-24). The message format uses several predefined fields, which are listed at the…
Tuesday, 18 August 2009 13:09

Managing Content

  Implementing Document Management First, we will consider text-based documents in various formats, such as PDFs, Word documents, spreadsheets, and so on. For managing such documents, Liferay provides two important applications: • Document Library • Document Library Display You will now study the use of these applications, starting with Document Library. The Document Library application allows you to organize and manage your documents. You use it to create a tree-structured hierarchy where the documents are published and stored. Thus, you can organize the document storage logically so that users can easily locate the files. Adding the Application To add the Document Library application on our ISI portal page, follow the steps listed here:   1. Log in as Administrator on the ISI portal. 2. Create a new page called Document Library under our predefined communities, or at any other location you’d like. 3. Select the Add Application menu. 4. Select and add the Document Library application from the CMS category.   Now you’re ready to create a folder structure for document storage. You’ll create a hierarchy of folders for storing documents created by our analysts and categorize the documents into two types: • Fundamental Analysis Documents • Technical Analysis Documents…
Installing the Calendar Application   To install the Calendar application on your portal, follow these steps:   1. Log in to the portal using your administrator account.   2. Create a new public page called Shared Calendar under either the Fundamental or Technical community. Or you could create a general page that’s accessible to both groups.   3. Select the Add Application menu item.   4. Open the Collaboration category and click the Add link associated with the Calendar application   Setting Up Events Adding an Event To set up an event, follow these steps:   1. View the Calendar application, which initially shows the calendar for the current system date   2. Select the date on which you want to set the event.   3. Click the Add Event button. You will see the screen shown in Figure 8-3.     4. Select the date and time for the event.   5. Select the event duration by selecting hours and minutes from the two displayed dropdown boxes. If it is an all-day event, check the corresponding check box.   6. If your event is conducted at a location that abides by Daylight Saving Time, check the Time Zone Sensitive…
Tuesday, 18 August 2009 16:45

Publishing Dynamic Content

Installing the Journal Application The application that we are going to use for creating regularly changing content is called the Journal portlet. First, you need to install this application on the ISI portal. Follow these steps to perform the installation:   1. Log on to the ISI portal using your Administrator account. 2. Create a public page called Dynamic under one of our communities, or at any other location of your choice. 3. Select the Add Application menu. 4. Locate the Journal application under the CMS category. 5. Add the application to the page. Creating Article Structures To create a new journal-article structure, follow these steps:   1. Click the Structures tab in the main application window of the Journal portlet. The screen shows a list of available structures. As no structures are currently defined, this list is blank. 2. Click the Add Structure button to create a new structure. 3. Take these actions on this screen: a. Autogenerate ID: Each structure has its own unique ID. If you do not wish to track your own IDs, allow the application to autogenerate the IDs by marking this check box. b. Name: Enter Announcement Structure. c. Description: Enter This defines the…
Page 11 of 13

« July 2010 »
Mon Tue Wed Thu Fri Sat Sun
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31