idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
10,800 | @ SuppressWarnings ( "unchecked" ) public static < T > T cleanse ( T list , T element ) { if ( list == null || list == element ) { return null ; } else if ( list instanceof Pair ) { Pair < T , T > pair = ( Pair < T , T > ) list ; if ( pair . first == element ) { return pair . second ; } else if ( pair . second == element ) { return pair . first ; } else if ( pair . second instanceof Pair ) { pair . second = cleanse ( pair . second , element ) ; } } return list ; } | Cleanses an isomorphic list of a particular element . Only one thread should be updating the list at a time . |
10,801 | @ SuppressWarnings ( "unchecked" ) public static < T > boolean includes ( T list , T element ) { if ( list == null ) { return false ; } else if ( list == element ) { return true ; } else if ( list instanceof Pair ) { Pair < T , T > pair = ( Pair < T , T > ) list ; if ( pair . first == element || pair . second == element ) { return true ; } else if ( pair . second instanceof Pair ) { return includes ( pair . second , element ) ; } else { return false ; } } else { return false ; } } | Tests whether an isomorphic list includes a particular element . |
10,802 | @ SuppressWarnings ( "unchecked" ) public static < T > int count ( T list ) { if ( list == null ) { return 0 ; } else if ( list instanceof Pair ) { return 1 + count ( ( ( Pair < T , T > ) list ) . second ) ; } else { return 1 ; } } | Counts the number of elements in an isomorphic list . |
10,803 | @ SuppressWarnings ( "unchecked" ) public static < T > int traverse ( T list , Functor < ? , T > func ) { if ( list == null ) { return 0 ; } else if ( list instanceof Pair ) { Pair < T , T > pair = ( Pair < T , T > ) list ; func . invoke ( pair . first ) ; return 1 + traverse ( pair . second , func ) ; } else { func . invoke ( list ) ; return 1 ; } } | Traverses an isomorphic list using a Functor . The return values from the functor are discarded . |
10,804 | public JSONBuilder quote ( String value ) { _sb . append ( '"' ) ; for ( int i = 0 ; i < value . length ( ) ; ++ i ) { char c = value . charAt ( i ) ; switch ( c ) { case '"' : _sb . append ( "\\\"" ) ; break ; case '\\' : _sb . append ( "\\\\" ) ; break ; default : if ( c < 0x20 ) { _sb . append ( CTRLCHARS [ c ] ) ; } else { _sb . append ( c ) ; } break ; } } _sb . append ( '"' ) ; return this ; } | Quotes properly a string and appends it to the JSON stream . |
10,805 | public JSONBuilder serialize ( Object value ) { if ( value == null ) { _sb . append ( "null" ) ; } else { Class < ? > t = value . getClass ( ) ; if ( t . isArray ( ) ) { _sb . append ( '[' ) ; boolean hasElements = false ; for ( int i = 0 , ii = Array . getLength ( value ) ; i < ii ; ++ i ) { serialize ( Array . get ( value , i ) ) ; _sb . append ( ',' ) ; hasElements = true ; } if ( hasElements ) { _sb . setCharAt ( _sb . length ( ) - 1 , ']' ) ; } else { _sb . append ( ']' ) ; } } else if ( Iterable . class . isAssignableFrom ( t ) ) { _sb . append ( '[' ) ; boolean hasElements = false ; for ( Object object : ( Iterable < ? > ) value ) { serialize ( object ) ; _sb . append ( ',' ) ; hasElements = true ; } if ( hasElements ) { _sb . setCharAt ( _sb . length ( ) - 1 , ']' ) ; } else { _sb . append ( ']' ) ; } } else if ( Number . class . isAssignableFrom ( t ) || Boolean . class . isAssignableFrom ( t ) ) { _sb . append ( value . toString ( ) ) ; } else if ( String . class == t ) { quote ( ( String ) value ) ; } else { quote ( value . toString ( ) ) ; } } return this ; } | Serializes an object and appends it to the stream . |
10,806 | protected String createExceptionMessage ( final String message , final Object ... messageParameters ) { if ( ArrayUtils . isEmpty ( messageParameters ) ) { return message ; } else { return String . format ( message , messageParameters ) ; } } | Create a string message by string format . |
10,807 | public static ApruveResponse < PaymentRequest > get ( String paymentRequestId ) { return ApruveClient . getInstance ( ) . get ( PAYMENT_REQUESTS_PATH + paymentRequestId , PaymentRequest . class ) ; } | Fetches the PaymentRequest with the given ID from Apruve . |
10,808 | public String toSecureHash ( ) { String apiKey = ApruveClient . getInstance ( ) . getApiKey ( ) ; String shaInput = apiKey + toValueString ( ) ; return ShaUtil . getDigest ( shaInput ) ; } | For use by merchants and depends on proper initialization of ApruveClient . Returns the secure hash for a PaymentRequest suitable for use with the property of apruve . js JavaScript library on a merchant checkout page . Use this to populate the value of apruve . secureHash . |
10,809 | public AnnotationValue defaultValue ( ) { return ( sym . defaultValue == null ) ? null : new AnnotationValueImpl ( env , sym . defaultValue ) ; } | Returns the default value of this element . Returns null if this element has no default . |
10,810 | public void sessionReady ( boolean isReady ) { if ( isReady ) { speedSlider . setValue ( session . getClockPeriod ( ) ) ; } startAction . setEnabled ( isReady ) ; speedSlider . setEnabled ( isReady ) ; stepAction . setEnabled ( isReady ) ; reloadAction . setEnabled ( isReady ) ; } | Changes the UI depending on whether the session is ready or not |
10,811 | public synchronized void mark ( final int limit ) { try { in . mark ( limit ) ; } catch ( IOException ioe ) { throw new RuntimeException ( ioe . getMessage ( ) ) ; } } | Marks the read limit of the StringReader . |
10,812 | public synchronized void reset ( ) throws IOException { if ( in == null ) { throw new IOException ( "Stream Closed" ) ; } slack = null ; in . reset ( ) ; } | Resets the StringReader . |
10,813 | public synchronized void close ( ) throws IOException { if ( in != null ) in . close ( ) ; slack = null ; in = null ; } | Closes the Stringreader . |
10,814 | public Collection < String > getValues ( String property ) { Multimap < Optional < String > , String > values = properties . get ( property ) ; if ( values == null ) { return Collections . emptyList ( ) ; } return values . values ( ) ; } | Get all literal values for the property passed by parameter |
10,815 | public String getValue ( String property , String language ) { Multimap < Optional < String > , String > values = properties . get ( property ) ; if ( values == null ) { return null ; } Iterator < String > it = values . get ( Optional . of ( language ) ) . iterator ( ) ; return it . hasNext ( ) ? it . next ( ) : null ; } | Get a literal value for a property and language passed by parameters |
10,816 | public String getFirstPropertyValue ( String property ) { Iterator < String > it = getValues ( property ) . iterator ( ) ; return it . hasNext ( ) ? it . next ( ) : null ; } | Return the first value associated to the property passed by parameter |
10,817 | public DConnection findByAccessToken ( java . lang . String accessToken ) { return queryUniqueByField ( null , DConnectionMapper . Field . ACCESSTOKEN . getFieldName ( ) , accessToken ) ; } | find - by method for unique field accessToken |
10,818 | public Iterable < DConnection > queryByExpireTime ( java . util . Date expireTime ) { return queryByField ( null , DConnectionMapper . Field . EXPIRETIME . getFieldName ( ) , expireTime ) ; } | query - by method for field expireTime |
10,819 | public Iterable < DConnection > queryByImageUrl ( java . lang . String imageUrl ) { return queryByField ( null , DConnectionMapper . Field . IMAGEURL . getFieldName ( ) , imageUrl ) ; } | query - by method for field imageUrl |
10,820 | public Iterable < DConnection > queryByProfileUrl ( java . lang . String profileUrl ) { return queryByField ( null , DConnectionMapper . Field . PROFILEURL . getFieldName ( ) , profileUrl ) ; } | query - by method for field profileUrl |
10,821 | public Iterable < DConnection > queryByProviderId ( java . lang . String providerId ) { return queryByField ( null , DConnectionMapper . Field . PROVIDERID . getFieldName ( ) , providerId ) ; } | query - by method for field providerId |
10,822 | public Iterable < DConnection > queryByProviderUserId ( java . lang . String providerUserId ) { return queryByField ( null , DConnectionMapper . Field . PROVIDERUSERID . getFieldName ( ) , providerUserId ) ; } | query - by method for field providerUserId |
10,823 | public DConnection findByRefreshToken ( java . lang . String refreshToken ) { return queryUniqueByField ( null , DConnectionMapper . Field . REFRESHTOKEN . getFieldName ( ) , refreshToken ) ; } | find - by method for unique field refreshToken |
10,824 | public Iterable < DConnection > queryBySecret ( java . lang . String secret ) { return queryByField ( null , DConnectionMapper . Field . SECRET . getFieldName ( ) , secret ) ; } | query - by method for field secret |
10,825 | public Iterable < DConnection > queryByUserId ( java . lang . Long userId ) { return queryByField ( null , DConnectionMapper . Field . USERID . getFieldName ( ) , userId ) ; } | query - by method for field userId |
10,826 | public Iterable < DConnection > queryByUserRoles ( java . lang . String userRoles ) { return queryByField ( null , DConnectionMapper . Field . USERROLES . getFieldName ( ) , userRoles ) ; } | query - by method for field userRoles |
10,827 | public void add ( Collection < Label > labels ) { for ( Label label : labels ) this . labels . put ( label . getKey ( ) , label ) ; } | Adds the label list to the labels for the account . |
10,828 | public final void sendGlobal ( String handler , String data ) { try { connection . sendMessage ( "{\"id\":-1,\"type\":\"global\",\"handler\":" + Json . escapeString ( handler ) + ",\"data\":" + data + "}" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } | This function is mainly made for plug - in use it sends data to global user handler for example to perform some tasks that aren t related directly to widgets . Global handler is a javascript function in array named global under key that is passed to this function as handler parameter . As first argument the javascript function is given data object that is passed as JSON here |
10,829 | public void replaceWith ( final ThriftEnvelope thriftEnvelope ) { this . typeName = thriftEnvelope . typeName ; this . name = thriftEnvelope . name ; this . payload . clear ( ) ; this . payload . addAll ( thriftEnvelope . payload ) ; } | hack method to allow hadoop to re - use this object |
10,830 | protected void addFrameWarning ( Content contentTree ) { Content noframes = new HtmlTree ( HtmlTag . NOFRAMES ) ; Content noScript = HtmlTree . NOSCRIPT ( HtmlTree . DIV ( getResource ( "doclet.No_Script_Message" ) ) ) ; noframes . addContent ( noScript ) ; Content noframesHead = HtmlTree . HEADING ( HtmlConstants . CONTENT_HEADING , getResource ( "doclet.Frame_Alert" ) ) ; noframes . addContent ( noframesHead ) ; Content p = HtmlTree . P ( getResource ( "doclet.Frame_Warning_Message" , getHyperLink ( configuration . topFile , configuration . getText ( "doclet.Non_Frame_Version" ) ) ) ) ; noframes . addContent ( p ) ; contentTree . addContent ( noframes ) ; } | Add the code for issueing the warning for a non - frame capable web client . Also provide links to the non - frame version documentation . |
10,831 | private void addAllPackagesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . FRAME ( DocPaths . OVERVIEW_FRAME . getPath ( ) , "packageListFrame" , configuration . getText ( "doclet.All_Packages" ) ) ; contentTree . addContent ( frame ) ; } | Add the FRAME tag for the frame that lists all packages . |
10,832 | private void addAllClassesFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . FRAME ( DocPaths . ALLCLASSES_FRAME . getPath ( ) , "packageFrame" , configuration . getText ( "doclet.All_classes_and_interfaces" ) ) ; contentTree . addContent ( frame ) ; } | Add the FRAME tag for the frame that lists all classes . |
10,833 | private void addClassFrameTag ( Content contentTree ) { HtmlTree frame = HtmlTree . FRAME ( configuration . topFile . getPath ( ) , "classFrame" , configuration . getText ( "doclet.Package_class_and_interface_descriptions" ) , SCROLL_YES ) ; contentTree . addContent ( frame ) ; } | Add the FRAME tag for the frame that describes the class in detail . |
10,834 | public static JCTree declarationFor ( final Symbol sym , final JCTree tree ) { class DeclScanner extends TreeScanner { JCTree result = null ; public void scan ( JCTree tree ) { if ( tree != null && result == null ) tree . accept ( this ) ; } public void visitTopLevel ( JCCompilationUnit that ) { if ( that . packge == sym ) result = that ; else super . visitTopLevel ( that ) ; } public void visitClassDef ( JCClassDecl that ) { if ( that . sym == sym ) result = that ; else super . visitClassDef ( that ) ; } public void visitMethodDef ( JCMethodDecl that ) { if ( that . sym == sym ) result = that ; else super . visitMethodDef ( that ) ; } public void visitVarDef ( JCVariableDecl that ) { if ( that . sym == sym ) result = that ; else super . visitVarDef ( that ) ; } public void visitTypeParameter ( JCTypeParameter that ) { if ( that . type != null && that . type . tsym == sym ) result = that ; else super . visitTypeParameter ( that ) ; } } DeclScanner s = new DeclScanner ( ) ; tree . accept ( s ) ; return s . result ; } | Find the declaration for a symbol where that symbol is defined somewhere in the given tree . |
10,835 | public static List < Type > types ( List < ? extends JCTree > trees ) { ListBuffer < Type > ts = new ListBuffer < Type > ( ) ; for ( List < ? extends JCTree > l = trees ; l . nonEmpty ( ) ; l = l . tail ) ts . append ( l . head . type ) ; return ts . toList ( ) ; } | Return the types of a list of trees . |
10,836 | protected void configure ( Properties properties ) { _properties = properties ; _recipients = properties . getProperty ( "mail.smtp.to" ) . split ( " *[,;] *" ) ; _authenticator = new Authenticator ( ) { protected PasswordAuthentication getPasswordAuthentication ( ) { return new PasswordAuthentication ( _properties . getProperty ( "mail.smtp.user" ) , _properties . getProperty ( "mail.smtp.pass" ) ) ; } } ; } | Configures the EmailChannel with given properties . |
10,837 | private void initStandardTagsLowercase ( ) { Iterator < String > it = standardTags . iterator ( ) ; while ( it . hasNext ( ) ) { standardTagsLowercase . add ( StringUtils . toLowerCase ( it . next ( ) ) ) ; } } | Initialize lowercase version of standard Javadoc tags . |
10,838 | public static ApruveResponse < Subscription > get ( String suscriptionId ) { return ApruveClient . getInstance ( ) . get ( getSubscriptionsPath ( ) + suscriptionId , Subscription . class ) ; } | Get the Subscription with the given ID |
10,839 | public static ApruveResponse < SubscriptionCancelResponse > cancel ( String subscriptionId ) { return ApruveClient . getInstance ( ) . post ( getCancelPath ( subscriptionId ) , "" , SubscriptionCancelResponse . class ) ; } | Cancels the Subscription with the given ID . This cannot be undone once completed so use with care! |
10,840 | public boolean handleNextTask ( ) { Runnable task = this . getNextTask ( ) ; if ( task != null ) { synchronized ( this . tasksReachesZero ) { this . runningTasks ++ ; } try { task . run ( ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; } synchronized ( this . tasksReachesZero ) { this . runningTasks -- ; if ( this . runningTasks == 0 ) { this . tasksReachesZero . notifyAll ( ) ; } } synchronized ( task ) { task . notifyAll ( ) ; } return true ; } return false ; } | Process the next pending Task synchronously . |
10,841 | public < T extends Runnable > T executeSync ( T runnable ) { synchronized ( runnable ) { this . executeAsync ( runnable ) ; try { runnable . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } return runnable ; } | Add a Task to the queue and wait until it s run . It is guaranteed that the Runnable will be processed when this method returns . |
10,842 | public < T extends Runnable > T executeSyncTimed ( T runnable , long inMs ) { try { Thread . sleep ( inMs ) ; this . executeSync ( runnable ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } return runnable ; } | Add a Task to the queue and wait until it s run . The Task will be executed after inMs milliseconds . It is guaranteed that the Runnable will be processed when this method returns . |
10,843 | public < T extends Runnable > T executeAsyncTimed ( T runnable , long inMs ) { final Runnable theRunnable = runnable ; Timer timer = new Timer ( ) ; timer . schedule ( new TimerTask ( ) { public void run ( ) { TaskQueue . this . executeAsync ( theRunnable ) ; } } , inMs ) ; return runnable ; } | Add a Task to the queue . The Task will be executed after inMs milliseconds . |
10,844 | protected boolean waitForTasks ( ) { synchronized ( this . tasks ) { while ( ! this . closed && ! this . hasTaskPending ( ) ) { try { this . tasks . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } return ! this . closed ; } | Wait until the TaskQueue has a Task ready to process . If the TaskQueue is closed this method will also return but giving the value false . |
10,845 | public void waitAllTasks ( ) { synchronized ( this . tasks ) { while ( this . hasTaskPending ( ) ) { try { this . tasks . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } synchronized ( this . tasksReachesZero ) { if ( this . runningTasks > 0 ) { try { this . tasksReachesZero . wait ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } } } | Wait that every pending task are processed . This method will return once it has no pending task or once it has been closed |
10,846 | protected List < SchemaDescriptor > scanConnection ( String url , String user , String password , String infoLevelName , String bundledDriverName , Properties properties , Store store ) throws IOException { LOGGER . info ( "Scanning schema '{}'" , url ) ; Catalog catalog = getCatalog ( url , user , password , infoLevelName , bundledDriverName , properties ) ; return createSchemas ( catalog , store ) ; } | Scans the connection identified by the given parameters . |
10,847 | protected Catalog getCatalog ( String url , String user , String password , String infoLevelName , String bundledDriverName , Properties properties ) throws IOException { InfoLevel level = InfoLevel . valueOf ( infoLevelName . toLowerCase ( ) ) ; SchemaInfoLevel schemaInfoLevel = level . getSchemaInfoLevel ( ) ; for ( InfoLevelOption option : InfoLevelOption . values ( ) ) { String value = properties . getProperty ( option . getPropertyName ( ) ) ; if ( value != null ) { LOGGER . info ( "Setting option " + option . name ( ) + "=" + value ) ; option . set ( schemaInfoLevel , Boolean . valueOf ( value . toLowerCase ( ) ) ) ; } } SchemaCrawlerOptions options ; if ( bundledDriverName != null ) { options = getOptions ( bundledDriverName , level ) ; } else { options = new SchemaCrawlerOptions ( ) ; } options . setSchemaInfoLevel ( schemaInfoLevel ) ; LOGGER . debug ( "Scanning database schemas on '" + url + "' (user='" + user + "', info level='" + level . name ( ) + "')" ) ; Catalog catalog ; try ( Connection connection = DriverManager . getConnection ( url , user , password ) ) { catalog = SchemaCrawlerUtility . getCatalog ( connection , options ) ; } catch ( SQLException | SchemaCrawlerException e ) { throw new IOException ( String . format ( "Cannot scan schema (url='%s', user='%s'" , url , user ) , e ) ; } return catalog ; } | Retrieves the catalog metadata using schema crawler . |
10,848 | private SchemaCrawlerOptions getOptions ( String bundledDriverName , InfoLevel level ) throws IOException { for ( BundledDriver bundledDriver : BundledDriver . values ( ) ) { if ( bundledDriver . name ( ) . toLowerCase ( ) . equals ( bundledDriverName . toLowerCase ( ) ) ) { return bundledDriver . getOptions ( level ) ; } } throw new IOException ( "Unknown bundled driver name '" + bundledDriverName + "', supported values are " + Arrays . asList ( BundledDriver . values ( ) ) ) ; } | Loads the bundled driver options |
10,849 | private List < SchemaDescriptor > createSchemas ( Catalog catalog , Store store ) throws IOException { List < SchemaDescriptor > schemaDescriptors = new ArrayList < > ( ) ; Map < String , ColumnTypeDescriptor > columnTypes = new HashMap < > ( ) ; Map < Column , ColumnDescriptor > allColumns = new HashMap < > ( ) ; Set < ForeignKey > allForeignKeys = new HashSet < > ( ) ; for ( Schema schema : catalog . getSchemas ( ) ) { SchemaDescriptor schemaDescriptor = store . create ( SchemaDescriptor . class ) ; schemaDescriptor . setName ( schema . getName ( ) ) ; createTables ( catalog , schema , schemaDescriptor , columnTypes , allColumns , allForeignKeys , store ) ; createSequences ( catalog . getSequences ( schema ) , schemaDescriptor , store ) ; createRoutines ( catalog . getRoutines ( schema ) , schemaDescriptor , columnTypes , store ) ; schemaDescriptors . add ( schemaDescriptor ) ; } createForeignKeys ( allForeignKeys , allColumns , store ) ; return schemaDescriptors ; } | Stores the data . |
10,850 | private void createTables ( Catalog catalog , Schema schema , SchemaDescriptor schemaDescriptor , Map < String , ColumnTypeDescriptor > columnTypes , Map < Column , ColumnDescriptor > allColumns , Set < ForeignKey > allForeignKeys , Store store ) { for ( Table table : catalog . getTables ( schema ) ) { TableDescriptor tableDescriptor = getTableDescriptor ( table , schemaDescriptor , store ) ; Map < String , ColumnDescriptor > localColumns = new HashMap < > ( ) ; for ( Column column : table . getColumns ( ) ) { ColumnDescriptor columnDescriptor = createColumnDescriptor ( column , ColumnDescriptor . class , columnTypes , store ) ; columnDescriptor . setDefaultValue ( column . getDefaultValue ( ) ) ; columnDescriptor . setGenerated ( column . isGenerated ( ) ) ; columnDescriptor . setPartOfIndex ( column . isPartOfIndex ( ) ) ; columnDescriptor . setPartOfPrimaryKey ( column . isPartOfPrimaryKey ( ) ) ; columnDescriptor . setPartOfForeignKey ( column . isPartOfForeignKey ( ) ) ; columnDescriptor . setAutoIncremented ( column . isAutoIncremented ( ) ) ; tableDescriptor . getColumns ( ) . add ( columnDescriptor ) ; localColumns . put ( column . getName ( ) , columnDescriptor ) ; allColumns . put ( column , columnDescriptor ) ; } PrimaryKey primaryKey = table . getPrimaryKey ( ) ; if ( primaryKey != null ) { PrimaryKeyDescriptor primaryKeyDescriptor = storeIndex ( primaryKey , tableDescriptor , localColumns , PrimaryKeyDescriptor . class , PrimaryKeyOnColumnDescriptor . class , store ) ; tableDescriptor . setPrimaryKey ( primaryKeyDescriptor ) ; } for ( Index index : table . getIndices ( ) ) { IndexDescriptor indexDescriptor = storeIndex ( index , tableDescriptor , localColumns , IndexDescriptor . class , IndexOnColumnDescriptor . class , store ) ; tableDescriptor . getIndices ( ) . add ( indexDescriptor ) ; } for ( Trigger trigger : table . getTriggers ( ) ) { TriggerDescriptor triggerDescriptor = store . create ( TriggerDescriptor . class ) ; triggerDescriptor . setName ( trigger . getName ( ) ) ; triggerDescriptor . setActionCondition ( trigger . getActionCondition ( ) ) ; triggerDescriptor . setActionOrder ( trigger . getActionOrder ( ) ) ; triggerDescriptor . setActionOrientation ( trigger . getActionOrientation ( ) . name ( ) ) ; triggerDescriptor . setActionStatement ( trigger . getActionStatement ( ) ) ; triggerDescriptor . setConditionTiming ( trigger . getConditionTiming ( ) . name ( ) ) ; triggerDescriptor . setEventManipulationTime ( trigger . getEventManipulationType ( ) . name ( ) ) ; tableDescriptor . getTriggers ( ) . add ( triggerDescriptor ) ; } allForeignKeys . addAll ( table . getForeignKeys ( ) ) ; } } | Create the table descriptors . |
10,851 | private < T extends BaseColumnDescriptor > T createColumnDescriptor ( BaseColumn column , Class < T > descriptorType , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) { T columnDescriptor = store . create ( descriptorType ) ; columnDescriptor . setName ( column . getName ( ) ) ; columnDescriptor . setNullable ( column . isNullable ( ) ) ; columnDescriptor . setSize ( column . getSize ( ) ) ; columnDescriptor . setDecimalDigits ( column . getDecimalDigits ( ) ) ; ColumnDataType columnDataType = column . getColumnDataType ( ) ; ColumnTypeDescriptor columnTypeDescriptor = getColumnTypeDescriptor ( columnDataType , columnTypes , store ) ; columnDescriptor . setColumnType ( columnTypeDescriptor ) ; return columnDescriptor ; } | Create a column descriptor . |
10,852 | private void createForeignKeys ( Set < ForeignKey > allForeignKeys , Map < Column , ColumnDescriptor > allColumns , Store store ) { for ( ForeignKey foreignKey : allForeignKeys ) { ForeignKeyDescriptor foreignKeyDescriptor = store . create ( ForeignKeyDescriptor . class ) ; foreignKeyDescriptor . setName ( foreignKey . getName ( ) ) ; foreignKeyDescriptor . setDeferrability ( foreignKey . getDeferrability ( ) . name ( ) ) ; foreignKeyDescriptor . setDeleteRule ( foreignKey . getDeleteRule ( ) . name ( ) ) ; foreignKeyDescriptor . setUpdateRule ( foreignKey . getUpdateRule ( ) . name ( ) ) ; for ( ForeignKeyColumnReference columnReference : foreignKey . getColumnReferences ( ) ) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store . create ( ForeignKeyReferenceDescriptor . class ) ; Column foreignKeyColumn = columnReference . getForeignKeyColumn ( ) ; ColumnDescriptor foreignKeyColumnDescriptor = allColumns . get ( foreignKeyColumn ) ; keyReferenceDescriptor . setForeignKeyColumn ( foreignKeyColumnDescriptor ) ; Column primaryKeyColumn = columnReference . getPrimaryKeyColumn ( ) ; ColumnDescriptor primaryKeyColumnDescriptor = allColumns . get ( primaryKeyColumn ) ; keyReferenceDescriptor . setPrimaryKeyColumn ( primaryKeyColumnDescriptor ) ; foreignKeyDescriptor . getForeignKeyReferences ( ) . add ( keyReferenceDescriptor ) ; } } } | Create the foreign key descriptors . |
10,853 | private void createRoutines ( Collection < Routine > routines , SchemaDescriptor schemaDescriptor , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) throws IOException { for ( Routine routine : routines ) { RoutineDescriptor routineDescriptor ; String returnType ; switch ( routine . getRoutineType ( ) ) { case procedure : routineDescriptor = store . create ( ProcedureDescriptor . class ) ; returnType = ( ( ProcedureReturnType ) routine . getReturnType ( ) ) . name ( ) ; schemaDescriptor . getProcedures ( ) . add ( ( ProcedureDescriptor ) routineDescriptor ) ; break ; case function : routineDescriptor = store . create ( FunctionDescriptor . class ) ; returnType = ( ( FunctionReturnType ) routine . getReturnType ( ) ) . name ( ) ; schemaDescriptor . getFunctions ( ) . add ( ( FunctionDescriptor ) routineDescriptor ) ; break ; case unknown : routineDescriptor = store . create ( RoutineDescriptor . class ) ; returnType = null ; schemaDescriptor . getUnknownRoutines ( ) . add ( routineDescriptor ) ; break ; default : throw new IOException ( "Unsupported routine type " + routine . getRoutineType ( ) ) ; } routineDescriptor . setName ( routine . getName ( ) ) ; routineDescriptor . setReturnType ( returnType ) ; routineDescriptor . setBodyType ( routine . getRoutineBodyType ( ) . name ( ) ) ; routineDescriptor . setDefinition ( routine . getDefinition ( ) ) ; for ( RoutineColumn < ? extends Routine > routineColumn : routine . getColumns ( ) ) { RoutineColumnDescriptor columnDescriptor = createColumnDescriptor ( routineColumn , RoutineColumnDescriptor . class , columnTypes , store ) ; routineDescriptor . getColumns ( ) . add ( columnDescriptor ) ; RoutineColumnType columnType = routineColumn . getColumnType ( ) ; if ( columnType instanceof ProcedureColumnType ) { ProcedureColumnType procedureColumnType = ( ProcedureColumnType ) columnType ; columnDescriptor . setType ( procedureColumnType . name ( ) ) ; } else if ( columnType instanceof FunctionColumnType ) { FunctionColumnType functionColumnType = ( FunctionColumnType ) columnType ; columnDescriptor . setType ( functionColumnType . name ( ) ) ; } else { throw new IOException ( "Unsupported routine column type " + columnType . getClass ( ) . getName ( ) ) ; } } } } | Create routines i . e . functions and procedures . |
10,854 | private void createSequences ( Collection < Sequence > sequences , SchemaDescriptor schemaDescriptor , Store store ) { for ( Sequence sequence : sequences ) { SequenceDesriptor sequenceDesriptor = store . create ( SequenceDesriptor . class ) ; sequenceDesriptor . setName ( sequence . getName ( ) ) ; sequenceDesriptor . setIncrement ( sequence . getIncrement ( ) ) ; sequenceDesriptor . setMinimumValue ( sequence . getMinimumValue ( ) . longValue ( ) ) ; sequenceDesriptor . setMaximumValue ( sequence . getMaximumValue ( ) . longValue ( ) ) ; sequenceDesriptor . setCycle ( sequence . isCycle ( ) ) ; schemaDescriptor . getSequences ( ) . add ( sequenceDesriptor ) ; } } | Add the sequences of a schema to the schema descriptor . |
10,855 | private TableDescriptor getTableDescriptor ( Table table , SchemaDescriptor schemaDescriptor , Store store ) { TableDescriptor tableDescriptor ; if ( table instanceof View ) { View view = ( View ) table ; ViewDescriptor viewDescriptor = store . create ( ViewDescriptor . class ) ; viewDescriptor . setUpdatable ( view . isUpdatable ( ) ) ; CheckOptionType checkOption = view . getCheckOption ( ) ; if ( checkOption != null ) { viewDescriptor . setCheckOption ( checkOption . name ( ) ) ; } schemaDescriptor . getViews ( ) . add ( viewDescriptor ) ; tableDescriptor = viewDescriptor ; } else { tableDescriptor = store . create ( TableDescriptor . class ) ; schemaDescriptor . getTables ( ) . add ( tableDescriptor ) ; } tableDescriptor . setName ( table . getName ( ) ) ; return tableDescriptor ; } | Create a table descriptor for the given table . |
10,856 | private < I extends IndexDescriptor > I storeIndex ( Index index , TableDescriptor tableDescriptor , Map < String , ColumnDescriptor > columns , Class < I > indexType , Class < ? extends OnColumnDescriptor > onColumnType , Store store ) { I indexDescriptor = store . create ( indexType ) ; indexDescriptor . setName ( index . getName ( ) ) ; indexDescriptor . setUnique ( index . isUnique ( ) ) ; indexDescriptor . setCardinality ( index . getCardinality ( ) ) ; indexDescriptor . setIndexType ( index . getIndexType ( ) . name ( ) ) ; indexDescriptor . setPages ( index . getPages ( ) ) ; for ( IndexColumn indexColumn : index . getColumns ( ) ) { ColumnDescriptor columnDescriptor = columns . get ( indexColumn . getName ( ) ) ; OnColumnDescriptor onColumnDescriptor = store . create ( indexDescriptor , onColumnType , columnDescriptor ) ; onColumnDescriptor . setIndexOrdinalPosition ( indexColumn . getIndexOrdinalPosition ( ) ) ; onColumnDescriptor . setSortSequence ( indexColumn . getSortSequence ( ) . name ( ) ) ; } return indexDescriptor ; } | Stores index data . |
10,857 | private ColumnTypeDescriptor getColumnTypeDescriptor ( ColumnDataType columnDataType , Map < String , ColumnTypeDescriptor > columnTypes , Store store ) { String databaseSpecificTypeName = columnDataType . getDatabaseSpecificTypeName ( ) ; ColumnTypeDescriptor columnTypeDescriptor = columnTypes . get ( databaseSpecificTypeName ) ; if ( columnTypeDescriptor == null ) { columnTypeDescriptor = store . find ( ColumnTypeDescriptor . class , databaseSpecificTypeName ) ; if ( columnTypeDescriptor == null ) { columnTypeDescriptor = store . create ( ColumnTypeDescriptor . class ) ; columnTypeDescriptor . setDatabaseType ( databaseSpecificTypeName ) ; columnTypeDescriptor . setAutoIncrementable ( columnDataType . isAutoIncrementable ( ) ) ; columnTypeDescriptor . setCaseSensitive ( columnDataType . isCaseSensitive ( ) ) ; columnTypeDescriptor . setPrecision ( columnDataType . getPrecision ( ) ) ; columnTypeDescriptor . setMinimumScale ( columnDataType . getMinimumScale ( ) ) ; columnTypeDescriptor . setMaximumScale ( columnDataType . getMaximumScale ( ) ) ; columnTypeDescriptor . setFixedPrecisionScale ( columnDataType . isFixedPrecisionScale ( ) ) ; columnTypeDescriptor . setNumericPrecisionRadix ( columnDataType . getNumPrecisionRadix ( ) ) ; columnTypeDescriptor . setUnsigned ( columnDataType . isUnsigned ( ) ) ; columnTypeDescriptor . setUserDefined ( columnDataType . isUserDefined ( ) ) ; columnTypeDescriptor . setNullable ( columnDataType . isNullable ( ) ) ; } columnTypes . put ( databaseSpecificTypeName , columnTypeDescriptor ) ; } return columnTypeDescriptor ; } | Return the column type descriptor for the given data type . |
10,858 | public static ProfilePackageSummaryBuilder getInstance ( Context context , PackageDoc pkg , ProfilePackageSummaryWriter profilePackageWriter , Profile profile ) { return new ProfilePackageSummaryBuilder ( context , pkg , profilePackageWriter , profile ) ; } | Construct a new ProfilePackageSummaryBuilder . |
10,859 | public void addItem ( Point coordinates , Drawable item ) { assertEDT ( ) ; if ( coordinates == null || item == null ) { throw new IllegalArgumentException ( "Coordinates and added item cannot be null" ) ; } log . trace ( "[addItem] New item added @ {}" , coordinates ) ; getPanelAt ( coordinates ) . addModel ( item ) ; getPanelAt ( coordinates ) . repaint ( ) ; } | Adds an item to draw in a particular position |
10,860 | public void moveItem ( Point oldCoordinates , Point newCoordinates ) { assertEDT ( ) ; if ( oldCoordinates == null || newCoordinates == null ) { throw new IllegalArgumentException ( "Coordinates cannot be null" ) ; } if ( getPanelAt ( newCoordinates ) . hasModel ( ) ) { throw new IllegalStateException ( "New position contains a model in the UI already. New position = " + newCoordinates ) ; } if ( ! getPanelAt ( oldCoordinates ) . hasModel ( ) ) { throw new IllegalStateException ( "Old position doesn't contain a model in the UI. Old position = " + oldCoordinates ) ; } Drawable item = getPanelAt ( oldCoordinates ) . getModel ( ) ; removeItem ( oldCoordinates ) ; addItem ( newCoordinates , item ) ; } | Changes the position of the item in the specified location |
10,861 | public void clear ( ) { assertEDT ( ) ; log . debug ( "[clear] Cleaning board" ) ; for ( int row = 0 ; row < SIZE ; row ++ ) { for ( int col = 0 ; col < SIZE ; col ++ ) { removeItem ( new Point ( col , row ) ) ; } } } | Removes all the drawn elements |
10,862 | public void refresh ( Point coordinates ) { assertEDT ( ) ; if ( coordinates == null ) { throw new IllegalArgumentException ( "Coordinates cannot be null" ) ; } getPanelAt ( coordinates ) . repaint ( ) ; } | Repaints the item specified |
10,863 | public TablePanel removeAll ( ) { for ( int i = 0 ; i < content . length ; ++ i ) for ( int j = 0 ; j < content [ i ] . length ; ++ j ) content [ i ] [ j ] = null ; this . sendElement ( ) ; return this ; } | Removes all elements stored in this container |
10,864 | public TablePanel remove ( Widget widget ) { for ( int i = 0 ; i < content . length ; ++ i ) for ( int j = 0 ; j < content [ i ] . length ; ++ j ) if ( content [ i ] [ j ] == widget ) content [ i ] [ j ] = null ; this . sendElement ( ) ; return this ; } | Removes all elements that are instance of specified element |
10,865 | public TablePanel put ( Widget widget , int x , int y ) { if ( x < 0 || y < 0 || x >= content . length || y >= content [ x ] . length ) throw new IndexOutOfBoundsException ( ) ; attach ( widget ) ; content [ x ] [ y ] = widget ; this . sendElement ( ) ; return this ; } | Set widget to certain cell in table |
10,866 | private Map < String , String > loadProperties ( ServiceReference reference ) { log . trace ( "loadProperties" ) ; Map < String , String > properties = new HashMap < String , String > ( ) ; properties . put ( "id" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_ID ) , "" ) ) ; properties . put ( "class" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_PID ) , "" ) ) ; properties . put ( "description" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_DESCRIPTION ) , "" ) ) ; properties . put ( "vendor" , OsgiUtil . toString ( reference . getProperty ( Constants . SERVICE_VENDOR ) , "" ) ) ; properties . put ( "resourceTypes" , Arrays . toString ( OsgiUtil . toStringArray ( reference . getProperty ( ComponentBindingsProvider . RESOURCE_TYPE_PROP ) , new String [ 0 ] ) ) ) ; properties . put ( "priority" , OsgiUtil . toString ( reference . getProperty ( ComponentBindingsProvider . PRIORITY ) , "" ) ) ; properties . put ( "bundle_id" , String . valueOf ( reference . getBundle ( ) . getBundleId ( ) ) ) ; properties . put ( "bundle_name" , reference . getBundle ( ) . getSymbolicName ( ) ) ; log . debug ( "Loaded properties {}" , properties ) ; return properties ; } | Loads the properties from the specified Service Reference into a map . |
10,867 | private void renderBlock ( HttpServletResponse res , String templateName , Map < String , String > properties ) throws IOException { InputStream is = null ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; String template = null ; try { is = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( templateName ) ; if ( is != null ) { IOUtils . copy ( is , baos ) ; template = baos . toString ( ) ; } else { throw new IOException ( "Unable to load template " + templateName ) ; } } finally { IOUtils . closeQuietly ( is ) ; IOUtils . closeQuietly ( baos ) ; } StrSubstitutor sub = new StrSubstitutor ( properties ) ; res . getWriter ( ) . write ( sub . replace ( template ) ) ; } | Loads the template with the specified name from the classloader and uses it to templatize the properties using Apache Commons Lang s StrSubstitutor and writes it to the response . |
10,868 | private void unmarshall ( ) { sheetData = sheet . getJaxbElement ( ) . getSheetData ( ) ; rows = sheetData . getRow ( ) ; if ( rows != null && rows . size ( ) > 0 ) { Row r = ( Row ) rows . get ( 0 ) ; numColumns = r . getC ( ) . size ( ) ; } } | Unmarshall the data in this worksheet . |
10,869 | public int getRows ( ) { if ( sheetData == null ) unmarshall ( ) ; int ret = 0 ; if ( rows != null ) ret = rows . size ( ) ; return ret ; } | Returns the number of rows in this worksheet . |
10,870 | public static ManifestVersion get ( final Class < ? > clazz ) { final String manifestUrl = ClassExtensions . getManifestUrl ( clazz ) ; try { return of ( manifestUrl != null ? new URL ( manifestUrl ) : null ) ; } catch ( final MalformedURLException ignore ) { return of ( null ) ; } } | Returns a ManifestVersion object by reading the manifest file from the JAR WAR or EAR file that contains the given class . |
10,871 | public Object processTask ( String taskName , Map < String , String [ ] > parameterMap ) { if ( "createAdmin" . equalsIgnoreCase ( taskName ) ) { return userService . createDefaultAdmin ( ) ; } return null ; } | Create a default admin in the datastore . |
10,872 | public ValueType get ( final KeyType ... keys ) { if ( ArrayUtils . isEmpty ( keys ) ) { return null ; } int keysLength = keys . length ; if ( keysLength == 1 ) { return get ( keys [ 0 ] ) ; } else { StorageComponent < KeyType , ValueType > storageComponent = this ; int lastKeyIndex = keysLength - 1 ; for ( int i = 0 ; i < lastKeyIndex ; i ++ ) { KeyType storageComponentKey = keys [ i ] ; storageComponent = storageComponent . getStorageComponent ( storageComponentKey ) ; } return storageComponent . get ( keys [ lastKeyIndex ] ) ; } } | Returns value of keys reference . |
10,873 | public void put ( final ValueType value , final KeyType ... keys ) { if ( ArrayUtils . isEmpty ( keys ) ) { return ; } int keysLength = keys . length ; if ( keysLength == 1 ) { put ( value , keys [ 0 ] ) ; } else { StorageComponent < KeyType , ValueType > childStorageComponent = getStorageComponent ( keys [ 0 ] ) ; int lastKeyIndex = keysLength - 1 ; for ( int i = 1 ; i < lastKeyIndex ; i ++ ) { childStorageComponent = childStorageComponent . getStorageComponent ( keys [ i ] ) ; } childStorageComponent . put ( value , keys [ lastKeyIndex ] ) ; } } | Storages the value by keys . |
10,874 | public StorageComponent < KeyType , ValueType > getStorageComponent ( final KeyType key ) { KeyToStorageComponent < KeyType , ValueType > storage = getkeyToStorage ( ) ; StorageComponent < KeyType , ValueType > storageComponent = storage . get ( key ) ; if ( storageComponent == null ) { storageComponent = new StorageComponent < KeyType , ValueType > ( ) ; storage . put ( key , storageComponent ) ; } return storageComponent ; } | Returns child StorageComponent by given key . |
10,875 | public boolean add ( T element , Class < ? > accessibleClass ) { boolean added = false ; while ( accessibleClass != null && accessibleClass != this . baseClass ) { added |= this . addSingle ( element , accessibleClass ) ; for ( Class < ? > interf : accessibleClass . getInterfaces ( ) ) { this . addSingle ( element , interf ) ; } accessibleClass = accessibleClass . getSuperclass ( ) ; } return added ; } | Associate the element with accessibleClass and any of the the superclass and interfaces of the accessibleClass until baseClass |
10,876 | public void remove ( T element , Class < ? > accessibleClass ) { while ( accessibleClass != null && accessibleClass != this . baseClass ) { this . removeSingle ( element , accessibleClass ) ; for ( Class < ? > interf : accessibleClass . getInterfaces ( ) ) { this . removeSingle ( element , interf ) ; } accessibleClass = accessibleClass . getSuperclass ( ) ; } } | Remove the element from accessible class and any of the superclass and interfaces of the accessibleClass until baseClass |
10,877 | private static void _readIBANDataFromXML ( ) { final IMicroDocument aDoc = MicroReader . readMicroXML ( new ClassPathResource ( "codelists/iban-country-data.xml" ) ) ; if ( aDoc == null ) throw new InitializationException ( "Failed to read IBAN country data [1]" ) ; if ( aDoc . getDocumentElement ( ) == null ) throw new InitializationException ( "Failed to read IBAN country data [2]" ) ; final DateTimeFormatter aDTPattern = DateTimeFormatter . ISO_DATE ; for ( final IMicroElement eCountry : aDoc . getDocumentElement ( ) . getAllChildElements ( ELEMENT_COUNTRY ) ) { final String sDesc = eCountry . getTextContent ( ) ; final String sCountryCode = sDesc . substring ( 0 , 2 ) ; if ( CountryCache . getInstance ( ) . getCountry ( sCountryCode ) == null ) if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "IBAN country data: no such country code '" + sCountryCode + "' - be careful" ) ; LocalDate aValidFrom = null ; if ( eCountry . hasAttribute ( ATTR_VALIDFROM ) ) { aValidFrom = PDTFromString . getLocalDateFromString ( eCountry . getAttributeValue ( ATTR_VALIDFROM ) , aDTPattern ) ; } LocalDate aValidTo = null ; if ( eCountry . hasAttribute ( ATTR_VALIDUNTIL ) ) { aValidTo = PDTFromString . getLocalDateFromString ( eCountry . getAttributeValue ( ATTR_VALIDUNTIL ) , aDTPattern ) ; } final String sLayout = eCountry . getAttributeValue ( ATTR_LAYOUT ) ; final String sCheckDigits = eCountry . getAttributeValue ( ATTR_CHECKDIGITS ) ; final String sLen = eCountry . getAttributeValue ( ATTR_LEN ) ; final int nExpectedLength = StringParser . parseInt ( sLen , CGlobal . ILLEGAL_UINT ) ; if ( nExpectedLength == CGlobal . ILLEGAL_UINT ) throw new InitializationException ( "Failed to convert length '" + sLen + "' to int!" ) ; if ( s_aIBANData . containsKey ( sCountryCode ) ) throw new IllegalArgumentException ( "Country " + sCountryCode + " is already contained!" ) ; s_aIBANData . put ( sCountryCode , IBANCountryData . createFromString ( sCountryCode , nExpectedLength , sLayout , sCheckDigits , aValidFrom , aValidTo , sDesc ) ) ; } } | Read all IBAN country data from a file . |
10,878 | public static IBANCountryData getCountryData ( final String sCountryCode ) { ValueEnforcer . notNull ( sCountryCode , "CountryCode" ) ; return s_aIBANData . get ( sCountryCode . toUpperCase ( Locale . US ) ) ; } | Get the country data for the given country code . |
10,879 | public static String unifyIBAN ( final String sIBAN ) { if ( sIBAN == null ) return null ; String sRealIBAN = sIBAN . toUpperCase ( Locale . US ) ; sRealIBAN = RegExHelper . stringReplacePattern ( "[^0-9A-Z]" , sRealIBAN , "" ) ; if ( sRealIBAN . length ( ) < 4 ) return null ; return sRealIBAN ; } | Make an IBAN that can be parsed . It is converted to upper case and all non - alphanumeric characters are removed . |
10,880 | public static boolean isValidIBAN ( final String sIBAN , final boolean bReturnCodeIfNoCountryData ) { final String sRealIBAN = unifyIBAN ( sIBAN ) ; if ( sRealIBAN == null ) return false ; final IBANCountryData aData = s_aIBANData . get ( sRealIBAN . substring ( 0 , 2 ) ) ; if ( aData == null ) return bReturnCodeIfNoCountryData ; if ( aData . getExpectedLength ( ) != sRealIBAN . length ( ) ) return false ; if ( ! _isValidChecksumChar ( sRealIBAN . charAt ( 2 ) ) || ! _isValidChecksumChar ( sRealIBAN . charAt ( 3 ) ) ) return false ; if ( _calculateChecksum ( sRealIBAN ) != 1 ) return false ; if ( ! aData . matchesPattern ( sRealIBAN ) ) return false ; return true ; } | Check if the passed IBAN is valid and the country is supported! |
10,881 | public void buildContent ( XMLNode node , Content contentTree ) { Content packageContentTree = packageWriter . getContentHeader ( ) ; buildChildren ( node , packageContentTree ) ; contentTree . addContent ( packageContentTree ) ; } | Build the content for the package doc . |
10,882 | public JavaFileObject asJavaFileObject ( File file ) { JavacFileManager fm = ( JavacFileManager ) context . get ( JavaFileManager . class ) ; return fm . getRegularFile ( file ) ; } | Construct a JavaFileObject from the given file . |
10,883 | public Iterable < ? extends CompilationUnitTree > parse ( ) throws IOException { try { prepareCompiler ( ) ; List < JCCompilationUnit > units = compiler . parseFiles ( fileObjects ) ; for ( JCCompilationUnit unit : units ) { JavaFileObject file = unit . getSourceFile ( ) ; if ( notYetEntered . containsKey ( file ) ) notYetEntered . put ( file , unit ) ; } return units ; } finally { parsed = true ; if ( compiler != null && compiler . log != null ) compiler . log . flush ( ) ; } } | Parse the specified files returning a list of abstract syntax trees . |
10,884 | public static ClassLoader findMostCompleteClassLoader ( Class < ? > target ) { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( classLoader == null && target != null ) { classLoader = target . getClassLoader ( ) ; } if ( classLoader == null ) { classLoader = ClassLoaders . class . getClassLoader ( ) ; } if ( classLoader == null ) { classLoader = ClassLoader . getSystemClassLoader ( ) ; } if ( classLoader == null ) { throw new RuntimeException ( "Unable to find a classloader" ) ; } return classLoader ; } | Find the most complete class loader by trying the current thread context class loader then the classloader of the given class if any then the class loader that loaded SEED core then the system class loader . |
10,885 | public void emit ( Level level , String message , long sequence ) { if ( _broadcaster != null ) _broadcaster . sendNotification ( new Notification ( level . toString ( ) , _name != null ? _name : this , sequence , message ) ) ; } | Emits a notification through this manageable . |
10,886 | public < T extends Throwable > T emit ( T throwable , String message , long sequence ) { if ( _broadcaster != null ) _broadcaster . sendNotification ( new Notification ( Level . WARNING . toString ( ) , _name != null ? _name : this , sequence , message == null ? Throwables . getFullMessage ( throwable ) : message + ": " + Throwables . getFullMessage ( throwable ) ) ) ; return throwable ; } | Emits an alert for a caught Throwable through this manageable . |
10,887 | public void emit ( Level level , String message , long sequence , Logger logger ) { emit ( level , message , sequence ) ; logger . log ( level , message ) ; } | Emits a notification through this manageable entering the notification into a logger along the way . |
10,888 | public < T extends Throwable > T emit ( T throwable , String message , long sequence , Logger logger ) { message = message == null ? Throwables . getFullMessage ( throwable ) : message + ": " + Throwables . getFullMessage ( throwable ) ; emit ( Level . WARNING , message , sequence , logger ) ; return throwable ; } | Emits an alert for a caught Throwable through this manageable entering the alert into a logger along the way . |
10,889 | public ArrayList < SchemaField > getSchema ( ) { final ArrayList < SchemaField > items = new ArrayList < SchemaField > ( schemaFields . values ( ) ) ; Collections . sort ( items , new Comparator < SchemaField > ( ) { public int compare ( final SchemaField left , final SchemaField right ) { return left . getId ( ) - right . getId ( ) ; } } ) ; return items ; } | Get the schema as a collection of fields . We guarantee the ordering by field id . |
10,890 | PlatformControl bind ( ServicePlatform p , XmlWebApplicationContext c , ClassLoader l ) { _platform = p ; _root = c ; _cloader = l ; return this ; } | To be called by ServicePlatform when detected in the top - level application context . |
10,891 | public static boolean isSafeMediaType ( final String mediaType ) { return mediaType != null && VALID_MIME_TYPE . matcher ( mediaType ) . matches ( ) && ! DANGEROUS_MEDIA_TYPES . contains ( mediaType ) ; } | Returns true if the given string is a valid media type |
10,892 | public WriteStream writeStream ( ) { detachReader ( ) ; if ( writer == null ) { writer = new BytesWriteStream ( bytes , maxCapacity ) ; } return writer ; } | Attaches a writer to the object . If there is already an attached writer the existing writer is returned . If a reader is attached to the object when this method is called the reader is closed and immediately detached before a writer is created . |
10,893 | public ReadStream readStream ( ) { detachWriter ( ) ; if ( reader == null ) { reader = new BytesReadStream ( bytes , 0 , length ) ; } return reader ; } | Attaches a reader to the object . If there is already any attached reader the existing reader is returned . If a writer is attached to the object when this method is called the writer is closed and immediately detached before the reader is created . |
10,894 | public void add ( Collection < Entity > entities ) { for ( Entity entity : entities ) this . entities . put ( entity . getId ( ) , entity ) ; } | Adds the entity list to the entities for the account . |
10,895 | public Class < ? > loadClass ( String classname ) throws ClassNotFoundException { return getClass ( ) . getClassLoader ( ) . loadClass ( classname ) ; } | Get the class loader of the mock rather than that of the bundle . |
10,896 | public ResourceSchema getSchema ( final String location , final Job job ) throws IOException { final List < Schema . FieldSchema > schemaList = new ArrayList < Schema . FieldSchema > ( ) ; for ( final GoodwillSchemaField field : schema . getSchema ( ) ) { schemaList . add ( new Schema . FieldSchema ( field . getName ( ) , getPigType ( field . getType ( ) ) ) ) ; } return new ResourceSchema ( new Schema ( schemaList ) ) ; } | Get a schema for the data to be loaded . |
10,897 | public static String getUserApplicationConfigurationFilePath ( final String applicationName , final String configFileName ) { return System . getProperty ( USER_HOME_PROPERTY_KEY ) + File . separator + applicationName + File . separator + configFileName ; } | Gets the user application configuration file path . |
10,898 | public static String getTemporaryApplicationConfigurationFilePath ( final String applicationName , final String fileName ) { return System . getProperty ( JAVA_IO_TPMDIR_PROPERTY_KEY ) + File . separator + applicationName + File . separator + fileName ; } | Gets the specific temporary directory path for from the given arguments . It is indeded for any application temporary files |
10,899 | public static < T > T instantiateClass ( final Class < T > clazz ) throws IllegalArgumentException , BeanInstantiationException { return instantiateClass ( clazz , MethodUtils . EMPTY_PARAMETER_CLASSTYPES , MethodUtils . EMPTY_PARAMETER_VALUES ) ; } | Create and initialize a new instance of the given class by default constructor . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.