You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by vt...@apache.org on 2004/11/09 15:50:39 UTC

svn commit: rev 57043 - incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authorization/predicate

Author: vtence
Date: Tue Nov  9 06:50:38 2004
New Revision: 57043

Added:
   incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authorization/predicate/Predicates.java
Log:
A factory for predicates

Added: incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authorization/predicate/Predicates.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/sandbox/src/java/org/apache/janus/authorization/predicate/Predicates.java	Tue Nov  9 06:50:38 2004
@@ -0,0 +1,52 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.janus.authorization.predicate;
+
+import org.apache.janus.authorization.Permission;
+import org.apache.janus.authorization.Predicate;
+
+import java.security.Principal;
+
+public final class Predicates
+{
+    public static final Predicate TRUE = new TruePredicate();
+    public static final Predicate FALSE = new FalsePredicate();
+
+    private Predicates()
+    {
+    }
+
+    public static Predicate isImplied( Permission p )
+    {
+        return new ImpliedPermissionPredicate( p );
+    }
+
+    public static Predicate isDependedUpon( Permission p )
+    {
+        return new DependedUponPermissionPredicate( p );
+    }
+
+    public static Predicate is( Object o )
+    {
+        return new EqualPredicate( o );
+    }
+
+    public static Predicate hasPrincipal( Principal p )
+    {
+        return new HasPrincipalPredicate( p );
+    }
+}