jdk/test/javax/accessibility/AccessibilityProvider/UnusedProvider.java
author ptbrunet
Mon, 15 Jun 2015 12:36:35 -0500
changeset 31438 5593480edd2a
permissions -rw-r--r--
8055160: Support loading of Assistive Technology from service provider Summary: Load assistive technolgy via service provider Reviewed-by: mchung, prr, alanb, ihse, serb Contributed-by: peter.brunet@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31438
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     1
/*
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     4
 *
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     8
 *
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    13
 * accompanied this code).
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    14
 *
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    18
 *
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    21
 * questions.
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    22
 */
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    23
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    24
import java.io.IOException;
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    25
import java.io.PrintWriter;
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    26
import java.io.UncheckedIOException;
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    27
import javax.accessibility.AccessibilityProvider;
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    28
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    29
public final class UnusedProvider extends AccessibilityProvider {
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    30
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    31
    private static final String name = "UnusedProvider";
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    32
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    33
    public String getName() {
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    34
        return name;
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    35
    }
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    36
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    37
    public void activate() {
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    38
        // Write to log to indicate activate was called.
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    39
        try (PrintWriter writer = new PrintWriter("UnusedProvider.txt")) {
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    40
            writer.println("UnusedProvider-activated");
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    41
        } catch (IOException e) {
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    42
            throw new UncheckedIOException(e);
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    43
        }
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    44
    }
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    45
5593480edd2a 8055160: Support loading of Assistive Technology from service provider
ptbrunet
parents:
diff changeset
    46
}