Session #, Session Title1 Print APIs for Jini Connection Technology Robert Herriot Xerox Alan Kaminsky Xerox.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

I/O Basics 12 January 2014Smitha N. Pai, CSE Dept.1.
J0 1 Marco Ronchetti - Web architectures – Laurea Specialistica in Informatica – Università di Trento Java XML parsing.
Introduction to Java 2 Programming Lecture 10 API Review; Where Next.
IPP Notification Subscriptions Event Notification.
Delivery Methods forIPP Event Notifications 1 Internet Printing Protocol (IPP) Delivery Methods for IPP Event Notifications.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
6 Copyright © 2005, Oracle. All rights reserved. Using Advanced Techniques in Servlets.
JSP and Servelets.
The Jini Technology Lookup Service. How Does It Work Services and clients find a lookup service using the discovery protocol Services advertise themselves.
Service Description: WSDL COMP6017 Topics on Web Services Dr Nicholas Gibbins –
1 Jini Tutorial, Part 3 Jini Programming. 2 Tutorial outline Part 1 Introduction Distributed systems Java basics Remote Method Invocation (RMI) Part 2.
31242/32549 Advanced Internet Programming Advanced Java Programming
Introduction to Java 2 Programming Lecture 7 IO, Files, and URLs.
Lecture 15: I/O and Parsing
JLab Lattice Portal – Data Grid Web Service Ying Chen, Chip Watson Thomas Jefferson National Accelerator Facility.
Jini, third verse Richard Chapman October 13, 1999.
Mini project /2 Jini - a new computing paradigm.
Java Applets:. How Applets differ from application?: They do not use main method but init(), start() and paint() methods of the applet class They can.
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
1 Servlets Based on Notes by Dave Hollinger & Ethan Cerami Also, the Online Java Tutorial by Sun.
Java Server Pages (JSP)
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
Introduction to push technology © 2009 Research In Motion Limited.
1 Lecture 4 Exception Handling. 2 Exception-Handling Fundamentals An exception is an abnormal condition that arises in a code sequence at run time A Java.
Generate Dynamic Content On Cache Server Master’s Project Proposal by Aparna Yeddula.
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
Sheet 1XML Technology in E-Commerce 2001Lecture 4 XML Technology in E-Commerce Lecture 4 Case Study: XmlMessenger.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
CVSQL 2 The Design. System Overview System Components CVSQL Server –Three network interfaces –Modular data source provider framework –Decoupled SQL parsing.
Io package as Java’s basic I/O system continue’d.
Sen Wang 11/17/2011.  RFC  “Form-based File Upload in HTML” NOV 1995 
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
Java RMI Essentials Based on Mastering RMI Rickard Oberg.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Introduction - What is Jini Technology?
Chapter 6 Configuring Windows Server 2008 Printing
James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.
January 26, Bob Scheifler Copyright 1999 Sun Microsystems, Inc., all rights reserved. Jini™ Lookup Service Bob Scheifler Senior Staff Engineer Sun.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Session Management.
© 2009 Research In Motion Limited Advanced Java Application Development for the BlackBerry Smartphone Trainer name Date.
CIS Intro to JAVA Lecture Notes Set 6 2-June-05.
Jini Architecture Introduction System Overview An Example.
Kemal Baykal Rasim Ismayilov
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Mapping Salutation to Bluetooth 4 Overview 4 Bluetooth Summary 4 Salutation Architecture Summary 4 Mapping Bluetooth SDP to Salutation APIs 4 Mapping Bluetooth.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
DICOMwebTM 2015 Conference & Hands-on Workshop University of Pennsylvania, Philadelphia, PA September 10-11, 2015 DICOMweb Workflow API (UPS-RS) Jonathan.
10-1 JXTA Messages Learning Objectives ● This module will help you... – Develop applications and services which exchange messages either through.
USING ANDROID WITH THE INTERNET. Slide 2 Lecture Summary Getting network permissions Working with the HTTP protocol Sending HTTP requests Getting results.
Chapter 5 Remote Procedure Call
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
RMI Packages Overview java.rmi java.rmi.server java.rmi.registry
Pre-assessment Questions
I/O Basics.
Java Programming Language
CUPS Print Services.
JINI ICS 243F- Distributed Systems Middleware, Spring 2001
Internet Printing Protocol (IPP)
For Documents and Pages Robert Herriot, Xerox
Presentation transcript:

Session #, Session Title1 Print APIs for Jini Connection Technology Robert Herriot Xerox Alan Kaminsky Xerox

Session #, Session Title2 Goals of Print API Allow client software to –find Printers with particular features –submit Print Jobs to a Printer –make use of a Printers features, e.g. copies (multiple copies of a document) sides (one-sided or two-sided printing) finishing (stapling, binding, drilling, folding) –query Printer and Job characteristics –cancel a Print Job

Session #, Session Title3 Source of Print Model for Print APIs Print APIs for Jini technology (Jini Print APIs) are based on IPP –a.k.a. Internet Printing Protocol IPP is an industry standard –IETF RFC 2565: encoding and transport –IETF RFC 2566: print model Many IPP implementations –more than 25 printer and system vendors

Session #, Session Title4 IPP Model output device or proxy Printerclient IPP over network

Session #, Session Title5 IPP model in the context of Jini technology output device or proxy Printer client IPP or other protocol Print Service Jini look up service Print Service Find Print Service

Session #, Session Title6 IPP Concepts: Operations IPP Operations perform the basic tasks –Examples Create-Job Send-Document Send-URI –printer fetches print data from a URI Cancel-Job Get-Job-Attributes Get-Printer-Attributes Get-Jobs (not in current API)

Session #, Session Title7 IPP Concepts: Objects Three object classes –Printer the software that provides the Print Service –Job what the Create-Job operation creates –Subscription for notification not yet an RFC

Session #, Session Title8 IPP Concepts: Attributes IPP Attributes –act as parameters to operations, e.g. copies=4, sides=two-sided-long-edge –indicate capabilities of a Printer sides-supported= {one-sided, two-sided-long-edge} –describe Printer printer-state=idle –describe Job job-state=completed

Session #, Session Title9 IPP Encoding & Transport RFC 2565 specifies –a binary encoding MIME media type is application/ipp –a transport HTTP using the POST method Model allows for other encodings and transports, e.g. –XML –RMI

Session #, Session Title10 Print Services based on Java Technology In packages under javax.print –talk earlier today at JavaOne Common infrastructure for printing in –net.jini.print –java.awt.print Classes or concepts borrowed from Jini Print API work

Session #, Session Title11 Use of Color in this Talk Color is used: –specification of an API: DocAttributeSet getAttributes() –code fragment: new AttributeEntry(Sides) { Copies(4), Sides.ONE_SIDED } –for a class name: PrintService

Session #, Session Title12 Jini Print API Overview of Topics Infrastructure –Attributes, AttributeSets and DocFlavors –Print Data with Docs and MultiDocs Printer Look-up –PrintService Job Submission –PrintRequest –PrintJob Exceptions and Events

Session #, Session Title13 ServiceRegistrar JLUS = // Obtain a Jini Lookup // Service (JLUS) proxy Class[] cl = {PrintService.class}; ServiceTemplate tm = new ServiceTemplate(null,cl,null); PrintService svc =(PrintService) JLUS.lookup (tm); if (svc != null){ DocPrintRequest req = svc.createDocPrintRequest(); Doc doc = new StringDoc ("Hello, world!", null); req.setDoc(doc); HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet(new Copies(10)); as.add(Sides.TWO_SIDED_LONG_EDGE); req.setAttributes(as); req.print(); } Sample Code for a Client to Print

Session #, Session Title14 Infrastructure: Attributes Same concept as IPP Attributes –Examples IPP copies is Java programming language Class (Java Class) Copies IPP sides is Java Class Sides IPP printer-state is Java Class PrinterState –Exception IPP document-format is Class DocFlavor –DocFlavor is not an Attribute

Session #, Session Title15 javax.print.attribute.standard Class Copies (hierarchy) Class Copies Class IntegerSyntax Interface PrintJobAttribute Interface PrintRequestAttribute Interface Attribute Class Object Interface Serializable Interface Cloneable data type attribute name can be member of PrintRequest can be member of PrintJob is an attribute

Session #, Session Title16 javax.print.attribute Interface PrintJobAttribute Tags the attribute –attribute can be a member of a PrintJob provides type safety for setting values Other similar classes –Naming pattern: ClassName Attribute DocAttribute PrintRequestAttribute PrintServiceAttribute

Session #, Session Title17 javax.print.attribute Class IntegerSyntax For an Attribute with an integer value Provides access to –integer value int getValue() String toString() Provides service –equals boolean equals(Object) –hash code int hashcode()

Session #, Session Title18 javax.print.attribute.standard Class Copies Provides access to –attribute name Class getCategory() –i.e. Copies.class String getName() –i.e. "Copies" –integer value (inherited from IntegerSyntax) int getValue() –e.g. 10 String toString() –e.g. "10"

Session #, Session Title19 javax.print.attribute.standard Class PrinterState (hierarchy) Class PrinterState Class EnumSyntax Interface PrintServiceAttribute Interface Attribute Class Object Interface Serializable Interface Cloneable data type attribute name can be member of PrintService is an attribute

Session #, Session Title20 javax.print.attribute.standard Class PrinterState Provides access to –attribute name Class getCategory() –i.e. PrinterState.class String getName() –i.e. "PrinterState" –value (inherited from EnumSyntax) String toString() –e.g. "idle", "stopped or "processing" predefined constants –e.g. PrinterState.IDLE, PrinterState.STOPPED or PrinterState.PROCESSING X

Session #, Session Title21 javax.print.attribute Interface AttributeSet Extends Interface java.util.Map Is a set of attributes with distinct names –e.g. { Copies(4), Sides.ONE_SIDED } NOT {Sides.ONE_SIDED,Sides.TWO_SIDED_LONG_EDGE} Has subinterfaces –Naming pattern: ClassName AttributeSet DocAttributeSet PrintJobAttributeSet PrintRequestAttributeSet PrintServiceAttributeSet

Session #, Session Title22 javax.print.attribute Interface AttributeSet (services) Provides services –methods of java.util.Map –special get method Attribute get(Class); –e.g. get(Sides) -> Sides.ONE_SIDED –special variant of put method boolean add(Attribute); –e.g. add(Sides.ONE_SIDED) is equivalent to Sides s = Sides.ONE_SIDED; put(s.getCategory(),s); Note: s.getCategory() == Sides.class

Session #, Session Title23 javax.print.attribute Class HashAttributeSet Extends Class java.util.HashMap Implements Interface AttributeSet Has subclasses –Naming pattern: Hash ClassName AttributeSet HashDocAttributeSet HashPrintJobAttributeSet HashPrintRequestAttributeSet HashPrintServiceAttributeSet

Session #, Session Title24 javax.print.data Class DocFlavor Specifies –the MIME media type of a Document, e.g. "text/plain" "application/PostScript" "image/jpeg" –the class of Print Data object, e.g. char[] byte[] java.lang.String java.io.InputStream java.awt.print.Printable

Session #, Session Title25 Infrastructure: Print Data E.g., if the Print Data is a PostScript File –Class DocFlavor specifies application/PostScript (as MIME media type) java.io. InputStream ( as Print Data class) Two Interfaces for Print Data –Doc wraps the Print Data implemented by a client application –MultiDoc contains multiple Docs implemented by a client application

Session #, Session Title26 net.jini.print.data Interface Doc Extends Interface javax.print.data.Doc –methods throw RemoteException methods in javax.print.data throw IOException Provides access to –Associated attributes DocAttributeSet getAttributes() –Continued on next slide

Session #, Session Title27 net.jini.print.data Interface Doc (more access) Provides access to –Its DocFlavor, DocFlavor getFlavor() returns e.g. DocFlavor.INPUT_STREAM.POSTSCRIPT –Object containing Print Data Object getPrintData() returns e.g. java.io.InputStream object –Reader or InputStream for Print Data Reader getReaderForText() InputStream getStreamForBytes()

Session #, Session Title28 net.jini.print.data Interface MultiDoc Extends Interface javax.print.data.MultiDoc –methods throw RemoteException methods in javax.print.data throw IOException Contains data of multiple documents –Acts like a linked list of Doc elements Provides access to –Doc of list element: it is accessible with Doc getDoc() –Remaining MultiDoc: it is accessible with MultiDoc next()

Session #, Session Title29 Jini Technology Look-up Service (review) Client specifies any of –java.lang.Class[ ], e.g. (Class[]){ PrintService } –net.jini.core.entry.Entry[ ], e.g. (Entry[]){ net.jini.lookup.entry.Location (floor 2,room 12, bldg 23) } Look-up Service returns a matching service Object, e.g. PrintService MultiDocPrintService

Session #, Session Title30 net.jini.print.lookup Class AttributeEntry Extends net.jini.entry.AbstractEntry –which implements Entry Matches Entry in Look-up service –any Attribute new AttributeEntry() –any Attribute of a specified class, e.g. new AttributeEntry(Sides) –any Attribute with specified value (& class), e.g. new AttributeEntry(Sides.ONE_SIDED)

Session #, Session Title31 net.jini.print.lookup Class FlavorEntry Extends net.jini.entry.AbstractEntry –which implements Entry Matches Entry in Look-up service –any DocFlavor new FlavorEntry() –any DocFlavor with specified value, e.g. new FlavorEntry(DocFlavor.BYTE_ARRAY.JPEG)

Session #, Session Title32 net.jini.print.service Interface PrintService Gives access to the Printer –Provides access to attributes that relate to Printer information Printer capabilities for Job Creation –Provides services of Events Job Creation

Session #, Session Title33 net.jini.print.service Interface PrintService (info) Provides access to Printer Information –attribute values of all Printer attributes PrintServiceAttributeSet getAttributes() returns e.g. { PrinterState.PROCESSING, new PrinterName("speedy",locale), new QueuedJobCount(8),… }

Session #, Session Title34 net.jini.print.service Interface PrintService (Job Creation) Provides access to Job Creation info –attribute names supported, Class[] getSupportedAttributeCategories(… ) returns e.g. (Class[]){ Sides, Copies, … } –attribute values supported Object getSupportedAttributeValues(Class,…) returns e.g. (with parameters (Sides, … ) ) (Sides[]) {Sides.ONE_SIDED,Sides.TWO_SIDED_LONG_EDGE} DocFlavors[] getSupportedDocFlavors()

Session #, Session Title35 net.jini.print.service Interface PrintService (Job Creation) Provides access to Job Creation info –default attribute values Object getDefaultAttributeValue(Class) returns e.g. (with parameter (Sides) ) Sides.TWO_SIDED_LONG_EDGE

Session #, Session Title36 net.jini.print.service Interface PrintService (services) Provides services –adds an event listener for changes in PrintService attribute values –creates a PrintRequest DocPrintRequest CreateDocPrintRequest()

Session #, Session Title37 net.jini.print.service Interface LocalizedPrintService Extends PrintService –Exists if a PrintService provides localized strings Provides access to –supported locales Locale[] getSupportedLocales() Provides services –localizes attribute names String localize(Class,Locale) –localizes attribute and DocFlavor values String localize(Attribute,Locale) String localize(DocFlavor,Locale)

Session #, Session Title38 net.jini.print.service Interface MultiDocPrintService Extends PrintService –Exists if a PrintService allows jobs to contain more than one Document Provides services –creates a PrintRequest MultiDocPrintRequest CreateMultiDocPrintRequest()

Session #, Session Title39 Steps in Job Submission (1) With PrintService –Client creates PrintRequest e.g. DocPrintRequest req = svc.createDocPrintRequest(); –Printer doesnt remember PrintRequests

Session #, Session Title40 Steps in Job Submission (2) With a PrintRequest, a client –Adds Attributes and Docs (i.e. Print Data) e.g. req.setDoc(doc); HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet(new Copies(10)); as.add(Sides.TWO_SIDED_LONG_EDGE); req.setAttributes(as); –Then creates a PrintJob with the print method e.g. req.print(); –Can track progress of a PrintJob

Session #, Session Title41 net.jini.print.job Interface PrintRequest Acts as a container for –Attributes –Docs (i.e. Print Data) Has two subinterfaces for setting Docs –DocPrintRequest: void SetDoc(Doc) –MultiDocPrintRequest: void SetMultiDoc(MultiDoc)

Session #, Session Title42 net.jini.print.job Interface PrintRequest (services) Provides Services –Sets Attributes requested for the Job void SetAttributes(PrintRequestAttributeSet) –Adds event listeners for changes in PrintJob attribute values –Submits PrintRequest to Printer void Print() PrintJobAndLease Print(long leaseDuration)

Session #, Session Title43 net.jini.print.job Class PrintJobAndLease Extends Object Contains two objects –net.jini.core.lease.Lease client must hold a lease on the PrintJob –PrintJob

Session #, Session Title44 net.jini.print.job Interface PrintJob Represents a Job on the Printer –i.e. the Printer has knowledge of it. Provides access to –Attributes in the PrintJob PrintJobAttributeSet getAttributes() Provides services –Adds event listener for changes in PrintJob attribute values same method and effect as for PrintRequest

Session #, Session Title45 net.jini.print.job Interface CancelablePrintJob Extends PrintJob –Exists if a PrintService allows a client to cancel a PrintJob Allows client to cancel a PrintJob void cancel()

Session #, Session Title46 javax.print.exception Class PrintException Extends java.lang.Exception 3 subclasses className Exception net.jini.print.service.PrintServiceException net.jini.print.job.PrintRequestException net.jini.print.job.PrintJobException Interfaces for additional information AttributeException DocFlavorException NestedException

Session #, Session Title47 net.jini.print.service Class PrintServiceException Is thrown during PrintRequest creation by –Interface PrintService for DocPrintRequest CreateDocPrintRequest() –Interface MultiDocPrintService for MultiDocPrintRequest CreateMultiDocPrintRequest() Provides access to –PrintService object causing exception PrintService getPrintService()

Session #, Session Title48 net.jini.print.job Class PrintRequestException Is thrown during PrintJob creation by –Interface PrintRequest void Print() PrintJobAndLease Print(long leaseDuration) Provides access to –PrintRequest object causing exception PrintRequest getPrintRequest() –Unsupported attributes or values (optional) via javax.print.exception.AttributeException –Class[] getUnsupportdAttributes() –Attribute[] getUnsupportdValues()

Session #, Session Title49 net.jini.print.job Class PrintJobException Is thrown by –Interface CancelablePrintJob void cancel() Provides access to –PrintJob object causing exception PrintJob getPrintJob() –NestedException (optional) via javax.print.exception.NestedException –Throwable getNestedException()

Session #, Session Title50 Events can add event listeners to: –PrintService –PrintRequest –PrintJob can listen for change of –any attribute –any specified attribute –any attribute achieving a specified value

Session #, Session Title51 net.jini.print.event Class PrintEvent Extends Jini technology RemoteEvent –net.jini.core.remote.RemoteEvent Provides access to events PrintService PrintService getPrintService() Has subclasses: –PrintServiceEvent –PrintJobEvent –PrintDataEvent –PrintJobFinishedEvent

Session #, Session Title52 net.jini.print.service Class PrintServiceEvent Sent when attribute value changes in –PrintService Provides access to –Attributes that changed PrintServiceAttributeSet getAttributes() –Events PrintService in superclass PrintEvent (just discussed) PrintService getPrintService()

Session #, Session Title53 net.jini.print.job Class PrintJobEvent Sent when attribute value changes in –PrintJob Provides access to –Attributes that changed in PrintJob PrintJobAttributeSet getAttributes() –PrintJob in which attributes changed PrintJob getPrintJob()

Session #, Session Title54 net.jini.print.job Class PrintDataEvent Sent when Printer has finished obtaining a unit (Doc) of Print Data Provides access to –Whether the Printer was successful boolean succeeded() –Exception if the Printer failed Throwable getException() –PrintJob intended to receive the print data PrintJob getPrintJob()

Session #, Session Title55 net.jini.print.job Class PrintJobFinishedEvent Sent when Printer has finished printing a PrintJob Provides access to –JobState of the PrintJob when it finished JobState getFinalState() returns e.g. JobState.COMPLETED, or JobState.CANCELED, or JobState.ABORTED –PrintJob that finished PrintJob getPrintJob()

Session #, Session Title56 Documentation for Jini Print API Web page for Jini Printing Working Group – Latest document is (with above prefix) : –JiniPrintService/standards/ JiniPrintServiceApi zip