1 2 27 28 package org.netbeans.modules.websvc.api.jaxws.project.config; 29 30 34 public class HandlerChain { 35 private org.netbeans.modules.websvc.jaxwsmodel.handler_config1_0.HandlerChain chain; 36 37 public HandlerChain(org.netbeans.modules.websvc.jaxwsmodel.handler_config1_0.HandlerChain chain) { 38 this.chain=chain; 39 } 40 41 Object getOriginal() { 42 return chain; 43 } 44 45 public String getHandlerChainName() { 46 return chain.getHandlerChainName(); 47 } 48 49 public Handler[] getHandlers() { 50 org.netbeans.modules.websvc.jaxwsmodel.handler_config1_0.Handler[] handlers = chain.getHandler(); 51 Handler[] newHandlers = new Handler[handlers.length]; 52 for (int i=0;i<handlers.length;i++) { 53 newHandlers[i]=new Handler(handlers[i]); 54 } 55 return newHandlers; 56 } 57 58 public void setHandlerChainName(String value) { 59 chain.setHandlerChainName(value); 60 } 61 62 public Handler newHandler() { 63 org.netbeans.modules.websvc.jaxwsmodel.handler_config1_0.Handler handler = chain.newHandler(); 64 return new Handler(handler); 65 } 66 67 public void addHandler(String handlerName, String handlerClass) { 68 org.netbeans.modules.websvc.jaxwsmodel.handler_config1_0.Handler handler = chain.newHandler(); 69 handler.setHandlerName(handlerName); 70 handler.setHandlerClass(handlerClass); 71 chain.addHandler(handler); 72 } 73 74 public boolean removeHandler(String handlerNameOrClass) { 75 org.netbeans.modules.websvc.jaxwsmodel.handler_config1_0.Handler[] handlers = chain.getHandler(); 76 for (int i=0;i<handlers.length;i++) { 77 if (handlerNameOrClass.equals(handlers[i].getHandlerName()) || 78 handlerNameOrClass.equals(handlers[i].getHandlerClass())) { 79 chain.removeHandler(handlers[i]); 80 return true; 81 } 82 } 83 return false; 84 } 85 86 public Handler findHandlerByName(String handlerName) { 87 Handler[] handlers = getHandlers(); 88 for (int i=0;i<handlers.length;i++) { 89 if (handlerName.equals(handlers[i].getHandlerName())) return handlers[i]; 90 } 91 return null; 92 } 93 } 94 | Popular Tags |