Pages

Showing posts with label Ebook. Show all posts
Showing posts with label Ebook. Show all posts

Tuesday, December 1, 2009

Effective Java


Introduction

THIS book is designed to help you make the most effective use of the Java™ programming language and its fundamental libraries, java.lang, java.util, and, to a lesser extent, java.util.concurrent and java.io. The book discusses other libraries from time to time, but it does not cover graphical user interface programming, enterprise APIs, or mobile devices.
This book consists of seventy-eight items, each of which conveys one rule. The rules capture practices generally held to be beneficial by the best and most experienced programmers. The items are loosely grouped into ten chapters, each
concerning one broad aspect of software design. The book is not intended to be
read from cover to cover: each item stands on its own, more or less. The items are heavily cross-referenced so you can easily plot your own course through the book.

Learning Wireless Java


Preface

Most Internet technologies are designed for desktop computers or enterprise servers running on reliable networks with relatively high bandwidth. Handheld wireless devices, on the other hand, have a more constrained computing environment. They tend to have less memory, less powerful CPUs, different input devices, and smaller displays.
Since the mid-1990s, various architectures and protocols have been introduced to deal with these constraints. The Wireless Application Protocol (or WAP), which is a specification developed by the WAP Forum (http://www.wapforum.org), takes advantage of several data-handling approaches already in use. Developing wireless applications using WAP technologies is similar to developing Web pages with a markup language (e.g., HTML or XML) because WAP technologies are browserbased. Another approach to developing wireless applications is to use the Java 2 Platform, Micro Edition (J2ME ). The Java programming language already plays an important role in modern programming. With WAP, you can use Java servlets and JavaServer Pages to generate Wireless Markup Language (WML) pages dynamically. However, with J2ME, you can now write applications in Java and store them directly on a cell phone. This adds a whole new dimension to wireless programming.

Contents of This Book

Part I gives an overview of the J2ME and includes information about its architectural components: namely, configurations and profiles. Part I also presents detailed coverage of the CLDC and the MIDP.
Chapter 1
This chapter introduces the J2ME environment and also explains configurations and profiles. In addition, it shows you how to set up the J2ME Wireless Toolkit to compile, preverify, and run a simple MIDlet using the
command line with the Wireless Toolkit emulator.
Chapter 2
This chapter discusses the CLDC, including its requirements, limitations, and the differences between its classes and the classes of the J2SE. In addition, it looks briefly at the standalone CLDC and KVM distribution.
Chapter 3
This chapter introduces the requirements, limitations, and classes of the MIDP, as well as introducing MIDlets and their associated Java Application Descriptor (JAD) files.

Part II contains programming details of the MIDP. It shows you how to program the phone interface, handle events, make network connections, and work with databases.
Chapter 4
This chapter picks up where Chapter 3 left off, explaining the MIDlet lifecycle methods, the Java application manager, and showing how to use the KToolbar application inside the J2ME Wireless Toolkit to simplify MIDlet development. We also discuss how to deploy MIDlets and include step-by-step instructions on how to download a MIDlet into a Motorola i85s or i50x J2ME-enabled phone.
Chapter 5
This chapter introduces the MIDP GUI model and its associated classes. In addition, it gives detailed coverage of both the high-level and low-level MIDP GUI APIs.
Chapter 6
This chapter continues the discussion of the MIDP GUI APIs by describing how various events take place surrounding the graphical components and commands. In addition, we cover the CommandListener and ItemStateListener interfaces, as well as low-level event handling.
Chapter 7
This chapter discusses the Generic Connection Framework provided by the CLDC and shows how to implement an HTTP connection across the Internet, using a MIDlet. The chapter also includes examples of how to send data to CGI scripts and Java servlets across a network. Finally, the chapter briefly discusses wireless session tracking and security for MIDlet data traveling across the airwaves.
Chapter 8
This chapter introduces the concept of data stores, which are simple databases that MIDP applications can use to store persistent data beyond the lifetime of the MIDlet that created them. In addition, the chapter includes a MIDlet that can be used to download stock information from a remote web site.
Chapter 9
This chapter gives a quick introduction to the MIDP implementation on the Palm Connected Organizers, including step-by-step instructions on how to deploy MIDlets to a PalmPilot.

Part III contains several chapters that are quick references for the J2ME CLDC and MIDP APIs. There is also an appendix that contains bibliographic information and URLs to J2ME specifications, white papers, wireless software

Tutorial Mobility Module for Netbeans


Preface

This tutorial creates an application that conforms to the architecture of the Java™ 2 Platform, Micro Edition (J2ME™ platform). The application is also compliant with the Connected, Limited Device Configuration (CLDC) and Mobile Information Device Profile (MIDP) standards. By working through tasks that create, develop, and deploy this J2ME compliant application, you will learn the major features of the Mobility Modules for NetBeans™ 2004Q1 software.


 How This Book Is Organized
Chapter 1 
provides the information necessary to set up the Sun Java Studio Mobility 6.
Chapter 2 
explains the Currency Converter application used in this tutorial and shows you how to quickly install, execute, and run the application.
Chapter 3 
provides a glossary and explanation of MIDP/CLDC concepts used in this tutorial.
Chapter 4 
shows you how to use the Java Studio Mobility to code and compile the Currency Converter application.
Chapter 5 
shows you how to use Java Studio Mobility to debug the Currency Converter application.

J2ME in a Nutshell


Preface

This book is a desktop quick reference for the Java 2 Micro Edition (J2ME ). It is intended for Java programmers writing applications for devices with limited memory
resources and processor power, such as cell phones, Personal Data Assistants (PDAs), and set-top boxes. The first part of this book provides a fast-paced introduction to the two different configurations that make up the J2ME platform -- the Connected Limited Device Configuration (CLDC) and the Connected Device Configuration (CDC), along with the profiles that are based on them, such as the Mobile Information Device Profile (MIDP), which provides the APIs for programming cell phones and similar devices. These chapters are followed by a quick-reference section that details each class of the CLDC and MIDP APIs, along with tables that show which Java packages and classes are available in each configuration and profile.
This book is intended to be used in conjunction with the best-selling Java in a Nutshell, by David Flanagan, and Java Enterprise in a Nutshell, by Jim Farley, David Flanagan, and William Crawford (both published by O'Reilly). Java in a Nutshell introduces the Java programming language itself and provides an API quick reference for the core packages and classes of the Java 2 Standard Edition (J2SE) platform. Java Enterprise in a Nutshell does the same for the APIs in the Java 2 Enterprise Edition (J2EE). The CDC and its profiles are actually large subsets of the J2SE API, and, therefore, this book does not replicate their API quick reference material, which you can find in Java in a Nutshell and, in the case of the RMI profile, in Java Enterprise in a Nutshell.

Contents of This Book
The first nine chapters of this book describe the J2ME platform, the command-line tools that are provided with Sun's J2ME reference implementations, and some of the visual development environments that you can use when writing J2ME applications:
Chapter 1
This chapter introduces the J2ME platform and the concepts of configuration and profile, and it compares J2ME to a number of other Java platforms for small devices.
Chapter 2
This chapter covers the Connected Limited Device Configuration (CLDC), which is the basic building block for the J2ME profiles for wireless devices and PDAs. It begins by outlining the differences between CLDC and the core libraries of the J2SE platform. Then it takes a close look at KVM, the small-footprint virtual machine that is used in Sun's reference implementation of CLDC.
Chapter 3
This chapter introduces MIDlets, the wireless Java equivalent of applets. MIDlets are part of the Mobile Information Device Profile (MIDP), which is the subject of this and the following three chapters. This chapter looks at the lifecycle of a MIDlet and illustrates it with a simple example. It concludes with a discussion of the facilities that a typical mobile device would provide to allow the user to download, install,manage, and remove MIDlets.
Chapter 4
The devices that MIDlets run on range from cell phones with a small two-color display and room for only a few lines of text to PDAs with larger, multicolor screens. In order to isolate MIDlets from the specifics of the devices on which they are running, MIDP includes a high-level API that provides simple input and outputcontrols and the ability to combine these controls to create form-like screens. This chapter takes a detailed look at the high-level API and provides sample MIDlets that can be run on cell phones or PDAs.
Chapter 5
This chapter looks at an alternative user interface API that provides lower-level access to a mobile device's screen and input devices. This chapter looks at the details of this API and shows how to avoid writing code that may not be portable between devices with different user interface capabilities.
Chapter 6
Networking is a key feature of a mobile device. The first part of this chapter looks at the Generic Connection Framework (GCF), which provides the basis for access to various networking APIs, including optional protocols (such as sockets and datagrams) and HTTP, which all MIDP implementations are required to support. A simple example that involves fetching information from a web site is used to illustrate the use of HTTP on a mobile device and shows how to avoid problems that arise when working in an environment with limited memory. The second part of this chapter looks at the facilities available for storing information on a mobile device and illustrates them by extending the HTTP example to include persistence of information retrieved from the web site.
Chapter 7
This chapter looks at the Connected Device Configuration (CDC) and its profiles, which are designed for use on devices that have more than 2 MB of memory to devote to the Java platform. It begins by looking at Sun's reference implementation of CDC and the CVM, the virtual machine for CDC devices, then briefly covers the content of the CDC-based profiles that are currently defined.
Chapter 8
This chapter contains reference material for the command-line tools that are provided with the CLDC and CDC reference implementations and the MIDP for the PalmOS product.
Chapter 9
This chapter covers the J2ME wireless toolkit, a development environment provided by Sun that allows you to create and test MIDlets using a cell-phone emulator that canbe customized to resemble a number of different cell phones and PalmOS-based handhelds. It also looks at how to use the wireless toolkit in conjunction with Sun's Forte for Java IDE to create a complete development environment, and it investigates
a number of alternative third-party products that provide similar functionality.

These first nine chapters provide a tutorial introduction to J2ME, with particular emphasis on wireless devices, which are currently the most popular application of J2ME technology. The core of this book, however, is the API quick reference, Chapter 10 through Class, Method, and Field Index, which is a succinct but detailed API reference formatted for optimum ease of use. Please be sure to read "How To Use This Quick Reference," which appears at the beginning of the reference section; it explains how to get the most out of this section.

Download

The Complete Reference J2ME



Introduction

Java technology has evolved from a programming language designed to create machine-independent embedded systems into a robust, vendor-independent, machine-independent, server-side technology, enabling the corporate community to realize the full potential of web-centric applications.
Java began with the release of the Java Development Kit (JDK). It was obvious from the start that Java was on a fast track to becoming a solution to the problems of many corporate systems. More interface and libraries were extended in the JDK as the corporate world demanded—and received—application programming interfaces (API) that addressed real-world situations.
JDK API extensions fully integrated into the JDK with the release of the Java 2 Standard Edition (J2SE) of the JDK. J2SE contains all the APIs needed to build industrialstrength Java applications. However, the corporate world felt J2SE lacked the strengthrequired for developing enterprise-wide applications and for servicing the needs of developers of mobile and embedded systems.
Again the corporate community pushed Sun Microsystems, Inc. to revise Java technology to address needs of an enterprise. Sun Microsystems, Inc. then launched the Java Community Program (JCP) that brought together corporate users, vendors, and technologists to develop a standard for enterprise Java APIs. The result is the Java 2 Platform Enterprise Edition, commonly referred to as Java 2 Enterprise Edition (J2EE), and the Java 2 Micro Edition (J2ME). Enterprise systems traditionally are designed using the client/server model, where client-side systems request processing from service-side systems. However, enterprise systems were undergoing their own evolution. Anew model calledWeb services gradually replaced the client/server model in corporations. Application programmers assembled applications from an assortment of processing
components called Web services. Each Web service was independent from other Web services and independent from applications. A client-side application communicates with a middle-tier, server-side application, which in turns interacts with the necessary Web services that are also located on the server side.
With the adoption of the Web services model in corporations, the JCP realized that J2ME must also go through another evolutionary cycle. With the introduction of new specifications, the Java community has merged J2ME technology with Web services technology. In addition to the acceptance ofWeb services, corporations are also seeking to merge mobile technology such as Personal Digital Assistants and cellular phones with corporate mainstream applications. J2ME, with the new PIM API, enables developers to create sophisticated, wireless applications that have direct access to native PDA databases. This enables corporate executives to use corporation’s PDA systems to interact with data mantained by PDA native applications.

What’s Inside
This book covers in detail all aspect of J2ME, Web services, PDA, and cellular phone application development. The book is divided into these five parts:
■ Part I: J2ME Basics
■ Part II: J2ME User Interface
■ Part III: J2ME Data Management
■ Part IV: J2ME Personal Information Manager Profile
■ Part V: J2ME Networking and Web Services