Help coderanch get a
new server
by contributing to the fundraiser

Viswanatha GB

Greenhorn
+ Follow
since Sep 19, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Viswanatha GB

Hi, even I/O is not possible thenre is a way to do if you have samll ammount of data. that is Resource Reading..
Java Provides ResuourceBundel API to do so...
just a suggestion..to make simple
Viswa
-------
Hi,
You should never explicitly throw a RemoteException as of EJB1.1 or later. Instead you should either throw an EJBException (or subclass thereof) in the case of a system exception or a subclass of Exception in the case of an application exception. The EJB Spec talks about this in detail in the "Exception Handling" section
Hi, I think you need to understand first few thigns on EJB transaction.

1. Read about ACID : Basic properties of transactions can be summarized using the ACID mnemonic:
2. Transaction Attributes
Transactions can be defined at several different levels and in several different ways.
- Levels
3. Isolation Levels : Isolation levels provide a degree of control of the effects one transaction can have on another.
Then how to
Implementing Two-Phase Commits...
I asume you are using some Application server before telling all the above..
any way if you uise any vendor Application server like IBM WSAD, BEA Weblogic.
Life makes simple...for your problem...
Here goes...how
In the Session EJB method, enclose the statement(s) that start the thread that eventually reaches the operations on multiple EJBs within a try-catch block; e.g.,
try {
return domain.updateBoth( DataBean dataBean);
} catch ( Exception e ) {
mySessionCtx.setRollbackOnly();
}
Note: mySessionCtx is a global variable that is generated by WSAD and included in the Session EJB.

I hope this helps you..
Viswa
Hi,
NO, you should not use I/O,
Using the java.io package from within a bean is prohibited. The EJB 1.1 Specification, section 18.1.2 (Programming Restrictions) states the following:
An enterprise bean must not use the java.io package to attempt to access files and directories in the file system.
Solution is:
The file system APIs are not well-suited for business components to access data. Business components should use a resource manager API, such as JDBC API, to store data.
I hope this helps you..
Viswa
----------
Hi All
can any one give SCEA esam objectives with links to details on each topic.
Thanks
Viswa
-------
Hi Intelli,
Here You have TWO quesrtions
1. Whether to go for Application Server/EJB container Or NOT
2. if you go for App Server, Is EJB is realy need or NOT.
It is all based on the kind of Application you are developing.
If your application need the following capabilities such as:
Clustering
Session-level fail-over
Management consoles
Connection pooling
Load balancing
Fault-tolerance
the go for App Server with EJB.
Else you can do it only a Java Class.
Regards
Viswa
----------
Hi All,
I'm not able to find outwhat exactly main diffrence between LDAP server and RDBMS Server.
Can I use LDAP in placeofDB Server. pls if any one know the diff write me soon.also when I have to use what?
In short
What is the difference between a database and a directory service? When
should I choose for a database and when for a directory service?
I'll appreciate hearing the thoughts/opinions/experiences/recommendations of
anyone with some insights here. Thanks, people.
Viswa
======
[ July 02, 2002: Message edited by: viswagb ]
22 years ago
HI All
Any one know about Object-Oriented Analysis and Design with UML certification pls provide me the more info about how the test pattern.
Thanks in Advance
Viswa
Have one Timer Componet like this. load this componet in Servlet init method
*****************************************
import java.util.*;
import java.io.*;
public class SchedulerComponent
{
Date DateObj =new Date();
//load this text file value and set for date obj.
SchedulerComponent()
{
Timer objTimer = new Timer();
objTimer.scheduleAtFixedRate(new TimerTask()
{public void run()
{
for (int i = 0 ; i < 100 ; i++)
{
System.out.println(i);
}
//iCount1++;
}
}, 0, DateObj);
}
}
********************************************
I think this works for you..
Viswanatha GB
http://viswa.itgo.com
INDIA

Originally posted by vivek sivakumar:
i have a java program which does a simple for loop
like this
class time{
public static void main(String args[])
{
for (int i = 0 ; i < 100 ; i++)
{
System.out.println(i);
}
}
}
but what i want to do is that i have a file (for ex value.txt)where i want to say something like this
[12.05.2002]
9:00
the day and time when this (above program) has to start ... how can i do it ???
any snippet will be helpful ...thanks in advance for ur support.

22 years ago
HI Leena,
The Singleton's purpose is to control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes. Since there is only one Singleton instance, any instance fields of a Singleton will occur only once per class, just like static fields.
Singletons often control access to resources such as
1.Database connections or
2.sockets
Thanks
viswa
Viswanatha GB
1.
[ May 23, 2002: Message edited by: viswagb ]
Hi All,
I' have written the Java POP3 Mail Client.to get my new mails from my Yahoo account. but i'm unable to get only unreadmails. psl help me how to make my Mail Client to get only unread mails..snice now i'm getting all mails when i run this programm.
Programm is like this
==========================================
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
/**
* A simple email receiver class.
*/
public class SimpleReceiver
{
/**
* MAIN method to receive messages from the mail server specified
* as command line arguments.
*/
public static void main(String args[])
{
try
{
String popUser="myyahooID";//args[1];
String popPassword="xxxxxxx";//args[2];
//String popServer="pop.mail.yahoo.com";//args[0];
// String
receive(popServer, popUser, popPassword);
}
catch (Exception ex)
{
System.out.println("Usage: java com.lotontech.mail.SimpleReceiver"
+" popServer popUser popPassword");
}
System.exit(0);
}
/**
* "receive" method to fetch messages and process them.
*/
public static void receive(String popServer, String popUser
, String popPassword)
{
Store store=null;
Folder folder=null;
try
{
// -- Get hold of the default session --
Properties props = System.getProperties();
Session session = Session.getDefaultInstance(props, null);
// -- Get hold of a POP3 message store, and connect to it --
store = session.getStore("pop3");
store.connect(popServer, popUser, popPassword);
// -- Try to get hold of the default folder --
folder = store.getDefaultFolder();
if (folder == null) throw new Exception("No default folder");
// -- ...and its INBOX --
folder = folder.getFolder("INBOX");
if (folder == null) throw new Exception("No POP3 INBOX");
// -- Open the folder for read only --
folder.open(Folder.READ_ONLY);
// -- Get the message wrappers and process them --
Message[] msgs = folder.getMessages();
for (int msgNum = 0; msgNum < msgs.length; msgNum++)
{
printMessage(msgs[msgNum]);
// speakMessage(msgs[msgNum]);
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
// -- Close down nicely --
try
{
if (folder!=null) folder.close(false);
if (store!=null) store.close();
}
catch (Exception ex2) {ex2.printStackTrace();}
}
}
}
=========================================
/**
* "printMessage" method to print a message.
*/
public static void printMessage(Message message)
{
try
{
// -- Get the header information --
String from=((InternetAddress)message.getFrom()[0]).getPersonal();
if (from==null) from=((InternetAddress)message.getFrom()[0]).getAddress();
System.out.println("FROM: "+from);
String subject=message.getSubject();
System.out.println("SUBJECT: "+subject);
// -- Get the message part (i.e. the message itself) --
Part messagePart=message;
Object content=messagePart.getContent();
// -- or its first body part if it is a multipart message --
if (content instanceof Multipart)
{
messagePart=((Multipart)content).getBodyPart(0);
System.out.println("[ Multipart Message ]");
}
// -- Get the content type --
String contentType=messagePart.getContentType();
// -- If the content is plain text, we can print it --
System.out.println("CONTENT:"+contentType);
if (contentType.startsWith("text/plain")
|| contentType.startsWith("text/html"))
{
InputStream is = messagePart.getInputStream();
BufferedReader reader
=new BufferedReader(new InputStreamReader(is));
String thisLine=reader.readLine();
while (thisLine!=null)
{
System.out.println(thisLine);
thisLine=reader.readLine();
}
}
System.out.println("-----------------------------");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}

/*************************************/
/**************************************/
Viswa
[ April 04, 2002: Message edited by: viswagb ]
[ July 02, 2002: Message edited by: Viswanatha GB ]
22 years ago
Hi,
I don't think so it will not call ejbCreat(),
It will call. noramlly we have to Create the PK ID in the ejbCreat() method is self..
here is the samle code
ProductEJB.java
=========================================
public String ejbCreate(String productId, String description,
double price) throws CreateException {
if (productId == null) {
throw new CreateException("The productId is required.");
}
this.productId = productId;
this.description = description;
this.price = price;
return null;
}
=======================================
ProductHome .java
=======================================

public interface ProductHome extends EJBHome {
public Product create(String productId, String description,
double balance) throws RemoteException, CreateException;

public Product findByPrimaryKey(String productId)
throws FinderException, RemoteException;

public Collection findByDescription(String description)
throws FinderException, RemoteException;
public Collection findInRange(double low, double high)
throws FinderException, RemoteException;
}
=======================================
Client
=======================================
public class ProductClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Object objref = initial.lookup("jdbc/Cloudscape");
ProductHome home =
(ProductHome)PortableRemoteObject.narrow(objref,
ProductHome.class);
Product duke = home.create("123", "Ceramic Dog", 10.00);
}
}
=======================================

I think it helps you..but i'm sure it will call ejbCreat methoid..check out..
viswa
[ April 04, 2002: Message edited by: viswagb ]
Hi..
If your planing to use of Weblogic 7.0 it could be very easy i think. since it provides new concept called JCOM where u can easly intract with C++ COM objec as ur API.
Ref:
http://edocs.bea.com/wls/docs70/jcom/index.html
Hi
set u r calss path to this rt.jar you will not get this error..
D:\bea\weblogic61\cong\jdk1.3\jre\lib\rt.jar
viswa
Hi All,
I have a application which is developed usng JEC Swing There is a Frame which is opened with Login Oprion.
i want to disable all the Keys other then some Char & Numaric) when this frame is opened.
Example:
When i boot the system i will open My Applcation after that user should able to open any applications fromn Desktop..like if he press start menu key,F1...F2...some thing like this.
can i do this ? pls let me know how can i achive this through Event OR some other way..
Thanks in Advace
Viswa
======
22 years ago