idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
121,900 | public long getCertCacheLifetime ( ) throws NumberFormatException { long value = 60 * 1000 ; String property = getProperty ( CERT_CACHE_LIFETIME ) ; if ( property != null && property . length ( ) > 0 ) { long parsedValue = Long . parseLong ( property ) ; if ( parsedValue > 0 ) { value = parsedValue ; } } property = Sys... | Returns the Cert cache lifetime . If this property is set to zero or less no caching is done . The value is the number of milliseconds the certificates are cached without checking for modifications on disk . |
121,901 | public long getReveseDNSCacheLifetime ( ) throws NumberFormatException { long value = 60 * 60 * 1000 ; String property = getProperty ( REVERSE_DNS_CACHE_LIFETIME ) ; if ( property != null && property . length ( ) > 0 ) { long parsedValue = Long . parseLong ( property ) ; if ( parsedValue > 0 ) { value = parsedValue ; }... | Returns the reverse DNS cache time . |
121,902 | public String getReverseDNSCacheType ( ) { String value = System . getProperty ( REVERSE_DNS_CACHETYPE ) ; if ( value != null ) { return value ; } return getProperty ( REVERSE_DNS_CACHETYPE , THREADED_CACHE ) ; } | Returns the reverse DNS cache type . Defaults to a threaded chache . |
121,903 | public void add ( Binding binding ) { if ( values == null ) values = new LinkedList ( ) ; values . add ( binding ) ; } | Adds a new variable definition to the list . |
121,904 | public Bindings evaluate ( Map symbolTable ) throws RslEvaluationException { if ( symbolTable == null ) { throw new IllegalArgumentException ( "Symbol table must be initialized." ) ; } List newValues = new LinkedList ( ) ; Iterator iter = values . iterator ( ) ; Object vl ; Binding binding ; while ( iter . hasNext ( ) ... | Evaluates the variable definitions as variable definitions can reference each other against the symbol table . The evaluation process updates the symbol table . |
121,905 | protected TrustManager [ ] getTrustManagers ( String keystoreType , String keystoreProvider , String algorithm ) throws Exception { KeyStore trustStore = getTrustStore ( keystoreType , keystoreProvider ) ; CertStore crlStore = null ; if ( crlLocation != null ) { crlStore = GlobusSSLHelper . findCRLStore ( ( String ) cr... | Create a Globus trust manager which supports proxy certificates . This requires that the CRL store and signing policy store be configured . |
121,906 | public static synchronized PortRange getTcpInstance ( ) { if ( tcpPortRange == null ) { tcpPortRange = new PortRange ( ) ; tcpPortRange . init ( CoGProperties . getDefault ( ) . getTcpPortRange ( ) ) ; } return tcpPortRange ; } | Returns PortRange instance for TCP listening sockets . If the tcp . port . range property is set the class will be initialized with the specified port ranges . |
121,907 | public static synchronized PortRange getTcpSourceInstance ( ) { if ( tcpSourcePortRange == null ) { tcpSourcePortRange = new PortRange ( ) ; tcpSourcePortRange . init ( CoGProperties . getDefault ( ) . getTcpSourcePortRange ( ) ) ; } return tcpSourcePortRange ; } | Returns PortRange instance for TCP source sockets . If the tcp . source . port . range property is set the class will be initialized with the specified port ranges . |
121,908 | public static synchronized PortRange getUdpSourceInstance ( ) { if ( udpSourcePortRange == null ) { udpSourcePortRange = new PortRange ( ) ; udpSourcePortRange . init ( CoGProperties . getDefault ( ) . getUdpSourcePortRange ( ) ) ; } return udpSourcePortRange ; } | Returns PortRange instance for UDP source sockets . If the udp . source . port . range property is set the class will be initialized with the specified port ranges . |
121,909 | public synchronized int getFreePort ( int lastPortNumber ) throws IOException { int id = 0 ; if ( lastPortNumber != 0 ) { id = lastPortNumber - minPort ; if ( id < 0 ) { throw new IOException ( "Port number out of range." ) ; } } for ( int i = id ; i < ports . length ; i ++ ) { if ( ports [ i ] == USED ) continue ; ret... | Returns first available port . |
121,910 | public void save ( OutputStream out ) throws IOException { try { cred . save ( out ) ; } catch ( CertificateEncodingException e ) { throw new ChainedIOException ( e . getMessage ( ) , e ) ; } } | Saves the credential into a specified output stream . The self - signed certificates in the certificate chain will not be saved . The output stream should always be closed after calling this function . |
121,911 | public ASN1Primitive toASN1Primitive ( ) { ASN1EncodableVector vec = new ASN1EncodableVector ( ) ; if ( this . pathLenConstraint != null ) { vec . add ( this . pathLenConstraint ) ; } vec . add ( this . proxyPolicy . toASN1Primitive ( ) ) ; return new DERSequence ( vec ) ; } | Returns the DER - encoded ASN . 1 representation of the extension . |
121,912 | public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { if ( ! requireSigningPolicyCheck ( certType ) ) { return ; } X500Principal caPrincipal = cert . getIssuerX500Principal ( ) ; SigningPolicy policy ; try { policy = this . policyStore . getSigningPoli... | Validate DN against the signing policy |
121,913 | private boolean requireSigningPolicyCheck ( GSIConstants . CertificateType certType ) { return ! ProxyCertificateUtil . isProxy ( certType ) && certType != GSIConstants . CertificateType . CA ; } | if a certificate is not a CA or if it is not a proxy return true . |
121,914 | public DataChannelReader getDataChannelSource ( TransferContext context ) throws Exception { String id = getHandlerID ( session . transferMode , session . transferType , SOURCE ) ; logger . debug ( "type/mode: " + id ) ; Class clazz = ( Class ) dataHandlers . get ( id ) ; if ( clazz == null ) { throw new Exception ( "N... | currently context is only needed in case of EBlock mode |
121,915 | public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { X500Principal certIssuer = cert . getIssuerX500Principal ( ) ; X509CRLSelector crlSelector = new X509CRLSelector ( ) ; crlSelector . addIssuer ( certIssuer ) ; Collection < ? extends CRL > crls ; if... | Method that checks the if the certificate is in a CRL if CRL is available If no CRL is found then no error is thrown If an expired CRL is found an error is thrown |
121,916 | public static ServerException embedFTPReplyParseException ( FTPReplyParseException rpe , String message ) { ServerException se = new ServerException ( WRONG_PROTOCOL , message ) ; se . setRootCause ( rpe ) ; return se ; } | Constructs server exception with FTPReplyParseException nested in it . |
121,917 | public static ServerException embedUnexpectedReplyCodeException ( UnexpectedReplyCodeException urce , String message ) { ServerException se = new ServerException ( SERVER_REFUSED , message ) ; se . setRootCause ( urce ) ; return se ; } | Constructs server exception with UnexpectedReplyCodeException nested in it . |
121,918 | public static synchronized I18n getI18n ( String resource ) { I18n instance = ( I18n ) mapping . get ( resource ) ; if ( instance == null ) { instance = new I18n ( ResourceBundle . getBundle ( resource , Locale . getDefault ( ) , getClassLoader ( ) ) ) ; mapping . put ( resource , instance ) ; } return instance ; } | Retrieve a I18n instance by resource name . |
121,919 | public String toFtpCmdArgument ( ) { if ( this . sporCommandParam == null && this . vector != null ) { StringBuffer cmd = new StringBuffer ( ) ; for ( int i = 0 ; i < this . vector . size ( ) ; i ++ ) { HostPort hp = ( HostPort ) this . vector . get ( i ) ; if ( i != 0 ) { cmd . append ( ' ' ) ; } cmd . append ( hp . t... | Returns the host - port infromation in the format used by SPOR command . |
121,920 | public synchronized void transferError ( Exception e ) { logger . debug ( "intercepted exception" , e ) ; if ( transferException == null ) { transferException = e ; } else if ( transferException instanceof InterruptedException || transferException instanceof InterruptedIOException ) { transferException = e ; } notifyAl... | this is called when an error occurs during transfer |
121,921 | public synchronized void waitForEnd ( ) throws ServerException , ClientException , IOException { try { while ( ! isDone ( ) && ! hasError ( ) ) { wait ( ) ; } } catch ( InterruptedException e ) { } checkError ( ) ; } | Blocks until the transfer is complete or the transfer fails . |
121,922 | public synchronized void waitForStart ( ) throws ServerException , ClientException , IOException { try { while ( ! isStarted ( ) && ! hasError ( ) ) { wait ( ) ; } } catch ( InterruptedException e ) { } checkError ( ) ; } | Blocks until the transfer begins or the transfer fails to start . |
121,923 | public void add ( ASN1ObjectIdentifier oid , String value ) { ASN1EncodableVector v = new ASN1EncodableVector ( ) ; v . add ( oid ) ; v . add ( new DERPrintableString ( value ) ) ; add ( new DERSet ( new DERSequence ( v ) ) ) ; } | Appends the specified OID and value pair name component to the end of the current name . |
121,924 | public void add ( ASN1Set entry ) { ASN1EncodableVector v = new ASN1EncodableVector ( ) ; int size = seq . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { v . add ( seq . getObjectAt ( i ) ) ; } v . add ( entry ) ; seq = new DERSequence ( v ) ; } | Appends the specified name component entry to the current name . This can be used to add handle multiple AVAs in one name component . |
121,925 | public static String GET ( String path , String host ) { return HTTPProtocol . createGETHeader ( "/" + path , host , USER_AGENT ) ; } | This method concatenates a properly formatted header for performing Globus Gass GETs with the given information . |
121,926 | public static String PUT ( String path , String host , long length , boolean append ) { String newPath = null ; if ( append ) { newPath = APPEND_URI + "/" + path ; } else { newPath = "/" + path ; } return HTTPProtocol . createPUTHeader ( newPath , host , USER_AGENT , TYPE , length , append ) ; } | This method concatenates a properly formatted header for performing Globus Gass PUTs with the given information . |
121,927 | public void close ( ) throws IOException { logger . debug ( "ftp socket closed" ) ; if ( ftpIn != null ) ftpIn . close ( ) ; if ( ftpOut != null ) ftpOut . close ( ) ; if ( socket != null ) socket . close ( ) ; hasBeenOpened = false ; } | Closes the control channel |
121,928 | public Reply read ( ) throws ServerException , IOException , FTPReplyParseException , EOFException { Reply reply = new Reply ( ftpIn ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Control channel received: " + reply ) ; } lastReply = reply ; return reply ; } | Block until a reply is available in the control channel . |
121,929 | public void write ( Command cmd ) throws IOException , IllegalArgumentException { if ( cmd == null ) { throw new IllegalArgumentException ( "null argument: cmd" ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Control channel sending: " + cmd ) ; } writeStr ( cmd . toString ( ) ) ; } | Sends the command over the control channel . Do not wait for reply . |
121,930 | public Reply exchange ( Command cmd ) throws ServerException , IOException , FTPReplyParseException { write ( cmd ) ; return read ( ) ; } | Write the command to the control channel block until reply arrives and return the reply . Before calling this method make sure that no old replies are waiting on the control channel . Otherwise the reply returned may not be the reply to this command . |
121,931 | public static Class getClassContextAt ( int i ) { Class [ ] classes = MANAGER . getClassContext ( ) ; if ( classes != null && classes . length > i ) { return classes [ i ] ; } return null ; } | Returns a class at specified depth of the current execution stack . |
121,932 | public static ClassLoader getClassLoaderContextAt ( int i ) { Class [ ] classes = MANAGER . getClassContext ( ) ; if ( classes != null && classes . length > i ) { return classes [ i ] . getClassLoader ( ) ; } return null ; } | Returns a classloader at specified depth of the current execution stack . |
121,933 | public static InputStream getResourceAsStream ( String name ) { ClassLoader loader = getClassLoaderContextAt ( 3 ) ; InputStream in = ( loader == null ) ? null : loader . getResourceAsStream ( name ) ; if ( in == null ) { ClassLoader contextLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contextL... | Gets an InputStream to a resource of a specified name . First the caller s classloader is used to load the resource and if it fails the thread s context classloader is used to load the resource . |
121,934 | public static Class forName ( String name ) throws ClassNotFoundException { ClassLoader loader = getClassLoaderContextAt ( 3 ) ; try { return Class . forName ( name , true , loader ) ; } catch ( ClassNotFoundException e ) { ClassLoader contextLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( contex... | Loads a specified class . First the caller s classloader is used to load the class and if it fails the thread s context classloader is used to load the specified class . |
121,935 | public void start ( String rmc ) throws GassException { if ( rmc == null ) { throw new IllegalArgumentException ( "Resource manager contact not specified" ) ; } GassServer gassServer = null ; String error = null ; try { gassServer = new GassServer ( this . cred , 0 ) ; String gassURL = gassServer . getURL ( ) ; String ... | Starts the gass server on the remote machine . |
121,936 | public boolean shutdown ( ) { if ( url != null ) { logger . debug ( "Trying to shutdown gass server directly..." ) ; try { GlobusURL u = new GlobusURL ( url ) ; GassServer . shutdown ( this . cred , u ) ; } catch ( Exception e ) { logger . debug ( "gass server shutdown failed" , e ) ; } try { gassJobListener . reset ( ... | Shutdowns remotely running gass server . |
121,937 | public static File createFile ( String filename ) throws SecurityException , IOException { File f = new File ( filename ) ; if ( ! f . createNewFile ( ) ) { if ( ! destroy ( f ) ) { throw new SecurityException ( "Could not destroy existing file" ) ; } if ( ! f . createNewFile ( ) ) { throw new SecurityException ( "Fail... | Attempts to create a new file in an atomic way . If the file already exists it if first deleted . |
121,938 | public static boolean destroy ( File file ) { if ( ! file . exists ( ) ) return false ; RandomAccessFile f = null ; long size = file . length ( ) ; try { f = new RandomAccessFile ( file , "rw" ) ; long rec = size / DMSG . length ( ) ; int left = ( int ) ( size - rec * DMSG . length ( ) ) ; while ( rec != 0 ) { f . writ... | Overwrites the contents of the file with a random string and then deletes the file . |
121,939 | public static String getInput ( String prompt ) { System . out . print ( prompt ) ; try { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; return in . readLine ( ) ; } catch ( IOException e ) { return null ; } } | Displays a prompt and then reads in the input from System . in . |
121,940 | public static String getPrivateInput ( String prompt ) { System . out . print ( prompt ) ; PrivateInputThread privateInput = new PrivateInputThread ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; privateInput . start ( ) ; try { return in . readLine ( ) ; } catch ( Exception e )... | Displays a prompt and then reads in private input from System . in . Characters typed by the user are replaced with a space on the screen . |
121,941 | public static String quote ( String str ) { int len = str . length ( ) ; StringBuffer buf = new StringBuffer ( len + 2 ) ; buf . append ( "\"" ) ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = str . charAt ( i ) ; if ( c == '"' || c == '\\' ) { buf . append ( "\\" ) ; } buf . append ( c ) ; } buf . append ( "\"" ) ... | Quotifies a specified string . The entire string is encompassed by double quotes and each is replaced with \ \ is replaced with \\ . |
121,942 | public static String unquote ( String str ) throws Exception { int len = str . length ( ) ; StringBuffer buf = new StringBuffer ( len ) ; boolean inQuotes = false ; char c ; int i = 0 ; if ( str . charAt ( i ) == '"' ) { inQuotes = true ; i ++ ; } while ( i < len ) { c = str . charAt ( i ) ; if ( inQuotes ) { if ( c ==... | Dequotifies a specified string . The quotes are removed and each \ is replaced with and each \\ is replaced with \ . |
121,943 | public X509Credential createCredential ( X509Certificate [ ] certs , PrivateKey privateKey , int bits , int lifetime , GSIConstants . CertificateType certType , X509ExtensionSet extSet , String cnValue ) throws GeneralSecurityException { X509Certificate [ ] bcCerts = getX509CertificateObjectChain ( certs ) ; KeyPairGen... | Creates a new proxy credential from the specified certificate chain and a private key . A set of X . 509 extensions can be optionally included in the new proxy certificate . This function automatically creates a RSA - based key pair . |
121,944 | public X509Certificate loadCertificate ( InputStream in ) throws IOException , GeneralSecurityException { ASN1InputStream derin = new ASN1InputStream ( in ) ; ASN1Primitive certInfo = derin . readObject ( ) ; ASN1Sequence seq = ASN1Sequence . getInstance ( certInfo ) ; return new X509CertificateObject ( Certificate . g... | Loads a X509 certificate from the specified input stream . Input stream must contain DER - encoded certificate . |
121,945 | public byte [ ] createCertificateRequest ( X509Name subjectDN , String sigAlgName , KeyPair keyPair ) throws GeneralSecurityException { DERSet attrs = null ; PKCS10CertificationRequest certReq = null ; certReq = new PKCS10CertificationRequest ( sigAlgName , subjectDN , keyPair . getPublic ( ) , attrs , keyPair . getPri... | Creates a certificate request from the specified subject name signing algorithm and a key pair . |
121,946 | public static GSIConstants . CertificateType decideProxyType ( X509Certificate issuerCert , GSIConstants . DelegationType delegType ) throws CertificateException { GSIConstants . CertificateType proxyType = GSIConstants . CertificateType . UNDEFINED ; if ( delegType == GSIConstants . DelegationType . LIMITED ) { GSICon... | Given a delegation mode and an issuing certificate decides an appropriate certificate type to use for proxies |
121,947 | public NameOpValue getParam ( String attribute ) { if ( _relations == null || attribute == null ) return null ; return ( NameOpValue ) _relations . get ( canonicalize ( attribute ) ) ; } | Returns the relation associated with the given attribute . |
121,948 | public Bindings removeBindings ( String attribute ) { if ( _relations == null || attribute == null ) return null ; return ( Bindings ) _bindings . remove ( canonicalize ( attribute ) ) ; } | Removes a bindings list for the specified attribute . |
121,949 | public void toRSL ( StringBuffer buf , boolean explicitConcat ) { Iterator iter ; buf . append ( getOperatorAsString ( ) ) ; if ( _bindings != null && _bindings . size ( ) > 0 ) { iter = _bindings . keySet ( ) . iterator ( ) ; Bindings binds ; while ( iter . hasNext ( ) ) { binds = getBindings ( ( String ) iter . next ... | Produces a RSL representation of node . |
121,950 | public String getSingle ( String attribute ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return null ; Object obj = nv . getFirstValue ( ) ; if ( obj != null && obj instanceof Value ) { return ( ( Value ) obj ) . getCompleteValue ( ) ; } else { ret... | Returns a string value of the specified attribute . If the attribute contains multiple values the first one is returned . |
121,951 | public List getMulti ( String attribute ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return null ; List values = nv . getValues ( ) ; List list = new LinkedList ( ) ; Iterator iter = values . iterator ( ) ; Object obj ; while ( iter . hasNext ( ) ... | Returns a list of strings for a specified attribute . For example for arguments attribute . |
121,952 | public void addVariable ( String attribute , String varName , String value ) { Bindings binds = rslTree . getBindings ( attribute ) ; if ( binds == null ) { binds = new Bindings ( attribute ) ; rslTree . put ( binds ) ; } binds . add ( new Binding ( varName , value ) ) ; } | Adds a new variable definition to the specified variable definitions attribute . |
121,953 | public boolean removeVariable ( String attribute , String varName ) { Bindings binds = rslTree . getBindings ( attribute ) ; if ( binds == null ) return false ; return binds . removeVariable ( varName ) ; } | Removes a specific variable definition given a variable name . |
121,954 | public boolean remove ( String attribute , String value ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return false ; return nv . remove ( new Value ( value ) ) ; } | Removes a specific value from a list of values of the specified attribute . |
121,955 | public boolean removeMap ( String attribute , String key ) { NameOpValue nv = rslTree . getParam ( attribute ) ; if ( nv == null || nv . getOperator ( ) != NameOpValue . EQ ) return false ; List values = nv . getValues ( ) ; Iterator iter = values . iterator ( ) ; Object obj ; int i = 0 ; int found = - 1 ; while ( iter... | Removes a specific key from a list of values of the specified attribute . The attribute values must be in the right form . See the environment rsl attribute . |
121,956 | public void add ( String attribute , String value ) { NameOpValue nv = getRelation ( attribute ) ; nv . add ( new Value ( value ) ) ; } | Adds a simple value to the list of values of a given attribute . |
121,957 | public void setMulti ( String attribute , String [ ] values ) { NameOpValue nv = getRelation ( attribute ) ; nv . clear ( ) ; List list = new LinkedList ( ) ; for ( int i = 0 ; i < values . length ; i ++ ) { list . add ( new Value ( values [ i ] ) ) ; } nv . add ( list ) ; } | Sets the attribute value to the given list of values . The list of values is added as a single value . |
121,958 | public void invoke ( X509Certificate cert , GSIConstants . CertificateType certType ) throws CertPathValidatorException { if ( proxyCertValidator . getIdentityCertificate ( ) == null ) { if ( ProxyCertificateUtil . isLimitedProxy ( certType ) ) { proxyCertValidator . setLimited ( true ) ; if ( proxyCertValidator . isRe... | Method that sets the identity of the certificate path . Also checks if limited proxy is acceptable . |
121,959 | private void notReflexive ( List < String > conditions , QueryNode node , QueryNode target ) { Validate . isTrue ( node != target , "notReflexive(...) implies that source " + "and target node are not the same, but someone is violating this constraint!" ) ; Validate . notNull ( node ) ; Validate . notNull ( target ) ; i... | Explicitly disallow reflexivity . |
121,960 | protected PreparedStatement executeSql ( String sql , MapSqlParameterSource args ) { Map < String , Object > parameters = args != null ? args . getValues ( ) : new HashMap < String , Object > ( ) ; for ( Map . Entry < String , Object > placeHolderEntry : parameters . entrySet ( ) ) { String key = placeHolderEntry . get... | executes an SQL string substituting the parameters found in args |
121,961 | private String readSqlFromResource ( Resource resource ) { try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( resource . getFile ( ) ) , "UTF-8" ) ) ; ) { StringBuilder sqlBuf = new StringBuilder ( ) ; for ( String line = reader . readLine ( ) ; line != null ; line = reader... | Reads the content from a resource into a string . |
121,962 | public static void toDNF ( LogicClause topNode ) { while ( makeDNF ( topNode ) == false ) { } cleanEmptyLeafs ( topNode ) ; flattenDNF ( topNode ) ; } | Transforms an AQL query to the Disjunctive Normal Form . |
121,963 | private static void flattenDNF ( LogicClause top ) { if ( top . getOp ( ) == LogicClause . Operator . LEAF || top . getOp ( ) == LogicClause . Operator . AND ) { List < LogicClause > children = new ArrayList < > ( ) ; findAllChildrenForOp ( top , children , LogicClause . Operator . AND ) ; List < ? extends Token > orgi... | Flatten the clause in the sense that there is only one toplevel OR layer and one layer of AND - clauses . |
121,964 | public List < Long > getDocumentsForMetadata ( QueryData queryData ) { List < Long > corpusList = queryData . getCorpusList ( ) ; if ( ! corpusList . isEmpty ( ) ) { List < QueryAnnotation > metaData = queryData . getMetaData ( ) ; if ( ! metaData . isEmpty ( ) ) { String documentsWithMetaDataSql = subQueryCorpusSelect... | Will query the database which documents are matching according to the given metadata |
121,965 | public void setQueryResultQueue ( BlockingQueue < SaltProject > queue , PagedResultQuery q , ArrayList < Match > allMatches ) { this . projectQueue = queue ; this . currentQuery = q ; this . numberOfResults = allMatches . size ( ) ; this . allMatches = allMatches ; paging . setPageSize ( q . getLimit ( ) , false ) ; pa... | Set a new querys in result panel . |
121,966 | public static Client createRESTClient ( String userName , String password ) { DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config ( ) ; rc . getClasses ( ) . add ( SaltProjectProvider . class ) ; ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager ( ) ; clientConnMgr . setDefa... | Creates an authentificiated REST client |
121,967 | public static List < Annotation > getMetaDataDoc ( String toplevelCorpusName , String documentName ) { List < Annotation > result = new ArrayList < Annotation > ( ) ; WebResource res = Helper . getAnnisWebResource ( ) ; try { res = res . path ( "meta" ) . path ( "doc" ) . path ( urlPathEscape . escape ( toplevelCorpusN... | Retrieve the meta data for a given document of a corpus . |
121,968 | public static CorpusConfig getCorpusConfig ( String corpus ) { if ( corpus == null || corpus . isEmpty ( ) ) { Notification . show ( "no corpus is selected" , "please select at leas one corpus and execute query again" , Notification . Type . WARNING_MESSAGE ) ; return null ; } CorpusConfig corpusConfig = new CorpusConf... | Loads the corpus config of a specific corpus . |
121,969 | public static CorpusConfigMap getCorpusConfigs ( ) { CorpusConfigMap corpusConfigurations = null ; try { corpusConfigurations = Helper . getAnnisWebResource ( ) . path ( "query" ) . path ( "corpora" ) . path ( "config" ) . get ( CorpusConfigMap . class ) ; } catch ( UniformInterfaceException | ClientHandlerException ex... | Loads the all available corpus configurations . |
121,970 | public static CorpusConfigMap getCorpusConfigs ( Set < String > corpora ) { CorpusConfigMap corpusConfigurations = new CorpusConfigMap ( ) ; for ( String corpus : corpora ) { corpusConfigurations . put ( corpus , getCorpusConfig ( corpus ) ) ; } corpusConfigurations . put ( DEFAULT_CONFIG , getDefaultCorpusConfig ( ) )... | Loads the available corpus configurations for a list of specific corpora . |
121,971 | public static Map < String , String > parseFragment ( String fragment ) { Map < String , String > result = new TreeMap < String , String > ( ) ; fragment = StringUtils . removeStart ( fragment , "!" ) ; String [ ] split = StringUtils . split ( fragment , "&" ) ; for ( String s : split ) { String [ ] parts = s . split (... | Parses the fragment . |
121,972 | public static String convertExceptionToMessage ( Throwable ex ) { StringBuilder sb = new StringBuilder ( ) ; if ( ex != null ) { sb . append ( "Exception type: " ) . append ( ex . getClass ( ) . getName ( ) ) . append ( "\n" ) ; sb . append ( "Message: " ) . append ( ex . getLocalizedMessage ( ) ) . append ( "\n" ) ; s... | Returns a formatted string containing the type of the exception the message and the stacktrace . |
121,973 | public static String encodePath ( String v ) { String encoded = urlPathEscape . escape ( v ) ; return encoded ; } | Encodes a String so it can be used as path param . |
121,974 | public static String encodeQueryParam ( String v ) { String encoded = UrlEscapers . urlFormParameterEscaper ( ) . escape ( v ) ; return encoded ; } | Encodes a String so it can be used as query param . |
121,975 | public void writeOutput ( VisualizerInput input , OutputStream outstream ) { try { OutputStreamWriter writer = new OutputStreamWriter ( outstream , getCharacterEncoding ( ) ) ; writeOutput ( input , writer ) ; writer . flush ( ) ; } catch ( IOException ex ) { log . error ( "Exception when writing visualizer output." , ... | Will create a Writer of the outstream . |
121,976 | private static Set < String > getRelationLevelSet ( SDocumentGraph graph , String namespace , Class < ? extends SRelation > type ) { Set < String > result = new TreeSet < > ( ) ; if ( graph != null ) { List < ? extends SRelation > edges = null ; if ( type == SDominanceRelation . class ) { edges = graph . getDominanceRe... | Get the qualified name of all annotations belonging to relations having a specific namespace . |
121,977 | public boolean includeNode ( SNode node ) { if ( node instanceof SToken || configurations . get ( 0 ) == null ) { return true ; } Set < SAnnotation > nodeAnnotations = node . getAnnotations ( ) ; return includeObject ( nodeAnnotations , displayedNodeAnnotations ) ; } | Implements the includeNode method of the org . corpus_tools . salt . util . ExportFilter interface . |
121,978 | public boolean includeRelation ( SRelation relation ) { Map < String , Set < String > > displayedRelAnnotations = new HashMap < String , Set < String > > ( ) ; if ( relation instanceof SPointingRelation ) { if ( configurations . get ( 1 ) == null ) { return true ; } else { displayedRelAnnotations = displayedPointingRel... | Implements the includeRelation method of the org . corpus_tools . salt . util . ExportFilter interface . |
121,979 | public static boolean containsRTLText ( String str ) { if ( str != null ) { for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char cc = str . charAt ( i ) ; if ( cc >= 1425 && cc <= 1785 ) { return true ; } else if ( cc >= 64286 && cc <= 65019 ) { return true ; } else if ( cc >= 65136 && cc <= 65276 ) { return true ; }... | Detects arabic characters in a string . |
121,980 | public static String getSafeFileName ( String orig ) { if ( orig != null ) { return orig . replaceAll ( "[^0-9A-Za-z-]" , "_" ) ; } else { return UUID . randomUUID ( ) . toString ( ) ; } } | Returns a file name that is safe to use and does not have any invalid characters . |
121,981 | public static Set < String > getToplevelCorpusNames ( SaltProject p ) { Set < String > names = new HashSet < > ( ) ; if ( p != null && p . getCorpusGraphs ( ) != null ) { for ( SCorpusGraph g : p . getCorpusGraphs ( ) ) { if ( g . getRoots ( ) != null ) { for ( SNode c : g . getRoots ( ) ) { names . add ( c . getName (... | Gets all names of a corpus from a salt project . |
121,982 | public static < V > Map < SNode , V > createSNodeMapFromIDs ( Map < String , V > map , SDocumentGraph graph ) { HashMap < SNode , V > result = new LinkedHashMap < > ( ) ; if ( map != null && graph != null ) { for ( Map . Entry < String , V > e : map . entrySet ( ) ) { SNode n = graph . getNode ( e . getKey ( ) ) ; if (... | Takes a map of salt node IDs to a value and return a new map that uses the SNodes as keys instead of the IDs . |
121,983 | public static LinkedHashMap < String , ArrayList < Row > > parseSalt ( VisualizerInput input , boolean showSpanAnnos , boolean showTokenAnnos , List < String > annotationNames , Set < String > mediaLayer , boolean replaceValueWithMediaIcon , long startTokenIndex , long endTokenIndex , PDFController pdfController , STex... | Converts Salt document graph to rows . |
121,984 | public static Set < String > computeDisplayedNamespace ( VisualizerInput input , List < Class < ? extends SNode > > types ) { if ( input == null ) { return new HashSet < > ( ) ; } String showNamespaceConfig = input . getMappings ( ) . getProperty ( GridComponent . MAPPING_SHOW_NAMESPACE ) ; if ( showNamespaceConfig != ... | Returns the annotations to which should be displayed together with their namespace . |
121,985 | private static Set < String > getAnnotationLevelSet ( SDocumentGraph graph , String namespace , Class < ? extends SNode > type ) { Set < String > result = new TreeSet < > ( ) ; if ( graph != null ) { List < ? extends SNode > nodes ; if ( SSpan . class == type ) { nodes = graph . getSpans ( ) ; } else if ( SToken . clas... | Get the qualified name of all annotations belonging to spans having a specific namespace . |
121,986 | private static void sortEventsByTokenIndex ( Row row ) { Collections . sort ( row . getEvents ( ) , new Comparator < GridEvent > ( ) { public int compare ( GridEvent o1 , GridEvent o2 ) { if ( o1 == o2 ) { return 0 ; } if ( o1 == null ) { return - 1 ; } if ( o2 == null ) { return + 1 ; } return Integer . compare ( o1 .... | Sort events of a row . The sorting is depending on the left value of the event |
121,987 | private static void splitRowsOnIslands ( Row row , final SDocumentGraph graph , STextualDS text , long startTokenIndex , long endTokenIndex ) { BitSet tokenCoverage = new BitSet ( ) ; List < SToken > sortedTokenList = graph . getSortedTokenByText ( ) ; ListIterator < SToken > itToken = sortedTokenList . listIterator ( ... | Splits events of a row if they overlap an island . Islands are areas between the token which are included in the result . |
121,988 | private String getText ( SNode node , VisualizerInput input ) { SDocumentGraph sDocumentGraph = input . getSResult ( ) . getDocumentGraph ( ) ; List < DataSourceSequence > sequences = sDocumentGraph . getOverlappedDataSourceSequence ( node , SALT_TYPE . STEXT_OVERLAPPING_RELATION ) ; if ( sequences != null && sequences... | Get the text which is overlapped by the SNode . |
121,989 | private void addLoginButton ( ) { VaadinSession session = VaadinSession . getCurrent ( ) ; if ( session != null ) { boolean kickstarter = Helper . isKickstarter ( session ) ; if ( ! kickstarter ) { addComponent ( lblUserName ) ; setComponentAlignment ( lblUserName , Alignment . MIDDLE_RIGHT ) ; addComponent ( btLogin )... | Adds the login button + login text to the toolbar . This is only happened when the gui is not started via the kickstarter . |
121,990 | public void addAnnotationConditions ( Collection < String > conditions , int index , QueryAnnotation annotation , String table , TableAccessStrategy tas ) { TextMatching tm = annotation . getTextMatching ( ) ; String column = annotation . getNamespace ( ) == null ? "annotext" : "qannotext" ; Escaper escaper = tm != nul... | Adds annotation conditions for a single node . |
121,991 | public static FrequencyTableEntry parse ( String definition ) { List < String > splitted = Splitter . on ( ':' ) . trimResults ( ) . omitEmptyStrings ( ) . limit ( 2 ) . splitToList ( definition ) ; if ( splitted . size ( ) == 2 ) { FrequencyTableEntry entry = new FrequencyTableEntry ( ) ; if ( "meta" . equals ( splitt... | A constructor that takes the raw definition as argument . |
121,992 | private void updateAutoGeneratedQueriesPanel ( ) { Set < String > corpora = new HashSet < > ( ui . getQueryState ( ) . getSelectedCorpora ( ) . getValue ( ) ) ; if ( corpora . isEmpty ( ) ) { corpora . addAll ( ui . getQueryState ( ) . getAvailableCorpora ( ) . getItemIds ( ) ) ; } autoGenQueries . setSelectedCorpusInB... | Updates or initializes the panel which holds the automatic generated queries . |
121,993 | protected boolean existConflictingTopLevelCorpus ( String topLevelCorpusName ) { String sql = "SELECT count(name) as amount FROM corpus WHERE top_level=true AND name='" + topLevelCorpusName + "'" ; Integer numberOfCorpora = getJdbcTemplate ( ) . query ( sql , new ResultSetExtractor < Integer > ( ) { public Integer extr... | Checks if there already exists a top level corpus . |
121,994 | protected void closeAllConnections ( String databasename ) { String sql = "SELECT pg_terminate_backend(pg_stat_activity.pid)\n" + "FROM pg_stat_activity\n" + "WHERE pg_stat_activity.datname = ?\n" + " AND pid <> pg_backend_pid();" ; try ( Connection conn = getDataSource ( ) . getConnection ( ) ) { DatabaseMetaData met... | Closes all open idle connections . The current data source must have superuser rights . |
121,995 | private String getText ( SToken currNode ) { List < DataSourceSequence > sSequences = ( ( SDocumentGraph ) currNode . getGraph ( ) ) . getOverlappedDataSourceSequence ( currNode , SALT_TYPE . STEXT_OVERLAPPING_RELATION ) ; if ( sSequences == null || sSequences . size ( ) != 1 ) { log . error ( "rst supports only one te... | Gets the overlapping token as string from a node which are direct dominated by this node . |
121,996 | private String getHTMLColor ( SToken token ) { if ( ! markedAndCovered . containsKey ( token ) ) { return null ; } int color = ( int ) ( long ) markedAndCovered . get ( token ) ; color = Math . min ( color > 0 ? color - 1 : color , MatchedNodeColors . values ( ) . length - 1 ) ; return MatchedNodeColors . values ( ) [ ... | Checks if a specific token is marked as matching token and returns a HTML color string . |
121,997 | private boolean isSegment ( SNode currNode ) { List < SRelation < SNode , SNode > > edges = currNode . getGraph ( ) . getOutRelations ( currNode . getId ( ) ) ; if ( edges != null && edges . size ( ) > 0 ) { for ( SRelation < SNode , SNode > edge : edges ) { if ( edge . getTarget ( ) instanceof SToken ) { return true ;... | Checks if there exists an SRelation which targets a SToken . |
121,998 | private void sortChildren ( JSONObject root ) throws JSONException { JSONArray children = root . getJSONArray ( "children" ) ; List < JSONObject > childrenSorted = new ArrayList < JSONObject > ( children . length ( ) ) ; for ( int i = 0 ; i < children . length ( ) ; i ++ ) { childrenSorted . add ( children . getJSONObj... | Sorts the children of root by the the sentence indizes . Since the sentence indizes are based on the token indizes some sentences have no sentences indizes because sometimes token nodes are out of context . |
121,999 | public void shutdown ( ) { log . info ( "Shutting down..." ) ; isShutdownRequested = true ; try { mainThread . join ( ) ; } catch ( InterruptedException e ) { log . error ( "Interrupted which waiting on main daemon thread to complete." ) ; } } | shutdown the AnnisService - ensure that current work load finishes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.