sowmya thiru

Greenhorn
+ Follow
since Jun 09, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by sowmya thiru

In bruce eckel book, builder pattern returns a product which can be Book or Magazine or WebSite . all having a parent Media Type. This makes sense to me.
So in builder class, return type points to Media (parent) rather than specific child class like Book or Magazine or WebSite
when i was trying to do a sample excercise, in which one Builder that puts the words into a java.util.TreeSet, and another that produces a word count to java.util.HashMap
my question:
One builder returns TreeSet , another builder retruns HashMap
how do I map to a common base product. I want to do something similar to
Media -- Magazine, Web, Book. where Media is shown as Return type in each Builder class
Hi,
Im a rookie in DP. Im trying out bruce eckel questions on DP. one excercise on Builder is
"Break a text file up into an input stream of words (consider using regular expressions for this). Create one Builder that puts the words into a java.util.TreeSet, and another that produces a java.util.HashMap containing words and occurrences of those words (that is, it does a word count)."
Here is my solution. I want somebody to validate/finetune it. I have not coded word count algorithm
-------------------------------------------
public class Builder {
public Builder()
{}
public product getFinishedProduct(String str) {
return null ;
}
}
------------------------------
import java.util.*;
public class CountBuilder extends Builder {

private product p ;
public CountBuilder()
{
p = new product();
System.out.println("count builder constructor");
}
public product getFinishedProduct(String str) {
HashMap hm = new HashMap();
hm.put("one" ,"two");
p.addHashMap(hm);
return p;
}
}
------------------------------
import java.util.*;
public class SetBuilder extends Builder {
private product p ;
public SetBuilder()
{
p = new product();
System.out.println(" SetBuilder constructor");
}
public product getFinishedProduct(String str) {
StringTokenizer st = new StringTokenizer(str);
TreeSet ts = new TreeSet();
while (st.hasMoreTokens()) {
ts.add(st.nextToken());
}

p.addTreeSet(ts);
return p;
}
}
------------------------------
import java.io.*;
public class director {
private Builder builder ;
public director(Builder b) {
this.builder = b ;
}
public product produceProduct() {
BufferedReader in;
try
{
in = new BufferedReader(new FileReader("abc.txt"));
return builder.getFinishedProduct(in.readLine());
}
catch (Exception e) {
e.printStackTrace();
return null ;
}
}
}
------------------------------
import java.util.*;
public class product {
HashMap hm ;
TreeSet ts ;
public product() {
}
public void addHashMap(HashMap hm){
hm = hm;
}
public void addTreeSet(TreeSet ts) {
this.ts = ts;
}
public String toProduct() {
if (hm!=null) {
return hm.toString();
}
else
{
return ts.toString();
}
}
}
------------------------------
public class testDirectory {
public static void main(String arr[]){
director d = new director(new SetBuilder());
product p = d.produceProduct();
System.out.println(p.toProduct());
}
}
------------------------------
do i need to read ejb 2.0 specs or ejb 1.1 specks?
not 1 5, 3
private key is used of encription
For example, if someone has exploded a signed JAR file, has modified
one of its files, and has rebuilt the JAR file, when we try to verify the
signature using jarsigner, we get the following error message:

jarsigner: java.lang.SecurityException: SHA1 digest error for
itso.class
for applet to be trusted.
it HAS TO BE Digitally signed.
unsigned applet is NOT TRUSTED
if a signed jar is modified, it can be verified..but verification process will fail ..data integreity check is done by public/private key algo
umm surprised.... in many of SCEA notes, i have seen mentioning on cryptography, digest, pki, digital certificates apart from jdk security and applet security.
can anybody confirm that therei s not need to study on pki, certificate, digital signature.
what is the scope in security section?
applet security and jdk 1.1 , 2 security model?
question on applet security
in jdk1.1, a signed jar gets full access to system resources correct?
if a jar is signed..is it also trusted?
if above is not correct..how to make applet trusted apart from it is signed
Here is my understanding
1. Confidentialy/EavesDropping - Data is not read during transmission between sender and receiver. This is taken care by Encrption and Decrption � Symmetric cryptography.
correct?
2. Data Integrity/Tampering - Data is not modified during transmission between sender and receiver. This is taken care by public key crptography
correct?
so if I use just SSL and not using any certificate or digital signature, is it correct to say that i have taken care of point 1 but not point 2.
3. to vouch for public key, I need to use trusted CA like Verisign etc
correct?
4.im referring to figure 3 of following link:
http://developer.netscape.com/docs/manuals/security/pkin/contents.htm#1051918
From this diagram, Im assuming that original data is encrpted using symetric algo and transmitted via ssl along with digital signature.
correct?
Section: 8.5 of SUn J2EE tutorial on JTA in Web components
"Calling UserTransaction.begin associates the calling thread with a new
transaction context. Subsequent accesses of transactional resources such as JDBC
connections or resource adapter connections implicitly enlist those resources into
the transaction. The call to UserTransaction.commit commits the transaction,
transparently engaging the two-phase commit protocol if necessary."
Scenario:
In my web component code (jsp/servlet), i get usertxn using jndi , and begin txn, put some vaue to sesssion, and call JDBC connection.
MyQuestion: If i get sql exception during my jdbc call and txn rollbacks, will the value added to session gets rolled back?
SFSB
you can begin a transaction during ejbCreate() and commit/rollback in another business method
What will be effect when ejbCreate() is part of Txn start, and rollback happens in anotehr method?
SFSB
you can begin a transaction during ejbCreate() and commit/rollback in another business method
What will be effect when ejbCreate() is part of Txn start, and rollback happens in anotehr method?
here is the code that im running SFSB on WLS8.1. SFSB is called from a standalone java client.
clients transfer money from checking to savings. in my db i have 20$ in Checking. I make an attmpt to transfer $60 from checking to savings.
public void transferToSaving(double amount) throws InsufficientBalanceException {
checkingBalance -= amount; savingBalance += amount;
try { updateChecking(checkingBalance); if (checkingBalance < 0.00) {
System.out.println("loop starting"); //THIS LOOP IS PUT DELIBERATELy, // so that I can check DB if value has been deducted from checking table
for (int i = 0 ; i < 1000000000; i++) { }
context.setRollbackOnly(); throw new InsufficientBalanceException(); } updateSaving(savingBalance); } catch (SQLException ex) { throw new EJBException ("Transaction failed due to SQLException: " + ex.getMessage()); }
}
At end of above method, i see -40 in my checking account, and savings account incremented by 60$
my question. why updated to checking table has not rolled back?
here is the code that im running SFSB on WLS8.1. SFSB is called from a standalone java client.
clients transfer money from checking to savings. in my db i have 20$ in Checking. I make an attmpt to transfer $60 from checking to savings.
public void transferToSaving(double amount) throws InsufficientBalanceException {
checkingBalance -= amount; savingBalance += amount;
try { updateChecking(checkingBalance); if (checkingBalance < 0.00) {
System.out.println("loop starting"); //THIS LOOP IS PUT DELIBERATELy, // so that I can check DB if value has been deducted from checking table
for (int i = 0 ; i < 1000000000; i++) { }
context.setRollbackOnly(); throw new InsufficientBalanceException(); } updateSaving(savingBalance); } catch (SQLException ex) { throw new EJBException ("Transaction failed due to SQLException: " + ex.getMessage()); }
}
At end of above method, i see -40 in my checking account, and savings account incremented by 60$
my question. why updated to checking table has not rolled back?
14 years ago
i dont think your tool will solve problems esp in such situation.
1. customer facing pef. problem in production env
2. your tool needs adding few lines of code. ( which I feel is major drawback for such situation). many customers may not want to add code, even developers might feel lil bit apprehensive in adding extra code to monitor perf.
a j2ee app might consists of many components jsp,servlets,ejb, dao, etc etc... in order to benchmark my app, i dont want to go into each component and add few lines of code
14 years ago
1. Ideal tool for benchmarking a typical j2ee application consisting of JSP/Servlets/JDBC/EJB etc. Objective of benchmarking my application, is to see how much concurrent users it can withstand w.o breaking down.
2. Looking for lightwt profiling tool
14 years ago