org.mobicents.servlet.sip.annotations
Class DefaultSipInstanceManager

java.lang.Object
  extended by org.apache.catalina.core.DefaultInstanceManager
      extended by org.mobicents.servlet.sip.annotations.DefaultSipInstanceManager
All Implemented Interfaces:
org.apache.tomcat.InstanceManager, SipInstanceManager

public class DefaultSipInstanceManager
extends org.apache.catalina.core.DefaultInstanceManager
implements SipInstanceManager

An annotation processor which tries to inject resources found in the servlet context instead of the naming context of the servlet.

Author:
Vladimir Ralev

Field Summary
 
Fields inherited from class org.apache.catalina.core.DefaultInstanceManager
classLoader, containerClassLoader, ignoreAnnotations, privileged
 
Constructor Summary
DefaultSipInstanceManager(javax.naming.Context context, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> injectionMap, SipContext catalinaContext, java.lang.ClassLoader containerClassLoader)
           
 
Method Summary
 javax.naming.Context getContext()
           
 java.util.Map<java.lang.String,java.lang.String> getInjectionMap(java.lang.String name)
           
 SipContext getSipContext()
           
protected static void lookupFieldResource(javax.naming.Context context, java.lang.Object instance, java.lang.reflect.Field field, java.lang.String name)
          Inject resources in specified field.
protected  boolean lookupResourceInServletContext(java.lang.Object instance, java.lang.reflect.Field field, java.lang.String annotationName)
           
 void processAnnotations(java.lang.Object instance, java.util.Map<java.lang.String,java.lang.String> injections)
           
 void setContext(javax.naming.Context context)
           
 void setSipContext(SipContext sipContext)
           
 
Methods inherited from class org.apache.catalina.core.DefaultInstanceManager
destroyInstance, getName, loadClass, loadClassMaybePrivileged, lookupFieldResource, lookupMethodResource, newInstance, newInstance, newInstance, postConstruct, preDestroy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.tomcat.InstanceManager
destroyInstance, newInstance, newInstance, newInstance
 

Constructor Detail

DefaultSipInstanceManager

public DefaultSipInstanceManager(javax.naming.Context context,
                                 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> injectionMap,
                                 SipContext catalinaContext,
                                 java.lang.ClassLoader containerClassLoader)
Method Detail

processAnnotations

public void processAnnotations(java.lang.Object instance,
                               java.util.Map<java.lang.String,java.lang.String> injections)
                        throws java.lang.IllegalAccessException,
                               java.lang.reflect.InvocationTargetException,
                               javax.naming.NamingException
Specified by:
processAnnotations in interface SipInstanceManager
Overrides:
processAnnotations in class org.apache.catalina.core.DefaultInstanceManager
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
javax.naming.NamingException

lookupResourceInServletContext

protected boolean lookupResourceInServletContext(java.lang.Object instance,
                                                 java.lang.reflect.Field field,
                                                 java.lang.String annotationName)

lookupFieldResource

protected static void lookupFieldResource(javax.naming.Context context,
                                          java.lang.Object instance,
                                          java.lang.reflect.Field field,
                                          java.lang.String name)
                                   throws javax.naming.NamingException,
                                          java.lang.IllegalAccessException
Inject resources in specified field.

Throws:
javax.naming.NamingException
java.lang.IllegalAccessException

setSipContext

public void setSipContext(SipContext sipContext)
Parameters:
sipContext - the sipContext to set

getSipContext

public SipContext getSipContext()
Returns:
the sipContext

setContext

public void setContext(javax.naming.Context context)
Specified by:
setContext in interface SipInstanceManager
Parameters:
context - the context to set

getContext

public javax.naming.Context getContext()
Specified by:
getContext in interface SipInstanceManager
Returns:
the context

getInjectionMap

public java.util.Map<java.lang.String,java.lang.String> getInjectionMap(java.lang.String name)
Specified by:
getInjectionMap in interface SipInstanceManager


Copyright © 2010. All Rights Reserved.