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
010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2008 Sun Microsystems, Inc.
026 */
027
028 package org.opends.server.backends.jeb.importLDIF;
029
030 import org.opends.server.types.Entry;
031
032 /**
033 * A work element passed on the work queue.
034 */
035 public class WorkElement {
036
037 //The entry to import.
038 private Entry entry;
039
040 //Used in replace mode, this is the entry to replace.
041 private Entry existingEntry;
042
043 //The context related to the entry.
044 private DNContext context;
045
046 /**
047 * Create a work element instance.
048 *
049 * @param entry The entry to import.
050 * @param context The context related to the entry.
051 */
052 private WorkElement(Entry entry, DNContext context ) {
053 this.entry = entry;
054 this.context = context;
055 }
056
057 /**
058 * Static to create an work element.
059 *
060 * @param entry The entry to import.
061 * @param context The context related to the entry.
062 * @return A work element to put on the queue.
063 */
064 public static
065 WorkElement decode(Entry entry, DNContext context ) {
066 return new WorkElement(entry, context);
067 }
068
069 /**
070 * Return the entry to import.
071 *
072 * @return The entry to import.
073 */
074 public Entry getEntry() {
075 return entry;
076 }
077
078 /**
079 * Return the context related to the entry.
080 *
081 * @return The context.
082 */
083 public DNContext getContext() {
084 return context;
085 }
086
087 /**
088 * Return an existing entry, used during replace mode.
089 *
090 * @return An existing entry.
091 */
092 public Entry getExistingEntry() {
093 return existingEntry;
094 }
095
096 /**
097 * Set the existing entry.
098 *
099 * @param existingEntry The existing entry to set.
100 */
101 public void setExistingEntry(Entry existingEntry) {
102 this.existingEntry = existingEntry;
103 }
104 }