String packageName = ((Class)annotatedElement).getPackage().getName();
String servletName = ((Class)annotatedElement).getSimpleName();
Servlet servlet = new Servlet();
servlet.setServletClass(servletClassName);
// ---- Set load on startup ---
SipServlet sipServlet = (SipServlet) ainfo.getAnnotation();
int loadOnStartUp = sipServlet.loadOnStartup();
servlet.setLoadOnStartup(loadOnStartUp);
// --- Set Servlet Name ---
// if the annotated Servlet Name is omitted, the the Class Name of the
// SipServlet is used as Servlet Name.
String annotatedServletName = sipServlet.name();
if ( "".equals(annotatedServletName) )
{
// Servlet Name not annotated
annotatedServletName = servletName;
}
servlet.setServletName(annotatedServletName);
servlet.setPackageName(packageName);
// --- Set Application Name ---
String annotatedAppliationName = sipServlet.applicationName();
servlet.setApplicationName(annotatedAppliationName);
// Since we are not guaranteed that SipApplication annotation is processed
// before SipServlet, we add the SipServlet to a temporary Map in the
// SipApplication structure.