001: /**
002: * Speedo: an implementation of JDO compliant personality on top of JORM generic
003: * I/O sub-system.
004: * Copyright (C) 2001-2004 France Telecom R&D
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: *
021: *
022: * Contact: speedo@objectweb.org
023: *
024: * Authors: S.Chassande-Barrioz.
025: *
026: */package org.objectweb.speedo.jmx.mbeans;
027:
028: import java.util.Collection;
029:
030: import org.objectweb.perseus.cache.api.CacheAttributeController;
031: import org.objectweb.perseus.cache.api.CacheException;
032: import org.objectweb.perseus.cache.api.CacheManager;
033: import org.objectweb.perseus.cache.api.UnbindManager;
034: import org.objectweb.speedo.query.api.QueryManagerAttribute;
035:
036: /**
037: *
038: *
039: * @author S.Chassande-Barrioz
040: */
041: public class Query implements QueryMBean {
042:
043: private QueryManagerAttribute qma;
044: private CacheAttributeController ca;
045: private UnbindManager um;
046: private CacheManager cm;
047:
048: public Query(CacheAttributeController ca, UnbindManager um,
049: CacheManager cm, QueryManagerAttribute qma) {
050: this .ca = ca;
051: this .um = um;
052: this .cm = cm;
053: this .qma = qma;
054: }
055:
056: public void evictAllCompiledQueriesFromCache() {
057: try {
058: um.unbindUnfixed(false);
059: } catch (CacheException e) {
060: }
061: }
062:
063: public String getCompiledQueryCache_AutoCleanSize() {
064: return ca.getAutoCleanSize();
065: }
066:
067: public String getCompiledQueryCache_AutoCleanThreshold() {
068: return ca.getAutoCleanThreshold();
069: }
070:
071: public Collection getCompiledQueryCache_ObjectIdentifiers() {
072: return ca.getCurrentEntryIdentifiers();
073: }
074:
075: public int getCompiledQueryCache_CurrentSize() {
076: return ca.getCurrentSize();
077: }
078:
079: public int getCompiledQueryCache_MaxObjects() {
080: return ca.getMaxObjects();
081: }
082:
083: public void setCompiledQueryCache_AutoCleanSize(String size) {
084: ca.setAutoCleanSize(size);
085: }
086:
087: public void setCompiledQueryCache_AutoCleanThreshold(String size) {
088: ca.setAutoCleanThreshold(size);
089: }
090:
091: public void setCompiledQueryCache_MaxObjects(int size)
092: throws IllegalArgumentException, CacheException {
093: ca.setMaxObjects(size);
094: }
095:
096: // IMPLEMENTS THE QueryManagerAttribute INTERFACE //
097: //------------------------------------------------//
098:
099: public boolean getPrefetchActivatedOnExtent() {
100: return qma.getPrefetchActivatedOnExtent();
101: }
102:
103: public boolean getPrefetchActivatedOnQuery() {
104: return qma.getPrefetchActivatedOnQuery();
105: }
106:
107: public void setPrefetchActivatedOnExtent(boolean prefetch) {
108: qma.setPrefetchActivatedOnExtent(prefetch);
109: }
110:
111: public void setPrefetchActivatedOnQuery(boolean prefetch) {
112: qma.setPrefetchActivatedOnQuery(prefetch);
113: }
114: }
|