1 23 package com.sun.ejb.codegen; 24 25 import java.io.File ; 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 28 34 public class GeneratedNames { 35 36 42 public GeneratedNames(EjbDescriptor desc) { 43 45 ejbObjectImplClass = 47 desc.getEJBObjectImplClassName().replace('.', 48 File.separatorChar) + ".class"; 49 50 homeImplClass = 52 desc.getRemoteHomeImplClassName().replace('.', 53 File.separatorChar) + ".class"; 54 55 homeStubClass = 57 getStubName(desc.getHomeClassName()).replace('.', 58 File.separatorChar) + ".class"; 59 remoteStubClass = 60 getStubName(desc.getRemoteClassName()).replace('.', 61 File.separatorChar) + ".class"; 62 } 63 64 69 public static String getStubName(String fullName) { 70 71 String className = fullName; 72 String packageName = ""; 73 74 int lastDot = fullName.lastIndexOf('.'); 75 if (lastDot != -1) { 76 className = fullName.substring(lastDot+1, fullName.length()); 77 packageName = fullName.substring(0, lastDot+1); 78 } 79 80 String stubName = packageName + "_" + className + "_Stub"; 81 82 if(isSpecialPackage(fullName)) 83 stubName = ORG_OMG_STUB_PREFIX + stubName; 84 85 return stubName; 86 } 87 88 public String getEjbObjectImplClass() { 89 return ejbObjectImplClass; 90 } 91 92 public String getHomeImplClass() { 93 return homeImplClass; 94 } 95 96 public String getHomeStubClass() { 97 return homeStubClass; 98 } 99 100 public String getRemoteStubClass() { 101 return remoteStubClass; 102 } 103 104 private static boolean isSpecialPackage(String name) 105 { 106 110 if(name == null) 113 return false; 114 115 if(name.startsWith("javax.")) 118 return true; 119 120 return false; 121 } 122 123 private String homeImplClass; 125 private String homeStubClass; 126 private String remoteStubClass; 127 private String ejbObjectImplClass; 128 129 private static final String ORG_OMG_STUB_PREFIX = "org.omg.stub."; 130 } 131 | Popular Tags |