idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
22,300 | public Map < String , String > getValueMap ( ) { if ( tokensMap == null ) { return null ; } if ( tokensMap . isEmpty ( ) ) { return new LinkedHashMap < > ( ) ; } else { Map < String , String > map = new LinkedHashMap < > ( tokensMap . size ( ) ) ; for ( Map . Entry < String , Token [ ] > entry : tokensMap . entrySet ( ... | Returns a map of string values of this item . |
22,301 | public void setValue ( Map < String , Token [ ] > tokensMap ) { if ( type == null ) { type = ItemType . MAP ; } if ( ! isMappableType ( ) ) { throw new IllegalArgumentException ( "The type of this item must be 'map' or 'properties'" ) ; } this . tokensMap = tokensMap ; } | Sets a value to this Map type item . |
22,302 | public void setValue ( Properties properties ) { if ( properties == null ) { throw new IllegalArgumentException ( "properties must not be null" ) ; } if ( type == null ) { type = ItemType . PROPERTIES ; } if ( ! isMappableType ( ) ) { throw new IllegalArgumentException ( "The type of this item must be 'properties' or '... | Sets a value to this Properties type item . |
22,303 | public void setValue ( List < Token [ ] > tokensList ) { if ( type == null ) { type = ItemType . LIST ; } if ( ! isListableType ( ) ) { throw new IllegalArgumentException ( "The item type must be 'array', 'list' or 'set' for this item " + this ) ; } this . tokensList = tokensList ; } | Sets a value to this List type item . |
22,304 | public void setValue ( Set < Token [ ] > tokensSet ) { if ( tokensSet == null ) { throw new IllegalArgumentException ( "tokensSet must not be null" ) ; } if ( type == null ) { type = ItemType . SET ; } if ( ! isListableType ( ) ) { throw new IllegalArgumentException ( "The type of this item must be 'set', 'array' or 'l... | Sets a value to this Set type item . |
22,305 | public boolean isListableType ( ) { return ( type == ItemType . ARRAY || type == ItemType . LIST || type == ItemType . SET ) ; } | Return whether this item is listable type . |
22,306 | public static ItemRule newInstance ( String type , String name , String valueType , String defaultValue , Boolean tokenize , Boolean mandatory , Boolean secret ) throws IllegalRuleException { ItemRule itemRule = new ItemRule ( ) ; ItemType itemType = ItemType . resolve ( type ) ; if ( type != null && itemType == null )... | Returns a new derived instance of ItemRule . |
22,307 | public static Token makeReferenceToken ( String bean , String template , String parameter , String attribute , String property ) { Token token ; if ( bean != null ) { token = new Token ( TokenType . BEAN , bean ) ; } else if ( template != null ) { token = new Token ( TokenType . TEMPLATE , template ) ; } else if ( para... | Returns a made reference token . |
22,308 | public InputStream getInputStream ( ) throws IOException { InputStream inputStream = fileItem . getInputStream ( ) ; return ( inputStream != null ? inputStream : new ByteArrayInputStream ( new byte [ 0 ] ) ) ; } | Return an InputStream to read the contents of the file from . |
22,309 | public File saveAs ( File destFile , boolean overwrite ) throws IOException { if ( destFile == null ) { throw new IllegalArgumentException ( "destFile can not be null" ) ; } validateFile ( ) ; try { destFile = determineDestinationFile ( destFile , overwrite ) ; fileItem . write ( destFile ) ; } catch ( FileUploadExcept... | Save an uploaded file as a given destination file . |
22,310 | private static String makeMessage ( int lineNumber , String line , String tline , String msg ) { int columnNumber = ( tline != null ? line . indexOf ( tline ) : 0 ) ; StringBuilder sb = new StringBuilder ( ) ; if ( msg != null ) { sb . append ( msg ) ; } sb . append ( " [lineNumber: " ) . append ( lineNumber ) ; if ( c... | Create a detail message . |
22,311 | private void prepare ( String requestName , MethodType requestMethod , TransletRule transletRule , Translet parentTranslet ) { try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Translet " + transletRule ) ; } newTranslet ( requestMethod , requestName , transletRule , parentTranslet ) ; if ( parentTranslet == null ... | Prepares a new activity for the Translet Rule by taking the results of the process that was created earlier . |
22,312 | private void produce ( ) { ContentList contentList = getTransletRule ( ) . getContentList ( ) ; if ( contentList != null ) { ProcessResult processResult = translet . getProcessResult ( ) ; if ( processResult == null ) { processResult = new ProcessResult ( contentList . size ( ) ) ; processResult . setName ( contentList... | Produce the result of the content and its subordinate actions . |
22,313 | protected String resolveRequestEncoding ( ) { String encoding = getRequestRule ( ) . getEncoding ( ) ; if ( encoding == null ) { encoding = getSetting ( RequestRule . CHARACTER_ENCODING_SETTING_NAME ) ; } return encoding ; } | Determines the request encoding . |
22,314 | protected String resolveResponseEncoding ( ) { String encoding = getRequestRule ( ) . getEncoding ( ) ; if ( encoding == null ) { encoding = resolveRequestEncoding ( ) ; } return encoding ; } | Determines the response encoding . |
22,315 | protected LocaleResolver resolveLocale ( ) { LocaleResolver localeResolver = null ; String localeResolverBeanId = getSetting ( RequestRule . LOCALE_RESOLVER_SETTING_NAME ) ; if ( localeResolverBeanId != null ) { localeResolver = getBean ( localeResolverBeanId , LocaleResolver . class ) ; localeResolver . resolveLocale ... | Resolve the current locale . |
22,316 | protected void parseDeclaredParameters ( ) { ItemRuleMap parameterItemRuleMap = getRequestRule ( ) . getParameterItemRuleMap ( ) ; if ( parameterItemRuleMap != null && ! parameterItemRuleMap . isEmpty ( ) ) { ItemEvaluator evaluator = null ; ItemRuleList missingItemRules = null ; for ( ItemRule itemRule : parameterItem... | Parses the declared parameters . |
22,317 | protected void parseDeclaredAttributes ( ) { ItemRuleMap attributeItemRuleMap = getRequestRule ( ) . getAttributeItemRuleMap ( ) ; if ( attributeItemRuleMap != null && ! attributeItemRuleMap . isEmpty ( ) ) { ItemEvaluator evaluator = new ItemExpression ( this ) ; for ( ItemRule itemRule : attributeItemRuleMap . values... | Parses the declared attributes . |
22,318 | protected void execute ( ActionList actionList ) { ProcessResult processResult = translet . getProcessResult ( ) ; if ( processResult == null ) { processResult = new ProcessResult ( 1 ) ; translet . setProcessResult ( processResult ) ; } ContentResult contentResult = processResult . getContentResult ( actionList . getN... | Execute actions . |
22,319 | private void execute ( Executable action , ContentResult contentResult ) { try { ChooseWhenRule chooseWhenRule = null ; if ( action . getCaseNo ( ) > 0 ) { ChooseRuleMap chooseRuleMap = getTransletRule ( ) . getChooseRuleMap ( ) ; if ( chooseRuleMap == null || chooseRuleMap . isEmpty ( ) ) { throw new IllegalRuleExcept... | Execute action . |
22,320 | public void scanConfigurableBeans ( String ... basePackages ) throws BeanRuleException { if ( basePackages == null || basePackages . length == 0 ) { return ; } log . info ( "Auto component scanning on packages [" + StringUtils . joinCommaDelimitedList ( basePackages ) + "]" ) ; for ( String basePackage : basePackages )... | Scans for annotated components . |
22,321 | public void addBeanRule ( final BeanRule beanRule ) throws IllegalRuleException { PrefixSuffixPattern prefixSuffixPattern = PrefixSuffixPattern . parse ( beanRule . getId ( ) ) ; String scanPattern = beanRule . getScanPattern ( ) ; if ( scanPattern != null ) { BeanClassScanner scanner = createBeanClassScanner ( beanRul... | Adds a bean rule . |
22,322 | protected String getMessageFromParent ( String code , Object [ ] args , Locale locale ) { MessageSource parent = getParentMessageSource ( ) ; if ( parent != null ) { if ( parent instanceof AbstractMessageSource ) { return ( ( AbstractMessageSource ) parent ) . getMessageInternal ( code , args , locale ) ; } else { retu... | Try to retrieve the given message from the parent MessageSource if any . |
22,323 | public void reserve ( String beanId , Class < ? > beanClass , BeanReferenceable referenceable , RuleAppender ruleAppender ) { RefererKey key = new RefererKey ( beanClass , beanId ) ; Set < RefererInfo > refererInfoSet = refererInfoMap . get ( key ) ; if ( refererInfoSet == null ) { refererInfoSet = new LinkedHashSet < ... | Reserves to bean reference inspection . |
22,324 | public void inspect ( BeanRuleRegistry beanRuleRegistry ) throws BeanReferenceException , BeanRuleException { Set < Object > brokenReferences = new LinkedHashSet < > ( ) ; for ( Map . Entry < RefererKey , Set < RefererInfo > > entry : refererInfoMap . entrySet ( ) ) { RefererKey refererKey = entry . getKey ( ) ; String... | Inspect bean reference . |
22,325 | public ItemRule putItemRule ( ItemRule itemRule ) { if ( itemRule . isAutoNamed ( ) ) { autoNaming ( itemRule ) ; } return put ( itemRule . getName ( ) , itemRule ) ; } | Adds a item rule . |
22,326 | protected void rejectRequest ( Translet translet , CorsException ce ) throws CorsException { HttpServletResponse res = translet . getResponseAdaptee ( ) ; res . setStatus ( ce . getHttpStatusCode ( ) ) ; translet . setAttribute ( CORS_HTTP_STATUS_CODE , ce . getHttpStatusCode ( ) ) ; translet . setAttribute ( CORS_HTTP... | Invoked when one of the CORS checks failed . The default implementation sets the response status to 403 . |
22,327 | private boolean isAllowedAddress ( String ipAddress ) { if ( allowedAddresses == null ) { return false ; } int offset = ipAddress . lastIndexOf ( '.' ) ; if ( offset == - 1 ) { offset = ipAddress . lastIndexOf ( ':' ) ; if ( offset == - 1 ) { return false ; } } String ipAddressClass = ipAddress . substring ( 0 , offset... | Returns whether IP address is valid . |
22,328 | public byte [ ] getBytes ( ) throws IOException { InputStream input = getInputStream ( ) ; ByteArrayOutputStream output = new ByteArrayOutputStream ( ) ; final byte [ ] buffer = new byte [ DEFAULT_BUFFER_SIZE ] ; int len ; try { while ( ( len = input . read ( buffer ) ) != - 1 ) { output . write ( buffer , 0 , len ) ; ... | Returns the contents of the file in a byte array . Can not use a large array of memory than the JVM Heap deal . |
22,329 | public File saveAs ( File destFile , boolean overwrite ) throws IOException { if ( destFile == null ) { throw new IllegalArgumentException ( "destFile can not be null" ) ; } try { destFile = determineDestinationFile ( destFile , overwrite ) ; final byte [ ] buffer = new byte [ DEFAULT_BUFFER_SIZE ] ; int len ; try ( In... | Save an file as a given destination file . |
22,330 | public void release ( ) { if ( file != null ) { file . setWritable ( true ) ; } if ( savedFile != null ) { savedFile . setWritable ( true ) ; } } | Sets the access permission that allow write operations on the file associated with this FileParameter . |
22,331 | public static ActivityContext getActivityContext ( ServletContext servletContext ) { ActivityContext activityContext = getActivityContext ( servletContext , ROOT_WEB_SERVICE_ATTRIBUTE ) ; if ( activityContext == null ) { throw new IllegalStateException ( "No Root AspectranWebService found; " + "No AspectranServiceListe... | Find the root ActivityContext for this web aspectran service . |
22,332 | public static ActivityContext getActivityContext ( HttpServlet servlet ) { ServletContext servletContext = servlet . getServletContext ( ) ; String attrName = STANDALONE_WEB_SERVICE_ATTRIBUTE_PREFIX + servlet . getServletName ( ) ; ActivityContext activityContext = getActivityContext ( servletContext , attrName ) ; if ... | Find the standalone ActivityContext for this web aspectran service . |
22,333 | private static ActivityContext getActivityContext ( ServletContext servletContext , String attrName ) { Object attr = servletContext . getAttribute ( attrName ) ; if ( attr == null ) { return null ; } if ( ! ( attr instanceof AspectranWebService ) ) { throw new IllegalStateException ( "Context attribute [" + attr + "] ... | Find the ActivityContext for this web aspectran service . |
22,334 | private boolean deleteFile ( String filename ) throws Exception { if ( filename == null ) { return false ; } File file = new File ( storeDir , filename ) ; return Files . deleteIfExists ( file . toPath ( ) ) ; } | Delete the file associated with a session |
22,335 | public Set < String > doGetExpired ( final Set < String > candidates ) { final long now = System . currentTimeMillis ( ) ; Set < String > expired = new HashSet < > ( ) ; for ( String filename : sessionFileMap . values ( ) ) { try { long expiry = getExpiryFromFilename ( filename ) ; if ( expiry > 0 && expiry < now ) { e... | Check to see which sessions have expired . |
22,336 | private String getIdFromFilename ( String filename ) { if ( ! StringUtils . hasText ( filename ) || filename . indexOf ( '_' ) < 0 ) { return null ; } return filename . substring ( 0 , filename . lastIndexOf ( '_' ) ) ; } | Extract the session id from the filename . |
22,337 | private boolean isSessionFilename ( String filename ) { if ( ! StringUtils . hasText ( filename ) ) { return false ; } String [ ] parts = filename . split ( "_" ) ; return ( parts . length >= 2 ) ; } | Check if the filename matches our session pattern . |
22,338 | public void sweepFile ( long now , Path p ) throws Exception { if ( p == null ) { return ; } long expiry = getExpiryFromFilename ( p . getFileName ( ) . toString ( ) ) ; if ( expiry > 0 && ( ( now - expiry ) >= ( 5 * TimeUnit . SECONDS . toMillis ( gracePeriodSec ) ) ) ) { Files . deleteIfExists ( p ) ; if ( log . isDe... | Check to see if the expiry on the file is very old and delete the file if so . Old means that it expired at least 5 gracePeriods ago . |
22,339 | private void save ( OutputStream os , String id , SessionData data ) throws IOException { DataOutputStream out = new DataOutputStream ( os ) ; out . writeUTF ( id ) ; out . writeLong ( data . getCreationTime ( ) ) ; out . writeLong ( data . getAccessedTime ( ) ) ; out . writeLong ( data . getLastAccessedTime ( ) ) ; ou... | Save the session data . |
22,340 | private SessionData load ( InputStream is , String expectedId ) throws Exception { try { DataInputStream di = new DataInputStream ( is ) ; String id = di . readUTF ( ) ; long created = di . readLong ( ) ; long accessed = di . readLong ( ) ; long lastAccessed = di . readLong ( ) ; long expiry = di . readLong ( ) ; long ... | Load session data from an input stream that contains session data . |
22,341 | private void restoreAttributes ( InputStream is , int size , SessionData data ) throws Exception { if ( size > 0 ) { Map < String , Object > attributes = new HashMap < > ( ) ; ObjectInputStream ois = new CustomObjectInputStream ( is ) ; for ( int i = 0 ; i < size ; i ++ ) { String key = ois . readUTF ( ) ; Object value... | Load attributes from an input stream that contains session data . |
22,342 | private void parseMultipartParameters ( Map < String , List < FileItem > > fileItemListMap , RequestAdapter requestAdapter ) { String encoding = requestAdapter . getEncoding ( ) ; MultiValueMap < String , String > parameterMap = new LinkedMultiValueMap < > ( ) ; MultiValueMap < String , FileParameter > fileParameterMap... | Parse form fields and file items . |
22,343 | public Configuration createConfiguration ( ) throws IOException , TemplateException { Configuration config = newConfiguration ( ) ; Properties props = new Properties ( ) ; if ( this . freemarkerSettings != null ) { props . putAll ( this . freemarkerSettings ) ; } if ( ! props . isEmpty ( ) ) { config . setSettings ( pr... | Prepare the FreeMarker Configuration and return it . |
22,344 | protected TemplateLoader getAggregateTemplateLoader ( TemplateLoader [ ] templateLoaders ) { int loaderCount = ( templateLoaders != null ? templateLoaders . length : 0 ) ; switch ( loaderCount ) { case 0 : if ( log . isDebugEnabled ( ) ) { log . debug ( "No FreeMarker TemplateLoaders specified; Can be used only inner t... | Return a TemplateLoader based on the given TemplateLoader list . If more than one TemplateLoader has been registered a FreeMarker MultiTemplateLoader needs to be created . |
22,345 | protected TemplateLoader getTemplateLoaderForPath ( String templateLoaderPath ) throws IOException { if ( templateLoaderPath . startsWith ( ResourceUtils . CLASSPATH_URL_PREFIX ) ) { String basePackagePath = templateLoaderPath . substring ( ResourceUtils . CLASSPATH_URL_PREFIX . length ( ) ) ; if ( log . isDebugEnabled... | Determine a FreeMarker TemplateLoader for the given path . |
22,346 | public Options addOption ( Option opt ) { String key = opt . getKey ( ) ; if ( opt . hasLongName ( ) ) { longOpts . put ( opt . getLongName ( ) , opt ) ; } if ( opt . isRequired ( ) ) { if ( requiredOpts . contains ( key ) ) { requiredOpts . remove ( requiredOpts . indexOf ( key ) ) ; } requiredOpts . add ( key ) ; } s... | Adds an option instance . |
22,347 | public ItemRule newHeaderItemRule ( String headerName ) { ItemRule itemRule = new ItemRule ( ) ; itemRule . setName ( headerName ) ; addHeaderItemRule ( itemRule ) ; return itemRule ; } | Adds a new header rule with the specified name and returns it . |
22,348 | public void addHeaderItemRule ( ItemRule headerItemRule ) { if ( headerItemRuleMap == null ) { headerItemRuleMap = new ItemRuleMap ( ) ; } headerItemRuleMap . putItemRule ( headerItemRule ) ; } | Adds the header item rule . |
22,349 | public static HeaderActionRule newInstance ( String id , Boolean hidden ) { HeaderActionRule headerActionRule = new HeaderActionRule ( ) ; headerActionRule . setActionId ( id ) ; headerActionRule . setHidden ( hidden ) ; return headerActionRule ; } | Returns a new derived instance of HeaderActionRule . |
22,350 | protected Object getBean ( Token token ) { Object value ; if ( token . getAlternativeValue ( ) != null ) { if ( token . getDirectiveType ( ) == TokenDirectiveType . FIELD ) { Field field = ( Field ) token . getAlternativeValue ( ) ; if ( Modifier . isStatic ( field . getModifiers ( ) ) ) { value = ReflectionUtils . get... | Returns the bean instance that matches the given token . |
22,351 | protected Object getBeanProperty ( final Object object , String propertyName ) { Object value ; try { value = BeanUtils . getProperty ( object , propertyName ) ; } catch ( InvocationTargetException e ) { value = null ; } return value ; } | Invoke bean s property . |
22,352 | protected Object getProperty ( Token token ) throws IOException { if ( token . getDirectiveType ( ) == TokenDirectiveType . CLASSPATH ) { Properties props = PropertiesLoaderUtils . loadProperties ( token . getValue ( ) , activity . getEnvironment ( ) . getClassLoader ( ) ) ; Object value = ( token . getGetterName ( ) !... | Returns an Environment variable that matches the given token . |
22,353 | protected String getTemplate ( Token token ) { TemplateRenderer templateRenderer = activity . getActivityContext ( ) . getTemplateRenderer ( ) ; StringWriter writer = new StringWriter ( ) ; templateRenderer . render ( token . getName ( ) , activity , writer ) ; String result = writer . toString ( ) ; return ( result !=... | Executes template returns the generated output . |
22,354 | public String stringify ( ) { if ( type == TokenType . TEXT ) { return defaultValue ; } StringBuilder sb = new StringBuilder ( ) ; if ( type == TokenType . BEAN ) { sb . append ( BEAN_SYMBOL ) ; sb . append ( START_BRACKET ) ; if ( name != null ) { sb . append ( name ) ; } if ( value != null ) { sb . append ( VALUE_SEP... | Convert a Token object into a string . |
22,355 | public static boolean isTokenSymbol ( char c ) { return ( c == BEAN_SYMBOL || c == TEMPLATE_SYMBOL || c == PARAMETER_SYMBOL || c == ATTRIBUTE_SYMBOL || c == PROPERTY_SYMBOL ) ; } | Returns whether a specified character is the token symbol . |
22,356 | public static TokenType resolveTypeAsSymbol ( char symbol ) { TokenType type ; if ( symbol == Token . BEAN_SYMBOL ) { type = TokenType . BEAN ; } else if ( symbol == Token . TEMPLATE_SYMBOL ) { type = TokenType . TEMPLATE ; } else if ( symbol == Token . PARAMETER_SYMBOL ) { type = TokenType . PARAMETER ; } else if ( sy... | Returns the token type for the specified character . |
22,357 | public void setTransformType ( TransformType transformType ) { this . transformType = transformType ; if ( contentType == null && transformType != null ) { if ( transformType == TransformType . TEXT ) { contentType = ContentType . TEXT_PLAIN . toString ( ) ; } else if ( transformType == TransformType . JSON ) { content... | Sets the transform type . |
22,358 | public void setTemplateRule ( TemplateRule templateRule ) { this . templateRule = templateRule ; if ( templateRule != null ) { if ( this . transformType == null ) { setTransformType ( TransformType . TEXT ) ; } if ( templateRule . getEncoding ( ) != null && this . encoding == null ) { this . encoding = templateRule . g... | Sets the template rule . |
22,359 | public void setResultValue ( String actionId , Object resultValue ) { if ( actionId == null || ! actionId . contains ( ActivityContext . ID_SEPARATOR ) ) { this . actionId = actionId ; this . resultValue = resultValue ; } else { String [ ] ids = StringUtils . tokenize ( actionId , ActivityContext . ID_SEPARATOR , true ... | Sets the result value of the action . |
22,360 | public static URL getResource ( String resource , ClassLoader classLoader ) throws IOException { URL url = null ; if ( classLoader != null ) { url = classLoader . getResource ( resource ) ; } if ( url == null ) { url = ClassLoader . getSystemResource ( resource ) ; } if ( url == null ) { throw new IOException ( "Could ... | Returns the URL of the resource on the classpath . |
22,361 | public static Reader getReader ( final File file , String encoding ) throws IOException { InputStream stream ; try { stream = AccessController . doPrivileged ( new PrivilegedExceptionAction < InputStream > ( ) { public InputStream run ( ) throws IOException { return new FileInputStream ( file ) ; } } ) ; } catch ( Priv... | Returns a Reader for reading the specified file . |
22,362 | public static Reader getReader ( final URL url , String encoding ) throws IOException { InputStream stream ; try { stream = AccessController . doPrivileged ( new PrivilegedExceptionAction < InputStream > ( ) { public InputStream run ( ) throws IOException { InputStream is = null ; if ( url != null ) { URLConnection con... | Returns a Reader for reading the specified url . |
22,363 | public static String read ( File file , String encoding ) throws IOException { Reader reader = getReader ( file , encoding ) ; String source ; try { source = read ( reader ) ; } finally { reader . close ( ) ; } return source ; } | Returns a string from the specified file . |
22,364 | public static String read ( URL url , String encoding ) throws IOException { Reader reader = getReader ( url , encoding ) ; String source ; try { source = read ( reader ) ; } finally { reader . close ( ) ; } return source ; } | Returns a string from the specified url . |
22,365 | public static String read ( Reader reader ) throws IOException { final char [ ] buffer = new char [ 1024 ] ; StringBuilder sb = new StringBuilder ( ) ; int len ; while ( ( len = reader . read ( buffer ) ) != - 1 ) { sb . append ( buffer , 0 , len ) ; } return sb . toString ( ) ; } | Returns a string from the specified Reader object . |
22,366 | private ViewDispatcher getViewDispatcher ( Activity activity ) throws ViewDispatcherException { if ( dispatchRule . getViewDispatcher ( ) != null ) { return dispatchRule . getViewDispatcher ( ) ; } try { String dispatcherName ; if ( dispatchRule . getDispatcherName ( ) != null ) { dispatcherName = dispatchRule . getDis... | Determine the view dispatcher . |
22,367 | public static void fetchAttributes ( RequestAdapter requestAdapter , ProcessResult processResult ) { if ( processResult != null ) { for ( ContentResult contentResult : processResult ) { for ( ActionResult actionResult : contentResult ) { Object actionResultValue = actionResult . getResultValue ( ) ; if ( actionResultVa... | Stores an attribute in request . |
22,368 | public void excludePackage ( String ... packageNames ) { if ( packageNames == null ) { excludePackageNames = null ; } else { for ( String packageName : packageNames ) { if ( excludePackageNames == null ) { excludePackageNames = new HashSet < > ( ) ; } excludePackageNames . add ( packageName + PACKAGE_SEPARATOR_CHAR ) ;... | Adds packages that this ClassLoader should not handle . Any class whose fully - qualified name starts with the name registered here will be handled by the parent ClassLoader in the usual fashion . |
22,369 | public void excludeClass ( String ... classNames ) { if ( classNames == null ) { excludeClassNames = null ; } else { for ( String className : classNames ) { if ( ! isExcludePackage ( className ) ) { if ( excludeClassNames == null ) { excludeClassNames = new HashSet < > ( ) ; } excludeClassNames . add ( className ) ; } ... | Adds classes that this ClassLoader should not handle . Any class whose fully - qualified name starts with the name registered here will be handled by the parent ClassLoader in the usual fashion . |
22,370 | public void open ( ) { if ( sqlSession == null ) { if ( executorType == null ) { executorType = ExecutorType . SIMPLE ; } sqlSession = sqlSessionFactory . openSession ( executorType , autoCommit ) ; if ( log . isDebugEnabled ( ) ) { ToStringBuilder tsb = new ToStringBuilder ( String . format ( "%s %s@%x" , ( arbitraril... | Opens a new SqlSession and store its instance inside . Therefore whenever there is a request for a SqlSessionTxAdvice bean a new bean instance of the object must be created . |
22,371 | public void commit ( boolean force ) { if ( checkSession ( ) ) { return ; } if ( log . isDebugEnabled ( ) ) { ToStringBuilder tsb = new ToStringBuilder ( String . format ( "Committing transactional %s@%x" , sqlSession . getClass ( ) . getSimpleName ( ) , sqlSession . hashCode ( ) ) ) ; tsb . append ( "force" , force ) ... | Flushes batch statements and commits database connection . |
22,372 | public void close ( boolean arbitrarily ) { if ( checkSession ( ) ) { return ; } arbitrarilyClosed = arbitrarily ; sqlSession . close ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Closed %s@%x" , sqlSession . getClass ( ) . getSimpleName ( ) , sqlSession . hashCode ( ) ) ) ; } sqlSession = nu... | Closes the session arbitrarily . If the transaction advice does not finally close the session the session will automatically reopen whenever necessary . |
22,373 | public void ifExceptionThrow ( ) throws Exception { if ( nested == null || nested . isEmpty ( ) ) { return ; } if ( nested . size ( ) == 1 ) { Throwable th = nested . get ( 0 ) ; if ( th instanceof Error ) { throw ( Error ) th ; } if ( th instanceof Exception ) { throw ( Exception ) th ; } } throw this ; } | Throw a MultiException . If this multi exception is empty then no action is taken . If it contains a single exception that is thrown otherwise the this multi exception is thrown . |
22,374 | public void ifExceptionThrowRuntime ( ) throws Error { if ( nested == null || nested . isEmpty ( ) ) { return ; } if ( nested . size ( ) == 1 ) { Throwable th = nested . get ( 0 ) ; if ( th instanceof Error ) { throw ( Error ) th ; } else if ( th instanceof RuntimeException ) { throw ( RuntimeException ) th ; } else { ... | Throw a Runtime exception . If this multi exception is empty then no action is taken . If it contains a single error or runtime exception that is thrown otherwise the this multi exception is thrown wrapped in a runtime exception . |
22,375 | public void printHelp ( Command command ) { if ( command . getDescriptor ( ) . getUsage ( ) != null ) { printUsage ( command . getDescriptor ( ) . getUsage ( ) ) ; } else { printUsage ( command ) ; } int leftWidth = printOptions ( command . getOptions ( ) ) ; printArguments ( command . getArgumentsList ( ) , leftWidth ... | Print the help with the given Command object . |
22,376 | public void printUsage ( Command command ) { String commandName = command . getDescriptor ( ) . getName ( ) ; StringBuilder sb = new StringBuilder ( getSyntaxPrefix ( ) ) . append ( commandName ) . append ( " " ) ; Collection < OptionGroup > processedGroups = new ArrayList < > ( ) ; Collection < Option > optList = comm... | Prints the usage statement for the specified command . |
22,377 | private void appendOptionGroup ( StringBuilder sb , OptionGroup group ) { if ( ! group . isRequired ( ) ) { sb . append ( OPTIONAL_BRACKET_OPEN ) ; } List < Option > optList = new ArrayList < > ( group . getOptions ( ) ) ; if ( optList . size ( ) > 1 && getOptionComparator ( ) != null ) { optList . sort ( getOptionComp... | Appends the usage clause for an OptionGroup to a StringBuilder . The clause is wrapped in square brackets if the group is required . The display of the options is handled by appendOption . |
22,378 | public ItemRule newArgumentItemRule ( String argumentName ) { ItemRule itemRule = new ItemRule ( ) ; itemRule . setName ( argumentName ) ; addArgumentItemRule ( itemRule ) ; return itemRule ; } | Adds a new argument rule with the specified name and returns it . |
22,379 | public void addArgumentItemRule ( ItemRule argumentItemRule ) { if ( argumentItemRuleMap == null ) { argumentItemRuleMap = new ItemRuleMap ( ) ; } argumentItemRuleMap . putItemRule ( argumentItemRule ) ; } | Adds the argument item rule . |
22,380 | public static BeanMethodActionRule newInstance ( String id , String beanId , String methodName , Boolean hidden ) throws IllegalRuleException { if ( methodName == null ) { throw new IllegalRuleException ( "The 'action' element requires an 'method' attribute" ) ; } BeanMethodActionRule beanMethodActionRule = new BeanMet... | Returns a new instance of BeanActionRule . |
22,381 | public void setAll ( Map < String , String > params ) { for ( Map . Entry < String , String > entry : params . entrySet ( ) ) { setParameter ( entry . getKey ( ) , entry . getValue ( ) ) ; } } | Set the given parameters under . |
22,382 | public Object getParameterWithoutCache ( String name ) { if ( activity . getRequestAdapter ( ) != null ) { String [ ] values = activity . getRequestAdapter ( ) . getParameterValues ( name ) ; if ( values != null ) { if ( values . length == 1 ) { return values [ 0 ] ; } else { return values ; } } } return null ; } | Returns the value of the request parameter from the request adapter without storing it in the cache . If the parameter does not exist returns null . |
22,383 | public Object getAttributeWithoutCache ( String name ) { if ( activity . getRequestAdapter ( ) != null ) { return activity . getRequestAdapter ( ) . getAttribute ( name ) ; } else { return null ; } } | Returns the value of the named attribute from the request adapter without storing it in the cache . If no attribute of the given name exists returns null . |
22,384 | public Object getActionResultWithoutCache ( String name ) { if ( activity . getProcessResult ( ) != null ) { return activity . getProcessResult ( ) . getResultValue ( name ) ; } else { return null ; } } | Returns the value of the named action s process result without storing it in the cache . If no process result of the given name exists returns null . |
22,385 | public Object getSessionAttributeWithoutCache ( String name ) { if ( activity . getSessionAdapter ( ) != null ) { return activity . getSessionAdapter ( ) . getAttribute ( name ) ; } else { return null ; } } | Returns the value of the named attribute from the session adapter without storing it in the cache . If no attribute of the given name exists returns null . |
22,386 | public Session get ( String id ) throws Exception { Session session ; Exception ex = null ; while ( true ) { session = doGet ( id ) ; if ( sessionDataStore == null ) { break ; } if ( session == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Session " + id + " not found locally, attempting to load" ) ; } Plac... | Get a session object . If the session object is not in this session store try getting the data for it from a SessionDataStore associated with the session manager . |
22,387 | private Session loadSession ( String id ) throws Exception { if ( sessionDataStore == null ) { return null ; } try { SessionData data = sessionDataStore . load ( id ) ; if ( data == null ) { return null ; } return newSession ( data ) ; } catch ( UnreadableSessionDataException e ) { if ( isRemoveUnloadableSessions ( ) )... | Load the info for the session from the session data store . |
22,388 | public void put ( String id , Session session ) throws Exception { if ( id == null || session == null ) { throw new IllegalArgumentException ( "Put key=" + id + " session=" + ( session == null ? "null" : session . getId ( ) ) ) ; } try ( Lock ignored = session . lock ( ) ) { if ( ! session . isValid ( ) ) { return ; } ... | Put the Session object back into the session store . |
22,389 | public boolean exists ( String id ) throws Exception { Session s = doGet ( id ) ; if ( s != null ) { try ( Lock ignored = s . lock ( ) ) { return s . isValid ( ) ; } } return ( sessionDataStore != null && sessionDataStore . exists ( id ) ) ; } | Check to see if a session corresponding to the id exists . |
22,390 | public Session delete ( String id ) throws Exception { Session session = get ( id ) ; if ( sessionDataStore != null ) { boolean deleted = sessionDataStore . delete ( id ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Session " + id + " deleted in db: " + deleted ) ; } } if ( session != null ) { session . stopInact... | Remove a session object from this store and from any backing store . |
22,391 | public void checkInactiveSession ( Session session ) { if ( session == null ) { return ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Checking for idle " + session . getId ( ) ) ; } try ( Lock ignored = session . lock ( ) ) { if ( getEvictionPolicy ( ) > 0 && session . isIdleLongerThan ( getEvictionPolicy ( ) ) &... | Check a session for being inactive and thus being able to be evicted if eviction is enabled . |
22,392 | public PebbleEngine createPebbleEngine ( ) { PebbleEngine . Builder builder = new PebbleEngine . Builder ( ) ; builder . strictVariables ( strictVariables ) ; if ( defaultLocale != null ) { builder . defaultLocale ( defaultLocale ) ; } if ( templateLoaders == null ) { if ( templateLoaderPaths != null && templateLoaderP... | Creates a PebbleEngine instance . |
22,393 | protected Loader < ? > getAggregateTemplateLoader ( Loader < ? > [ ] templateLoaders ) { int loaderCount = ( templateLoaders == null ) ? 0 : templateLoaders . length ; switch ( loaderCount ) { case 0 : Loader < ? > stringLoader = new StringLoader ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Pebble Engine Temp... | Return a Template Loader based on the given Template Loader list . If more than one Template Loader has been registered a DelegatingLoader needs to be created . |
22,394 | protected Loader < ? > getTemplateLoaderForPath ( String templateLoaderPath ) { if ( templateLoaderPath . startsWith ( ResourceUtils . CLASSPATH_URL_PREFIX ) ) { String basePackagePath = templateLoaderPath . substring ( ResourceUtils . CLASSPATH_URL_PREFIX . length ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ... | Determine a Pebble Engine Template Loader for the given path . |
22,395 | public String newSessionId ( long seedTerm ) { synchronized ( random ) { long r0 ; if ( weakRandom ) { r0 = hashCode ( ) ^ Runtime . getRuntime ( ) . freeMemory ( ) ^ random . nextInt ( ) ^ ( seedTerm << 32 ) ; } else { r0 = random . nextLong ( ) ; } if ( r0 < 0 ) { r0 = - r0 ; } long r1 ; if ( weakRandom ) { r1 = hash... | Returns a new unique session id . |
22,396 | private void initRandom ( ) { try { random = new SecureRandom ( ) ; } catch ( Exception e ) { log . warn ( "Could not generate SecureRandom for session-id randomness" , e ) ; random = new Random ( ) ; weakRandom = true ; } } | Set up a random number generator for the sessionids . |
22,397 | public void write ( Parameters parameters ) throws IOException { if ( parameters != null ) { for ( Parameter pv : parameters . getParameterValueMap ( ) . values ( ) ) { if ( pv . isAssigned ( ) ) { write ( pv ) ; } } } } | Write a Parameters object to the character - output stream . |
22,398 | public void comment ( String message ) throws IOException { if ( message . indexOf ( NEW_LINE_CHAR ) != - 1 ) { String line ; int start = 0 ; while ( ( line = readLine ( message , start ) ) != null ) { writer . write ( COMMENT_LINE_START ) ; writer . write ( SPACE_CHAR ) ; writer . write ( line ) ; newLine ( ) ; start ... | Writes a comment to the character - output stream . |
22,399 | public static String stringify ( Parameters parameters , String indentString ) { if ( parameters == null ) { return null ; } try { Writer writer = new StringWriter ( ) ; AponWriter aponWriter = new AponWriter ( writer ) ; aponWriter . setIndentString ( indentString ) ; aponWriter . write ( parameters ) ; aponWriter . c... | Converts a Parameters object to an APON formatted string . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.