signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class JndiTreeParser { /** * create actual children
* @ param sibling
* @ return */
private boolean createChild ( Property sibling , String parentURI ) { } } | boolean skipped = sibling . getName ( ) . equals ( "children" ) ; if ( ! skipped ) { // dump ( sibling ) ;
String dataType = null ; String uri = "" ; if ( sibling . getValue ( ) . hasDefined ( "class-name" ) ) { dataType = sibling . getValue ( ) . get ( "class-name" ) . asString ( ) ; uri = parentURI + "/" + sibling . getName ( ) ; int idx = uri . indexOf ( ':' ) ; if ( idx > 0 ) { int idx2 = uri . lastIndexOf ( '/' , idx ) ; if ( idx2 >= 0 && ( idx2 + 1 ) < uri . length ( ) ) uri = uri . substring ( idx2 + 1 ) ; } } JndiEntry next = new JndiEntry ( sibling . getName ( ) , uri , dataType ) ; if ( sibling . getValue ( ) . hasDefined ( "value" ) ) next . setValue ( sibling . getValue ( ) . get ( "value" ) . asString ( ) ) ; stack . peek ( ) . getChildren ( ) . add ( next ) ; stack . push ( next ) ; } return skipped ; |
public class Results { /** * Generates a new result with the status set to { @ literal 500 - INTERNAL SERVER ERROR } and a JSON - form of the
* given exception as content . The { @ literal Content - Type } header is set to { @ literal application / json } .
* @ param e the exception
* @ return the new result */
public static Result internalServerError ( Throwable e ) { } } | return status ( Result . INTERNAL_SERVER_ERROR ) . render ( e ) . as ( MimeTypes . JSON ) ; |
public class NodeReadTrx { /** * { @ inheritDoc } */
@ Override public final boolean moveToAttribute ( final int mIndex ) throws TTIOException { } } | checkState ( ! mPageReadTrx . isClosed ( ) , "Transaction is already closed." ) ; if ( mCurrentNode . getKind ( ) == IConstants . ELEMENT ) { return moveTo ( ( ( ElementNode ) mCurrentNode ) . getAttributeKey ( mIndex ) ) ; } else { return false ; } |
public class DefaultSentryClientFactory { /** * Tags to extract from the MDC system and set on { @ link io . sentry . event . Event } s , where applicable .
* @ param dsn Sentry server DSN which may contain options .
* @ return Tags to extract from the MDC system and set on { @ link io . sentry . event . Event } s , where applicable . */
protected Set < String > getMdcTags ( Dsn dsn ) { } } | String val = Lookup . lookup ( MDCTAGS_OPTION , dsn ) ; if ( Util . isNullOrEmpty ( val ) ) { val = Lookup . lookup ( EXTRATAGS_OPTION , dsn ) ; if ( ! Util . isNullOrEmpty ( val ) ) { logger . warn ( "The '" + EXTRATAGS_OPTION + "' option is deprecated, please use" + " the '" + MDCTAGS_OPTION + "' option instead." ) ; } } return Util . parseMdcTags ( val ) ; |
public class IntArrayList { /** * Returns an array containing all of the values in this list in
* proper sequence ( from first to last value ) . If the list fits
* in the specified array , it is returned therein . Otherwise , a new
* array is allocated with the size of this list .
* @ param dest the array into which the values of the list are to
* be stored , if it is big enough ; otherwise , a new array is allocated
* for this purpose .
* @ return an array containing the values of the list */
public int [ ] toArray ( int [ ] dest ) { } } | if ( dest == null || dest . length < size ( ) ) { dest = new int [ size ] ; } System . arraycopy ( data , 0 , dest , 0 , size ) ; return dest ; |
public class BaseRegistrationScreen { /** * A record with this datasource handle changed , notify any behaviors that are checking .
* NOTE : Be very careful as this code is running in an independent thread
* ( synchronize to the task before calling record calls ) .
* NOTE : For now , you are only notified of the main record changes .
* @ param message The message to handle .
* @ return The error code . */
public int handleMessage ( BaseMessage message ) { } } | if ( message != null ) if ( message . getMessageHeader ( ) . getRegistryIDMatch ( ) != null ) // My private message
{ strMessage = ( String ) message . get ( StandardMessageResponseData . MESSAGE ) ; synchronized ( this ) { waiting = false ; this . notify ( ) ; } } return super . handleMessage ( message ) ; |
public class Iterators { /** * Combines multiple iterators into a single iterator . The returned iterator
* iterates across the elements of each iterator in { @ code inputs } . The input
* iterators are not polled until necessary .
* < p > The returned iterator supports { @ code remove ( ) } when the corresponding
* input iterator supports it . The methods of the returned iterator may throw
* { @ code NullPointerException } if any of the input iterators is null .
* < p > < b > Note : < / b > the current implementation is not suitable for nested
* concatenated iterators , i . e . the following should be avoided when in a loop :
* { @ code iterator = Iterators . concat ( iterator , suffix ) ; } , since iteration over the
* resulting iterator has a cubic complexity to the depth of the nesting . */
public static < T > Iterator < T > concat ( final Iterator < ? extends Iterator < ? extends T > > inputs ) { } } | checkNotNull ( inputs ) ; return new Iterator < T > ( ) { Iterator < ? extends T > current = emptyIterator ( ) ; Iterator < ? extends T > removeFrom ; @ Override public boolean hasNext ( ) { // http : / / code . google . com / p / google - collections / issues / detail ? id = 151
// current . hasNext ( ) might be relatively expensive , worth minimizing .
boolean currentHasNext ; // checkNotNull eager for GWT
// note : it must be here & not where ' current ' is assigned ,
// because otherwise we ' ll have called inputs . next ( ) before throwing
// the first NPE , and the next time around we ' ll call inputs . next ( )
// again , incorrectly moving beyond the error .
while ( ! ( currentHasNext = checkNotNull ( current ) . hasNext ( ) ) && inputs . hasNext ( ) ) { current = inputs . next ( ) ; } return currentHasNext ; } @ Override public T next ( ) { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( ) ; } removeFrom = current ; return current . next ( ) ; } @ Override public void remove ( ) { checkRemove ( removeFrom != null ) ; removeFrom . remove ( ) ; removeFrom = null ; } } ; |
public class ReUtil { /** * 从字符串中获得第一个整数
* @ param StringWithNumber 带数字的字符串
* @ return 整数 */
public static Integer getFirstNumber ( CharSequence StringWithNumber ) { } } | return Convert . toInt ( get ( PatternPool . NUMBERS , StringWithNumber , 0 ) , null ) ; |
public class Dist { /** * Activates pipe that have previously reached high watermark . */
public void activated ( Pipe pipe ) { } } | // Move the pipe from passive to eligible state .
Collections . swap ( pipes , pipes . indexOf ( pipe ) , eligible ) ; eligible ++ ; // If there ' s no message being sent at the moment , move it to
// the active state .
if ( ! more ) { Collections . swap ( pipes , eligible - 1 , active ) ; active ++ ; } |
public class CanonicalKieModule { /** * Delegate methods */
@ Override public void cacheKnowledgeBuilderForKieBase ( String kieBaseName , KnowledgeBuilder kbuilder ) { } } | internalKieModule . cacheKnowledgeBuilderForKieBase ( kieBaseName , kbuilder ) ; |
public class Concept { /** * indexed getter for mentions - gets an indexed value -
* @ generated
* @ param i index in the array to get
* @ return value of the element at index i */
public Annotation getMentions ( int i ) { } } | if ( Concept_Type . featOkTst && ( ( Concept_Type ) jcasType ) . casFeat_mentions == null ) jcasType . jcas . throwFeatMissing ( "mentions" , "de.julielab.jules.types.Concept" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Concept_Type ) jcasType ) . casFeatCode_mentions ) , i ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Concept_Type ) jcasType ) . casFeatCode_mentions ) , i ) ) ) ; |
public class DVWordsiMain { /** * { @ inheritDoc } */
protected ContextExtractor getExtractor ( ) { } } | DependencyContextGenerator generator = getContextGenerator ( ) ; // Set to read only if in evaluation mode .
if ( argOptions . hasOption ( 'e' ) ) generator . setReadOnly ( true ) ; // If the evaluation type is for semEval , use a
// SemEvalDependencyContextExtractor .
if ( argOptions . hasOption ( 'E' ) ) return new SemEvalDependencyContextExtractor ( new CoNLLDependencyExtractor ( ) , generator ) ; // If the evaluation type is for pseudoWord , use a
// PseudoWordDependencyContextExtractor .
if ( argOptions . hasOption ( 'P' ) ) return new PseudoWordDependencyContextExtractor ( new CoNLLDependencyExtractor ( ) , generator , getPseudoWordMap ( ) ) ; // Otherwise return the normal extractor .
return new DependencyContextExtractor ( new CoNLLDependencyExtractor ( ) , generator , argOptions . hasOption ( 'h' ) ) ; |
public class TransactionException { /** * Thrown when there exists and instance of { @ code type } HAS { @ code attributeType } upon unlinking the AttributeType from the Type */
public static TransactionException illegalUnhasInherited ( String type , String attributeType , boolean isKey ) { } } | return create ( ErrorMessage . ILLEGAL_TYPE_UNHAS_ATTRIBUTE_INHERITED . getMessage ( type , isKey ? "key" : "has" , attributeType ) ) ; |
public class CompletableFuture { /** * Returns raw result after waiting , or null if interruptible and
* interrupted . */
private Object waitingGet ( boolean interruptible ) { } } | Signaller q = null ; boolean queued = false ; int spins = SPINS ; Object r ; while ( ( r = result ) == null ) { if ( spins > 0 ) { if ( ThreadLocalRandom . nextSecondarySeed ( ) >= 0 ) -- spins ; } else if ( q == null ) q = new Signaller ( interruptible , 0L , 0L ) ; else if ( ! queued ) queued = tryPushStack ( q ) ; else { try { ForkJoinPool . managedBlock ( q ) ; } catch ( InterruptedException ie ) { // currently cannot happen
q . interrupted = true ; } if ( q . interrupted && interruptible ) break ; } } if ( q != null ) { q . thread = null ; if ( q . interrupted ) { if ( interruptible ) cleanStack ( ) ; else Thread . currentThread ( ) . interrupt ( ) ; } } if ( r != null ) postComplete ( ) ; return r ; |
public class FileOutStream { /** * Schedules the async persistence of the current file . */
protected void scheduleAsyncPersist ( ) throws IOException { } } | try ( CloseableResource < FileSystemMasterClient > masterClient = mContext . acquireMasterClientResource ( ) ) { ScheduleAsyncPersistencePOptions persistOptions = FileSystemOptions . scheduleAsyncPersistDefaults ( mContext . getPathConf ( mUri ) ) . toBuilder ( ) . setCommonOptions ( mOptions . getCommonOptions ( ) ) . build ( ) ; masterClient . get ( ) . scheduleAsyncPersist ( mUri , persistOptions ) ; } |
public class Messenger { /** * Sending activation code
* @ param code activation code
* @ return Command for execution */
@ NotNull @ ObjectiveCName ( "validateCodeCommand:" ) public Command < AuthState > validateCode ( final String code ) { } } | return modules . getAuthModule ( ) . requestValidateCode ( code ) ; |
public class GeometryIndexService { /** * Given a certain index , find the next vertex in line .
* @ param index
* The index to start out from . Must point to either a vertex or and edge .
* @ return Returns the next vertex index . Note that no geometry is given , and so no actual checking is done . It just
* returns the theoretical answer . */
public GeometryIndex getNextVertex ( GeometryIndex index ) { } } | if ( index . hasChild ( ) ) { return new GeometryIndex ( index . getType ( ) , index . getValue ( ) , getNextVertex ( index . getChild ( ) ) ) ; } else { return new GeometryIndex ( GeometryIndexType . TYPE_VERTEX , index . getValue ( ) + 1 , null ) ; } |
public class ComponentFinder { /** * Finds the current { @ link AjaxRequestTarget } or creates a new ajax request target from the
* given application and page if the current { @ link AjaxRequestTarget } is null .
* @ param application
* the web application
* @ param page
* page on which ajax response is made
* @ return an AjaxRequestTarget instance
* @ see WebApplication # newAjaxRequestTarget ( Page ) */
public static AjaxRequestTarget findOrCreateNewAjaxRequestTarget ( final WebApplication application , final Page page ) { } } | final AjaxRequestTarget target = findAjaxRequestTarget ( ) ; if ( target != null ) { return target ; } return newAjaxRequestTarget ( application , page ) ; |
public class ReflectionServer { /** * Start the server on the port set in the constructor , this method behaves as
* follows :
* < ul >
* < li > Start server socket on the assigned port number < / li >
* < li > starts accepting clients connection < / li >
* < li > for every client connection received , handleClient method will be called
* < / ul > */
public void start ( ) { } } | this . logger . info ( "starting reflection server on port : " + this . port ) ; try { this . server = new ServerSocket ( this . port ) ; while ( ! this . stopped ) { this . logger . info ( "Reflection server waiting client connection..." ) ; this . waitingClient = true ; final Socket client = this . server . accept ( ) ; this . waitingClient = false ; this . logger . info ( "handling client connection request to reflection server..." ) ; handleClient ( client ) ; } } catch ( final Exception e ) { if ( e instanceof RuntimeException ) { throw ( RuntimeException ) e ; } if ( e instanceof SocketException && e . getMessage ( ) . equals ( "socket closed" ) ) { // it is safe to eat the exception since it most likely caused
// by calling the stop method
} else { throw new RemoteReflectionException ( e ) ; } } finally { if ( this . server != null && ! this . server . isClosed ( ) ) { try { this . server . close ( ) ; } catch ( final IOException e ) { throw new RemoteReflectionException ( e ) ; } } } |
public class AmazonGlacierClient { /** * This operation initiates a job of the specified type , which can be a select , an archival retrieval , or a vault
* retrieval . For more information about using this operation , see the documentation for the underlying REST API < a
* href = " http : / / docs . aws . amazon . com / amazonglacier / latest / dev / api - initiate - job - post . html " > Initiate a Job < / a > .
* @ param initiateJobRequest
* Provides options for initiating an Amazon Glacier job .
* @ return Result of the InitiateJob operation returned by the service .
* @ throws ResourceNotFoundException
* Returned if the specified resource ( such as a vault , upload ID , or job ID ) doesn ' t exist .
* @ throws PolicyEnforcedException
* Returned if a retrieval job would exceed the current data policy ' s retrieval rate limit . For more
* information about data retrieval policies ,
* @ throws InvalidParameterValueException
* Returned if a parameter of the request is incorrectly specified .
* @ throws MissingParameterValueException
* Returned if a required header or parameter is missing from the request .
* @ throws InsufficientCapacityException
* Returned if there is insufficient capacity to process this expedited request . This error only applies to
* expedited retrievals and not to standard or bulk retrievals .
* @ throws ServiceUnavailableException
* Returned if the service cannot complete the request .
* @ sample AmazonGlacier . InitiateJob */
@ Override public InitiateJobResult initiateJob ( InitiateJobRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeInitiateJob ( request ) ; |
public class HtmlStreamRenderer { /** * Factory .
* @ param output the buffer to which HTML is streamed .
* @ param badHtmlHandler receives alerts when HTML cannot be rendered because
* there is not valid HTML tree that results from that series of calls .
* E . g . it is not possible to create an HTML { @ code < style > } element whose
* textual content is { @ code " < / style > " } . */
public static HtmlStreamRenderer create ( StringBuilder output , Handler < ? super String > badHtmlHandler ) { } } | // Propagate since StringBuilder should not throw IOExceptions .
return create ( output , Handler . PROPAGATE , badHtmlHandler ) ; |
public class StandardSiteSwitcherHandlerFactory { /** * Creates a site switcher that redirects to a custom domain for normal site requests that either
* originate from a mobile device or indicate a mobile site preference .
* Uses a { @ link CookieSitePreferenceRepository } that saves a cookie that is shared between the two domains .
* @ param normalServerName the ' normal ' domain name e . g . " normal . com "
* @ param mobileServerName the ' mobile domain name e . g . " mobile . com "
* @ param tabletServerName the ' tablet ' domain name e . g . " tablet . com "
* @ param cookieDomain the name to use for saving the cookie
* @ see # standard ( String , String , String )
* @ see # standard ( String , String , String , Boolean )
* @ see StandardSiteUrlFactory */
public static SiteSwitcherHandler standard ( String normalServerName , String mobileServerName , String tabletServerName , String cookieDomain ) { } } | return new StandardSiteSwitcherHandler ( new StandardSiteUrlFactory ( normalServerName ) , new StandardSiteUrlFactory ( mobileServerName ) , new StandardSiteUrlFactory ( tabletServerName ) , new StandardSitePreferenceHandler ( new CookieSitePreferenceRepository ( cookieDomain ) ) , null ) ; |
public class LeaseManager { /** * Remove the lease for the specified holder and src */
synchronized void removeLease ( String holder , String src ) { } } | Lease lease = getLease ( holder ) ; if ( lease != null ) { removeLease ( lease , src ) ; } |
public class Route { /** * contentRelatedTo ( For reporting ) list routes that will end up at a specific Code
* @ return */
public String contentRelatedTo ( HttpCode < TRANS , ? > code ) { } } | StringBuilder sb = new StringBuilder ( path ) ; sb . append ( ' ' ) ; content . relatedTo ( code , sb ) ; return sb . toString ( ) ; |
public class LambdaResource { /** * The array of ARNs for < a > S3Resource < / a > objects to trigger the < a > LambdaResource < / a > objects associated with this
* job .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setEventTriggers ( java . util . Collection ) } or { @ link # withEventTriggers ( java . util . Collection ) } if you want
* to override the existing values .
* @ param eventTriggers
* The array of ARNs for < a > S3Resource < / a > objects to trigger the < a > LambdaResource < / a > objects associated
* with this job .
* @ return Returns a reference to this object so that method calls can be chained together . */
public LambdaResource withEventTriggers ( EventTriggerDefinition ... eventTriggers ) { } } | if ( this . eventTriggers == null ) { setEventTriggers ( new java . util . ArrayList < EventTriggerDefinition > ( eventTriggers . length ) ) ; } for ( EventTriggerDefinition ele : eventTriggers ) { this . eventTriggers . add ( ele ) ; } return this ; |
public class UUID { /** * 返回指定长度随机数字 + 字母 ( 大小写敏感 ) 组成的字符串
* @ param length 指定长度
* @ param caseSensitivity 是否区分大小写
* @ return 随机字符串 */
public static String captchaChar ( int length , boolean caseSensitivity ) { } } | StringBuilder sb = new StringBuilder ( ) ; Random rand = new Random ( ) ; // 随机用以下三个随机生成器
Random randdata = new Random ( ) ; int data = 0 ; for ( int i = 0 ; i < length ; i ++ ) { int index = rand . nextInt ( caseSensitivity ? 3 : 2 ) ; // 目的是随机选择生成数字 , 大小写字母
switch ( index ) { case 0 : data = randdata . nextInt ( 10 ) ; // 仅仅会生成0 ~ 9 , 0 ~ 9的ASCII为48 ~ 57
sb . append ( data ) ; break ; case 1 : data = randdata . nextInt ( 26 ) + 97 ; // 保证只会产生ASCII为97 ~ 122 ( a - z ) 之间的整数 ,
sb . append ( ( char ) data ) ; break ; case 2 : // caseSensitivity为true的时候 , 才会有大写字母
data = randdata . nextInt ( 26 ) + 65 ; // 保证只会产生ASCII为65 ~ 90 ( A ~ Z ) 之间的整数
sb . append ( ( char ) data ) ; break ; default : break ; } } return sb . toString ( ) ; |
public class Tailer { /** * 预读取行
* @ throws IOException */
private void readTail ( ) throws IOException { } } | final long len = this . randomAccessFile . length ( ) ; if ( initReadLine > 0 ) { long start = this . randomAccessFile . getFilePointer ( ) ; long nextEnd = len - 1 ; this . randomAccessFile . seek ( nextEnd ) ; int c ; int currentLine = 0 ; while ( nextEnd > start ) { if ( currentLine > initReadLine ) { break ; } c = this . randomAccessFile . read ( ) ; if ( c == CharUtil . LF || c == CharUtil . CR ) { FileUtil . readLine ( this . randomAccessFile , this . charset , this . lineHandler ) ; currentLine ++ ; nextEnd -- ; } nextEnd -- ; this . randomAccessFile . seek ( nextEnd ) ; if ( nextEnd == 0 ) { // 当文件指针退至文件开始处 , 输出第一行
FileUtil . readLine ( this . randomAccessFile , this . charset , this . lineHandler ) ; break ; } } } // 将指针置于末尾
try { this . randomAccessFile . seek ( len ) ; } catch ( IOException e ) { throw new IORuntimeException ( e ) ; } |
public class RuleFlowMigrator { /** * Converts the contents of the given Reader into a string .
* WARNING : the given string is not reset ( as not all
* readers support reset ) . Consequently , anny further
* attempt to read from the given reader will return nothing ,
* unless you reset the reader .
* @ param reader
* @ return he contents of the given Reader into a string .
* @ throws IOException */
public static String convertReaderToString ( Reader reader ) throws IOException { } } | final StringBuilder text = new StringBuilder ( ) ; final char [ ] buf = new char [ 1024 ] ; int len = 0 ; while ( ( len = reader . read ( buf ) ) >= 0 ) { text . append ( buf , 0 , len ) ; } return text . toString ( ) ; |
public class Ldap { /** * Indicates the attribute or attributes by which to sort query results . Use a comma [ , ] to separate
* attributes .
* @ param sort The sort to set .
* @ throws PageException */
public void setSort ( String sort ) throws PageException { } } | this . sort = ArrayUtil . trim ( ListUtil . toStringArray ( ListUtil . listToArrayRemoveEmpty ( sort , ',' ) ) ) ; |
public class LBiFltConsumerBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LBiFltConsumer biFltConsumerFrom ( Consumer < LBiFltConsumerBuilder > buildingFunction ) { } } | LBiFltConsumerBuilder builder = new LBiFltConsumerBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class Blob { /** * Serialisiert das Objekt in den übergebenen OutputStream . Zunächst wird der Header ( Type , Kompressions und Länge )
* in den Stream geschrieben . Anschließen der Content des Blobs , ggf . komprimiert . < br / >
* < br / >
* Der OutputStream wird am Ende der Operation geschlossen . Die geschriebenen Bytes werden gehasht und der Hash in
* der Id des Blobs gespeichert . Da der InputStream gelesen wird , kann diese Methode nur ein Mal aufgerufen werden .
* @ param outputStream
* Ziel der Serialisierung
* @ throws UnsupportedOperationException
* falls der InputStream des Blobs bereits eingelesen wurde .
* @ throws IOException */
public void writeToStream ( OutputStream outputStream ) throws IOException { } } | if ( exhausted ) { throw new UnsupportedOperationException ( "Der Content-InputStream des Blobs wurde bereits einmal gelesen" ) ; } MessageDigest digest = getDigest ( ) ; DigestOutputStream digestOutputStream = new DigestOutputStream ( outputStream , digest ) ; // Headerdaten und Inhalt schreiben
DataOutputStream dataOutputStream = new DataOutputStream ( digestOutputStream ) ; // Immer erster Stelle die aktuelle Version schreiben
dataOutputStream . writeByte ( CURRENT_BINARY_VERSION ) ; // Die Reihenfolge der Felder darf sich aus Gründen der
// Kompatibilität niemals ändern . Neue Felder können hinzugefügt
// werden . Dann ist die Version hochzusetzten .
dataOutputStream . writeUTF ( type ( ) ) ; dataOutputStream . writeUTF ( compression ) ; dataOutputStream . writeLong ( contentLength ) ; // Nur der Content wird komprimiertFileSizeFormatter
Compressor compressor = createCompressor ( compression ) ; OutputStream compressingStream = compressor . compress ( dataOutputStream ) ; Streams . copyStream ( contentStream , compressingStream , true ) ; byte [ ] hashBytes = digest . digest ( ) ; id = HashUtil . convertHashBytesToString ( hashBytes ) ; |
public class MkGrouper { /** * get which task should tuple be sent to */
public List < Integer > grouper ( List < Object > values ) { } } | if ( GrouperType . global . equals ( groupType ) ) { // send to task which taskId is 0
return JStormUtils . mk_list ( outTasks . get ( 0 ) ) ; } else if ( GrouperType . fields . equals ( groupType ) ) { // field grouping
return fieldsGrouper . grouper ( values ) ; } else if ( GrouperType . all . equals ( groupType ) ) { // send to every task
return outTasks ; } else if ( GrouperType . shuffle . equals ( groupType ) ) { // random , but the random is different from none
return shuffer . grouper ( values ) ; } else if ( GrouperType . none . equals ( groupType ) ) { int rnd = Math . abs ( random . nextInt ( ) % outTasks . size ( ) ) ; return JStormUtils . mk_list ( outTasks . get ( rnd ) ) ; } else if ( GrouperType . custom_obj . equals ( groupType ) ) { return customGrouper . grouper ( values ) ; } else if ( GrouperType . custom_serialized . equals ( groupType ) ) { return customGrouper . grouper ( values ) ; } else { LOG . warn ( "Unsupported group type" ) ; } return new ArrayList < > ( ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link MsqrtType } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.w3.org/1998/Math/MathML" , name = "msqrt" ) public JAXBElement < MsqrtType > createMsqrt ( MsqrtType value ) { } } | return new JAXBElement < MsqrtType > ( _Msqrt_QNAME , MsqrtType . class , null , value ) ; |
public class IDCard { /** * 检查身份证号是否符合格式
* @ param idCard 身份证号
* @ return 如果身份证号符合身份证格式则返回 < code > true < / code > */
public static boolean check ( String idCard ) { } } | // 验证身份证格式
Matcher matcher = ID_CARD_PATTERN . matcher ( idCard ) ; if ( ! matcher . matches ( ) ) { // 格式不对
logger . error ( "身份证格式不对{}" , idCard ) ; return false ; } // 验证最后一位加权码
byte [ ] idCardByte = idCard . getBytes ( ) ; int sum = 0 ; for ( int i = 0 ; i < 17 ; i ++ ) { sum += ( ( ( int ) idCardByte [ i ] ) - 48 ) * POWER [ i ] ; } int mod = sum % 11 ; int calcLast = DIVISOR [ mod ] ; char last ; if ( idCardByte [ 17 ] == 'x' || idCardByte [ 17 ] == 'X' ) { last = 'X' ; } else { last = ( char ) idCardByte [ 17 ] ; } if ( last != calcLast ) { // 格式不对
logger . error ( "加权码错误{}" , idCard ) ; return false ; } return true ; |
public class ExamplesUtil { /** * Generates a Map of response examples
* @ param generateMissingExamples specifies the missing examples should be generated
* @ param operation the Swagger Operation
* @ param definitions the map of definitions
* @ param markupDocBuilder the markup builder
* @ return map containing response examples . */
public static Map < String , Object > generateResponseExampleMap ( boolean generateMissingExamples , PathOperation operation , Map < String , Model > definitions , DocumentResolver definitionDocumentResolver , MarkupDocBuilder markupDocBuilder ) { } } | Map < String , Object > examples = new LinkedHashMap < > ( ) ; Map < String , Response > responses = operation . getOperation ( ) . getResponses ( ) ; if ( responses != null ) for ( Map . Entry < String , Response > responseEntry : responses . entrySet ( ) ) { Response response = responseEntry . getValue ( ) ; Object example = response . getExamples ( ) ; if ( example == null ) { Model model = response . getResponseSchema ( ) ; if ( model != null ) { Property schema = new PropertyModelConverter ( ) . modelToProperty ( model ) ; if ( schema != null ) { example = schema . getExample ( ) ; if ( example == null && schema instanceof RefProperty ) { String simpleRef = ( ( RefProperty ) schema ) . getSimpleRef ( ) ; example = generateExampleForRefModel ( generateMissingExamples , simpleRef , definitions , definitionDocumentResolver , markupDocBuilder , new HashMap < > ( ) ) ; } if ( example == null && schema instanceof ArrayProperty && generateMissingExamples ) { example = generateExampleForArrayProperty ( ( ArrayProperty ) schema , definitions , definitionDocumentResolver , markupDocBuilder , new HashMap < > ( ) ) ; } if ( example == null && schema instanceof ObjectProperty && generateMissingExamples ) { example = exampleMapForProperties ( ( ( ObjectProperty ) schema ) . getProperties ( ) , definitions , definitionDocumentResolver , markupDocBuilder , new HashMap < > ( ) ) ; } if ( example == null && generateMissingExamples ) { example = PropertyAdapter . generateExample ( schema , markupDocBuilder ) ; } } } } if ( example != null ) examples . put ( responseEntry . getKey ( ) , example ) ; } return examples ; |
public class ResourceAssignment { /** * Returns the finish date for this resource assignment .
* @ return finish date */
public Date getFinish ( ) { } } | Date result = ( Date ) getCachedValue ( AssignmentField . FINISH ) ; if ( result == null ) { result = getTask ( ) . getFinish ( ) ; } return result ; |
public class DefaultSerializableProxy { /** * Get the associated proxy class .
* @ return the proxy class
* @ throws ClassNotFoundException if the proxy class is not found */
protected Class < ? > getProxyClass ( ) throws ClassNotFoundException { } } | ClassLoader classLoader = getProxyClassLoader ( ) ; return Class . forName ( proxyClassName , false , classLoader ) ; |
public class InviteAction { /** * Sets the max age for the invite . Set this to { @ code 0 } if the invite should never expire . Default is { @ code 86400 } ( 24 hours ) .
* { @ code null } will reset this to the default value .
* @ param maxAge
* The max age for this invite or { @ code null } to use the default value .
* @ param timeUnit
* The { @ link java . util . concurrent . TimeUnit TimeUnit } type of { @ code maxAge } .
* @ throws IllegalArgumentException
* If maxAge is negative or maxAge is positive and timeUnit is null .
* @ return The current InviteAction for chaining . */
@ CheckReturnValue public final InviteAction setMaxAge ( final Long maxAge , final TimeUnit timeUnit ) { } } | if ( maxAge == null ) return this . setMaxAge ( null ) ; Checks . notNegative ( maxAge , "maxAge" ) ; Checks . notNull ( timeUnit , "timeUnit" ) ; return this . setMaxAge ( Math . toIntExact ( timeUnit . toSeconds ( maxAge ) ) ) ; |
public class BeanMapping { /** * 指定したカラム名を持つカラムのマッピング情報を取得する 。
* @ param columnName カラム名 ( フィールド名 ) を指定します 。
* @ return 引数で指定したカラム名の値と一致するカラム情報 。 */
public Optional < ColumnMapping > getColumnMapping ( final String columnName ) { } } | return columns . stream ( ) . filter ( c -> c . getName ( ) != null && c . getName ( ) . equals ( columnName ) ) . findFirst ( ) ; |
public class Standby { /** * Check the correct ingest state for instantiating new ingest
* ( synchronized on ingestStateLock )
* @ return true if the ingest for the requested txid is running
* @ throws IOException when the state is incorrect */
private boolean checkIngestState ( ) throws IOException { } } | if ( currentIngestState == StandbyIngestState . INGESTING_EDITS ) { String msg = "" ; if ( ingest == null ) { msg = "Standby: Ingest instantiation failed, the state is " + currentIngestState + ", but the ingest is null" ; } if ( currentSegmentTxId != ingest . getStartTxId ( ) ) { msg = "Standby: Ingest instantiation failed, trying to instantiate ingest for txid: " + currentSegmentTxId + ", but there is ingest for txid: " + ingest . getStartTxId ( ) ; } if ( currentIngestState == StandbyIngestState . NOT_INGESTING && ingest . isRunning ( ) ) { msg = "Standby: Ingest instantiation failed, the state is " + currentIngestState + " but the ingest is running" ; } if ( ! msg . isEmpty ( ) ) { LOG . warn ( msg ) ; throw new IOException ( msg ) ; } return true ; } return false ; |
public class SwiftAPIClient { /** * Direct HTTP PUT request without JOSS package
* @ param objName name of the object
* @ param contentType content type
* @ return HttpURLConnection */
@ Override public FSDataOutputStream createObject ( String objName , String contentType , Map < String , String > metadata , Statistics statistics ) throws IOException { } } | final URL url = new URL ( mJossAccount . getAccessURL ( ) + "/" + getURLEncodedObjName ( objName ) ) ; LOG . debug ( "PUT {}. Content-Type : {}" , url . toString ( ) , contentType ) ; // When overwriting an object , cached metadata will be outdated
String cachedName = getObjName ( container + "/" , objName ) ; objectCache . remove ( cachedName ) ; try { final OutputStream sos ; if ( nonStreamingUpload ) { sos = new SwiftNoStreamingOutputStream ( mJossAccount , url , contentType , metadata , swiftConnectionManager , this ) ; } else { sos = new SwiftOutputStream ( mJossAccount , url , contentType , metadata , swiftConnectionManager ) ; } return new FSDataOutputStream ( sos , statistics ) ; } catch ( IOException e ) { LOG . error ( e . getMessage ( ) ) ; throw e ; } |
public class GroupApi { /** * Deletes an LDAP group link .
* < pre > < code > GitLab Endpoint : DELETE / groups / : id / ldap _ group _ links / : cn < / code > < / pre >
* @ param groupIdOrPath the group ID , path of the group , or a Group instance holding the group ID or path
* @ param cn the CN of the LDAP group link to delete
* @ throws GitLabApiException if any exception occurs */
public void deleteLdapGroupLink ( Object groupIdOrPath , String cn ) throws GitLabApiException { } } | if ( cn == null || cn . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "cn cannot be null or empty" ) ; } delete ( Response . Status . OK , null , "groups" , getGroupIdOrPath ( groupIdOrPath ) , "ldap_group_links" , cn ) ; |
public class XMLRPCClient { /** * Asynchronously call a remote procedure on the server . The method must be
* described by a method name . If the method requires parameters , this must
* be set . When the server returns a response the onResponse method is called
* on the listener . If the server returns an error the onServerError method
* is called on the listener . The onError method is called whenever something
* fails . This method returns immediately and returns an identifier for the
* request . All listener methods get this id as a parameter to distinguish between
* multiple requests .
* @ param listener A listener , which will be notified about the server response or errors .
* @ param methodName A method name to call on the server .
* @ param params An array of parameters for the method .
* @ return The id of the current request . */
public long callAsync ( XMLRPCCallback listener , String methodName , Object ... params ) { } } | long id = System . currentTimeMillis ( ) ; new Caller ( listener , id , methodName , params ) . start ( ) ; return id ; |
public class JCudnn { /** * Set all values of a tensor to a given value : y [ i ] = value [ 0] */
public static int cudnnSetTensor ( cudnnHandle handle , cudnnTensorDescriptor yDesc , Pointer y , Pointer valuePtr ) { } } | return checkResult ( cudnnSetTensorNative ( handle , yDesc , y , valuePtr ) ) ; |
public class RuntimeEnvironmentBuilder { /** * Provides default configuration of < code > RuntimeEnvironmentBuilder < / code > that is based on :
* < ul >
* < li > DefaultRuntimeEnvironment < / li >
* < / ul >
* It relies on KieClasspathContainer that requires to have kmodule . xml present in META - INF folder which
* defines the kjar itself .
* @ param kbaseName name of the kbase defined in kmodule . xml
* @ param ksessionName name of the ksession define in kmodule . xml
* @ return new instance of < code > RuntimeEnvironmentBuilder < / code > that is already preconfigured with defaults
* @ see DefaultRuntimeEnvironment */
public static RuntimeEnvironmentBuilder getClasspathKmoduleDefault ( String kbaseName , String ksessionName ) { } } | return setupClasspathKmoduleBuilder ( KieServices . Factory . get ( ) . getKieClasspathContainer ( ) , kbaseName , ksessionName ) ; |
public class Clock { /** * Defines the color that will be used to colorize the date of the clock
* @ param COLOR */
public void setDateColor ( final Color COLOR ) { } } | if ( null == dateColor ) { _dateColor = COLOR ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { dateColor . set ( COLOR ) ; } |
public class HtmlSelectManyCheckbox { /** * < p > Set the value of the < code > selectedClass < / code > property . < / p > */
public void setSelectedClass ( java . lang . String selectedClass ) { } } | getStateHelper ( ) . put ( PropertyKeys . selectedClass , selectedClass ) ; |
public class BaseClassFinderService { /** * Make sure this service reference is the correct interface / class
* @ param serviceReference
* @ param interfaceClassName
* @ param serviceClassName
* @ return */
private ServiceReference checkService ( ServiceReference serviceReference , String interfaceClassName ) { } } | if ( serviceReference != null ) { Object service = bundleContext . getService ( serviceReference ) ; if ( service != null ) { try { if ( interfaceClassName != null ) if ( ! service . getClass ( ) . isAssignableFrom ( Class . forName ( interfaceClassName ) ) ) serviceReference = null ; } catch ( ClassNotFoundException e ) { // Ignore this error
} } } return serviceReference ; |
public class ParamTagImpl { /** * For the parameter comment with embedded @ link tags return the array of
* TagImpls consisting of SeeTagImpl ( s ) and text containing TagImpl ( s ) .
* @ return TagImpl [ ] Array of tags with inline SeeTagImpls .
* @ see TagImpl # inlineTags ( )
* @ see ThrowsTagImpl # inlineTags ( ) */
@ Override public Tag [ ] inlineTags ( ) { } } | if ( inlineTags == null ) { inlineTags = Comment . getInlineTags ( holder , parameterComment ) ; } return inlineTags ; |
public class AuditNotificationTargetMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AuditNotificationTarget auditNotificationTarget , ProtocolMarshaller protocolMarshaller ) { } } | if ( auditNotificationTarget == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( auditNotificationTarget . getTargetArn ( ) , TARGETARN_BINDING ) ; protocolMarshaller . marshall ( auditNotificationTarget . getRoleArn ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( auditNotificationTarget . getEnabled ( ) , ENABLED_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Request { /** * sets the if modified since header for the request ( use with GET only )
* @ param dateSince : header field value to add
* @ return : Request Object with if _ modified _ since header value set */
public Request ifModifiedSince ( String dateSince ) { } } | final String ifmodsin = RequestHeaderFields . IF_MODIFIED_SINCE . getName ( ) ; return this . setHeader ( ifmodsin , dateSince ) ; |
public class CommerceCurrencyPersistenceImpl { /** * Returns an ordered range of all the commerce currencies where groupId = & # 63 ; and primary = & # 63 ; .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceCurrencyModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param groupId the group ID
* @ param primary the primary
* @ param start the lower bound of the range of commerce currencies
* @ param end the upper bound of the range of commerce currencies ( not inclusive )
* @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > )
* @ return the ordered range of matching commerce currencies */
@ Override public List < CommerceCurrency > findByG_P ( long groupId , boolean primary , int start , int end , OrderByComparator < CommerceCurrency > orderByComparator ) { } } | return findByG_P ( groupId , primary , start , end , orderByComparator , true ) ; |
public class KontonummerValidator { /** * Returns an object that represents a Kontonummer .
* @ param kontonummer A String containing a Kontonummer
* @ return A Kontonummer instance
* @ throws IllegalArgumentException thrown if String contains an invalid Kontonummer */
public static Kontonummer getKontonummer ( String kontonummer ) throws IllegalArgumentException { } } | validateSyntax ( kontonummer ) ; validateChecksum ( kontonummer ) ; return new Kontonummer ( kontonummer ) ; |
public class MqttTopicPermission { /** * Checks the MqttTopicPermission implies a given topic , qos and activity combination
* @ param topic the topic to check
* @ param qoS the QoS to check
* @ param activity the activity to check
* @ return < code > true < / code > if the given topic , qos and activity combination is implied */
public boolean implies ( final String topic , final String [ ] splitTopic , final QoS qoS , final ACTIVITY activity ) { } } | if ( qoS == null ) { return false ; } return implies ( topic , splitTopic , QOS . from ( qoS ) , activity ) ; |
public class ZaurusConnectionDialog { /** * Method declaration */
void create ( Insets defInsets ) { } } | setLayout ( new BorderLayout ( ) ) ; addKeyListener ( this ) ; Panel p = new Panel ( new GridLayout ( 6 , 2 , 10 , 10 ) ) ; p . addKeyListener ( this ) ; p . setBackground ( SystemColor . control ) ; p . add ( createLabel ( "Type:" ) ) ; Choice types = new Choice ( ) ; types . addItemListener ( this ) ; types . addKeyListener ( this ) ; for ( int i = 0 ; i < sJDBCTypes . length ; i ++ ) { types . add ( sJDBCTypes [ i ] [ 0 ] ) ; } p . add ( types ) ; p . add ( createLabel ( "Driver:" ) ) ; mDriver = new TextField ( "org.hsqldb_voltpatches.jdbcDriver" ) ; mDriver . addKeyListener ( this ) ; p . add ( mDriver ) ; p . add ( createLabel ( "URL:" ) ) ; mURL = new TextField ( "jdbc:hsqldb:mem:." ) ; mURL . addKeyListener ( this ) ; p . add ( mURL ) ; p . add ( createLabel ( "User:" ) ) ; mUser = new TextField ( "SA" ) ; mUser . addKeyListener ( this ) ; p . add ( mUser ) ; p . add ( createLabel ( "Password:" ) ) ; mPassword = new TextField ( "" ) ; mPassword . addKeyListener ( this ) ; mPassword . setEchoChar ( '*' ) ; p . add ( mPassword ) ; Button b ; b = new Button ( "Cancel" ) ; b . setActionCommand ( "ConnectCancel" ) ; b . addActionListener ( this ) ; b . addKeyListener ( this ) ; p . add ( b ) ; b = new Button ( "Ok" ) ; b . setActionCommand ( "ConnectOk" ) ; b . addActionListener ( this ) ; b . addKeyListener ( this ) ; p . add ( b ) ; setLayout ( new BorderLayout ( ) ) ; add ( "East" , createLabel ( " " ) ) ; add ( "West" , createLabel ( " " ) ) ; mError = new Label ( "" ) ; Panel pMessage = createBorderPanel ( mError ) ; pMessage . addKeyListener ( this ) ; add ( "South" , pMessage ) ; add ( "North" , createLabel ( "" ) ) ; add ( "Center" , p ) ; doLayout ( ) ; pack ( ) ; Dimension d = Toolkit . getDefaultToolkit ( ) . getScreenSize ( ) ; Dimension size = getSize ( ) ; if ( d . width > 640 ) { setLocation ( ( d . width - size . width ) / 2 , ( d . height - size . height ) / 2 ) ; } else if ( defInsets . top > 0 && defInsets . left > 0 ) { setLocation ( defInsets . bottom , defInsets . right ) ; setSize ( defInsets . top , defInsets . left ) ; // full size on screen with less than 640 width
} else { setLocation ( 0 , 0 ) ; setSize ( d ) ; } show ( ) ; |
public class MatchingStrategy { /** * Common iteration to get the best constraint match response from the security constraints .
* < pre >
* To get the aggregated match response ,
* 1 . For each security constraint ,
* 1a . Ask security constraint for its match response for the resource access .
* 1b . Optionally set the default match response of the aggregate after receiving a response for a security constraint .
* 1c . Aggregate the responses . See { @ link com . ibm . ws . webcontainer . security . metadata . MatchResponse # aggregateResponse ( ResponseAggregate ) } .
* 2 . Finally , select from the aggregate the response .
* < / pre >
* @ param securityConstraintCollection the security constraints to iterate through .
* @ param resourceName the resource name .
* @ param method the HTTP method .
* @ return the match response . */
public MatchResponse performMatch ( SecurityConstraintCollection securityConstraintCollection , String resourceName , String method ) { } } | MatchResponse currentResponse = null ; ResponseAggregate responseAggregate = createResponseAggregate ( ) ; for ( SecurityConstraint securityConstraint : securityConstraintCollection . getSecurityConstraints ( ) ) { currentResponse = getMatchResponse ( securityConstraint , resourceName , method ) ; optionallySetAggregateResponseDefault ( currentResponse , responseAggregate ) ; if ( isMatch ( currentResponse ) ) { responseAggregate = currentResponse . aggregateResponse ( responseAggregate ) ; } } return responseAggregate . selectMatchResponse ( ) ; |
public class WCOutputStream { /** * @ see javax . servlet . ServletOutputStream # print ( boolean ) */
public void print ( boolean b ) throws IOException { } } | String value = Boolean . toString ( b ) ; this . output . write ( value . getBytes ( ) , 0 , value . length ( ) ) ; |
public class PlannerWriter { /** * Convert a Java date into a Planner date - time string .
* 20070222T080000Z
* @ param value Java date
* @ return Planner date - time string */
private String getDateTimeString ( Date value ) { } } | String result = null ; if ( value != null ) { Calendar cal = DateHelper . popCalendar ( value ) ; StringBuilder sb = new StringBuilder ( 16 ) ; sb . append ( m_fourDigitFormat . format ( cal . get ( Calendar . YEAR ) ) ) ; sb . append ( m_twoDigitFormat . format ( cal . get ( Calendar . MONTH ) + 1 ) ) ; sb . append ( m_twoDigitFormat . format ( cal . get ( Calendar . DAY_OF_MONTH ) ) ) ; sb . append ( 'T' ) ; sb . append ( m_twoDigitFormat . format ( cal . get ( Calendar . HOUR_OF_DAY ) ) ) ; sb . append ( m_twoDigitFormat . format ( cal . get ( Calendar . MINUTE ) ) ) ; sb . append ( m_twoDigitFormat . format ( cal . get ( Calendar . SECOND ) ) ) ; sb . append ( 'Z' ) ; result = sb . toString ( ) ; DateHelper . pushCalendar ( cal ) ; } return result ; |
public class IconAwesome { /** * Use the free font of FontAwesome 5 . As a side effect , every FontAwesome icon on the same page is switched to FontAwesome 5.2.0 . By default , the icon set is the older version 4.7.0 . < P >
* Usually this method is called internally by the JSF engine . */
public void setSolid ( boolean _solid ) { } } | if ( _solid ) { AddResourcesListener . setFontAwesomeVersion ( 5 , this ) ; } getStateHelper ( ) . put ( PropertyKeys . solid , _solid ) ; |
public class RunbookDraftsInner { /** * Undo draft edit to last known published state identified by runbook name .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param runbookName The runbook name .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the RunbookDraftUndoEditResultInner object */
public Observable < RunbookDraftUndoEditResultInner > undoEditAsync ( String resourceGroupName , String automationAccountName , String runbookName ) { } } | return undoEditWithServiceResponseAsync ( resourceGroupName , automationAccountName , runbookName ) . map ( new Func1 < ServiceResponse < RunbookDraftUndoEditResultInner > , RunbookDraftUndoEditResultInner > ( ) { @ Override public RunbookDraftUndoEditResultInner call ( ServiceResponse < RunbookDraftUndoEditResultInner > response ) { return response . body ( ) ; } } ) ; |
public class DumpProcessingController { /** * Wraps the given processor into a { @ link EntityDocumentProcessorFilter } if
* global filters are configured ; otherwise just returns the processor
* unchanged .
* @ param processor
* the processor to wrap */
private EntityDocumentProcessor filterEntityDocumentProcessor ( EntityDocumentProcessor processor ) { } } | if ( this . filter . getPropertyFilter ( ) == null && this . filter . getSiteLinkFilter ( ) == null && this . filter . getLanguageFilter ( ) == null ) { return processor ; } else { return new EntityDocumentProcessorFilter ( processor , this . filter ) ; } |
public class Stream { /** * Zip together the " a " and " b " iterators until all of them runs out of values .
* Each pair of values is combined into a single value using the supplied zipFunction function .
* @ param a
* @ param b
* @ param valueForNoneA value to fill if " a " runs out of values first .
* @ param valueForNoneB value to fill if " b " runs out of values first .
* @ param zipFunction
* @ return */
public static < R > Stream < R > zip ( final IntStream a , final IntStream b , final int valueForNoneA , final int valueForNoneB , final IntBiFunction < R > zipFunction ) { } } | return zip ( a . iteratorEx ( ) , b . iteratorEx ( ) , valueForNoneA , valueForNoneB , zipFunction ) . onClose ( newCloseHandler ( N . asList ( a , b ) ) ) ; |
public class Card { /** * Don ' t change card ' s mCells in binding process ! */
public void onBindCell ( int offset , int position , boolean showFromEnd ) { } } | if ( ! mIsExposed && serviceManager != null ) { ExposureSupport exposureSupport = serviceManager . getService ( ExposureSupport . class ) ; if ( exposureSupport != null ) { mIsExposed = true ; exposureSupport . onExposure ( this , offset , position ) ; } } |
public class GlobalUsersInner { /** * List Environments for the user .
* @ param userName The name of the user .
* @ param labId The resource Id of the lab
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ListEnvironmentsResponseInner object */
public Observable < ServiceResponse < ListEnvironmentsResponseInner > > listEnvironmentsWithServiceResponseAsync ( String userName , String labId ) { } } | if ( userName == null ) { throw new IllegalArgumentException ( "Parameter userName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } ListEnvironmentsPayload listEnvironmentsPayload = new ListEnvironmentsPayload ( ) ; listEnvironmentsPayload . withLabId ( labId ) ; return service . listEnvironments ( userName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , listEnvironmentsPayload , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ListEnvironmentsResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < ListEnvironmentsResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ListEnvironmentsResponseInner > clientResponse = listEnvironmentsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Segment3dfx { /** * Replies the property that is the z coordinate of the first segment point .
* @ return the z1 property . */
@ Pure public DoubleProperty z1Property ( ) { } } | if ( this . p1 . z == null ) { this . p1 . z = new SimpleDoubleProperty ( this , MathFXAttributeNames . Z1 ) ; } return this . p1 . z ; |
public class QuerysImpl { /** * Execute an Analytics query .
* Executes an Analytics query for data . [ Here ] ( https : / / dev . applicationinsights . io / documentation / Using - the - API / Query ) is an example for using POST with an Analytics query .
* @ param appId ID of the application . This is Application ID from the API Access settings blade in the Azure portal .
* @ param body The Analytics query . Learn more about the [ Analytics query syntax ] ( https : / / azure . microsoft . com / documentation / articles / app - insights - analytics - reference / )
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < QueryResults > executeAsync ( String appId , QueryBody body , final ServiceCallback < QueryResults > serviceCallback ) { } } | return ServiceFuture . fromResponse ( executeWithServiceResponseAsync ( appId , body ) , serviceCallback ) ; |
public class CleanUpScheduler { /** * Get scheduled delay for proactive gc task , cross - day setting is supported . < br / >
* 01:30-02:40 , some time between 01:30-02:40 ; < br / >
* 180000,180 seconds later . */
public static long getDelayMillis ( String time ) { } } | String pattern = "HH:mm" ; Date now = new Date ( ) ; if ( StringUtils . contains ( time , "-" ) ) { String start = time . split ( "-" ) [ 0 ] ; String end = time . split ( "-" ) [ 1 ] ; if ( StringUtils . contains ( start , ":" ) && StringUtils . contains ( end , ":" ) ) { Date d1 = getCurrentDateByPlan ( start , pattern ) ; Date d2 = getCurrentDateByPlan ( end , pattern ) ; while ( d1 . before ( now ) ) { d1 = DateUtils . addDays ( d1 , 1 ) ; } while ( d2 . before ( d1 ) ) { d2 = DateUtils . addDays ( d2 , 1 ) ; } return RandomUtil . nextLong ( d1 . getTime ( ) - now . getTime ( ) , d2 . getTime ( ) - now . getTime ( ) ) ; } } else if ( StringUtils . isNumeric ( time ) ) { return Long . parseLong ( time ) ; } // default
return getDelayMillis ( "02:00-05:00" ) ; |
public class JtaTransactionManagerFactory { /** * Creates a { @ link JtaTransactionManager } instance using any of the { @ link javax . transaction . UserTransaction } ,
* { @ link javax . transaction . TransactionSynchronizationRegistry } , and { @ link javax . transaction . TransactionManager }
* present in { @ code env } .
* @ param env */
@ Override public TransactionManager newTransactionManager ( Environment env ) { } } | return new JtaTransactionManager ( env . get ( EnvironmentName . TRANSACTION ) , env . get ( EnvironmentName . TRANSACTION_SYNCHRONIZATION_REGISTRY ) , env . get ( EnvironmentName . TRANSACTION_MANAGER ) ) ; |
public class CookieUtil { /** * Get the value of the cookie for the cookie of the specified name , or null if not found . */
public static String getCookieValue ( HttpServletRequest req , String name ) { } } | Cookie c = getCookie ( req , name ) ; return ( c == null ) ? null : c . getValue ( ) ; |
public class DefaultFeaturizerSequenceValidator { private boolean hasNoSubjOpt ( List < String > tags ) { } } | if ( tags . size ( ) > 1 ) { for ( String tag : tags ) { if ( ! tag . endsWith ( "=SUBJ" ) ) { return true ; } } } return false ; |
public class AbstractAmazonSQSAsync { /** * Simplified method form for invoking the SetQueueAttributes operation with an AsyncHandler .
* @ see # setQueueAttributesAsync ( SetQueueAttributesRequest , com . amazonaws . handlers . AsyncHandler ) */
@ Override public java . util . concurrent . Future < SetQueueAttributesResult > setQueueAttributesAsync ( String queueUrl , java . util . Map < String , String > attributes , com . amazonaws . handlers . AsyncHandler < SetQueueAttributesRequest , SetQueueAttributesResult > asyncHandler ) { } } | return setQueueAttributesAsync ( new SetQueueAttributesRequest ( ) . withQueueUrl ( queueUrl ) . withAttributes ( attributes ) , asyncHandler ) ; |
public class MailMessageConverter { /** * Reads Citrus internal mail message model object from message payload . Either payload is actually a mail message object or
* XML payload String is unmarshalled to mail message object .
* @ param message
* @ param endpointConfiguration
* @ return */
private MailRequest getMailRequest ( Message message , MailEndpointConfiguration endpointConfiguration ) { } } | Object payload = message . getPayload ( ) ; MailRequest mailRequest = null ; if ( payload != null ) { if ( payload instanceof MailRequest ) { mailRequest = ( MailRequest ) payload ; } else { mailRequest = ( MailRequest ) endpointConfiguration . getMarshaller ( ) . unmarshal ( message . getPayload ( Source . class ) ) ; } } if ( mailRequest == null ) { throw new CitrusRuntimeException ( "Unable to create proper mail message from payload: " + payload ) ; } return mailRequest ; |
public class AnyChromosome { /** * Create a new chromosome of type { @ code A } with the given parameters . The
* { @ code validator } predicate of the generated gene will always return
* { @ code true } .
* @ param < A > the allele type
* @ param supplier the allele - supplier which is used for creating new ,
* random alleles
* @ param length the length of the created chromosome
* @ return a new chromosome of allele type { @ code A }
* @ throws NullPointerException if the { @ code supplier } is { @ code null }
* @ throws IllegalArgumentException if chromosome length is smaller than one . */
public static < A > AnyChromosome < A > of ( final Supplier < ? extends A > supplier , final int length ) { } } | return of ( supplier , Predicates . TRUE , length ) ; |
public class GeoCircle { /** * { @ inheritDoc } */
@ Override public Shape toSpatial4j ( SpatialContext spatialContext ) { } } | double kms = distance . getValue ( GeoDistanceUnit . KILOMETRES ) ; double d = DistanceUtils . dist2Degrees ( kms , DistanceUtils . EARTH_MEAN_RADIUS_KM ) ; return spatialContext . makeCircle ( longitude , latitude , d ) ; |
public class BalancerUrlRewriteFilter { /** * The main method called for each request that this filter is mapped for .
* @ param request the request to filter
* @ throws IOException
* @ throws ServletException */
public void doFilter ( final HttpRequest httpRequest , MessageEvent e ) throws IOException , ServletException { } } | HttpServletRequest servletRequest = new NettyHttpServletRequestAdaptor ( httpRequest , e . getChannel ( ) ) ; final HttpServletRequest hsRequest = ( HttpServletRequest ) servletRequest ; if ( urlRewriter != null ) { String newUrl = urlRewriter . processRequest ( hsRequest ) ; if ( ! newUrl . equals ( httpRequest . getUri ( ) ) ) { if ( log . isDebugEnabled ( ) ) log . debug ( "request rewrited from : [" + httpRequest . getUri ( ) + "] to : [" + newUrl + "]" ) ; httpRequest . setUri ( newUrl ) ; } else { if ( log . isDebugEnabled ( ) ) log . debug ( "request not rewrited : [" + httpRequest . getUri ( ) + "]" ) ; } } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "urlRewriter engine not loaded ignoring request (could be a conf file problem)" ) ; } } |
public class Context { /** * Associates the specified value with the specified key in the request
* attributes . If the request attributes previously contained a mapping for
* this key , the old value is replaced by the specified value .
* @ param _ key key name of the attribute to set
* @ param _ value _ value of the attribute to set
* @ return Object
* @ see # requestAttributes
* @ see # containsRequestAttribute
* @ see # getRequestAttribute */
public Object setRequestAttribute ( final String _key , final Object _value ) { } } | return this . requestAttributes . put ( _key , _value ) ; |
public class AmazonGuardDutyClient { /** * Lists the ThreatIntelSets of the GuardDuty service specified by the detector ID .
* @ param listThreatIntelSetsRequest
* @ return Result of the ListThreatIntelSets operation returned by the service .
* @ throws BadRequestException
* 400 response
* @ throws InternalServerErrorException
* 500 response
* @ sample AmazonGuardDuty . ListThreatIntelSets
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / guardduty - 2017-11-28 / ListThreatIntelSets " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public ListThreatIntelSetsResult listThreatIntelSets ( ListThreatIntelSetsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListThreatIntelSets ( request ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcTendonType ( ) { } } | if ( ifcTendonTypeEClass == null ) { ifcTendonTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 708 ) ; } return ifcTendonTypeEClass ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link IntTunnelInstallationType } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link IntTunnelInstallationType } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/tunnel/2.0" , name = "IntTunnelInstallation" , substitutionHeadNamespace = "http://www.opengis.net/citygml/2.0" , substitutionHeadName = "_CityObject" ) public JAXBElement < IntTunnelInstallationType > createIntTunnelInstallation ( IntTunnelInstallationType value ) { } } | return new JAXBElement < IntTunnelInstallationType > ( _IntTunnelInstallation_QNAME , IntTunnelInstallationType . class , null , value ) ; |
public class UrlContentTilePainter { /** * Painter the tile , by building a URL where the image can be found .
* @ param tile
* Must be an instance of { @ link InternalTile } , and must have a non - null { @ link RasterUrlBuilder } .
* @ return Returns a { @ link InternalTile } . */
public InternalTile paint ( InternalTile tile ) throws RenderException { } } | if ( tile . getContentType ( ) . equals ( VectorTileContentType . URL_CONTENT ) ) { if ( urlBuilder != null ) { if ( paintGeometries ) { urlBuilder . paintGeometries ( paintGeometries ) ; urlBuilder . paintLabels ( false ) ; tile . setFeatureContent ( urlBuilder . getImageUrl ( ) ) ; } if ( paintLabels ) { urlBuilder . paintGeometries ( false ) ; urlBuilder . paintLabels ( paintLabels ) ; tile . setLabelContent ( urlBuilder . getImageUrl ( ) ) ; } return tile ; } } return tile ; |
public class KAFDocument { /** * Creates a new property . It assigns an appropriate ID to it . The property is added to the document .
* @ param lemma the lemma of the property .
* @ param references different mentions ( list of targets ) to the same property .
* @ return a new coreference . */
public Feature newProperty ( String lemma , List < Span < Term > > references ) { } } | String newId = idManager . getNextId ( AnnotationType . PROPERTY ) ; Feature newProperty = new Feature ( newId , lemma , references ) ; annotationContainer . add ( newProperty , Layer . PROPERTIES , AnnotationType . PROPERTY ) ; return newProperty ; |
public class CPDefinitionVirtualSettingUtil { /** * Returns the last cp definition virtual setting in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp definition virtual setting , or < code > null < / code > if a matching cp definition virtual setting could not be found */
public static CPDefinitionVirtualSetting fetchByUuid_Last ( String uuid , OrderByComparator < CPDefinitionVirtualSetting > orderByComparator ) { } } | return getPersistence ( ) . fetchByUuid_Last ( uuid , orderByComparator ) ; |
public class Buffer { public void digest ( InputStream src , MessageDigest digest ) throws IOException { } } | int numRead ; while ( true ) { numRead = src . read ( buffer ) ; if ( numRead < 0 ) { break ; } digest . update ( buffer , 0 , numRead ) ; } |
public class Commands { /** * Returns true if this command can be invoked */
public static boolean isEnabled ( UICommand command , UIContext context ) { } } | return ( command . isEnabled ( context ) && ! ( command instanceof UIWizardStep ) ) ; |
public class AmqpUtils { /** * Close a connection .
* @ param connection */
public static void closeQuietly ( final Connection connection ) { } } | if ( connection != null && connection . isOpen ( ) ) { try { connection . close ( ) ; } catch ( IOException ioe ) { LOG . warnDebug ( ioe , "While closing connection" ) ; } } |
public class ShapeGenerator { /** * Return a path for a scroll bar decrease button . This is used when the
* buttons are placed together at one end of the scroll bar .
* @ param x the X coordinate of the upper - left corner of the button
* @ param y the Y coordinate of the upper - left corner of the button
* @ param w the width of the button
* @ param h the height of the button
* @ return a path representing the shape . */
public Shape createScrollButtonTogetherDecrease ( int x , int y , int w , int h ) { } } | path . reset ( ) ; path . moveTo ( x + w , y ) ; path . lineTo ( x + w , y + h ) ; path . lineTo ( x , y + h ) ; addScrollGapPath ( x , y , w , h , false ) ; path . closePath ( ) ; return path ; |
public class A_CmsJspValueWrapper { /** * Converts the wrapped value to a boolean . < p >
* @ return the boolean value */
public boolean getToBoolean ( ) { } } | if ( m_boolean == null ) { m_boolean = Boolean . valueOf ( Boolean . parseBoolean ( getToString ( ) ) ) ; } return m_boolean . booleanValue ( ) ; |
public class AccessPoint { /** * Build a self - referencing URL that will perform a query for all copies
* of URL { @ code url } .
* @ param url URL to search for copies of
* @ param startdate start of date range in DT14 format ( may be { @ code null }
* for no date range .
* @ param enddate end of date range in DT14 format ( may be { @ code null } , ignored
* if { @ code startdate } is { @ code null } )
* @ return String URL that will make a query for all captures of { @ code url } . */
public String makeCaptureQueryUrl ( String url , String startdate , String enddate ) { } } | // XXX assumes particular style of query URL , which may not be compatible
// with RequestParsers in use . TODO : refactor .
if ( startdate != null ) { if ( enddate != null ) { return getQueryPrefix ( ) + startdate + "-" + enddate + "*/" + url ; } else { return getQueryPrefix ( ) + startdate + "*/" + url ; } } else { return getQueryPrefix ( ) + "*/" + url ; } |
public class Dom { public static String getAttribute ( Element element , String name ) { } } | String attr ; attr = getAttributeOpt ( element , name ) ; if ( attr == null ) { throw new DomException ( "missing attribute '" + name + "' in element '" + element . getTagName ( ) + "'" ) ; } return attr ; |
public class HadoopLogParser { /** * Attempt to determine the hostname of the node that created the
* log file . This information can be found in the STARTUP _ MSG lines
* of the Hadoop log , which are emitted when the node starts . */
private void findHostname ( ) { } } | String startupInfo = Environment . runCommand ( "grep --max-count=1 STARTUP_MSG:\\s*host " + file . getName ( ) ) . toString ( ) ; Pattern pattern = Pattern . compile ( "\\s+(\\w+/.+)\\s+" ) ; Matcher matcher = pattern . matcher ( startupInfo ) ; if ( matcher . find ( 0 ) ) { hostname = matcher . group ( 1 ) . split ( "/" ) [ 0 ] ; ips = new String [ 1 ] ; ips [ 0 ] = matcher . group ( 1 ) . split ( "/" ) [ 1 ] ; } |
public class FileInfo { /** * Add a key and value representing the current time , as determined by the passed clock , to the
* passed attributes dictionary .
* @ param attributes The file attributes map to update
* @ param clock The clock to retrieve the current time from */
public static void addModificationTimeToAttributes ( Map < String , byte [ ] > attributes , Clock clock ) { } } | attributes . put ( FILE_MODIFICATION_TIMESTAMP_KEY , Longs . toByteArray ( clock . currentTimeMillis ( ) ) ) ; |
public class OutputCommitter { /** * This method implements the new interface by calling the old method . Note
* that the input types are different between the new and old apis and this
* is a bridge between the two . */
@ Override public final void abortJob ( org . apache . hadoop . mapreduce . JobContext context , org . apache . hadoop . mapreduce . JobStatus . State runState ) throws IOException { } } | int state = JobStatus . getOldNewJobRunState ( runState ) ; if ( state != JobStatus . FAILED && state != JobStatus . KILLED ) { throw new IOException ( "Invalid job run state : " + runState . name ( ) ) ; } abortJob ( ( JobContext ) context , state ) ; |
public class DomainObject { /** * Set a field ( attribute ) value
* @ param fieldName
* @ param value */
public void setFieldValue ( String fieldName , Object value ) { } } | DOField field = this . domainObjectType . getFieldByName ( fieldName ) ; if ( field == null ) throw new RuntimeException ( "field: " + fieldName + " not found in: " + this . domainObjectType . getName ( ) ) ; if ( field . getComponentTypeName ( ) != null ) throw new RuntimeException ( "field: " + fieldName + " is a list field, use list field accessors instead " ) ; Object val = value ; if ( value instanceof DomainObject ) val = ( ( DomainObject ) value ) . getRawObject ( ) ; field . setValue ( this . getRawObject ( ) , val ) ; |
public class XAssignmentImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case XbasePackage . XASSIGNMENT__ASSIGNABLE : setAssignable ( ( XExpression ) null ) ; return ; case XbasePackage . XASSIGNMENT__VALUE : setValue ( ( XExpression ) null ) ; return ; case XbasePackage . XASSIGNMENT__EXPLICIT_STATIC : setExplicitStatic ( EXPLICIT_STATIC_EDEFAULT ) ; return ; case XbasePackage . XASSIGNMENT__STATIC_WITH_DECLARING_TYPE : setStaticWithDeclaringType ( STATIC_WITH_DECLARING_TYPE_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class HiveColumnHandle { /** * The column indicating the bucket id .
* When table bucketing differs from partition bucketing , this column indicates
* what bucket the row will fall in under the table bucketing scheme . */
public static HiveColumnHandle bucketColumnHandle ( ) { } } | return new HiveColumnHandle ( BUCKET_COLUMN_NAME , BUCKET_HIVE_TYPE , BUCKET_TYPE_SIGNATURE , BUCKET_COLUMN_INDEX , SYNTHESIZED , Optional . empty ( ) ) ; |
public class EQL { /** * Parses the stmt .
* @ param _ stmt the stmt
* @ return the abstract stmt */
public static AbstractStmt getStatement ( final CharSequence _stmt ) { } } | AbstractStmt ret = null ; final IStatement < ? > stmt = parse ( _stmt ) ; if ( stmt instanceof IPrintStatement ) { ret = PrintStmt . get ( ( IPrintStatement < ? > ) stmt ) ; } else if ( stmt instanceof IDeleteStatement ) { ret = DeleteStmt . get ( ( IDeleteStatement < ? > ) stmt ) ; } else if ( stmt instanceof IInsertStatement ) { ret = InsertStmt . get ( ( IInsertStatement ) stmt ) ; } else if ( stmt instanceof IUpdateStatement ) { ret = UpdateStmt . get ( ( IUpdateStatement < ? > ) stmt ) ; } return ret ; |
public class IfcPersonImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) public EList < String > getSuffixTitles ( ) { } } | return ( EList < String > ) eGet ( Ifc2x3tc1Package . Literals . IFC_PERSON__SUFFIX_TITLES , true ) ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link IdReferenceType } { @ code > } } */
@ XmlElementDecl ( namespace = "urn:oasis:names:tc:xacml:2.0:policy:schema:os" , name = "PolicyIdReference" , scope = PolicySetType . class ) public JAXBElement < IdReferenceType > createPolicySetTypePolicyIdReference ( IdReferenceType value ) { } } | return new JAXBElement < IdReferenceType > ( _PolicyIdReference_QNAME , IdReferenceType . class , PolicySetType . class , value ) ; |
public class AbstractBlockResettableIterator { protected boolean writeNextRecord ( T record ) throws IOException { } } | try { this . serializer . serialize ( record , this . collectingView ) ; this . numRecordsInBuffer ++ ; return true ; } catch ( EOFException eofex ) { return false ; } |
public class JmsAdapter { /** * The method overrides the one in the super class to perform
* JMS specific functions . */
@ Override public Object invoke ( Object conn , Object requestData ) throws AdapterException , ConnectionException { } } | try { Object result ; if ( jmsSenderReceiver != null ) { final String responseQueueName = this . getAttributeValueSmart ( RESPONSE_QUEUE_NAME ) ; final String requestDataForMessage = ( String ) requestData ; final Queue replyQueue ; final String correlationId = getCorrelationId ( ) ; boolean replyIsTemporaryQueue = false ; if ( responseQueueName != null && responseQueueName . length ( ) > 0 ) { replyQueue = ( Queue ) ApplicationContext . getNamingProvider ( ) . lookup ( null , responseQueueName , Queue . class ) ; // msg . setJMSReplyTo ( replyQueue ) ;
} else if ( this . isSynchronous ( ) ) { replyQueue = qSession . createTemporaryQueue ( ) ; // msg . setJMSReplyTo ( replyQueue ) ;
replyIsTemporaryQueue = true ; } else replyQueue = null ; jmsSenderReceiver . send ( getQueueName ( ) , new MessageCreator ( ) { @ Override public Message createMessage ( Session session ) throws JMSException { Message message = session . createTextMessage ( requestDataForMessage ) ; if ( correlationId != null ) message . setJMSCorrelationID ( correlationId ) ; if ( replyQueue != null ) { message . setJMSReplyTo ( replyQueue ) ; } return message ; } } ) ; if ( this . isSynchronous ( ) ) { Message message = null ; jmsSenderReceiver . setReceiveTimeout ( getTimeoutForResponse ( ) * 1000 ) ; if ( replyIsTemporaryQueue ) { message = jmsSenderReceiver . receive ( replyQueue ) ; } else { String messageSelector = "JMSCorrelationID = '" + correlationId + "'" ; message = jmsSenderReceiver . receiveSelected ( replyQueue , messageSelector ) ; } if ( message == null ) { throw new ActivityException ( "Synchronous JMS call times out while waiting for response" ) ; } else { result = ( ( TextMessage ) message ) . getText ( ) ; } } else result = null ; } else { QueueSession qSession = ( QueueSession ) conn ; Queue replyQueue ; boolean replyIsTemporaryQueue = false ; QueueSender qSender = qSession . createSender ( queue ) ; TextMessage msg = qSession . createTextMessage ( ( String ) requestData ) ; String responseQueueName = this . getAttributeValueSmart ( RESPONSE_QUEUE_NAME ) ; if ( responseQueueName != null && responseQueueName . length ( ) > 0 ) { replyQueue = ( Queue ) ApplicationContext . getNamingProvider ( ) . lookup ( null , responseQueueName , Queue . class ) ; msg . setJMSReplyTo ( replyQueue ) ; } else if ( this . isSynchronous ( ) ) { replyQueue = qSession . createTemporaryQueue ( ) ; msg . setJMSReplyTo ( replyQueue ) ; replyIsTemporaryQueue = true ; } else replyQueue = null ; String correlationId = getCorrelationId ( ) ; if ( correlationId != null ) msg . setJMSCorrelationID ( correlationId ) ; qSender . send ( msg ) ; if ( this . isSynchronous ( ) ) { MessageConsumer consumer ; if ( replyIsTemporaryQueue ) { consumer = qSession . createConsumer ( replyQueue ) ; } else { String messageSelector = "JMSCorrelationID = '" + correlationId + "'" ; consumer = qSession . createConsumer ( replyQueue , messageSelector ) ; } msg = ( TextMessage ) consumer . receive ( getTimeoutForResponse ( ) * 1000 ) ; if ( msg == null ) { throw new ActivityException ( "Synchronous JMS call times out while waiting for response" ) ; } else { result = msg . getText ( ) ; } } else result = null ; } return result ; } catch ( Exception e ) { // logger . severeException ( " Exception in JmsAdapter . invoke ( ) " , e ) ;
throw new AdapterException ( - 1 , "Exception in invoking JmsAdapter" , e ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.