
Computer Engineering
1999ꡡ254ڡVol.25No.41999



WebĲеļ̳л
ءλӡ
ժҪWebµĲģֲʽ̳лƵıҪԣԻJavaƽ̨ĲģJavaBeansΪһVisualAge for JavaΪķֲ̳ģ͵ʵ;ָһо
ؼʡϢWWWWebü̳л
Inheritance Mechanism Based on WWW in Reusable Components
Ai Lirong He Huacan PengLiang
Department of computer Science&Engineering,Northwestern Polytechnical University Xian 710072)(Software Engineering Institute,Xidian University Xian 710071)
Abxtract:This paper discusses the necessity of ymcorporating distributed inheritance mechanism into reusable components models in WWW(Web) environment.Using JavaBeans,a reusable component model based on Java platform,as a representative,it proposes the implementation method of a distributed inheritancd inheritance model under the deveopment envionment of VisualAge for Java.Finally,it points out further research directions.
Key words:World Wide Web(WWW);Component reuse;Inheritance mechanism
ԽJavaƽ̨ϵĲģ-JavaBeansΪе˷ֲеļ̳лơ
1Javaƽ̨Ĳģ-JavaBeans
1.1ڲõ
ĹģѶߣڲõԽԽ㷺áͨõ(Parts)װµӦӦóڻڲǿģԡԺͿɿԼ绷еĹܣֲüڻԽԽҪJavaJavaƽ̨ҲӦĲģͣJavaBeans
1.2JavaBeans
JavaBeansչƽ̨УJavaBeansһģУõĻλBeanһһBean,BeanJavaʽڵģҲ˵JavaBeansJavaࡣJavaԼƽ̨ԡԡ̬Եʹý֮ϵJavaBeansȻسΪһInternet/IntranetĲģ͡
1.3JavaBeansٵ
ȻJavaBeansģ(COMActiveX)ŵƽ̨绷ԴһЩ⡣
JavaBeans֮Ĺϵܵ˵¿ԷΪࣺ̬Ĺ;̬Ĺ̬ĹָڿнͬBeansͨ¼ӦĳBeanض¼ʱἤBeanӦ̬ĹҪָйӦóʱȷ֮װϵ(ĳװ)̳йϵ(ĳ)ҪʵJava֮ļ̳йϵһ⣬JavaֲάWebвͬʱʵּ̳СJavaBeans Ĺ˵вδṩֲַ̳лƣֻǰJavaBeansһJava(Applet)JARļʽ紫䣬ֲBeans֮ļ̳йϵչΪֲJavaļ̳йϵ
2WebĶ̳ģ
ʵֲַµļ̳Ա뿼ǵֲϵͳܡɿԡȫԡԡ͸ԵءЩֱӰ쵽ֲ̳ģеĸֲԡ
2.1ͳķֲ̳з
һַʹ̳еÿһʹ߼϶һݿȻԻŵڲɸʵ࣬ͼ1ʾ

ͼ1һִͳķֲ̳з
Ȼַ⡣ͬһڲͬ϶п˱֮һԳΪҪ⣬ΪÿһϵĿܱģ֮估ǵ֮ļ޷֤ԣһɵʵƶһܽͻˣҪʹַʵʿУȷļԲҲԸ߶ȿΪϵͳƵҪĿꡣ
Ҳеķǽ࿽Զ̽ϣԶ̽ϱһָĳָ룬ͼ2ʾ

ͼ2ͳķֲ̳зı
ַʵڽƶʱĳͻ⣬ִµ⡣ΪʵһҲڽƶƶʱָָ붼ģĿܴϵͳ벻ϵΪЩָĶ鿴ԼӱָǷ仯ʹϵͳܺܵ͡
2.2Webķֲ̳ģ
WebصǶ̬ǿԸߣų̶ȸߡJavaķչࡢеƶøȻJavaȲ鿴Ƿб̳лõ࣬ûͨURLԶ̽㲢뵽ءͳֲе͵ڱԶproxyͨproxyĲʵֶԶļ̳СŵǶԱʹߵ͸̶ȸߣǵʹ߶ԶƵʱЧʻԽ͡
Webеķֲ̳лӦ͸ԡԡЧԵͳһν͸ԣʹ߸оֲĴڣϲ㿪(VAJ)ʹ߿νṹһֲνṹһӦһȨ޷ΧڲݡΪʵһ㣬ȱһĻƣʹø㶼ⷢصνṹȻпϲĿнصۺ֯Ρа
(1)ϸexposeصΡexposeĹУΪÿһ඼ӦproxyexposeBeansԸӦBeanInfoӦproxy)ٽԵ proxy .classļһproxyģ͡
class proxyA extends classB{
private URL arl;
private string Name;

publicURLgeturl{};
publicString getName{};
}
⣬ӦνṹлԺexposeΪǨʱ谴һȺǨƣȷе˵ӦǨƸǨࡣԣڸexposeʱӦȴӸʼ
(2)ûIDEжεʹתɶԶãVA JavaΪûӦֱVisual Composite EditorвνṹΪVA Java δṩ֧֣ʿһbeanڸbeanܿӵز(еԶbeansµbean)Щ漰Զ̵ʱڵײ㽨ԶproxyϵԶproxyһװصءЩײʹ͸ҲԸûṩȨһЩ(磬Ǩproxy俽)
(3)ƶĹУǸԶURLҵӦproxy,ٸݼ̳йϵֱӻӵĸ༰ʵֵĽӿڡJavaֻ֧ĵؼ̳жֶ֧ؼ̳У˽ṹΪͽṹʿظڽ·ңνṹһǨƣʱɰ㷨
move Hierachy(url,name){
ͨurl,nameҳproxyࣻ
if (໹и){
move Hierachy(url, name);}
װظأ
}
(4)Ŀ¼Ŀ¼Ƿֲʽϵͳж以һҪɲ֡JNDI(Java Naming and Directory Interface)ΪĿ¼ṩһͳһĽӿڡûͨİ(Binding)ضֲҶȵȡӦóͨJNDIṩΪضĿ¼ַʵ޹صĿ¼APIضĿ¼ַϵͳLDAPNDSNISJNDIϵṹͼ3ʾ

  ͼ3JNDIϵṹ
ǲѹWebķֲ̳ģ͵Ľṹ(ͼ4).

ͼ4Webķֲ̳ģ͵ϵṹ
3һĹ
ֵָǣģ͵ȻVAJavaΪ˼·ͬʺ֧Java Beansļɿ
ϽWeb²üеļ̳лչۡǰJavaBeans֮Ĺ˾̬⻹ж̬ĹWeb£ֶ̬һΣûVAJIDEнBean֮¼beanWebϲͬУҪӦĻֲַ֧µĲ¼ֲ²ģͲ걸дһֵ̽⡣
߼飺ءŮ27ֲ̡꣬ʽ㼰˹
ߵλ:ҵѧϵ710072ӿƼѧ710071
ο
1Taivalsaari A.On the Notion of Inheritance. ACM Computing Surveys199628(3)438-479
2Object Management Group.The Common Object Request BrokerArchitecture and Specification Revision 2.0 . OMG Technical Document ptc/96-08-041996-07.URL:ftp://ftp. omg.org/pub/docs/ptc/96-08-04.pdf.gz
3JavaSoft.Javasoft JavaBeans Version 1.00-A.JavaSoft1996
ո:1998-08-04
