PersistentServerState.java revision 336ccbd284177b59fca3636fc5fc7212b2f67061
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
/**
* This class implements a ServerState that is stored on the backends
* used to store the synchronized data and that is therefore persistent
* accross server reboot.
*/
public class PersistentServerState extends ServerState
{
private boolean savedStatus = true;
private InternalClientConnection conn =
private ASN1OctetString asn1BaseDn;
/**
* The attribute name used to store the state in the backend.
*/
/**
* create a new ServerState.
* @param baseDn The baseDN for which the ServerState is created
*/
{
loadState();
}
/**
* {@inheritDoc}
*/
{
savedStatus = false;
return super.update(changeNumber);
}
/**
* Save this object to persistent storage.
*/
public void save()
{
if (savedStatus)
return;
savedStatus = true;
{
savedStatus = false;
}
}
/**
* Load the ServerState from the backing entry in database to memory.
*/
public void loadState()
{
/*
* Read the serverState from the database,
* If not there create empty entry
*/
try
{
} catch (LDAPException e)
{
// can not happen
return;
}
/*
* Search the database entry that is used to periodically
* save the ServerState
*/
{
int msgID = MSGID_ERROR_SEARCHING_RUV;
}
{
/*
* Read the serverState from the REPLICATION_STATE attribute
*/
if (resultEntry != null)
{
{
{
}
}
}
/*
* TODO : The ServerState is saved to the database periodically,
* therefore in case of crash it is possible that is does not contain
* the latest changes that have been processed and saved to the
* database.
* In order to make sure that we don't loose them, search all the entries
* that have been updated after this entry.
* This is done by using the HistoricalCsnOrderingMatchingRule
* and an ordering index for historical attribute
*/
}
}
/**
* Save the current values of this PersistentState object
* in the appropiate entry of the database.
*
* @return a ResultCode indicating if the method was successfull.
*/
private ResultCode updateStateEntry()
{
/*
* Generate a modify operation on the Server State baseD Entry.
*/
return ResultCode.SUCCESS;
mods);
op.setInternalOperation(true);
op.setSynchronizationOperation(true);
op.setDontSynchronize(true);
{
int msgID = MSGID_ERROR_UPDATING_RUV;
}
return result;
}
}