/** * This sets the error state when the user has attempted a fiendishly complex and stoopid request * that requires a mixture of 'deleteOldRDN=false' and 'deleteOldRDN=true'. Since JX does not * handle indeterminate quantum states, we throw an error instead. * * @param oldDN * @param newDN * @return */ private boolean setWierdoRDNError(DN oldDN, DN newDN) { String msg = CBIntText.get( "The rename operation is too complex to proceed. Try to break it up into smaller stages.") + "\n " + oldDN.toString() + "\n => " + newDN.toString(); return error(msg, new NamingException(msg)); }
/** Opens a dialog that displays the operational attributes of the current entry. */ public void displayOperationalAttributes() { JXplorerBrowser jx = null; if (owner instanceof JXplorerBrowser) jx = (JXplorerBrowser) owner; else return; showingOperationalAttributes = !showingOperationalAttributes; // EJP 17 August 2010. // CB 14 August 2012 - some directories (looking at you Active Directory) don't support the '+' // operator... so do it manually as well... String[] opAttrs = { "+", "createTimeStamp", "creatorsName", "entryFlags", "federationBoundary", "localEntryID", "modifiersName", "modifyTimeStamp", "structuralObjectClass", "subordinateCount", "subschemaSubentry" }; DXEntry entry = null; if (showingOperationalAttributes) { try { entry = (jx.getSearchBroker()).unthreadedReadEntry(currentDN, opAttrs); StringBuffer buffy = new StringBuffer("DN: " + currentDN.toString() + "\n\n"); // Get the attribute values... // EJP 17 August 2010: use the actual attributes returned. NamingEnumeration ne = null; try { ne = entry.getAll(); while (ne.hasMore()) { DXAttribute att = (DXAttribute) ne.next(); buffy.append(att.getName() + ": " + att.get().toString() + "\n"); tableData.insertOperationalAttribute(att); } } finally { if (ne != null) ne.close(); } tableData.fireTableDataChanged(); } catch (NamingException e) { CBUtility.error( TableAttributeEditor.this, CBIntText.get("Unable to read entry " + currentDN), e); } } else { tableData.removeOperationalAttributes(); tableData.fireTableDataChanged(); } }
/** {@inheritDoc} */ @Override public void initializeBackend() throws ConfigException, InitializationException { // Create the set of base DNs that we will handle. In this case, it's just // the DN of the base backup entry. try { backupBaseDN = DN.decode(DN_BACKUP_ROOT); } catch (Exception e) { if (debugEnabled()) { TRACER.debugCaught(DebugLogLevel.ERROR, e); } Message message = ERR_BACKEND_CANNOT_DECODE_BACKEND_ROOT_DN.get(getExceptionMessage(e), getBackendID()); throw new InitializationException(message, e); } // FIXME -- Deal with this more correctly. this.baseDNs = new DN[] {backupBaseDN}; // Determine the set of backup directories that we will use by default. Set<String> values = currentConfig.getBackupDirectory(); backupDirectories = new LinkedHashSet<File>(values.size()); for (String s : values) { backupDirectories.add(getFileForPath(s)); } // Construct the backup base entry. LinkedHashMap<ObjectClass, String> objectClasses = new LinkedHashMap<ObjectClass, String>(2); objectClasses.put(DirectoryServer.getTopObjectClass(), OC_TOP); ObjectClass untypedOC = DirectoryServer.getObjectClass(OC_UNTYPED_OBJECT_LC, true); objectClasses.put(untypedOC, OC_UNTYPED_OBJECT); LinkedHashMap<AttributeType, List<Attribute>> opAttrs = new LinkedHashMap<AttributeType, List<Attribute>>(0); LinkedHashMap<AttributeType, List<Attribute>> userAttrs = new LinkedHashMap<AttributeType, List<Attribute>>(1); RDN rdn = backupBaseDN.getRDN(); int numAVAs = rdn.getNumValues(); for (int i = 0; i < numAVAs; i++) { AttributeType attrType = rdn.getAttributeType(i); ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); attrList.add(Attributes.create(attrType, rdn.getAttributeValue(i))); userAttrs.put(attrType, attrList); } backupBaseEntry = new Entry(backupBaseDN, objectClasses, userAttrs, opAttrs); currentConfig.addBackupChangeListener(this); // Register the backup base as a private suffix. try { DirectoryServer.registerBaseDN(backupBaseDN, this, true); } catch (Exception e) { if (debugEnabled()) { TRACER.debugCaught(DebugLogLevel.ERROR, e); } Message message = ERR_BACKEND_CANNOT_REGISTER_BASEDN.get(backupBaseDN.toString(), getExceptionMessage(e)); throw new InitializationException(message, e); } }