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 (... | 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 .... | 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 n... | 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 ... | 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 , RequestConte... | 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 : ser... | 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... | 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 ( ! connectionWrappe... | 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 ) ) ; } r... | 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 ( i... | 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 ) ; } i... | 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 ( ) ; RenderTemplateRespo... | 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 ) ... | 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 ( "Exe... | 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 ) ; } filtersIn... | 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 .... | 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 ) ) ; } c... | 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 ... | 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 . r... | 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 . cre... | 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 ) mes... | 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... | 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 , List... | 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 ... | 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 ( testSour... | 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 ( ) ; VaadinSe... | 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 <... | 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 ( )... | 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 ) { t... | 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 .... | 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 ... | 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 . createResourceR... | 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 + ... | 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 ( ) ) ; } retu... | 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 InitializationExcepti... | 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 ( ) +... | 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... | 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 = entr... | 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 : getDef... | 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 bytesTr... | 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" + Core... | 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 ... | 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 ] ; tr... | 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 = getFileAsSt... | 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 ( fi... | Scan config file . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.