A Service-Oriented Peer-to-Peer System for University
Library Resource Sharing
Presented By: Chandana KancherlaSupervisor: Dr. Haiping Xu
Spring 2005 • UMass Dartmouth
Outlines• Peer-to-Peer Systems
• Web Services
• System Requirements
• System Architecture
• UML Diagrams
• Implementation
• Future Scope
Peer-to-Peer Systems• File sharing P2P applications focus on storing and
retrieving information from various peers in the network • The model that popularized this class of application is
the content exchange model • A P2P application should be able to locate other peers
in the network.• Once an application is able to locate other peers, it
should be able to communicate with them using messages.
• P2P systems consider that all nodes or peers are equal for sharing information.
Peer-to-Peer Systems Contd.• There are two types of P2P architectures: Pure and
Hybrid.• Pure P2P : In this model, there is no main server. Every
peer is a client as well as a server.• Hybrid P2P: In this model, there is a special server that
maintains a database and performs some administrative functions.
Web Services• A Web service is accessible over the web. Web services
communicate using platform-independent and language-neutral web protocols.
• A Web service provides an interface that can be called from another program. The Web service interface acts as a liaison between the web and the actual application logic that implements the service.
• Web services support loosely coupled connections between
systems. The web service interface adds a layer of abstraction to the environment that makes the connections flexible and adaptable.
Web Services Contd.Three XML-based technologies have emerged as the
standards for Web services:
• Simple Object Access Protocol (SOAP) defines a standard communications protocol for Web services.
• Web Services Description Language (WSDL) defines a standard mechanism to describe a Web service.
• Universal Description, Discovery and Integration (UDDI) provides a standard mechanism to register and discover Web services.
Requirements• Design and implement a service oriented Peer-to-Peer system for
University Library Resource sharing.• When the user wants to perform a remote search on a peer from
another network then the peer can select a peer from a remote network and send a request and that respective remote peer will perform a local search within its network and return the result to the requestor.
• The result of a remote search will contain all the URLs and the names of the Universities (hosts) that have the requested resource and the user will be allowed to choose from where he/she wants to download the book.
• Pure P2P architecture is used here which is a major feature since it eliminates the risk of single point of failure.
Class DiagramAdminI
uploadBook()
(from admin)
PeerServerI
searchBookLocally()searchBookRemotely()
downloadBook()
(from server)
PeerServerImpl
propertiesFile : String = "librarySettings.txt"clearTimePeriod : long = 10 * 100 * 60properties : Propertiesrequests : HashMap = new HashMap ()lastClearTime : Date = new Date ()localHostList : ArrayList = new ArrayList ()
PeerServerImpl()searchBookLocally()searchBookRemotely()downloadBook()readLocalHostList()loadProperties()isRequestDone()clearRequests()getProperties()
(from client)
AdminImpl
propertiesFile : String = "librarySettings.txt"properties : Properties
uploadBook()loadProperties()
(from admin)
Library
Library()addBook()getBook()findBook()compareBookDetails()compareStringBookDetails()compareIntegerBookDetails()openLibrary()saveLibrary()getNextID()getBookDetailsFromNode()addBookDetailsToNode()getBookFile()
(from MyP2P)
-library
-library
NetworkServerImpl
propertiesFile : String = "librarySettings.txt"properties : Propertiesnets : HashMap
NetworkServerImpl()getHosts()loadProperties()
readNetsList()
readHostsList()
(from server)
NetworkServerI
getHosts()
(from network server)
Class Diagram Contd.
Reply
Reply()getRequest()setRequest()getBookURLs()setBookURLs()getXML()restoreFromXML()serialize()unserialize()
(from MyP2P)
Book
text[] : byte = new byte [0]
Book()loadTextFromFile()saveTextToFile()getText()setText()getDetails()setDetails()getXML()restoreFromXML()...
(from MyP2P)
Request
id : StringrecieveTime : Date
Request()getDetails()setDetails()getId()setId()getRecieveTime()setRecieveTime()getXML()restoreFromXML()serialize()unserialize()
(from MyP2P)
-request
BookDetailsPanel
BookDetailsPanel()init()setConstraints()getBookDetails()setBookDetails()clear()
(from gui)
BookURL
host : Stringnet : Stringid : String
BookURL()getNet()setNet()getHost()setHost()getId()setId()getDetails()setDetails()toString()getXML()restoreFromXML()
(from MyP2P)
-bookURLs[]
BookDetails
title : Stringauthor : StringpublishYear : Integeredition : Stringsubject : Stringcategory : Stringdescription : Stringkeywords : String
BookDetails()getTitle()setTitle()getAuthor()setAuthor()getPublishYear()setPublishYear()getEdition()setEdition()getSubject()setSubject()getCategory()setCategory()getDescription()setDescription()getKeywords()setKeywords()getXML()restoreFromXML()
(from MyP2P)
-details
-details
-details
-details
FoundBooksTableModel
rowData : ArrayList = new ArrayList ()columnNames[] : String = {"Book URLs"} ...
FoundBooksTableModel()clear()add()add()getColumnName()getRowCount()getColumnCount()getValueAt()isCellEditable()setValueAt()
(from gui)
AdminPanel
AdminPanel()init()createBook()uploadBook()setConstraints()
(from gui)
-detailsPanel
PeerServerPanel
hosts : HashMap
PeerServerPanel()init()searchLocal()searchRemote()getRemoteHosts()downloadBook()...
(from gui)
-bookURL
-searchDetails
-tableModel
LibraryGUI
LibraryGUI()init()
(from gui)
LibraryApp
propertiesFile : String = "librarySettings.txt"windows : String = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" ...currentLookAndFeel : String = windowsframeWidth : int = 640frameHeight : int = 480properties : Properties
LibraryApp()main()loadProperties()getProperties()
(from gui)
-libraryApp
-libraryApp-mainPanel
-libraryApp
Sequence Diagrams• Local Search
user interfaceuser interface Implementation of ClientI on the hosts of the same network
Implementation of PeerServerI on the hosts of the same network
Library on the same hostLibrary on the same network
Search request with book details
Search request with book details
details of the books with URLs
details of the books with URLs
Sequence Diagrams Contd.• Remote Search
user interfaceuser interface Implementation of ClientI on the host on the other network
Implementation of PeerServerI on the host on the other network
Hosts on the other network Hosts on the other network
Search request with book details
Search request with book details
Result of the search with book details and URLs
Sequence Diagrams Contd.• Upload
User InterfaceUser Interface implementation of AdminI on the same host
implementation of AdminI on the same host
Library on the same host
Library on the same host
Book and properties
Book and properties
Result of upload
Result of upload
Sequence Diagrams Contd.• Download
User InterfaceUser Interface Implementation of the ClientI interface
Implementation of the PeerServerI interface
Library on the Library on the Local/remote host
URL of the book
URL of the book
Book
Book
Programming Platform - J2EE• The J2EE platform uses a distributed multi-tiered application
model for enterprise application
• Web services are web-based enterprise application that use open, XML-based standards and transport protocols to exchange data with calling clients
• The J2EE platform provides the XML APIs and tools you need to quickly design, develop, test, and deploy web services and clients running on Java-based or non-Java-based platform
• JAX-RPC stands for Java API for XML-based RPC. JAX-RPC is a technology for building web services and clients that use remote procedure calls (RPC) and XML.
ImplementationLocal Search
• The program gets the search details from the user interface.
• An object of the class Request is created with all the search details specified by the user.
• The object Request is then serialized into an XML string
• The Search method is called on the local hosts with the XML string as parameter
• The search call returns another string that contains the serialization of the Object Reply which contains details of the book.
• The program unserializes the string for the object Reply.
Implementation Contd. Remote Search• Similar to Local search
except that instead of the method local search the method Remote Search is called.
Implementation Contd. Upload• An instance of the AdminI Interface
for the local host is created.
• The method uploadBook is called with the string that contains the serialization of the object Book.
• The method returns the result of upload and the program displays the result to the user.
Implementation Contd. Download• The program retrieves the host of the
book selected from the object Reply.
• An instance/local stub of the PeerServerI interface is created
• The method download of PeerServerI is called with the book id (retrieved from the object Book) as the parameter.
• The method call returns the string that contains the serialization of the object Book.
• The program unserializes it and stores it to the specified space.
Future Scope• Ability to store (and search) CD’s and audio visual aids. • Web based client interface for the library. • A text viewer incorporated into the Client application. • Add ratings of the books.
Top Related