1 39 package org.objectweb.jotm.jta.jeremie; 40 41 import org.objectweb.jonathan.apis.kernel.Context; 42 import org.objectweb.jonathan.apis.kernel.InternalException; 43 import org.objectweb.jonathan.apis.kernel.JonathanException; 44 import org.objectweb.jonathan.presentation.api.MarshallerFactory; 45 import org.objectweb.jonathan.libs.kernel.GenericFactory; 46 47 48 51 public class TSHandlerFactory extends GenericFactory { 52 53 56 static public final String ts_context_name = "/jotm/transaction/TSHandler"; 57 58 74 protected Object [] getUsedComponents(Context c) { 75 76 Object [] used_components = { 77 Context.NO_VALUE, Context.NO_VALUE, Context.NO_VALUE, Context.NO_VALUE 78 }; 79 80 if (c != null) { 81 used_components[0] = c.getValue("id", (char) 0); 82 used_components[1] = c.getValue("sender", (char) 0); 83 used_components[2] = c.getValue("receiver", (char) 0); 84 used_components[3] = c.getValue("MarshallerFactory", (char) 0); 85 } 86 if (! (used_components[0] instanceof Integer )) { 87 used_components[0] = new Integer (Integer.MAX_VALUE); 88 } 89 if (! (used_components[1] instanceof JotmTransactionSender)) { 90 used_components[1] = null; 91 } 92 if (! (used_components[2] instanceof JotmTransactionReceiver)) { 93 used_components[2] = null; 94 } 95 if (! (used_components[3] instanceof MarshallerFactory)) { 96 throw new InternalException("Component MarshallerFactory of type MarshallerFactory is required by TSHandler."); 97 } 98 99 return used_components; 100 } 101 102 111 protected Object newInstance(Context c, Object [] components) throws JonathanException { 112 return new TSHandler(c, components); 113 } 114 } 115 116 | Popular Tags |