public void init(final ServletContext context, final Map<String, String> paras) {
   _startTime = new Date();
   _context = context;
   _sipFactory = (SipFactory) context.getAttribute(ServletContextConstants.SIP_FACTORY);
   _mrcpFactory = (MrcpFactory) context.getAttribute(ServletContextConstants.MRCP_FACTORY);
   _appJarUrl =
       _context.getRealPath("/")
           + "WEB-INF"
           + File.separator
           + "lib"
           + File.separator
           + "tropo.jar";
   _cache = Collections.synchronizedMap(new WeakHashMap<Object, Application>());
   _tmx = ManagementFactory.getThreadMXBean();
   _mmx = ManagementFactory.getMemoryMXBean();
   try {
     _tropoBuildDate = Utils.getManifestAttribute(_appJarUrl, "Build-Date");
   } catch (final IOException t) {
     LOG.error(t.toString(), t);
     _tropoBuildDate = "Unknown";
   }
   try {
     _tropoVersionNo = Utils.getManifestAttribute(_appJarUrl, "Version-No");
   } catch (final IOException t) {
     LOG.error(t.toString(), t);
     _tropoVersionNo = "Unknown";
   }
   try {
     _tropoBuildNo = Utils.getManifestAttribute(_appJarUrl, "Build-No");
   } catch (final IOException t) {
     LOG.error(t.toString(), t);
     _tropoBuildNo = "Unknown";
   }
   LOG.info(toString() + " / " + getVersionNo() + " / " + getBuildNo());
 }
 public Application get(final URI uri) throws InvalidApplicationException, RedirectException {
   Application app = getCached(uri);
   if (LOG.isDebugEnabled()) {
     LOG.debug(
         toString() + " found app=" + app + " for url=" + uri + ",_cache.size=" + _cache.size());
   }
   if (app == null) {
     app = findApplication(uri);
     putCached(uri, app);
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           toString()
               + " cached app="
               + app
               + " for url="
               + uri
               + ",_cache.size="
               + _cache.size());
     }
   } else {
     Utils.setLogContext(app, null);
     LOG.info(app + " has been found.");
   }
   return app;
 }
Ejemplo n.º 3
0
 public ThriftApplication(final ThriftApplication shared, final String appId)
     throws AuthenticationException, SystemException, TException {
   super(shared.getManager(), shared.getURL(), "Thrift", shared.getAccountID(), appId, null);
   _contacts = shared.getContacts();
   _calls = new ConcurrentHashMap<String, Call>();
   _key = Utils.getGUID();
   _notifier = shared.getNotifier();
   setLogContext(null);
 }
Ejemplo n.º 4
0
 public ThriftApplication(
     final RemoteApplicationManager mgr,
     final ThriftURL url,
     final int aid,
     final String appId,
     final List<SipURI> contacts) {
   super(mgr, url, "Thrift", aid, appId, null);
   _contacts = contacts;
   _calls = new ConcurrentHashMap<String, Call>();
   _key = Utils.getGUID();
   setLogContext(null);
 }
 public Application get(final String token, final Properties params)
     throws InvalidApplicationException, RedirectException {
   Application app = getCached(token);
   if (LOG.isDebugEnabled()) {
     LOG.debug("Mgr Found app=" + app + " for token=" + token + ",_cache.size=" + _cache.size());
   }
   if (app == null) {
     app = findApplication(token, params);
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Mgr Cached app=" + app + " for token=" + token + ",_cache.size=" + _cache.size());
     }
   } else {
     Utils.setLogContext(app, null);
     LOG.info(app + " has been found.");
   }
   return app;
 }