Monday, December 21, 2009

Application Vs. Web Server

(1) Webserver serves pages for viewing in web browser, application server provides exposes businness logic for client applications through various protocols.


(2) Webserver exclusively handles http requests.application server serves bussiness logic to application programs through any number of protocols.


(3) Webserver delegation model is fairly simple,when the request comes into the webserver,it simply passes the request to the program best able to handle it(Server side program). It may not support transactions and database connection pooling.


(4) Application server is more capable of dynamic behaviour than webserver. We can also configure application server to work as a webserver.Simply applic! ation server is a superset of webserver.


(5) Web Server serves static HTML pages  or gifs, jpegs, etc., and can also run code written in CGI, JSP etc. A Web server handles the HTTP protocol. Eg of some web server are IIS or apache.


(6) An Application Server is used to run business logic or dynamically generated presentation code. It can either be .NET based or J2EE based (BEA WebLogic Server, IBM WebSphere, JBoss).


(7) A J2EE application server runs servlets and JSPs (infact a part of the app server called web container is responsible for running servlets and JSPs) that are used to create HTML pages dynamically. In addition, J2EE application server can run EJBs - which are used to execute business logic.


(8) An Application server has a 'built-in' web server, in addition to that it supports other modules or features like e-business integration, independent management and security module, portlets etc.

JAVA Vs. DOTNET

# JAVA


  • Java is developed by Sun Microsystems
  • Java is a light weight language and can be run on almost all the OS(it require less hardware)
  • Java you need to confirm it that all the objects are destroyed before application quits.
  • Java has no standard tool is available. Although, many third party IDEs are available
  • Java is a programming language designed to be run on many different platforms, and so uses a common language which has to be compiled and run on different platforms (eg. windows, mac and linux).Any OS which is able to install JVMJava can be used to write programs for many different operating systems
  • Java interface, a null object reference maps to the VT_NULL VARIANT value
  • Java interface, all failure HRESULTs from the underlying COM interface are reported by throwing a com.ca.openroad.COMException containing that HRESULT value




# .NET


  • .Net is developed by Microsoft Corporation
  • .Net needs a very heavy framework to be installed which have higher Hardware requirements too compared to Java
  • .Net garbage collector runs at a certain interval and see is there is any memory occupied by anyobject whose parent is now finished processing (for eg. you closed an application), in this casethe garbage collector automatically removes the reference of that object and free up the memory
  • .Net a standard development IDE is available that is Microsoft Visual Studio
  • .NET, takes on a different approach, by allowing you to program in any language you choose,but has compilers for many different languages that generates a platform specific code (i.e.Microsoft or Windows).
  • .NET can be used to make any programming language into a Windows program.NET COM interoperability layer maps null .NET object references to VT_EMPTY. VT_NULLis mapped to a special object type of class “System.DBNull”.
  • .NET COM interoperability layer does something similar, using theInteropServices.COMException class. However, it uses that exception class only as a lastresort. If there is already a .NET exception class that reasonably represents the meaning of aparticular HRESULT, the interoperability layer throws that .NET exception instead of a COMException.

Saturday, December 12, 2009

Java Fundamental-V

>
1. What is the use of preparedstatement?
Preparedstatements are precompiled statements. It is mainly used to speed up the process of inserting/updating/deleting especially when there is a bulk processing.


2. What is callable statement? Tell me the way to get the callable statement?
Callablestatements are used to invoke the stored procedures. You can obtain the callablestatement from Connection using the following methods prepareCall(String sql) prepareCall(String sql, int resultSetType, int resultSetConcurrency)


3. In a statement, I am executing a batch. What is the result of the execution?
It returns the int array. The array contains the affected row count in the corresponding index of the SQL.


4. Can a abstract method have the static qualifier?
No


5.. What are the different types of qualifier and what is the default qualifier?
public, protected, private, package (default)


6. What is the super class of Hashtable?
Dictionary

Java Fundamental-IV



1. What are types of J2EE clients?
Answer: J2EE clients are the software that access the services components installed on the J2EE container. Following are the J2EE clients:
a) Applets
b) Java-Web Start clients
c) Wireless clients
d) Web applications


2. What do you understand by JTA and JTS?
Answer: JTA stands for Java Transaction API and JTS stands for Java Transaction Service. JTA provides a standard interface which allows the developers to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK uses the JTA transaction manager to implement the transaction. The code developed by developers does not calls the JTS methods directly, but only invokes the JTA methods. Then JTA internally invokes the JTS routines. JTA is a high level transaction interface used by the application code to control the transaction.


Java Fundamental-III


1. When should the method invokeLater()be used?
This method is used to ensure that Swing components are updated through the event-dispatching thread.


2. How can a subclass call a method or a constructor defined in a superclass?
Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass’s constructor.


3. What’s the difference between a queue and a stack?
Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule.


4. You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces?
Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.


5. What comes to mind when you hear about a young generation in Java?
Garbage collection.


6. What comes to mind when someone mentions a shallow copy in Java?
Object cloning.


7. If you’re overriding the method equals() of an object, which other method you might also consider?
hashCode()


8. You are planning to do an indexed search in a list of objects. Which of the two Java collections should you use: ArrayList or LinkedList?
ArrayList


9. How would you make a copy of an entire Java object with its state?
Have this class implement Cloneable interface and call its method clone().




10. How can you minimize the need of garbage collection and make the memory use more effective?
Use object pooling and weak object references.


11. There are two classes: A and B. The class B need to inform a class A when some important event has happened. What Java technique would you use to implement it?
If these classes are threads I’d consider notify() or notifyAll(). For regular classes you can use the Observer interface.


12. What access level do you need to specify in the class declaration to ensure that only classes from the same directory can access it?
You do not need to specify any access level, and Java will use a default package access level


13. What are the contents of web module?
Answer: A web module may contain:
a) JSP files
b) Java classes
c) gif and html files and
d) web component deployment descriptor


14. Differentiate between .ear, .jar and .war files.
Answer: These files are simply zipped file using java jar tool. These files are created for different purposes. Here is the description of these files:
.jar files: These files are with the .jar extenstion. The .jar files contains the libraries, resources and accessories files like property files.
.war files: These files are with the .war extension. The war file contains the web application that can be deployed on the any servlet/jsp container. The .war file contains jsp, html, javascript and other files for necessary for the development of web applications.
.ear files: The .ear file contains the EJB modules of the application.


15. What is the difference between Session Bean and Entity Bean?
Answer:
Session Bean: Session is one of the EJBs and it represents a single client inside the Application Server. Stateless session is easy to develop and its efficient. As compare to entity beans session beans require few server resources.


A session bean is similar to an interactive session and is not shared; it can have only one client, in the same way that an interactive session can have only one user. A session bean is not persistent and it is destroyed once the session terminates.


Entity Bean: An entity bean represents persistent global data from the database. Entity beans data are stored into database.


16. Why J2EE is suitable for the development distributed multi-tiered enterprise applications?
Answer: The J2EE platform consists of multi-tiered distributed application model. J2EE applications allows the developers to design and implement the business logic into components according to business requirement. J2EE architecture allows the development of multi-tired applications and the developed applications can be installed on different machines depending on the tier in the multi-tiered J2EE environment . The J2EE application parts are:


a) Client-tier components run on the client machine.
b) Web-tier components run on the J2EE server.
c) Business-tier components run on the J2EE server and the
d) Enterprise information system (EIS)-tier software runs on the EIS servers


17. Why do understand by a container?
Answer: Normally, thin-client multi-tiered applications are hard to write because they involve many lines of intricate code to handle transaction and state management, multithreading, resource pooling, and other complex low-level details. The component-based and platform-independent J2EE architecture makes J2EE applications easy to write because business logic is organized into reusable components. In addition, the J2EE server provides underlying services in the form of a container for every component type. Because you do not have to develop these services yourself, you are free to concentrate on solving the business problem at hand (Source: http://java.sun.com/j2ee/1.3/docs/tutorial/doc/Overview4.html ).


In short containers are the interface between a component and the low-level platform specific functionality that supports the component. The application like Web, enterprise bean, or application client component must be assembled and deployed on the J2EE container before executing.


18. What are the services provided by a container?
Answer: The services provided by container are as follows:
a) Transaction management for the bean
b) Security for the bean
c) Persistence of the bean
d) Remote access to the bean
e) Lifecycle management of the bean
f) Database-connection pooling
g) Instance pooling for the bean

Search Aptipedia