Author: mgrigorov
Date: Thu Jun 16 08:40:55 2011
New Revision: 1136324

URL: http://svn.apache.org/viewvc?rev=1136324&view=rev
Log:
WICKET-3803 Add JMX MBean for the new StoreSettings


Added:
    
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettings.java
    
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettingsMBean.java
Modified:
    wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java

Modified: 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java?rev=1136324&r1=1136323&r2=1136324&view=diff
==============================================================================
--- 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java 
(original)
+++ 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/Initializer.java 
Thu Jun 16 08:40:55 2011
@@ -188,6 +188,8 @@ public class Initializer implements IIni
                                ":type=Application,name=SecuritySettings"));
                        register(new SessionSettings(application), new 
ObjectName(domain +
                                ":type=Application,name=SessionSettings"));
+                       register(new StoreSettings(application), new 
ObjectName(domain +
+                               ":type=Application,name=StoreSettings"));
 
                        RequestLogger sessionsBean = new 
RequestLogger(application);
                        ObjectName sessionsBeanName = new ObjectName(domain + 
":type=RequestLogger");

Added: 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettings.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettings.java?rev=1136324&view=auto
==============================================================================
--- 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettings.java 
(added)
+++ 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettings.java 
Thu Jun 16 08:40:55 2011
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.wicket.jmx;
+
+import java.io.File;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.util.lang.Bytes;
+
+/**
+ * Exposes Application's StoreSettings for JMX.
+ */
+public class StoreSettings implements StoreSettingsMBean
+{
+       private final Application application;
+
+       /**
+        * Construct.
+        * 
+        * @param application
+        */
+       public StoreSettings(final Application application)
+       {
+               this.application = application;
+       }
+
+       public int getFileChannelPoolCapacity()
+       {
+               return 
application.getStoreSettings().getFileChannelPoolCapacity();
+       }
+
+       public void setFileChannelPoolCapacity(int capacity)
+       {
+               
application.getStoreSettings().setFileChannelPoolCapacity(capacity);
+       }
+
+       public int getInmemoryCacheSize()
+       {
+               return application.getStoreSettings().getInmemoryCacheSize();
+       }
+
+       public void setInmemoryCacheSize(int inmemoryCacheSize)
+       {
+               
application.getStoreSettings().setInmemoryCacheSize(inmemoryCacheSize);
+       }
+
+       public long getMaxSizePerSession()
+       {
+               return 
application.getStoreSettings().getMaxSizePerSession().bytes();
+       }
+
+       public void setMaxSizePerSession(long maxSizePerSession)
+       {
+               Bytes bytes = Bytes.bytes(maxSizePerSession);
+               application.getStoreSettings().setMaxSizePerSession(bytes);
+       }
+
+       public String getFileStoreFolder()
+       {
+               return 
application.getStoreSettings().getFileStoreFolder().getAbsolutePath();
+       }
+
+       public void setFileStoreFolder(String fileStoreFolder)
+       {
+               File storeFolder = new File(fileStoreFolder);
+               application.getStoreSettings().setFileStoreFolder(storeFolder);
+       }
+
+}

Added: 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettingsMBean.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettingsMBean.java?rev=1136324&view=auto
==============================================================================
--- 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettingsMBean.java
 (added)
+++ 
wicket/trunk/wicket-jmx/src/main/java/org/apache/wicket/jmx/StoreSettingsMBean.java
 Thu Jun 16 08:40:55 2011
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.apache.wicket.jmx;
+
+import java.io.File;
+
+import org.apache.wicket.pageStore.DiskDataStore;
+
+/**
+ * JMX MBean for Application's StoreSettings
+ */
+public interface StoreSettingsMBean
+{
+
+       /**
+        * @return the maximum number of opened file channels by {@link 
DiskDataStore}.
+        */
+       int getFileChannelPoolCapacity();
+
+       /**
+        * Sets the number of maximum opened file channels by {@link 
DiskDataStore}
+        * 
+        * @param capacity
+        *            the new maximum number of opened file channels
+        */
+       void setFileChannelPoolCapacity(int capacity);
+
+       /**
+        * @return the number of page instances which will be stored in the 
http session for faster
+        *         retrieval
+        */
+       int getInmemoryCacheSize();
+
+       /**
+        * Sets the maximum number of page instances which will be stored in 
the http session for faster
+        * retrieval
+        * 
+        * @param inmemoryCacheSize
+        *            the maximum number of page instances which will be held 
in the http session
+        */
+       void setInmemoryCacheSize(int inmemoryCacheSize);
+
+       /**
+        * @return maximum page size. After this size is exceeded, the {@link 
DiskDataStore} will start
+        *         saving the pages at the beginning of file.
+        */
+       long getMaxSizePerSession();
+
+       /**
+        * Sets the maximum size of the {@link File} where page instances per 
session are stored. After
+        * reaching this size the {@link DiskDataStore} will start overriding 
the oldest pages at the
+        * beginning of the file.
+        * 
+        * @param maxSizePerSession
+        *            the maximum size of the file where page instances are 
stored per session. In
+        *            bytes.
+        */
+       void setMaxSizePerSession(long maxSizePerSession);
+
+       /**
+        * @return the location of the folder where {@link DiskDataStore} will 
store the files with page
+        *         instances per session
+        */
+       String getFileStoreFolder();
+
+       /**
+        * Sets the folder where {@link DiskDataStore} will store the files 
with page instances per
+        * session
+        * 
+        * @param fileStoreFolder
+        *            the new location
+        */
+       void setFileStoreFolder(String fileStoreFolder);
+}


Reply via email to