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