idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
35,000 | public RouteBuilder put ( ) { if ( ! methods . contains ( HttpMethod . PUT ) ) { methods . add ( HttpMethod . PUT ) ; } return this ; } | Specifies that this route is mapped to HTTP PUT method . |
35,001 | public RouteBuilder delete ( ) { if ( ! methods . contains ( HttpMethod . DELETE ) ) { methods . add ( HttpMethod . DELETE ) ; } return this ; } | Specifies that this route is mapped to HTTP DELETE method . |
35,002 | protected boolean matches ( String requestUri , ControllerPath controllerPath , HttpMethod httpMethod ) throws ClassLoadException { boolean match = false ; String [ ] requestUriSegments = Util . split ( requestUri , '/' ) ; if ( isWildcard ( ) && requestUriSegments . length >= segments . size ( ) && wildSegmentsMatch ( requestUriSegments , controllerPath ) ) { String [ ] tailArr = Arrays . copyOfRange ( requestUriSegments , segments . size ( ) - 1 , requestUriSegments . length ) ; wildCardValue = Util . join ( tailArr , "/" ) ; match = true ; } else if ( segments . isEmpty ( ) && requestUri . equals ( "/" ) ) { actionName = "index" ; match = true ; } else if ( requestUriSegments . length < mandatorySegmentCount || requestUriSegments . length > segments . size ( ) && controllerPath . getControllerPackage ( ) == null ) { match = false ; } else { if ( segments . size ( ) != requestUriSegments . length ) { return false ; } for ( int i = 0 ; i < segments . size ( ) ; i ++ ) { String requestUriSegment = requestUriSegments [ i ] ; match = segments . get ( i ) . match ( requestUriSegment , controllerPath ) ; if ( ! match ) break ; } } if ( match && Configuration . activeReload ( ) ) { controller = reloadController ( ) ; } return match && methodMatches ( httpMethod ) ; } | Returns true if this route matches the request URI otherwise returns false . |
35,003 | protected static Map < String , Object > getSessionAttributes ( ) { HttpSession session = RequestContext . getHttpRequest ( ) . getSession ( true ) ; Enumeration names = session . getAttributeNames ( ) ; Map < String , Object > values = new HashMap < > ( ) ; while ( names . hasMoreElements ( ) ) { Object name = names . nextElement ( ) ; values . put ( name . toString ( ) , session . getAttribute ( name . toString ( ) ) ) ; } return values ; } | Returns all session attributes in a map . |
35,004 | protected FilterBuilder add ( HttpSupportFilter ... filters ) { for ( HttpSupportFilter filter : filters ) { if ( allFilters . contains ( filter ) ) { throw new IllegalArgumentException ( "Cannot register the same filter instance more than once." ) ; } } allFilters . addAll ( Collections . list ( filters ) ) ; return new FilterBuilder ( filters ) ; } | Adds a set of filters to a set of controllers . The filters are invoked in the order specified . Will reject adding the same instance of a filter more than once . |
35,005 | public static boolean isXhr ( ) { String xhr = header ( "X-Requested-With" ) ; if ( xhr == null ) { xhr = header ( "x-requested-with" ) ; } return xhr != null && xhr . toLowerCase ( ) . equals ( "xmlhttprequest" ) ; } | Returns true if this request is Ajax . |
35,006 | public static List < String > params ( String name ) { String [ ] values = RequestContext . getHttpRequest ( ) . getParameterValues ( name ) ; List < String > valuesList = null ; if ( name . equals ( "id" ) ) { if ( values . length == 1 ) { valuesList = Collections . singletonList ( values [ 0 ] ) ; } else if ( values . length > 1 ) { valuesList = asList ( values ) ; } } else { valuesList = values == null ? new ArrayList < String > ( ) : list ( values ) ; String userSegment = RequestContext . getRequestVo ( ) . getUserSegments ( ) . get ( name ) ; if ( userSegment != null ) { valuesList . add ( userSegment ) ; } } return valuesList ; } | Returns multiple request values for a name . |
35,007 | public static Map < String , String > params1st ( ) { Map < String , String > params = new HashMap < > ( ) ; Enumeration names = RequestContext . getHttpRequest ( ) . getParameterNames ( ) ; while ( names . hasMoreElements ( ) ) { String name = names . nextElement ( ) . toString ( ) ; params . put ( name , RequestContext . getHttpRequest ( ) . getParameter ( name ) ) ; } if ( getId ( ) != null ) params . put ( "id" , getId ( ) ) ; Map < String , String > userSegments = RequestContext . getRequestVo ( ) . getUserSegments ( ) ; params . putAll ( userSegments ) ; return params ; } | Returns a map where keys are names of all parameters while values are the first value for each parameter even if such parameter has more than one value submitted . |
35,008 | public static List < Cookie > cookies ( ) { javax . servlet . http . Cookie [ ] servletCookies = RequestContext . getHttpRequest ( ) . getCookies ( ) ; if ( servletCookies == null ) return new ArrayList < > ( ) ; List < Cookie > cookies = new ArrayList < > ( ) ; for ( javax . servlet . http . Cookie servletCookie : servletCookies ) { Cookie cookie = Cookie . fromServletCookie ( servletCookie ) ; cookies . add ( cookie ) ; } return cookies ; } | Returns collection of all cookies browser sent . |
35,009 | public static Cookie cookie ( String name ) { javax . servlet . http . Cookie [ ] servletCookies = RequestContext . getHttpRequest ( ) . getCookies ( ) ; if ( servletCookies != null ) { for ( javax . servlet . http . Cookie servletCookie : servletCookies ) { if ( servletCookie . getName ( ) . equals ( name ) ) { return Cookie . fromServletCookie ( servletCookie ) ; } } } return null ; } | Returns a cookie by name null if not found . |
35,010 | public void session ( String name , Object value ) { RequestContext . getHttpRequest ( ) . getSession ( ) . getAttribute ( name ) ; } | Sets an object on a current session . |
35,011 | private List < ConnectionSpecWrapper > getConnectionWrappers ( ) { List < ConnectionSpecWrapper > allConnections = DbConfiguration . getConnectionSpecWrappers ( ) ; List < ConnectionSpecWrapper > result = new LinkedList < > ( ) ; for ( ConnectionSpecWrapper connectionWrapper : allConnections ) { if ( ! connectionWrapper . isTesting ( ) && ( dbName == null || dbName . equals ( connectionWrapper . getDbName ( ) ) ) ) result . add ( connectionWrapper ) ; } return result ; } | Returns all connections which correspond dbName of this filter and not for testing |
35,012 | protected void assign ( String name , Object value ) { KeyWords . check ( name ) ; RequestContext . getValues ( ) . put ( name , value ) ; } | Assigns a value for a view . |
35,013 | protected HttpBuilder redirect ( String path ) { RedirectResponse resp = new RedirectResponse ( path ) ; RequestContext . setControllerResponse ( resp ) ; return new HttpBuilder ( resp ) ; } | Redirects to a an action of this controller or an action of a different controller . This method does not expect a full URL . |
35,014 | protected Iterator < FormItem > uploadedFiles ( String encoding , long maxFileSize ) { List < FormItem > fileItems = new ArrayList < > ( ) ; for ( FormItem item : multipartFormItems ( encoding , maxFileSize ) ) { if ( item . isFile ( ) ) { fileItems . add ( item ) ; } } return fileItems . iterator ( ) ; } | Returns a collection of uploaded files from a multi - part port request . |
35,015 | private static String parseHashName ( String param ) { Matcher matcher = hashPattern . matcher ( param ) ; String name = null ; while ( matcher . find ( ) ) { name = matcher . group ( 0 ) ; } return name == null ? null : name . substring ( 1 , name . length ( ) - 1 ) ; } | Parses name from hash syntax . |
35,016 | protected boolean blank ( String ... names ) { for ( String name : names ) { if ( Util . blank ( param ( name ) ) ) { return true ; } } return false ; } | Returns true if any named request parameter is blank . |
35,017 | protected String merge ( String template , Map values ) { StringWriter stringWriter = new StringWriter ( ) ; Configuration . getTemplateManager ( ) . merge ( values , template , stringWriter ) ; return stringWriter . toString ( ) ; } | Will merge a template and return resulting string . This method is used for just merging some text with dynamic values . Once you have the result you can send it by email external web service save it to a database etc . |
35,018 | public Map < String , String > getResponseHeaders ( ) { Collection < String > names = RequestContext . getHttpResponse ( ) . getHeaderNames ( ) ; Map < String , String > headers = new HashMap < > ( ) ; for ( String name : names ) { headers . put ( name , RequestContext . getHttpResponse ( ) . getHeader ( name ) ) ; } return headers ; } | Returns response headers |
35,019 | public void addAttributesExcept ( Map params , String ... exceptions ) { List exceptionList = Arrays . asList ( exceptions ) ; for ( Object key : params . keySet ( ) ) { if ( ! exceptionList . contains ( key ) ) { attribute ( key . toString ( ) , params . get ( key ) . toString ( ) ) ; } } } | Will add values from params map except the exceptions . |
35,020 | public String id ( ) { HttpServletRequest r = RequestContext . getHttpRequest ( ) ; if ( r == null ) { return null ; } HttpSession session = r . getSession ( false ) ; return session == null ? null : session . getId ( ) ; } | Returns a session ID from underlying session . |
35,021 | public Object get ( String name ) { return RequestContext . getHttpRequest ( ) . getSession ( true ) . getAttribute ( name ) ; } | Retrieve object from session . |
35,022 | private void injectFreemarkerTags ( ) { if ( ! tagsInjected ) { AbstractFreeMarkerConfig freeMarkerConfig = Configuration . getFreeMarkerConfig ( ) ; Injector injector = Configuration . getInjector ( ) ; tagsInjected = true ; if ( injector == null || freeMarkerConfig == null ) { return ; } freeMarkerConfig . inject ( injector ) ; } } | Injects FreeMarker tags with dependencies from Guice module . |
35,023 | private void injectController ( AppController controller ) { Injector injector = Configuration . getInjector ( ) ; if ( injector != null ) { injector . injectMembers ( controller ) ; } } | Injects controller with dependencies from Guice module . |
35,024 | private void configureExplicitResponse ( Route route , String controllerLayout , RenderTemplateResponse resp ) throws InstantiationException , IllegalAccessException { if ( ! Configuration . getDefaultLayout ( ) . equals ( controllerLayout ) && resp . hasDefaultLayout ( ) ) { resp . setLayout ( controllerLayout ) ; } if ( resp . getContentType ( ) == null ) { resp . setContentType ( route . getController ( ) . getContentType ( ) ) ; } resp . setTemplateManager ( Configuration . getTemplateManager ( ) ) ; } | response on current thread . |
35,025 | private void createDefaultResponse ( Route route , String controllerLayout ) throws InstantiationException , IllegalAccessException { String controllerPath = Router . getControllerPath ( route . getController ( ) . getClass ( ) ) ; String template = controllerPath + "/" + route . getActionName ( ) ; RenderTemplateResponse resp = new RenderTemplateResponse ( route . getController ( ) . values ( ) , template , RequestContext . getFormat ( ) ) ; if ( ! Configuration . getDefaultLayout ( ) . equals ( controllerLayout ) ) { resp . setLayout ( controllerLayout ) ; } if ( resp . getContentType ( ) == null ) { resp . setContentType ( route . getController ( ) . getContentType ( ) ) ; } RequestContext . setControllerResponse ( resp ) ; resp . setTemplateManager ( Configuration . getTemplateManager ( ) ) ; } | this is implicit processing - default behavior really |
35,026 | private boolean checkActionMethod ( AppController controller , String actionMethod ) { HttpMethod method = HttpMethod . getMethod ( RequestContext . getHttpRequest ( ) ) ; if ( ! controller . actionSupportsHttpMethod ( actionMethod , method ) ) { DirectResponse res = new DirectResponse ( "" ) ; res . setStatus ( 405 ) ; LOGGER . warn ( "Requested action does not support HTTP method: " + method . name ( ) + ", returning status code 405." ) ; RequestContext . setControllerResponse ( res ) ; RequestContext . getHttpResponse ( ) . setHeader ( "Allow" , join ( controller . allowedActions ( actionMethod ) , ", " ) ) ; return false ; } return true ; } | Checks if the action method supports requested HTTP method |
35,027 | private void filterAfter ( Route route ) { try { List < HttpSupportFilter > filters = Configuration . getFilters ( ) ; for ( int i = filters . size ( ) - 1 ; i >= 0 ; i -- ) { HttpSupportFilter filter = filters . get ( i ) ; if ( Configuration . getFilterMetadata ( filter ) . matches ( route ) ) { LOGGER . debug ( "Executing filter: " + filter . getClass ( ) . getName ( ) + "#after" ) ; filters . get ( i ) . after ( ) ; } else { LOGGER . debug ( "Filter: " + filter . getClass ( ) . getName ( ) + "#after does not match route: " + route ) ; } } } catch ( Exception e ) { throw new FilterException ( e ) ; } } | Run filters in opposite order |
35,028 | public void jdbc ( String driver , String url , String user , String password ) { connectionWrapper . setConnectionSpec ( new ConnectionJdbcSpec ( driver , url , user , password ) ) ; } | Configure standard JDBC parameters for opening a connection . |
35,029 | public void jdbc ( String driver , String url , Properties props ) { connectionWrapper . setConnectionSpec ( new ConnectionJdbcSpec ( driver , url , props ) ) ; } | Configure expanded JDBC parameters for opening a connection if needed |
35,030 | protected static void injectFilters ( ) { if ( injector != null ) { if ( Configuration . isTesting ( ) ) { for ( HttpSupportFilter filter : filters ) { injector . injectMembers ( filter ) ; } } else if ( ! filtersInjected ) { for ( HttpSupportFilter filter : filters ) { injector . injectMembers ( filter ) ; } filtersInjected = true ; } } } | the same stuff a few times . |
35,031 | static FilterMetadata getFilterMetadata ( HttpSupportFilter filter ) { FilterMetadata config = filterMetadataMap . get ( filter ) ; if ( config == null ) { config = new FilterMetadata ( ) ; filterMetadataMap . put ( filter , config ) ; } return config ; } | by a single thread when the app is bootstrapped . |
35,032 | public static < T extends Command > T fromXml ( String commandXml ) { return ( T ) X_STREAM . fromXML ( commandXml ) ; } | Method used by framework to de - serialize a command from XML . |
35,033 | public static byte [ ] generateImage ( String text ) { int w = 180 , h = 40 ; BufferedImage image = new BufferedImage ( w , h , BufferedImage . TYPE_INT_RGB ) ; Graphics2D g = image . createGraphics ( ) ; g . setRenderingHint ( RenderingHints . KEY_FRACTIONALMETRICS , RenderingHints . VALUE_FRACTIONALMETRICS_ON ) ; g . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; g . setColor ( Color . white ) ; g . fillRect ( 0 , 0 , w , h ) ; g . setFont ( new Font ( "Serif" , Font . PLAIN , 26 ) ) ; g . setColor ( Color . blue ) ; int start = 10 ; byte [ ] bytes = text . getBytes ( ) ; Random random = new Random ( ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { g . setColor ( new Color ( random . nextInt ( 255 ) , random . nextInt ( 255 ) , random . nextInt ( 255 ) ) ) ; g . drawString ( new String ( new byte [ ] { bytes [ i ] } ) , start + ( i * 20 ) , ( int ) ( Math . random ( ) * 20 + 20 ) ) ; } g . setColor ( Color . white ) ; for ( int i = 0 ; i < 8 ; i ++ ) { g . drawOval ( ( int ) ( Math . random ( ) * 160 ) , ( int ) ( Math . random ( ) * 10 ) , 30 , 30 ) ; } g . dispose ( ) ; ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; try { ImageIO . write ( image , "png" , bout ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return bout . toByteArray ( ) ; } | Generates a PNG image of text 180 pixels wide 40 pixels high with white background . |
35,034 | public String getStreamAsString ( ) { try { return Util . read ( fileItemStream . openStream ( ) ) ; } catch ( Exception e ) { throw new ControllerException ( e ) ; } } | Converts entire content of this item to String . |
35,035 | public void registerTag ( String name , FreeMarkerTag tag ) { configuration . setSharedVariable ( name , tag ) ; userTags . add ( tag ) ; } | Registers an application - specific tag . |
35,036 | private static List < URL > hackForWeblogic ( FilterConfig config ) { List < URL > urls = new ArrayList < > ( ) ; Set libJars = config . getServletContext ( ) . getResourcePaths ( "/WEB-INF/lib" ) ; for ( Object jar : libJars ) { try { urls . add ( config . getServletContext ( ) . getResource ( ( String ) jar ) ) ; } catch ( MalformedURLException e ) { LOGGER . warn ( "Failed to get resource: " + jar ) ; } } addClassesUrl ( config , urls ) ; return urls ; } | Maybe this is a hack for other containers too?? Maybe this is not a hack at all? |
35,037 | public void close ( ) { synchronized ( sessions ) { closed = true ; sessionCleaner . close ( ) ; sessions . stream ( ) . forEach ( PooledSession :: reallyClose ) ; } } | Closes all underlying JMS sessions . |
35,038 | public void stop ( ) { started = false ; senderSessionPool . close ( ) ; receiverSessionPool . close ( ) ; listenerConsumers . forEach ( Util :: closeQuietly ) ; listenerSessions . forEach ( Util :: closeQuietly ) ; closeQuietly ( producerConnection ) ; closeQuietly ( consumerConnection ) ; try { ActiveMQServerControl control = jmsServer . getActiveMQServer ( ) . getActiveMQServerControl ( ) ; String [ ] remoteAddresses = control . listRemoteAddresses ( ) ; for ( String address : remoteAddresses ) { control . closeConnectionsForAddress ( address ) ; } } catch ( Exception e ) { LOGGER . warn ( "exception trying to close remote connections." , e ) ; } try { jmsServer . stop ( ) ; } catch ( Exception e ) { LOGGER . warn ( "exception trying to stop broker." , e ) ; } } | Stops this JMS server . |
35,039 | public void configureNetty ( String host , int port ) { Map < String , Object > params = map ( TransportConstants . HOST_PROP_NAME , host , TransportConstants . PORT_PROP_NAME , port ) ; config . getAcceptorConfigurations ( ) . add ( new TransportConfiguration ( NettyAcceptorFactory . class . getName ( ) , params ) ) ; } | Call this method once after a constructor in order to create a Netty instance to accept out of VM messages . |
35,040 | public Message receiveMessage ( String queueName , long timeout ) { checkStarted ( ) ; try ( Session session = receiverSessionPool . getSession ( ) ) { Queue queue = ( Queue ) jmsServer . lookup ( QUEUE_NAMESPACE + queueName ) ; try ( MessageConsumer consumer = session . createConsumer ( queue ) ) { return consumer . receive ( timeout ) ; } } catch ( Exception e ) { throw new AsyncException ( "Could not get message" , e ) ; } } | Receives a messafge from a queue asynchronously . If this queue also has listeners then messages will be distributed across all consumers . |
35,041 | public List < Command > getTopCommands ( int count , String queueName ) { checkStarted ( ) ; List < Command > res = new ArrayList < > ( ) ; try ( Session session = consumerConnection . createSession ( ) ) { Queue queue = ( Queue ) jmsServer . lookup ( QUEUE_NAMESPACE + queueName ) ; Enumeration messages = session . createBrowser ( queue ) . getEnumeration ( ) ; for ( int i = 0 ; i < count && messages . hasMoreElements ( ) ; i ++ ) { Command command ; Message message = ( Message ) messages . nextElement ( ) ; if ( binaryMode ) { command = Command . fromBytes ( getBytes ( ( BytesMessage ) message ) ) ; } else { command = Command . fromXml ( ( ( TextMessage ) message ) . getText ( ) ) ; } command . setJMSMessageID ( message . getJMSMessageID ( ) ) ; res . add ( command ) ; } return res ; } catch ( Exception e ) { throw new AsyncException ( "Could not lookup commands" , e ) ; } } | Returns top commands in queue . Does not remove anything from queue . This method can be used for an admin tool to peek inside the queue . |
35,042 | protected Message lookupMessage ( String queueName ) { checkStarted ( ) ; try ( Session session = consumerConnection . createSession ( ) ) { Queue queue = ( Queue ) jmsServer . lookup ( QUEUE_NAMESPACE + queueName ) ; Enumeration messages = session . createBrowser ( queue ) . getEnumeration ( ) ; return ( Message ) messages . nextElement ( ) ; } catch ( NoSuchElementException e ) { return null ; } catch ( Exception e ) { throw new AsyncException ( "Lookup failed" , e ) ; } } | This method exists for testing |
35,043 | public Map < String , Long > getMessageCounts ( ) { Map < String , Long > counts = new HashMap < > ( ) ; for ( QueueConfig queueConfig : queueConfigsList ) { counts . put ( queueConfig . getName ( ) , getMessageCount ( queueConfig . getName ( ) ) ) ; } return counts ; } | Returns counts of messages for all queues . |
35,044 | public long getMessageCount ( String queue ) { try { return getQueueControl ( queue ) . getMessageCount ( ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Returns number of messages currently in queue |
35,045 | public void resume ( String queueName ) { try { getQueueControl ( queueName ) . resume ( ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Resumes a paused queue |
35,046 | public void pause ( String queueName ) { try { getQueueControl ( queueName ) . pause ( ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Pauses a queue . A paused queue stops delivering commands to listeners . It still can accumulate commands . |
35,047 | public int removeMessages ( String queueName , String filter ) { try { return getQueueControl ( queueName ) . removeMessages ( filter ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Removes messages from queue . |
35,048 | public int removeAllMessages ( String queueName ) { try { return getQueueControl ( queueName ) . removeMessages ( null ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Removes all messages from queue . |
35,049 | public int moveMessages ( String source , String target ) { try { return getQueueControl ( source ) . moveMessages ( "" , target ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Moves all messages from one queue to another |
35,050 | private static String encode ( String value , BitSet unescapedChars ) { final ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; for ( final byte c : value . getBytes ( CHARSET ) ) { int b = c ; if ( b < 0 ) { b = 256 + b ; } if ( unescapedChars . get ( b ) ) { buffer . write ( b ) ; } else { buffer . write ( ESCAPE_CHAR ) ; final char hex1 = Character . toUpperCase ( Character . forDigit ( ( b >> 4 ) & 0xF , HEXADECIMAL_RADIX ) ) ; final char hex2 = Character . toUpperCase ( Character . forDigit ( b & 0xF , HEXADECIMAL_RADIX ) ) ; buffer . write ( hex1 ) ; buffer . write ( hex2 ) ; } } return new String ( buffer . toByteArray ( ) , CHARSET ) ; } | URL - encode a String . |
35,051 | public SchemaEntry extractResourceLocation ( SchemaEntry entry ) { Optional < String > actualResourceUri = Optional . empty ( ) ; if ( ! entry . getVocabularyDefinedBy ( ) . equals ( entry . getVocabularyNamespace ( ) ) ) actualResourceUri = getContentLocation ( entry . getVocabularyDefinedBy ( ) , GENERALFORMAT , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) ) actualResourceUri = getContentLocation ( entry . getVocabularyURI ( ) , GENERALFORMAT , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) && ! entry . getVocabularyDefinedBy ( ) . equals ( entry . getVocabularyNamespace ( ) ) ) actualResourceUri = getContentLocation ( entry . getVocabularyDefinedBy ( ) , TEXTHTML , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) ) actualResourceUri = getContentLocation ( entry . getVocabularyURI ( ) , TEXTHTML , Lists . newArrayList ( ) ) ; if ( ! actualResourceUri . isPresent ( ) ) { log . info ( "Could not find resource for " + entry . getVocabularyURI ( ) ) ; return entry ; } return new SchemaEntry ( entry . getPrefix ( ) , entry . getVocabularyURI ( ) , entry . getVocabularyNamespace ( ) , actualResourceUri . get ( ) ) ; } | Will try to get a responsive content location trying 1 . VocabularyDefinedBy location 2 . VocabularyURI location |
35,052 | private Optional < String > getContentVersions ( String currentUrl , Collection < SerializationFormat > formats , ArrayList < String > redirects ) { Optional < SerializationFormat > test = formats . stream ( ) . filter ( x -> currentUrl . trim ( ) . endsWith ( x . getExtension ( ) ) ) . findFirst ( ) ; if ( currentUrl != null && ! test . isPresent ( ) ) { for ( SerializationFormat format : formats ) { String tryOwl = StringUtils . replacePattern ( currentUrl , "#$" , "" ) ; tryOwl = StringUtils . replacePattern ( tryOwl , "/$" , "" ) ; tryOwl = StringUtils . replacePattern ( tryOwl , "\\.html$" , "" ) ; tryOwl = StringUtils . replacePattern ( tryOwl , "\\.htm$" , "" ) ; Optional < String > res = getContentLocation ( tryOwl + "." + format . getExtension ( ) , format , redirects ) ; if ( res . isPresent ( ) ) return res ; res = getContentLocation ( tryOwl + "/ontology." + format . getExtension ( ) , format , redirects ) ; if ( res . isPresent ( ) ) return res ; res = getContentLocation ( tryOwl + "/schema." + format . getExtension ( ) , format , redirects ) ; if ( res . isPresent ( ) ) return res ; } } return Optional . empty ( ) ; } | Will try to get a responsive content location by adding suffixes based on the given SerializationFormats |
35,053 | public static void main ( String [ ] args ) { LOVEndpoint lov = new LOVEndpoint ( ) ; String file = args . length > 0 ? args [ 1 ] . trim ( ) : "rdfunit-model/src/main/resources/org/aksw/rdfunit/configuration/schemaLOV.csv" ; lov . writeAllLOVEntriesToFile ( file ) ; } | Will start the crawling of the LOV endpoint |
35,054 | public static TestExecution validate ( final TestCaseExecutionType testCaseExecutionType , final TestSource testSource , final TestSuite testSuite , final String agentID , DatasetOverviewResults overviewResults ) { checkNotNull ( testCaseExecutionType , "Test Execution Type must not be null" ) ; checkNotNull ( testSource , "Test Source must not be null" ) ; checkNotNull ( testSuite , "Test Suite must not be null" ) ; checkNotNull ( agentID , "Agent must not be null" ) ; checkNotNull ( overviewResults , "Overview Results must not be null" ) ; final boolean enableRDFUnitLogging = false ; final SimpleTestExecutorMonitor testExecutorMonitor = new SimpleTestExecutorMonitor ( enableRDFUnitLogging ) ; testExecutorMonitor . setUserID ( agentID ) ; testExecutorMonitor . setExecutionType ( testCaseExecutionType ) ; final TestExecutor testExecutor = TestExecutorFactory . createTestExecutor ( testCaseExecutionType ) ; testExecutor . addTestExecutorMonitor ( testExecutorMonitor ) ; testExecutor . execute ( testSource , testSuite ) ; overviewResults . set ( testExecutorMonitor . getOverviewResults ( ) ) ; return testExecutorMonitor . getTestExecution ( ) ; } | Static method that validates a Source . In this case the Source and TestSuite are provided as argument along with a RDFUnitConfiguration object This function can also serve as standalone |
35,055 | public static void init ( String clientHost ) { VaadinSession . getCurrent ( ) . setAttribute ( "client" , clientHost ) ; String baseDir = _getBaseDir ( ) ; VaadinSession . getCurrent ( ) . setAttribute ( String . class , baseDir ) ; TestGeneratorExecutor testGeneratorExecutor = new TestGeneratorExecutor ( ) ; VaadinSession . getCurrent ( ) . setAttribute ( TestGeneratorExecutor . class , testGeneratorExecutor ) ; TestSuite testSuite = new TestSuite ( new ArrayList < > ( ) ) ; VaadinSession . getCurrent ( ) . setAttribute ( TestSuite . class , testSuite ) ; CommonAccessUtils . initializeSchemaServices ( ) ; } | Init session variables . |
35,056 | public static String findLongestOverlap ( String first , String second ) { if ( org . apache . commons . lang3 . StringUtils . isEmpty ( first ) || org . apache . commons . lang3 . StringUtils . isEmpty ( second ) ) return "" ; int length = Math . min ( first . length ( ) , second . length ( ) ) ; for ( int i = 0 ; i < length ; i ++ ) { String zw = first . substring ( first . length ( ) - length + i ) ; if ( second . startsWith ( zw ) ) return zw ; } return "" ; } | Will find the longest suffix of the first sequence which is a prefix of the second . |
35,057 | public RDFUnit init ( ) { for ( Pattern pattern : getPatterns ( ) ) { PatternService . addPattern ( pattern . getId ( ) , pattern . getIRI ( ) , pattern ) ; } return this ; } | Initializes the patterns library required |
35,058 | private void handleRequestAndRespond ( HttpServletRequest httpServletRequest , HttpServletResponse httpServletResponse ) throws IOException { RDFUnitConfiguration configuration = null ; try { configuration = getConfiguration ( httpServletRequest ) ; } catch ( ParameterException e ) { String message = e . getMessage ( ) ; if ( message != null ) { printMessage ( httpServletResponse , message ) ; } printHelpMessage ( httpServletResponse ) ; httpServletResponse . getWriter ( ) . close ( ) ; return ; } assert configuration != null ; final TestSource dataset = configuration . getTestSource ( ) ; final TestSuite testSuite = getTestSuite ( configuration , dataset ) ; assert testSuite != null ; TestExecution results = null ; try { results = validate ( configuration , dataset , testSuite ) ; } catch ( TestCaseExecutionException e ) { } assert results != null ; try { writeResults ( configuration , results , httpServletResponse ) ; } catch ( RdfWriterException e ) { printMessage ( httpServletResponse , e . getMessage ( ) ) ; } } | Has all the workflow logic for getting the parameters performing a validation and writing the output |
35,059 | private static void writeResults ( final RDFUnitConfiguration configuration , final TestExecution testExecution , HttpServletResponse httpServletResponse ) throws RdfWriterException , IOException { SerializationFormat serializationFormat = configuration . geFirstOutputFormat ( ) ; if ( serializationFormat == null ) { throw new RdfWriterException ( "Invalid output format" ) ; } httpServletResponse . setContentType ( serializationFormat . getMimeType ( ) ) ; RdfWriter rdfWriter = RdfResultsWriterFactory . createWriterFromFormat ( httpServletResponse . getOutputStream ( ) , serializationFormat , testExecution ) ; rdfWriter . write ( ModelFactory . createDefaultModel ( ) ) ; } | Writes the output of the validation to the HttpServletResponse |
35,060 | private boolean containsFormatName ( String format ) { return name . equalsIgnoreCase ( format ) || synonyms . contains ( format . toLowerCase ( ) ) ; } | Helper function that matches only the synonyms |
35,061 | public static String getURIFromAbbrev ( final String abbreviation ) { String [ ] parts = abbreviation . split ( ":" ) ; if ( parts . length == 2 ) { return getNSFromPrefix ( parts [ 0 ] ) + parts [ 1 ] ; } throw new IllegalArgumentException ( "Undefined prefix in " + abbreviation ) ; } | Given an abbreviated URI it returns a full URI |
35,062 | public static String getLocalName ( final String uri , final String prefix ) { String ns = getNSFromPrefix ( prefix ) ; if ( ns != null ) { return uri . replace ( ns , "" ) ; } throw new IllegalArgumentException ( "Undefined prefix (" + prefix + ") in URI: " + uri ) ; } | Returns the local name of a URI by removing the prefix namespace |
35,063 | protected static String getStatusClass ( RLOGLevel level ) { String rowClass = "" ; switch ( level ) { case WARN : rowClass = "warning" ; break ; case ERROR : rowClass = "danger" ; break ; case INFO : rowClass = "info" ; break ; default : break ; } return rowClass ; } | return a css class |
35,064 | private static String nodeTargetPattern ( ShapeTargetValueShape target ) { return " " + formatNode ( target . getNode ( ) ) + " " + writePropertyChain ( target . pathChain ) + " ?this . " ; } | FIXME add focus node |
35,065 | private Model initModel ( ) { OntModel m = ModelFactory . createOntologyModel ( OntModelSpec . OWL_DL_MEM , ModelFactory . createDefaultModel ( ) ) ; try { schemaReader . read ( m ) ; } catch ( RdfReaderException e ) { log . error ( "Cannot load ontology: {} " , getSchema ( ) , e ) ; } return m ; } | lazy loaded via lombok |
35,066 | public static SerializationFormat getInputFormat ( String name ) { for ( SerializationFormat ft : Instance . serializationFormats ) { if ( ft . isAcceptedAsInput ( name ) ) { return ft ; } } return null ; } | returns an input FormatType for a given name |
35,067 | public static SerializationFormat getOutputFormat ( String name ) { for ( SerializationFormat ft : Instance . serializationFormats ) { if ( ft . isAcceptedAsOutput ( name ) ) { return ft ; } } return null ; } | returns an output FormatType for a given name |
35,068 | public static Collection < SerializationFormat > getAllFormats ( ) { ArrayList < SerializationFormat > serializationFormats = new ArrayList < > ( ) ; serializationFormats . add ( createTurtle ( ) ) ; serializationFormats . add ( createN3 ( ) ) ; serializationFormats . add ( createNTriples ( ) ) ; serializationFormats . add ( createJsonLD ( ) ) ; serializationFormats . add ( createRDFJson ( ) ) ; serializationFormats . add ( createRDFXMLAbbrevOut ( ) ) ; serializationFormats . add ( createRDFXMLIn ( ) ) ; serializationFormats . add ( createRDFXMLOut ( ) ) ; serializationFormats . add ( createRDFa ( ) ) ; serializationFormats . add ( createHTML ( ) ) ; serializationFormats . add ( createJunitXml ( ) ) ; serializationFormats . add ( createNQads ( ) ) ; serializationFormats . add ( createTriG ( ) ) ; serializationFormats . add ( createTriX ( ) ) ; return serializationFormats ; } | Returns a list with all the defined serialization formats |
35,069 | static HttpResponse executeHeadRequest ( URI uri , SerializationFormat format ) throws IOException { HttpHead headMethod = new HttpHead ( uri ) ; MyRedirectHandler redirectHandler = new MyRedirectHandler ( uri ) ; String acceptHeader = format . getMimeType ( ) != null && ! format . getMimeType ( ) . trim ( ) . isEmpty ( ) ? format . getMimeType ( ) : "*/*" ; CloseableHttpClient httpClient = HttpClientBuilder . create ( ) . setDefaultRequestConfig ( requestConfig ) . setConnectionManager ( poolingConnManager ) . setSSLContext ( ssl ) . setRedirectStrategy ( redirectHandler ) . setDefaultHeaders ( Arrays . asList ( new BasicHeader ( "Accept" , acceptHeader ) , new BasicHeader ( "User-Agent" , "Mozilla/5.0" ) , new BasicHeader ( "Upgrade-Insecure-Requests" , "1" ) ) ) . build ( ) ; HttpResponse httpResponse = httpClient . execute ( headMethod ) ; redirectHandler . lastRedirectedUri . forEach ( x -> httpResponse . setHeader ( HEADERKEY , String . valueOf ( x ) ) ) ; return httpResponse ; } | Will execute a HEAD only request following redirects trying to locate an rdf document . |
35,070 | public static RdfReader createDereferenceReader ( String uri ) { Collection < RdfReader > readers = new ArrayList < > ( ) ; if ( ! IOUtils . isFile ( uri ) ) { readers . add ( new RdfDereferenceReader ( uri ) ) ; } else { readers . add ( new RdfStreamReader ( uri ) ) ; readers . add ( RdfReaderFactory . createResourceReader ( uri ) ) ; } return new RdfFirstSuccessReader ( readers ) ; } | Generates a Dereference reader . This can be either a remote url a local file or a resource |
35,071 | public String getNamespaceFromURI ( String uri ) { String breakChar = "/" ; if ( uri . contains ( "#" ) ) { breakChar = "#" ; } else { if ( uri . substring ( 6 ) . contains ( ":" ) ) { breakChar = ":" ; } } int pos = Math . min ( uri . lastIndexOf ( breakChar ) , uri . length ( ) ) ; return uri . substring ( 0 , pos + 1 ) ; } | Gets namespace from uRI . |
35,072 | private Runnable decorateTask ( Runnable task , boolean isRepeatingTask ) { Runnable result = TaskUtils . decorateTaskWithErrorHandler ( task , this . errorHandler , isRepeatingTask ) ; if ( this . enterpriseConcurrentScheduler ) { result = ManagedTaskBuilder . buildManagedTask ( result , task . toString ( ) ) ; } return result ; } | Decorate task . |
35,073 | public void registerMbeans ( ) { ServerAdminMBean serverAdministrationBean = new ServerAdmin ( ) ; try { mbeanServer . registerMBean ( serverAdministrationBean , JMXUtils . getObjectName ( jmxConfig . getContextName ( ) , "ServerAdmin" ) ) ; } catch ( InstanceAlreadyExistsException e ) { throw new InitializationException ( "Could not initialize the MBean.!" , e ) ; } catch ( MBeanRegistrationException e ) { throw new InitializationException ( "Could not initialize the MBean.!" , e ) ; } catch ( NotCompliantMBeanException e ) { throw new InitializationException ( "Could not initialize the MBean.!" , e ) ; } } | Register mbeans . |
35,074 | public static CommandProcessor getInstance ( ) { if ( null == instance ) { synchronized ( CommandProcessor . class ) { if ( null == instance ) { instance = new CommandProcessor ( ) ; } } } return instance ; } | Gets the single instance of CommandProcessor . |
35,075 | private static Configuration getDefault ( ) { Configuration config = new Configuration ( ) ; config . addHandler ( new ConsoleAuditHandler ( ) ) ; config . setMetaData ( new DummyMetaData ( ) ) ; config . setLayout ( new SimpleLayout ( ) ) ; config . addProperty ( "log.file.location" , "user.dir" ) ; return config ; } | Gets the default . |
35,076 | public void addHandler ( Handler handler ) { if ( null == handlers ) { handlers = new ArrayList < > ( ) ; } handlers . add ( handler ) ; } | Adds the handler . |
35,077 | public void addProperty ( String key , String value ) { if ( null == properties ) { properties = new HashMap < > ( ) ; } properties . put ( key , value ) ; } | Adds the property . |
35,078 | public boolean audit ( Class < ? > clazz , Method method , Object [ ] args ) { return audit ( new AnnotationAuditEvent ( clazz , method , args ) ) ; } | Audit with annotation . |
35,079 | public static IAuditManager getInstance ( ) { IAuditManager result = auditManager ; if ( result == null ) { synchronized ( AuditManager . class ) { result = auditManager ; if ( result == null ) { Context . init ( ) ; auditManager = result = new AuditManager ( ) ; } } } return result ; } | Gets the single instance of AuditHelper . |
35,080 | public Date nextExecutionTime ( TriggerContext triggerContext ) { if ( triggerContext . lastScheduledExecutionTime ( ) == null ) { return new Date ( System . currentTimeMillis ( ) + this . initialDelay ) ; } else if ( this . fixedRate ) { return new Date ( triggerContext . lastScheduledExecutionTime ( ) . getTime ( ) + this . period ) ; } return new Date ( triggerContext . lastCompletionTime ( ) . getTime ( ) + this . period ) ; } | Returns the time after which a task should run again . |
35,081 | public String convertDateToString ( final Date date ) { if ( date == null ) { return null ; } return dateFormat . get ( ) . format ( date ) ; } | Convert date to string . |
35,082 | public static Schedulers newThreadPoolScheduler ( int poolSize ) { createSingleton ( ) ; Schedulers . increaseNoOfSchedullers ( ) ; ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler ( ) ; CustomizableThreadFactory factory = new CustomizableThreadFactory ( ) ; scheduler . initializeExecutor ( factory , new RejectedExecutionHandler ( ) { public void rejectedExecution ( Runnable r , ThreadPoolExecutor executor ) { System . out . println ( "asdsa" ) ; } } ) ; scheduler . setPoolSize ( poolSize ) ; instance . setCurrentScheduler ( scheduler ) ; return instance ; } | New thread pool scheduler . |
35,083 | public static Schedulers stopAll ( ) { createSingleton ( ) ; if ( instance . runningSchedullers . isEmpty ( ) ) { throw new IllegalStateException ( "No schedulers available." ) ; } for ( Entry < String , ScheduledFuture < ? > > entry : instance . runningSchedullers . entrySet ( ) ) { ScheduledFuture < ? > future = entry . getValue ( ) ; future . cancel ( true ) ; Schedulers . decreaseNoOfSchedullers ( ) ; Schedulers . decreaseNoOfRunningSchedullers ( ) ; } return instance ; } | Stop all . |
35,084 | public List < I > getNewInstanceList ( String [ ] clsssList ) { List < I > instances = new ArrayList < > ( ) ; for ( String className : clsssList ) { I instance = new ReflectUtil < I > ( ) . getNewInstance ( className ) ; instances . add ( instance ) ; } return instances ; } | Gets the new instance list . |
35,085 | public void update ( Date lastScheduledExecutionTime , Date lastActualExecutionTime , Date lastCompletionTime ) { this . lastScheduledExecutionTime = lastScheduledExecutionTime ; this . lastActualExecutionTime = lastActualExecutionTime ; this . lastCompletionTime = lastCompletionTime ; } | Update this holder s state with the latest time values . |
35,086 | public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler ( Runnable task , ErrorHandler errorHandler , boolean isRepeatingTask ) { if ( task instanceof DelegatingErrorHandlingRunnable ) { return ( DelegatingErrorHandlingRunnable ) task ; } ErrorHandler eh = errorHandler != null ? errorHandler : getDefaultErrorHandler ( isRepeatingTask ) ; return new DelegatingErrorHandlingRunnable ( task , eh ) ; } | Decorate the task for error handling . If the provided |
35,087 | public static Date addDate ( final Date date , final Integer different ) { final Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; cal . add ( Calendar . DATE , different ) ; return cal . getTime ( ) ; } | Add days . |
35,088 | private static CopyStreamListener createListener ( ) { return new CopyStreamListener ( ) { private long megsTotal = 0 ; public void bytesTransferred ( CopyStreamEvent event ) { bytesTransferred ( event . getTotalBytesTransferred ( ) , event . getBytesTransferred ( ) , event . getStreamSize ( ) ) ; } public void bytesTransferred ( long totalBytesTransferred , int bytesTransferred , long streamSize ) { long megs = totalBytesTransferred / 1000000 ; for ( long l = megsTotal ; l < megs ; l ++ ) { System . err . print ( "#" ) ; } megsTotal = megs ; } } ; } | Creates the listener . |
35,089 | public static void info ( Object ... message ) { StringBuilder builder = new StringBuilder ( APP_INFO ) ; for ( Object object : message ) { builder . append ( object . toString ( ) ) ; } infoStream . println ( builder . toString ( ) ) ; } | Write information in the console . |
35,090 | public static void warn ( Object ... message ) { StringBuilder builder = new StringBuilder ( APP_WARN ) ; for ( Object object : message ) { builder . append ( object . toString ( ) ) ; } warnStream . println ( builder . toString ( ) ) ; } | Write warn messasge on console . |
35,091 | public static void warn ( final Object message , final Throwable t ) { warnStream . println ( APP_WARN + message . toString ( ) ) ; warnStream . println ( stackTraceToString ( t ) ) ; } | Write warn message on console with exception . |
35,092 | public static void error ( Object ... message ) { StringBuilder builder = new StringBuilder ( APP_ERROR ) ; for ( Object object : message ) { builder . append ( object . toString ( ) ) ; } errorStream . println ( builder . toString ( ) ) ; } | Write error message on console . |
35,093 | public static void error ( final Object message , final Throwable t ) { errorStream . println ( APP_ERROR + message . toString ( ) ) ; errorStream . println ( stackTraceToString ( t ) ) ; } | Write error messages on console with exception . |
35,094 | static ObjectName getObjectName ( String type , String name ) { try { return new ObjectName ( JMXUtils . class . getPackage ( ) . getName ( ) + ":type=" + type + ",name=" + name ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | Gets the object name . |
35,095 | void printBanner ( ) { PrintStream printStream = System . out ; for ( String lineLocal : BANNER ) { printStream . println ( lineLocal ) ; } printStream . print ( line ) ; String version = Audit4jBanner . class . getPackage ( ) . getImplementationVersion ( ) ; if ( version == null ) { printStream . println ( "(v" + CoreConstants . RELEASE_VERSION + ")" ) ; } else { printStream . println ( "(v" + version + ")" ) ; } printStream . println ( ) ; } | Prints banner using system out . |
35,096 | protected File [ ] getAvailableFiles ( final String logFileLocation , final Date maxDate ) { File dir = new File ( logFileLocation ) ; return dir . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String fileName ) { boolean extentionMatch = fileName . endsWith ( compressionExtention ) ; boolean dateMatch = maxDate . before ( fileCreatedDate ( fileName ) ) ; return dateMatch && extentionMatch ; } } ) ; } | Gets the available files . |
35,097 | private Date fileCreatedDate ( String fileName ) { String [ ] splittedWithoutExtention = fileName . split ( "." ) ; String fileNameWithoutExtention = splittedWithoutExtention [ 0 ] ; String [ ] splittedWithoutPrefix = fileNameWithoutExtention . split ( "-" ) ; String fileNameDateInStr = splittedWithoutPrefix [ 1 ] ; try { return AuditUtil . stringTodate ( fileNameDateInStr , "yyyy-MM-dd" ) ; } catch ( ParseException e ) { throw new Audit4jRuntimeException ( "Exception occured parsing the date." , e ) ; } } | File created date . |
35,098 | static ConfigurationStream resolveConfigFileAsStream ( String configFilePath ) throws ConfigurationException { InputStream fileStream ; String fileExtention ; if ( configFilePath != null ) { if ( new File ( configFilePath ) . isDirectory ( ) ) { String path = scanConfigFile ( configFilePath ) ; fileStream = getFileAsStream ( new File ( path ) ) ; fileExtention = FilenameUtils . getExtension ( path ) ; } else { fileStream = getFileAsStream ( configFilePath ) ; fileExtention = FilenameUtils . getExtension ( configFilePath ) ; } } else if ( hasEnvironmentVariable ( ENVIRONMENT_CONFIG_VARIABLE_NAME ) ) { fileStream = getFileAsStream ( getEnvironemtVariableConfigFilePath ( ) ) ; fileExtention = FilenameUtils . getExtension ( getEnvironemtVariableConfigFilePath ( ) . toFile ( ) . getName ( ) ) ; } else if ( hasSystemPropertyVariable ( SYSTEM_PROPERTY_CONFIG_VARIABLE_NAME ) ) { fileStream = getFileAsStream ( getSystemPropertyConfigFilePath ( ) ) ; fileExtention = FilenameUtils . getExtension ( getSystemPropertyConfigFilePath ( ) . toFile ( ) . getName ( ) ) ; } else if ( getClasspathResourceAsStream ( CONFIG_FILE_NAME + "." + YML_EXTENTION ) != null ) { fileStream = getClasspathResourceAsStream ( CONFIG_FILE_NAME + "." + YML_EXTENTION ) ; fileExtention = YML_EXTENTION ; } else if ( getClasspathResourceAsStream ( CONFIG_FILE_NAME + "." + YAML_EXTENTION ) != null ) { fileStream = getClasspathResourceAsStream ( CONFIG_FILE_NAME + "." + YAML_EXTENTION ) ; fileExtention = YAML_EXTENTION ; } else if ( getClasspathResourceAsStream ( CONFIG_FILE_NAME + "." + XML_EXTENTION ) != null ) { fileStream = getClasspathResourceAsStream ( CONFIG_FILE_NAME + "." + XML_EXTENTION ) ; fileExtention = XML_EXTENTION ; } else { String defaultConfigDir = System . getProperty ( "user.dir" ) ; String defaultConfigPath = scanConfigFile ( defaultConfigDir ) ; fileExtention = FilenameUtils . getExtension ( defaultConfigPath ) ; fileStream = getFileAsStream ( new File ( defaultConfigPath ) ) ; } ConfigurationStream config = new ConfigurationStream ( ) ; config . setExtention ( fileExtention ) ; config . setInputStream ( fileStream ) ; return config ; } | Resolve config path . |
35,099 | static String scanConfigFile ( String dirPath ) throws ConfigurationException { String filePath = dirPath + File . separator + CONFIG_FILE_NAME + "." ; String fullFilePath ; if ( AuditUtil . isFileExists ( filePath + YML_EXTENTION ) ) { fullFilePath = filePath + YML_EXTENTION ; } else if ( AuditUtil . isFileExists ( filePath + YAML_EXTENTION ) ) { fullFilePath = filePath + YAML_EXTENTION ; } else if ( AuditUtil . isFileExists ( filePath + XML_EXTENTION ) ) { fullFilePath = filePath + XML_EXTENTION ; } else { fullFilePath = filePath + YML_EXTENTION ; generateConfigFile ( fullFilePath ) ; } return fullFilePath ; } | Scan config file . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.