FileDocCategorySizeDatePackage
GeneratedNames.javaAPI DocGlassfish v2 API5061Fri May 04 22:32:58 BST 2007com.sun.ejb.codegen

GeneratedNames

public class GeneratedNames extends Object
Helper class for ejbc generated class names.
author
Nazrul Islam
since
JDK 1.4

Fields Summary
private String
homeImplClass
private String
homeStubClass
private String
remoteStubClass
private String
ejbObjectImplClass
private static final String
ORG_OMG_STUB_PREFIX
Constructors Summary
public GeneratedNames(com.sun.enterprise.deployment.EjbDescriptor desc)
Initializes the generated names based on the given deployment descriptor.

param
desc deployment descriptor

        // Set the file names for generated Home/Remote impl/tie/stubs

        // set EJBOBject Impl 
        ejbObjectImplClass = 
            desc.getEJBObjectImplClassName().replace('.", 
                                File.separatorChar) + ".class";
       
        // set EJBHome Impl 
        homeImplClass = 
            desc.getRemoteHomeImplClassName().replace('.", 
                                    File.separatorChar) + ".class";

        // Set EJBHome/EJBObject stub filenames
        homeStubClass = 
            getStubName(desc.getHomeClassName()).replace('.", 
                                    File.separatorChar) + ".class";
        remoteStubClass = 
            getStubName(desc.getRemoteClassName()).replace('.", 
                                    File.separatorChar) + ".class"; 
    
Methods Summary
public java.lang.StringgetEjbObjectImplClass()

        return ejbObjectImplClass;
    
public java.lang.StringgetHomeImplClass()

        return homeImplClass;
    
public java.lang.StringgetHomeStubClass()

        return homeStubClass;
    
public java.lang.StringgetRemoteStubClass()

        return remoteStubClass;
    
public static java.lang.StringgetStubName(java.lang.String fullName)
Returns the stub classname for the given interface name

param
fullName fully qualified name of the ejb home and obj impl


        String className = fullName;
        String packageName = "";

        int lastDot = fullName.lastIndexOf('.");
        if (lastDot != -1) {
            className   = fullName.substring(lastDot+1, fullName.length());
            packageName = fullName.substring(0, lastDot+1);
        }

        String stubName = packageName + "_" + className + "_Stub";

		if(isSpecialPackage(fullName))
            stubName = ORG_OMG_STUB_PREFIX + stubName;

        return stubName;
    
private static booleanisSpecialPackage(java.lang.String name)

		// these package names are magic.  RMIC puts any home/remote stubs
		// into a different directory in these cases.
		// 4845896  bnevins, April 2003
		
		// this is really an error.  But we have enough errors. Let's be forgiving
		// and not allow a NPE out of here...
		if(name == null)	
			return false;
		
		// Licensee bug 4959550 
		// if(name.startsWith("com.sun.") || name.startsWith("javax."))
		if(name.startsWith("javax."))
			return true;
		
		return false;