|
Starting in Mac OS X 10.3.9, new APIs enable Java software to advertise and discover services on the network using Zeroconf's DNS Service Discovery. The same Java DNS-SD APIs are also available in Bonjour for Windows, Bonjour for Linux, Solaris, *BSD, etc., enabling Java software to make use of Zeroconf's DNS Service Discovery across a wide range of platforms, not just on Mac OS X. In this chapter, you will take a quick look through the APIs, see short examples of how to register, browse for, add TXT records to, and resolve services, and finally see a complete example of using Java DNS-SD in a tic-tac-toe game. Editor's Note: Since you've all been good and read parts one and two of this excerpt from Zero Configuration Networking: The Definitive Guide, by Stuart Cheshire and Daniel H. Steinberg, it's time to have a little fun. In this code-heavy final installment, the authors take what they've shown in the previous sections and apply it to creating a game, using Zeroconf/Bonjour for the networking and Swing for the GUI. Each instance of the game advertises itself on the network and browses for potential opponents. While the game of tic-tac-toe is trifling--and this implementation doesn't even bother enforcing the rules, since that's off-topic--what you'll find here are the essentials of creating a self-networking Java game, or any kind of collaborative application, on the LAN. Note that you can also download the code directly from the book's example page. Enjoy! Starting with J2SE 1.4, the standard set of APIs will include the Preferences API made up of classes and interfaces in the java.util.prefs package. The Preferences API has been designed to provide a platform independent interface for storing preferences data. This article explores the Preferences API as it is implemented in the J2SE 1.4 Beta 2. Note that some details of the implementation may change in the final release of J2SE 1.4. Example 8-2 shows a complete listing, which you can compile with javac, to browse for services using DNS-SD. In this example, the program just runs for 30 seconds, displaying add and remove events as they arrive, and then calls b.stop( ) and exits. Of course, in a real program, you wouldn't use a fixed timeout like 30 seconds. You'd start the browse operation running when the user brings up a browsing window, and stop it when they close the browsing window. The logging API is part of J2SE as of JDK 1.4, and it ships with the JDK. It is designed to let a Java program, servlet, applet, EJB, etc. produce messages of interest to end users, system administrators, field engineers, and software developers. Especially in production situations, where things can't be run in a debugger, or if doing so masks the problem that is occurring (because it is timing related, for example), such logs are frequently the greatest (and sometimes the only) source of information about a running program. This article has illustrated some features of JSR 310, a new Java date/time API that is proposed for Java 7. In particular, it has illustrated the use of classes representing the five JSR 310 date/time concepts: instants, partials, durations, periods, and intervals. There is much additional functionality in JSR 310, such as advanced date/time matching, that this article does not describe. Furthermore, because this article was based mainly on a snapshot of the current JSR 310 API, additional functionality may be added after the publication of this article. See the Resources section to learn more about the features of JSR 310. The Java Conformance team at Sun has been part of the API evolution in both Java SE and ME, where preserving backward compatibility is critical to platform success. In this session we'd like to share our experience in this area. A short overview of compatibility problems in general will be presented, as well as the API compatibility puzzles. This talk will cover the basics of using the TrackBot API for simulating and controlling TrackBots. It will flesh out some of the concepts covered in the TrackBotsAndGreenfoot and SunSPOTsAndTrackBots talks, although attendance at those sessions is not a prerequisite. The three tags I've described here are released as open source and are available as taglibtools.zip. I developed them specifically for non-technical users. The RSS feed was for my sister, who is an actress with a weblog. The calendar was for the president of my neighborhood association. The tree was for the redesigned neighborhood web site that my girlfriend, a print designer, has created. All three are smart but non-technical people with better things to do than learn my APIs. The tags had to be reliable, so that I didn't have to fix them, and simple, so that I didn't have to answer lots of questions. Even without the FileConnection (FC) API, it is possible to read from files using classes available in Java ME. The FC API is required for manipulating files in all the other ways listed in the documentation. The FC API also comes in handy in browsing and locating predefined folders as explained in the discussion on the example MIDlet. In this article, we will look at the Smack API, an easy-to-use open source Jabber API that you can use to integrate instant messaging and chat features into your Java applications. Have you ever thought of how tools like Checkstyle or FindBugs perform a static code analysis, or how Integrated Development Environments (IDEs) like NetBeans or Eclipse execute quick code fixes or find the exact references of a field declared in your code? In many cases, IDEs have their own APIs to parse the source code and generate a standard tree structure, called an Abstract Syntax Tree (AST) or "parse tree," which can be used for deeper analysis of the source elements. The good news is that it is now possible to accomplish the said tasks plus a lot more with the help of three new APIs introduced in Java as part of the Java Standard Edition 6 release. The APIs that might be of interest to developers of Java applications that need to perform source code analysis are the Java Compiler API (JSR 199), the Pluggable Annotation Processing API (JSR 269), and the Compiler Tree API. In the first section we will take a closer look at what wizards are, how they work, and, of course, why you should consider using them in your programs. I will then introduce you to a project hosted here at java.net which provides a very easy-to-use implementation of a wizard component. In the remaining sections you will learn how to obtain, install, and use this library. For processing XML documents, most XML tools work with the SAX or DOM API. In this article, we'll look at a way to implement the same APIs directly over a database, enabling XML tools to treat databases as if they were XML documents. That way, we can obviate the need of converting a database. Near-field Communication (NFC) is characterized as a very short-range radio communication technology with a lot of potential, especially when applied to mobile handsets. Imagine yourself using your cellphone to interact with posters, magazines, and even with products while at the store, and with such interaction initiating a request or search for related information in real-time. Other usages of NFC include the electronic wallet to make payments using your handset, the same way you do with your credit card. With NFC all this is possible. But NFC is still a young technology. That said, NFC-enabled handsets are being introduced into the market, and deployments and pilots around the world are occurring. This article explores NFC and how you can leverage it in your Java application by using the Contactless Communications API. Since the introduction of the JavaBeans component architecture in the Java Development Kit v 1.1 (JDK) release in February 1997, additional specifications have been added to this component architecture such as the Extensible Runtime Containment and Services Protocol and the InfoBus standard extension. Both of these additions provide APIs that enable Beans to interconnect during run-time. Read on to learn more about the Extensible Runtime Containment and Services Protocol API (BeanContext, for short) and see how this API is implemented in the BeanBox in the Beans Development Kit (BDK) 1.1 and how you can develop dynamically connecting Beans. Serialization in Java is simple to instigate and almost as simple to implement. Understanding the three different ways of implementing serialization should aid in bending the API to your will. We have seen a lot of the serialization mechanism in that article, and I hope it made things clearer and not worse. The bottom line, as with all coding, is to maintain common sense within the bounds of API familiarity. That article has laid out a strong basis of understanding the Java Serialization API, but I recommend perusing the specification to discover more fine-grained details. 18. Java TV API The Java TV API is a vertical extension to the PersonalJava platform for creating interactive applications for digital television. The API allows the real-time display of relevant, contextual information in parallel with standard programming; electronic commerce transactions initiated from advertising spots, programming, or applications such as home banking; and real-time interactive communications with television personalities and animated characters.Programming With the Java XML Digital Signature API by Sean Mullan Get started with the Java XML Digital Signature API and learn the basic steps in generating and validating an XML signature. (February 2007) A major enhancement in EJB technology is the addition of the new Java Persistence API, which simplifies the entity persistence model and adds capabilities that were not in EJB 2.1 technology. The Java Persistence API deals with the way relational data is mapped to Java objects ("persistent entities"), the way that these objects are stored in a relational database so that they can be accessed at a later time, and the continued existence of an entity's state even after the application that uses it ends. In addition to simplifying the entity persistence model, the Java Persistence API standardizes object-relational mapping. Systems management products, such as BMC PATROL, can be configured to monitor system or application logfiles. Typically, a template is associated with each file to be monitored. If a string specified in the template matches a string found in the logfile, an alarm or other event is triggered. Depending on the configuration, the event may cause an update to appear on the management console, an email or page to be sent to a system administrator, or an SNMP trap to be generated. This mechanism can be used in combination with the J2SE Logging API to accomplish the monitoring of a set of Java programs. Events worth monitoring might include loss of a network connection, loss of a database connection, overflow of a JMS message queue, or exceeding some preset threshold in the application. In the future, the Service UI API can evolve in several different ways. Any party can define new role types and their meanings, new attribute classes, and new factory types. Any party can identify new toolkit types. For clients to be able to use these new types, the new types will need to be publicized. Before a client will be able to use a role, factory, or attribute type, that client's programmers must have had prior knowledge of the type. API Design with Java is book-in-progress filled with guidelines that will help you improve your designs. It is a companion to Object Design with Java. During a object-oriented design's initial stages, you discover objects. You assign each object an area of responsibility and flesh out the services each type of object should provide. Finally, you design the interfaces through which objects provide their services to clients. In the process, you move code to data. One solution to the problem of evaluating and learning about increasingly complex APIs comes—not surprisingly—in the form of software. While traditional documentation tools are still lagging in helping to cope with complexity, a few efforts under way aim to produce the kinds of interactive documentation that can ease someone into an APIs complex innards. This article provides a brief review of a few approaches, including an interactive web application that uses a decision tree to help users navigate complex APIs. The ServiceUI API defines classes and interfaces that enable service UIs to be associated with Jini services. The full specification of this API is available at: For example, one of the benefits of having a compiler API is that you can make compilation part of an application-level service. Consider the case when you upload JSP code to an app server: The server has to analyze the JSP files, generate Java source code files from the JSPs, write those files out to disk, invoke an external compiler that then reads the generated Java source code files from disk, writes the class files back to disk, and then the app server needs to read those class files into memory. With the Compiler API, you can keep the compiler running in that app server, and keep all of that in memory. That can reduce deployment time, and also eliminates the startup overhead of the compiler. Data-oriented methods, such as the accessor methods that appear in the data-oriented Matrix, are not inherently bad. In many situations they are appropriate. One common use of accessor methods is to access data inside objects used to transmit information. I discuss such data-oriented objects, called messengers, in Guideline 5 . To access the source and binary files for Artima Software, Inc.'s 1.1a implementation of the Jini Service UI API, which was released under the Apache License, Version 2.0, just click on these links: Data mining "is a process for finding patterns and relationships in the data, and using that knowledge to classify new data or gain insights into that data," says Mark Hornick, Oracle Senior Manager for Data Mining Technologies and spec lead for the Java Data Mining API, or JDM (JSRs 73 [1] and 247 [2]). One of Java's key strengths today is its multitude of APIs and frameworks, addressing a wide range of problem domains. Such APIs and frameworks provide ready-made answers to many programming problems. Indeed, programming in Java today is to a great extent an exercise in learning to identify and use APIs and frameworks suited to a problem area. I welcome all comments about this work-in-progress. Please e-mail your comments to [email protected], or sound off in the Flexible Java Forum. The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages. Most Recent Update: Friday, 11/9/2001 - Renamed the Interface Design project to API Design. I have spent probably 2 solid months this year getting a build system going for book writing, including buying and learning to use FrameMaker, plus developing many tools in Java and Python to help me process code and generate nice web pages for the book projects. I'm leaving the older stuff in this area for a while, until the new one (which comes out of FrameMaker) catches up and passes the old one. I welcome all comments about this work-in-progress. Please e-mail your comments to [email protected], or sound off in the Flexible Java Forum. The article describes the generation of Javadoc documentation using a directly updated source code in IBM Rational® ClearCase® (hereafter, ClearCase). The process described in this article is the result of discussions and experimentation by development and documentation teams. The proposed API reference documentation process streamlines the process for generating public API Javadoc documentation for applications. The process resolves the need to copy source code files back and forth between developers and the API writer. It also ensures that the latest source code is always being used and updated. As a result, the generated Javadoc HTML files will reflect both writer input and developer comments with minimal developer effort to merge in the API writer edits. Also, the Javadoc builds for internal customers will include the most complete documentation possible, because all documentation updates are reflected back into the source code. This article describes a process for generating Javadoc API documentation using indirectly updated source code and IBM Rational® ClearQuest® (hereafter, ClearQuest), and IBM Rational® ClearCase® (hereafter, ClearCase). Looking to incorporate mail facilities into your platform-independent Java? solutions? Look no further than the JavaMail API, which offers a protocol-independent model for working with IMAP, POP, SMTP, MIME, and all those other Internet-related messaging protocols. With the help of the JavaBeans Activation Framework (JAF), your applications can now be mail-enabled through the JavaMail API. Ironically, in Securing Java, McGraw and Felten recommend that Java developers avoid the use of inner classes to make their code more secure (see the sidebar in this article and Chapter 7 of Securing Java: Getting down to business with mobile code.) But if you want to include privileged blocks in your JDK 1.2 code, you are strongly encouraged by Sun to use them. In addition to the inner-class problem, verbosity is also a problem with the new API. As was the case in Figure 1, the screen-shot image in Figure 2 was also reduced to 470x353 pixels for inclusion in this lesson. Briefly, Figure 2 shows a JFrame object displayed by a program using the Full-Screen Exclusive Mode API. The Java Transformation API for XML (TrAX) can be used to invoke XSL stylesheets from Java programs. One of the nice features of TrAX is the ability to compile stylesheets and hold them in memory, dramatically improving performance. Here in Part 2 you'll take a tour of Mustang's new Scripting API, which lets you create programs that are part Java and part scripting language. This hybrid "Java/scripting language" approach to developing software benefits from Java's wealth of APIs and its other advantages, and from scripting language advantages such as support for dynamic typing. The MIDP 2.0 Media API lets you create and play simple melodies (tone sequences) and some sort of audio. The first sounds that usually come to mind when thinking about cell phones and simple music are ring tones, but the API has the same restrictions as the whole concept of MIDP: It has to stay inside the Java environment, so you can't compose new ring tones for your phone. But for games and other applications that need more sophisticated sound than a beep, the API offers great advantages. In 1989, Tim Berners-Lee invented the World Wide Web (WWW). Think of the WWW as a global collection of interconnected physical and abstract resources?entities supplying information on demand?that are accessed over the Internet. Physical resources range from files to people, and abstract resources include database queries. Because resources are identified in various ways (people have nonunique names, whereas computer files can be accessed via unique pathname combinations), a uniform way to identify WWW resources was needed. To address that need, Tim Berners-Lee introduced standardized ways to identify, locate, and name resources: URIs, URLs, and URNs. |
w__w___w_.__ja_v__a_2___s___.__c_o_m___ | Contact Us |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |