Java Doc for PrintServiceLookup.java in  » 6.0-JDK-Core » print » javax » print » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » print » javax.print 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.print.PrintServiceLookup

PrintServiceLookup
abstract public class PrintServiceLookup (Code)
Implementations of this class provide lookup services for print services (typically equivalent to printers) of a particular type.

Multiple implementations may be installed concurrently. All implementations must be able to describe the located printers as instances of a PrintService. Typically implementations of this service class are located automatically in JAR files (see the SPI JAR file specification). These classes must be instantiable using a default constructor. Alternatively applications may explicitly register instances at runtime.

Applications use only the static methods of this abstract class. The instance methods are implemented by a service provider in a subclass and the unification of the results from all installed lookup classes are reported by the static methods of this class when called by the application.

A PrintServiceLookup implementor is recommended to check for the SecurityManager.checkPrintJobAccess() to deny access to untrusted code. Following this recommended policy means that untrusted code may not be able to locate any print services. Downloaded applets are the most common example of untrusted code.

This check is made on a per lookup service basis to allow flexibility in the policy to reflect the needs of different lookup services.

Services which are registered by registerService(PrintService) will not be included in lookup results if a security manager is installed and its checkPrintJobAccess() method denies access.


Inner Class :static class Services



Method Summary
abstract public  PrintServicegetDefaultPrintService()
     Not called directly by applications.
abstract public  MultiDocPrintService[]getMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes)
     Not called directly by applications.

Implemented by a service provider, used by the static methods of this class.

Locates MultiDoc print services which can be positively confirmed to support the combination of attributes and DocFlavors specified.


Parameters:
  flavors - of documents required.

abstract public  PrintService[]getPrintServices(DocFlavor flavor, AttributeSet attributes)
     Locates services that can be positively confirmed to support the combination of attributes and DocFlavors specified. This method is not called directly by applications.

Implemented by a service provider, used by the static methods of this class.

The results should be the same as obtaining all the PrintServices and querying each one individually on its support for the specified attributes and flavors, but the process can be more efficient by taking advantage of the capabilities of lookup services for the print services.
Parameters:
  flavor - of document required.

abstract public  PrintService[]getPrintServices()
     Not called directly by applications. Implemented by a service provider, used by the static methods of this class. array of all PrintServices known to this lookup serviceclass.
final public static  PrintServicelookupDefaultPrintService()
     Locates the default print service for this environment. This may return null. If multiple lookup services each specify a default, the chosen service is not precisely defined, but a platform native service, rather than an installed service, is usually returned as the default.
final public static  MultiDocPrintService[]lookupMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes)
     Locates MultiDoc print Services capable of printing MultiDocs containing all the specified doc flavors.

This method is useful to help locate a service that can print a MultiDoc in which the elements may be different flavors.

final public static  PrintService[]lookupPrintServices(DocFlavor flavor, AttributeSet attributes)
     Locates print services capable of printing the specified DocFlavor .
Parameters:
  flavor - the flavor to print.
public static  booleanregisterService(PrintService service)
     Allows an application to directly register an instance of a class which implements a print service. The lookup operations for this service will be performed by the PrintServiceLookup class using the attribute values and classes reported by the service. This may be less efficient than a lookup service tuned for that service. Therefore registering a PrintServiceLookup instance instead is recommended. The method returns true if this service is not previously registered and is now successfully registered. This method should not be called with StreamPrintService instances. They will always fail to register and the method will return false.
Parameters:
  service - an implementation of a print service.
public static  booleanregisterServiceProvider(PrintServiceLookup sp)
     Allows an application to explicitly register a class that implements lookup services.



Method Detail
getDefaultPrintService
abstract public PrintService getDefaultPrintService()(Code)
Not called directly by applications. Implemented by a service provider, and called by the print lookup service the default PrintService for this lookup service.If there is no default, returns null.



getMultiDocPrintServices
abstract public MultiDocPrintService[] getMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes)(Code)
Not called directly by applications.

Implemented by a service provider, used by the static methods of this class.

Locates MultiDoc print services which can be positively confirmed to support the combination of attributes and DocFlavors specified.


Parameters:
  flavors - of documents required. If null or empty it is ignored.
Parameters:
  attributes - required to be supported. If null thisconstraint is not used. array of matching PrintServices. If no services match, thearray is zero-length.




getPrintServices
abstract public PrintService[] getPrintServices(DocFlavor flavor, AttributeSet attributes)(Code)
Locates services that can be positively confirmed to support the combination of attributes and DocFlavors specified. This method is not called directly by applications.

Implemented by a service provider, used by the static methods of this class.

The results should be the same as obtaining all the PrintServices and querying each one individually on its support for the specified attributes and flavors, but the process can be more efficient by taking advantage of the capabilities of lookup services for the print services.
Parameters:
  flavor - of document required. If null it is ignored.
Parameters:
  attributes - required to be supported. If null thisconstraint is not used. array of matching PrintServices. If no services match, thearray is zero-length.




getPrintServices
abstract public PrintService[] getPrintServices()(Code)
Not called directly by applications. Implemented by a service provider, used by the static methods of this class. array of all PrintServices known to this lookup serviceclass. If none are found, the array is zero-length.



lookupDefaultPrintService
final public static PrintService lookupDefaultPrintService()(Code)
Locates the default print service for this environment. This may return null. If multiple lookup services each specify a default, the chosen service is not precisely defined, but a platform native service, rather than an installed service, is usually returned as the default. If there is no clearly identifiable platform native default print service, the default is the first to be located in an implementation-dependent manner.

This may include making use of any preferences API that is available as part of the Java or native platform. This algorithm may be overridden by a user setting the property javax.print.defaultPrinter. A service specified must be discovered to be valid and currently available to be returned as the default. the default PrintService.




lookupMultiDocPrintServices
final public static MultiDocPrintService[] lookupMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes)(Code)
Locates MultiDoc print Services capable of printing MultiDocs containing all the specified doc flavors.

This method is useful to help locate a service that can print a MultiDoc in which the elements may be different flavors. An application could perform this itself by multiple lookups on each DocFlavor in turn and collating the results, but the lookup service may be able to do this more efficiently.
Parameters:
  flavors - the flavors to print. If null or empty thisconstraint is not used.Otherwise return only multidoc print services that can print allspecified doc flavors.
Parameters:
  attributes - attributes that the print service mustsupport. If null this constraint is not used. array of matching MultiDocPrintService objects.If no services match, the array is zero-length.




lookupPrintServices
final public static PrintService[] lookupPrintServices(DocFlavor flavor, AttributeSet attributes)(Code)
Locates print services capable of printing the specified DocFlavor .
Parameters:
  flavor - the flavor to print. If null, this constraint is notused.
Parameters:
  attributes - attributes that the print service must support.If null this constraint is not used. array of matching PrintService objectsrepresenting print services that support the specified flavorattributes. If no services match, the array is zero-length.



registerService
public static boolean registerService(PrintService service)(Code)
Allows an application to directly register an instance of a class which implements a print service. The lookup operations for this service will be performed by the PrintServiceLookup class using the attribute values and classes reported by the service. This may be less efficient than a lookup service tuned for that service. Therefore registering a PrintServiceLookup instance instead is recommended. The method returns true if this service is not previously registered and is now successfully registered. This method should not be called with StreamPrintService instances. They will always fail to register and the method will return false.
Parameters:
  service - an implementation of a print service. true if the service is newlyregistered; false otherwise.



registerServiceProvider
public static boolean registerServiceProvider(PrintServiceLookup sp)(Code)
Allows an application to explicitly register a class that implements lookup services. The registration will not persist across VM invocations. This is useful if an application needs to make a new service available that is not part of the installation. If the lookup service is already registered, or cannot be registered, the method returns false.


Parameters:
  sp - an implementation of a lookup service. true if the new lookup service is newlyregistered; false otherwise.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.