View Javadoc

1   /*
2    *  File: JavaSystemInfoProvider.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Common Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/cpl-v10.html
10   */
11  package de.jaret.util.infoprovider;
12  
13  import java.util.ArrayList;
14  import java.util.Iterator;
15  import java.util.List;
16  import java.util.Properties;
17  
18  /**
19   * JaretSystemInfoProvider providing information about the java runtime.
20   * 
21   * @author Peter Kliem
22   * @version $Id: JavaSystemInfoProvider.java 242 2007-02-11 21:05:07Z olk $
23   */
24  public class JavaSystemInfoProvider implements JaretInfoProvider {
25  
26      /*
27       * (non-Javadoc)
28       * 
29       * @see de.jaret.app.JaretSystemInfoProvider#getInfoProviderName()
30       */
31      public String getInfoProviderName() {
32          return "Java Runtime environment";
33      }
34  
35      /*
36       * (non-Javadoc)
37       * 
38       * @see de.jaret.app.JaretSystemInfoProvider#getAccess()
39       */
40      public int getAccess() {
41          return SysInfoEntry.ACCESS_PUBLIC;
42      }
43  
44      /*
45       * (non-Javadoc)
46       * 
47       * @see de.jaret.app.JaretSystemInfoProvider#getSysInfoEntries()
48       */
49      public List<SysInfoEntry> getSysInfoEntries() {
50          List<SysInfoEntry> entries = new ArrayList<SysInfoEntry>();
51          Properties props = System.getProperties();
52          Iterator it = props.keySet().iterator();
53          while (it.hasNext()) {
54              String key = (String) it.next();
55              String val = props.getProperty(key);
56              entries.add(new SysInfoEntry(key, val));
57          }
58          return entries;
59      }
60  
61      /*
62       * (non-Javadoc)
63       * 
64       * @see de.jaret.app.JaretSystemInfoProvider#getSubInfoProviders()
65       */
66      public List<JaretInfoProvider> getSubInfoProviders() {
67          return null;
68      }
69  
70      /*
71       * (non-Javadoc)
72       * 
73       * @see de.jaret.app.JaretSystemInfoProvider#addSubInfoProvider(de.jaret.app.JaretSystemInfoProvider)
74       */
75      public void addSubInfoProvider(JaretInfoProvider infoProvider) {
76          throw new RuntimeException("Not implemented");
77      }
78  
79      public void remSubInfoProvider(JaretInfoProvider infoProvider) {
80      }
81  
82  }