1 22 23 24 package com.mchange.v2.c3p0.management; 25 26 import java.util.*; 27 import java.sql.SQLException ; 28 import com.mchange.v2.c3p0.C3P0Registry; 29 import com.mchange.v2.c3p0.subst.C3P0Substitutions; 30 31 public class C3P0RegistryManager implements C3P0RegistryManagerMBean 32 { 33 public String [] getAllIdentityTokens() 34 { 35 Set tokens = C3P0Registry.allIdentityTokens(); 36 return (String []) tokens.toArray( new String [ tokens.size() ] ); 37 } 38 39 public Set getAllIdentityTokenized() 40 { return C3P0Registry.allIdentityTokenized(); } 41 42 public Set getAllPooledDataSources() 43 { return C3P0Registry.allPooledDataSources(); } 44 45 public int getAllIdentityTokenCount() 46 { return C3P0Registry.allIdentityTokens().size(); } 47 48 public int getAllIdentityTokenizedCount() 49 { return C3P0Registry.allIdentityTokenized().size(); } 50 51 public int getAllPooledDataSourcesCount() 52 { return C3P0Registry.allPooledDataSources().size(); } 53 54 public String [] getAllIdentityTokenizedStringified() 55 { return stringifySet( C3P0Registry.allIdentityTokenized() ); } 56 57 public String [] getAllPooledDataSourcesStringified() 58 { return stringifySet( C3P0Registry.allPooledDataSources() ); } 59 60 public int getNumPooledDataSources() throws SQLException 61 { return C3P0Registry.getNumPooledDataSources(); } 62 63 public int getNumPoolsAllDataSources() throws SQLException 64 { return C3P0Registry.getNumPoolsAllDataSources(); } 65 66 public String getC3p0Version() 67 { return C3P0Substitutions.VERSION ; } 68 69 private String [] stringifySet(Set s) 70 { 71 String [] out = new String [ s.size() ]; 72 int i = 0; 73 for (Iterator ii = s.iterator(); ii.hasNext(); ) 74 out[i++] = ii.next().toString(); 75 return out; 76 } 77 } | Popular Tags |