idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
22,700 | public final ProcessorDependencyGraph getProcessorGraph ( ) { if ( this . processorGraph == null ) { synchronized ( this ) { if ( this . processorGraph == null ) { final Map < String , Class < ? > > attcls = new HashMap < > ( ) ; for ( Map . Entry < String , Attribute > attribute : this . attributes . entrySet ( ) ) { ... | Get the processor graph to use for executing all the processors for the template . |
22,701 | @ SuppressWarnings ( "unchecked" ) public final java . util . Optional < Style > getStyle ( final String styleName ) { final String styleRef = this . styles . get ( styleName ) ; Optional < Style > style ; if ( styleRef != null ) { style = ( Optional < Style > ) this . styleParser . loadStyle ( getConfiguration ( ) , t... | Look for a style in the named styles provided in the configuration . |
22,702 | public void init ( ) { this . metricRegistry . register ( name ( "gc" ) , new GarbageCollectorMetricSet ( ) ) ; this . metricRegistry . register ( name ( "memory" ) , new MemoryUsageGaugeSet ( ) ) ; this . metricRegistry . register ( name ( "thread-states" ) , new ThreadStatesGaugeSet ( ) ) ; this . metricRegistry . re... | Add several jvm metrics . |
22,703 | public void postConstruct ( ) throws URISyntaxException { WmsVersion . lookup ( this . version ) ; Assert . isTrue ( validateBaseUrl ( ) , "invalid baseURL" ) ; Assert . isTrue ( this . layers . length > 0 , "There must be at least one layer defined for a WMS request" + " to make sense" ) ; if ( this . styles != null &... | Validate some of the properties of this layer . |
22,704 | public BufferedImage createBufferedImage ( final int imageWidth , final int imageHeight ) { return new BufferedImage ( imageWidth , imageHeight , BufferedImage . TYPE_4BYTE_ABGR ) ; } | Create a buffered image with the correct image bands etc ... for the tiles being loaded . |
22,705 | public void setKeywords ( final List < String > keywords ) { StringBuilder builder = new StringBuilder ( ) ; for ( String keyword : keywords ) { if ( builder . length ( ) > 0 ) { builder . append ( ',' ) ; } builder . append ( keyword . trim ( ) ) ; } this . keywords = Optional . of ( builder . toString ( ) ) ; } | The keywords to include in the PDF metadata . |
22,706 | protected String getKey ( final String ref , final String filename , final String extension ) { return prefix + ref + "/" + filename + "." + extension ; } | Compute the key to use . |
22,707 | private Object tryConvert ( final MfClientHttpRequestFactory clientHttpRequestFactory , final Object rowValue ) throws URISyntaxException , IOException { if ( this . converters . isEmpty ( ) ) { return rowValue ; } String value = String . valueOf ( rowValue ) ; for ( TableColumnConverter < ? > converter : this . conver... | If converters are set on a table this function tests if these can convert a cell value . The first converter which claims that it can convert will be used to do the conversion . |
22,708 | public final Integer optInt ( final String key ) { final int result = this . obj . optInt ( key , Integer . MIN_VALUE ) ; return result == Integer . MIN_VALUE ? null : result ; } | Get a property as a int or null . |
22,709 | public final Double optDouble ( final String key ) { double result = this . obj . optDouble ( key , Double . NaN ) ; if ( Double . isNaN ( result ) ) { return null ; } return result ; } | Get a property as a double or null . |
22,710 | public final Boolean optBool ( final String key ) { if ( this . obj . optString ( key , null ) == null ) { return null ; } else { return this . obj . optBoolean ( key ) ; } } | Get a property as a boolean or null . |
22,711 | public final PJsonObject optJSONObject ( final String key ) { final JSONObject val = this . obj . optJSONObject ( key ) ; return val != null ? new PJsonObject ( this , val , key ) : null ; } | Get a property as a json object or null . |
22,712 | public final PJsonArray getJSONArray ( final String key ) { final JSONArray val = this . obj . optJSONArray ( key ) ; if ( val == null ) { throw new ObjectMissingException ( this , key ) ; } return new PJsonArray ( this , val , key ) ; } | Get a property as a json array or throw exception . |
22,713 | public final PJsonArray optJSONArray ( final String key , final PJsonArray defaultValue ) { PJsonArray result = optJSONArray ( key ) ; return result != null ? result : defaultValue ; } | Get a property as a json array or default . |
22,714 | public final boolean has ( final String key ) { String result = this . obj . optString ( key , null ) ; return result != null ; } | Check if the object has a property with the key . |
22,715 | public void setAttributes ( final Map < String , Attribute > attributes ) { this . internalAttributes = attributes ; this . allAttributes . putAll ( attributes ) ; } | All the attributes needed either by the processors for each datasource row or by the jasper template . |
22,716 | public void setAttribute ( final String name , final Attribute attribute ) { if ( name . equals ( "datasource" ) ) { this . allAttributes . putAll ( ( ( DataSourceAttribute ) attribute ) . getAttributes ( ) ) ; } else if ( this . copyAttributes . contains ( name ) ) { this . allAttributes . put ( name , attribute ) ; }... | All the sub - level attributes . |
22,717 | public String getBody ( ) { if ( body == null ) { return storage == null ? DEFAULT_BODY : DEFAULT_BODY_STORAGE ; } else { return body ; } } | Returns the configured body or the default value . |
22,718 | private boolean isTileVisible ( final ReferencedEnvelope tileBounds ) { if ( FloatingPointUtil . equals ( this . transformer . getRotation ( ) , 0.0 ) ) { return true ; } final GeometryFactory gfac = new GeometryFactory ( ) ; final Optional < Geometry > rotatedMapBounds = getRotatedMapBounds ( gfac ) ; if ( rotatedMapB... | When using a map rotation there might be tiles that are outside the rotated map area . To avoid to load these tiles this method checks if a tile is really required to draw the map . |
22,719 | private List < Rule > getStyleRules ( final String styleProperty ) { final List < Rule > styleRules = new ArrayList < > ( this . json . size ( ) ) ; for ( Iterator < String > iterator = this . json . keys ( ) ; iterator . hasNext ( ) ; ) { String styleKey = iterator . next ( ) ; if ( styleKey . equals ( JSON_STYLE_PROP... | Creates SLD rules for each old style . |
22,720 | public void setHeaders ( final Set < String > names ) { Set < String > lowerCaseNames = new HashSet < > ( ) ; for ( String name : names ) { lowerCaseNames . add ( name . toLowerCase ( ) ) ; } this . headerNames = lowerCaseNames ; } | Set the header names to forward from the request . Should not be defined if all is set to true |
22,721 | public static Multimap < String , String > convertToMultiMap ( final PObject objectParams ) { Multimap < String , String > params = HashMultimap . create ( ) ; if ( objectParams != null ) { Iterator < String > customParamsIter = objectParams . keys ( ) ; while ( customParamsIter . hasNext ( ) ) { String key = customPar... | convert a param object to a multimap . |
22,722 | public Envelope getMaxExtent ( ) { final int minX = 0 ; final int maxX = 1 ; final int minY = 2 ; final int maxY = 3 ; return new Envelope ( this . maxExtent [ minX ] , this . maxExtent [ minY ] , this . maxExtent [ maxX ] , this . maxExtent [ maxY ] ) ; } | Get the max extent as a envelop object . |
22,723 | public final void setConfigurationFiles ( final Map < String , String > configurationFiles ) throws URISyntaxException { this . configurationFiles . clear ( ) ; this . configurationFileLastModifiedTimes . clear ( ) ; for ( Map . Entry < String , String > entry : configurationFiles . entrySet ( ) ) { if ( ! entry . getV... | The setter for setting configuration file . It will convert the value to a URI . |
22,724 | public final ZoomToFeatures copy ( ) { ZoomToFeatures obj = new ZoomToFeatures ( ) ; obj . zoomType = this . zoomType ; obj . minScale = this . minScale ; obj . minMargin = this . minMargin ; return obj ; } | Make a copy . |
22,725 | public String getFullContentType ( ) { final String url = this . url . toExternalForm ( ) . substring ( "data:" . length ( ) ) ; final int endIndex = url . indexOf ( ',' ) ; if ( endIndex >= 0 ) { final String contentType = url . substring ( 0 , endIndex ) ; if ( ! contentType . isEmpty ( ) ) { return contentType ; } }... | Get the content - type including the optional ; base64 . |
22,726 | public final Optional < Boolean > tryOverrideValidation ( final MatchInfo matchInfo ) throws SocketException , UnknownHostException , MalformedURLException { for ( AddressHostMatcher addressHostMatcher : this . matchersForHost ) { if ( addressHostMatcher . matches ( matchInfo ) ) { return Optional . empty ( ) ; } } ret... | Check the given URI to see if it matches . |
22,727 | public final void setHost ( final String host ) throws UnknownHostException { this . host = host ; final InetAddress [ ] inetAddresses = InetAddress . getAllByName ( host ) ; for ( InetAddress address : inetAddresses ) { final AddressHostMatcher matcher = new AddressHostMatcher ( ) ; matcher . setIp ( address . getHost... | Set the host . |
22,728 | @ SuppressWarnings ( "unchecked" ) public Multimap < String , Processor > getAllRequiredAttributes ( ) { Multimap < String , Processor > requiredInputs = HashMultimap . create ( ) ; for ( ProcessorGraphNode root : this . roots ) { final BiMap < String , String > inputMapper = root . getInputMapper ( ) ; for ( String at... | Get all the names of inputs that are required to be in the Values object when this graph is executed . |
22,729 | public Set < Processor < ? , ? > > getAllProcessors ( ) { IdentityHashMap < Processor < ? , ? > , Void > all = new IdentityHashMap < > ( ) ; for ( ProcessorGraphNode < ? , ? > root : this . roots ) { for ( Processor p : root . getAllProcessors ( ) ) { all . put ( p , null ) ; } } return all . keySet ( ) ; } | Create a set containing all the processors in the graph . |
22,730 | public void validate ( final List < Throwable > validationErrors ) { if ( this . matchers == null ) { validationErrors . add ( new IllegalArgumentException ( "Matchers cannot be null. There should be at least a !acceptAll matcher" ) ) ; } if ( this . matchers != null && this . matchers . isEmpty ( ) ) { validationErro... | Validate the configuration . |
22,731 | public final void init ( ) throws URISyntaxException { final String address = getConfig ( ADDRESS , null ) ; if ( address != null ) { final URI uri = new URI ( "udp://" + address ) ; final String prefix = getConfig ( PREFIX , "mapfish-print" ) . replace ( "%h" , getHostname ( ) ) ; final int period = Integer . parseInt... | Start the StatsD reporter if configured . |
22,732 | public static MapBounds adjustBoundsToScaleAndMapSize ( final GenericMapAttributeValues mapValues , final Rectangle paintArea , final MapBounds bounds , final double dpi ) { MapBounds newBounds = bounds ; if ( mapValues . isUseNearestScale ( ) ) { newBounds = newBounds . adjustBoundsToNearestScale ( mapValues . getZoom... | If requested adjust the bounds to the nearest scale and the map size . |
22,733 | public static SVGGraphics2D createSvgGraphics ( final Dimension size ) throws ParserConfigurationException { DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder db = dbf . newDocumentBuilder ( ) ; Document document = db . getDOMImplementation ( ) . createDocument ( null , "svg" , nul... | Create a SVG graphic with the give dimensions . |
22,734 | public static void saveSvgFile ( final SVGGraphics2D graphics2d , final File path ) throws IOException { try ( FileOutputStream fs = new FileOutputStream ( path ) ; OutputStreamWriter outputStreamWriter = new OutputStreamWriter ( fs , StandardCharsets . UTF_8 ) ; Writer osw = new BufferedWriter ( outputStreamWriter ) )... | Save a SVG graphic to the given path . |
22,735 | private ReferencedEnvelope getFeatureBounds ( final MfClientHttpRequestFactory clientHttpRequestFactory , final MapAttributeValues mapValues , final ExecutionContext context ) { final MapfishMapContext mapContext = createMapContext ( mapValues ) ; String layerName = mapValues . zoomToFeatures . layer ; ReferencedEnvelo... | Get the bounding - box containing all features of all layers . |
22,736 | public final File getJasperCompilation ( final Configuration configuration ) { File jasperCompilation = new File ( getWorking ( configuration ) , "jasper-bin" ) ; createIfMissing ( jasperCompilation , "Jasper Compilation" ) ; return jasperCompilation ; } | Get the directory where the compiled jasper reports should be put . |
22,737 | public final File getTaskDirectory ( ) { createIfMissing ( this . working , "Working" ) ; try { return Files . createTempDirectory ( this . working . toPath ( ) , TASK_DIR_PREFIX ) . toFile ( ) ; } catch ( IOException e ) { throw new AssertionError ( "Unable to create temporary directory in '" + this . working + "'" ) ... | Creates and returns a temporary directory for a printing task . |
22,738 | public final void removeDirectory ( final File directory ) { try { FileUtils . deleteDirectory ( directory ) ; } catch ( IOException e ) { LOGGER . error ( "Unable to delete directory '{}'" , directory ) ; } } | Deletes the given directory . |
22,739 | public final File getBuildFileFor ( final Configuration configuration , final File jasperFileXml , final String extension , final Logger logger ) { final String configurationAbsolutePath = configuration . getDirectory ( ) . getPath ( ) ; final int prefixToConfiguration = configurationAbsolutePath . length ( ) + 1 ; fin... | Calculate the file to compile a jasper report template to . |
22,740 | public static URI createRestURI ( final String matrixId , final int row , final int col , final WMTSLayerParam layerParam ) throws URISyntaxException { String path = layerParam . baseURL ; if ( layerParam . dimensions != null ) { for ( int i = 0 ; i < layerParam . dimensions . length ; i ++ ) { String dimension = layer... | Prepare the baseURL to make a request . |
22,741 | public final String getPath ( final String key ) { StringBuilder result = new StringBuilder ( ) ; addPathTo ( result ) ; result . append ( "." ) ; result . append ( getPathElement ( key ) ) ; return result . toString ( ) ; } | Gets the string representation of the path to the current JSON element . |
22,742 | protected final void addPathTo ( final StringBuilder result ) { if ( this . parent != null ) { this . parent . addPathTo ( result ) ; if ( ! ( this . parent instanceof PJsonArray ) ) { result . append ( "." ) ; } } result . append ( getPathElement ( this . contextName ) ) ; } | Append the path to the StringBuilder . |
22,743 | public static void main ( final String [ ] args ) { if ( System . getProperty ( "db.name" ) == null ) { System . out . println ( "Not running in multi-instance mode: no DB to connect to" ) ; System . exit ( 1 ) ; } while ( true ) { try { Class . forName ( "org.postgresql.Driver" ) ; DriverManager . getConnection ( "jdb... | A comment . |
22,744 | private void started ( final ProcessorGraphNode processorGraphNode ) { this . processorLock . lock ( ) ; try { this . runningProcessors . put ( processorGraphNode . getProcessor ( ) , null ) ; } finally { this . processorLock . unlock ( ) ; } } | Flag that the processor has started execution . |
22,745 | public boolean isRunning ( final ProcessorGraphNode processorGraphNode ) { this . processorLock . lock ( ) ; try { return this . runningProcessors . containsKey ( processorGraphNode . getProcessor ( ) ) ; } finally { this . processorLock . unlock ( ) ; } } | Return true if the processor of the node is currently being executed . |
22,746 | public boolean isFinished ( final ProcessorGraphNode processorGraphNode ) { this . processorLock . lock ( ) ; try { return this . executedProcessors . containsKey ( processorGraphNode . getProcessor ( ) ) ; } finally { this . processorLock . unlock ( ) ; } } | Return true if the processor of the node has previously been executed . |
22,747 | public void finished ( final ProcessorGraphNode processorGraphNode ) { this . processorLock . lock ( ) ; try { this . runningProcessors . remove ( processorGraphNode . getProcessor ( ) ) ; this . executedProcessors . put ( processorGraphNode . getProcessor ( ) , null ) ; } finally { this . processorLock . unlock ( ) ; ... | Flag that the processor has completed execution . |
22,748 | public final void draw ( ) { AffineTransform transform = new AffineTransform ( this . transform ) ; transform . concatenate ( getAlignmentTransform ( ) ) ; this . graphics2d . setTransform ( transform ) ; this . graphics2d . setColor ( this . params . getBackgroundColor ( ) ) ; this . graphics2d . fillRect ( 0 , 0 , th... | Start the rendering of the scalebar . |
22,749 | private AffineTransform getAlignmentTransform ( ) { final int offsetX ; switch ( this . settings . getParams ( ) . getAlign ( ) ) { case LEFT : offsetX = 0 ; break ; case RIGHT : offsetX = this . settings . getMaxSize ( ) . width - this . settings . getSize ( ) . width ; break ; case CENTER : default : offsetX = ( int ... | Create a transformation which takes the alignment settings into account . |
22,750 | protected final MapfishMapContext getLayerTransformer ( final MapfishMapContext transformer ) { MapfishMapContext layerTransformer = transformer ; if ( ! FloatingPointUtil . equals ( transformer . getRotation ( ) , 0.0 ) && ! this . supportsNativeRotation ( ) ) { layerTransformer = new MapfishMapContext ( transformer ,... | If the layer transformer has not been prepared yet do it . |
22,751 | public static void log ( final String templateName , final Template template , final Values values ) { new ValuesLogger ( ) . doLog ( templateName , template , values ) ; } | Log the values for the provided template . |
22,752 | private static String getFileName ( final MapPrinter mapPrinter , final PJsonObject spec ) { String fileName = spec . optString ( Constants . OUTPUT_FILENAME_KEY ) ; if ( fileName != null ) { return fileName ; } if ( mapPrinter != null ) { final Configuration config = mapPrinter . getConfiguration ( ) ; final String te... | Read filename from spec . |
22,753 | protected PrintResult withOpenOutputStream ( final PrintAction function ) throws Exception { final File reportFile = getReportFile ( ) ; final Processor . ExecutionContext executionContext ; try ( FileOutputStream out = new FileOutputStream ( reportFile ) ; BufferedOutputStream bout = new BufferedOutputStream ( out ) )... | Open an OutputStream and execute the function using the OutputStream . |
22,754 | static Style get ( final GridParam params ) { final StyleBuilder builder = new StyleBuilder ( ) ; final Symbolizer pointSymbolizer = crossSymbolizer ( "shape://plus" , builder , CROSS_SIZE , params . gridColor ) ; final Style style = builder . createStyle ( pointSymbolizer ) ; final List < Symbolizer > symbolizers = st... | Create the Grid Point style . |
22,755 | public Scale get ( final int index , final DistanceUnit unit ) { return new Scale ( this . scaleDenominators [ index ] , unit , PDF_DPI ) ; } | Get the scale at the given index . |
22,756 | public double [ ] getScaleDenominators ( ) { double [ ] dest = new double [ this . scaleDenominators . length ] ; System . arraycopy ( this . scaleDenominators , 0 , dest , 0 , this . scaleDenominators . length ) ; return dest ; } | Return a copy of the zoom level scale denominators . Scales are sorted greatest to least . |
22,757 | public final SimpleFeatureCollection autoTreat ( final Template template , final String features ) throws IOException { SimpleFeatureCollection featuresCollection = treatStringAsURL ( template , features ) ; if ( featuresCollection == null ) { featuresCollection = treatStringAsGeoJson ( features ) ; } return featuresCo... | Get the features collection from a GeoJson inline string or URL . |
22,758 | public final SimpleFeatureCollection treatStringAsURL ( final Template template , final String geoJsonUrl ) throws IOException { URL url ; try { url = FileUtils . testForLegalFileUrl ( template . getConfiguration ( ) , new URL ( geoJsonUrl ) ) ; } catch ( MalformedURLException e ) { return null ; } final String geojson... | Get the features collection from a GeoJson URL . |
22,759 | public boolean supportsNativeRotation ( ) { return this . params . useNativeAngle && ( this . params . serverType == WmsLayerParam . ServerType . MAPSERVER || this . params . serverType == WmsLayerParam . ServerType . GEOSERVER ) ; } | If supported by the WMS server a parameter angle can be set on customParams or mergeableParams . In this case the rotation will be done natively by the WMS . |
22,760 | protected static File platformIndependentUriToFile ( final URI fileURI ) { File file ; try { file = new File ( fileURI ) ; } catch ( IllegalArgumentException e ) { if ( fileURI . toString ( ) . startsWith ( "file://" ) ) { file = new File ( fileURI . toString ( ) . substring ( "file://" . length ( ) ) ) ; } else { thro... | Convert a url to a file object . No checks are made to see if file exists but there are some hacks that are needed to convert uris to files across platforms . |
22,761 | public static String getContext ( final PObject [ ] objs ) { StringBuilder result = new StringBuilder ( "(" ) ; boolean first = true ; for ( PObject obj : objs ) { if ( ! first ) { result . append ( '|' ) ; } first = false ; result . append ( obj . getCurrentPath ( ) ) ; } result . append ( ')' ) ; return result . toSt... | Build the context name . |
22,762 | public final void save ( final PrintJobStatusExtImpl entry ) { getSession ( ) . merge ( entry ) ; getSession ( ) . flush ( ) ; getSession ( ) . evict ( entry ) ; } | Save Job Record . |
22,763 | public final Object getValue ( final String id , final String property ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaQuery < Object > criteria = builder . createQuery ( Object . class ) ; final Root < PrintJobStatusExtImpl > root = criteria . from ( PrintJobStatusExtImpl . ... | get specific property value of job . |
22,764 | public final void cancelOld ( final long starttimeThreshold , final long checkTimeThreshold , final String message ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaUpdate < PrintJobStatusExtImpl > update = builder . createCriteriaUpdate ( PrintJobStatusExtImpl . class ) ; fina... | Cancel old waiting jobs . |
22,765 | public final void updateLastCheckTime ( final String id , final long lastCheckTime ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaUpdate < PrintJobStatusExtImpl > update = builder . createCriteriaUpdate ( PrintJobStatusExtImpl . class ) ; final Root < PrintJobStatusExtImpl >... | Update the lastCheckTime of the given record . |
22,766 | public final int deleteOld ( final long checkTimeThreshold ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaDelete < PrintJobStatusExtImpl > delete = builder . createCriteriaDelete ( PrintJobStatusExtImpl . class ) ; final Root < PrintJobStatusExtImpl > root = delete . from ( ... | Delete old jobs . |
22,767 | public final List < PrintJobStatusExtImpl > poll ( final int size ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaQuery < PrintJobStatusExtImpl > criteria = builder . createQuery ( PrintJobStatusExtImpl . class ) ; final Root < PrintJobStatusExtImpl > root = criteria . from (... | Poll for the next N waiting jobs in line . |
22,768 | public final PrintJobResultExtImpl getResult ( final URI reportURI ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaQuery < PrintJobResultExtImpl > criteria = builder . createQuery ( PrintJobResultExtImpl . class ) ; final Root < PrintJobResultExtImpl > root = criteria . from ... | Get result report . |
22,769 | public void delete ( final String referenceId ) { final CriteriaBuilder builder = getSession ( ) . getCriteriaBuilder ( ) ; final CriteriaDelete < PrintJobStatusExtImpl > delete = builder . createCriteriaDelete ( PrintJobStatusExtImpl . class ) ; final Root < PrintJobStatusExtImpl > root = delete . from ( PrintJobStatu... | Delete a record . |
22,770 | public final void configureAccess ( final Template template , final ApplicationContext context ) { final Configuration configuration = template . getConfiguration ( ) ; AndAccessAssertion accessAssertion = context . getBean ( AndAccessAssertion . class ) ; accessAssertion . setPredicates ( configuration . getAccessAsse... | Configure the access permissions required to access this print job . |
22,771 | protected final < T > StyleSupplier < T > createStyleSupplier ( final Template template , final String styleRef ) { return new StyleSupplier < T > ( ) { public Style load ( final MfClientHttpRequestFactory requestFactory , final T featureSource ) { final StyleParser parser = AbstractGridCoverageLayerPlugin . this . sty... | Common method for creating styles . |
22,772 | private void store ( final PrintJobStatus printJobStatus ) throws JSONException { JSONObject metadata = new JSONObject ( ) ; metadata . put ( JSON_REQUEST_DATA , printJobStatus . getEntry ( ) . getRequestData ( ) . getInternalObj ( ) ) ; metadata . put ( JSON_STATUS , printJobStatus . getStatus ( ) . toString ( ) ) ; m... | Store the data of a print job in the registry . |
22,773 | public static boolean canParseColor ( final String colorString ) { try { return ColorParser . toColor ( colorString ) != null ; } catch ( Exception exc ) { return false ; } } | Check if the given color string can be parsed . |
22,774 | private static Dimension adaptTileDimensions ( final Dimension pixels , final int maxWidth , final int maxHeight ) { return new Dimension ( adaptTileDimension ( pixels . width , maxWidth ) , adaptTileDimension ( pixels . height , maxHeight ) ) ; } | Adapt the size of the tiles so that we have the same amount of tiles as we would have had with maxWidth and maxHeight but with the smallest tiles as possible . |
22,775 | public static Multimap < String , String > getParameters ( final String rawQuery ) { Multimap < String , String > result = HashMultimap . create ( ) ; if ( rawQuery == null ) { return result ; } StringTokenizer tokens = new StringTokenizer ( rawQuery , "&" ) ; while ( tokens . hasMoreTokens ( ) ) { String pair = tokens... | Parse the URI and get all the parameters in map form . Query name - > ; List of Query values . |
22,776 | public static URI setQueryParams ( final URI initialUri , final Multimap < String , String > queryParams ) { StringBuilder queryString = new StringBuilder ( ) ; for ( Map . Entry < String , String > entry : queryParams . entries ( ) ) { if ( queryString . length ( ) > 0 ) { queryString . append ( "&" ) ; } queryString ... | Construct a new uri by replacing query parameters in initialUri with the query parameters provided . |
22,777 | public static URI setPath ( final URI initialUri , final String path ) { String finalPath = path ; if ( ! finalPath . startsWith ( "/" ) ) { finalPath = '/' + path ; } try { if ( initialUri . getHost ( ) == null && initialUri . getAuthority ( ) != null ) { return new URI ( initialUri . getScheme ( ) , initialUri . getA... | Set the replace of the uri and return the new URI . |
22,778 | public final PJsonArray toJSON ( ) { JSONArray jsonArray = new JSONArray ( ) ; final int size = this . array . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { final Object o = get ( i ) ; if ( o instanceof PYamlObject ) { PYamlObject pYamlObject = ( PYamlObject ) o ; jsonArray . put ( pYamlObject . toJSON ( ) . getInt... | Convert this object to a json array . |
22,779 | public void checkUniqueSchemes ( ) { Multimap < String , ConfigFileLoaderPlugin > schemeToPluginMap = HashMultimap . create ( ) ; for ( ConfigFileLoaderPlugin plugin : getLoaderPlugins ( ) ) { schemeToPluginMap . put ( plugin . getUriScheme ( ) , plugin ) ; } StringBuilder violations = new StringBuilder ( ) ; for ( Str... | Method is called by spring and verifies that there is only one plugin per URI scheme . |
22,780 | public Set < String > getSupportedUriSchemes ( ) { Set < String > schemes = new HashSet < > ( ) ; for ( ConfigFileLoaderPlugin loaderPlugin : this . getLoaderPlugins ( ) ) { schemes . add ( loaderPlugin . getUriScheme ( ) ) ; } return schemes ; } | Return all URI schemes that are supported in the system . |
22,781 | public static CoordinateReferenceSystem parseProjection ( final String projection , final Boolean longitudeFirst ) { try { if ( longitudeFirst == null ) { return CRS . decode ( projection ) ; } else { return CRS . decode ( projection , longitudeFirst ) ; } } catch ( NoSuchAuthorityCodeException e ) { throw new RuntimeE... | Parse the given projection . |
22,782 | public final double [ ] getDpiSuggestions ( ) { if ( this . dpiSuggestions == null ) { List < Double > list = new ArrayList < > ( ) ; for ( double suggestion : DEFAULT_DPI_VALUES ) { if ( suggestion <= this . maxDpi ) { list . add ( suggestion ) ; } } double [ ] suggestions = new double [ list . size ( ) ] ; for ( int ... | Get DPI suggestions . |
22,783 | protected BufferedImage createErrorImage ( final Rectangle area ) { final BufferedImage bufferedImage = new BufferedImage ( area . width , area . height , TYPE_INT_ARGB_PRE ) ; final Graphics2D graphics = bufferedImage . createGraphics ( ) ; try { graphics . setBackground ( ColorParser . toColor ( this . configuration ... | Create an error image . |
22,784 | protected BufferedImage fetchImage ( final ClientHttpRequest request , final MapfishMapContext transformer ) throws IOException { final String baseMetricName = getClass ( ) . getName ( ) + ".read." + StatsUtils . quotePart ( request . getURI ( ) . getHost ( ) ) ; final Timer . Context timerDownload = this . registry . ... | Fetch the given image from the web . |
22,785 | public static < T > Set < T > create ( final T ... values ) { Set < T > result = new HashSet < > ( values . length ) ; Collections . addAll ( result , values ) ; return result ; } | Create a HashSet with the given initial values . |
22,786 | @ SuppressWarnings ( { "deprecation" , "WeakerAccess" } ) protected void removeShutdownHook ( ClassLoaderLeakPreventor preventor , Thread shutdownHook ) { final String displayString = "'" + shutdownHook + "' of type " + shutdownHook . getClass ( ) . getName ( ) ; preventor . error ( "Removing shutdown hook: " + display... | Deregister shutdown hook and execute it immediately |
22,787 | protected static int getIntInitParameter ( ServletContext servletContext , String parameterName , int defaultValue ) { final String parameterString = servletContext . getInitParameter ( parameterName ) ; if ( parameterString != null && parameterString . trim ( ) . length ( ) > 0 ) { try { return Integer . parseInt ( pa... | Parse init parameter for integer value returning default if not found or invalid |
22,788 | @ SuppressWarnings ( "WeakerAccess" ) protected void clearRmiTargetsMap ( ClassLoaderLeakPreventor preventor , Map < ? , ? > rmiTargetsMap ) { try { final Field cclField = preventor . findFieldOfClass ( "sun.rmi.transport.Target" , "ccl" ) ; preventor . debug ( "Looping " + rmiTargetsMap . size ( ) + " RMI Targets to f... | Iterate RMI Targets Map and remove entries loaded by protected ClassLoader |
22,789 | @ SuppressWarnings ( "WeakerAccess" ) protected boolean isJettyWithJMX ( ClassLoaderLeakPreventor preventor ) { final ClassLoader classLoader = preventor . getClassLoader ( ) ; try { if ( classLoader . getResource ( "org/eclipse/jetty" ) == null ) { return false ; } Class . forName ( "org.eclipse.jetty.jmx.MBeanContain... | Are we running in Jetty with JMX enabled? |
22,790 | public long [ ] keys ( ) { long [ ] values = new long [ size ] ; int idx = 0 ; for ( Entry entry : table ) { while ( entry != null ) { values [ idx ++ ] = entry . key ; entry = entry . next ; } } return values ; } | Returns all keys in no particular order . |
22,791 | public Entry < T > [ ] entries ( ) { @ SuppressWarnings ( "unchecked" ) Entry < T > [ ] entries = new Entry [ size ] ; int idx = 0 ; for ( Entry entry : table ) { while ( entry != null ) { entries [ idx ++ ] = entry ; entry = entry . next ; } } return entries ; } | Returns all entries in no particular order . |
22,792 | public boolean add ( long key ) { final int index = ( ( ( ( int ) ( key >>> 32 ) ) ^ ( ( int ) ( key ) ) ) & 0x7fffffff ) % capacity ; final Entry entryOriginal = table [ index ] ; for ( Entry entry = entryOriginal ; entry != null ; entry = entry . next ) { if ( entry . key == key ) { return false ; } } table [ index ]... | Adds the given value to the set . |
22,793 | public boolean remove ( long key ) { int index = ( ( ( ( int ) ( key >>> 32 ) ) ^ ( ( int ) ( key ) ) ) & 0x7fffffff ) % capacity ; Entry previous = null ; Entry entry = table [ index ] ; while ( entry != null ) { Entry next = entry . next ; if ( entry . key == key ) { if ( previous == null ) { table [ index ] = next ;... | Removes the given value to the set . |
22,794 | public VALUE put ( KEY key , VALUE object ) { CacheEntry < VALUE > entry ; if ( referenceType == ReferenceType . WEAK ) { entry = new CacheEntry < > ( new WeakReference < > ( object ) , null ) ; } else if ( referenceType == ReferenceType . SOFT ) { entry = new CacheEntry < > ( new SoftReference < > ( object ) , null ) ... | Stores an new entry in the cache . |
22,795 | public void putAll ( Map < KEY , VALUE > mapDataToPut ) { int targetSize = maxSize - mapDataToPut . size ( ) ; if ( maxSize > 0 && values . size ( ) > targetSize ) { evictToTargetSize ( targetSize ) ; } Set < Entry < KEY , VALUE > > entries = mapDataToPut . entrySet ( ) ; for ( Entry < KEY , VALUE > entry : entries ) {... | Stores all entries contained in the given map in the cache . |
22,796 | public VALUE get ( KEY key ) { CacheEntry < VALUE > entry ; synchronized ( this ) { entry = values . get ( key ) ; } VALUE value ; if ( entry != null ) { if ( isExpiring ) { long age = System . currentTimeMillis ( ) - entry . timeCreated ; if ( age < expirationMillis ) { value = getValue ( key , entry ) ; } else { coun... | Get the cached entry or null if no valid cached entry is found . |
22,797 | public static int copyAllBytes ( InputStream in , OutputStream out ) throws IOException { int byteCount = 0 ; byte [ ] buffer = new byte [ BUFFER_SIZE ] ; while ( true ) { int read = in . read ( buffer ) ; if ( read == - 1 ) { break ; } out . write ( buffer , 0 , read ) ; byteCount += read ; } return byteCount ; } | Copies all available data from in to out without closing any stream . |
22,798 | public synchronized int get ( ) { if ( available == 0 ) { return - 1 ; } byte value = buffer [ idxGet ] ; idxGet = ( idxGet + 1 ) % capacity ; available -- ; return value ; } | Gets a single byte return or - 1 if no data is available . |
22,799 | public synchronized int get ( byte [ ] dst , int off , int len ) { if ( available == 0 ) { return 0 ; } int limit = idxGet < idxPut ? idxPut : capacity ; int count = Math . min ( limit - idxGet , len ) ; System . arraycopy ( buffer , idxGet , dst , off , count ) ; idxGet += count ; if ( idxGet == capacity ) { int count... | Gets as many of the requested bytes as available from this buffer . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.