It may be the case that a solution using PHP and PERL technologies to handle presentation and business logic (and in some cases transaction management), could be better separated in J2EE with presentation logic being handled by JSP and Servlets and business logic by EJBs. (If transactions are involved in almost all cases, this is enough justification for using a separate application server and Enterprise JavaBeans.)
***
Use AJAX for repeated refreshes in web pages. Gmail uses this! ( note - 5 years Beta, solidly tested ).
Ajax neither reduces browser-compatibility issues nor improves security in anyway. Ajax will not work if Javascript is disabled because Ajax is basically a combination of Java Script and XML.
***
You are architecting a new web based labor claim management application. Currently the users have a Java Swing-based application running on their local PCs, and you want to implement the new web-based solution with a GUI that is similar to their desktop application. Once the users have filled in their hours then you must send the details to central labour system through a Web service.
What of the following technologies would be required for building this application?
UI can be built using JSF and the web service may be invoked through a JAX-WS client.
The Java Message Service (JMS) API is an API for accessing enterprise messaging systems. The Java Message Service makes it easy to write business applications that asynchronously send and receive critical business data and events. It defines a common enterprise messaging API that is designed to be easily and efficiently supported by a wide range of enterprise messaging products. It supports both message queueing and publish-subscribe styles of messaging.
The Java Secure Socket Extension (JSSE) enables secure Internet communications. It provides a framework and an implementation for a Java version of the SSL and TLS protocols and includes functionality for data encryption, server authentication, message integrity, and optional client authentication. Using JSSE, developers can provide for the secure passage of data between a client and a server running any application protocol, such as Hypertext Transfer Protocol (HTTP), Telnet, or FTP, over TCP/IP.
The Java Cryptography Extension (JCE) provides a framework and implementations for encryption, key generation and key agreement, and Message Authentication Code (MAC) algorithms. Support for encryption includes symmetric, asymmetric, block and stream ciphers.
***
You are currently designing your own Desktop Publishing application, as you have not found any existing application that does exactly what you want. As part of the design, you are using a Controller to which you send all GUI requests. Not all objects can process the same commands.
For example, you cannot select the spell check tool when an image has the focus. To stop any possible errors, you would like to filter out some of the messages as they are passed from these objects to the Controller object. What pattern could you use?
Firewall and Filter are not design patterns. In this scenario, what you are essentially trying to do is filter all packets that do not meet a certain set of requirements. This behavior is just like a Proxy server dropping packets from certain IP address etc.
Proxy - (GOF 207): "Provide a surrogate or placeholder for another object to control access to it."
The other patterns:
Adapter - (GOF 139):"Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces."
Observer - (GOF 293):"Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically."
Chain of Responsibility - (GOF 223):"Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it."
***
Both the Abstract Factory and Factory Method are Creational patterns.
Abstract Factory - (GOF 87): "Provide an interface for creating families of related or dependent objects without specifying their concrete classes."
Factory Method - (GOF 107): "Define an interface for creating an object, but let subclasses decide, which class to instantiate. Factory Method lets a class defer instantiation to subclasses."
***
The current application has been built using JSF & a custom persistence framework. You have been approached to expose some of the data as a EJB to another J2EE application. You may need to access multiple business objects to provide the data.
Use Session Facade.
See description of patterns.
Application Service - Application Service centralizes and aggregates behavior to provide a uniform service layer to the business tier services. An Application Service might interact with other services or Business Objects. An Application Service can invoke other Application Services and thus create a layer of services in your application.
Session Facade - Session Facade provides coarse-grained services to the clients by hiding the complexities of the business service interactions. A Session Facade might invoke several Application Service implementations or Business Objects. A Session Facade can also encapsulate a Value List Handler.
The Service to Worker pattern, like the Dispatcher View pattern, describes a common combination of other patterns from the catalog. Both of these macro patterns describe the combination of a controller and dispatcher with views and helpers. While describing this common structure, they emphasize related but different usage of patterns. Both of these patterns differ in division of labour among components(Controller, Dispatcher and View).
In Dispatcher View content retrieval is done by View and in case of Service To worker content retrieval is done by controller.
Business Delegate - Business Delegate reduces coupling between remote tiers and provides an entry point for accessing remote services in the business tier. A Business Delegate might also cache data as necessary to improve performance. A Business Delegate encapsulates a Session Facade and maintains a one-to-one relationship with that Session Facade. An Application Service uses a Business Delegate to invoke a Session Facade.
***
Polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class.
For example, a method can be declared in a parent class, but each subclass can have a different implementation of that method.
Inheritance is the ability of objects in Java to inherit properties and methods of other objects.
An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer."
Encapsulation (also information hiding) consists of separating the external aspects of an object which are accessible to other objects, from the internal implementation details of the object, which are hidden from other objects.
***
Every Java object implicitly extends java.lang.Object class. What is this design concept?
It describes Inheritance. All Java objects extend Object class implicitly and also inherit methods such as toString().
Polymorphism is a characteristic of being able to assign a different behavior or value in a subclass, to something that was declared in a parent class. For example, a method can be declared in a parent class, but each subclass can have a different implementation of that method. Inheritance is the ability of objects in Java to inherit properties and methods of other objects.
An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer."
Encapsulation (also information hiding) consists of separating the external aspects of an object which are accessible to other objects, from the internal implementation details of the object, which are hidden from other objects.
***
What is the difference between Maintainability and Manageability in Software Engineering?
Maintainability (Cade 8) "is the ability to correct flaws in the existing system without impacting other components of the system" and Manageability (Cade 9) "is the ability to manage the system to ensure the continued health of a system with respect to scalability, reliability, availability, performance and security."
***
It provides a convenient way to bind an XML schema to a representation in Java code. This makes it easy for you to incorporate XML data and processing functions in applications based on Java technology without having to know much about XML itself. Which of the following is the API described above?
JAXB - Java Architecture for XML Binding (JAXB) provides a convenient way to bind an XML schema to a representation in Java code. This makes it easy for you to incorporate XML data and processing functions in applications based on Java technology without having to know much about XML itself.
SAAJ - The SOAP with Attachments API for Java (SAAJ) provides a standard way to send XML documents over the Internet from the Java platform. SAAJ 1.3 EA (with support for SOAP 1.2) is shipped in Java WSDP 2.0.
JAXR - The Java API for XML Registries (JAXR) provides a uniform and standard Java API for accessing different kinds of XML Registries. An XML registry is an enabling infrastructure for building, deploying, and discovering Web services.
JAXP - The Java API for XML Processing (JAXP) enables applications to parse, transform, validate and query XML documents using an API that is independent of a particular XML processor implementation. JAXP provides a pluggability layer to enable vendors to provide their own implementations without introducing dependencies in application code.
***
You have developed an application consisting of Java EE Stateless session beans. Methods of these beans use simple Java types. You would like to convert them to web services. How can you achieve it?
You can use annotations like @WebService and @WebMethod. They are automatically deployed as web services.
. web.xml does not have any such entries.
. resource injection is a mechanism that removes the burden of creating and initializing common resources in a Java runtime environment.
. ejb-jar.xml does not have any such entries.
***
EJB 3.0 offers simplified entity programming model.
Java Entity is a POJO class but not an EJB, so it does not require any Local/Home interfaces. Entities may either use persistent fields or persistent properties.
If the mapping annotations are applied to the entity's instance variables, the entity uses persistent fields.
If the mapping annotations are applied to the entity's getter methods for JavaBeans-style properties, the entity uses persistent properties. You cannot apply mapping annotations to both fields and properties in a single entity.
Simple primary keys use the javax.persistence.Id annotation to denote the primary key property or field. Composite primary keys are denoted using the javax.persistence.EmbeddedId and javax.persistence.Id Class annotations.
In the Java Persistence API, you no longer need to provide a deployment descriptor. JPA supports complex relationships between Entities.
***
A typical JSF application contains
- A set of JSP pages (although you are not limited to using JSP pages as your presentation technology)
- A set of backing beans, which are JavaBeans components that define properties and functions for UI components on a page
- An application configuration resource file, which defines page navigation rules and configures beans and other custom objects, such as custom components. Usually named faces-config.xml
- A deployment descriptor (a web.xml file)
- Possibly a set of custom objects created by the application developer. These objects might include custom components, validators, converters, or listeners.
- A set of custom tags for representing custom objects on the page
- validations.xml is not part of JSF.
Real Time Web based Application can be built using JSP for UI, stateless session beans for business services and EJB3 entities for persistence.
***
The JavaServer Pages Standard Tag Library (JSTL) encapsulates, as simple tags, core functionality common to many JSP applications.
--
Regards
Vijayashankar
No comments:
Post a Comment