1 24 25 package org.objectweb.dream.exception; 26 27 import java.util.HashMap ; 28 import java.util.Map ; 29 30 import org.objectweb.dream.AbstractComponent; 31 import org.objectweb.dream.Push; 32 import org.objectweb.dream.PushException; 33 import org.objectweb.dream.message.Message; 34 import org.objectweb.fractal.api.NoSuchInterfaceException; 35 import org.objectweb.fractal.api.control.IllegalBindingException; 36 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 37 import org.objectweb.util.monolog.api.BasicLevel; 38 39 45 public class CatchPushExceptionImpl extends AbstractComponent implements Push 46 { 47 54 public static final String EXCEPTION_PUSH_ITF_NAME = "exception-push"; 55 protected Push outPushItf; 56 protected Push exceptionPushItf; 57 58 62 65 public void push(Message message, Map context) throws PushException 66 { 67 try 68 { 69 outPushItf.push(message, context); 70 } 71 catch (PushException e) 72 { 73 logger.log(BasicLevel.INFO, 74 "Catched Push Exception push message on exception-push. ", e); 75 if (context == null) 76 { 77 context = new HashMap (); 78 } 79 context.put("exception", e); 80 exceptionPushItf.push(message, context); 81 } 82 } 83 84 88 91 public String [] listFc() 92 { 93 return new String []{Push.OUT_PUSH_ITF_NAME, EXCEPTION_PUSH_ITF_NAME}; 94 } 95 96 100 public void bindFc(String clientItfName, Object serverItf) 101 throws NoSuchInterfaceException, IllegalBindingException, 102 IllegalLifeCycleException 103 { 104 super.bindFc(clientItfName, serverItf); 105 if (clientItfName.equals(Push.OUT_PUSH_ITF_NAME)) 106 { 107 outPushItf = (Push) serverItf; 108 } 109 else if (clientItfName.equals(EXCEPTION_PUSH_ITF_NAME)) 110 { 111 exceptionPushItf = (Push) serverItf; 112 } 113 } 114 } | Popular Tags |