1 25 26 package org.objectweb.perseus.concurrency.dbdelegate; 27 28 import org.objectweb.perseus.concurrency.api.ConcurrencyException; 29 import org.objectweb.perseus.concurrency.api.ConcurrencyManager; 30 import org.objectweb.fractal.api.control.BindingController; 31 import org.objectweb.fractal.api.control.IllegalBindingException; 32 import org.objectweb.fractal.api.control.LifeCycleController; 33 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 34 import org.objectweb.fractal.api.NoSuchInterfaceException; 35 import org.objectweb.util.monolog.api.Logger; 36 import org.objectweb.util.monolog.api.BasicLevel; 37 38 41 public abstract class DbDelegateConcurrencyManager 42 implements ConcurrencyManager, BindingController, LifeCycleController { 43 private String state = LifeCycleController.STOPPED; 44 45 protected Logger logger = null; 46 47 public DbDelegateConcurrencyManager() throws ConcurrencyException { 48 } 49 50 56 protected abstract Object getState(Object ctx, 57 Object resource, 58 Object thinLock) throws ConcurrencyException; 59 60 61 64 public String [] listFc() { 65 return new String [] {}; 66 } 67 68 public Object lookupFc(String s) throws NoSuchInterfaceException { 69 return null; 71 } 72 73 public void bindFc(String s, Object o) throws IllegalBindingException, 74 NoSuchInterfaceException { 75 try { 76 } catch (ClassCastException e) { 77 throw new IllegalBindingException(s + ":" + e.getMessage()); 78 } 79 } 81 82 public void unbindFc(String s) throws NoSuchInterfaceException { 83 } 85 86 public String getFcState() { 89 return state; 90 } 91 92 public void startFc() throws IllegalLifeCycleException { 93 if (state == LifeCycleController.STARTED) return; 94 state = LifeCycleController.STARTED; 95 } 96 97 public void stopFc() throws IllegalLifeCycleException { 98 if (state == LifeCycleController.STOPPED) return; 99 state = LifeCycleController.STOPPED; 100 } 101 102 105 public void begin(Object ctx) { 106 } 107 108 public boolean validate(Object ctx) { 109 return true; 110 } 111 112 public abstract void finalize(Object ctx); 113 114 public void abort(Object ctx) { 115 finalize(ctx); 116 } 117 118 public Object readIntention(Object ctx, Object resourceId, Object hints) 119 throws ConcurrencyException { 120 return getState(ctx, resourceId, hints); 121 } 122 123 public Object writeIntention(Object ctx, Object resourceId, Object hints) 124 throws ConcurrencyException { 125 return getState(ctx, resourceId, hints); 126 } 127 } 128 | Popular Tags |