youngwoo seo

Greenhorn
+ Follow
since May 28, 2004
Merit badge: grant badges
For More
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by youngwoo seo

Hi, guys.
I have something which i can't understand the benefit when using prototype pattern. On the book 'Sun Certified Enterprise Architect for J2EE Tech..', the benefits of using prototype pattern is like that:
1. Adding and Removing products at run time.
2. Specifying new objects by varying value.
3. Specifying new objects by varying structure.
4. Reducing subclassing.
5. Configuring an application with classes dynamically.

i can know how the prototype pattern composed of. but i can't understand the benefit listings(2,3,4)
Is there anybody who can tell me the reason why the benefit is like that?

1.
package framework;
import java.util.*;

public class Manager {
private Hashtable showcase = new Hashtable();
public void register(String name, Product proto) {
showcase.put(name, proto);
}
public Product create(String protoname) {
Product p = (Product)showcase.get(protoname);
return p.createClone();
}
}

2. package framework;

public interface Product extends Cloneable {
public abstract void use(String s);
public abstract Product createClone();
}

3.
import framework.*;

public class Main {
public static void main(String[] args) {

Manager manager = new Manager();
UnderlinePen upen = new UnderlinePen('~');
MessageBox mbox = new MessageBox('*');
MessageBox sbox = new MessageBox('/');
manager.register("strong message", upen);
manager.register("warning box", mbox);
manager.register("slash box", sbox);


Product p1 = manager.create("strong message");
p1.use("Hello, world.");
Product p2 = manager.create("warning box");
p2.use("Hello, world.");
Product p3 = manager.create("slash box");
p3.use("Hello, world.");
}
}

4.
import framework.*;

public class MessageBox implements Product {
private char decochar;
public MessageBox(char decochar) {
this.decochar = decochar;
}
public void use(String s) {
int length = s.getBytes().length;
for (int i = 0; i & lt; length + 4; i++) {
System.out.print(decochar);
}
System.out.println("");
System.out.println(decochar + " " + s + " " + decochar);
for (int i = 0; i & lt; length + 4; i++) {
System.out.print(decochar);
}
System.out.println("");
}
public Product createClone() {
Product p = null;
try {
p = (Product)clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return p;
}
}

5.
import framework.*;

public class UnderlinePen implements Product {
private char ulchar;
public UnderlinePen(char ulchar) {
this.ulchar = ulchar;
}
public void use(String s) {
int length = s.getBytes().length;
System.out.println("\"" + s + "\"");
System.out.print(" ");
for (int i = 0; i & lt; length; i++) {
System.out.print(ulchar);
}
System.out.println("");
}
public Product createClone() {
Product p = null;
try {
p = (Product)clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return p;
}
}
---------------------------------------------------------------------------
Hi folks

I've just finished with SCJD, and I'm looking towards SCEA. I've browsed through this forum, and there's some talk about a new release of the SCEA exam, so I was thinking about doing something else while I wait. Would SCWCD or SCBCD be any help with the SCEA exam? I'm keen to get going with something, but these aren't skills that i'll use right now so there's not much point in doing the exams unless they'll help with SCEA.

Alternatively, how about the IBM certified enterprise developer exams? Some of those (484, 486) sound like they might be useful for SCEA.
---------------------------------------------------------------------------

Hi.
Now, i am preparing for the SCEA. Maybe i gonna take the test on Aust 1. At the end of the June, i passed the SCBCD. In the SCEA, it also requires more knowledge about the EJB than other technologies(ie, pattern, uml, security..etc). so as i think, you had better take SCBCD first than SCEA. and then if u take the SCEA, you can save more time to prepare for the SCEA.
I passed the test today, thank the information provided here ,thank everybody.


============================================================
SCJP, SCJD, SCBCD, OCP
19 years ago
----------------------------------------------------------------
The book says, in ejbCreate method of a stateful bean we cannot call methods to rollback a transaction or find out if transaction has already been set to rollback(CMT)?

But we can get a transaction reference and call method on it...(BMT)

Why is that so?
Is that because we cannot declare the ejbcreate method as CMT in DD?
Thanks,
-------------------------------------------------------------------
hi.
in ejbCreate method of a stateful bean, we cannt call to rollback on transaction. but if the stateful session bean implements SessionSynchronization interface, business method can call to rollbak on transaction. additionally, business method of the stateful session bean is called in the "READY STATE". so in the ejbCreate(), you can't call to rollback.

reference it : http://www.valoxo.ch/jr/BeanLC.pdf
[ June 22, 2004: Message edited by: youngwoo seo ]
//////////////////////////////////////////////////////////////
Which session bean component interface method(s) can be called successfully, by a local client.

A. remove()
B. getHandle()
C. isIdentical()
D. getEJBHome()


My Answers: A, B, C, D

Explaination : Local Client might have a remote component object, in that case it can see all the above methods and infact use it. In the question only the client is local not the component.

But the answer to this mock questions are given as A & C.

Does anybody knows why?
//////////////////////////////////////////////////////////////////////////
I think the answer is A & C.

in EJBHome interface:
EJBMetaData getEJBMetaData(),
HomeHandle getHomeHandle(),
void remove(Handle) --> EJBLocalHome
void remove(Object key)

in EJBObject interface:
Object getPrimaryKey()
EJBHome getEJBHome()
Handle getHandle()
void remove()
boolean isIdentical

in EJBLocalObject interface;
Object getPrimaryKey()
EJBLocalHOme getEJBLocalHome()
void remove()
boolean isIdentical(Object o)

the session bean can call remove(Object key) on the EJBHome, but the container will throw RemoteException. remove(Object key) method is for only entity bean.
You have to know that the question is "called Successfully".
as u said, a & b& c&d(never seen)methods are called. but
for a, c is ok. but for b, there is no method named getHandle() in the EJBLocalObject interface. so it cause to throw an exception.

that's what i think that answer a,c is correct.
[ June 22, 2004: Message edited by: youngwoo seo ]
hi guys.
i got an question about the transaction-related with DD.
the question is :

Which of the following deployment descriptor element specifies whether the enterprise bean is associated with container-managed or bean-managed transaction demarcation (select the best answer):

..
b. <transaction-type>
..
..

the answer is b.
but the explanation is that :

B) is correct. Note: This element is used only in session and message-driven beans because it is mandatory for entity beans to use container-managed transaction demarcation.

from this explanation, i am so complicated. Does this explanation means that the <transaction-type> tags is used only in session, message-driven, and entity bean? or what else?

i am so nervous about the exam. i have exam on this sunday...but there are too many things to memorize and understand the complicate principal about EJB...

Thx in advanced
hi, guys.
i got some questions in HFE.

No 12 on page 434 of HFE,it's about the EJB QL.
the question is
-----------------
Given CMP beans CustomerBean, OrderBean, and LineItemsBean with the following relations;

CustomerBean(1)<--> OrderBean(n)
OrderBean(1)<-->LineItemsBean(n)

which will return all orders that have line items?
a. select distinct o
from Order o, IN(o.lineItems) li
b. select distinct Object(o)
from Order o, IN(o.lineItems) li
c. select Object(o)
from Order o
where o.lineitems=0
d. select object(o)
from Order o

the answer is b, d. but i think there is no answer.
and a,c is incorrect and i can know why.
but b,d also there is some problem as i think.
on B, there is no 'where' clause, so the result is all order objects(no duplicate).
on D is as same reason to b.but could be duplicated.

does anybody know?