Debian Codegraph @

bundles/org.eclipse.equinox.p2.discovery/src/org/eclipse/equinox/internal/p2/discovery/Policy.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Tasktop Technologies and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * Tasktop Technologies - initial API and implementation
13 *******************************************************************************/
14
15 package org.eclipse.equinox.internal.p2.discovery;
16
17 /**
18 * A policy defines what is permitted.
19 *
20 * @author David Green
21 */
22 public class Policy {
23
24 /**
25 * Define system property <code>org.eclipse.mylyn.internal.discovery.core.model.Policy.permissive=true</code> to
26 * allow for categories to be permitted by anyone. For testing purposes.
27 */
28 private static final boolean PERMISSIVE = Boolean.getBoolean(Policy.class.getName() + ".permissive"); //$NON-NLS-1$
29
30 private static final Policy DEFAULT = new Policy(false);
31
32 private final boolean permitCategories;
33
34 public Policy(boolean permitCategories) {
35 this.permitCategories = permitCategories;
36 }
37
38 public boolean isPermitCategories() {
39 return permitCategories || PERMISSIVE;
40 }
41
42 public static Policy defaultPolicy() {
43 return DEFAULT;
44 }
45 }