1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
47 * <p>
48 * Applications use only the static methods of this abstract class. The instance
49 * methods are implemented by a service provider in a subclass and the
50 * unification of the results from all installed lookup classes are reported by
51 * the static methods of this class when called by the application.
52 * <p>
53 * A {@code PrintServiceLookup} implementor is recommended to check for the
54 * {@code SecurityManager.checkPrintJobAccess()} to deny access to untrusted
55 * code. Following this recommended policy means that untrusted code may not be
56 * able to locate any print services. Downloaded applets are the most common
57 * example of untrusted code.
58 * <p>
59 * This check is made on a per lookup service basis to allow flexibility in the
60 * policy to reflect the needs of different lookup services.
61 * <p>
62 * Services which are registered by {@link #registerService(PrintService)} will
63 * not be included in lookup results if a security manager is installed and its
64 * {@code checkPrintJobAccess()} method denies access.
65 */
66 public abstract class PrintServiceLookup {
67
68 /**
69 * Contains a lists of services.
70 */
71 static class Services {
72
73 /**
74 * The list of lookup services.
75 */
76 private ArrayList<PrintServiceLookup> listOfLookupServices = null;
77
78 /**
79 * The list of registered services.
80 */
81 private ArrayList<PrintService> registeredServices = null;
82 }
83
84 /**
85 * Returns the services from the current appcontext.
86 *
|
1 /*
2 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
47 * <p>
48 * Applications use only the static methods of this abstract class. The instance
49 * methods are implemented by a service provider in a subclass and the
50 * unification of the results from all installed lookup classes are reported by
51 * the static methods of this class when called by the application.
52 * <p>
53 * A {@code PrintServiceLookup} implementor is recommended to check for the
54 * {@code SecurityManager.checkPrintJobAccess()} to deny access to untrusted
55 * code. Following this recommended policy means that untrusted code may not be
56 * able to locate any print services. Downloaded applets are the most common
57 * example of untrusted code.
58 * <p>
59 * This check is made on a per lookup service basis to allow flexibility in the
60 * policy to reflect the needs of different lookup services.
61 * <p>
62 * Services which are registered by {@link #registerService(PrintService)} will
63 * not be included in lookup results if a security manager is installed and its
64 * {@code checkPrintJobAccess()} method denies access.
65 */
66 public abstract class PrintServiceLookup {
67
68 /**
69 * Constructor for subclasses to call.
70 */
71 public PrintServiceLookup() {}
72
73 /**
74 * Contains a lists of services.
75 */
76 static class Services {
77
78 /**
79 * The list of lookup services.
80 */
81 private ArrayList<PrintServiceLookup> listOfLookupServices = null;
82
83 /**
84 * The list of registered services.
85 */
86 private ArrayList<PrintService> registeredServices = null;
87 }
88
89 /**
90 * Returns the services from the current appcontext.
91 *
|