idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
34,900 | protected void synchronizeGroupMembersOnUpdate ( IEntityGroup group ) throws GroupsException { EntityGroupImpl egi = ( EntityGroupImpl ) group ; GroupMemberImpl gmi = null ; for ( Iterator it = egi . getAddedMembers ( ) . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { gmi = ( GroupMemberImpl ) it . next ( ) ; gmi .... | Adjust the back pointers of the updated group members to either add or remove the parent group . Then update the cache to invalidate copies on peer servers . | 220 | 30 |
34,901 | public Object doThreadContextClassLoaderUpdate ( ProceedingJoinPoint pjp ) throws Throwable { final Thread currentThread = Thread . currentThread ( ) ; final ClassLoader previousClassLoader = currentThread . getContextClassLoader ( ) ; Deque < ClassLoader > deque = PREVIOUS_CLASS_LOADER . get ( ) ; if ( deque == null )... | Wraps the targeted execution switching the current thread s context class loader to this classes class loader . Usage defined in persistanceContext . xml . | 210 | 28 |
34,902 | @ RequestMapping ( value = "/entity/{entityType}/{entityId}" , method = RequestMethod . DELETE ) public void deleteEntity ( @ PathVariable ( "entityType" ) String entityType , @ PathVariable ( "entityId" ) String entityId , HttpServletRequest request , HttpServletResponse response ) throws IOException { final IPerson p... | Delete an uPortal database object . This method provides a REST interface for uPortal database object deletion . | 252 | 22 |
34,903 | @ Override public double getStandardDeviation ( ) { double stdDev = Double . NaN ; if ( getN ( ) > 0 ) { if ( getN ( ) > 1 ) { stdDev = FastMath . sqrt ( getVariance ( ) ) ; } else { stdDev = 0.0 ; } } return stdDev ; } | Returns the standard deviation of the values that have been added . | 74 | 12 |
34,904 | public void sendBatch ( ) { LrsStatement statement = null ; List < LrsStatement > list = new ArrayList < LrsStatement > ( ) ; while ( ( statement = statementQueue . poll ( ) ) != null ) { list . add ( statement ) ; } if ( ! list . isEmpty ( ) ) { postStatementList ( list ) ; } } | Send a batch of LRS statements . MUST BE SCHEDULED! Failure to properly configure this class will result in memory leaks . | 78 | 27 |
34,905 | private void postStatementList ( List < LrsStatement > list ) { try { ResponseEntity < Object > response = sendRequest ( STATEMENTS_REST_ENDPOINT , HttpMethod . POST , null , list , Object . class ) ; if ( response . getStatusCode ( ) . series ( ) == Series . SUCCESSFUL ) { logger . trace ( "LRS provider successfully s... | Send the list of batched LRS statements to the LRS . | 321 | 14 |
34,906 | public final void addValue ( double v ) { if ( isComplete ( ) ) { this . getLogger ( ) . warn ( "{} is already closed, the new value of {} will be ignored on: {}" , this . getClass ( ) . getSimpleName ( ) , v , this ) ; return ; } // Lazily init the statistics object if ( this . statisticalSummary == null ) { this . st... | Add the value to the summary statistics | 118 | 7 |
34,907 | @ RequestMapping ( value = "/portletList" , method = RequestMethod . GET ) public ModelAndView listChannels ( WebRequest webRequest , HttpServletRequest request , @ RequestParam ( value = "type" , required = false ) String type ) { if ( TYPE_MANAGE . equals ( type ) ) { throw new UnsupportedOperationException ( "Moved ... | Original pre - 4 . 3 version of this API . Always returns the entire contents of the Portlet Registry including uncategorized portlets to which the user has access . Access is based on the SUBSCRIBE permission . | 197 | 46 |
34,908 | @ Override public LrsStatement toLrsStatement ( PortalEvent event ) { return new LrsStatement ( getActor ( event ) , getVerb ( event ) , getLrsObject ( event ) ) ; } | Convert an event to an LrsStatement . | 46 | 10 |
34,909 | protected LrsActor getActor ( PortalEvent event ) { String username = event . getUserName ( ) ; return actorService . getLrsActor ( username ) ; } | Get the actor for an event . | 36 | 7 |
34,910 | protected URI buildUrn ( String ... parts ) { UrnBuilder builder = new UrnBuilder ( "UTF-8" , "tincan" , "uportal" , "activities" ) ; builder . add ( parts ) ; return builder . getUri ( ) ; } | Build the URN for the LrsStatement . This method attaches creates the base URN . Additional elements can be attached . | 62 | 25 |
34,911 | @ Bean ( name = "usernameAttributeProvider" ) public IUsernameAttributeProvider getUsernameAttributeProvider ( ) { final SimpleUsernameAttributeProvider rslt = new SimpleUsernameAttributeProvider ( ) ; rslt . setUsernameAttribute ( USERNAME_ATTRIBUTE ) ; return rslt ; } | Provides the default username attribute to use to the rest of the DAOs . | 66 | 16 |
34,912 | @ Bean ( name = "requestAttributeSourceFilter" ) public Filter getRequestAttributeSourceFilter ( ) { final RequestAttributeSourceFilter rslt = new RequestAttributeSourceFilter ( ) ; rslt . setAdditionalDescriptors ( getRequestAdditionalDescriptors ( ) ) ; rslt . setUsernameAttribute ( REMOTE_USER_ATTRIBUTE ) ; // Looks... | Servlet filter that creates an attribute for the serverName | 352 | 11 |
34,913 | @ Bean ( name = "sessionAttributesOverridesMap" ) @ Scope ( value = "globalSession" , proxyMode = ScopedProxyMode . TARGET_CLASS ) public Map getSessionAttributesOverridesMap ( ) { return new ConcurrentHashMap ( ) ; } | Store attribute overrides in a session scoped map to ensure overrides don t show up for other users and swapped attributes will be cleaned up on user logout . | 59 | 33 |
34,914 | @ Bean ( name = "personAttributeDao" ) @ Qualifier ( "personAttributeDao" ) public IPersonAttributeDao getPersonAttributeDao ( ) { final PortalRootPersonAttributeDao rslt = new PortalRootPersonAttributeDao ( ) ; rslt . setDelegatePersonAttributeDao ( getRequestAttributeMergingDao ( ) ) ; rslt . setAttributeOverridesMap... | Overrides DAO acts as the root it handles incorporating attributes from the attribute swapper utility wraps the caching DAO | 105 | 24 |
34,915 | @ Bean ( name = "requestAttributeMergingDao" ) @ Qualifier ( "uPortalInternal" ) public IPersonAttributeDao getRequestAttributeMergingDao ( ) { final MergingPersonAttributeDaoImpl rslt = new MergingPersonAttributeDaoImpl ( ) ; rslt . setUsernameAttributeProvider ( getUsernameAttributeProvider ( ) ) ; rslt . setMerger (... | Merges attributes from the request with those from other DAOs . | 166 | 13 |
34,916 | @ Bean ( name = "requestAttributesDao" ) @ Qualifier ( "uPortalInternal" ) public IPersonAttributeDao getRequestAttributesDao ( ) { final AdditionalDescriptorsPersonAttributeDao rslt = new AdditionalDescriptorsPersonAttributeDao ( ) ; rslt . setDescriptors ( getRequestAdditionalDescriptors ( ) ) ; rslt . setUsernameAtt... | The person attributes DAO that returns the attributes from the request . Uses a currentUserProvider since the username may not always be provided by the request object . | 118 | 31 |
34,917 | @ Bean ( name = "cachingPersonAttributeDao" ) @ Qualifier ( "uPortalInternal" ) public IPersonAttributeDao getCachingPersonAttributeDao ( ) { final CachingPersonAttributeDaoImpl rslt = new CachingPersonAttributeDaoImpl ( ) ; rslt . setUsernameAttributeProvider ( getUsernameAttributeProvider ( ) ) ; rslt . setCacheNullR... | Defines the order that the data providing DAOs are called results are cached by the outer caching DAO . | 160 | 22 |
34,918 | @ Bean ( name = "innerMergedPersonAttributeDaoList" ) public List < IPersonAttributeDao > getInnerMergedPersonAttributeDaoList ( ) { final List < IPersonAttributeDao > rslt = new ArrayList <> ( ) ; rslt . add ( getImpersonationStatusPersonAttributeDao ( ) ) ; rslt . add ( getUPortalAccountUserSource ( ) ) ; rslt . add ... | IPersonAttributeDao beans defined by implementors will be added to this list when the ApplicationContext comes up . | 113 | 23 |
34,919 | @ Bean ( name = "uPortalAccountUserSource" ) @ Qualifier ( "uPortalInternal" ) public IPersonAttributeDao getUPortalAccountUserSource ( ) { final LocalAccountPersonAttributeDao rslt = new LocalAccountPersonAttributeDao ( ) ; rslt . setLocalAccountDao ( localAccountDao ) ; rslt . setUsernameAttributeProvider ( getUserna... | Looks in the local person - directory data . This is only used for portal - local users such as fragment owners All attributes are searchable via this configuration results are cached by the underlying DAO . | 317 | 39 |
34,920 | @ Bean ( name = "uPortalJdbcUserSource" ) @ Qualifier ( "uPortalInternal" ) public IPersonAttributeDao getUPortalJdbcUserSource ( ) { final String sql = "SELECT USER_NAME FROM UP_USER WHERE {0}" ; final SingleRowJdbcPersonAttributeDao rslt = new SingleRowJdbcPersonAttributeDao ( personDb , sql ) ; rslt . setUsernameAtt... | Looks in the base UP_USER table doesn t find attributes but will ensure a result if it the user exists in the portal database and is searched for by username results are cached by the outer caching DAO . | 253 | 42 |
34,921 | static void addParameterChild ( Element node , String name , String value ) { if ( node != null ) { Document doc = node . getOwnerDocument ( ) ; Element parm = doc . createElement ( Constants . ELM_PARAMETER ) ; parm . setAttribute ( Constants . ATT_NAME , name ) ; parm . setAttribute ( Constants . ATT_VALUE , value ) ... | Performs parameter child element creation in the passed in Element . | 175 | 12 |
34,922 | protected final < T > TypedQuery < T > createQuery ( CriteriaQuery < T > criteriaQuery ) { return this . getEntityManager ( ) . createQuery ( criteriaQuery ) ; } | Common logic for creating and configuring JPA queries | 41 | 10 |
34,923 | protected final < T > TypedQuery < T > createCachedQuery ( CriteriaQuery < T > criteriaQuery ) { final TypedQuery < T > query = this . getEntityManager ( ) . createQuery ( criteriaQuery ) ; final String cacheRegion = getCacheRegionName ( criteriaQuery ) ; query . setHint ( "org.hibernate.cacheable" , true ) ; query . s... | Important common logic for creating and configuring JPA queries cached in EhCache . This step is important for the sake of scalability . | 111 | 27 |
34,924 | protected final < T > String getCacheRegionName ( CriteriaQuery < T > criteriaQuery ) { final Set < Root < ? > > roots = criteriaQuery . getRoots ( ) ; final Class < ? > cacheRegionType = roots . iterator ( ) . next ( ) . getJavaType ( ) ; final String cacheRegion = cacheRegionType . getName ( ) + QUERY_SUFFIX ; if ( r... | Creates the cache region name for the criteria query | 156 | 10 |
34,925 | protected Map session ( ) { Map session ; try { SimpleHash sessionHash = ( SimpleHash ) get ( "session" ) ; session = sessionHash . toMap ( ) ; } catch ( Exception e ) { logger ( ) . warn ( "failed to get a session map in context, returning session without data!!!" , e ) ; session = new HashMap ( ) ; } return Collectio... | Returns reference to a current session map . | 91 | 8 |
34,926 | protected RenderBuilder render ( ) { String template = Router . getControllerPath ( getClass ( ) ) + "/" + RequestContext . getRoute ( ) . getActionName ( ) ; return super . render ( template , values ( ) ) ; } | Use this method in order to override a layout status code and content type . | 52 | 15 |
34,927 | public boolean actionSupportsHttpMethod ( String actionMethodName , HttpMethod httpMethod ) { if ( restful ( ) ) { return restfulActionSupportsHttpMethod ( actionMethodName , httpMethod ) || standardActionSupportsHttpMethod ( actionMethodName , httpMethod ) ; } else { return standardActionSupportsHttpMethod ( actionMet... | Checks if the action supports an HTTP method according to its configuration . | 81 | 14 |
34,928 | protected Route recognize ( String uri , HttpMethod httpMethod ) throws ClassLoadException { if ( uri . endsWith ( "/" ) && uri . length ( ) > 1 ) { uri = uri . substring ( 0 , uri . length ( ) - 1 ) ; } ControllerPath controllerPath = getControllerPath ( uri ) ; Route route = matchCustom ( uri , controllerPath , httpM... | This is a main method for recognizing a route to a controller ; used when a request is received . | 299 | 20 |
34,929 | private Route matchStandard ( String uri , ControllerPath controllerPathObject , AppController controller , HttpMethod method ) { String controllerPath = ( controllerPathObject . getControllerPackage ( ) != null ? "/" + controllerPathObject . getControllerPackage ( ) . replace ( "." , "/" ) : "" ) + "/" + controllerPat... | Will match a standard non - restful route . | 329 | 10 |
34,930 | protected static String findControllerNamePart ( String pack , String uri ) { String temp = uri . startsWith ( "/" ) ? uri . substring ( 1 ) : uri ; temp = temp . replace ( "/" , "." ) ; if ( temp . length ( ) > pack . length ( ) ) temp = temp . substring ( pack . length ( ) + 1 ) ; if ( temp . equals ( "" ) ) throw ne... | Now that we know that this controller is under a package need to find the controller short name . | 134 | 19 |
34,931 | protected String findPackageSuffix ( String uri ) { String temp = uri . startsWith ( "/" ) ? uri . substring ( 1 ) : uri ; temp = temp . replace ( "." , "_" ) ; temp = temp . replace ( "/" , "." ) ; //find all matches List < String > candidates = new ArrayList <> ( ) ; for ( String pack : Configuration . getControllerP... | Finds a part of a package name which can be found in between app . controllers and short name of class . | 249 | 23 |
34,932 | public < T extends AppController > RouteBuilder to ( Class < T > type ) { boolean hasControllerSegment = false ; for ( Segment segment : segments ) { hasControllerSegment = segment . controller ; } if ( type != null && hasControllerSegment ) { throw new IllegalArgumentException ( "Cannot combine {controller} segment an... | Allows to wire a route to a controller . | 102 | 9 |
34,933 | public RouteBuilder action ( String action ) { boolean hasActionSegment = false ; for ( Segment segment : segments ) { hasActionSegment = segment . action ; } if ( action != null && hasActionSegment ) { throw new IllegalArgumentException ( "Cannot combine {action} segment and .action(\"...\") method. Failed route: " + ... | Name of action to which a route is mapped . | 94 | 10 |
34,934 | public RouteBuilder get ( ) { if ( ! methods . contains ( HttpMethod . GET ) ) { methods . add ( HttpMethod . GET ) ; } return this ; } | Specifies that this route is mapped to HTTP GET method . | 38 | 12 |
34,935 | public RouteBuilder post ( ) { if ( ! methods . contains ( HttpMethod . POST ) ) { methods . add ( HttpMethod . POST ) ; } return this ; } | Specifies that this route is mapped to HTTP POST method . | 38 | 12 |
34,936 | public RouteBuilder options ( ) { if ( ! methods . contains ( HttpMethod . OPTIONS ) ) { methods . add ( HttpMethod . OPTIONS ) ; } return this ; } | Specifies that this route is mapped to HTTP OPTIONS method . | 40 | 13 |
34,937 | public RouteBuilder put ( ) { if ( ! methods . contains ( HttpMethod . PUT ) ) { methods . add ( HttpMethod . PUT ) ; } return this ; } | Specifies that this route is mapped to HTTP PUT method . | 40 | 13 |
34,938 | public RouteBuilder delete ( ) { if ( ! methods . contains ( HttpMethod . DELETE ) ) { methods . add ( HttpMethod . DELETE ) ; } return this ; } | Specifies that this route is mapped to HTTP DELETE method . | 42 | 14 |
34,939 | 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 . | 398 | 13 |
34,940 | protected static Map < String , Object > getSessionAttributes ( ) { //TODO: cache session attributes map since this method can be called multiple times during a request. HttpSession session = RequestContext . getHttpRequest ( ) . getSession ( true ) ; Enumeration names = session . getAttributeNames ( ) ; Map < String ,... | Returns all session attributes in a map . | 136 | 8 |
34,941 | 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 . | 83 | 33 |
34,942 | 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 . | 75 | 8 |
34,943 | 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 . | 175 | 8 |
34,944 | public static Map < String , String > params1st ( ) { //TODO: candidate for performance optimization Map < String , String > params = new HashMap <> ( ) ; Enumeration names = RequestContext . getHttpRequest ( ) . getParameterNames ( ) ; while ( names . hasMoreElements ( ) ) { String name = names . nextElement ( ) . toS... | 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 . | 172 | 30 |
34,945 | 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 : servl... | Returns collection of all cookies browser sent . | 126 | 8 |
34,946 | 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 . | 114 | 10 |
34,947 | public void session ( String name , Object value ) { RequestContext . getHttpRequest ( ) . getSession ( ) . getAttribute ( name ) ; } | Sets an object on a current session . | 32 | 9 |
34,948 | private List < ConnectionSpecWrapper > getConnectionWrappers ( ) { List < ConnectionSpecWrapper > allConnections = DbConfiguration . getConnectionSpecWrappers ( ) ; List < ConnectionSpecWrapper > result = new LinkedList <> ( ) ; for ( ConnectionSpecWrapper connectionWrapper : allConnections ) { if ( ! connectionWrapper... | Returns all connections which correspond dbName of this filter and not for testing | 120 | 14 |
34,949 | protected void assign ( String name , Object value ) { KeyWords . check ( name ) ; RequestContext . getValues ( ) . put ( name , value ) ; } | Assigns a value for a view . | 35 | 9 |
34,950 | 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 . | 43 | 27 |
34,951 | 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 . | 83 | 14 |
34,952 | 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 . | 75 | 8 |
34,953 | protected boolean blank ( String ... names ) { //TODO: write test, move elsewhere - some helper for ( String name : names ) { if ( Util . blank ( param ( name ) ) ) { return true ; } } return false ; } | Returns true if any named request parameter is blank . | 53 | 10 |
34,954 | 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 . | 50 | 43 |
34,955 | 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 ) ) ; } re... | Returns response headers | 86 | 3 |
34,956 | 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 . | 77 | 10 |
34,957 | 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 . | 61 | 8 |
34,958 | public Object get ( String name ) { return RequestContext . getHttpRequest ( ) . getSession ( true ) . getAttribute ( name ) ; } | Retrieve object from session . | 31 | 6 |
34,959 | 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 . | 90 | 14 |
34,960 | private void injectController ( AppController controller ) { Injector injector = Configuration . getInjector ( ) ; if ( injector != null ) { injector . injectMembers ( controller ) ; } } | Injects controller with dependencies from Guice module . | 44 | 11 |
34,961 | 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 . | 114 | 5 |
34,962 | 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 | 193 | 8 |
34,963 | private boolean checkActionMethod ( AppController controller , String actionMethod ) { HttpMethod method = HttpMethod . getMethod ( RequestContext . getHttpRequest ( ) ) ; if ( ! controller . actionSupportsHttpMethod ( actionMethod , method ) ) { DirectResponse res = new DirectResponse ( "" ) ; //see http://www.w3.org/... | Checks if the action method supports requested HTTP method | 229 | 10 |
34,964 | 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 | 176 | 5 |
34,965 | 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 . | 45 | 11 |
34,966 | 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 | 40 | 12 |
34,967 | 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 . | 88 | 7 |
34,968 | 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 . | 64 | 12 |
34,969 | 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 . | 37 | 14 |
34,970 | 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 . | 441 | 17 |
34,971 | public String getStreamAsString ( ) { try { return Util . read ( fileItemStream . openStream ( ) ) ; } catch ( Exception e ) { throw new ControllerException ( e ) ; } } | Converts entire content of this item to String . | 44 | 10 |
34,972 | public void registerTag ( String name , FreeMarkerTag tag ) { configuration . setSharedVariable ( name , tag ) ; userTags . add ( tag ) ; } | Registers an application - specific tag . | 36 | 8 |
34,973 | 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 ) ) ; } ca... | Maybe this is a hack for other containers too?? Maybe this is not a hack at all? | 145 | 19 |
34,974 | public void close ( ) { synchronized ( sessions ) { closed = true ; sessionCleaner . close ( ) ; sessions . stream ( ) . forEach ( PooledSession :: reallyClose ) ; } } | Closes all underlying JMS sessions . | 42 | 8 |
34,975 | 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 . | 203 | 7 |
34,976 | 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 . | 86 | 22 |
34,977 | 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 . | 110 | 29 |
34,978 | 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 . crea... | 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 . | 245 | 28 |
34,979 | 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 | 125 | 5 |
34,980 | 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 . | 75 | 8 |
34,981 | public long getMessageCount ( String queue ) { try { return getQueueControl ( queue ) . getMessageCount ( ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Returns number of messages currently in queue | 44 | 7 |
34,982 | public void resume ( String queueName ) { try { getQueueControl ( queueName ) . resume ( ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Resumes a paused queue | 41 | 5 |
34,983 | 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 . | 41 | 20 |
34,984 | public int removeMessages ( String queueName , String filter ) { try { return getQueueControl ( queueName ) . removeMessages ( filter ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Removes messages from queue . | 50 | 6 |
34,985 | public int removeAllMessages ( String queueName ) { try { return getQueueControl ( queueName ) . removeMessages ( null ) ; } catch ( Exception e ) { throw new AsyncException ( e ) ; } } | Removes all messages from queue . | 48 | 7 |
34,986 | 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 | 50 | 9 |
34,987 | private static String encode ( String value , BitSet unescapedChars ) { // Code from org.apache.commons.codec.net.URLCodec.encodeUrl(BitSet, byte[]) final ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; for ( final byte c : value . getBytes ( CHARSET ) ) { int b = c ; if ( b < 0 ) { b = 256 + b ; } if ( ... | URL - encode a String . | 246 | 6 |
34,988 | 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 | 376 | 23 |
34,989 | 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 | 328 | 20 |
34,990 | 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 | 89 | 9 |
34,991 | 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 | 289 | 36 |
34,992 | 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 . | 165 | 4 |
34,993 | 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 . | 136 | 17 |
34,994 | public RDFUnit init ( ) { // Update pattern service for ( Pattern pattern : getPatterns ( ) ) { PatternService . addPattern ( pattern . getId ( ) , pattern . getIRI ( ) , pattern ) ; } return this ; } | Initializes the patterns library required | 53 | 6 |
34,995 | 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 | 248 | 16 |
34,996 | 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 | 156 | 14 |
34,997 | private boolean containsFormatName ( String format ) { return name . equalsIgnoreCase ( format ) || synonyms . contains ( format . toLowerCase ( ) ) ; } | Helper function that matches only the synonyms | 36 | 8 |
34,998 | 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 | 77 | 10 |
34,999 | 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 | 75 | 12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.