Labels

Wednesday, December 5, 2012

How to find QC10 bug history by using SQL?

SELECT AL.AU_USER, AL.AU_TIME, AP.AP_PROPERTY_NAME,
       AP.AP_NEW_VALUE, AP.AP_NEW_LONG_VALUE, AP.AP_NEW_DATE_VALUE,AL.AU_ACTION
FROM AUDIT_LOG AL, AUDIT_PROPERTIES AP, BUG B
WHERE (AL.AU_ACTION_ID = AP.AP_ACTION_ID)
  AND (TO_CHAR(B.BG_BUG_ID) = TO_CHAR(AL.AU_ENTITY_ID))
  AND (B.BG_BUG_ID = '20480')
  AND (AL.AU_ENTITY_TYPE = 'BUG')
ORDER BY AU_TIME ASC

Thursday, November 29, 2012

Send a Simple Email

To send an email using your Java Application is simple enough but to start with you should have JavaMail API and Java Activation Framework (JAF) installed on your machine.
Download and unzip these files, in the newly created top level directories you will find a number of jar files for both the applications. You need to add mail.jar and activation.jar files in your CLASSPATH.

Send a Simple Email:

Here is an example to send a simple email from your machine. Here it is assumed that your localhost is connected to the internet and capable enough to send an email.
// File Name SendEmail.java

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Now set the actual message
         message.setText("This is actual message");

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}
Compile and run this program to send a simple email:
$ java SendEmail
Sent message successfully....
If you want to send an email to multiple recipients then following methods would be used to specify multiple email IDs:
void addRecipients(Message.RecipientType type, 
                   Address[] addresses)
throws MessagingException
Here is the description of the parameters:
  • type: This would be set to TO, CC or BCC. Here CC represents Carbon Copy and BCC represents Black Carbon Copy. Example Message.RecipientType.TO
  • addresses: This is the array of email ID. You would need to use InternetAddress() method while specifying email IDs

Send an HTML Email:

Here is an example to send an HTML email from your machine. Here it is assumed that your localhost is connected to the internet and capable enough to send an email.
This example is very similar to previous one, except here we are using setContent() method to set content whose second argument is "text/html" to specify that the HTML content is included in the message.
Using this example, you can send as big as HTML content you like.
// File Name SendHTMLEmail.java

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendHTMLEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Send the actual HTML message, as big as you like
         message.setContent("<h1>This is actual message</h1>",
                            "text/html" );

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}
Compile and run this program to send an HTML email:
$ java SendHTMLEmail
Sent message successfully....

Send Attachment in Email:

Here is an example to send an email with attachment from your machine. Here it is assumed that your localhost is connected to the internet and capable enough to send an email.
// File Name SendFileEmail.java

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendFileEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Create the message part 
         BodyPart messageBodyPart = new MimeBodyPart();

         // Fill the message
         messageBodyPart.setText("This is message body");
         
         // Create a multipar message
         Multipart multipart = new MimeMultipart();

         // Set text message part
         multipart.addBodyPart(messageBodyPart);

         // Part two is attachment
         messageBodyPart = new MimeBodyPart();
         String filename = "file.txt";
         DataSource source = new FileDataSource(filename);
         messageBodyPart.setDataHandler(new DataHandler(source));
         messageBodyPart.setFileName(filename);
         multipart.addBodyPart(messageBodyPart);

         // Send the complete message parts
         message.setContent(multipart );

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}
Compile and run this program to send an HTML email:
$ java SendFileEmail
Sent message successfully....

User Authentication Part:

If it is required to provide user ID and Password to the email server for authentication purpose then you can set these properties as follows:
 props.setProperty("mail.user", "myuser");
 props.setProperty("mail.password", "mypwd");
Rest of the email sending mechanism would remain as explained above.

Send a Simple Email

To send an email using your Java Application is simple enough but to start with you should have JavaMail API and Java Activation Framework (JAF) installed on your machine.
Download and unzip these files, in the newly created top level directories you will find a number of jar files for both the applications. You need to add mail.jar and activation.jar files in your CLASSPATH.

Send a Simple Email:

Here is an example to send a simple email from your machine. Here it is assumed that your localhost is connected to the internet and capable enough to send an email.
// File Name SendEmail.java

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Now set the actual message
         message.setText("This is actual message");

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}
Compile and run this program to send a simple email:
$ java SendEmail
Sent message successfully....
If you want to send an email to multiple recipients then following methods would be used to specify multiple email IDs:
void addRecipients(Message.RecipientType type, 
                   Address[] addresses)
throws MessagingException
Here is the description of the parameters:
  • type: This would be set to TO, CC or BCC. Here CC represents Carbon Copy and BCC represents Black Carbon Copy. Example Message.RecipientType.TO
  • addresses: This is the array of email ID. You would need to use InternetAddress() method while specifying email IDs

Send an HTML Email:

Here is an example to send an HTML email from your machine. Here it is assumed that your localhost is connected to the internet and capable enough to send an email.
This example is very similar to previous one, except here we are using setContent() method to set content whose second argument is "text/html" to specify that the HTML content is included in the message.
Using this example, you can send as big as HTML content you like.
// File Name SendHTMLEmail.java

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendHTMLEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Send the actual HTML message, as big as you like
         message.setContent("<h1>This is actual message</h1>",
                            "text/html" );

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}
Compile and run this program to send an HTML email:
$ java SendHTMLEmail
Sent message successfully....

Send Attachment in Email:

Here is an example to send an email with attachment from your machine. Here it is assumed that your localhost is connected to the internet and capable enough to send an email.
// File Name SendFileEmail.java

import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendFileEmail
{
   public static void main(String [] args)
   {
      
      // Recipient's email ID needs to be mentioned.
      String to = "abcd@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "web@gmail.com";

      // Assuming you are sending email from localhost
      String host = "localhost";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Create the message part 
         BodyPart messageBodyPart = new MimeBodyPart();

         // Fill the message
         messageBodyPart.setText("This is message body");
         
         // Create a multipar message
         Multipart multipart = new MimeMultipart();

         // Set text message part
         multipart.addBodyPart(messageBodyPart);

         // Part two is attachment
         messageBodyPart = new MimeBodyPart();
         String filename = "file.txt";
         DataSource source = new FileDataSource(filename);
         messageBodyPart.setDataHandler(new DataHandler(source));
         messageBodyPart.setFileName(filename);
         multipart.addBodyPart(messageBodyPart);

         // Send the complete message parts
         message.setContent(multipart );

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }
   }
}
Compile and run this program to send an HTML email:
$ java SendFileEmail
Sent message successfully....

User Authentication Part:

If it is required to provide user ID and Password to the email server for authentication purpose then you can set these properties as follows:
 props.setProperty("mail.user", "myuser");
 props.setProperty("mail.password", "mypwd");
Rest of the email sending mechanism would remain as explained above.

Wednesday, November 28, 2012

Best JCAPS Interview questions with Answers

oracle JCAPS Interview questions with Answers

1)      Full form of CAPS
Composite Application Platform Suite.
2)      What is Collaboration
A logical operation performed between some combination of message destinations and
external applications. The operation is defined by a Collaboration Definition, which can
be encoded in either Java or XSLT.

3)      What is a Connectivity Map
 Contains business logic and routing information about the data transmission. A
Connectivity Map usually includes one or more Collaborations, topics, queues, and
eWays. A Connectivity Map is created under a Project. A Project may have multiple
4)      What is Deployment Profile
Contains the information about how the Project components will be deployed in an
Environment. A Project can have multiple Deployment Profiles, but only one
Deployment Profile can be activated for a Project in any one Environment.
5)      What is Environment
A collection of physical resources and their configurations that are used to host Project
components. An Environment contains logical hosts and external systems.
6)      What is a eWay
A link between a Collaboration and an external connection including the message
server connection (topic or queue) or external application.
7)      What is a External Application
A logical representation in an eGate Project of an external application.
8)      What is a External System
A representation in an eGate Project of an external application system.
9)What is a Integraion Server
J2EE software platform that houses the business logic container used to run
Collaborations and JCA connectors (eWays). Provides transaction services, persistence,
and external connectivity.
9)      What is a JMS IQ Manager
JMS-compliant, guaranteed delivery store, forwarding, and queueing service.
Link
The JMS Connection between a Collaboration and a topic or queue in a JMS-compliant
message server.
10)   What is a Logical Host
An instance of the eGate runtime Environment that is installed on a machine. A Logical
Host contains the software and other installed components that are required at
runtime, such as application and message servers.
11)What is a Management Agent
Uses J2EE technology to manage and monitor an eGate 5.0 deployment that may
contain other application servers in addition to the SeeBeyond Integration Server.
Defines management interfaces and services designed for distributed environments,
focusing on providing functionality for managing networks, systems, and applications.
12)What is Message Destination
A general term for a topic or queue. Two or more Projects can share a message
destination that has the same name and is deployed on the same message server. A
single Project may also have a single message destination referenced in multiple
Connectivity Maps.
13) What is a OTD
An acronym for Object Type Definition. OTDs contain the data structure and rules that
define an object. An OTD is used in Java Collaboration Definitions for creating data
transformations and interfacing with external systems.
14) how you define a Project in JCAPS
Contains a collection of logical components, configurations, and files that are used to
solve business problems. A Project organizes the files and packages and maintains the
settings that comprise an eGate system in SeeBeyond’s Enterprise Designer.
15)What is a Queue
A JMS queue is a shareable object that conforms to the point-to-point (p2p, or PTP)
messaging domain, where one sender delivers a message to exactly one receiver. When
the SeeBeyond JMS IQ Manager sends a message to a queue, it ensures it is received
once and only once, even though there may be many receivers “listening” to the queue.
This is equivalent to the subscriber pooling in other queue implementations. You can
reference a queue that exists in another Connectivity Map or Project.
16)What is Repository
Stores and manages the setup, component, and configuration information for eGate
Projects. The Repository also provides monitoring services for Projects, which include
version control and impact analysis.
17)What is the use of Schema Runtime Environment
An add-on in eGate 5.0 that provides the upgrade path for e*Gate 4.x users to upgrade
to eGate 5.0. Also known as the SRE.
18) What is Service in JCAPS
Contains the information about executing a set of business rules. These business rules
can be defined in a Java Collaboration Definition, XSLT Collaboration Definition,
Business Process, eTL Definition, or other service. A Service also contains binding
information for connecting to JMS Topics, Queues, eWays, and other services.
19) Define Topic
A JMS topic is a shareable object that conforms to the publish-and-subscribe (pub/sub)
messaging domain, where one publisher broadcasts messages to potentially many
subscribers. When the SeeBeyond JMS IQ Manager publishes a message on a topic, it
ensures that all subscribers receive the message.
20) Define XSLT
An acronym for Extensible Stylesheet Language Transformations. A File format used in
eGate to generate Collaboration Definitions.

Tuesday, November 27, 2012

Best OOPS Concepts with examples

OOPS Concepts are mainly 4
 1.Abstraction
 2.Encapsulation
 3.Inheritance
 4.Polymorphisam
Abstraction:-Hidding non-essential features and showing the
essential features

              (or)
Hidding unnecessary data from the users details,is called
abstraction.
Real Time example:TV Remote Button

in that number format and power buttons and other buttons
there.just we are seeing the butttons,we don't see the
button circuits.i.e buttons circutes and wirings all are
hidden.so i think its good example.

Encapsulation:

    Writing Operations and methods stored in a single
class.This is Called Encapsulation

Real Time Example:Medical Capsuals
i.e one drug is stored in buttom layer and another drug is
stored in Upper layer these two layers are combined in
single capsual.

Inheritance:
   The New Class is Existing from Old Class,i.e SubClass is
Existing from Super Class.

Real Time Example:
      Father and Son Relationship

Polymorphisam:

          Sinle Form behaving diffreantly in diffreant
Situations.
  Example:-
            Person
Person in Home act is husband/son,
       in Office acts Employer.
       in Public Good Cityzen.

Monday, November 26, 2012

Must Know Java Interview Questions After 2 + Years of Experience”

 What is the purpose of serialization?
    Answer: Serialization is the conversion of an object to a series of bytes, so that the object can be easily saved to persistent storage or streamed across a communication link. The byte stream can then be deserialised – converted into a replica of the original object.

    What is the difference between JDK and JRE?
    Answer: Java Development Kit (JDK) is the most widely used Java Software Development Kit. Java Runtime Environment (JRE) is an implementation of the Java Virtual Machine which executes Java programs.

    What is the difference between equals() and “==” ?
    Answer: Equals is intended to check logical equality and == checks if both references point to same object. (Thanks Sandeep)

    a == b;        // Compares references, not values.
    a.equals(b);  // Compares values for equality.


    When will you use Comparator and Comparable interfaces?
    Answer: java.util.Comparator and java.lang.Comparable
    java.util.Comparator compares some other class’s instances, while java.lang.Comparable compares itself with another object.
  
    What is the wait/notify mechanism?
    Answer: This deals with concurrent programming. The wait() and notify() methods are designed to provide a mechanism to allow a thread to be block until a specific condition is met.
    However, java.util.concurrent should be used instead of wait() and notify() to reduce complexity.

    What is the difference between checked and unchecked exceptions?
    Answer:
    In general, unchecked exceptions represent defects in the program (bugs), which are normally Runtime exceptions.
    Furthermore, checked exceptions represent invalid conditions in areas outside the immediate control of the program.

    What is the difference between final, finally and finalize?
    Answer: “final” is the keyword to declare a constant AND prevents a class from producing subclasses. (Thanks Tom Ellis)
    “finally” is a block of code that always executes when the try block is finished, unless System.exit() was called. finalize() is an method that is invoked before an object is discarded by the garbage collector.
    Source | Final Usage |Finally Usage | Finalize()
    What is the difference between web server and app server?
    Answer: A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols.

    Explain the Struts1/Struts2/MVC application architecture?
    Answer: Struts was adopted by the Java developer community as a default web framework for developing web applications
    The MVC(Model–view–controller) an application that consist of three distinct parts. The problem domain is represented by the Model. The output to the user is represented by the View. And, the input from the user is represented by Controller.

    What is the difference between forward and sendredirect?
    Answer: Both method calls redirect you to new resource/page/servlet. The difference between the two is that sendRedirect always sends a header back to the client/browser, containing the data in which you wanted to be redirected.

    How does a 3 tier application differ from a 2 tier one?
    Answer: Tiers are the physical units of separation or deployment, while layers are the logical units of separation.
    Imagine that you’re designing an e-commerce website. A 3 tier architecture would consist of web pages, a web server and a database, with the corresponding 3 layers being the “Presentation”, “Business Logic” and “Database” layers.
    If you take the database tier and layer out then your have a 2 tier architecture.

    What is the difference between JAR and WAR files?
    Answer: JAR files (Java ARchive) allows aggregating many files into one, it is usually used to hold Java classes in a library.
    WAR files (Web Application aRchive) stores XML, java classes, and JavaServer pages for Web Application purposes.

    What is a Left outer join?
    Answer: This deals with SQL. Left outer join preserves the unmatched rows from the first (left) table, joining them with a NULL row in the shape of the second (right) table.

    What is the difference between UNION and UNION ALL?
    Answer: This deals with SQL. UNION only selects distinct values, UNION ALL selects all values.

Tuesday, November 6, 2012

How is an argument passed in java, by copy or by reference ?

If the variable is primitive datatype then it is passed by copy.
If the variable is an object then it is passed by reference