idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
125,600
public ParagraphBuilder styledSpan ( final String text , final TextStyle ts ) { final ParagraphElement paragraphElement = new Span ( text , ts ) ; this . paragraphElements . add ( paragraphElement ) ; return this ; }
Create a styled span with a text content
125,601
public static TableBuilder create ( final PositionUtil positionUtil , final WriteUtil writeUtil , final XMLUtil xmlUtil , final StylesContainer stylesContainer , final DataStyles format , final boolean libreOfficeMode , final String name , final int rowCapacity , final int columnCapacity ) { final ConfigItemMapEntrySet...
Create a new table builder
125,602
public void flushEndTable ( final TableAppender appender ) throws IOException { this . observer . update ( new EndTableFlusher ( appender , this . tableRows . subList ( this . lastFlushedRowIndex , this . tableRows . usedSize ( ) ) ) ) ; }
Flush the end of the table
125,603
public TableRow nextRow ( final Table table , final TableAppender appender ) throws IOException { return this . getRowSecure ( table , appender , this . curRowIndex + 1 , true ) ; }
Get the next row
125,604
public void setStyle ( final TableStyle style ) { this . stylesContainer . addPageStyle ( style . getPageStyle ( ) ) ; this . stylesContainer . addContentStyle ( style ) ; this . style = style ; }
Set a new TableFamilyStyle
125,605
public static void appendXMLToTable ( final TableRow row , final XMLUtil xmlUtil , final Appendable appendable ) throws IOException { if ( row == null ) appendable . append ( "<row />" ) ; else row . appendXMLToTable ( xmlUtil , appendable ) ; }
Append the XML corresponding to a given row to the appendable
125,606
public void setColumnsSpanned ( final int colIndex , final int n ) { if ( n <= 1 ) return ; final TableCell firstCell = this . getOrCreateCell ( colIndex ) ; if ( firstCell . isCovered ( ) ) return ; firstCell . markColumnsSpanned ( n ) ; this . coverRightCells ( colIndex , n ) ; }
Add a span across columns
125,607
public void setRowsSpanned ( final int rowIndex , final int n ) throws IOException { if ( n <= 1 ) return ; final TableCell firstCell = this . getOrCreateCell ( rowIndex ) ; if ( firstCell . isCovered ( ) ) return ; this . parent . setRowsSpanned ( this . rowIndex , rowIndex , n ) ; }
Add a span across rows
125,608
public TableCell getOrCreateCell ( final int colIndex ) { TableCell cell = this . cells . get ( colIndex ) ; if ( cell == null ) { cell = new TableCellImpl ( this . writeUtil , this . xmlUtil , this . stylesContainer , this . dataStyles , this . libreOfficeMode , this , colIndex ) ; this . cells . set ( colIndex , cell...
Get the cell at given index . If the cell was not created before then it is created by this method .
125,609
public void setStyle ( final TableRowStyle rowStyle ) { this . stylesContainer . addContentFontFaceContainerStyle ( rowStyle ) ; this . stylesContainer . addContentStyle ( rowStyle ) ; this . rowStyle = rowStyle ; }
Set the row style
125,610
public TableRow getRow ( final String pos ) throws FastOdsException , IOException { return this . builder . getRow ( this , this . appender , pos ) ; }
Return a row from a position
125,611
public void setCellMerge ( final int rowIndex , final int colIndex , final int rowMerge , final int columnMerge ) throws IOException { this . builder . setCellMerge ( this , this . appender , rowIndex , colIndex , rowMerge , columnMerge ) ; }
Set a span over cells
125,612
public void addEmbeddedStyles ( final StylesContainer stylesContainer ) { if ( this . header != null ) this . header . addEmbeddedStyles ( stylesContainer ) ; if ( this . footer != null ) this . footer . addEmbeddedStyles ( stylesContainer ) ; }
Add the style embedded in this master page style to a container
125,613
public void appendXMLToMasterStyle ( final XMLUtil util , final Appendable appendable ) throws IOException { appendable . append ( "<style:master-page" ) ; util . appendEAttribute ( appendable , "style:name" , this . name ) ; util . appendEAttribute ( appendable , "style:page-layout-name" , this . layoutName ) ; append...
Return the master - style informations for this PageStyle .
125,614
public ZipUTF8Writer build ( final OutputStream out ) { final OutputStream bufferedOut ; switch ( this . zipBufferSize ) { case NO_BUFFER : bufferedOut = out ; break ; case DEFAULT_BUFFER : bufferedOut = new BufferedOutputStream ( out ) ; break ; default : bufferedOut = new BufferedOutputStream ( out , this . zipBuffer...
Build the new writer with a given output stream
125,615
public int hashObjects ( final Object ... objects ) { final int prime = 31 ; int result = 1 ; for ( final Object object : objects ) { result = prime * result + ( ( object == null ) ? 0 : object . hashCode ( ) ) ; } return result ; }
Hash a bunch of objects
125,616
public int hashInts ( final int ... integers ) { final int prime = 31 ; int result = 1 ; for ( final int integer : integers ) result = prime * result + integer ; return result ; }
Hash a bunch of integers
125,617
static AnonymousOdsDocument create ( final Logger logger , final XMLUtil xmlUtil , final OdsElements odsElements ) { return new AnonymousOdsDocument ( logger , xmlUtil , odsElements , new CommonOdsDocument ( odsElements ) ) ; }
Create a new anonymous ODS document .
125,618
public void appendLVAttributes ( final XMLUtil util , final Appendable appendable ) throws IOException { this . appendLocaleAttributes ( util , appendable ) ; this . appendVolatileAttribute ( util , appendable ) ; }
Append locale and volatile attributes
125,619
static Settings create ( final ConfigItemSet viewSettings , final ConfigItemMapEntrySet firstView , final ConfigItemSet configurationSettings ) { final List < ConfigBlock > rootBlocks = new ArrayList < ConfigBlock > ( ) ; final ConfigItemMapIndexed views = new ConfigItemMapIndexed ( "Views" ) ; final Map < String , Con...
Create a new settings representation
125,620
void appendXMLHelper ( final XMLUtil util , final Appendable appendable , final String numberStyleName , final CharSequence number ) throws IOException { this . numberStyle . appendXMLHelper ( util , appendable , numberStyleName , number ) ; }
A helper to create the XML representation of the float style
125,621
void appendXMLHelper ( final XMLUtil util , final Appendable appendable , final String numberStyleName , final CharSequence number ) throws IOException { this . appendOpenTag ( util , appendable , numberStyleName , this . dataStyle . getName ( ) ) ; appendable . append ( number ) ; this . appendCloseTag ( appendable , ...
A helper to append XML content
125,622
public void appendNumberAttribute ( final XMLUtil util , final Appendable appendable ) throws IOException { this . appendMinIntegerDigitsAttribute ( util , appendable ) ; this . appendGroupingAttribute ( util , appendable ) ; }
Append the attributes of the number
125,623
private void appendStyleColor ( final XMLUtil util , final Appendable appendable ) throws IOException { appendable . append ( "<style:text-properties" ) ; util . appendAttribute ( appendable , "fo:color" , this . negativeValueColor . hexValue ( ) ) ; appendable . append ( "/>" ) ; }
Appends the style color .
125,624
public String set ( final int i , final String value ) { final ConfigBlock block = this . blocks . get ( i ) ; if ( block instanceof ConfigItem ) { final ConfigItem item = ( ConfigItem ) block ; final String previousValue = item . getValue ( ) ; item . setValue ( value ) ; return previousValue ; } return null ; }
Set a value for an item at a given index
125,625
public void addChildCellStyle ( final TableCellStyle style , final TableCell . Type type ) { this . contentElement . addChildCellStyle ( style , type ) ; }
Create an automatic style for this TableCellStyle and this type of cell . Do not produce any effect if the type is Type . STRING or Type . VOID
125,626
public Table addTableToContent ( final String name , final int rowCapacity , final int columnCapacity ) throws IOException { final Table previousTable = this . contentElement . getLastTable ( ) ; final Table table = this . contentElement . addTable ( name , rowCapacity , columnCapacity ) ; this . settingsElement . addT...
Add a new table to content . The config for this table is added to the settings . If the OdsElements is observed the previous table is flushed . If there is no previous table meta . xml styles . xml and the preamble of content . xml are written to destination .
125,627
public void createEmptyElements ( final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing empty ods elements to zip file" ) ; for ( final String elementName : EMPTY_ELEMENT_NAMES ) { this . logger . log ( Level . FINEST , "Writing odselement: {0} to zip file" , elementName ) ; w...
Create empty elements for package . Used on save or by the ImmutableElementsFlusher .
125,628
public void finalizeContent ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . contentElement . flushTables ( xmlUtil , writer ) ; this . contentElement . writePostamble ( xmlUtil , writer ) ; }
Flush tables and write end of document
125,629
public void flushRows ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { this . contentElement . flushRows ( util , writer , this . settingsElement ) ; }
Flush the rows
125,630
public void flushTables ( final XMLUtil util , final ZipUTF8Writer writer ) throws IOException { this . contentElement . flushTables ( util , writer ) ; }
Flush the tables
125,631
public void save ( ) throws IOException { final Table previousTable = this . contentElement . getLastTable ( ) ; if ( previousTable != null ) previousTable . flush ( ) ; this . observer . update ( new FinalizeFlusher ( this . contentElement , this . settingsElement ) ) ; }
Save the elements
125,632
public void writeContent ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: contentElement to zip file" ) ; this . contentElement . write ( xmlUtil , writer ) ; }
Write the content element to a writer .
125,633
public void writeImmutableElements ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: mimeTypeEntry to zip file" ) ; this . mimetypeElement . write ( xmlUtil , writer ) ; this . logger . log ( Level . FINER , "Writing odselement: manife...
Write the mimetype and manifest elements to a writer .
125,634
public void writeMeta ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: metaElement to zip file" ) ; this . metaElement . write ( xmlUtil , writer ) ; }
Write the meta element to a writer .
125,635
public void writeSettings ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . settingsElement . setTables ( this . getTables ( ) ) ; this . logger . log ( Level . FINER , "Writing odselement: settingsElement to zip file" ) ; this . settingsElement . write ( xmlUtil , writer ) ; }
Write the settings element to a writer .
125,636
public void writeStyles ( final XMLUtil xmlUtil , final ZipUTF8Writer writer ) throws IOException { this . logger . log ( Level . FINER , "Writing odselement: stylesElement to zip file" ) ; this . stylesElement . write ( xmlUtil , writer ) ; }
Write the styles element to a writer .
125,637
public void appendPreamble ( final XMLUtil util , final Appendable appendable ) throws IOException { if ( this . preambleWritten ) return ; appendable . append ( "<table:table" ) ; util . appendEAttribute ( appendable , "table:name" , this . builder . getName ( ) ) ; util . appendEAttribute ( appendable , "table:style-...
Append the preamble
125,638
public XceliteSheet getSheet ( int sheetIndex ) { Sheet sheet = workbook . getSheetAt ( sheetIndex ) ; if ( sheet == null ) { throw new XceliteException ( String . format ( "Could not find sheet at index %s" , sheetIndex ) ) ; } return new XceliteSheetImpl ( sheet , file ) ; }
Gets the sheet at the specified index .
125,639
public XceliteSheet getSheet ( String sheetName ) { Sheet sheet = workbook . getSheet ( sheetName ) ; if ( sheet == null ) { throw new XceliteException ( String . format ( "Could not find sheet named \"%s\"" , sheetName ) ) ; } return new XceliteSheetImpl ( sheet , file ) ; }
Gets the sheet with the specified index .
125,640
public void write ( File file ) { FileOutputStream out = null ; try { out = new FileOutputStream ( file , false ) ; workbook . write ( out ) ; } catch ( FileNotFoundException e ) { throw new RuntimeException ( e ) ; } catch ( IOException e ) { new RuntimeException ( e ) ; } finally { if ( out != null ) try { out . clos...
Saves data to a new file .
125,641
public byte [ ] getBytes ( ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { workbook . write ( baos ) ; } catch ( IOException e ) { new RuntimeException ( e ) ; } finally { if ( baos != null ) try { baos . close ( ) ; } catch ( IOException e ) { new RuntimeException ( e ) ; } } return baos . toByt...
Gets the excel file as byte array .
125,642
static public void set ( int level ) { Log . level = level ; ERROR = level <= LEVEL_ERROR ; WARN = level <= LEVEL_WARN ; INFO = level <= LEVEL_INFO ; DEBUG = level <= LEVEL_DEBUG ; TRACE = level <= LEVEL_TRACE ; }
Sets the level to log . If a version of this class is being used that has a final log level this has no affect .
125,643
public static String queryString ( Map < String , Object > values ) { StringBuilder sbuf = new StringBuilder ( ) ; String separator = "" ; for ( Map . Entry < String , Object > entry : values . entrySet ( ) ) { Object entryValue = entry . getValue ( ) ; if ( entryValue instanceof Object [ ] ) { for ( Object value : ( O...
Convert a Map to a query string .
125,644
public static JSONObject toJsonObject ( byte [ ] bytes ) { String json ; try { json = new String ( bytes , Const . UTF8 ) ; return new JSONObject ( json ) ; } catch ( UnsupportedEncodingException e ) { throw new WebbException ( e ) ; } catch ( JSONException e ) { throw new WebbException ( "payload is not a valid JSON o...
Convert a byte array to a JSONObject .
125,645
public static JSONArray toJsonArray ( byte [ ] bytes ) { String json ; try { json = new String ( bytes , Const . UTF8 ) ; return new JSONArray ( json ) ; } catch ( UnsupportedEncodingException e ) { throw new WebbException ( e ) ; } catch ( JSONException e ) { throw new WebbException ( "payload is not a valid JSON arra...
Convert a byte array to a JSONArray .
125,646
private void sendStream ( InputStream in ) { new Thread ( ( ) -> { try { con . sendData ( in ) ; con . sendResponse ( 226 , "File sent!" ) ; } catch ( ResponseException ex ) { con . sendResponse ( ex . getCode ( ) , ex . getMessage ( ) ) ; } catch ( Exception ex ) { con . sendResponse ( 451 , ex . getMessage ( ) ) ; } ...
Sends a stream asynchronously sending a response after it s done
125,647
private void receiveStream ( OutputStream out ) { new Thread ( ( ) -> { try { con . receiveData ( out ) ; con . sendResponse ( 226 , "File received!" ) ; } catch ( ResponseException ex ) { con . sendResponse ( ex . getCode ( ) , ex . getMessage ( ) ) ; } catch ( Exception ex ) { con . sendResponse ( 451 , ex . getMessa...
Receives a stream asynchronously sending a response after it s done
125,648
public void listen ( InetAddress address , int port ) throws IOException { if ( auth == null ) throw new NullPointerException ( "The Authenticator is null" ) ; if ( socket != null ) throw new IOException ( "Server already started" ) ; socket = Utils . createServer ( port , 50 , address , ssl , ! explicitSecurity ) ; se...
Starts the FTP server asynchronously .
125,649
public void listenSync ( InetAddress address , int port ) throws IOException { if ( auth == null ) throw new NullPointerException ( "The Authenticator is null" ) ; if ( socket != null ) throw new IOException ( "Server already started" ) ; socket = Utils . createServer ( port , 50 , address , ssl , ! explicitSecurity ) ...
Starts the FTP server synchronously blocking the current thread .
125,650
protected void addConnection ( Socket socket ) throws IOException { FTPConnection con = createConnection ( socket ) ; synchronized ( listeners ) { for ( IFTPListener l : listeners ) { l . onConnected ( con ) ; } } synchronized ( connections ) { connections . add ( con ) ; } }
Called when a connection is created .
125,651
protected void removeConnection ( FTPConnection con ) throws IOException { synchronized ( listeners ) { for ( IFTPListener l : listeners ) { l . onDisconnected ( con ) ; } } synchronized ( connections ) { connections . remove ( con ) ; } }
Called when a connection is terminated
125,652
protected void dispose ( ) { if ( serverThread != null ) { serverThread . interrupt ( ) ; serverThread = null ; } synchronized ( connections ) { for ( FTPConnection con : connections ) { try { con . stop ( true ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } connections . clear ( ) ; } }
Starts disposing server resources .
125,653
public void close ( ) throws IOException { dispose ( ) ; if ( socket != null ) { socket . close ( ) ; socket = null ; } }
Stops the server and dispose its resources .
125,654
public void sendResponse ( int code , String response ) { if ( con . isClosed ( ) ) return ; if ( response == null || response . isEmpty ( ) ) { response = "Unknown" ; } try { if ( response . charAt ( 0 ) == '-' ) { writer . write ( code + response + "\r\n" ) ; } else { writer . write ( code + " " + response + "\r\n" )...
Sends a response to the connection
125,655
public void sendData ( byte [ ] data ) throws ResponseException { if ( con . isClosed ( ) ) return ; Socket socket = null ; try { socket = conHandler . createDataSocket ( ) ; dataConnections . add ( socket ) ; OutputStream out = socket . getOutputStream ( ) ; Utils . write ( out , data , data . length , conHandler . is...
Sends an array of bytes through a data connection
125,656
public void sendData ( InputStream in ) throws ResponseException { if ( con . isClosed ( ) ) return ; Socket socket = null ; try { socket = conHandler . createDataSocket ( ) ; dataConnections . add ( socket ) ; OutputStream out = socket . getOutputStream ( ) ; byte [ ] buffer = new byte [ bufferSize ] ; int len ; while...
Sends a stream through a data connection
125,657
public void abortDataTransfers ( ) { while ( ! dataConnections . isEmpty ( ) ) { Socket socket = dataConnections . poll ( ) ; if ( socket != null ) Utils . closeQuietly ( socket ) ; } }
Aborts all data transfers
125,658
public void registerOption ( String option , String value ) { options . put ( option . toUpperCase ( ) , value ) ; }
Registers an option for the OPTS command
125,659
protected void addSiteCommand ( String label , String help , Command cmd ) { siteCommands . put ( label . toUpperCase ( ) , new CommandInfo ( cmd , help , true ) ) ; }
Internally registers a SITE sub - command
125,660
protected void addCommand ( String label , String help , Command cmd , boolean needsAuth ) { commands . put ( label . toUpperCase ( ) , new CommandInfo ( cmd , help , needsAuth ) ) ; }
Internally registers a command
125,661
public String getSiteHelpMessage ( String label ) { CommandInfo info = siteCommands . get ( label ) ; return info != null ? info . help : null ; }
Gets the help message from a SITE command
125,662
public String getHelpMessage ( String label ) { CommandInfo info = commands . get ( label ) ; return info != null ? info . help : null ; }
Gets the help message from a command
125,663
protected void update ( ) { if ( conHandler . shouldStop ( ) ) { Utils . closeQuietly ( this ) ; return ; } String line ; try { line = reader . readLine ( ) ; } catch ( SocketTimeoutException ex ) { if ( ! dataConnections . isEmpty ( ) && ( System . currentTimeMillis ( ) - lastUpdate ) >= timeout ) { Utils . closeQuiet...
Updates the connection
125,664
protected void stop ( boolean close ) throws IOException { if ( ! thread . isInterrupted ( ) ) { thread . interrupt ( ) ; } conHandler . onDisconnected ( ) ; if ( close ) con . close ( ) ; }
Stops the connection but does not removes it from the list .
125,665
public Properties generate ( Properties instructions , ProjectDependencies dependencies ) { Properties result = new Properties ( ) ; result . putAll ( instructions ) ; StringBuilder include = new StringBuilder ( ) ; if ( instructions . getProperty ( Constants . INCLUDE_RESOURCE ) != null ) { include . append ( instruct...
Generates the new set of instruction containing the original set of instructions enhanced with the embed dependencies results .
125,666
public static boolean isInDirectory ( File file , File directory ) { try { return FilenameUtils . directoryContains ( directory . getCanonicalPath ( ) , file . getCanonicalPath ( ) ) ; } catch ( IOException e ) { return false ; } }
Checks whether the given file is inside the given directory .
125,667
public static boolean hasExtension ( File file , String ... extensions ) { String extension = FilenameUtils . getExtension ( file . getName ( ) ) ; for ( String s : extensions ) { if ( extension . equalsIgnoreCase ( s ) || ( "." + extension ) . equalsIgnoreCase ( s ) ) { return true ; } } return false ; }
Checks whether the given file has one of the given extension .
125,668
public List < org . wisdom . api . router . Route > routes ( ) { if ( configuration . getBooleanWithDefault ( "documentation.standalone" , true ) ) { return ImmutableList . of ( new RouteBuilder ( ) . route ( HttpMethod . GET ) . on ( "/" ) . to ( this , "doc" ) ) ; } else { return Collections . emptyList ( ) ; } }
Default implementation of the routes method .
125,669
public static List < String > extractResponseCodes ( JavadocComment jdoc ) { List < String > list = new ArrayList < > ( ) ; list . addAll ( extractDocAnnotation ( DOC_RESPONSE_CODE , jdoc ) ) ; return list ; }
Return the response codes as String from a JavaDoc comment block .
125,670
public static List < String > extractResponseDescription ( JavadocComment jdoc ) { List < String > list = new ArrayList < > ( ) ; list . addAll ( extractDocAnnotation ( DOC_RESPONSE_DESCRIPTION , jdoc ) ) ; return list ; }
Return the response descriptions as String from a JavaDoc comment block .
125,671
public static List < String > extractResponseBodies ( JavadocComment jdoc ) { List < String > list = new ArrayList < > ( ) ; list . addAll ( extractDocAnnotation ( DOC_RESPONSE_BODY , jdoc ) ) ; return list ; }
Return the response bodies as String from a JavaDoc comment block .
125,672
public static String extractDescription ( JavadocComment jdoc ) { String content = jdoc . getContent ( ) . replaceAll ( "\n[ \t]+\\* ?" , "\n" ) ; int end = content . indexOf ( "\n@" ) ; if ( end > 0 ) { return content . substring ( 1 , end ) . trim ( ) ; } return content . substring ( 1 ) . trim ( ) ; }
Get a text description from JavaDoc block comment .
125,673
public final Version version ( ) { return new Version ( bundle . getVersion ( ) . getMajor ( ) , bundle . getVersion ( ) . getMinor ( ) , bundle . getVersion ( ) . getMicro ( ) , null , null , null ) ; }
Retrieves the version from the bundle version .
125,674
public static DefaultCookie convertWisdomCookieToNettyCookie ( Cookie cookie ) { DefaultCookie nettyCookie = new DefaultCookie ( cookie . name ( ) , cookie . value ( ) ) ; nettyCookie . setMaxAge ( cookie . maxAge ( ) ) ; if ( cookie . domain ( ) != null ) { nettyCookie . setDomain ( cookie . domain ( ) ) ; } if ( cook...
Converts the Wisdom s cookie to a Netty s cookie .
125,675
public static Cookie convertNettyCookieToWisdomCookie ( DefaultCookie cookie ) { Preconditions . checkNotNull ( cookie ) ; String value = cookie . value ( ) ; Cookie . Builder builder = Cookie . builder ( cookie . name ( ) , value ) ; builder . setMaxAge ( cookie . maxAge ( ) ) ; if ( cookie . domain ( ) != null ) { bu...
Converts the Netty s cookie to a Wisdom s cookie .
125,676
public static String getCookieValue ( String name , Cookies cookies ) { Cookie c = cookies . get ( name ) ; if ( c != null ) { return c . value ( ) ; } return null ; }
Gets the value of the cookie having the given name . The cookie is looked from the given cookies set .
125,677
public static void ensureOrGenerateSecret ( MavenProject project , Log log ) throws IOException { File conf = new File ( project . getBasedir ( ) , "src/main/configuration/application.conf" ) ; if ( conf . isFile ( ) ) { List < String > lines = FileUtils . readLines ( conf ) ; boolean changed = false ; for ( int i = 0 ...
Checks whether the application configuration file as the application secret . If not generates one .
125,678
public static String getBuildPluginVersion ( AbstractWisdomMojo mojo , String plugin ) { List < Plugin > plugins = mojo . project . getBuildPlugins ( ) ; for ( Plugin plug : plugins ) { if ( plug . getArtifactId ( ) . equals ( plugin ) ) { return plug . getVersion ( ) ; } } return null ; }
Retrieves the plugin version from Maven Project .
125,679
public static Xpp3Dom getBuildPluginConfiguration ( AbstractWisdomMojo mojo , String artifactId , String goal ) { List < Plugin > plugins = mojo . project . getBuildPlugins ( ) ; Plugin plugin = null ; for ( Plugin plug : plugins ) { if ( plug . getArtifactId ( ) . equals ( artifactId ) ) { plugin = plug ; } } if ( plu...
Retrieves the main configuration of the given plugin from the Maven Project .
125,680
private void clearPipelineError ( ) { File dir = new File ( buildDirectory , "pipeline" ) ; if ( dir . isDirectory ( ) ) { try { FileUtils . cleanDirectory ( dir ) ; } catch ( IOException e ) { getLog ( ) . warn ( "Cannot clean the pipeline directory" , e ) ; } } }
Deletes all error report from the pipeline error directory .
125,681
public static void store ( MavenProject project ) throws IOException { final File output = new File ( project . getBasedir ( ) , Constants . DEPENDENCIES_FILE ) ; output . getParentFile ( ) . mkdirs ( ) ; ProjectDependencies dependencies = new ProjectDependencies ( project ) ; mapper . writer ( ) . withDefaultPrettyPri...
Stores the dependencies from the given project into the dependencies . json file .
125,682
public static ProjectDependencies load ( File basedir ) throws IOException { return mapper . reader ( ProjectDependencies . class ) . readValue ( new File ( basedir , Constants . DEPENDENCIES_FILE ) ) ; }
Reloads the dependencies stored in the dependencies . json file .
125,683
public Thread newThread ( final Runnable runnable ) { Runnable wrapped = new Runnable ( ) { public void run ( ) { try { runnable . run ( ) ; } catch ( Exception e ) { log . error ( "Error while executing " + Thread . currentThread ( ) . getName ( ) , e ) ; } } } ; Thread thread = factory . newThread ( wrapped ) ; threa...
Creates a new threads .
125,684
public void execute ( ) throws MojoExecutionException { if ( ! watch ) { removeFromWatching ( ) ; } if ( extensions == null || extensions . isEmpty ( ) ) { extensions = ImmutableList . of ( "ad" , "asciidoc" , "adoc" ) ; } if ( instance == null ) { instance = getAsciidoctorInstance ( ) ; } final OptionsBuilder optionsB...
Compiles Asciidoc files from the internal and external assets to HTML .
125,685
@ Route ( method = HttpMethod . GET , uri = "i18n/bundles/{file<.+>}.json" ) public Result getBundleResourceForI18Next ( @ QueryParameter ( "locales" ) String listOfLocales , @ HttpParameter ( HeaderNames . IF_NONE_MATCH ) String ifNoneMatch ) { List < Locale > locales = new ArrayList < > ( ) ; if ( ! Strings . isNullO...
Gets the internationalized messages as a JSON document compliant with the I18Next format .
125,686
@ Route ( method = HttpMethod . GET , uri = "i18n/{key}" ) public Result getMessage ( @ Parameter ( "key" ) String key , @ QueryParameter ( "locale" ) Locale locale ) { String message ; if ( locale != null && ! locale . equals ( InternationalizationService . DEFAULT_LOCALE ) ) { message = service . get ( locale , key )...
Gets a specific internationalized message .
125,687
public boolean check ( ) { if ( ! method . getReturnType ( ) . equals ( Void . TYPE ) ) { WebSocketRouter . getLogger ( ) . error ( "The method {} annotated with a web socket callback is not well-formed. " + "These methods receive only parameter annotated with @Parameter and do not return anything" , method . getName (...
Checks that the callback is well - formed .
125,688
public void invoke ( String uri , String client , byte [ ] content ) throws InvocationTargetException , IllegalAccessException { Map < String , String > values = getPathParametersEncoded ( uri ) ; Object [ ] parameters = new Object [ arguments . size ( ) ] ; for ( int i = 0 ; i < arguments . size ( ) ; i ++ ) { ActionP...
Invokes the callback .
125,689
private void publish ( String buffer ) { CommandResult out = new CommandResult ( myType ) ; out . setContent ( buffer ) ; synchronized ( lock ) { publisher . publish ( topic , out . toString ( ) ) ; } }
Use the Publisher in order to broadcast the command result through the web - socket .
125,690
public void controllerParsed ( File source , ControllerModel < Raml > model ) throws WatchingException { Raml raml = new Raml ( ) ; raml . setBaseUri ( baseUri ) ; raml . setVersion ( project ( ) . getVersion ( ) ) ; model . accept ( controllerVisitor , raml ) ; getLog ( ) . info ( "Create raml file for controller " + ...
Generate the raml file from a given controller source file .
125,691
private File getRamlOutputFile ( File input ) { String ramlFileName = input . getName ( ) . substring ( 0 , input . getName ( ) . length ( ) - 4 ) + "raml" ; File outDir ; if ( outputDirectory == null ) { outDir = new File ( WatcherUtils . getExternalAssetsDestination ( basedir ) , "raml" ) ; } else { outDir = new File...
Create the . raml file from the java source file .
125,692
public CommandResult exec ( String commandLine ) { CommandResult result = new CommandResult ( RESULT ) ; try { Object raw = shellSession . execute ( commandLine ) ; if ( raw != null ) { result . setContent ( format ( raw ) ) ; } } catch ( Exception e ) { result . setType ( ERR ) ; result . setContent ( e . getMessage (...
Execute a command on the gogo shell .
125,693
private String format ( Object o ) { return shellSession . format ( o , Converter . INSPECT ) . toString ( ) ; }
Format the given object as a String .
125,694
private void checkSize ( long newSize , long maxSize , HttpServerFileUpload upload ) { if ( maxSize >= 0 && newSize > maxSize ) { upload . handler ( null ) ; report ( new IllegalStateException ( "Size exceed allowed maximum capacity" ) ) ; } }
Checks whether we exceed the max allowed file size .
125,695
public void updatedTemplate ( Bundle bundle , File templateFile ) { ThymeLeafTemplateImplementation template = getTemplateByFile ( templateFile ) ; if ( template != null ) { LOGGER . debug ( "Thymeleaf template updated for {} ({})" , templateFile . getAbsoluteFile ( ) , template . fullName ( ) ) ; updatedTemplate ( ) ;...
Updates the template object using the given file as backend .
125,696
private ThymeLeafTemplateImplementation getTemplateByFile ( File templateFile ) { try { return getTemplateByURL ( templateFile . toURI ( ) . toURL ( ) ) ; } catch ( MalformedURLException e ) { } return null ; }
Gets the template object using the given file as backend .
125,697
private ThymeLeafTemplateImplementation getTemplateByURL ( URL url ) { Collection < ThymeLeafTemplateImplementation > list = registrations . keySet ( ) ; for ( ThymeLeafTemplateImplementation template : list ) { if ( template . getURL ( ) . sameFile ( url ) ) { return template ; } } return null ; }
Gets the template object using the given url as backend .
125,698
public void deleteTemplate ( File templateFile ) { ThymeLeafTemplateImplementation template = getTemplateByFile ( templateFile ) ; if ( template != null ) { deleteTemplate ( template ) ; } }
Deletes the template using the given file as backend .
125,699
public ThymeLeafTemplateImplementation addTemplate ( Bundle bundle , URL templateURL ) { ThymeLeafTemplateImplementation template = getTemplateByURL ( templateURL ) ; if ( template != null ) { return template ; } synchronized ( this ) { template = new ThymeLeafTemplateImplementation ( engine , templateURL , router , as...
Adds a template form the given url .