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 */
016
017package org.opends.guitools.controlpanel.datamodel;
018
019/**
020 * Abstract class used to describe the configuration of an index.
021 *
022 */
023public abstract class AbstractIndexDescriptor
024implements Comparable<AbstractIndexDescriptor>
025{
026  private String name;
027  private BackendDescriptor backend;
028  /**
029   * Constructor.
030   * @param name the name of the index.
031   * @param backend the backend where the index is defined.
032   */
033  protected AbstractIndexDescriptor(String name, BackendDescriptor backend)
034  {
035    this.name = name;
036    this.backend = backend;
037  }
038
039  /**
040   * Returns the name of the index.
041   * @return the name of the index.
042   */
043  public String getName()
044  {
045    return name;
046  }
047
048  /**
049   * Returns the backend where the index is defined.
050   * @return the backend where the index is defined.
051   */
052  public BackendDescriptor getBackend()
053  {
054    return backend;
055  }
056
057  /**
058   * Sets which is the backend where the index is defined.
059   * @param backend the backend where the index is defined.
060   */
061  public void setBackend(BackendDescriptor backend)
062  {
063    this.backend = backend;
064    recalculateHashCode();
065  }
066
067  /**
068   * Method used to minimize the times the hashcode is calculated.
069   *
070   */
071  protected abstract void recalculateHashCode();
072}