idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
37,400 | public void setMaxSequenceNumber ( int maxSequenceNumber ) throws Exception { if ( this . isStarted ) throw new Exception ( "MaxSequenceNumber parameter can be updated only when M3UA stack is NOT running" ) ; if ( maxSequenceNumber < 1 ) { maxSequenceNumber = 1 ; } else if ( maxSequenceNumber > MAX_SEQUENCE_NUMBER ) { ... | Set the maximum SLS that can be used by SCTP . Internally SLS vs SCTP Stream Sequence Number is maintained . Stream Seq Number 0 is for management . | 114 | 37 |
37,401 | public void startAsp ( String aspName ) throws Exception { AspFactoryImpl aspFactoryImpl = this . getAspFactory ( aspName ) ; if ( aspFactoryImpl == null ) { throw new Exception ( String . format ( M3UAOAMMessages . NO_ASP_FOUND , aspName ) ) ; } if ( aspFactoryImpl . getStatus ( ) ) { throw new Exception ( String . fo... | This method should be called by management to start the ASP | 323 | 11 |
37,402 | public void add ( Mtp2 link ) { // add link at the first empty place for ( int i = 0 ; i < links . length ; i ++ ) { if ( links [ i ] == null ) { links [ i ] = link ; break ; } } count ++ ; remap ( ) ; } | Adds link to this link set . | 65 | 7 |
37,403 | private void remap ( ) { int k = - 1 ; for ( int i = 0 ; i < map . length ; i ++ ) { boolean found = false ; for ( int j = k + 1 ; j < links . length ; j ++ ) { if ( links [ j ] != null ) { found = true ; k = j ; map [ i ] = k ; break ; } } if ( found ) { continue ; } for ( int j = 0 ; j < k ; j ++ ) { if ( links [ j ]... | This method is called each time when number of links has changed to reestablish relation between link selection indicator and link | 151 | 22 |
37,404 | protected Dialog createNewTCAPDialog ( SccpAddress origAddress , SccpAddress destAddress , Long localTrId ) throws MAPException { try { return this . mapProviderImpl . getTCAPProvider ( ) . getNewDialog ( origAddress , destAddress , localTrId ) ; } catch ( TCAPException e ) { throw new MAPException ( e . getMessage ( )... | Creating new outgoing TCAP Dialog . Used when creating a new outgoing MAP Dialog | 89 | 17 |
37,405 | private synchronized Long getAvailableTxId ( ) throws TCAPException { if ( this . dialogs . size ( ) >= this . stack . getMaxDialogs ( ) ) throw new TCAPException ( "Current dialog count exceeds its maximum value" ) ; while ( true ) { // Long id; // if (!currentDialogId.compareAndSet(this.stack.getDialogIdRangeEnd(), t... | some help methods ... crude but will work for first impl . | 246 | 12 |
37,406 | protected int getNextSeqControl ( ) { int res = seqControl . getAndIncrement ( ) ; // if (!seqControl.compareAndSet(256, 1)) { // return seqControl.getAndIncrement(); // } else { // return 0; // } // seqControl++; // if (seqControl > 255) { // seqControl = 0; // // } // return seqControl; if ( this . stack . getSlsRang... | get next Seq Control value available | 167 | 7 |
37,407 | protected Dialog createNewTCAPDialog ( SccpAddress origAddress , SccpAddress destAddress , Long localTrId ) throws CAPException { try { return this . capProviderImpl . getTCAPProvider ( ) . getNewDialog ( origAddress , destAddress , localTrId ) ; } catch ( TCAPException e ) { throw new CAPException ( e . getMessage ( )... | Creating new outgoing TCAP Dialog . Used when creating a new outgoing CAP Dialog | 89 | 17 |
37,408 | public int encodeDigits ( ByteArrayOutputStream bos ) { boolean isOdd = this . oddFlag == _FLAG_ODD ; byte b = 0 ; int count = ( ! isOdd ) ? address . length ( ) : address . length ( ) - 1 ; int bytesCount = 0 ; for ( int i = 0 ; i < count - 1 ; i += 2 ) { String ds1 = address . substring ( i , i + 1 ) ; String ds2 = a... | This method is used in encode . Encodes digits part . This is because | 245 | 15 |
37,409 | public ShellChannel accept ( ) throws IOException { SocketChannel newChannel = ( ( ServerSocketChannel ) channel ) . accept ( ) ; if ( newChannel == null ) return null ; return new ShellChannelExt ( chanProvider , newChannel ) ; } | Accepts a connection made to this channel s socket . | 53 | 11 |
37,410 | private void parseSmsSignalInfo ( SmsSignalInfo si , boolean isMo , boolean isMt ) { if ( si == null ) return ; if ( isMo ) { try { SmsTpdu tpdu = si . decodeTpdu ( true ) ; parseSmsTpdu ( tpdu ) ; } catch ( MAPException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } } if ( isMt ) { try { SmsTpdu ... | SMS service listener | 168 | 4 |
37,411 | protected AspImpl getAspForNullRc ( ) { // We know if null RC, ASP cannot be shared and AspFactory will // have only one ASP AspImpl aspImpl = ( AspImpl ) this . aspFactoryImpl . aspList . get ( 0 ) ; if ( this . aspFactoryImpl . aspList . size ( ) > 1 ) { // verify that AS to which this ASP is added is also having nul... | Get s the ASP for any ASP Traffic Maintenance Management Signalling Network Management and Transfer m3ua message s received which has null Routing Context | 173 | 28 |
37,412 | protected void sendTransferMessageToLocalUser ( Mtp3TransferPrimitive msg , int seqControl ) { if ( this . isStarted ) { MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler ( msg ) ; seqControl = seqControl & slsFilter ; this . msgDeliveryExecutors [ this . slsTable [ seqControl ] ] . execute ( hdl ) ; } el... | Deliver an incoming message to the local user | 129 | 9 |
37,413 | protected static String getHomeDir ( String [ ] args ) { if ( System . getenv ( HOME_DIR ) == null ) { if ( args . length > index ) { return args [ index ++ ] ; } else { return "." ; } } else { return System . getenv ( HOME_DIR ) ; } } | Gets the Media Server Home directory . | 68 | 8 |
37,414 | private void linkUp ( Mtp2 link ) { if ( link . mtp2Listener != null ) { link . mtp2Listener . linkUp ( ) ; } linkset . add ( link ) ; if ( linkset . isActive ( ) && this . mtp3Listener != null ) { try { mtp3Listener . linkUp ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } if ( logger . isInfoEnabled ( ) ... | Notify that link is up . | 136 | 7 |
37,415 | private boolean checkPattern ( Mtp2Buffer frame , int sltmLen , byte [ ] pattern ) { if ( sltmLen != pattern . length ) { return false ; } for ( int i = 0 ; i < pattern . length ; i ++ ) { if ( frame . frame [ i + PATTERN_OFFSET ] != pattern [ i ] ) { return false ; } } return true ; } | + 2 becuase frame . len contains 2B for CRC | 84 | 13 |
37,416 | public static String bcdToHexString ( int encodingScheme , byte bcdByte ) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder ( ) ; byte leftNibble = ( byte ) ( bcdByte & 0xf0 ) ; leftNibble = ( byte ) ( leftNibble >>> 4 ) ; leftNibble = ( byte ) ( leftNibble & 0x0f ) ; byte rightNibble = ( byte ... | Converts single BCD encoded byte into String Hex representation . | 240 | 12 |
37,417 | public static String bcdDecodeToHexString ( int encodingScheme , byte [ ] bcdBytes ) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder ( ) ; for ( byte b : bcdBytes ) { sb . append ( bcdToHexString ( encodingScheme , b ) ) ; } if ( GenericDigits . _ENCODING_SCHEME_BCD_ODD == encodingScheme ) { ... | Decoded BCD encoded string into Hex digits string . | 128 | 11 |
37,418 | private PowerShell initalize ( String powerShellExecutablePath ) throws PowerShellNotAvailableException { String codePage = PowerShellCodepage . getIdentifierByCodePageName ( Charset . defaultCharset ( ) . name ( ) ) ; ProcessBuilder pb ; //Start powershell executable in process if ( OSDetector . isWindows ( ) ) { pb =... | Initializes PowerShell console in which we will enter the commands | 429 | 11 |
37,419 | public static PowerShellResponse executeSingleCommand ( String command ) { PowerShellResponse response = null ; try ( PowerShell session = PowerShell . openSession ( ) ) { response = session . executeCommand ( command ) ; } catch ( PowerShellNotAvailableException ex ) { logger . log ( Level . SEVERE , "PowerShell not a... | Execute a single command in PowerShell console and gets result | 76 | 11 |
37,420 | private void handleResponse ( PowerShellResponseHandler response , PowerShellResponse powerShellResponse ) { try { response . handle ( powerShellResponse ) ; } catch ( Exception ex ) { logger . log ( Level . SEVERE , "PowerShell not available" , ex ) ; } } | Handle response in callback way | 57 | 5 |
37,421 | @ SuppressWarnings ( "WeakerAccess" ) public PowerShellResponse executeScript ( String scriptPath , String params ) { BufferedReader srcReader ; try { srcReader = new BufferedReader ( new FileReader ( new File ( scriptPath ) ) ) ; } catch ( FileNotFoundException fnfex ) { logger . log ( Level . SEVERE , "Unexpected err... | Executed the provided PowerShell script in PowerShell console and gets result . | 130 | 13 |
37,422 | public PowerShellResponse executeScript ( BufferedReader srcReader , String params ) { PowerShellResponse response ; if ( srcReader != null ) { File tmpFile = createWriteTempFile ( srcReader ) ; if ( tmpFile != null ) { this . scriptMode = true ; response = executeCommand ( tmpFile . getAbsolutePath ( ) + " " + params ... | Execute the provided PowerShell script in PowerShell console and gets result . | 156 | 13 |
37,423 | private File createWriteTempFile ( BufferedReader srcReader ) { BufferedWriter tmpWriter = null ; File tmpFile = null ; try { tmpFile = File . createTempFile ( "psscript_" + new Date ( ) . getTime ( ) , ".ps1" , this . tempFolder ) ; if ( ! tmpFile . exists ( ) ) { return null ; } tmpWriter = new BufferedWriter ( new F... | Writes a temp powershell script file based on the srcReader | 265 | 13 |
37,424 | @ Override public void close ( ) { if ( ! this . closed ) { try { Future < String > closeTask = threadpool . submit ( ( ) -> { commandWriter . println ( "exit" ) ; p . waitFor ( ) ; return "OK" ; } ) ; if ( ! closeAndWait ( closeTask ) && this . pid > 0 ) { //If it can be closed, force kill the process Logger . getLogg... | Closes all the resources used to maintain the PowerShell context | 403 | 11 |
37,425 | private File getTempFolder ( String tempPath ) { if ( tempPath != null ) { File folder = new File ( tempPath ) ; if ( folder . exists ( ) ) { return folder ; } } return null ; } | Return the temp folder File object or null if the path does not exist | 47 | 14 |
37,426 | public static String getIdentifierByCodePageName ( String cpName ) { if ( cpName != null ) { for ( Entry < String , String > codePage : codePages . entrySet ( ) ) { if ( codePage . getValue ( ) . toLowerCase ( ) . equals ( cpName . toLowerCase ( ) ) ) { return codePage . getKey ( ) ; } } } //Default UTF-8 return "65001... | Get the CodePage code from encoding value | 97 | 8 |
37,427 | public String call ( ) throws InterruptedException { StringBuilder powerShellOutput = new StringBuilder ( ) ; try { if ( startReading ( ) ) { readData ( powerShellOutput ) ; } } catch ( IOException ioe ) { Logger . getLogger ( PowerShell . class . getName ( ) ) . log ( Level . SEVERE , "Unexpected error reading PowerSh... | Calls the command and returns its output | 130 | 8 |
37,428 | private void readData ( StringBuilder powerShellOutput ) throws IOException { String line ; while ( null != ( line = this . reader . readLine ( ) ) ) { //In the case of script mode it finish when the last line is read if ( this . scriptMode ) { if ( line . equals ( PowerShell . END_SCRIPT_STRING ) ) { break ; } } power... | Reads all data from output | 192 | 6 |
37,429 | private boolean startReading ( ) throws IOException , InterruptedException { //If the reader is not ready, gives it some milliseconds while ( ! this . reader . ready ( ) ) { Thread . sleep ( this . waitPause ) ; if ( this . closed ) { return false ; } } return true ; } | Checks when we can start reading the output . Timeout if it takes too long in order to avoid hangs | 64 | 22 |
37,430 | private boolean canContinueReading ( ) throws IOException , InterruptedException { //If the reader is not ready, gives it some milliseconds //It is important to do that, because the ready method guarantees that the readline will not be blocking if ( ! this . reader . ready ( ) ) { Thread . sleep ( this . waitPause ) ; ... | Checks when we the reader can continue to read . | 116 | 11 |
37,431 | public static FilterBuilder any ( final Predicate ... alternatives ) { return new CommonFilterBuilder ( ) { @ Override public boolean matches ( Class < ? > klass ) { for ( Predicate alternative : alternatives ) { if ( alternative . matches ( klass ) ) { return true ; } } return false ; } } ; } | Returns a filter which satisfies any of the selected predicates . | 68 | 12 |
37,432 | protected final void indexAnnotations ( Class < ? > ... classes ) { for ( Class < ? > klass : classes ) { indexedAnnotations . add ( klass . getCanonicalName ( ) ) ; } annotationDriven = false ; } | Adds given annotations for indexing . | 53 | 7 |
37,433 | protected final void indexSubclasses ( Class < ? > ... classes ) { for ( Class < ? > klass : classes ) { indexedSuperclasses . add ( klass . getCanonicalName ( ) ) ; } annotationDriven = false ; } | Adds given classes for subclass indexing . | 53 | 8 |
37,434 | public final boolean isRouteExternal ( RouteHeader routeHeader ) { if ( routeHeader != null ) { javax . sip . address . SipURI routeUri = ( javax . sip . address . SipURI ) routeHeader . getAddress ( ) . getURI ( ) ; String routeTransport = routeUri . getTransportParam ( ) ; if ( routeTransport == null ) { routeTranspo... | Check if the route is external | 130 | 6 |
37,435 | public final boolean isViaHeaderExternal ( ViaHeader viaHeader ) { if ( viaHeader != null ) { return isExternal ( viaHeader . getHost ( ) , viaHeader . getPort ( ) , viaHeader . getTransport ( ) ) ; } return true ; } | Check if the via header is external | 57 | 7 |
37,436 | public final boolean isExternal ( String host , int port , String transport ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "isExternal - host=" + host + ", port=" + port + ", transport=" + transport ) ; } boolean isExternal = true ; MobicentsExtendedListeningPoint listeningPoint = sipNetworkInterfaceManager ... | Check whether or not the triplet host port and transport are corresponding to an interface | 265 | 16 |
37,437 | private void resetOutboundInterfaces ( ) { List < SipURI > outboundInterfaces = sipNetworkInterfaceManager . getOutboundInterfaces ( ) ; for ( SipContext sipContext : applicationDeployed . values ( ) ) { sipContext . getServletContext ( ) . setAttribute ( javax . servlet . sip . SipServlet . OUTBOUND_INTERFACES , outbo... | set the outbound interfaces on all servlet context of applications deployed | 95 | 13 |
37,438 | public void creditGranted ( long amount , boolean finalUnits ) throws Exception { if ( CURRENT_STATE == SENT_INITIAL_RESERVATION ) { CURRENT_STATE = GRANTED_INITIAL_RESERVATION ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "credit granted : " ) ; } doInviteChargingAllowed ( this . inviteRequest ) ; } } | Ro Client Listener Implementation | 94 | 5 |
37,439 | public void recycle ( ) { proxyConfig . isProxyConfigSet = false ; sessionConfig . isSessionConfigSet = false ; loginConfig . isLoginConfigSet = false ; servletSelection . isMainServlet = false ; servletSelection . isServletMapping = false ; } | Reset counter used for validating the web . xml file . | 62 | 13 |
37,440 | private JBossConvergedSipMetaData mergeSipMetaDataAndSipAnnMetaData ( final DeploymentUnit deploymentUnit ) { final WarMetaData warMetaData = deploymentUnit . getAttachment ( WarMetaData . ATTACHMENT_KEY ) ; SipMetaData sipMetaData = deploymentUnit . getAttachment ( SipMetaData . ATTACHMENT_KEY ) ; SipAnnotationMetaDat... | merge DD and annotation meta data and store in WarMetaData . mergedJBossWebMetaData based on SIPWebContext code | 370 | 27 |
37,441 | private final void forwardResponseStatefully ( final SipServletResponseImpl sipServletResponse ) { final Response response = sipServletResponse . getResponse ( ) ; final ListIterator < ViaHeader > viaHeadersLeft = response . getHeaders ( ViaHeader . NAME ) ; // we cannot remove the via header on the original response (... | this method is called when a B2BUA got the response so we don t have anything to do here or an app that didn t do anything with it or when handling the request an app had to be called but wasn t deployed the topmost via header is stripped from the response and the response is forwarded statefully | 701 | 64 |
37,442 | public void startNextUntriedBranch ( ) { if ( this . parallel ) throw new IllegalStateException ( "This method is only for sequantial proxying" ) ; for ( final MobicentsProxyBranch pbi : this . proxyBranches . values ( ) ) { // Issue http://code.google.com/p/mobicents/issues/detail?id=2461 // don't start the branch is ... | In sequential proxying get some untried branch and start it then wait for response and repeat | 132 | 18 |
37,443 | public static DeploymentUnit getSipContextAnchorDu ( final DeploymentUnit du ) { // attach context to top-level deploymentUnit so it can be used to get context resources (SipFactory, etc.) DeploymentUnit parentDu = du . getParent ( ) ; if ( parentDu == null ) { // this is a war only deployment return du ; } else if ( D... | returns the anchor deployment unit that will have attached a SIPWebContext | 145 | 15 |
37,444 | private void pushRoute ( javax . sip . address . SipURI sipUri ) { if ( ! isInitial ( ) && getSipSession ( ) . getProxy ( ) == null ) { //as per JSR 289 Section 11.1.3 Pushing Route Header Field Values // pushRoute can only be done on the initial requests. // Subsequent requests within a dialog follow the route set. //... | Pushes a route header on initial request based on the jain sip sipUri given on parameter | 276 | 20 |
37,445 | private javax . sip . address . URI resolveSipOutbound ( final javax . sip . address . URI uriToResolve ) { if ( ! uriToResolve . isSipURI ( ) ) { return uriToResolve ; } final javax . sip . address . SipURI sipURI = ( javax . sip . address . SipURI ) uriToResolve ; if ( sipURI . getParameter ( MessageDispatcher . SIP_... | Check to see if the uri to resolve contains a ob parameter and if so try and locate a flow for this uri . | 237 | 26 |
37,446 | private void updateLinkedRequestAppDataMapping ( final ClientTransaction ctx , Dialog dialog ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "updateLinkedRequestAppDataMapping" ) ; } final Transaction linkedTransaction = linkedRequest . getTransaction ( ) ; final Dialog linkedDialog = linkedRequest . getDialo... | Keeping the transactions mapping in application data for CANCEL handling | 239 | 12 |
37,447 | private void addInfoForRoutingBackToContainer ( SipApplicationRouterInfo routerInfo , String applicationSessionId , String applicationName ) throws ParseException , SipException { final Request request = ( Request ) super . message ; final javax . sip . address . SipURI sipURI = JainSipUtils . createRecordRouteURI ( si... | Add a route header to route back to the container | 437 | 10 |
37,448 | private static RoutingState checkRoutingState ( SipServletRequestImpl sipServletRequest , Dialog dialog ) { // 2. Ongoing Transaction Detection - Employ methods of Section 17.2.3 in RFC 3261 //to see if the request matches an existing transaction. //If it does, stop. The request is not an initial request. if ( dialog !... | Method checking whether or not the sip servlet request in parameter is initial according to algorithm defined in JSR289 Appendix B | 753 | 24 |
37,449 | public MobicentsExtendedListeningPoint findMatchingListeningPoint ( String transport , final boolean strict ) { String tmpTransport = transport ; if ( tmpTransport == null ) { tmpTransport = ListeningPoint . UDP ; } Set < MobicentsExtendedListeningPoint > extendedListeningPoints = transportMappingCacheMap . get ( tmpTr... | Retrieve the first matching listening point corresponding to the transport . | 295 | 12 |
37,450 | public MobicentsExtendedListeningPoint findMatchingListeningPoint ( final String ipAddress , int port , String transport ) { String tmpTransport = transport ; int portChecked = checkPortRange ( port , tmpTransport ) ; if ( tmpTransport == null ) { tmpTransport = ListeningPoint . UDP ; } // we check first if a listening... | Retrieve the first matching listening Point corresponding to the ipAddress port and transport given in parameter . | 748 | 19 |
37,451 | protected void computeOutboundInterfaces ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Outbound Interface List : " ) ; } List < SipURI > newlyComputedOutboundInterfaces = new CopyOnWriteArrayList < SipURI > ( ) ; Set < String > newlyComputedOutboundInterfacesIpAddresses = new CopyOnWriteArraySet < String... | Compute all the outbound interfaces for this manager | 438 | 10 |
37,452 | private DatagramSocket initRandomPortSocket ( ) { int bindRetries = 5 ; int currentlyTriedPort = getRandomPortNumber ( JainSipUtils . MIN_PORT_NUMBER , JainSipUtils . MAX_PORT_NUMBER ) ; DatagramSocket resultSocket = null ; // we'll first try to bind to a random port. if this fails we'll try // again (bindRetries times... | Initializes and binds a socket that on a random port number . The method would try to bind on a random port and retry 5 times until a free port is found . | 307 | 35 |
37,453 | public void setToTag ( String toTag , boolean recomputeSessionId ) { this . toTag = toTag ; if ( toTag != null && recomputeSessionId ) { // Issue 2365 : to tag needed for getApplicationSession().getSipSession(<sessionId>) to return forked session and not the parent one computeToString ( ) ; } } | Sets the to tag on the key when we receive a response . We recompute the session id only for derived session otherwise the id will change when the a request is received or sent and the response is sent back or received which should not happen See TCK test SipSessionListenerTest . testSessionDestroyed001 | 78 | 64 |
37,454 | public static void removeSipSubcontext ( Context envCtx ) { try { envCtx . destroySubcontext ( SIP_SUBCONTEXT ) ; } catch ( NamingException e ) { logger . error ( sm . getString ( "naming.unbindFailed" , e ) ) ; } } | Removes the sip subcontext from JNDI | 68 | 10 |
37,455 | public static void addSipSubcontext ( Context envCtx ) { try { envCtx . createSubcontext ( SIP_SUBCONTEXT ) ; } catch ( NamingException e ) { logger . error ( sm . getString ( "naming.bindFailed" , e ) ) ; } } | Add the sip subcontext to JNDI | 67 | 9 |
37,456 | public static void removeAppNameSubContext ( Context envCtx , String appName ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT ) ; sipContext . destroySubcontext ( appName ) ; } catch ( NamingException e ) { logger . error ( sm . getStr... | Removes the app name subcontext from the jndi mapping | 110 | 13 |
37,457 | public static void removeSipSessionsUtil ( Context envCtx , String appName , SipSessionsUtil sipSessionsUtil ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT + "/" + appName ) ; sipContext . unbind ( SIP_SESSIONS_UTIL_JNDI_NAME ) ; } c... | Removes the sip sessions util binding from the jndi mapping | 142 | 13 |
37,458 | public static void removeTimerService ( Context envCtx , String appName , TimerService timerService ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT + "/" + appName ) ; sipContext . unbind ( TIMER_SERVICE_JNDI_NAME ) ; } catch ( Naming... | Removes the Timer Service binding from the jndi mapping | 128 | 13 |
37,459 | public static void removeSipFactory ( Context envCtx , String appName , SipFactory sipFactory ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT + "/" + appName ) ; sipContext . unbind ( SIP_FACTORY_JNDI_NAME ) ; } catch ( NamingExceptio... | Removes the sip factory binding from the jndi mapping | 130 | 12 |
37,460 | protected void handleSipOutbound ( final SipServletRequestImpl sipServletRequest ) { // if this is not a dialog creating request, then bail out right away if ( ! JainSipUtils . DIALOG_CREATING_METHODS . contains ( sipServletRequest . getMethod ( ) ) ) { return ; } final Request request = ( Request ) sipServletRequest .... | NOTE! This is only a partial implementation and will only work when we are acting as a UAS as per RFC 5626 Section 4 . 3 . Sending Non - REGISTER Requests . Need to add some more logic for proxy scenarios . See RFC 5626 for exact details . | 557 | 56 |
37,461 | protected void registerSipConnector ( Connector connector ) { try { ObjectName objectName = createSipConnectorObjectName ( connector , getName ( ) , "SipConnector" ) ; Registry . getRegistry ( null , null ) . registerComponent ( connector , objectName , null ) ; //TODO connector.setController(objectName); } catch ( Exc... | Register the sip connector under a different name than HTTP Connector and we add the transport to avoid clashing with 2 connectors having the same port and address | 124 | 30 |
37,462 | public void initializeSystemPortProperties ( ) { for ( Connector connector : connectors ) { if ( connector . getProtocol ( ) . contains ( "HTTP" ) ) { if ( connector . getSecure ( ) ) { System . setProperty ( "org.mobicents.properties.sslPort" , Integer . toString ( connector . getPort ( ) ) ) ; } else { System . setPr... | This method simply makes the HTTP and SSL ports avaialble everywhere in the JVM in order jsip ha to read them for balancer description purposes . There is no other good way to communicate the properies to jsip ha without adding more dependencies . | 118 | 52 |
37,463 | public static String [ ] getMissingSipMethods ( Collection < String > sipMethods ) { String [ ] methods = { } ; if ( sipMethods . size ( ) > 0 && sipMethods . containsAll ( ALL_SIP_METHODS ) == false ) { HashSet < String > missingMethods = new HashSet < String > ( ALL_SIP_METHODS ) ; missingMethods . removeAll ( sipMet... | Get sip methods in ALL_SIP_METHODS not in the argument sipMethods . | 117 | 18 |
37,464 | private Set < String > getAllComponentClasses ( DeploymentUnit deploymentUnit , CompositeIndex index , SipMetaData sipMetaData , SipAnnotationMetaData sipAnnotationMetaData ) { final Set < String > classes = new HashSet < String > ( ) ; if ( sipAnnotationMetaData != null ) { for ( Map . Entry < String , SipMetaData > m... | Gets all classes that are eligible for injection etc | 507 | 10 |
37,465 | public void addSipServletResponse ( SipServletResponseImpl sipServletResponse ) { if ( sipServletResponses == null ) { sipServletResponses = new CopyOnWriteArraySet < SipServletResponseImpl > ( ) ; } sipServletResponses . add ( sipServletResponse ) ; } | used to get access from the B2BUA to pending messages on the transaction | 74 | 16 |
37,466 | public void setMaxActiveSipSessions ( int max ) { int oldMaxActiveSipSessions = this . sipManagerDelegate . getMaxActiveSipSessions ( ) ; this . sipManagerDelegate . setMaxActiveSipSessions ( max ) ; support . firePropertyChange ( "maxActiveSipSessions" , Integer . valueOf ( oldMaxActiveSipSessions ) , Integer . valueO... | Set the maximum number of actives Sip Sessions allowed or - 1 for no limit . | 112 | 18 |
37,467 | public void setMaxActiveSipApplicationSessions ( int max ) { int oldMaxActiveSipApplicationSessions = this . sipManagerDelegate . getMaxActiveSipApplicationSessions ( ) ; this . sipManagerDelegate . setMaxActiveSipApplicationSessions ( max ) ; support . firePropertyChange ( "maxActiveSipApplicationSessions" , Integer .... | Set the maximum number of actives Sip Application Sessions allowed or - 1 for no limit . | 119 | 19 |
37,468 | public static boolean findPackageInfoinDirectory ( File file ) { if ( file . getName ( ) . equals ( "package-info.class" ) ) { FileInputStream stream = null ; try { stream = new FileInputStream ( file ) ; if ( findSipApplicationAnnotation ( stream ) ) return true ; } catch ( Exception e ) { } finally { try { stream . c... | Determine if there is a sip application in this folder . | 142 | 13 |
37,469 | public static boolean findSipApplicationAnnotation ( InputStream stream ) { try { byte [ ] rawClassBytes ; rawClassBytes = new byte [ stream . available ( ) ] ; stream . read ( rawClassBytes ) ; boolean one = contains ( rawClassBytes , SIP_APPLICATION_BYTES ) ; boolean two = contains ( rawClassBytes , ANNOTATION_BYTES ... | Determine if this stream contains SipApplication annotations | 107 | 11 |
37,470 | public String auth_getSession ( String authToken ) throws FacebookException , IOException { if ( null != this . _sessionKey ) { return this . _sessionKey ; } Document d = this . callMethod ( FacebookMethod . AUTH_GET_SESSION , new Pair < String , CharSequence > ( "auth_token" , authToken . toString ( ) ) ) ; this . _se... | Call this function to retrieve the session information after your user has logged in . | 218 | 15 |
37,471 | protected URL extractURL ( Document doc ) throws IOException { String url = doc . getFirstChild ( ) . getTextContent ( ) ; return ( null == url || "" . equals ( url ) ) ? null : new URL ( url ) ; } | Extracts a URL from a document that consists of a URL only . | 52 | 15 |
37,472 | private static void stripEmptyTextNodes ( Node n ) { NodeList children = n . getChildNodes ( ) ; int length = children . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { Node c = children . item ( i ) ; if ( ! c . hasChildNodes ( ) && c . getNodeType ( ) == Node . TEXT_NODE && c . getTextContent ( ) . trim ( ) .... | Hack ... since DOM reads newlines as textnodes we want to strip out those nodes to make it easier to use the tree . | 147 | 27 |
37,473 | public static void printDom ( Node n , String prefix ) { String outString = prefix ; if ( n . getNodeType ( ) == Node . TEXT_NODE ) { outString += "'" + n . getTextContent ( ) . trim ( ) + "'" ; } else { outString += n . getNodeName ( ) ; } System . out . println ( outString ) ; NodeList children = n . getChildNodes ( ... | Prints out the DOM tree . | 145 | 7 |
37,474 | public void run ( ) { final MobicentsSipApplicationSession sipApplicationSession = getApplicationSession ( ) ; SipContext sipContext = sipApplicationSession . getSipContext ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "running Servlet Timer " + id + " for sip application session " + sipApplicationSession... | Method that actually | 406 | 3 |
37,475 | private void estimateNextExecution ( ) { synchronized ( TIMER_LOCK ) { if ( fixedDelay ) { scheduledExecutionTime = period + System . currentTimeMillis ( ) ; } else { if ( firstExecution == 0 ) { // save timestamp of first execution firstExecution = scheduledExecutionTime ; } long now = System . currentTimeMillis ( ) ;... | Helper to calculate when next execution time is . | 165 | 9 |
37,476 | public void addPermission ( String path ) { if ( path == null ) { return ; } if ( securityManager != null ) { Permission permission = null ; if ( path . startsWith ( "jndi:" ) || path . startsWith ( "jar:jndi:" ) ) { if ( ! path . endsWith ( "/" ) ) { path = path + "/" ; } permission = new JndiPermission ( path + "*" )... | If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path . | 183 | 25 |
37,477 | public void addPermission ( Permission permission ) { if ( ( securityManager != null ) && ( permission != null ) ) { permissionList . add ( permission ) ; } } | If there is a Java SecurityManager create a Permission . | 37 | 12 |
37,478 | public void stop ( ) throws LifecycleException { // Clearing references should be done before setting started to // false, due to possible side effects clearReferences ( ) ; // Annotations dont need a running app. //started = false; int length = files . length ; for ( int i = 0 ; i < length ; i ++ ) { files [ i ] = nul... | Stop the class loader . | 252 | 5 |
37,479 | protected void clearReferences ( ) { // Unregister any JDBC drivers loaded by this classloader Enumeration drivers = DriverManager . getDrivers ( ) ; while ( drivers . hasMoreElements ( ) ) { Driver driver = ( Driver ) drivers . nextElement ( ) ; if ( driver . getClass ( ) . getClassLoader ( ) == this ) { try { DriverM... | Clear references . | 665 | 3 |
37,480 | protected boolean loadedByThisOrChild ( Class clazz ) { boolean result = false ; for ( ClassLoader classLoader = clazz . getClassLoader ( ) ; null != classLoader ; classLoader = classLoader . getParent ( ) ) { if ( classLoader . equals ( this ) ) { result = true ; break ; } } return result ; } | Determine whether a class was loaded by this class loader or one of its child class loaders . | 74 | 21 |
37,481 | protected Class findClassInternal ( String name ) throws ClassNotFoundException { if ( ! validate ( name ) ) throw new ClassNotFoundException ( name ) ; String tempPath = name . replace ( ' ' , ' ' ) ; String classPath = tempPath + ".class" ; ResourceEntry entry = null ; entry = findResourceInternal ( name , classPath ... | Find specified class in local repositories . | 541 | 7 |
37,482 | protected ResourceEntry findResourceInternal ( File file , String path ) { ResourceEntry entry = new ResourceEntry ( ) ; try { entry . source = getURI ( new File ( file , path ) ) ; entry . codeBase = getURL ( new File ( file , path ) , false ) ; } catch ( MalformedURLException e ) { return null ; } return entry ; } | Find specified resource in local repositories . This block will execute under an AccessControl . doPrivilege block . | 81 | 21 |
37,483 | protected boolean filter ( String name ) { if ( name == null ) return false ; // Looking up the package String packageName = null ; int pos = name . lastIndexOf ( ' ' ) ; if ( pos != - 1 ) packageName = name . substring ( 0 , pos ) ; else return false ; for ( int i = 0 ; i < packageTriggers . length ; i ++ ) { if ( pac... | Filter classes . | 110 | 3 |
37,484 | protected static void deleteDir ( File dir ) { String files [ ] = dir . list ( ) ; if ( files == null ) { files = new String [ 0 ] ; } for ( int i = 0 ; i < files . length ; i ++ ) { File file = new File ( dir , files [ i ] ) ; if ( file . isDirectory ( ) ) { deleteDir ( file ) ; } else { try { file . delete ( ) ; } ca... | Delete the specified directory including all of its contents and subdirectories recursively . | 176 | 17 |
37,485 | private final static String basePhoneNumber ( String number ) throws ParseException { StringBuffer s = new StringBuffer ( ) ; Lexer lexer = new Lexer ( "sip_urlLexer" , number ) ; int lc = 0 ; while ( lexer . hasMoreChars ( ) ) { char w = lexer . lookAhead ( 0 ) ; if ( Lexer . isDigit ( w ) || w == ' ' || w == ' ' || w... | the part in comment | 176 | 4 |
37,486 | private static Properties loadProperties ( String defaultsName , String propertiesName ) throws IOException { Properties bundle = new Properties ( ) ; ClassLoader loader = SecurityActions . getContextClassLoader ( ) ; URL defaultUrl = null ; URL url = null ; // First check for local visibility via a URLClassLoader.find... | helper method to load digest user property file . Copied from org . jboss . security . auth . spi . Util | 653 | 27 |
37,487 | protected static String removeQuotes ( String quotedString , boolean quotesRequired ) { // support both quoted and non-quoted if ( quotedString . length ( ) > 0 && quotedString . charAt ( 0 ) != ' ' && ! quotesRequired ) { return quotedString ; } else if ( quotedString . length ( ) > 2 ) { return quotedString . substri... | Removes the quotes on a string . RFC2617 states quotes are optional for all parameters except realm . | 97 | 21 |
37,488 | protected synchronized MessageDigest getDigest ( ) { if ( this . digest == null ) { try { this . digest = MessageDigest . getInstance ( algorithm ) ; } catch ( NoSuchAlgorithmException e ) { try { this . digest = MessageDigest . getInstance ( DEFAULT_ALGORITHM ) ; } catch ( NoSuchAlgorithmException f ) { this . digest ... | Return the MessageDigest object to be used for calculating session identifiers . If none has been created yet initialize one the first time this method is called . | 98 | 30 |
37,489 | protected synchronized Random getRandom ( ) { if ( this . random == null ) { try { Class clazz = Class . forName ( randomClass ) ; this . random = ( Random ) clazz . newInstance ( ) ; long seed = System . currentTimeMillis ( ) ; char [ ] entropy = getEntropy ( ) . toCharArray ( ) ; for ( int i = 0 ; i < entropy . lengt... | Return the random number generator instance we should use for generating session identifiers . If there is no such generator currently defined construct and seed a new one . | 163 | 29 |
37,490 | public static int getAddressOutboundness ( String address ) { if ( address . startsWith ( "127.0" ) ) return 0 ; if ( address . startsWith ( "192.168" ) ) return 1 ; if ( address . startsWith ( "10." ) ) return 2 ; if ( address . startsWith ( "172.16" ) || address . startsWith ( "172.17" ) || address . startsWith ( "17... | RFC 1918 address spaces | 297 | 4 |
37,491 | public ViaHeader createViaHeader ( String branch , boolean usePublicAddress ) { try { String host = getIpAddress ( usePublicAddress ) ; ViaHeader via = SipFactoryImpl . headerFactory . createViaHeader ( host , port , transport , branch ) ; return via ; } catch ( ParseException ex ) { logger . error ( "Unexpected error ... | Create a Via Header based on the host port and transport of this listening point | 156 | 15 |
37,492 | public javax . sip . address . SipURI createRecordRouteURI ( boolean usePublicAddress ) { try { String host = getIpAddress ( usePublicAddress ) ; SipURI sipUri = SipFactoryImpl . addressFactory . createSipURI ( null , host ) ; sipUri . setPort ( port ) ; sipUri . setTransportParam ( transport ) ; // Do we want to add a... | Create a Record Route URI based on the host port and transport of this listening point | 152 | 16 |
37,493 | public void removeCorrespondingSipApplicationSession ( MobicentsSipApplicationSessionKey sipApplicationSession ) { joinApplicationSession . remove ( sipApplicationSession ) ; replacesApplicationSession . remove ( sipApplicationSession ) ; Iterator < MobicentsSipApplicationSessionKey > it = joinApplicationSession . valu... | Add a mapping between a corresponding sipSession related to a headerName . See Also getCorrespondingSipSession method . | 226 | 25 |
37,494 | public void notifySipSessionListeners ( SipSessionEventType sipSessionEventType ) { MobicentsSipApplicationSession sipApplicationSession = getSipApplicationSession ( ) ; if ( sipApplicationSession != null ) { SipContext sipContext = sipApplicationSession . getSipContext ( ) ; List < SipSessionListener > sipSessionListe... | Notifies the listeners that a lifecycle event occured on that sip session | 447 | 15 |
37,495 | protected boolean hasOngoingTransaction ( ) { if ( ! isSupervisedMode ( ) ) { return false ; } else { if ( ongoingTransactions != null ) { for ( Transaction transaction : ongoingTransactions ) { if ( TransactionState . CALLING . equals ( transaction . getState ( ) ) || TransactionState . TRYING . equals ( transaction .... | Removed from the interface in PFD stage so making it protected | 142 | 12 |
37,496 | public void addOngoingTransaction ( Transaction transaction ) { if ( transaction != null && ongoingTransactions != null && ! isReadyToInvalidate ( ) ) { boolean added = this . ongoingTransactions . add ( transaction ) ; if ( added ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "transaction " + transaction + ... | Add an ongoing tx to the session . | 102 | 8 |
37,497 | public void removeOngoingTransaction ( Transaction transaction ) { boolean removed = false ; if ( this . ongoingTransactions != null ) { removed = this . ongoingTransactions . remove ( transaction ) ; } // if(sessionCreatingTransactionRequest != null && sessionCreatingTransactionRequest.getMessage() != null && JainSipU... | Remove an ongoing tx to the session . | 677 | 8 |
37,498 | public void onReadyToInvalidate ( ) { if ( isB2BUAOrphan ( ) ) { logger . debug ( "Session is B2BUA Orphaned, lets invalidate" ) ; setReadyToInvalidate ( true ) ; } if ( ! readyToInvalidate ) { logger . debug ( "Session not ready to invalidate, wait next chance." ) ; return ; } boolean allDerivedReady = true ; Iterator... | This method is called immediately when the conditions for read to invalidate session are met | 477 | 16 |
37,499 | public void setAckReceived ( long cSeq , boolean ackReceived ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setting AckReceived to : " + ackReceived + " for CSeq " + cSeq ) ; } acksReceived . put ( cSeq , ackReceived ) ; if ( ackReceived ) { cleanupAcksReceived ( cSeq ) ; } } | Setting ackReceived for CSeq to specified value in second param . if the second param is true it will try to cleanup earlier cseq as well to save on memory | 100 | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.