/*
 * RemoteManagedObjectTest.java
 *
 * Created on October 16, 2003, 12:11 AM
 */

package hep.aida.ref.remote.testRemote;

import hep.aida.dev.IDevMutableStore;
import hep.aida.ref.Annotation;
import hep.aida.ref.remote.RemoteManagedObject;

/**
 * RemoteManagedObject that can be used for tests
 *
 * @author  serbo
 */
public class RemoteManagedObjectTest extends RemoteManagedObject {
    
    private Annotation annotation = null;
    private String data;

    /** Creates a new instance of RemoteManagedObjectTest */
    public RemoteManagedObjectTest(String name) {
        this(null, name);
    }
    
    public RemoteManagedObjectTest(IDevMutableStore store, String name) {
        this(store, name, "Title: "+name);
    }
    
    public RemoteManagedObjectTest(IDevMutableStore store, String name, String title) {
        super(name);
        aidaType = "RemoteManagedObjectTest";
        this.store = store;
        annotation = new Annotation(); 
        annotation.setFillable(true);
        annotation.addItem(Annotation.titleKey,title,true);
        annotation.setFillable(false);
        init();
    }
    
    
    // Service methods
    
    public void setData(String data) { this.data = data; }
    
    public String getData() { 
        makeSureDataIsValid();
        return data; 
    }
    
    protected void init() {
        data = null;
        dataIsValid = false;
    }
    
}
