public boolean getInvalidateWhenReady() { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } return invalidateWhenReady; }
public boolean isReadyToInvalidate() { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } return readyToInvalidate; }
public State getState() { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } return this.state; }
public void setInvalidateWhenReady(boolean arg0) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } invalidateWhenReady = arg0; }
/** * {@inheritDoc} */ public SipApplicationRoutingRegion getRegion() { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(routingRegion == null) { throw new IllegalStateException("This methos can be called only on initial requests"); } return routingRegion; }
public Object getAttribute(String name) { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } return getAttributeMap().get(name); }
public Enumeration<String> getAttributeNames() { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } Vector<String> names = new Vector<String>(getAttributeMap().keySet()); return names.elements(); }
/** * {@inheritDoc} */ public URI getSubscriberURI() { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if (this.subscriberURI == null) throw new IllegalStateException("Subscriber URI is only available for outbound sessions."); else { try { return sipFactory.createURI(subscriberURI); } catch (ServletParseException e) { throw new IllegalArgumentException("couldn't parse the outbound interface " + subscriberURI, e); } } }
/** * This method is called immediately when the conditions for read to invalidate * session are met */ public void onReadyToInvalidate() { this.setReadyToInvalidate(true); if(logger.isDebugEnabled()) { logger.debug("invalidateWhenReady flag is set to " + invalidateWhenReady); } if(isValid() && this.invalidateWhenReady) { this.notifySipSessionListeners(SipSessionEventType.READYTOINVALIDATE); //If the application does not explicitly invalidate the session in the callback or has not defined a listener, //the container will invalidate the session. if(isValid()) { invalidate(true); } } }
public void setOutboundInterface(InetSocketAddress inetSocketAddress) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(inetSocketAddress == null) { throw new NullPointerException("parameter is null"); } String address = inetSocketAddress.getAddress().getHostAddress() + ":" + inetSocketAddress.getPort(); List<SipURI> list = sipFactory.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.toString().contains(address)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + address + " not found"); try { outboundInterface = new SipURIImpl(SipFactoryImpl.addressFactory.createSipURI(null, address), ModifiableRule.NotModifiable).toString(); } catch (ParseException e) { logger.error("couldn't parse the SipURI from USER[" + null + "] HOST[" + address + "]", e); throw new IllegalArgumentException("Could not create SIP URI user = " + null + " host = " + address); } }
public void setOutboundInterface(InetAddress inetAddress) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(inetAddress == null) { throw new NullPointerException("parameter is null"); } String address = inetAddress.getHostAddress(); List<SipURI> list = sipFactory.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.toString().contains(address)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + address + " not found"); try { outboundInterface = new SipURIImpl(SipFactoryImpl.addressFactory.createSipURI(null, address), ModifiableRule.NotModifiable).toString(); } catch (ParseException e) { logger.error("couldn't parse the SipURI from USER[" + null + "] HOST[" + address + "]", e); throw new IllegalArgumentException("Could not create SIP URI user = " + null + " host = " + address); } }
public void setOutboundInterface(SipURI outboundInterface) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(outboundInterface == null) { throw new NullPointerException("parameter is null"); } List<SipURI> list = sipFactory.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.equals(outboundInterface)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + outboundInterface + " not found"); this.outboundInterface = outboundInterface.toString(); if(outboundInterface.getTransportParam() != null) { this.transport = outboundInterface.getTransportParam(); } }
public void removeAttribute(String name, boolean byPassValidCheck) { if(!byPassValidCheck && !isValid()) throw new IllegalStateException("Can not bind object to session that has been invalidated!!");
public void setAttribute(String key, Object attribute) { if(!isValid()) { throw new IllegalStateException("Can not bind object to session that has been invalidated!!");
public void setHandler(String name) throws ServletException { if(!isValid()) { throw new IllegalStateException("the session has already been invalidated, no handler can be set on it anymore !"); } if(name != null && name.equals(handlerServlet)) { return ; } SipContext sipContext = getSipApplicationSession().getSipContext(); MobicentsSipServlet container = sipContext.findSipServletByName(name); if(container == null && sipContext.getSipRubyController() == null) { throw new ServletException("the sip servlet with the name "+ name + " doesn't exist in the sip application " + sipContext.getApplicationName()); } this.handlerServlet = name; getSipApplicationSession().setCurrentRequestHandler(handlerServlet); if(logger.isDebugEnabled()) { if(name !=null) { logger.debug("Session Handler for application " + getKey().getApplicationName() + " set to " + handlerServlet + " on sip session " + key); } else { logger.debug("Session Handler for application " + getKey().getApplicationName() + " set to " + sipContext.getSipRubyController() + " on sip session " + key); } } }
"Can not create ACK, PRACK or CANCEL requests with this method"); if(!isValid()) { throw new IllegalStateException("cannot create a subsequent request " + method + " because the session " + key + " is invalid"); String errorMessage = "Couldn't create the subsequent request " + method + " for this session " + key + ", isValid " + isValid() + ", session state " + state + " , sessionCreatingDialog = " + sessionCreatingDialog; if(sessionCreatingDialog != null) { errorMessage += " , dialog state " + sessionCreatingDialog.getState();