idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
9,600 | public InputSource resolveEntity ( String publicID , String systemID ) throws SAXException , IOException { InputSource localFileInput = resolveLocalEntity ( systemID ) ; return localFileInput != null ? localFileInput : new InputSource ( systemID ) ; } | Resolve the entity . First try to find it locally then fallback to the network . |
9,601 | public InputSource resolveLocalEntity ( String systemID ) throws SAXException , IOException { String localFileName = systemID ; int fileNameStart = localFileName . lastIndexOf ( '/' ) + 1 ; if ( fileNameStart < localFileName . length ( ) ) { localFileName = systemID . substring ( fileNameStart ) ; } ClassLoader cl = LocalFileEntityResolver . class . getClassLoader ( ) ; InputStream stream = cl . getResourceAsStream ( RESORUCE_PATH_PREFIX + localFileName ) ; if ( stream != null ) { return new InputSource ( stream ) ; } return null ; } | Resolve the given entity locally . |
9,602 | public static AsyncHttpClient createClient ( Configuration configuration , int numberOfHostsBeingConnectedTo ) { AsyncHttpClientConfig . Builder cf = createClientConfig ( configuration ) ; cf . setMaximumConnectionsTotal ( - 1 ) ; cf . setMaximumConnectionsPerHost ( - 1 ) ; cf . setExecutorService ( getExecutorService ( numberOfHostsBeingConnectedTo ) ) ; return createClient ( cf ) ; } | Creates a AsyncHttpClient object that can be used for talking to elasticsearch |
9,603 | protected String getPreparedStatementText ( ControlBeanContext context , Method m , Object [ ] args ) { Object val = getParameterValue ( context , m , args ) ; if ( val instanceof JdbcControl . ComplexSqlFragment ) { return ( ( JdbcControl . ComplexSqlFragment ) val ) . getSQL ( ) ; } else { return PREPARED_STATEMENT_SUB_MARK ; } } | Return text generated by this fragment for a PreparedStatement |
9,604 | protected boolean hasComplexValue ( ControlBeanContext context , Method m , Object [ ] args ) { Object val = getParameterValue ( context , m , args ) ; return val instanceof JdbcControl . ComplexSqlFragment ; } | A reflection fragment may evaluate to an JdbcControl . ComplexSqlFragment type which requires additional steps to evaluate after reflection . |
9,605 | protected String [ ] getParameterNameQualifiers ( ) { String [ ] nameQualifiersCopy = new String [ _nameQualifiers . length ] ; System . arraycopy ( _nameQualifiers , 0 , nameQualifiersCopy , 0 , _nameQualifiers . length ) ; return nameQualifiersCopy ; } | Get a copy of the array of parameter name qualifiers . |
9,606 | protected Object [ ] getParameterValues ( ControlBeanContext context , Method method , Object [ ] args ) { Object value = getParameterValue ( context , method , args ) ; if ( value instanceof JdbcControl . ComplexSqlFragment ) { JdbcControl . SQLParameter [ ] params = ( ( JdbcControl . ComplexSqlFragment ) value ) . getParameters ( ) ; Object [ ] values = new Object [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { values [ i ] = params [ i ] . value ; } return values ; } return new Object [ ] { value } ; } | Get the value of this parameter . |
9,607 | private Object getParameterValue ( ControlBeanContext context , Method method , Object [ ] args ) { Object value ; try { value = context . getParameterValue ( method , _nameQualifiers [ 0 ] , args ) ; } catch ( IllegalArgumentException iae ) { throw new ControlException ( "Invalid argument name in SQL statement: " + _nameQualifiers [ 0 ] , iae ) ; } for ( int i = 1 ; i < _nameQualifiers . length ; i ++ ) { value = extractValue ( value , _nameQualifiers [ i - 1 ] , _nameQualifiers [ i ] ) ; } return value ; } | Get the value from the method param . |
9,608 | private Object extractValue ( Object aValue , String aName , String bName ) { Class aClass = aValue . getClass ( ) ; Object value ; String bNameCapped = Character . toUpperCase ( bName . charAt ( 0 ) ) + bName . substring ( 1 ) ; Method getMethod = null ; Class retType ; try { getMethod = aClass . getMethod ( "is" + bNameCapped , ( Class [ ] ) null ) ; retType = getMethod . getReturnType ( ) ; if ( ! ( retType . equals ( Boolean . class ) || retType . equals ( Boolean . TYPE ) ) ) { getMethod = null ; } else { boolean getMethodFound = true ; try { aClass . getMethod ( "get" + bNameCapped , ( Class [ ] ) null ) ; } catch ( NoSuchMethodException e ) { getMethodFound = false ; } if ( getMethodFound ) { throw new ControlException ( "Colliding field accsessors in user defined class '" + aClass . getName ( ) + "' for field '" + bName + "'. Please use is<FieldName> for boolean fields and get<FieldName> name for other datatypes." ) ; } } } catch ( NoSuchMethodException e ) { } if ( getMethod == null ) { try { getMethod = aClass . getMethod ( "get" + bNameCapped , ( Class [ ] ) null ) ; } catch ( NoSuchMethodException e ) { } } if ( getMethod != null ) { try { value = getMethod . invoke ( aValue , ( Object [ ] ) null ) ; } catch ( IllegalAccessException e ) { throw new ControlException ( "Unable to access public method: " + e . toString ( ) ) ; } catch ( java . lang . reflect . InvocationTargetException e ) { throw new ControlException ( "Exception thrown when executing : " + getMethod . getName ( ) + "() to use as parameter" ) ; } return value ; } try { value = aClass . getField ( bName ) . get ( aValue ) ; return value ; } catch ( NoSuchFieldException e ) { } catch ( IllegalAccessException e ) { } if ( aValue instanceof Map ) { try { value = TypeMappingsFactory . getInstance ( ) . lookupType ( aValue , new Object [ ] { bName } ) ; return value ; } catch ( Exception mapex ) { throw new ControlException ( "Exception thrown when executing Map.get() to resolve parameter" + mapex . toString ( ) ) ; } } throw new ControlException ( "Illegal argument in SQL statement: " + _parameterName + "; unable to find suitable method of retrieving property " + bName + " out of object " + aName + "." ) ; } | Get the value from the referenced method parameter using java reflection |
9,609 | protected boolean isPrivateMethod ( MethodDeclaration md ) { Collection < Modifier > modifiers = md . getModifiers ( ) ; for ( Modifier m : modifiers ) { if ( m . compareTo ( Modifier . PRIVATE ) == 0 ) return true ; } return false ; } | Checks a MethodDeclaration for a private modifier . |
9,610 | private String getFormalTypeParameters ( boolean namesOnly ) { Collection < TypeParameterDeclaration > ftColl = _typeDecl . getFormalTypeParameters ( ) ; if ( ftColl . size ( ) == 0 ) return "" ; StringBuffer sb = new StringBuffer ( "<" ) ; boolean isFirst = true ; for ( TypeParameterDeclaration tpDecl : ftColl ) { if ( ! isFirst ) sb . append ( "," ) ; else isFirst = false ; if ( namesOnly ) sb . append ( tpDecl . getSimpleName ( ) ) ; else sb . append ( tpDecl . toString ( ) ) ; } sb . append ( ">" ) ; return sb . toString ( ) ; } | Helper method to return type parameter information |
9,611 | public boolean removeDataAttribute ( DataAttribute attribute ) throws LockingException { if ( isFieldLocked ( EntryField . DATA ) ) { if ( dataUsage . containsKey ( attribute ) ) { throw new LockingException ( EntryField . DATA ) ; } return false ; } else { return dataUsage . remove ( attribute ) != null ; } } | Removes the given attribute from the set of managed attributes . |
9,612 | public boolean setDataUsage ( Map < DataAttribute , Set < DataUsage > > dataUsage ) throws ParameterException , LockingException { Validate . notNull ( dataUsage ) ; Validate . notEmpty ( dataUsage . keySet ( ) ) ; Validate . noNullElements ( dataUsage . keySet ( ) ) ; Validate . noNullElements ( dataUsage . values ( ) ) ; if ( isFieldLocked ( EntryField . DATA ) ) { if ( ! this . dataUsage . equals ( dataUsage ) ) { throw new LockingException ( EntryField . DATA ) ; } return false ; } else { this . dataUsage = dataUsage ; return true ; } } | Sets the given data usage as data usage for this entry . |
9,613 | public boolean setDataUsageFor ( DataAttribute attribute , Set < DataUsage > dataUsage ) throws ParameterException , LockingException { Validate . notNull ( attribute ) ; Validate . notNull ( dataUsage ) ; Validate . notEmpty ( dataUsage ) ; if ( isFieldLocked ( EntryField . DATA ) ) { if ( ! ( this . dataUsage . containsKey ( attribute ) && this . dataUsage . get ( attribute ) . equals ( dataUsage ) ) ) { throw new LockingException ( EntryField . DATA ) ; } return false ; } else { this . dataUsage . put ( attribute , dataUsage ) ; return true ; } } | Sets the data usage for a given attribute . |
9,614 | public boolean addDataUsage ( DataAttribute attribute , DataUsage usage ) throws ParameterException , LockingException { Validate . notNull ( attribute ) ; if ( isFieldLocked ( EntryField . DATA ) ) { if ( ! dataUsage . containsKey ( attribute ) ) { throw new LockingException ( EntryField . DATA ) ; } return false ; } else { if ( dataUsage . get ( attribute ) == null ) { dataUsage . put ( attribute , new HashSet < > ( ) ) ; } if ( usage != null ) { dataUsage . get ( attribute ) . add ( usage ) ; } return true ; } } | Adds the given attribute to the list of attributes |
9,615 | public void add ( T method ) { if ( isOverrideMethod ( method ) ) { return ; } _methods . put ( method . getName ( ) + method . getArgTypes ( ) , method ) ; Object nameValue = _nameMap . get ( method . getName ( ) ) ; if ( nameValue == null ) { _nameMap . put ( method . getName ( ) , method ) ; } else { int nextIndex ; if ( nameValue instanceof AptMethod ) { ( ( AptMethod ) nameValue ) . setIndex ( 0 ) ; nextIndex = 1 ; } else { nextIndex = ( ( Integer ) nameValue ) . intValue ( ) ; } method . setIndex ( nextIndex ++ ) ; _nameMap . put ( method . getName ( ) , nextIndex ) ; } } | Adds a new method to the list . Also detects overloaded methods and ensures that they will receive a unique index value . |
9,616 | protected void setMapClass ( Class mapClass ) { if ( ControlBean . class . isAssignableFrom ( mapClass ) ) { Class [ ] intfs = mapClass . getInterfaces ( ) ; for ( int i = 0 ; i < intfs . length ; i ++ ) { if ( intfs [ i ] . isAnnotationPresent ( ControlInterface . class ) || intfs [ i ] . isAnnotationPresent ( ControlExtension . class ) ) { mapClass = intfs [ i ] ; break ; } } } else { if ( ! mapClass . isAnnotation ( ) && ! mapClass . isAnnotationPresent ( ControlInterface . class ) && ! mapClass . isAnnotationPresent ( ControlExtension . class ) ) throw new IllegalArgumentException ( mapClass + " must be Control or annotation type" ) ; } _mapClass = mapClass ; } | Sets the PropertySet or Control interface associated with this map . Only properties declared by the PropertySet or one of the PropertySets on the Control interface may be used with this map . |
9,617 | private boolean isCompatibleClass ( Class checkClass ) { if ( _mapClass . isAssignableFrom ( checkClass ) ) return true ; if ( checkClass . isAnnotationPresent ( PropertySet . class ) ) { Class declaringClass = checkClass . getDeclaringClass ( ) ; if ( declaringClass == null ) return true ; if ( declaringClass . isAssignableFrom ( _mapClass ) ) return true ; } if ( _mapClass . isAnnotationPresent ( PropertySet . class ) ) { Class declaringClass = _mapClass . getDeclaringClass ( ) ; if ( declaringClass != null && declaringClass . isAssignableFrom ( checkClass ) ) return true ; if ( declaringClass == null ) { ExternalPropertySets eps = ( ExternalPropertySets ) checkClass . getAnnotation ( ExternalPropertySets . class ) ; if ( eps != null ) { Class [ ] propSets = eps . value ( ) ; if ( propSets != null ) { for ( Class ps : propSets ) { if ( _mapClass . equals ( ps ) ) return true ; } } } } } return false ; } | Checks to see if the provided class is a control or property set interface that is compatible with the local PropertyMap . |
9,618 | public synchronized void setDelegateMap ( PropertyMap delegateMap ) { if ( ! isCompatibleClass ( delegateMap . getMapClass ( ) ) ) throw new IllegalArgumentException ( "The delegate map type (" + delegateMap . getMapClass ( ) + " is an incompatible type with " + _mapClass ) ; _delegateMap = delegateMap ; } | Sets a delegate base property map from which values will be derived if not found within the local property map . |
9,619 | public boolean containsPropertySet ( Class < ? extends Annotation > propertySet ) { if ( _delegateMap != null ) return _delegateMap . containsPropertySet ( propertySet ) ; return false ; } | Returns true if the PropertyMap contains one or more values for the specified PropertySet false otherwise . |
9,620 | public < T extends Annotation > T getPropertySet ( Class < T > propertySet ) { if ( ! containsPropertySet ( propertySet ) ) return null ; return PropertySetProxy . getProxy ( propertySet , this ) ; } | Returns a PropertySet proxy instance that derives its data from the contents of the property map . Will return null if the PropertyMap does not contain any properties associated with the specified PropertySet . |
9,621 | public void setProperty ( String name , String value , int propertyIndex ) { additionalProperties [ propertyIndex ] . setName ( name ) ; additionalProperties [ propertyIndex ] . setValue ( value ) ; } | Sets the property at the given index to the given name and value . |
9,622 | public synchronized boolean hasService ( Class serviceClass ) { ServiceProvider sp = _serviceProviders . get ( serviceClass ) ; if ( sp != null && ! sp . isRevoked ( ) ) { return true ; } BeanContext bc = getBeanContext ( ) ; if ( bc instanceof BeanContextServices ) { return ( ( BeanContextServices ) bc ) . hasService ( serviceClass ) ; } return false ; } | Reports whether or not a given service is currently available from this context . |
9,623 | public Iterator getCurrentServiceClasses ( ) { ArrayList < Class > currentClasses = new ArrayList < Class > ( ) ; for ( Class serviceClass : _serviceProviders . keySet ( ) ) { ServiceProvider sp = _serviceProviders . get ( serviceClass ) ; if ( ! sp . isRevoked ( ) && ! sp . isDelegated ( ) ) { currentClasses . add ( serviceClass ) ; } } return currentClasses . iterator ( ) ; } | Gets the currently available services for this context . |
9,624 | protected synchronized void releaseBeanContextResources ( ) { for ( Class serviceClass : _serviceProviders . keySet ( ) ) { ServiceProvider sp = _serviceProviders . get ( serviceClass ) ; if ( sp . isDelegated ( ) ) { sp . revoke ( new BeanContextServiceRevokedEvent ( ( BeanContextServices ) getPeer ( ) , serviceClass , true ) ) ; } } } | Invoked when all resources obtained from the current nested bean context need to be released . For BeanContextServices this means revoke any services obtained from a delegate services provider . Typically invoked when the parent context is changed . |
9,625 | protected void initialize ( ) { super . initialize ( ) ; _serviceProviders = Collections . synchronizedMap ( new HashMap < Class , ServiceProvider > ( ) ) ; _bcsListeners = Collections . synchronizedList ( new ArrayList < BeanContextServicesListener > ( ) ) ; } | Initialize data structures . |
9,626 | private Class findServiceClass ( Object service ) { for ( Class sc : _serviceProviders . keySet ( ) ) { if ( sc . isInstance ( service ) ) { return sc ; } } throw new IllegalArgumentException ( "Cannot find service provider for: " + service . getClass ( ) . getCanonicalName ( ) ) ; } | Try to find the registered service for a service object instance . May return null if the object instance is not from a service registered with this service provider . |
9,627 | private synchronized void readObject ( ObjectInputStream ois ) throws IOException , ClassNotFoundException { ois . defaultReadObject ( ) ; int svcsSize = ois . readInt ( ) ; for ( int i = 0 ; i < svcsSize ; i ++ ) { _serviceProviders . put ( ( Class ) ois . readObject ( ) , ( ServiceProvider ) ois . readObject ( ) ) ; } int listenersSize = ois . readInt ( ) ; for ( int i = 0 ; i < listenersSize ; i ++ ) { _bcsListeners . add ( ( BeanContextServicesListener ) ois . readObject ( ) ) ; } } | Deserialization support . |
9,628 | private synchronized void writeObject ( ObjectOutputStream oos ) throws IOException { int serializable = 0 ; oos . defaultWriteObject ( ) ; Set < Map . Entry < Class , ServiceProvider > > providers = _serviceProviders . entrySet ( ) ; for ( Map . Entry < Class , ServiceProvider > provider : providers ) { if ( provider . getValue ( ) . isSerializable ( ) ) { serializable ++ ; } } oos . writeInt ( serializable ) ; if ( serializable > 0 ) { for ( Map . Entry < Class , ServiceProvider > entry : providers ) { if ( entry . getValue ( ) . isSerializable ( ) ) { oos . writeObject ( entry . getKey ( ) ) ; oos . writeObject ( entry . getValue ( ) ) ; } } } serializable = 0 ; for ( BeanContextServicesListener l : _bcsListeners ) { if ( l instanceof Serializable ) { serializable ++ ; } } oos . writeInt ( serializable ) ; if ( serializable > 0 ) { for ( BeanContextServicesListener l : _bcsListeners ) { if ( l instanceof Serializable ) { oos . writeObject ( l ) ; } } } } | Serialize this instance including any serializable services and BeanContextServicesListeners . Any services or listeners which are not Serializable will not be present once deserialized . |
9,629 | public boolean isMatched ( String value , Boolean defaultValue ) { if ( value == null ) return false ; if ( _match != null ) { for ( int i = 0 ; i < _match . length ; i ++ ) { if ( value . equals ( _match [ i ] ) ) return true ; } } else { if ( defaultValue != null ) return defaultValue . booleanValue ( ) ; if ( _defaultSingleton ) return _defaultSingleValue ; if ( _defaultSelections != null ) return _defaultSelections . contains ( value ) ; } return false ; } | Checks whether the given value matches one of the CheckBoxGroup s selected CheckBoxOptions . |
9,630 | public int doStartTag ( ) throws JspException { ServletRequest req = pageContext . getRequest ( ) ; if ( _cr == null ) _cr = TagRenderingBase . Factory . getConstantRendering ( req ) ; Object val = evaluateDataSource ( ) ; _defaultSelections = ( List ) evaluateDefaultValue ( ) ; if ( hasErrors ( ) ) { return SKIP_BODY ; } if ( val != null ) { buildMatch ( val ) ; if ( hasErrors ( ) ) { return SKIP_BODY ; } } _writer = new WriteRenderAppender ( pageContext ) ; if ( ! _repeater && ! _disabled ) { _state . clear ( ) ; String hiddenParamName = null ; hiddenParamName = getQualifiedDataSourceName ( ) + OLDVALUE_SUFFIX ; _state . name = hiddenParamName ; _state . value = "true" ; TagRenderingBase hiddenTag = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_HIDDEN_TAG , req ) ; hiddenTag . doStartTag ( _writer , _state ) ; hiddenTag . doEndTag ( _writer ) ; } if ( isVertical ( ) ) _cr . TABLE ( _writer ) ; _dynamicAttrs = evaluateOptionsDataSource ( ) ; assert ( _dynamicAttrs != null ) ; assert ( _dynamicAttrs instanceof Map || _dynamicAttrs instanceof Iterator ) ; if ( _repeater ) { if ( _dynamicAttrs instanceof Map ) { _dynamicAttrs = ( ( Map ) _dynamicAttrs ) . entrySet ( ) . iterator ( ) ; } if ( ! ( _dynamicAttrs instanceof Iterator ) ) { String s = Bundle . getString ( "Tags_OptionsDSIteratorError" ) ; registerTagError ( s , null ) ; return SKIP_BODY ; } while ( ( ( Iterator ) _dynamicAttrs ) . hasNext ( ) ) { _repCurItem = ( ( Iterator ) _dynamicAttrs ) . next ( ) ; if ( _repCurItem != null ) break ; } if ( isVertical ( ) ) _cr . TR_TD ( _writer ) ; DataAccessProviderStack . addDataAccessProvider ( this , pageContext ) ; } _saveBody = new InternalStringBuilder ( 128 ) ; return EVAL_BODY_BUFFERED ; } | Determine the set of matches for the CheckBoxGroup |
9,631 | private void buildMatch ( Object val ) { if ( val instanceof String [ ] ) { _match = ( String [ ] ) val ; } else { Iterator matchIterator = null ; matchIterator = IteratorFactory . createIterator ( val ) ; if ( matchIterator == null ) matchIterator = IteratorFactory . EMPTY_ITERATOR ; List matchList = new ArrayList ( ) ; while ( matchIterator . hasNext ( ) ) { Object o = matchIterator . next ( ) ; if ( o != null ) matchList . add ( o . toString ( ) ) ; } int size = matchList . size ( ) ; _match = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { _match [ i ] = matchList . get ( i ) . toString ( ) ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "****** CheckboxGroup Matches ******" ) ; if ( _match != null ) { for ( int i = 0 ; i < _match . length ; i ++ ) { logger . debug ( i + ": " + _match [ i ] ) ; } } } } | This method will build the match list should this be a hashmap? |
9,632 | public String getClassDeclaration ( ) { StringBuffer sb = new StringBuffer ( _shortName ) ; sb . append ( _controlIntf . getFormalTypeParameters ( ) ) ; return sb . toString ( ) ; } | Returns the class declaration for the ControlBean |
9,633 | public String getSuperTypeBinding ( ) { InterfaceType superType = _controlIntf . getSuperType ( ) ; if ( superType != null ) { String typeStr = superType . toString ( ) ; int paramIndex = typeStr . indexOf ( '<' ) ; if ( paramIndex > 0 ) return typeStr . substring ( paramIndex ) ; } return "" ; } | Returns any formal type parameters that should be bound for the bean s superclass based upon any type bindings that occur on the original interface . |
9,634 | private int processDivPanel ( ) throws JspException { if ( ! _visible ) return EVAL_PAGE ; if ( hasErrors ( ) ) { reportErrors ( ) ; localRelease ( ) ; return EVAL_PAGE ; } BodyContent bc = getBodyContent ( ) ; String content = ( bc != null ) ? bc . getString ( ) : "" ; ResponseUtils . write ( pageContext , content ) ; ResponseUtils . write ( pageContext , "</div>" ) ; localRelease ( ) ; return EVAL_PAGE ; } | This method will process the section in the context of a DivPanel |
9,635 | private int processTemplate ( ) { ServletRequest req = pageContext . getRequest ( ) ; Template . TemplateContext tc = ( Template . TemplateContext ) req . getAttribute ( TEMPLATE_SECTIONS ) ; if ( tc . secs == null ) { tc . secs = new HashMap ( ) ; } assert ( tc . secs != null ) ; if ( ! _visible ) { tc . secs . put ( _name , "" ) ; localRelease ( ) ; return EVAL_PAGE ; } if ( hasErrors ( ) ) { String s = getErrorsReport ( ) ; tc . secs . put ( _name , s ) ; localRelease ( ) ; return EVAL_PAGE ; } BodyContent bc = getBodyContent ( ) ; String content = ( bc != null ) ? bc . getString ( ) : "" ; tc . secs . put ( _name , content ) ; localRelease ( ) ; return EVAL_PAGE ; } | This method will process the section in the context of the Template |
9,636 | public String getImageRoot ( ) { if ( _imageRoot != null ) return _imageRoot ; if ( _parent != null ) return _parent . getImageRoot ( ) ; return null ; } | Return the default location of all images . It is used as the location for the tree structure images . |
9,637 | private String getRealIconRoot ( ) { if ( _iconRoot != null ) return _iconRoot ; if ( _parent != null ) return _parent . getRealIconRoot ( ) ; return null ; } | This method will walk the inheritable state looking for an icon root . It returns null if not found . |
9,638 | public void initalizeTreeState ( ) { _lastNodeExpandedImage = IMAGE_NODE_EXPAND_LAST ; _nodeExpandedImage = IMAGE_NODE_EXPAND ; _lastNodeCollapsedImage = IMAGE_NODE_COLLAPSE_LAST ; _nodeCollapsedImage = IMAGE_NODE_COLLAPSE ; _lastLineJoinImage = IMAGE_LINE_JOIN_LAST ; _lineJoinImage = IMAGE_LINE_JOIN ; _verticalLineImage = IMAGE_LINE_VERTICAL ; _imageSpacer = IMAGE_SPACER ; _defaultIcon = DEFAULT_ICON ; _imageRoot = null ; _selectionAction = null ; _expansionAction = null ; } | This method initalizes the state of the properties to their default values used by the tree tag to create the tree markup . |
9,639 | public void register ( XExtension extension ) { extensionMap . put ( extension . getUri ( ) , extension ) ; int i = extensionList . indexOf ( extension ) ; if ( i < 0 ) { extensionList . add ( extension ) ; } else { extensionList . remove ( i ) ; extensionList . add ( i , extension ) ; } } | Explicitly registers an extension instance with the extension manager . |
9,640 | public XExtension getByUri ( URI uri ) { XExtension extension = extensionMap . get ( uri ) ; if ( extension == null ) { try { extension = XExtensionParser . instance ( ) . parse ( uri ) ; register ( extension ) ; XLogging . log ( "Imported XES extension '" + extension . getUri ( ) + "' from remote source" , XLogging . Importance . DEBUG ) ; } catch ( IOException e ) { } catch ( ParserConfigurationException | SAXException e ) { e . printStackTrace ( ) ; return null ; } cacheExtension ( uri ) ; } return extension ; } | Retrieves an extension instance by its unique URI . If the extension has not been registered before it is looked up in the local cache . If it cannot be found in the cache the manager attempts to download it from its unique URI and add it to the set of managed extensions . |
9,641 | protected final void registerStandardExtensions ( ) { register ( XConceptExtension . instance ( ) ) ; register ( XTimeExtension . instance ( ) ) ; register ( XLifecycleExtension . instance ( ) ) ; register ( XOrganizationalExtension . instance ( ) ) ; register ( XSemanticExtension . instance ( ) ) ; } | Registers all defined standard extensions with the extension manager before caching . |
9,642 | protected void cacheExtension ( URI uri ) { String uriStr = uri . toString ( ) . toLowerCase ( ) ; if ( uriStr . endsWith ( "/" ) ) { uriStr = uriStr . substring ( 0 , uriStr . length ( ) - 1 ) ; } String fileName = uriStr . substring ( uriStr . lastIndexOf ( '/' ) ) ; if ( fileName . endsWith ( ".xesext" ) == false ) { fileName += ".xesext" ; } File cacheFile = new File ( XRuntimeUtils . getExtensionCacheFolder ( ) . getAbsolutePath ( ) + File . separator + fileName ) ; if ( uri . toString ( ) . equals ( DATAUSAGE_EXTENSION_URI ) ) { InputStream in = XExtensionManager . class . getResourceAsStream ( DATAUSAGE_EXTENSION_LOCAL_PATH ) ; try { final Path targetPath = cacheFile . toPath ( ) ; Files . copy ( in , targetPath ) ; XLogging . log ( "Cached XES extension '" + uri + "'" , XLogging . Importance . DEBUG ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; } } else { try { byte [ ] buffer = new byte [ 1024 ] ; BufferedOutputStream bos ; try ( BufferedInputStream bis = new BufferedInputStream ( uri . toURL ( ) . openStream ( ) ) ) { cacheFile . createNewFile ( ) ; bos = new BufferedOutputStream ( new FileOutputStream ( cacheFile ) ) ; int read = bis . read ( buffer ) ; while ( read >= 0 ) { bos . write ( buffer , 0 , read ) ; read = bis . read ( buffer ) ; } } bos . flush ( ) ; bos . close ( ) ; XLogging . log ( "Cached XES extension '" + uri + "'" , XLogging . Importance . DEBUG ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } | Downloads and caches an extension from its remote definition file . The extension is subsequently placed in the local cache so that future loading is accelerated . |
9,643 | protected final void loadExtensionCache ( ) { long minModified = System . currentTimeMillis ( ) - MAX_CACHE_MILLIS ; File extFolder = XRuntimeUtils . getExtensionCacheFolder ( ) ; XExtension extension ; File [ ] extFiles = extFolder . listFiles ( ) ; if ( extFiles == null ) { XLogging . log ( "Extension caching disabled (Could not access cache directory)!" , XLogging . Importance . WARNING ) ; return ; } for ( File extFile : extFiles ) { if ( extFile . getName ( ) . toLowerCase ( ) . endsWith ( ".xesext" ) == false ) { continue ; } if ( extFile . lastModified ( ) < minModified ) { if ( extFile . delete ( ) == false ) { extFile . deleteOnExit ( ) ; } } else { try { extension = XExtensionParser . instance ( ) . parse ( extFile ) ; if ( extensionMap . containsKey ( ( extension ) . getUri ( ) ) == false ) { extensionMap . put ( extension . getUri ( ) , extension ) ; extensionList . add ( extension ) ; XLogging . log ( "Loaded XES extension '" + extension . getUri ( ) + "' from cache" , XLogging . Importance . DEBUG ) ; } else { XLogging . log ( "Skipping cached XES extension '" + extension . getUri ( ) + "' (already defined)" , XLogging . Importance . DEBUG ) ; } } catch ( IOException | ParserConfigurationException | SAXException e ) { e . printStackTrace ( ) ; } } } } | Loads all extensions stored in the local cache . Cached extensions which exceed the maximum caching age are discarded and downloaded freshly . |
9,644 | public Object get ( String name , PageFlowContextActivator activator ) { assert ( name != null ) : "Parameter 'name' must not be null" ; assert ( activator != null ) : "Parameter 'activator' must not be null" ; Object ret = _contexts . get ( name ) ; if ( ret == null ) { ret = activator . activate ( ) ; _contexts . put ( name , ret ) ; } return ret ; } | This method will lookup a named object and return it . The object is looked up by name . If the object doesn t exist the activator object is called to create a new instance of the object before it is returned . |
9,645 | private void checkConditionalForwardsExpressions ( ClassDeclaration jclass ) throws FatalCompileTimeException { List simpleActions = CompilerUtils . getAnnotationArrayValue ( jclass , CONTROLLER_TAG_NAME , SIMPLE_ACTIONS_ATTR , true ) ; if ( simpleActions != null ) { HashSet expressionsFound = new HashSet ( ) ; for ( Iterator j = simpleActions . iterator ( ) ; j . hasNext ( ) ; ) { AnnotationInstance sa = ( AnnotationInstance ) j . next ( ) ; List conditionalForwards = CompilerUtils . getAnnotationArray ( sa , CONDITIONAL_FORWARDS_ATTR , true ) ; if ( conditionalForwards != null ) { for ( Iterator k = conditionalForwards . iterator ( ) ; k . hasNext ( ) ; ) { AnnotationInstance cf = ( AnnotationInstance ) k . next ( ) ; String expression = CompilerUtils . getString ( cf , CONDITION_ATTR , true ) ; assert expression != null ; if ( expressionsFound . contains ( expression ) ) { String name = CompilerUtils . getString ( sa , NAME_ATTR , true ) ; getDiagnostics ( ) . addWarning ( cf , "warning.duplicate-conditional-forward-expression" , expression , name ) ; } else { expressionsFound . add ( expression ) ; } } } expressionsFound . clear ( ) ; } } } | Check for duplicate expressions in conditional forwards of the simple action annotations . |
9,646 | public ActionForm getFirstOutputForm ( HttpServletRequest request ) { if ( _outputForms == null || _outputForms . size ( ) == 0 ) { if ( _outputFormBeanType != null ) { try { if ( _log . isDebugEnabled ( ) ) { _log . debug ( "Creating form bean of type " + _outputFormBeanType ) ; } ServletContext servletContext = InternalUtils . getServletContext ( request ) ; ReloadableClassHandler rch = Handlers . get ( servletContext ) . getReloadableClassHandler ( ) ; Object formBean = rch . newInstance ( _outputFormBeanType ) ; ActionForm wrappedFormBean = InternalUtils . wrapFormBean ( formBean ) ; addOutputForm ( wrappedFormBean ) ; return wrappedFormBean ; } catch ( Exception e ) { _log . error ( "Could not create form bean instance of " + _outputFormBeanType , e ) ; } } return null ; } else { return ( ActionForm ) _outputForms . get ( 0 ) ; } } | Get the first output form bean that was added to this Forward . |
9,647 | protected ActionForward findForward ( String forwardName ) { ActionForward fwd = _mapping != null ? _mapping . findForward ( forwardName ) : null ; if ( fwd != null ) { return fwd ; } else if ( _altModuleConfig != null ) { return ( ActionForward ) _altModuleConfig . findForwardConfig ( forwardName ) ; } return null ; } | Resolves the forward with the given name from the stored ActionMapping if possible or from the stored alternate ModuleConfig as a last resort . |
9,648 | private void checkActionOutputs ( PageFlowActionForward fc ) { PageFlowActionForward . ActionOutput [ ] actionOutputs = fc . getActionOutputs ( ) ; boolean doExpensiveChecks = _actionOutputs != null && ! AdapterManager . getServletContainerAdapter ( _servletContext ) . isInProductionMode ( ) ; for ( int i = 0 ; i < actionOutputs . length ; ++ i ) { PageFlowActionForward . ActionOutput actionOutput = actionOutputs [ i ] ; if ( ! actionOutput . getNullable ( ) ) { String actionOutputName = actionOutput . getName ( ) ; if ( _actionOutputs == null || ! _actionOutputs . containsKey ( actionOutputName ) ) { PageFlowException ex = new MissingActionOutputException ( _mappingPath , _flowController , actionOutput . getName ( ) , getName ( ) ) ; InternalUtils . throwPageFlowException ( ex ) ; } else if ( _actionOutputs . get ( actionOutputName ) == null ) { PageFlowException ex = new NullActionOutputException ( _mappingPath , _flowController , actionOutput . getName ( ) , getName ( ) ) ; InternalUtils . throwPageFlowException ( ex ) ; } } if ( doExpensiveChecks ) { Object actualActionOutput = _actionOutputs . get ( actionOutput . getName ( ) ) ; if ( actualActionOutput != null ) { String expectedTypeName = actionOutput . getType ( ) ; int expectedArrayDims = 0 ; while ( expectedTypeName . endsWith ( "[]" ) ) { ++ expectedArrayDims ; expectedTypeName = expectedTypeName . substring ( 0 , expectedTypeName . length ( ) - 2 ) ; } Class expectedType = ( Class ) PRIMITIVE_TYPES . get ( expectedTypeName ) ; if ( expectedType == null ) { try { ReloadableClassHandler rch = Handlers . get ( _servletContext ) . getReloadableClassHandler ( ) ; expectedType = rch . loadClass ( expectedTypeName ) ; } catch ( ClassNotFoundException e ) { _log . error ( "Could not load expected action output type " + expectedTypeName + " for action output '" + actionOutput . getName ( ) + "' on forward '" + fc . getName ( ) + "'; skipping type check." ) ; continue ; } } Class actualType = actualActionOutput . getClass ( ) ; int actualArrayDims = 0 ; InternalStringBuilder arraySuffix = new InternalStringBuilder ( ) ; while ( actualType . isArray ( ) && actualArrayDims <= expectedArrayDims ) { ++ actualArrayDims ; arraySuffix . append ( "[]" ) ; actualType = actualType . getComponentType ( ) ; } if ( actualArrayDims != expectedArrayDims || ! expectedType . isAssignableFrom ( actualType ) ) { PageFlowException ex = new MismatchedActionOutputException ( _mappingPath , _flowController , actionOutput . getName ( ) , getName ( ) , expectedTypeName , actualType . getName ( ) + arraySuffix ) ; InternalUtils . throwPageFlowException ( ex ) ; } } } } } | Make sure required action outputs are present and are of the right type ( only make the latter check when not in production mode |
9,649 | public static FilterTypeHint getTypeHint ( String hint ) { if ( STRING . getHint ( ) . equals ( hint ) ) return STRING ; else if ( NUMERIC . getHint ( ) . equals ( hint ) ) return NUMERIC ; else if ( DATE . getHint ( ) . equals ( hint ) ) return DATE ; else throw new IllegalArgumentException ( Bundle . getErrorString ( "FilterTypeHint_UnknownHintString" , new Object [ ] { hint } ) ) ; } | Given a String lookup a FilterTypeHint for the String . Valid |
9,650 | public void setAttribute ( String name , String value , String facet ) throws JspException { if ( name != null ) { if ( name . equals ( DISABLED ) ) { setDisabled ( Boolean . parseBoolean ( value ) ) ; return ; } else if ( name . equals ( READONLY ) ) { _state . readonly = new Boolean ( value ) . booleanValue ( ) ; return ; } else if ( name . equals ( COLS ) ) { _state . cols = Integer . parseInt ( value ) ; return ; } else if ( name . equals ( ROWS ) ) { _state . rows = Integer . parseInt ( value ) ; return ; } } super . setAttribute ( name , value , facet ) ; } | Base support for the attribute tag . |
9,651 | public int doEndTag ( ) throws JspException { ServletRequest req = pageContext . getRequest ( ) ; Object textObject = null ; Object val = evaluateDataSource ( ) ; textObject = ( val != null ) ? val : "" ; assert ( textObject != null ) ; ByRef ref = new ByRef ( ) ; nameHtmlControl ( _state , ref ) ; _state . disabled = isDisabled ( ) ; if ( hasErrors ( ) ) return reportAndExit ( EVAL_PAGE ) ; if ( _formatErrors ) { if ( bodyContent != null ) { String value = bodyContent . getString ( ) . trim ( ) ; bodyContent . clearBody ( ) ; write ( value ) ; } } WriteRenderAppender writer = new WriteRenderAppender ( pageContext ) ; TagRenderingBase br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . TEXT_AREA_TAG , req ) ; br . doStartTag ( writer , _state ) ; if ( ( textObject == null ) || ( textObject . toString ( ) . length ( ) == 0 ) ) { textObject = _defaultValue ; } String text = formatText ( textObject ) ; if ( text != null ) { if ( text . startsWith ( "\n" ) || text . startsWith ( "\r" ) ) { writer . append ( "\n" ) ; } HtmlUtils . filter ( text , writer ) ; } br . doEndTag ( writer ) ; if ( hasErrors ( ) ) return reportAndExit ( EVAL_PAGE ) ; if ( ! ref . isNull ( ) ) write ( ( String ) ref . getRef ( ) ) ; localRelease ( ) ; return EVAL_PAGE ; } | Render the TextArea . |
9,652 | public static URLTemplatesFactory getURLTemplatesFactory ( ServletContext servletContext ) { assert servletContext != null : "The ServletContext cannot be null." ; if ( servletContext == null ) { throw new IllegalArgumentException ( "The ServletContext cannot be null." ) ; } return ( URLTemplatesFactory ) servletContext . getAttribute ( URL_TEMPLATE_FACTORY_ATTR ) ; } | Gets the URLTemplatesFactory instance from a ServletContext attribute . |
9,653 | public static void initServletContext ( ServletContext servletContext , URLTemplatesFactory templatesFactory ) { assert servletContext != null : "The ServletContext cannot be null." ; if ( servletContext == null ) { throw new IllegalArgumentException ( "The ServletContext cannot be null." ) ; } servletContext . setAttribute ( URL_TEMPLATE_FACTORY_ATTR , templatesFactory ) ; } | Adds a given URLTemplatesFactory instance as an attribute on the ServletContext . |
9,654 | public static URLTemplatesFactory getURLTemplatesFactory ( ServletRequest servletRequest ) { assert servletRequest != null : "The ServletRequest cannot be null." ; if ( servletRequest == null ) { throw new IllegalArgumentException ( "The ServletRequest cannot be null." ) ; } return ( URLTemplatesFactory ) servletRequest . getAttribute ( URL_TEMPLATE_FACTORY_ATTR ) ; } | Gets the URLTemplatesFactory instance from a ServletRequest attribute . |
9,655 | public static void initServletRequest ( ServletRequest servletRequest , URLTemplatesFactory templatesFactory ) { assert servletRequest != null : "The ServletRequest cannot be null." ; if ( servletRequest == null ) { throw new IllegalArgumentException ( "The ServletRequest cannot be null." ) ; } servletRequest . setAttribute ( URL_TEMPLATE_FACTORY_ATTR , templatesFactory ) ; } | Adds a given URLTemplatesFactory instance as an attribute on the ServletRequest . |
9,656 | public void reset ( Set < OWLEntity > toReturn ) { objects = toReturn ; if ( anonymousIndividuals != null ) { verifyNotNull ( anonymousIndividuals ) . clear ( ) ; } } | XXX not in the interface |
9,657 | private static Object getSessionVar ( HttpServletRequest request , ServletContext servletContext , String name ) { StorageHandler sh = Handlers . get ( servletContext ) . getStorageHandler ( ) ; HttpServletRequest unwrappedRequest = PageFlowUtils . unwrapMultipart ( request ) ; RequestContext rc = new RequestContext ( unwrappedRequest , null ) ; String attrName = ScopedServletUtils . getScopedSessionAttrName ( name , unwrappedRequest ) ; return sh . getAttribute ( rc , attrName ) ; } | This is a generic routine that will retrieve a value from the Session through the StorageHandler . |
9,658 | public static boolean isXMLNameStartCharacter ( int codePoint ) { return codePoint == ':' || codePoint >= 'A' && codePoint <= 'Z' || codePoint == '_' || codePoint >= 'a' && codePoint <= 'z' || codePoint >= 0xC0 && codePoint <= 0xD6 || codePoint >= 0xD8 && codePoint <= 0xF6 || codePoint >= 0xF8 && codePoint <= 0x2FF || codePoint >= 0x370 && codePoint <= 0x37D || codePoint >= 0x37F && codePoint <= 0x1FFF || codePoint >= 0x200C && codePoint <= 0x200D || codePoint >= 0x2070 && codePoint <= 0x218F || codePoint >= 0x2C00 && codePoint <= 0x2FEF || codePoint >= 0x3001 && codePoint <= 0xD7FF || codePoint >= 0xF900 && codePoint <= 0xFDCF || codePoint >= 0xFDF0 && codePoint <= 0xFFFD || codePoint >= 0x10000 && codePoint <= 0xEFFFF ; } | Determines if a character is an XML name start character . |
9,659 | public static boolean isXMLNameChar ( int codePoint ) { return isXMLNameStartCharacter ( codePoint ) || codePoint == '-' || codePoint == '.' || codePoint >= '0' && codePoint <= '9' || codePoint == 0xB7 || codePoint >= 0x0300 && codePoint <= 0x036F || codePoint >= 0x203F && codePoint <= 0x2040 ; } | Determines if a character is an XML name character . |
9,660 | public static int getNCNameSuffixIndex ( CharSequence s ) { if ( s . length ( ) > 1 && s . charAt ( 0 ) == '_' && s . charAt ( 1 ) == ':' ) { return - 1 ; } int index = - 1 ; for ( int i = s . length ( ) - 1 ; i > - 1 ; i -- ) { if ( ! Character . isLowSurrogate ( s . charAt ( i ) ) ) { int codePoint = Character . codePointAt ( s , i ) ; if ( isNCNameStartChar ( codePoint ) ) { index = i ; } if ( ! isNCNameChar ( codePoint ) ) { break ; } } } return index ; } | Gets the index of the longest NCName that is the suffix of a character sequence . |
9,661 | public static String getNCNameSuffix ( CharSequence s ) { if ( s . length ( ) > 1 && s . charAt ( 0 ) == '_' && s . charAt ( 1 ) == ':' ) { return null ; } int localPartStartIndex = getNCNameSuffixIndex ( s ) ; if ( localPartStartIndex > - 1 ) { return s . toString ( ) . substring ( localPartStartIndex ) ; } else { return null ; } } | Get the longest NCName that is a suffix of a character sequence . |
9,662 | public static String getNCNamePrefix ( CharSequence s ) { if ( s . length ( ) > 1 && s . charAt ( 0 ) == '_' && s . charAt ( 1 ) == ':' ) { return s . toString ( ) ; } int localPartStartIndex = getNCNameSuffixIndex ( s ) ; if ( localPartStartIndex > - 1 ) { return s . toString ( ) . substring ( 0 , localPartStartIndex ) ; } else { return s . toString ( ) ; } } | utility to get the part of a charsequence that is not the NCName fragment . |
9,663 | public static String escapeXML ( CharSequence s ) { StringBuilder sb = new StringBuilder ( s . length ( ) * 2 ) ; for ( int i = 0 ; i < s . length ( ) ; ) { int codePoint = Character . codePointAt ( s , i ) ; if ( codePoint == '<' ) { sb . append ( LT ) ; } else if ( codePoint == '>' ) { sb . append ( GT ) ; } else if ( codePoint == '\"' ) { sb . append ( QUOT ) ; } else if ( codePoint == '&' ) { sb . append ( AMP ) ; } else if ( codePoint == '\'' ) { sb . append ( APOS ) ; } else { sb . appendCodePoint ( codePoint ) ; } i += Character . charCount ( codePoint ) ; } return sb . toString ( ) ; } | Escapes a character sequence so that it is valid XML . |
9,664 | public static StringBuilder escapeXML ( char [ ] chars , int start , int count , StringBuilder destination ) { for ( int i = 0 ; i < count ; i ++ ) { char codePoint = chars [ start + i ] ; if ( codePoint == '<' ) { destination . append ( LT ) ; } else if ( codePoint == '>' ) { destination . append ( GT ) ; } else if ( codePoint == '\"' ) { destination . append ( QUOT ) ; } else if ( codePoint == '&' ) { destination . append ( AMP ) ; } else if ( codePoint == '\'' ) { destination . append ( APOS ) ; } else { destination . append ( codePoint ) ; } } return destination ; } | Escapes a subset of a char sequence so that it is valid XML . Escaped or unchanged characters are added to destination . |
9,665 | public static void escapeXML ( StringBuilder sb ) { for ( int i = 0 ; i < sb . length ( ) ; ) { int codePoint = Character . codePointAt ( sb , i ) ; int length = Character . charCount ( codePoint ) ; if ( codePoint == '<' ) { sb . replace ( i , i + length , LT ) ; i += LT . length ( ) ; } else if ( codePoint == '>' ) { sb . replace ( i , i + length , GT ) ; i += GT . length ( ) ; } else if ( codePoint == '\"' ) { sb . replace ( i , i + length , QUOT ) ; i += QUOT . length ( ) ; } else if ( codePoint == '&' ) { sb . replace ( i , i + length , AMP ) ; i += AMP . length ( ) ; } else if ( codePoint == '\'' ) { sb . replace ( i , i + length , APOS ) ; i += APOS . length ( ) ; } else { i += length ; } } } | Escapes a string builder so that it is valid XML . |
9,666 | public void forward ( ServletRequest request , ServletResponse response ) throws ServletException , IOException { ScopedRequestImpl scopedRequest = ( ScopedRequestImpl ) ScopedServletUtils . unwrapRequest ( request ) ; assert scopedRequest != null : request . getClass ( ) . getName ( ) ; scopedRequest . setForwardedURI ( _uri ) ; scopedRequest . doForward ( ) ; } | Does not actually cause a server forward of the request but informs the ScopedRequest object that a forward was attempted for a particular URI . |
9,667 | public void include ( ServletRequest request , ServletResponse response ) throws ServletException , IOException { assert request instanceof HttpServletRequest : request . getClass ( ) . getName ( ) ; HttpServletRequest httpRequest = ( HttpServletRequest ) request ; HttpServletRequest outerRequest = ScopedServletUtils . getOuterRequest ( httpRequest ) ; outerRequest . setAttribute ( REQUEST_URI_INCLUDE , httpRequest . getRequestURI ( ) ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Delegating to RequestDispatcher for URI " + _uri ) ; } try { RequestDispatcher realDispatcher = outerRequest . getRequestDispatcher ( _uri ) ; if ( realDispatcher == null ) { assert response instanceof HttpServletResponse : response . getClass ( ) . getName ( ) ; ( ( HttpServletResponse ) response ) . setStatus ( HttpServletResponse . SC_NOT_FOUND ) ; logger . error ( "Could not get RequestDispatcher for URI " + _uri ) ; } else { realDispatcher . include ( request , response ) ; } } catch ( ServletException e ) { logger . error ( "Exception during RequestDispatcher.include()." , e . getRootCause ( ) ) ; throw e ; } } | Does a server include of the stored URI into the given ScopedRequest and ScopedResponse . |
9,668 | public boolean containsKey ( Object key ) { if ( key == null ) throw new NullPointerException ( "Binding to a resource bundle does not accept a null key" ) ; BundleNodeMap map = lookupScriptableBundle ( key . toString ( ) ) ; return map != null ; } | Implementation of Map . containsKey for the bundle implicit object . |
9,669 | private MessageResources lookupDefaultStrutsBundle ( ) { Object value = _servletRequest . getAttribute ( Globals . MESSAGES_KEY ) ; if ( value instanceof MessageResources ) return ( MessageResources ) value ; else { if ( value != null ) LOGGER . warn ( "Can not resolve the default module bundle." + " The object resolved from the request is of type " + value . getClass ( ) . toString ( ) ) ; return null ; } } | Lookup the default resource bundle for the current Struts module . |
9,670 | private MessageResources lookupStrutsBundle ( String name ) { Object value = _servletContext . getAttribute ( name ) ; if ( value instanceof MessageResources ) return ( MessageResources ) value ; else { if ( value != null ) LOGGER . warn ( "Can not resolve module bundle with name \"" + name + "\". The object resolved from ServletContext is of type " + value . getClass ( ) . toString ( ) ) ; return null ; } } | Lookup a specific resource bundle for the current Struts module . |
9,671 | static long x ( long d , long m , long over ) { if ( d > over ) return Long . MAX_VALUE ; if ( d < - over ) return Long . MIN_VALUE ; return d * m ; } | Scale d by m checking for overflow . This has a short name to make above code more readable . |
9,672 | private void addActivityWithDataUsage ( String activity ) { Validate . notNull ( activity ) ; Validate . notEmpty ( activity ) ; Set < String > currentActivities = getActivitiesWithDataUsage ( ) ; currentActivities . add ( activity ) ; setProperty ( ProcessContextProperty . ACTIVITIES_WITH_DATA_USAGE , ArrayUtils . toString ( currentActivities . toArray ( ) ) ) ; } | Adds an activity to the list of activities with data usage . |
9,673 | public Set < String > getActivitiesWithDataUsage ( ) { Set < String > result = new HashSet < > ( ) ; String propertyValue = getProperty ( ProcessContextProperty . ACTIVITIES_WITH_DATA_USAGE ) ; if ( propertyValue == null ) { return result ; } StringTokenizer activityTokens = StringUtils . splitArrayString ( propertyValue , " " ) ; while ( activityTokens . hasMoreTokens ( ) ) { result . add ( activityTokens . nextToken ( ) ) ; } return result ; } | Returns the names of all activities with data usage . |
9,674 | public static XLogInfo create ( XLog log , XEventClassifier defaultClassifier , Collection < XEventClassifier > classifiers ) { return new XLogInfoImpl ( log , defaultClassifier , classifiers ) ; } | Creates a new log info summary with a collection of custom event classifiers . |
9,675 | protected synchronized void setup ( ) { registerAttributes ( logAttributeInfo , log ) ; for ( XTrace trace : log ) { numberOfTraces ++ ; registerAttributes ( traceAttributeInfo , trace ) ; XTimeBoundsImpl traceBounds = new XTimeBoundsImpl ( ) ; for ( XEvent event : trace ) { registerAttributes ( eventAttributeInfo , event ) ; for ( XEventClasses classes : this . eventClasses . values ( ) ) { classes . register ( event ) ; } traceBounds . register ( event ) ; numberOfEvents ++ ; } this . traceBoundaries . put ( trace , traceBounds ) ; this . logBoundaries . register ( traceBounds ) ; } for ( XEventClasses classes : this . eventClasses . values ( ) ) { classes . harmonizeIndices ( ) ; } } | Creates the internal data structures of this summary on setup from the log . |
9,676 | protected void registerAttributes ( XAttributeInfoImpl attributeInfo , XAttributable attributable ) { if ( attributable . hasAttributes ( ) ) { for ( XAttribute attribute : attributable . getAttributes ( ) . values ( ) ) { attributeInfo . register ( attribute ) ; registerAttributes ( metaAttributeInfo , attribute ) ; } } } | Registers all attributes of a given attributable i . e . model type hierarchy element in the given attribute info registry . |
9,677 | public void setValue ( Object value ) throws JspException { if ( value != null ) _state . value = value . toString ( ) ; else _state . value = null ; } | Set the value of this CheckBoxOption . |
9,678 | @ EventHandler ( field = "_resourceContext" , eventSet = ResourceEvents . class , eventName = "onAcquire" ) public void onAquire ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Enter: onAquire()" ) ; } try { getConnection ( ) ; } catch ( SQLException se ) { throw new ControlException ( "SQL Exception while attempting to connect to database." , se ) ; } } | Invoked by the controls runtime when a new instance of this class is aquired by the runtime |
9,679 | @ EventHandler ( field = "_resourceContext" , eventSet = ResourceContext . ResourceEvents . class , eventName = "onRelease" ) public void onRelease ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Enter: onRelease()" ) ; } for ( PreparedStatement ps : getResources ( ) ) { try { ps . close ( ) ; } catch ( SQLException sqe ) { } } getResources ( ) . clear ( ) ; if ( _connection != null ) { try { _connection . close ( ) ; } catch ( SQLException e ) { throw new ControlException ( "SQL Exception while attempting to close database connection." , e ) ; } } _connection = null ; _connectionDataSource = null ; _connectionDriver = null ; } | Invoked by the controls runtime when an instance of this class is released by the runtime |
9,680 | public Object invoke ( Method method , Object [ ] args ) throws Throwable { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Enter: invoke()" ) ; } assert _connection . isClosed ( ) == false : "invoke(): JDBC Connection has been closed!!!!" ; return execPreparedStatement ( method , args ) ; } | Called by the Controls runtime to handle calls to methods of an extensible control . |
9,681 | private Connection getConnectionFromDataSource ( String jndiName , Class < ? extends JdbcControl . JndiContextFactory > jndiFactory ) throws SQLException { Connection con = null ; try { JndiContextFactory jf = ( JndiContextFactory ) jndiFactory . newInstance ( ) ; Context jndiContext = jf . getContext ( ) ; _dataSource = ( DataSource ) jndiContext . lookup ( jndiName ) ; con = _dataSource . getConnection ( ) ; } catch ( IllegalAccessException iae ) { throw new ControlException ( "IllegalAccessException:" , iae ) ; } catch ( InstantiationException ie ) { throw new ControlException ( "InstantiationException:" , ie ) ; } catch ( NamingException ne ) { throw new ControlException ( "NamingException:" , ne ) ; } return con ; } | Get a connection from a DataSource . |
9,682 | private Connection getConnectionFromDriverManager ( String dbDriverClassName , String dbUrlStr , String userName , String password , String propertiesString ) throws SQLException { Connection con = null ; try { Class . forName ( dbDriverClassName ) ; if ( ! EMPTY_STRING . equals ( userName ) ) { con = DriverManager . getConnection ( dbUrlStr , userName , password ) ; } else if ( ! EMPTY_STRING . equals ( propertiesString ) ) { Properties props = parseProperties ( propertiesString ) ; if ( props == null ) { throw new ControlException ( "Invalid properties annotation value: " + propertiesString ) ; } con = DriverManager . getConnection ( dbUrlStr , props ) ; } else { con = DriverManager . getConnection ( dbUrlStr ) ; } } catch ( ClassNotFoundException e ) { throw new ControlException ( "Database driver class not found!" , e ) ; } return con ; } | Get a JDBC connection from the DriverManager . |
9,683 | private void setTypeMappers ( TypeMapper [ ] typeMappers ) throws SQLException { if ( typeMappers . length > 0 ) { Map < String , Class < ? > > mappers = _connection . getTypeMap ( ) ; for ( TypeMapper t : typeMappers ) { mappers . put ( t . UDTName ( ) , t . mapperClass ( ) ) ; } _connection . setTypeMap ( mappers ) ; } } | Set any custom type mappers specifed in the annotation for the connection . Used for mapping SQL UDTs to java classes . |
9,684 | public void addTagID ( String tagID , String name ) { if ( _focusMap == null ) { _focusMap = new HashMap ( ) ; } _focusMap . put ( tagID , name ) ; } | Adds a tagId and name to the Form s focusMap . |
9,685 | public int doStartTag ( ) throws JspException { if ( hasErrors ( ) ) return SKIP_BODY ; if ( getNearestForm ( ) != null ) { registerTagError ( Bundle . getString ( "Tags_FormParentForm" ) , null ) ; } HttpServletRequest request = ( HttpServletRequest ) pageContext . getRequest ( ) ; ServletContext servletContext = pageContext . getServletContext ( ) ; lookupBeanScopeAndName ( request , servletContext ) ; if ( hasErrors ( ) ) return SKIP_BODY ; if ( _state . id != null ) { _realName = getIdForTagId ( _state . id ) ; } else { String formId = FORM_ID + getNextId ( request ) ; _realName = getIdForTagId ( formId ) ; } pageContext . setAttribute ( Constants . FORM_KEY , this , PageContext . REQUEST_SCOPE ) ; int scope = PageContext . SESSION_SCOPE ; if ( "request" . equals ( _beanScope ) ) { scope = PageContext . REQUEST_SCOPE ; } Object bean = null ; if ( _beanName != null ) bean = pageContext . getAttribute ( _beanName , scope ) ; if ( bean == null ) { if ( _explicitBeanType ) { try { Handlers handlers = Handlers . get ( pageContext . getServletContext ( ) ) ; bean = handlers . getReloadableClassHandler ( ) . newInstance ( _beanType ) ; if ( bean != null ) { ( ( ActionForm ) bean ) . setServlet ( _servlet ) ; } } catch ( Exception e ) { registerTagError ( Bundle . getString ( "Tags_FormNameBadType" ) , e ) ; } } else { if ( _flowController != null ) { bean = _flowController . getFormBean ( _mapping ) ; } if ( bean == null ) { bean = InternalUtils . createActionForm ( _mapping , _appConfig , _servlet , servletContext ) ; } } if ( hasErrors ( ) ) return SKIP_BODY ; if ( bean instanceof ActionForm ) { ( ( ActionForm ) bean ) . reset ( _mapping , request ) ; } if ( bean != null ) { pageContext . setAttribute ( _beanName , bean , scope ) ; } } if ( bean != null ) { pageContext . setAttribute ( Constants . BEAN_KEY , bean , PageContext . REQUEST_SCOPE ) ; ImplicitObjectUtil . loadActionForm ( pageContext , bean ) ; } try { HttpServletResponse response = ( HttpServletResponse ) pageContext . getResponse ( ) ; _extraHiddenParams = new LinkedHashMap ( ) ; _actionUrl = rewriteActionURL ( servletContext , request , response , _extraHiddenParams ) ; } catch ( URISyntaxException e ) { logger . error ( Bundle . getString ( "Tags_URISyntaxException" ) ) ; String s = Bundle . getString ( "Tags_Form_URLException" , new Object [ ] { _state . action , e . getMessage ( ) } ) ; registerTagError ( s , e ) ; } return EVAL_BODY_BUFFERED ; } | Render the beginning of this form . |
9,686 | public int doAfterBody ( ) throws JspException { if ( bodyContent != null ) { String value = bodyContent . getString ( ) ; bodyContent . clearBody ( ) ; if ( value . length ( ) > 0 ) _text = value ; } return SKIP_BODY ; } | Save the body content of the Form . |
9,687 | private String renderNameAndId ( HttpServletRequest request , String id ) { if ( id == null ) return null ; String idScript = null ; IScriptReporter scriptReporter = getScriptReporter ( ) ; ScriptRequestState srs = ScriptRequestState . getScriptRequestState ( request ) ; if ( TagConfig . isLegacyJavaScript ( ) ) { idScript = srs . mapLegacyTagId ( scriptReporter , id , _state . id ) ; } if ( TagConfig . isDefaultJavaScript ( ) ) { String script = srs . mapTagId ( scriptReporter , id , _state . id , _state . name ) ; if ( idScript != null ) { idScript = idScript + script ; } else { idScript = script ; } } return idScript ; } | This mehtod will render the JavaScript associated with the id lookup if id has been set . |
9,688 | private void writeHiddenParam ( String paramName , String paramValue , AbstractRenderAppender results , ServletRequest req , boolean newLine ) { if ( newLine ) results . append ( "\n" ) ; _hiddenState . clear ( ) ; _hiddenState . name = paramName ; _hiddenState . value = paramValue ; TagRenderingBase hiddenTag = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_HIDDEN_TAG , req ) ; hiddenTag . doStartTag ( results , _hiddenState ) ; hiddenTag . doEndTag ( results ) ; } | Write a hidden field for a paramter |
9,689 | public static boolean uriEndsWith ( String uri , String ending ) { int queryStart = uri . indexOf ( '?' ) ; if ( queryStart == - 1 ) { return uri . endsWith ( ending ) ; } else { return uri . length ( ) - queryStart >= ending . length ( ) && uri . substring ( queryStart - ending . length ( ) , queryStart ) . equals ( ending ) ; } } | Tell whether a URI ends in a given String . |
9,690 | public static String getFileExtension ( String filename ) { int lastDot = filename . lastIndexOf ( '.' ) ; return lastDot != - 1 ? filename . substring ( lastDot + 1 ) : "" ; } | Get the file extension from a file name . |
9,691 | public static boolean osSensitiveEquals ( String s1 , String s2 ) { if ( OS_CASE_SENSITIVE ) { return s1 . equals ( s2 ) ; } else { return s1 . equalsIgnoreCase ( s2 ) ; } } | Compare two strings with case sensitivity determined by the operating system . |
9,692 | public static boolean osSensitiveEndsWith ( String str , String suffix ) { if ( OS_CASE_SENSITIVE ) { return str . endsWith ( suffix ) ; } else { int strLen = str . length ( ) ; int suffixLen = suffix . length ( ) ; if ( strLen < suffixLen ) { return false ; } return ( str . substring ( strLen - suffixLen ) . equalsIgnoreCase ( suffix ) ) ; } } | Tell whether a string ends with a particular suffix with case sensitivity determined by the operating system . |
9,693 | public static void add ( HashMap html , HashMap htmlQuirks , HashMap xhtml ) { html . put ( ANCHOR_TAG , new Rendering ( ) ) ; htmlQuirks . put ( ANCHOR_TAG , new Rendering ( ) ) ; xhtml . put ( ANCHOR_TAG , new Rendering ( ) ) ; } | Add the Renderer for the HTML and XHTML tokens . |
9,694 | public AnnotationTypeElementDeclaration getElementDeclaration ( String elemName ) { if ( _elementMap . containsKey ( elemName ) ) return _elementMap . get ( elemName ) ; return null ; } | Returns the AnnotationTypeElementDeclaration for a particular element |
9,695 | public String getStringValue ( String elemName ) { if ( _valueMap . containsKey ( elemName ) ) return _valueMap . get ( elemName ) . toString ( ) ; return null ; } | Returns the value of a particular element as a String |
9,696 | public Object getObjectValue ( String elemName ) { if ( _valueMap . containsKey ( elemName ) ) return _valueMap . get ( elemName ) . getValue ( ) ; return null ; } | Returns the value of a particular element as an Object |
9,697 | public synchronized NikeFS2Block allocateBlock ( ) { int freeBlockIndex = blockAllocationMap . nextSetBit ( 0 ) ; if ( freeBlockIndex < 0 ) { return null ; } else { blockAllocationMap . set ( freeBlockIndex , false ) ; return new NikeFS2Block ( this , freeBlockIndex ) ; } } | Allocates a new block from this block provider . |
9,698 | public void setOnMouseUp ( String onMouseUp ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEUP , onMouseUp ) ; } | Sets the onMouseUp JavaScript event for the HTML tbody tag . |
9,699 | public void setOnMouseMove ( String onMouseMove ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEMOVE , onMouseMove ) ; } | Sets the onMouseMove JavaScript event for the HTML tbody tag . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.