001 package com.khubla.pragmatach.plugin.adminapp; 002 003 import java.util.Enumeration; 004 import java.util.Hashtable; 005 import java.util.Properties; 006 007 import com.khubla.pragmatach.framework.annotation.Controller; 008 import com.khubla.pragmatach.framework.annotation.Route; 009 import com.khubla.pragmatach.framework.annotation.View; 010 import com.khubla.pragmatach.framework.api.PragmatachException; 011 import com.khubla.pragmatach.framework.api.Response; 012 013 /** 014 * @author tome 015 */ 016 @Controller(name = "pragmatachShowJVMController") 017 @View(view = "pragmatach/admin/jvm.html") 018 public class ShowJVMController extends SecuredAdminController { 019 /** 020 * java properties 021 */ 022 private Hashtable<String, String> javaProperties; 023 024 private Hashtable<String, String> findJavaProperties() throws PragmatachException { 025 try { 026 final Hashtable<String, String> ret = new Hashtable<String, String>(); 027 final Properties props = System.getProperties(); 028 final Enumeration<Object> enumer = props.keys(); 029 while (enumer.hasMoreElements()) { 030 final String key = (String) enumer.nextElement(); 031 ret.put(key, props.getProperty(key)); 032 } 033 return ret; 034 } catch (final Exception e) { 035 throw new PragmatachException("Exception in findJavaProperties", e); 036 } 037 } 038 039 public Hashtable<String, String> getJavaProperties() { 040 return javaProperties; 041 } 042 043 @Route(uri = "/pragmatach/admin/jvm") 044 public Response render() throws PragmatachException { 045 javaProperties = findJavaProperties(); 046 return super.render(); 047 } 048 049 public void setJavaProperties(Hashtable<String, String> javaProperties) { 050 this.javaProperties = javaProperties; 051 } 052 }