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-2010 Sun Microsystems, Inc. 025 * Portions Copyright 2015 ForgeRock AS 026 */ 027 028package org.opends.guitools.controlpanel.ui.nodes; 029 030import javax.swing.tree.TreePath; 031 032import org.opends.server.types.LDAPURL; 033 034/** 035 * Interface used in the LDAP entries browser code to deal with entries. 036 * 037 */ 038public interface BrowserNodeInfo { 039 040 /** 041 * URL of the displayed entry. 042 * @return the URL of the displayed entry. 043 */ 044 LDAPURL getURL(); 045 046 047 /** 048 * Returns <CODE>true</CODE> if the displayed entry is the top entry of a 049 * suffix and <CODE>false</CODE> otherwise. 050 * @return <CODE>true</CODE> if the displayed entry is the top entry of a 051 * suffix and <CODE>false</CODE> otherwise. 052 */ 053 boolean isSuffix(); 054 055 056 /** 057 * Returns <CODE>true</CODE> if the displayed entry is the root node of the 058 * server (the dn="" entry) and <CODE>false</CODE> otherwise. 059 * @return <CODE>true</CODE> if the displayed entry is the root node of the 060 * server (the dn="" entry) and <CODE>false</CODE> otherwise. 061 */ 062 boolean isRootNode(); 063 064 /** 065 * Returns <CODE>true</CODE> if the displayed entry is not located on the 066 * current server. An entry is declared 'remote' when the host/port of 067 * getURL() is different from the host/port of the DirContext associated to 068 * the browser controller. Returns <CODE>false</CODE> otherwise. 069 * @return <CODE>true</CODE> if the displayed entry is not located on the 070 * current server. An entry is declared 'remote' when the host/port of 071 * getURL() is different from the host/port of the DirContext associated to 072 * the browser controller. Returns <CODE>false</CODE> otherwise. 073 * 074 */ 075 boolean isRemote(); 076 077 078 /** 079 * Returns the value of numsubordinates for the entry. 080 * -1 if the numsubordinates attribute is not defined. 081 * @return the value of numsubordinates for the entry. 082 */ 083 int getNumSubOrdinates(); 084 085 086 /** 087 * Returns the value of hassubordinates for the entry. 088 * @return the value of hassubordinates for the entry. 089 */ 090 boolean hasSubOrdinates(); 091 092 /** 093 * Returns the referrals attached to the displayed entry. 094 * This is the value of the 'ref' attribute. 095 * Returns <CODE>null</CODE> if the attribute is not present. 096 * @return the referrals attached to the displayed entry. 097 */ 098 String[] getReferral(); 099 100 101 /** 102 * Returns the error detected while reading this entry. 103 * @return the error detected while reading this entry. 104 */ 105 int getErrorType(); 106 107 108 /** 109 * Returns the exception associated to the error. 110 * Returns <CODE>null</CODE> if getErrorType() == ERROR_NONE. 111 * @return the exception associated to the error. 112 */ 113 Exception getErrorException(); 114 115 116 /** 117 * Returns the argument associated to an error/exception. 118 * Always null except when errorType == ERROR_SOLVING_REFERRAL, 119 * errorArg contains the String representing the faulty LDAP URL. 120 * @return the argument associated to an error/exception. 121 */ 122 Object getErrorArg(); 123 124 /** 125 * Returns the basic node associated with the node info. 126 * @return the basic node associated with the node info. 127 */ 128 BasicNode getNode(); 129 130 131 /** 132 * Returns the TreePath corresponding to the displayed entry. 133 * @return the TreePath corresponding to the displayed entry. 134 */ 135 TreePath getTreePath(); 136 137 138 /** 139 * Tells whether the node passed as parameter represents the same node as this 140 * one. 141 * @param node the node. 142 * @return <CODE>true</CODE> if the node passed as parameter represents the 143 * same node as this one and <CODE>false</CODE> otherwise. 144 */ 145 boolean representsSameNode(BrowserNodeInfo node); 146 147 /** 148 * Returns the object class value of the entry that the nodes represents. 149 * @return the object class value of the entry that the nodes represents. 150 */ 151 String[] getObjectClassValues(); 152 153 /** 154 * Error types 155 */ 156 /** No error happened. */ 157 int ERROR_NONE = 0; 158 /** And error reading the entry occurred. */ 159 int ERROR_READING_ENTRY = 1; 160 /** An error following referrals occurred. */ 161 int ERROR_SOLVING_REFERRAL = 2; 162 /** An error occurred searching the children of the entry. */ 163 int ERROR_SEARCHING_CHILDREN = 3; 164 165}