Author: dspicar
Date: Fri Aug  5 11:54:21 2011
New Revision: 1154178

URL: http://svn.apache.org/viewvc?rev=1154178&view=rev
Log:
CLEREZZA-606: First version of CRIS monitoring tool. Collects data and displays 
it in a table. Allows to specify a threshold and an action taken when reaching 
the threshold (action consists of a HTTP GET request on a specified web 
resource).

Added:
    incubator/clerezza/issues/CLEREZZA-606/
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/   (with props)
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/LICENSE
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/NOTICE.txt
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/pom.xml
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/
    incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/CRISFileDescriptorMonitor.java
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/FileDescriptorCountTask.java
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/MONITORING.java
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/OSDetector.java
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/scripts/
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/scripts/someFile.txt
    
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/statistics.ssp

Propchange: incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Aug  5 11:54:21 2011
@@ -0,0 +1 @@
+target

Added: incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/LICENSE
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/LICENSE?rev=1154178&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/LICENSE (added)
+++ incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/LICENSE Fri Aug  
5 11:54:21 2011
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Added: incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/NOTICE.txt
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/NOTICE.txt?rev=1154178&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/NOTICE.txt 
(added)
+++ incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/NOTICE.txt Fri 
Aug  5 11:54:21 2011
@@ -0,0 +1,5 @@
+Apache Clerezza
+Copyright 2009-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).

Added: incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/pom.xml?rev=1154178&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/pom.xml (added)
+++ incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/pom.xml Fri Aug  
5 11:54:21 2011
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project 
xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+<!--
+
+ 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.
+
+-->
+
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <artifactId>parent</artifactId>
+               <groupId>org.apache.clerezza</groupId>
+               <version>0.2-incubating-SNAPSHOT</version>
+       </parent>
+       <groupId>org.apache.clerezza</groupId>
+       <artifactId>rdf.cris.monitoring</artifactId>
+       <packaging>bundle</packaging>
+       <version>0.1-incubating-SNAPSHOT</version>
+       <name>Clerezza - CRIS Monitoring Tool</name>
+       <description>
+               A Tool that monitors file descriptor usage of CRIS and of the 
platform.
+       </description>
+       <dependencies>
+               <dependency>
+                       <groupId>org.apache.felix</groupId>
+                       
<artifactId>org.apache.felix.scr.annotations</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.compendium</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>javax.ws.rs</groupId>
+                       <artifactId>jsr311-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>rdf.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       
<artifactId>platform.typerendering.scalaserverpages</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>platform.dashboard.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.clerezza</groupId>
+                       <artifactId>web.fileserver</artifactId>
+               </dependency>
+       </dependencies>
+</project>
+

Added: 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/CRISFileDescriptorMonitor.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/CRISFileDescriptorMonitor.java?rev=1154178&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/CRISFileDescriptorMonitor.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/CRISFileDescriptorMonitor.java
 Fri Aug  5 11:54:21 2011
@@ -0,0 +1,374 @@
+/*
+ * 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.clerezza.rdf.cris.monitoring;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Timer;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+import 
org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesService;
+import org.apache.clerezza.rdf.core.BNode;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.clerezza.rdf.core.TypedLiteral;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.cris.monitoring.OSDetector.OS;
+import org.apache.clerezza.rdf.ontologies.PLATFORM;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.utils.GraphNode;
+import org.apache.clerezza.rdf.utils.RdfList;
+import org.apache.clerezza.utils.osgi.BundlePathNode;
+import org.apache.clerezza.web.fileserver.FileServer;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.wymiwyg.commons.util.dirbrowser.PathNode;
+
+/**
+ * Monitors file descriptor usage by CRIS and offers a web resource displaying 
the data.
+ *
+ * @author daniel
+ */
+@Component(metatype=true)
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
+@Path("/admin/monitoring/cris")
+public class CRISFileDescriptorMonitor {
+       @Property(description="Interval between measurements in milliseconds 
(min. 1000 ms).", 
+                       intValue=10000)
+       public static final String PROBING_RATE = "probing_rate";
+       
+       @Property(description="The Bundle ID of the monitored bundle (must be 
positive).", intValue=-1)
+       public static final String BUNDLE_ID = "bundle_id";
+       
+       @Property(description="The relative (do the bundle's data folder) path 
to "
+                       + "the lucene index folder.", value="")
+       public static final String DIRECTORY_PATH = "index_path";
+       
+       @Property(description="How many datapoints are stored. (min. 10)", 
intValue=10000)
+       public static final String STORE_SIZE = "store_size";
+       
+       @Property(description="When to trigger the treshold action (in terms of 
open files of the platform). (min. 700)", intValue=1000)
+       public static final String ACTION_THRESHOLD = "action_threshold";
+       
+       @Property(description="A URL. When threshold is reached, a GET request 
is performed in that URL", value="")
+       public static final String THRESHOLD_URL = "threshold_url";
+       
+       @Property(description="How long to wait before performing threshold 
action after last time it has been performed (in minutes).", intValue=30)
+       public static final String THRESHOLD_TIMEOUT = "threshold_timeout";
+       
+       @Reference
+       private ScalaServerPagesService scalaServerPagesService;
+       
+       private int viewLimit = 100;
+       private int storeSize;
+       private int bundleId;
+       private int probingRate;
+       private long userFileDescriptorLimit = -1;
+       private String directory;
+       private String thresholdUrl = "";
+       private long threshold = -1l;
+       private int thresholdTimeout;
+       private Date lastThreshHoldAction = new Date(0l);
+       
+       private FileServer fileServer;
+       
+       List<long[]> crisData, jvmData; 
+       
+       private final Logger logger = LoggerFactory.getLogger(getClass());
+       private Timer timer = new Timer();
+       private FileDescriptorCountTask fileDescriptorCountTask = null;
+       private int lastIndex = -1;
+       
+       @GET
+       public GraphNode getStatistics() {
+               SimpleMGraph graph = new SimpleMGraph();
+               GraphNode statisticsPageNode = new GraphNode(new BNode(), 
graph);
+               statisticsPageNode.addProperty(RDF.type, PLATFORM.HeadedPage);
+               statisticsPageNode.addProperty(RDF.type, 
MONITORING.STATISTICS_PAGE);
+               
+               statisticsPageNode.addProperty(MONITORING.PROBINGRATE, 
+                               new 
PlainLiteralImpl(String.valueOf(probingRate)));
+               statisticsPageNode.addProperty(MONITORING.STORESIZE, 
+                               new 
PlainLiteralImpl(String.valueOf(storeSize)));
+               statisticsPageNode.addProperty(MONITORING.VIEWLIMIT, 
+                               new 
PlainLiteralImpl(String.valueOf(viewLimit)));
+               statisticsPageNode.addProperty(MONITORING.BUNDLE, 
+                               new PlainLiteralImpl(String.valueOf(bundleId)));
+               statisticsPageNode.addProperty(MONITORING.INDEXDIRECTORY, 
+                               new 
PlainLiteralImpl(String.valueOf(directory)));
+               statisticsPageNode.addProperty(MONITORING.OPENFILELIMIT, 
+                               new 
PlainLiteralImpl(String.valueOf(userFileDescriptorLimit)));
+               statisticsPageNode.addProperty(MONITORING.THRESHOLD, 
+                               new 
PlainLiteralImpl(String.valueOf(threshold)));
+               statisticsPageNode.addProperty(MONITORING.THRESHOLDURL, 
+                               new 
PlainLiteralImpl(String.valueOf(thresholdUrl)));
+               statisticsPageNode.addProperty(MONITORING.THRESHOLDTIMEOUT, 
+                               new 
PlainLiteralImpl(String.valueOf(thresholdTimeout)));
+               
+               GraphNode dataNode = new GraphNode(new BNode(), graph);
+               RdfList list = new RdfList(dataNode);
+               int index = lastIndex;
+               for (int i = 0; i < viewLimit; ++i) {
+                       if(index < 0) {
+                               index = storeSize - 1;
+                       }
+                       
+                       LiteralFactory lf = LiteralFactory.getInstance();
+                       GraphNode entryNode = new GraphNode(new BNode(), graph);
+                       long[] jvmEntry = jvmData.get(index);
+                       Date date = new Date(jvmEntry[0]);
+                       String timeString = "-";
+                       if(date.getTime() > 0l) {
+                               SimpleDateFormat df = new 
SimpleDateFormat("HH:mm:ss dd.MM.yyyy");
+                               timeString = df.format(date);
+                       }
+                       TypedLiteral timestamp = 
lf.createTypedLiteral(timeString);
+                       TypedLiteral jvm = lf.createTypedLiteral(jvmEntry[1]);
+                       TypedLiteral cris = 
lf.createTypedLiteral(crisData.get(index)[1]);
+                       entryNode.addProperty(MONITORING.TIMESTAMP, timestamp);
+                       entryNode.addProperty(MONITORING.JVMDATA, jvm);
+                       entryNode.addProperty(MONITORING.CRISDATA, cris);
+                       
+                       list.add(entryNode.getNode());
+                       
+                       --index;
+               }
+               
+               statisticsPageNode.addProperty(MONITORING.DATA, 
dataNode.getNode());
+               
+               return statisticsPageNode;
+       } 
+       
+       /**
+        * Returns a PathNode of a static file from the staticweb folder.
+        * 
+        * @return {@link PathNode}
+        */
+       @GET
+       @Path("{path:.+}")
+       public PathNode getStaticFile(@PathParam("path") String path) {
+               final PathNode node = fileServer.getNode(path);
+               return node;
+       }
+       
+       protected void activate(ComponentContext context) throws IOException {
+               OSDetector.OS os = OSDetector.getOS();
+               logger.info("{} activated. Detected OS: {}", 
getClass().getSimpleName(), os);
+               if(os == OS.UNSUPPORTED) {
+                       logger.warn("Can not start CRIS Monitoring 
Tool:\nUnsupported Operating System.");
+               } else {
+                       
+                       long pid = -1l;
+                       try {
+                               pid = getPID();
+                               bundleId = getIntegerValue(context, BUNDLE_ID, 
0, Integer.MAX_VALUE);
+                               directory = getStringValue(context, 
DIRECTORY_PATH);
+                               getUserFileDescriptorLimit();
+                               probingRate = getIntegerValue(context, 
PROBING_RATE, 1000, Integer.MAX_VALUE);
+                               storeSize = getIntegerValue(context, 
STORE_SIZE, 10, Integer.MAX_VALUE);
+                               threshold = getIntegerValue(context, 
ACTION_THRESHOLD, 700, Integer.MAX_VALUE);
+                               thresholdTimeout = getIntegerValue(context, 
THRESHOLD_TIMEOUT, 0, Integer.MAX_VALUE);
+                               thresholdUrl = (String) 
context.getProperties().get(THRESHOLD_URL);
+                               thresholdUrl = thresholdUrl.trim();
+                       
+                               logger.info("Starting monitoring thread for PID 
{}, bundle ID {} and directory {}.", 
+                                               new Object[]{pid, bundleId, 
directory});
+                       
+                       } catch (Exception ex) {
+                               logger.warn("Can not start CRIS Monitoring 
Tool:\n{}", ex.getMessage());
+                               return;
+                       }
+                       
+                       BundleContext bundleContext = 
context.getBundleContext();
+                       
+                       Bundle bundle = bundleContext.getBundle();
+                       URL resourceDir = getClass().getResource("staticweb");
+                       PathNode pathNode = new BundlePathNode(bundle, 
resourceDir.getPath());
+                       fileServer = new FileServer(pathNode);
+                       
+                       crisData = new ArrayList<long[]>(storeSize);
+                       jvmData = new ArrayList<long[]>(storeSize);
+                       initStore(crisData);
+                       initStore(jvmData);
+                       
+                       if(fileDescriptorCountTask == null) {
+                               fileDescriptorCountTask = 
+                                               new 
FileDescriptorCountTask(pid, bundleId, directory, this);
+                       }
+                       
+                       if (timer != null) {
+                               timer.cancel();
+                       }
+                       timer = new Timer();
+                       timer.scheduleAtFixedRate(fileDescriptorCountTask, 0l, 
probingRate);
+                       
+                       URL template = getClass().getResource("statistics.ssp");
+                       
scalaServerPagesService.registerScalaServerPage(template, 
+                                       MONITORING.STATISTICS_PAGE, "naked", 
MediaType.APPLICATION_XHTML_XML_TYPE);
+               }
+       }
+
+       protected void deactivate(ComponentContext context) {
+               if(timer != null) {
+                       logger.info("Stopping monitoring thread.");
+                       timer.cancel();
+                       timer = null;
+               }
+       }
+       
+       synchronized void addCRISEntry(long time, long data) {
+               long[] entry = new long[2];
+               entry[0] = time;
+               entry[1] = data;
+               int index = lastIndex + 1;
+               if(index >= storeSize) {
+                       index = 0;
+               }
+               crisData.set(index, entry);
+               lastIndex = index;
+       }
+       
+       synchronized void addJVMentry(long time, long data) {
+               long[] entry = new long[2];
+               entry[0] = time;
+               entry[1] = data;
+               int index = lastIndex;
+               if(index >= storeSize) {
+                       index = 0;
+               }
+               jvmData.set(index, entry);
+               
+               if(data >= threshold) {
+                       performAction();
+               }
+       }
+       
+       synchronized void performAction() {
+               if(thresholdUrl == null || thresholdUrl.equals("")) {
+                       logger.info("Will not perform threshold action because 
no threshold URL is set.");
+                       return;
+               }
+               Date now = new Date();
+               if(lastThreshHoldAction.getTime() + thresholdTimeout*60*1000 < 
now.getTime()) {
+                       try {
+                               logger.info("Performing threshold action...");
+                               URL url = new URL(thresholdUrl);
+                               URLConnection conn = url.openConnection();
+                               BufferedReader rd = new BufferedReader(
+                                               new 
InputStreamReader(conn.getInputStream()));
+                               StringBuilder sb = new StringBuilder();
+                               String line;
+                               while ((line = rd.readLine()) != null) {
+                                       sb.append(line);
+                               }
+                               rd.close();
+                               String result = sb.toString();
+                               logger.info("RESPONSE: {}", result);
+                               lastThreshHoldAction = now;
+                       } catch (IOException ex) {
+                               logger.warn("Could not perform threshold 
action.", ex);
+                       }
+               } else {
+                       logger.info("Too little time passed since last 
threshold action. Skipping.");
+               }
+       }
+       
+       private long getPID() throws IOException, NumberFormatException {
+               long pid = -1l;
+               try {
+                       String[] cmd = {"bash", "-c", "echo $PPID"};
+                       Process p = Runtime.getRuntime().exec(cmd);
+                       byte[] output = new byte[32];
+                       p.getInputStream().read(output);
+                       p.destroy();
+                       pid = Long.parseLong(new String(output).trim());
+               } catch (IOException ex) {
+                       logger.warn("Could not retrieve PID.");
+                       throw ex;
+               } catch (NumberFormatException ex) {
+                       logger.warn("Could not retrieve PID.");
+                       throw ex;
+               }
+               return pid;
+       }
+
+       private void getUserFileDescriptorLimit() {
+               userFileDescriptorLimit = -1l;
+               try {
+                       String[] cmd = {"bash", "-c", "ulimit -Hn"};
+                       Process p = Runtime.getRuntime().exec(cmd);
+                       byte[] output = new byte[32];
+                       p.getInputStream().read(output);
+                       p.destroy();
+                       userFileDescriptorLimit = Long.parseLong(new 
String(output).trim());
+               } catch (IOException ex) {
+                       logger.warn("Could not retrieve user open file limit.");
+               } catch (NumberFormatException ex) {
+                       logger.warn("Could not retrieve user open file limit.");
+               }
+       }
+       
+       private void initStore(List<long[]> store) {
+               for(int i = 0; i < storeSize; ++i) {
+                       long[] entry = new long[2];
+                       entry[0] = -1l;
+                       entry[1] = -1l;
+                       store.add(entry);
+               }
+       }
+       
+       private String getStringValue(ComponentContext context, String 
property) {
+               String tmp = (String) context.getProperties().get(property);
+               tmp = tmp.trim();
+               if(tmp == null || tmp.equals("")) {
+                       throw new IllegalArgumentException("Invalid value for " 
+ 
+                                       property + ". Check the component 
configuration.");
+               }
+               
+               return tmp;
+       }
+       
+       private int getIntegerValue(ComponentContext context, String property, 
+                       int lowerBound, int upperBound) {
+               Integer tmp = (Integer) context.getProperties().get(property);
+               if(tmp == null || tmp < lowerBound || tmp > upperBound) {
+                       throw new IllegalArgumentException("Invalid value for " 
+ 
+                                       property + ". Check the component 
configuration.");
+               }
+               
+               return tmp;
+       }
+}
\ No newline at end of file

Added: 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/FileDescriptorCountTask.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/FileDescriptorCountTask.java?rev=1154178&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/FileDescriptorCountTask.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/FileDescriptorCountTask.java
 Fri Aug  5 11:54:21 2011
@@ -0,0 +1,111 @@
+/*
+ * 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.clerezza.rdf.cris.monitoring;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.TimerTask;
+
+/**
+ * Counts file descriptors used by this JVM instance in total and 
+ * file descriptors used for CRIS by a specified bundle.
+ *
+ * @author daniel
+ */
+class FileDescriptorCountTask extends TimerTask {
+       long crisFiles = -1;
+       long totalFDs = -1;
+       
+       long pid = -1;
+       int bundleId = -1;
+       String directory = null;
+       String[] crisOpenFilesCountCommand, jvmOpenFileDescriptorsCountCommand;
+       private CRISFileDescriptorMonitor monitorInstance;
+       
+       public FileDescriptorCountTask(long pid, int bundleId, String 
directory, 
+                       CRISFileDescriptorMonitor monitorInstance) {
+               this.pid = pid;
+               this.bundleId = bundleId;
+               this.directory = directory;
+               this.monitorInstance = monitorInstance;
+               
+               String pidString = String.valueOf(pid);
+               
+               StringBuilder subCommand = new StringBuilder("ls -l /proc/");
+               subCommand.append(pidString);
+               subCommand.append("/fd");
+               subCommand.append(" | grep ");
+               subCommand.append(System.getProperty("user.dir"));
+               subCommand.append("/felix-cache/bundle");
+               subCommand.append(String.valueOf(bundleId));
+               subCommand.append("/data/");
+               subCommand.append(directory);
+               subCommand.append(" | wc -l");
+//             StringBuilder subCommand = new StringBuilder("lsof -a -p");
+//             subCommand.append(pidString);
+//             subCommand.append(" +d ");
+//             subCommand.append(System.getProperty("user.dir"));
+//             subCommand.append("/felix-cache/bundle");
+//             subCommand.append(String.valueOf(bundleId));
+//             subCommand.append("/data/");
+//             subCommand.append(directory);
+//             subCommand.append(" | wc -l");
+               crisOpenFilesCountCommand = 
+                               new String[] {"bash", "-c", 
subCommand.toString()};
+               
+               subCommand = new StringBuilder("ls -l /proc/");
+               subCommand.append(pidString);
+               subCommand.append("/fd");
+               subCommand.append(" | wc -l");
+               jvmOpenFileDescriptorsCountCommand = 
+                               new String[] {"bash", "-c", 
subCommand.toString()};
+       }
+
+       @Override
+       public void run() {
+               try {
+                       Thread.currentThread().setName("CRIS File Descriptor 
Count Thread [" 
+                                       + Thread.currentThread().getId() + "]");
+                       
+                       long time = new Date().getTime(); 
+                       
+                       Process p = 
Runtime.getRuntime().exec(crisOpenFilesCountCommand);
+                       byte[] output = new byte[32];
+                       p.getInputStream().read(output);
+                       p.destroy();
+//                     crisFiles = Integer.parseInt(new String(output).trim()) 
- 1;
+                       crisFiles = Integer.parseInt(new String(output).trim());
+                       
+                       monitorInstance.addCRISEntry(time, crisFiles);
+                       
+                       p = 
Runtime.getRuntime().exec(jvmOpenFileDescriptorsCountCommand);
+                       output = new byte[32];
+                       p.getInputStream().read(output);
+                       p.destroy();
+                       totalFDs = Integer.parseInt(new String(output).trim());
+                       
+                       monitorInstance.addJVMentry(time, totalFDs);
+                       
+//                     System.out.println("CRIS: " + crisFiles);
+//                     System.out.println("Total: " + totalFDs);
+               } catch (IOException ex) {
+                       throw new RuntimeException(ex);
+               }
+       }
+}

Added: 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/MONITORING.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/MONITORING.java?rev=1154178&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/MONITORING.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/MONITORING.java
 Fri Aug  5 11:54:21 2011
@@ -0,0 +1,70 @@
+/*
+ * 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.clerezza.rdf.cris.monitoring;
+
+import org.apache.clerezza.rdf.core.UriRef;
+
+/**
+ * Monitoring ontology.
+ *
+ * @author daniel
+ */
+public class MONITORING {
+       public static final UriRef STATISTICS_PAGE = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#statisticsPage";);
+       
+       public static final UriRef DATA = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#data";);
+       
+       public static final UriRef TIMESTAMP = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#timestamp";);
+       
+       public static final UriRef CRISDATA = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#cris";);
+       
+       public static final UriRef JVMDATA = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#jvm";);
+       
+       public static final UriRef BUNDLE = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#bundle";);
+       
+       public static final UriRef PROBINGRATE = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#probingrate";);
+       
+       public static final UriRef STORESIZE = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#storesize";);
+       
+       public static final UriRef VIEWLIMIT = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#viewlimit";);
+       
+       public static final UriRef OPENFILELIMIT = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#openfilelimit";);
+       
+       public static final UriRef THRESHOLD = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#threshold";);
+       
+       public static final UriRef THRESHOLDURL = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#thresholdurl";);
+       
+       public static final UriRef INDEXDIRECTORY = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#indexdirectory";);
+       
+       public static final UriRef THRESHOLDTIMEOUT = 
+                       new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#thresholdtimeout";);
+}

Added: 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/OSDetector.java
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/OSDetector.java?rev=1154178&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/OSDetector.java
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/java/org/apache/clerezza/rdf/cris/monitoring/OSDetector.java
 Fri Aug  5 11:54:21 2011
@@ -0,0 +1,45 @@
+/*
+ * 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.clerezza.rdf.cris.monitoring;
+
+/**
+ * Utility class to help detect the operating system.
+ *
+ * @author daniel
+ */
+class OSDetector {
+       private static final String OS_NAME = "os.name";
+       private static final String OS_VERSION = "os.version";
+       private static final String OS_ARCHITECTURE = "os.arch";
+       
+       static enum OS {
+               LINUX,
+               UNSUPPORTED
+       }
+       
+       public static OS getOS() {
+               String os = System.getProperty(OS_NAME).toLowerCase();
+               
+               if(os.contains("linux")) {
+                       return OS.LINUX;
+               } else {
+                       return OS.UNSUPPORTED;
+               }
+       }
+}

Added: 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/scripts/someFile.txt
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/scripts/someFile.txt?rev=1154178&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/scripts/someFile.txt
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/staticweb/scripts/someFile.txt
 Fri Aug  5 11:54:21 2011
@@ -0,0 +1 @@
+without this file the bundle can not be correctly deployed, this is a 
placeholder for javascript files that will come here later.
\ No newline at end of file

Added: 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/statistics.ssp
URL: 
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/statistics.ssp?rev=1154178&view=auto
==============================================================================
--- 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/statistics.ssp
 (added)
+++ 
incubator/clerezza/issues/CLEREZZA-606/rdf.cris.monitoring/src/main/resources/org/apache/clerezza/rdf/cris/monitoring/statistics.ssp
 Fri Aug  5 11:54:21 2011
@@ -0,0 +1,54 @@
+import java.util.Date
+
+def monitoring(s: Any) = new 
UriRef("http://org.apache.clerezza/2011/07/monitoring#"+s)
+
+resultDocModifier.setTitle("CRIS Monitoring Statistics");
+resultDocModifier.addNodes2Elem("tx-module", <h1>CRIS Monitoring 
Statistics</h1>);
+
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol",
+<li class="tx-active">
+       <a href="#">Statistics</a>
+</li>);
+
+resultDocModifier.addNodes2Elem("tx-module-options-ol",
+       <li><a href="#" class="tx-icon tx-toggle-list-on">List</a></li>);
+
+<div id="tx-content">
+       <div class="tx-tree">
+               <div id="tx-list">
+               </div>
+       </div>
+       <div>
+               <ul>
+                       <li>Monitored Bundle ID: 
{(res/monitoring("bundle"))*}</li>
+                       <li>Probing Rate: {(res/monitoring("probingrate"))*} 
ms</li>
+                       <li>Index Directory: 
{(res/monitoring("indexdirectory"))*}</li>
+                       <li>Store Size: {(res/monitoring("storesize"))*}</li>
+                       <li>View Limit: {(res/monitoring("viewlimit"))*}</li>
+                       <li>Open File Limit: 
{(res/monitoring("openfilelimit"))*}</li>
+                       <li>Threshold: {(res/monitoring("threshold"))*}</li>
+                       <li>Threshold Action URL: 
{(res/monitoring("thresholdurl"))*}</li>
+                       <li>Threshold Action Timeout: 
{(res/monitoring("thresholdtimeout"))*} min</li>
+               </ul>
+       </div>
+       <table>
+               <caption>Number of open files</caption>
+               <tr><th>Time</th><th>CRIS</th><th>Platform</th></tr>
+               {
+                       val list = res/monitoring("data");
+                       for(entry <- list!!) yield {
+                               <tr>
+                                       
<td>{(entry/monitoring("timestamp"))*}</td>
+                                       <td>{(entry/monitoring("cris"))*}</td>
+                                       <td>{(entry/monitoring("jvm"))*}</td>
+                               </tr>
+                       }
+               }
+       </table>
+</div>
+
+<div class="tx-window">
+       <div class="hd"></div>
+       <div class="bd"></div>
+       <div class="ft"></div>
+</div>
\ No newline at end of file


Reply via email to