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.
Modifier and Type | Class and Description |
---|---|
pack-priv static class | PrintServiceLookup.
Contains a lists of services. |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
private static ArrayList | Returns: all lookup services for this environmentReturns all lookup services for this environment. |
public abstract PrintService | Returns: the defaultPrintService for this lookup service. If
there is no default, returns null .Not called directly by applications. |
private static ArrayList | |
public abstract MultiDocPrintService[] | Returns: array of matchingPrintServices . If no services match,
the array is zero-length.of documents required. If flavors, AttributeSet null or empty it is
ignored.required to be supported. If attributes)null this
constraint is not used.Not called directly by applications. |
private static ArrayList | Returns: list of matchingMultiDocPrintService objects. If no
services match, the empty list is returned.the flavors to print. If flavors, AttributeSet null or empty this
constraint is not used. Otherwise return only multidoc print
services that can print all specified doc flavors.attributes that the print service must support. If
attributes)null this constraint is not used.Locates |
public abstract PrintService[] | Returns: array of matchingPrintServices . If no services match,
the array is zero-length.of document required. If flavor, AttributeSet null it is ignored.required to be supported. If attributes)null this
constraint is not used.Locates services that can be positively confirmed to support the
combination of attributes and |
public abstract PrintService[] | Returns: array of allPrintServices known to this lookup service
class. If none are found, the array is zero-length.Not called directly by applications. |
private static ArrayList | Returns: the list of registered servicesReturns the list of registered services. |
private static ArrayList | Returns: list of matchingPrintService objects representing print
services that support the specified flavor attributes. If no
services match, the empty list is returned.the flavor to print. If flavor, AttributeSet null , this constraint is
not used.attributes that the print service must support. If
attributes)null this constraint is not used.Locates print services capable of printing the specified
|
private static PrintServiceLookup. | |
private static ArrayList | Returns: the list of lookup servicesInitialize the list of lookup services. |
private static ArrayList | Returns: the list of registered servicesInitialize the list of registered services. |
public static final PrintService | Returns: the defaultPrintService Locates the default print service for this environment. |
public static final MultiDocPrintService[] | Returns: array of matchingMultiDocPrintService objects. If no
services match, the array is zero-length.the flavors to print. If flavors, AttributeSet null or empty this
constraint is not used. Otherwise return only multidoc print
services that can print all specified doc flavors.attributes that the print service must support. If
attributes)null this constraint is not used.Locates |
public static final PrintService[] | Returns: array of matchingPrintService objects representing print
services that support the specified flavor attributes. If no
services match, the array is zero-length.the flavor to print. If flavor, AttributeSet null , this constraint is
not used.attributes that the print service must support. If
attributes)null this constraint is not used.Locates print services capable of printing the specified
|
public static boolean | Returns: true if the service is newly registered; false
otherwisean implementation of a print service service)Allows an application to directly register an instance of a class which implements a print service. |
public static boolean | Returns: true if the new lookup service is newly registered;
false otherwisean implementation of a lookup service sp)Allows an application to explicitly register a class that implements lookup services. |
PrintServiceLookup | back to summary |
---|---|
protected PrintServiceLookup() Constructor for subclasses to call. |
getAllLookupServices | back to summary |
---|---|
private static ArrayList Returns all lookup services for this environment.
|
getDefaultPrintService | back to summary |
---|---|
public abstract PrintService getDefaultPrintService() Not called directly by applications. Implemented by a service provider, and called by the print lookup service.
|
getListOfLookupServices | back to summary |
---|---|
private static ArrayList Returns the list of lookup services.
|
getMultiDocPrintServices | back to summary |
---|---|
public abstract 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
|
getMultiDocServices | back to summary |
---|---|
private static ArrayList Locates
|
getPrintServices | back to summary |
---|---|
public abstract PrintService[] getPrintServices(DocFlavor flavor, AttributeSet attributes) Locates services that can be positively confirmed to support the
combination of attributes and Implemented by a service provider, used by the static methods of this class.
The results should be the same as obtaining all the
|
getPrintServices | back to summary |
---|---|
public abstract PrintService[] getPrintServices() Not called directly by applications. Implemented by a service provider, used by the static methods of this class.
|
getRegisteredServices | back to summary |
---|---|
private static ArrayList Returns the list of registered services.
|
getServices | back to summary |
---|---|
private static ArrayList Locates print services capable of printing the specified
|
getServicesForContext | back to summary |
---|---|
private static PrintServiceLookup. Returns the services from the current appcontext.
|
initListOfLookupServices | back to summary |
---|---|
private static ArrayList Initialize the list of lookup services.
|
initRegisteredServices | back to summary |
---|---|
private static ArrayList Initialize the list of registered services.
|
lookupDefaultPrintService | back to summary |
---|---|
public static final PrintService lookupDefaultPrintService() Locates the default print service for this environment. This may return
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
|
lookupMultiDocPrintServices | back to summary |
---|---|
public static final MultiDocPrintService[] lookupMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes) Locates
This method is useful to help locate a service that can print a
|
lookupPrintServices | back to summary |
---|---|
public static final PrintService[] lookupPrintServices(DocFlavor flavor, AttributeSet attributes) Locates print services capable of printing the specified
|
registerService | back to summary |
---|---|
public static boolean registerService(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
|
registerServiceProvider | back to summary |
---|---|
public static boolean registerServiceProvider(PrintServiceLookup sp) 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
|
Modifier and Type | Field and Description |
---|---|
private ArrayList | listOfLookupServices
The list of lookup services. |
private ArrayList | registeredServices
The list of registered services. |
Access | Constructor and Description |
---|---|
pack-priv |
listOfLookupServices | back to summary |
---|---|
private ArrayList<PrintServiceLookup> listOfLookupServices The list of lookup services. |
registeredServices | back to summary |
---|---|
private ArrayList<PrintService> registeredServices The list of registered services. |
Services | back to summary |
---|---|
pack-priv Services() |