首页 北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集

北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集

举报
开通vip

北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集 北京理工大学【软件工程】毕业设计(论文):微博设 计并开发了一套基于Java语言的客户端开发工工具集 北京理工大学本科生毕业设计(论文) Abstract Microblogging has developed into a novel channel for human beings’ communication and information dissemination. With the rapid ...

北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集
北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集 北京理工大学【软件工程】毕业设计(论文):微博设 计并开发了一套基于Java语言的客户端开发工工具集 北京理工大学本科生毕业设计(论文) Abstract Microblogging has developed into a novel channel for human beings’ communication and information dissemination. With the rapid advancement of information technology, especially the application and spread of the mobile network technology, people can use the microblogging through variety of mobile terminals anywhere and anytimeSince 2009 Sina WeiBo has attracted millions of users by inviting famous people to settle down on its site, and has become a huge information library on the Internet. How to make use of such a potential platform to develop third-party applications has turned into an emergent problem. Currently, Sina WeiBo has opened its RESTful Web Services, and released different SDKs for client side programmers. However, these SDKs copied too much from Twitter, and made it too rigid for users to define their own functionalitiesAccording to the above situations, this article’s author designed and developed an SDK for Java Programming Language which implemented the following features: 1. Making it seamlessly connect to the Sina WeiBo RESTful Open API, implementing all of the functions in a synchronous state with the server side, including the optional parameters for users2. Accelerating the speed for client side developers to build applications, meeting the requirements such as usability, efficiency and security3. Reaching the Open Source Projects’ standards both in the design and coding stages, making it easier to read and extendIn this article, the author would like to introduce the related technologies in the development process, and elaborate the project’s requirements, design and implementation stages Keywords: Microblogging, RESTful Web Services, SDK, Open Source1 北 京理工大学本科生毕业设计(论文) 摘要 微 博 客 已 经 发 展 成 为 一 种 新 型 的 人 际 交 流 和 咨 询 传 播 途 径 , 随 着 信 息 技 术 , 特 别 是 移 动 互 联 网 技 术 的 应 用 与 普 及 , 人 们 可 以 通 过 各 种 移 动 终 端 在 任 意 场 所 任 意 时 间 使 用 微 博 客 。 国 内 的 新 浪 微 博 从 2009 年 开 始 , 凭 借 着 主 推 名 人 微 博 的 模 式 很 快 吸 引 了 大 量 的 用 户 , 现 已 成 为 一 个 巨 大 的 网 上 信 息 库 。 如 何 利 用 这 样 一 个 平 台 来 开 发 相 关 应 用 就 成 为 了 其 下 一 阶 段 需 要 亟 待 解 决 的 问 题 。 目 前 新 浪 微 博 已 经 开 放 了 RESTful 的 网 络 服 务 , 也 推 出 了 针 对 不 同 语 言 的 客 户 端 开 发 工 具 集 。 但 是 这 些 工 具 集 借 鉴 了 太 多 关 于 Twitter 的 理 念 , 而 且 在 用 户 自 定 义 功 能 上 显 得 不 是 那 么灵活。 基 于 以 上 现 状 , 学 生 为 新 浪 微 博 设 计 并 开 发 了 一 套 基 于 Java 语 言 的 客 户 端 开 发 工 具 集 以 实 现 以 下 主 要 功 能 : 1. 与 新 浪 微 博 所 开 放 的 网 络 服 务 接 口 无 缝 链 接 , 以 同 步 的 方 式 实 现 所 有 开 放 的 功 能 , 包 括 各 种 用 户 可 选 参 数 。 2. 帮 助 客 户 端 应 用 开 发 者 进 行 快 速 开 发 , 满 足 可 用 性 , 高 效 性 以 及 安 全 性 等 要 求 。 3. 在 项 目 设 计 和 编 码 实 现 上 达 到 开 源 项 目 的 要 求 , 让 项 目 具 有 良 好 的 可 读 性 和 可 扩 展 性 。 本 文 中 , 学 生 介 绍 了 在 开 发 过 程 中 需 要 了 解 的 相 关 技 术 , 并 且 详 细 阐 述 了 该 项 目 的 需 求 、 设 计 以 及 最 后 的 编 码 实 现 过 程 。 关键字 :微博, RESTful 网 络 服 务 , 开 发 工 具 集 , 开 源 。 2 北京理工大学本科生毕业设计(论文) Dedication To my parents, Deng Yijun and Zhang Ying, who made all of this possible, for their endless love, encouragement and patienceAnd also to Roy Thomas Fielding, for proposing the REST style for network-based software architecture When I am down and, oh my soul so weary; When troubles come and my heart burdened be, Then, I am still and wait here in the silence, Until you come and sit awhile with meYou raise me up, so I can stand on mountains; You raise me up, to walk on stormy seas; I am strong, when I am on your shoulders; You raise me up To more than I can be---- Brendan Grahasm 3 北京理工大学本科生毕业设计(论文) Table of Contents Abstract 1 摘要 2 Dedication. 3 List of Figures 7 List of Tables8 1 Introduction 9 1.1 Microblogging9 1.2 REST 10 1.2.1 REST Architecture Style. 10 1.2.2 RESTful Web Services. 11 1.3 SDK. 12 1.4 API 13 1.5 Article Structure. 13 1.6 Font Agreement13 2 Related Work 15 2.1 General Principles for SDK 15 2.2 Building Blocks for SDK 15 2.2.1 API 16 2.2.2 Documentary 16 2.2.3 Sample Codes17 2.3 Benchmarks for API. 17 2.4 Diving in JDBC18 3 Requirements 21 3.1 Glossary. 21 3.2 Overview of Sina WeiBo RESTful Open API 21 3.3 Function Requirement22 3.4 Performance Requirement23 3.5 Usability Requirement. 24 3.6 Security Requirement 25 4 北京理工大学本科生毕业设计(论文) 4 Design Overview. 26 4.1 Architecture26 4.2 Package Design27 4.3 Class Design. 29 4.3.1 Class Relationship. 29 4.3.2 Class Pattern. 31 4.4 Method Design 32 5 Implementation 34 5.1 Development Environment. 34 5.2 API 34 5.3 Request35 5.4 HTTP Manager 36 5.4.1 Synchronous vs Asynchronous. 36 5.4.2 Authentication. 37 5.4.2.1 HTTP Basic. 37 5.4.2.2 OAuth 38 5.4.2.3 XAuth 39 5.4.3 HTTP Scheme40 5.5 Response 41 5.5.1 Response Class 41 5.5.2 JavaBean 42 5.6 Parser43 5.6.1 XML. 44 5.6.1.1 DOM44 5.6.1.2 SAX 45 5.6.2 JSON 45 5.7 Exception Mechanism46 6 Sample Codes 47 6.1 Test Cases. 47 6.2 Use Cases49 5 北京理工大学本科生毕业设计(论文) 7 Conclusions 52 8 Future Work. 53 9 Acknowledgments54 10 References55 6 北京理工大学本科生毕业设计(论文) List of Figures Figure 1-1 ? Microblogging characteristics 9 Figure 1-2 ? RESTful Web Services 12 Figure 2-1 ? JWeiBo’s role in the applications 19 Figure 3-1 ? JWeiBo function requirement displayed in swimlane. 23 Figure 4-1 ? Architecture of JWeiBo27 Figure 4-2 ? Package design 28 Figure 4-3 ? Programming interface between classes 30 Figure 5-1 ? OAuth authentication flowchart39 7 北京理工大学本科生毕业设计(论文) List of Tables Table 3-1 ? Performance requirement in different network environments24 Table 5-1 ? Details about the HTTP method. 40 8 北京理工大学本科生毕业设计(论文) 1 Introduction 1.1 Microblogging Microblogging is a broadcast medium in the form of blogging. A microblogging differs from a traditional blog in that its content is typically smaller in both actual and aggregate file size [1]In the microblogging realm, Twitter and Sina WeiBo are playing the leading roles abroad or domestically both in the market share and product promotion. For the same points, they both provide the 140 characters-based Tweets or Status as the core part for their service. In addition, they simplify the online social networks by cutting the request-confirm round-trip style friends relationship into followers or followings one-click style pattern Figure 1-1 ? Microblogging characteristics This figure shows the new features of microblogging and the differences between microblogging and traditional medium9 北京理工大学本科生毕业设计 (论文) In the Internet century, with the rapid increment in the number of the Internet and cellphone users, microblogging services have revolutionized the way people communicate and information consuming, because whenever and wherever, citizens themselves can act as the sensors and sources of data which could lead to important pieces of information. Under the circumstance mentioned above, microblogging services have also emerged as an important source of real-time news updates for recent crisis situationsAccording to the introduction and analysis about the functions and operation modes of microblogging, we can notice the huge potential for microblogging to take the place of the traditional media, such as the newspaper and portal websites1.2 REST Representational State Transfer REST is a style of software architecture for distributed hypermedia systems such as the World Wide Web [2] [16] [17] [18]1.2.1 REST Architecture Style When talking about REST Architecture Style, there is no concrete design limitations. However, it describes the following six constraints applied to the architecture, while leaving the implementation of the individual components free to design: Client-server: This separation of concerns could lead the independent development and replacement of the clients and servers? Stateless: This constraint indicates that no client context should be stored on the server between requests, and each individual request should be self-descriptive containing all of the information the server can understand to fulfill this single request? Cacheable: Response must, implicitly or explicitly, define themselves as cacheable or not to prevent the clients resuing stable or inappropriate data in response to further requests? Layered system: The clients can not connect direclty to the end server, 10 北京理工大学本科生毕业设计(论文) there would be some temporary middlewares along the way? Uniform interface: This mechanism can simplify and decouple the architecture, which enables each part to evolve independently? Code on demand Optional: This constraint simplify the client side development, the server side can extend or customize the functionality of a client by transferring the logic to it which can execute on the client sideAccording to the above principles, every distributed hypermedia system which comply with these constraints will conform to the REST architectural style. In addition, this kind of style will enable the system to have desirable emergent properties, such as performance, scalability, simplicity, modifiability, visibi lity, portability and reliability1.2.2 RESTful Web Services A RESTful Web Service also called a RESTful web API is a simple web service implemented using HTTP and the principles of REST. RESTful Web Services is a collection of resources, the so called resources are the abstracti on or definition of anything that’s important enough to be referred as a thing in itself, usually located on the server side, we use the representations of the resource to transfer to the client side as the HTTP response A representation of a resource is typically a document that captures the current or intended state of a resourceCurrently, Sina WeiBo has deployed its resource-oriented platform, and opened its RESTful Web Services to the third-party application developers. The system is portrayed as the following figure: 11 北京理工大学本科生毕业设计(论文) Figure 1-2 ? RESTful Web Services For the resource-oriented systems, there are three main factors we should get known in advance: The base URL or URI for the Web Services, for example: ////0>. in Sina WeiBo RESTful Web Services? The Internet media type for the data supported by the Web Services, XML and JSON are the most popular data interchange format in this situation? The set of operations of HTTP methods defined on the resources, such as GET, POST, PUT and DELETE1.3 SDK A software development kit SDK is typically a set of development tools that allows for the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar platform [3]. A SDK can be as simple as an application programming interface API in the form of some files to interface to a particular programming language, and in some more common situations, the SDK would contain the tools which would make the development process more convenient and 12 北京理工大学本科生毕业设计(论文) efficient. Common tools include sample codes and supporting documentary or technical notes to help clarify points from the primary reference materialSina WeiBo has also released some SDKs for its Open API in variety of programming languages. However, some of them are not highly praised by the developers because of the defects in self-defined functionalities, extensibility and usability. On this basis, we make our minds to develop our own SDK, eliminating the previous shortcomings and tapping the potential advantages1.4 API An API can be created for applications, libraries, operating systems, etc., as a way of defining their “vocabularies” and resources request conventions. It may include specifications for routines, data structures, object classes, and protocols used to communicate between the consumer program and the implementer program of the API [4]To construct a set of well-designed and superb APIs means that half of our SDK has been successful. This is what we need to focus on through the whole article1.5 Article Structure The following parts of this article are structured as the following: Section 2 introduces some related work about this SDK; in Section 3, we would list the requirements for our project; the overview design for our SDK, especially for the API would be presented in Section 4; Section 5 focuses on the implementation details about our project; test cases and simple codes would be contained in the Section 6; Section 7 and 8 would give a conclusion about our project and some perspective for the future work separately1.6 Font Agreement Text: Times New Roman, normal, primary #4, for all of the normal texts, including the sample files texts13 北京理工大学本科生毕业设计(论文) Keyword: Times New Roman, italic, primary #4, which indicates the keywords or data types in the Java Programming Language. Also, the HTTP status codes’ denotation would borrow this style? Name: Times New Roman, italic, bold, primary #4, which stands for package, interface, abstract class, concrete class, field and method name in our SDK, not including other dependable libraries? Source code: Courier New, normal, primary #4, which shows the source code14 北京理工大学本科生毕业设计(论文) 2 Related Work 2.1 General Principles for SDK The overall mission of our SDK is trying to simplify the data interchange process between Sina WeiBo server side and other client side developers’ applications or network-based systems the so called client side doesn’t indicate the web browser in this article, it represents the other parts except the data interchange layer in a specified application or system. Simultaneously, our SDK should be flexible, agile and easy to useFor the sake of building an easy-to-use and advanced SDK, we should take the following rules into consideration, which would guide the whole development process and direction in some degree1. The interface which would be adopted to communicate with the Sina WeiBo RESTful Open API should be meticulously designed, it should meet the requirements to help the client side developers construct the applications in a more convenient and rapid way. Additionally, we should avoid the exceptions and fatal errors in our own package2. In the SDK, we should provide enough handbooks to help the client side developers have a better understanding of the interface in a shorter period, using it more efficiently and safely3. To give a hand to the client side developers when they start taking actions, we should write some use cases as the examples. The use cases should contain some sample codes, such as unit tests and scenario cases. It would promote the development efficiency to a large extend2.2 Building Blocks for SDK When an architect begins to design a building, especially some hybrid projects, they should have a clear idea about which building blocks they should construct to reach the final elegant craft. The processes of software development and 15 北京理工大学本科生毕业设计(论文) architecture have many common points in some degree. Therefore, we should clarify our ideas and analyze the building blocks both on the design rules and implementation strategies2.2.1 API As the core part of the whole SDK, we should pay enough attention on the definition, design prerequisite and implementation policy on the APIWe define the API in our SDK as the collection of Java interface, Java abstract Class, Java concrete classes and the variety of methods in them our JWeiBo is coded in Java Programming Language, which has the advantagies such as cross-platform, Object-Oriented and popularity in the real industry. We could instantiate the concrete classes and invoke the method contained in them to launch the data interchange call When designing the API, we should follow some common rules for the API Design Principles and add some specific constraints to them. On the other hand, we should fully take the advantagies of Java’s OO Object-Oriented characteristics: such as the encapsulation, polymorphism and inheritance The ultimate purpose of this project is to open source, contributing to the open source community. Thus, we should emphasize on the programming skills and implementations. The source codes should be self-descriptive with the help of standard naming, acurrate comments, and the whole project should be flexibly extended when some functions are added on the server side Sina WeiBo exposes more RESTful Open API2.2.2 Documentary Comments could be the best documentary in the programming environments, this is a perfect encouragement for the programming novinces to write comments when they just start learning programming, however, if the system gets bigger and bigger, the code volume would reach an uncountable number. Consequently, it would be extremely difficult to clarify the structure of the source files, let alone to 16 北京理工大学本科生毕业设计(论文) understand the acurrate behavior of each API maybe its a single source file or just an individual methodAccording to the discussion and hypothesis above, we have the responsibility to provide the elaborate handbooks with our SDK, even we have already contained the qualified comments in our source codes. The handbooks should explain the design principles, implementation details and test methods for the API, which just corresponds to the Section 4, 5, 6 in this article. Moreover, we would like to generate the Java Docs from the java-doc style comments in our SDK2.2.3 Sample Codes For the integrity of our SDK, we must contain some sample codes in our release versions, I think sample codes could play two different roles at the same time, one as the unit test for each API, making the client side programmers trust the availability and robutness of our codes, another as the introduction for the whole process the API can fulfill in a round-trip data interchange process2.3 Benchmarks for API Before we start to design our API for the communication between the Sina WeiBo RESTful Open API and client side applications, we should think about the questions as follows: What makes a good API? How to check the quality of an APIBy referring to some materials about API Design Principles [5] [6] and taking
本文档为【北京理工大学【软件工程】毕业设计(论文):微博设计并开发了一套基于Java语言的客户端开发工工具集】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_219945
暂无简介~
格式:doc
大小:56KB
软件:Word
页数:20
分类:工学
上传时间:2017-10-09
浏览量:36