001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 */ 016package org.forgerock.opendj.server.config.meta; 017 018 019 020import org.forgerock.opendj.config.AbstractManagedObjectDefinition; 021import org.forgerock.opendj.config.AdministratorAction; 022import org.forgerock.opendj.config.BooleanPropertyDefinition; 023import org.forgerock.opendj.config.ClassPropertyDefinition; 024import org.forgerock.opendj.config.PropertyOption; 025import org.forgerock.opendj.config.TopCfgDefn; 026import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider; 027import org.forgerock.opendj.server.config.client.HTTPAuthorizationMechanismCfgClient; 028import org.forgerock.opendj.server.config.server.HTTPAuthorizationMechanismCfg; 029 030 031 032/** 033 * An interface for querying the HTTP Authorization Mechanism managed 034 * object definition meta information. 035 * <p> 036 * The HTTP Authorization Mechanism is used to define HTTP 037 * authorization mechanism. 038 */ 039public final class HTTPAuthorizationMechanismCfgDefn extends AbstractManagedObjectDefinition<HTTPAuthorizationMechanismCfgClient, HTTPAuthorizationMechanismCfg> { 040 041 /** The singleton configuration definition instance. */ 042 private static final HTTPAuthorizationMechanismCfgDefn INSTANCE = new HTTPAuthorizationMechanismCfgDefn(); 043 044 045 046 /** The "enabled" property definition. */ 047 private static final BooleanPropertyDefinition PD_ENABLED; 048 049 050 051 /** The "java-class" property definition. */ 052 private static final ClassPropertyDefinition PD_JAVA_CLASS; 053 054 055 056 /** Build the "enabled" property definition. */ 057 static { 058 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "enabled"); 059 builder.setOption(PropertyOption.MANDATORY); 060 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "enabled")); 061 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Boolean>()); 062 PD_ENABLED = builder.getInstance(); 063 INSTANCE.registerPropertyDefinition(PD_ENABLED); 064 } 065 066 067 068 /** Build the "java-class" property definition. */ 069 static { 070 ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class"); 071 builder.setOption(PropertyOption.MANDATORY); 072 builder.setOption(PropertyOption.ADVANCED); 073 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class")); 074 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 075 builder.addInstanceOf("org.opends.server.protocols.http.authz.HttpAuthorizationMechanism"); 076 PD_JAVA_CLASS = builder.getInstance(); 077 INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS); 078 } 079 080 081 082 /** 083 * Get the HTTP Authorization Mechanism configuration definition 084 * singleton. 085 * 086 * @return Returns the HTTP Authorization Mechanism configuration 087 * definition singleton. 088 */ 089 public static HTTPAuthorizationMechanismCfgDefn getInstance() { 090 return INSTANCE; 091 } 092 093 094 095 /** 096 * Private constructor. 097 */ 098 private HTTPAuthorizationMechanismCfgDefn() { 099 super("http-authorization-mechanism", TopCfgDefn.getInstance()); 100 } 101 102 103 104 /** 105 * Get the "enabled" property definition. 106 * <p> 107 * Indicates whether the HTTP Authorization Mechanism is enabled. 108 * 109 * @return Returns the "enabled" property definition. 110 */ 111 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 112 return PD_ENABLED; 113 } 114 115 116 117 /** 118 * Get the "java-class" property definition. 119 * <p> 120 * Specifies the fully-qualified name of the Java class that 121 * provides the HTTP Authorization Mechanism implementation. 122 * 123 * @return Returns the "java-class" property definition. 124 */ 125 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 126 return PD_JAVA_CLASS; 127 } 128}