1 16 17 package org.apache.jetspeed.services.statemanager; 19 20 import java.util.HashMap ; 22 import java.util.Map ; 23 import java.util.Collections ; 24 import java.util.Iterator ; 25 import java.util.Vector ; 26 import java.util.Set ; 27 28 import org.apache.jetspeed.services.statemanager.BaseStateManagerService; 29 30 43 public class JetspeedStateManagerService 44 extends BaseStateManagerService 45 { 46 48 private Map m_states = null; 49 50 53 protected void initStates() 54 { 55 m_states = Collections.synchronizedMap(new HashMap ()); 57 58 } 60 63 protected void shutdownStates() 64 { 65 m_states.clear(); 66 m_states = null; 67 68 } 70 75 protected Map getState( String key ) 76 { 77 return (Map ) m_states.get(key); 78 79 } 81 86 protected void addState( String key, Map state ) 87 { 88 m_states.put(key, state); 89 90 } 92 96 protected void removeState( String key ) 97 { 98 m_states.remove(key); 99 100 } 102 107 protected String [] getStateKeys( String start ) 108 { 109 Vector rv = new Vector (); 111 112 Set allStateKeys = m_states.keySet(); 114 synchronized (m_states) 115 { 116 Iterator i = allStateKeys.iterator(); 117 while (i.hasNext()) 118 { 119 String key = (String ) i.next(); 120 121 if (key.startsWith(start)) 123 { 124 rv.add(key); 125 } 126 } 127 } 128 129 if (rv.size() == 0) return null; 130 131 return (String []) rv.toArray(new String [rv.size()]); 132 133 } 135 } 137 142 143 | Popular Tags |