[Mc4j-cvs] mc4j/modules/ems/src/ems/org/mc4j/ems/store CompleteValueHistory.java,NONE,1.1.2.1 Value.
Brought to you by:
ghinkl
From: Greg H. <gh...@us...> - 2005-05-26 17:27:36
|
Update of /cvsroot/mc4j/mc4j/modules/ems/src/ems/org/mc4j/ems/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7113/modules/ems/src/ems/org/mc4j/ems/store Added Files: Tag: ems_module_separation CompleteValueHistory.java Value.java ValueHistory.java Log Message: EMS is an externalization of the core JMX handling functionality in MC4J. This will provide a safe interface based access to jmx info that hides the necessary complexity of special classloaders per connection. The implementation is simple and the error handling has not been added yet. --- NEW FILE: CompleteValueHistory.java --- /* * Copyright 2002-2004 Greg Hinkle * * 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. */ package org.mc4j.ems.store; import java.util.List; import java.util.LinkedList; import java.util.Collections; /** * @author Greg Hinkle (gh...@us...), Apr 6, 2005 * @version $Revision: 1.1.2.1 $($Author: ghinkl $ / $Date: 2005/05/26 17:27:24 $) */ public class CompleteValueHistory implements ValueHistory { /** * Newer values are added at the end of the list. Oldest values first. */ protected List<Value> values = new LinkedList<Value>(); protected long historySize; public CompleteValueHistory() { this(-1); } public CompleteValueHistory(long historySize) { this.historySize = historySize; } public long getHistorySize() { return values.size(); } public void setMaximumHistorySize(long historySize) { this.historySize = historySize; } public List<Value> getValues() { return Collections.unmodifiableList(values); } public void addValue(Value value) { values.add(value); if (historySize > 0 && historySize < values.size()) { values.remove(0); } } } --- NEW FILE: ValueHistory.java --- package org.mc4j.ems.store; import java.util.List; /** * @author Greg Hinkle (gh...@us...), Apr 12, 2005 * @version $Revision: 1.1.2.1 $($Author: ghinkl $ / $Date: 2005/05/26 17:27:24 $) */ public interface ValueHistory { long getHistorySize(); List<Value> getValues(); void addValue(Value value); } --- NEW FILE: Value.java --- /* * Copyright 2002-2004 Greg Hinkle * * 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. */ package org.mc4j.ems.store; /** * @author Greg Hinkle (gh...@us...), Apr 12, 2005 * @version $Revision: 1.1.2.1 $($Author: ghinkl $ / $Date: 2005/05/26 17:27:24 $) */ public class Value { private Object value; private long recorded; public Value(Object value, long recorded) { this.value = value; this.recorded = recorded; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public long getRecorded() { return recorded; } public void setRecorded(long recorded) { this.recorded = recorded; } } |