毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

分布式环境中动态代理的应用外文翻译 第6页

更新时间:2007-10-15:  来源:毕业论文



objects on the client side. The servlets act as controllers allowing access to these resources.
We present the same example considered in the RMI and CORBA-based systems to explain how to implement the request/response model to support code reuse using Java’s servlets API. Figure 20 shows the pseudo code for an application client utilizing URL and URLConnection objects (lines 36 and 13-22) to request a reference to a proxy object implementing a reusable general behaviour at the server side. The client forwards a request by serializing the request’s parameters (lines 23-27) as two dlements of a vector (lines 37-41). The result is de-serialized (lines 29-34) and asted to IPoint (line 42). As in the previous RMI and CORBA cases, invoking a set method on the returned Proxy object (line 43) sets the object attribute to a new value and fires an event(PropertyChangeEvent) informing the listener (tclient) of the state change. In this way, the attributes of the base object (ipoint) behave as active properties of JavaBeans.
The servlet referred to in Figure 20 is specified in the URL string expression “http://<server:port/servlet location>”and runs on a Web server. In addition, the server also hosts the classes implementing the reusable code of catching and firing PropertyChangeEvents.
Figure 21 shows an implementation of an HttpServlet. The servlet processes HTTP requests (i.e. GET,POST,PUT,DELETE,HEAD) of a client by overriding the corresponding methods the processing to the doGet() method. We choose to delegate the processing to the doPost() method because there is no limit on the data size to be processed (lines 27-29). The method uses the HttpServletRequest parameter to de-serialize the data (lines 20 and 7-12) and obtain the object parameters needed to call the reusable code (lines 21-23). The proxy reference is then serialized and sent back to the client using  the HttpServletResponse parameter of the method (lines 24 and 13-17).
By de-serializing the parameters, the server must have access to client classes to call the reusable code. Mechanisms, such as dynamic class loading as provided by the RMI system or provision of a pool of classes accessible to the server, are needed to support the HTTP communication and allow the server to load the client object parameters.

DISCUSSION
Our approach to constructing distributed systems based on dynamic proxies makes use of polymorphism and reflection to process object data as part of customizing base objects’ behaviour at runtime. Reflection offers flexibility but imposes an extra overhead causing performance problems. Caching is one means of enhancing performance by reducing the server load. An overall strategy for managing the reusable proxy objects including a caching policy would be beneficial to counter the effects of reflection and improve performance; this is left as a topic for future research.
We have presented three implementation approaches for constructing distributed systems based on dynamic proxies and part of any analysis should be a comparison of those approaches to assess the relative merits of each. In comparing the three implementation approaches adopted in this work, we concentrate on the salient features of the different architectures.
RMI and CORBA are considered as two platforms specifically designed for developing OO distributed systems and as such share common features. Java Servlets, on the other hand, provide an API allowing HTTP communications between clients and servers according to the request/response model. Compared with the RMI and CORBA/IIOP protocols, HTTP is stateless and suitable for text transfer only; objects must be serialized and de-serialized before being sent and received along the communication wire. Enterprise applications require stateful communication sessions, security and transaction services. Servlets provide no naming service, no dynamic class loading and there is no security mechanism readily available for them (access security is normally managed by the servlet engine, i.e. the Web server). RMI and CORBA provide such services and more.
RMI and CORBA provide similar mechanisms for transparently accessing remote objects. The most important difference between the two technologies lies in the portability across language and operating systems platforms. RMI can only operate with Java systems and is thus tied to platforms with Java support whereas CORBA supports heterogeneous systems written in different languages and distributed over different platforms. RMI provides no support for legacy systems written, for example, in Fortran and Cobol; in CORBA, server implementations can be written in various languages and accessed by any language with an IDL language mapping. Alothough developing distributed applications follows a similar procedure in both frameworks, CORBA requires knowledge of the IDL and IDL mapping of the implementation language. IDL language mappings are specified by the Object Management Group (OMG) and mapping tools for generating stubs and skeletons required to establish the connection between clients and servers over the ORB would be needed.
In addition to the difference in the definition of the client server (RMI uses Java interface construct and CORBA the IDL), there is a slight difference in their architectures. In RMI, stubs and skeletons are generated from implementation objects. In CORBA, stubs and skeletons are formed from the IDL interface. As a result, in RMI, the generated stub is a proxy for all the remote interface of the remote objects, whereas in CORBA, each interface requires its own stub.
We perceive four key advantages to implementing reusable code on the server side with the help of dynamic proxies. Firstly, no changes on the client side are required and the client applications remain executable without being attached to the meta-code on the server side. Secondly, the meta-code is held separate from base applications. This is a desirable design feature since it reduces complexity and enhances the readability of the code. Thirdly, the class structure shows less coupling when compared with the corresponding static case and the object coupling between both sides (clients and servers) is flexible; one meta-object can be used to represent several base objects and vice versa. Finally, with the help of polymorphism and reflection, customization code is implemented independently and without any reference to particular applications. Variables of generic types such as java.lang.object are used to hold application objects and reflection is used to manipulate object data at runtime.

CONCLUSIONS AND FUTURE WORK
Java’s dynamic proxies provide a means of constructing a behavioural reflection model. With this model, the design principle of open implementations can be applied where the behaviour of application objects can be customized at runtime using proxy objects populating the meta-level. The meta-program is generic and realized independently of any application and thus reusable.Two programming models are considered: the single application model and the client/server model. In the latter, client and server applications run on different machines distributed over a TCP/IP network. The issue of considering the Java language as a system application is not addressed and will be left for future investigation.
    We use the proxy reflection model to implement reusable code. In the case of distributed systems, this code is implemented on the server side and accessed by clients via RMI ,CORBA/IIOP or HTTP protocols. The question of comparing our approach to code reuse with the standard OO mechanisms such as inheritance and aggregation (composition) is not discussed in full detail and is also left for future investigation.
Single JVM solutions to reusable code can be developed by interpreting the invocation handler of dynamic proxies as a meta-object and by using reflective techniques. The underlying architecture is open and consists of two levels: a base level populating application objects and a meta-level hosting the proxy objects.Application objects at the lower level implement default behaviour. The proxy object at the higher level control the behaviour of base objects by intercepting base-level operations such as method invocations and field access. To provide an enterprise solution with multiple JVMs connected over a TCP/IP network but retaining the semantics of both levels as is, we transform the single application into a client/server application. The transformation is realized by adapting the single application into a client/server application. The transformation is realized by adapting the single application code, firstly, to the requirements of an RMI-based system, secondly, to those of a CORBA IDL programming model, and finally, to the requirements of a request/response model supported by HTTP servlets.
For the RMI systems, a transformation algorithm including a number of steps is presented and the adapter pattern is used to accommodate the functionality of the single JVM implementation in the distributed environment. In the case of a distributed CORBA system, the transformation is realized by following the usual steps of implementing a client/server application is this environment. This consists of firstly defining a generic IDL interface and then implementing this interface on the server side using the classes (stubs and skeletons) generated by applying the algorithm to transform our single application to a distributed system supporting reuse over the ORB is similar to that of RMI. The main difference is that the CORBA client or server can be implemented in Java, C,C++,Lisp,Python,Smalltalk,COBOL,and Ada,or indeed any other language for which the OMG specifies IDL mapping. In RMI, both client as well as server must be Java applications. For the HTTP-protocol solution, we used classes of the java.net and javax.servlet packages to locate and to connect to servlets running on and contained in a Web server. The servlets act as controllers providing access to the reusable resources. On receiving an HTTP request (mainly GET or POST), a servlet uses helper classes implementing the reusable code to provide the client with required object references as an HTTP response.
In terms of future work, we are currently investigating the question of implementing the meta-level open architecture by using other techniques, such as compile-time MOPs, to implement reusable code. The question of comparing the dynamic proxies approach with other OO approaches to code reuse using software metrics is also under investigation. In addition , we are also intereted in examining the issue of how our approach to reuse contributes to solving the scaling problem of component libraries and to the question of how the reflection model based on proxies supports the idea of meta-object protocols.

ACKNOWLEDGEMENTS
The authors are grateful for incisive and useful comments from the anonymous reviewers. The paper has benefited significantly as a result. Thanks also to Rachel Hamill of the School of Computer Science and Information Systems at Virkbeck or her helpful comments on a draft of the revised paper.

PEFERENCES
1.        Kiczcales G.Beyond the black box: Open implementation. IEEE software 1996;13(1):8-11
2.        Hassoun Y,Johnson R, Counsell S.Reuability,Open implementation and Java’s dynamic proxies. Proceedings of the 2nd International Conference on the Principles and Practice of Programming in Java, Killkenny,Ireland,June 2003;3-6
3.        Java 2 Platform.Sun Microsystems.http://java.sun.com/
4.        Johnson RE,Foote B Designing reusable classes.Journal of Object-Oriented Programming 1988
5.        Gamma E ,Helm R,Johnson R,Vlissides J.Design Patterns.Elements of Reusable Object-Oriented Software. AddisonWesley:reading ,MA,1995
6.        Object Management Group(OMG).UML resource page.
http://www.omg.org.uml/ [May 2003]
7.        Czarnecki K,Eisenecker UW. Generative Programming :Methods,Tools and Applications. Addison-Wesley: Reading,MA,2000
8.        Bieman JM,Zhao JX,Reuse through inheritance: A quantitative study of C++ software. Proceedings of the ACM symposium on software Reusability(SSR’95),Seattle,April 1995;4-52
9.        Cargill G.C++ Programming Style. Addison-Wesley:Reading ,MA,1992
10.        Sitaraman M, Atkinson S, Kulczycki G,Weide BW, Long TJ, Bucci P, Heym WD, Pike SM,Holling sworth JE. Reasoning about software-component behavior.Proceedings of the 6th International Conference on Software Reuse(ICSR-7)
11.        Pike SM,Sridhar N.Early-raply components:Concurrent execurtion with sequential reasoning. Proceedings of the 7th International Conferendce on software Reuse(ICSR-7)
12.        Maes P.Concepts and experiments in computational reflection. Proceedings of the Conference on Object-Oriented Programming Systems Languages and Applications(OOPSLA87)ACM Apress:New York.1987;147-155
13.        Ferber J.Computational reflection in class based object-oriented languages. Proceedings of the Conference on Object Oriented Programming Systems Languages and Applications(OOPSLa89) ACM Apress:New York.1987;317-326
14.        Demers FN,Malenfant J. Reflection in logic, functional and Object-oriented Programming :A short comparative study. Proceedings of the IJCAI95 Workshop on Reflection and Metalevel Architectures and Their Applications in AI,August 1995;29-38
15.        Kiczales G,des Rivieres J,Bobrow DG.The Art of the Metaobject Protocol. MIT Press: Cambridge,MA,1991
16.        Kiczales G,Lamping J, Mendhekar A, Maeda C, Lopes CV, Loingtier J-M,Irwin J. Aspect-oriented programming Proceedings of the 11th European Conference onf Object-Oriented Programming (ECOOP97        )
17.        Biggerstaff TJ.Second order reusable libraries and meta-rules for component generation. Proceedings of the 7th Annual Workshop on Institutionalizing Software Reuse(WISR 7),St.Charles.IL,28-30
18.        JavaSoft. Java Remote Method Invocation. Sun Microsystems.
http://java.sun.com/products/jdk/rmi/
19.        JavaSoft.CORBA Technology and the Jaba 2 Platform, Standar Edition. Sun Microsystems
20.        Object Mangement Group (OMG).About the Object Mangement Group
21.        World Wide Web Consortium(W3C).HTTP specifications.
http://www/w3.org/Protocols/HTTP/
22.        Object Management Group(OMG) OMG IDL: Details. http://www.omg.org/getting started/omg_idl.htm
23.        Brose G,Vogel A,Duddy K,Java Programming with CORBA(3rd edn).Wiley: New York.2001.

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页

分布式环境中动态代理的应用外文翻译 第6页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。