1 16 package org.apache.cocoon.acting; 17 18 import org.apache.avalon.framework.parameters.Parameters; 19 import org.apache.avalon.framework.thread.ThreadSafe; 20 import org.apache.cocoon.environment.Redirector; 21 import org.apache.cocoon.environment.SourceResolver; 22 import org.apache.excalibur.store.Store; 23 24 import java.util.Map ; 25 26 32 public class ClearPersistentStoreAction extends ServiceableAction implements ThreadSafe { 33 34 public Map act(Redirector redirector, 35 SourceResolver resolver, 36 Map objectModel, 37 String src, 38 Parameters par 39 ) throws Exception { 40 if ( this.manager.hasService( Store.PERSISTENT_STORE) ) { 41 final Store store_persistent = (Store)this.manager.lookup(Store.ROLE); 42 43 try { 44 store_persistent.clear(); 45 return EMPTY_MAP; 46 } catch (Exception ex) { 47 getLogger().debug("Exception while trying to Clearing the Store", ex); 48 return null; 49 } finally { 50 this.manager.release( store_persistent ); 51 } 52 } else { 53 getLogger().info("Unable to clear persistent store as no persistent store is configured."); 54 return null; 55 } 56 } 57 } 58 | Popular Tags |