All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sakaiproject.cheftool.ControllerState Maven / Gradle / Ivy

There is a newer version: 23.3
Show newest version
/**********************************************************************************
 * $URL$
 * $Id$
 ***********************************************************************************
 *
 * Copyright (c) 2003, 2004, 2005, 2006, 2008 The Sakai Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ECL-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.
 *
 **********************************************************************************/

package org.sakaiproject.cheftool;

import java.util.Observable;
import java.util.Observer;

/**
 * 

* ControllerState is the core base class for the CHEF Tool's state objects. *

*

* State objects are used to store controller state for a tool. Specific state object implement this interface. *

*

* To support creation of controller state objects, make sure to supply a void constructor. *

*

* To support pooling of objects, implement the recycle() method to release any resources and restore the object to initial conditions before reuse. *

*/ public abstract class ControllerState implements Observer { /** * Init to startup values */ protected void init() { } // init /** * Release any resources and restore the object to initial conditions to be reused. */ public void recycle() { m_id = ""; m_setId = ""; init(); } // recycle /** This state's unique id (unique within the set) */ private String m_id = ""; public String getId() { return m_id; } public void setId(String id) { m_id = id; } /** This state's set unique id */ private String m_setId = ""; public String getSetId() { return m_setId; } public void setSetId(String id) { m_setId = id; } /** * Access a unique key for this state, combining the set id and the state id. * * @return A unique key for this state, combining the set id and the state id. */ public String getKey() { return m_setId + m_id; } // getKey /********************************************************************************************************************************************************************************************************************************************************** * Observer implementation *********************************************************************************************************************************************************************************************************************************************************/ /** * This method is called whenever the observed object is changed. An application calls an Observable object's notifyObservers method to have all the object's observers notified of the change. default implementation is to * cause the courier service to deliver to the interface controlled by my controller. Extensions can override. * * @param o * the observable object. * @param arg * an argument passed to the notifyObservers method. */ public void update(Observable o, Object arg) { } // update } // ControllerState




© 2015 - 2024 Weber Informatics LLC | Privacy Policy