001/* 002 * Copyright 2010-2017 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2010-2017 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk.controls; 022 023 024 025/** 026 * This enum defines the synchronization states for entries returned with the 027 * content synchronization state control. See the documentation for the 028 * {@link ContentSyncRequestControl} class for more information about using the 029 * content synchronization operation. 030 */ 031public enum ContentSyncInfoType 032{ 033 /** 034 * Indicates that the associated content synchronization info response only 035 * provides a new state cookie. 036 */ 037 NEW_COOKIE((byte) 0x80), 038 039 040 041 /** 042 * Indicates that the associated content synchronization info response is used 043 * to indicate that a delete phase has ended. 044 */ 045 REFRESH_DELETE((byte) 0xA1), 046 047 048 049 /** 050 * Indicates that the associated content synchronization info response is used 051 * to indicate that a present phase has ended. 052 */ 053 REFRESH_PRESENT((byte) 0xA2), 054 055 056 057 /** 058 * Indicates that the associated content synchronization info response is used 059 * to provide information about multiple entries which have been deleted or 060 * multiple entries which have remained unchanged. 061 */ 062 SYNC_ID_SET((byte) 0xA3); 063 064 065 066 // The BER type used for this sync info type in the value of a content 067 // synchronization info message. 068 private final byte type; 069 070 071 072 /** 073 * Creates a new content synchronization info type value with the specified 074 * BER type. 075 * 076 * @param type The BER type used for this sync info type in the value of a 077 * content synchronization info message. 078 */ 079 private ContentSyncInfoType(final byte type) 080 { 081 this.type = type; 082 } 083 084 085 086 /** 087 * Retrieves the BER type for this synchronization info type value. 088 * 089 * @return The BER type for this synchronization info type value. 090 */ 091 public byte getType() 092 { 093 return type; 094 } 095 096 097 098 /** 099 * Retrieves the content synchronization info type with the specified BER 100 * type. 101 * 102 * @param type The BER type of the content synchronization info type value 103 * to retrieve. 104 * 105 * @return The content synchronization info value with the specified BER 106 * type, or {@code null} if the given value does not correspond with 107 * any defined type. 108 */ 109 public static ContentSyncInfoType valueOf(final byte type) 110 { 111 if (type == NEW_COOKIE.getType()) 112 { 113 return NEW_COOKIE; 114 } 115 else if (type == REFRESH_DELETE.getType()) 116 { 117 return REFRESH_DELETE; 118 } 119 else if (type == REFRESH_PRESENT.getType()) 120 { 121 return REFRESH_PRESENT; 122 } 123 else if (type == SYNC_ID_SET.getType()) 124 { 125 return SYNC_ID_SET; 126 } 127 else 128 { 129 return null; 130 } 131 } 132}