1 17 package org.apache.geronimo.common; 18 19 24 public class UnresolvedEJBRefException extends DeploymentException { 25 private final String refName; 26 private final boolean local; 27 private final boolean session; 28 private final String homeInterface; 29 private final String beanInterface; 30 31 public UnresolvedEJBRefException(String refName, boolean local, boolean session, String homeInterface, 32 String beanInterface, boolean foundMultiple) { 33 super(createMessage(refName, local, session, homeInterface, beanInterface, foundMultiple)); 34 this.refName = refName; 35 this.local = local; 36 this.session = session; 37 this.homeInterface = homeInterface; 38 this.beanInterface = beanInterface; 39 } 40 41 public String getRefName() { 42 return refName; 43 } 44 45 public boolean isLocal() { 46 return local; 47 } 48 49 public boolean isSession() { 50 return session; 51 } 52 53 public String getHomeInterface() { 54 return homeInterface; 55 } 56 57 public String getBeanInterface() { 58 return beanInterface; 59 } 60 61 private static String createMessage(String refName, boolean local, boolean session, String homeInterface, 62 String beanInterface, boolean foundMultiple) { 63 StringBuffer msg = new StringBuffer (); 64 if (foundMultiple) { 65 msg.append("Two or more EJBs were found"); 66 } else { 67 msg.append("Could not find an EJB"); 68 } 69 msg.append(" for reference ").append(refName).append(" to a "); 70 msg.append((local ? "local " : "remote ")); 71 msg.append((session ? "session" : "entity")); 72 73 msg.append(" bean that has the home interface ").append(homeInterface); 74 msg.append(" and the ").append(local ? "local" : "remote"); 75 msg.append(" interface ").append(beanInterface); 76 77 return msg.toString(); 78 } 79 } 80 | Popular Tags |