| | |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void performBackendPreInitializationProcessing(Backend<?> backend) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void performBackendPostFinalizationProcessing(Backend<?> backend) |
| | | { |
| | |
| | | List<Attribute> dstList = dstEntry.getAttribute(attrCert); |
| | | |
| | | // Check for changes to the certificate value. |
| | | boolean differ = false; |
| | | if (srcList == null) |
| | | if (!srcList.equals(dstList)) |
| | | { |
| | | if (dstList != null) |
| | | { |
| | | differ = true; |
| | | } |
| | | } |
| | | else if (dstList == null |
| | | || srcList.size() != dstList.size() |
| | | || !srcList.equals(dstList)) |
| | | { |
| | | differ = true; |
| | | } |
| | | |
| | | if (differ) |
| | | { |
| | | // The trust store backend does not implement modify so we need to |
| | | // delete then add. |
| | | // The trust store backend does not implement modify so we need to delete then add. |
| | | // FIXME implement TrustStoreBackend.replaceEntry() as deleteEntry() + addEntry() and stop this madness |
| | | DN dstDN = dstEntry.getName(); |
| | | deleteEntry(dstDN); |
| | | addEntry(srcEntry, dstDN); |
| | |
| | | */ |
| | | private static void deleteEntry(DN dstDN) |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation delOperation = conn.processDelete(dstDN); |
| | | |
| | | DeleteOperation delOperation = getRootConnection().processDelete(dstDN); |
| | | if (delOperation.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | logger.debug(INFO_TRUSTSTORESYNC_DELETE_FAILED, dstDN, delOperation.getErrorMessage()); |
| | |
| | | |
| | | List<Attribute> attrList; |
| | | attrList = srcEntry.getAttribute(attrAlias); |
| | | if (attrList != null) |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | userAttrs.put(attrAlias, attrList); |
| | | } |
| | | attrList = srcEntry.getAttribute(attrCert); |
| | | if (attrList != null) |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | userAttrs.put(attrCert, attrList); |
| | | } |
| | | |
| | | Entry addEntry = new Entry(dstDN, ocMap, userAttrs, null); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | AddOperation addOperation = conn.processAdd(addEntry); |
| | | AddOperation addOperation = getRootConnection().processAdd(addEntry); |
| | | if (addOperation.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | logger.debug(INFO_TRUSTSTORESYNC_ADD_FAILED, dstDN, addOperation.getErrorMessage()); |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostResponse doPostResponse(PostResponseAddOperation op) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostResponse doPostResponse(PostResponseDeleteOperation op) |
| | | { |
| | |
| | | return PostResponse.continueOperationProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PostResponse doPostResponse(PostResponseModifyOperation op) |
| | | { |