com.gemstone.gemfire.internal.cache.ha.ConflatableObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-junit Show documentation
Show all versions of gemfire-junit Show documentation
SnappyData store based off Pivotal GemFireXD
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.gemstone.gemfire.internal.cache.ha;
import java.io.Serializable;
import com.gemstone.gemfire.internal.cache.Conflatable;
import com.gemstone.gemfire.internal.cache.EventID;
/**
* Implementing class for Conflatable
interface. Objects of this
* class will be add to the queue
*
* @author Dinesh Patel
*
*/
public class ConflatableObject implements Conflatable, Serializable
{
/** The key for this entry */
private Object key;
/** The value for this entry */
private Object value;
/** The unique EventID
object for this entry */
private EventID id;
/** boolean to indicate whether this entry should be conflated or not */
private boolean conflate;
/** The region to which this entry belongs */
private String regionname;
public ConflatableObject() {
}
/**
* Constructor
*
* @param key -
* The key for this entry
* @param value -
* The value for this entry
* @param eventid -
* eventID object for this entry
* @param conflate -
* conflate it true
* @param regionname -
* The region to which this entry belongs
*/
public ConflatableObject(Object key, Object value, EventID eventId,
boolean conflate, String regionname) {
this.key = key;
this.value = value;
this.id = eventId;
this.conflate = conflate;
this.regionname = regionname;
}
/**
* Returns whether the object should be conflated
*
* @return whether the object should be conflated
*/
public boolean shouldBeConflated()
{
return this.conflate;
}
/**
* {@inheritDoc}
*/
public boolean shouldBeMerged() {
return false;
}
/**
* {@inheritDoc}
*/
public boolean merge(Conflatable existing) {
throw new AssertionError("not expected to be invoked");
}
/**
* Returns the name of the region for this Conflatable
*
* @return the name of the region for this Conflatable
*/
public String getRegionToConflate()
{
return this.regionname;
}
/**
* Returns the key for this Conflatable
*
* @return the key for this Conflatable
*/
public Object getKeyToConflate()
{
return this.key;
}
/**
* Returns the value for this Conflatable
*
* @return the value for this Conflatable
*/
public Object getValueToConflate()
{
return this.value;
}
/**
* Sets the latest value for this Conflatable
*
* @param value
* The latest value
*/
public void setLatestValue(Object value)
{
throw new UnsupportedOperationException("setLatestValue should not be used");
}
/**
* Return this event's identifier
*
* @return this event's identifier
*/
public EventID getEventId()
{
return this.id;
}
/**
* @return Returns the conflate.
*/
final boolean isConflate()
{
return conflate;
}
/**
* @param conflate
* The conflate to set.
*/
final void setConflate(boolean conflate)
{
this.conflate = conflate;
}
/**
* @return Returns the id.
*/
final EventID getId()
{
return id;
}
/**
* @param id
* The id to set.
*/
final void setId(EventID id)
{
this.id = id;
}
/**
* @return Returns the key.
*/
final Object getKey()
{
return key;
}
/**
* @param key
* The key to set.
*/
final void setKey(Object key)
{
this.key = key;
}
/**
* @return Returns the regionname.
*/
final String getRegionname()
{
return regionname;
}
/**
* @param regionname
* The regionname to set.
*/
final void setRegionname(String regionname)
{
this.regionname = regionname;
}
/**
* @return Returns the value.
*/
final Object getValue()
{
return value;
}
/**
* @param value
* The value to set.
*/
final void setValue(Object value)
{
this.value = value;
}
}