001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008 Sun Microsystems, Inc. 025 */ 026package org.opends.server.admin.std.meta; 027 028 029 030import org.opends.server.admin.AbstractManagedObjectDefinition; 031import org.opends.server.admin.AdministratorAction; 032import org.opends.server.admin.BooleanPropertyDefinition; 033import org.opends.server.admin.ClassPropertyDefinition; 034import org.opends.server.admin.PropertyOption; 035import org.opends.server.admin.std.client.LogPublisherCfgClient; 036import org.opends.server.admin.std.server.LogPublisherCfg; 037import org.opends.server.admin.Tag; 038import org.opends.server.admin.TopCfgDefn; 039import org.opends.server.admin.UndefinedDefaultBehaviorProvider; 040 041 042 043/** 044 * An interface for querying the Log Publisher managed object 045 * definition meta information. 046 * <p> 047 * Log Publishers are responsible for distributing log messages from 048 * different loggers to a destination. 049 */ 050public final class LogPublisherCfgDefn extends AbstractManagedObjectDefinition<LogPublisherCfgClient, LogPublisherCfg> { 051 052 // The singleton configuration definition instance. 053 private static final LogPublisherCfgDefn INSTANCE = new LogPublisherCfgDefn(); 054 055 056 057 // The "enabled" property definition. 058 private static final BooleanPropertyDefinition PD_ENABLED; 059 060 061 062 // The "java-class" property definition. 063 private static final ClassPropertyDefinition PD_JAVA_CLASS; 064 065 066 067 // Build the "enabled" property definition. 068 static { 069 BooleanPropertyDefinition.Builder builder = BooleanPropertyDefinition.createBuilder(INSTANCE, "enabled"); 070 builder.setOption(PropertyOption.MANDATORY); 071 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "enabled")); 072 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<Boolean>()); 073 PD_ENABLED = builder.getInstance(); 074 INSTANCE.registerPropertyDefinition(PD_ENABLED); 075 } 076 077 078 079 // Build the "java-class" property definition. 080 static { 081 ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class"); 082 builder.setOption(PropertyOption.MANDATORY); 083 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class")); 084 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 085 builder.addInstanceOf("org.opends.server.loggers.LogPublisher"); 086 PD_JAVA_CLASS = builder.getInstance(); 087 INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS); 088 } 089 090 091 092 // Register the tags associated with this managed object definition. 093 static { 094 INSTANCE.registerTag(Tag.valueOf("logging")); 095 } 096 097 098 099 /** 100 * Get the Log Publisher configuration definition singleton. 101 * 102 * @return Returns the Log Publisher configuration definition 103 * singleton. 104 */ 105 public static LogPublisherCfgDefn getInstance() { 106 return INSTANCE; 107 } 108 109 110 111 /** 112 * Private constructor. 113 */ 114 private LogPublisherCfgDefn() { 115 super("log-publisher", TopCfgDefn.getInstance()); 116 } 117 118 119 120 /** 121 * Get the "enabled" property definition. 122 * <p> 123 * Indicates whether the Log Publisher is enabled for use. 124 * 125 * @return Returns the "enabled" property definition. 126 */ 127 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 128 return PD_ENABLED; 129 } 130 131 132 133 /** 134 * Get the "java-class" property definition. 135 * <p> 136 * The fully-qualified name of the Java class that provides the Log 137 * Publisher implementation. 138 * 139 * @return Returns the "java-class" property definition. 140 */ 141 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 142 return PD_JAVA_CLASS; 143 } 144}