KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > jmx > mbeans > Query


1 /**
2  * Speedo: an implementation of JDO compliant personality on top of JORM generic
3  * I/O sub-system.
4  * Copyright (C) 2001-2004 France Telecom R&D
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  *
21  *
22  * Contact: speedo@objectweb.org
23  *
24  * Authors: S.Chassande-Barrioz.
25  *
26  */

27 package org.objectweb.speedo.jmx.mbeans;
28
29 import java.util.Collection JavaDoc;
30
31 import org.objectweb.perseus.cache.api.CacheAttributeController;
32 import org.objectweb.perseus.cache.api.CacheException;
33 import org.objectweb.perseus.cache.api.CacheManager;
34 import org.objectweb.perseus.cache.api.UnbindManager;
35 import org.objectweb.speedo.query.api.QueryManagerAttribute;
36
37 /**
38  *
39  *
40  * @author S.Chassande-Barrioz
41  */

42 public class Query implements QueryMBean {
43
44     private QueryManagerAttribute qma;
45     private CacheAttributeController ca;
46     private UnbindManager um;
47     private CacheManager cm;
48
49     public Query(CacheAttributeController ca,
50             UnbindManager um,
51             CacheManager cm,
52            QueryManagerAttribute qma) {
53         this.ca = ca;
54         this.um = um;
55         this.cm = cm;
56         this.qma = qma;
57     }
58
59     public void evictAllCompiledQueriesFromCache() {
60         try {
61             um.unbindUnfixed(false);
62         } catch (CacheException e) {
63         }
64     }
65     
66     public String JavaDoc getCompiledQueryCache_AutoCleanSize() {
67         return ca.getAutoCleanSize();
68     }
69     public String JavaDoc getCompiledQueryCache_AutoCleanThreshold() {
70         return ca.getAutoCleanThreshold();
71     }
72     public Collection JavaDoc getCompiledQueryCache_ObjectIdentifiers() {
73         return ca.getCurrentEntryIdentifiers();
74     }
75     public int getCompiledQueryCache_CurrentSize() {
76         return ca.getCurrentSize();
77     }
78     public int getCompiledQueryCache_MaxObjects() {
79         return ca.getMaxObjects();
80     }
81     public void setCompiledQueryCache_AutoCleanSize(String JavaDoc size) {
82         ca.setAutoCleanSize(size);
83     }
84     public void setCompiledQueryCache_AutoCleanThreshold(String JavaDoc size) {
85         ca.setAutoCleanThreshold(size);
86     }
87     public void setCompiledQueryCache_MaxObjects(int size) throws IllegalArgumentException JavaDoc,
88             CacheException {
89         ca.setMaxObjects(size);
90     }
91
92     // IMPLEMENTS THE QueryManagerAttribute INTERFACE //
93
//------------------------------------------------//
94

95     public boolean getPrefetchActivatedOnExtent() {
96         return qma.getPrefetchActivatedOnExtent();
97     }
98     public boolean getPrefetchActivatedOnQuery() {
99         return qma.getPrefetchActivatedOnQuery();
100     }
101     public void setPrefetchActivatedOnExtent(boolean prefetch) {
102         qma.setPrefetchActivatedOnExtent(prefetch);
103     }
104     public void setPrefetchActivatedOnQuery(boolean prefetch) {
105         qma.setPrefetchActivatedOnQuery(prefetch);
106     }
107 }
108
Popular Tags