id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
147,000
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/PagerRenderer.java
PagerRenderer.buildLiveFirstLink
protected String buildLiveFirstLink() { InternalStringBuilder builder = new InternalStringBuilder(); AbstractRenderAppender appender = new StringBuilderRenderAppender(builder); buildAnchor(appender, _gridModel.getUrlBuilder().getQueryParamsForFirstPage(), IDataGridMessageKeys.PAGER_MSG_FIRST); return builder.toString(); }
java
protected String buildLiveFirstLink() { InternalStringBuilder builder = new InternalStringBuilder(); AbstractRenderAppender appender = new StringBuilderRenderAppender(builder); buildAnchor(appender, _gridModel.getUrlBuilder().getQueryParamsForFirstPage(), IDataGridMessageKeys.PAGER_MSG_FIRST); return builder.toString(); }
[ "protected", "String", "buildLiveFirstLink", "(", ")", "{", "InternalStringBuilder", "builder", "=", "new", "InternalStringBuilder", "(", ")", ";", "AbstractRenderAppender", "appender", "=", "new", "StringBuilderRenderAppender", "(", "builder", ")", ";", "buildAnchor", "(", "appender", ",", "_gridModel", ".", "getUrlBuilder", "(", ")", ".", "getQueryParamsForFirstPage", "(", ")", ",", "IDataGridMessageKeys", ".", "PAGER_MSG_FIRST", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Build an HTML anchor that contains URL state for navigating to the first page of a data set. @return the HTML markup for anchor to the first page
[ "Build", "an", "HTML", "anchor", "that", "contains", "URL", "state", "for", "navigating", "to", "the", "first", "page", "of", "a", "data", "set", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/PagerRenderer.java#L126-L133
147,001
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/PagerRenderer.java
PagerRenderer.buildLiveLastLink
protected String buildLiveLastLink() { InternalStringBuilder builder = new InternalStringBuilder(); AbstractRenderAppender appender = new StringBuilderRenderAppender(builder); buildAnchor(appender, _gridModel.getUrlBuilder().getQueryParamsForLastPage(), IDataGridMessageKeys.PAGER_MSG_LAST); return builder.toString(); }
java
protected String buildLiveLastLink() { InternalStringBuilder builder = new InternalStringBuilder(); AbstractRenderAppender appender = new StringBuilderRenderAppender(builder); buildAnchor(appender, _gridModel.getUrlBuilder().getQueryParamsForLastPage(), IDataGridMessageKeys.PAGER_MSG_LAST); return builder.toString(); }
[ "protected", "String", "buildLiveLastLink", "(", ")", "{", "InternalStringBuilder", "builder", "=", "new", "InternalStringBuilder", "(", ")", ";", "AbstractRenderAppender", "appender", "=", "new", "StringBuilderRenderAppender", "(", "builder", ")", ";", "buildAnchor", "(", "appender", ",", "_gridModel", ".", "getUrlBuilder", "(", ")", ".", "getQueryParamsForLastPage", "(", ")", ",", "IDataGridMessageKeys", ".", "PAGER_MSG_LAST", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Build an HTML anchor that contains URL state for navigating to the last page of a data set. @return the HTML markup for anchor to the last page
[ "Build", "an", "HTML", "anchor", "that", "contains", "URL", "state", "for", "navigating", "to", "the", "last", "page", "of", "a", "data", "set", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/PagerRenderer.java#L195-L200
147,002
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/PagerRenderer.java
PagerRenderer.buildAnchor
protected final void buildAnchor(AbstractRenderAppender appender, Map queryParams, String labelKey) { assert appender != null; assert queryParams != null; assert labelKey != null && labelKey.length() > 0; _anchorState.href = buildPageUri(queryParams); _anchorTag.doStartTag(appender, _anchorState); appender.append(_gridModel.getMessage(labelKey)); _anchorTag.doEndTag(appender); _anchorState.clear(); }
java
protected final void buildAnchor(AbstractRenderAppender appender, Map queryParams, String labelKey) { assert appender != null; assert queryParams != null; assert labelKey != null && labelKey.length() > 0; _anchorState.href = buildPageUri(queryParams); _anchorTag.doStartTag(appender, _anchorState); appender.append(_gridModel.getMessage(labelKey)); _anchorTag.doEndTag(appender); _anchorState.clear(); }
[ "protected", "final", "void", "buildAnchor", "(", "AbstractRenderAppender", "appender", ",", "Map", "queryParams", ",", "String", "labelKey", ")", "{", "assert", "appender", "!=", "null", ";", "assert", "queryParams", "!=", "null", ";", "assert", "labelKey", "!=", "null", "&&", "labelKey", ".", "length", "(", ")", ">", "0", ";", "_anchorState", ".", "href", "=", "buildPageUri", "(", "queryParams", ")", ";", "_anchorTag", ".", "doStartTag", "(", "appender", ",", "_anchorState", ")", ";", "appender", ".", "append", "(", "_gridModel", ".", "getMessage", "(", "labelKey", ")", ")", ";", "_anchorTag", ".", "doEndTag", "(", "appender", ")", ";", "_anchorState", ".", "clear", "(", ")", ";", "}" ]
Build the anchor @param appender @param queryParams @param labelKey
[ "Build", "the", "anchor" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/PagerRenderer.java#L218-L228
147,003
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/PageFlowInitialization.java
PageFlowInitialization.initPrefixHandlers
private static void initPrefixHandlers() { PrefixHandlerConfig[] prefixHandlers = ConfigUtil.getConfig().getPrefixHandlers(); if ( prefixHandlers == null ) { return; } for ( int i = 0; i < prefixHandlers.length; i++ ) { try { Class prefixClass = Class.forName( prefixHandlers[i].getHandlerClass() ); String name = prefixHandlers[i].getName(); if ( name == null || name.equals( "" ) ) { _log.warn( "The name for the prefix handler '" + prefixHandlers[i].getHandlerClass() + "' must not be null" ); continue; } Object o = prefixClass.newInstance(); if ( !( o instanceof RequestParameterHandler ) ) { _log.warn( "The class '" + prefixHandlers[i].getHandlerClass() + "' must be an instance of RequestParameterHandler" ); continue; } ProcessPopulate.registerPrefixHandler( name, ( RequestParameterHandler ) o ); } catch ( ClassNotFoundException e ) { _log.warn( "Class '" + prefixHandlers[i].getHandlerClass() + "' not found", e ); } catch ( IllegalAccessException e ) { _log.warn( "Illegal access on Class '" + prefixHandlers[i].getHandlerClass() + "'", e ); } catch ( InstantiationException e ) { _log.warn( "InstantiationException on Class '" + prefixHandlers[i].getHandlerClass() + "'", e.getCause() ); } } }
java
private static void initPrefixHandlers() { PrefixHandlerConfig[] prefixHandlers = ConfigUtil.getConfig().getPrefixHandlers(); if ( prefixHandlers == null ) { return; } for ( int i = 0; i < prefixHandlers.length; i++ ) { try { Class prefixClass = Class.forName( prefixHandlers[i].getHandlerClass() ); String name = prefixHandlers[i].getName(); if ( name == null || name.equals( "" ) ) { _log.warn( "The name for the prefix handler '" + prefixHandlers[i].getHandlerClass() + "' must not be null" ); continue; } Object o = prefixClass.newInstance(); if ( !( o instanceof RequestParameterHandler ) ) { _log.warn( "The class '" + prefixHandlers[i].getHandlerClass() + "' must be an instance of RequestParameterHandler" ); continue; } ProcessPopulate.registerPrefixHandler( name, ( RequestParameterHandler ) o ); } catch ( ClassNotFoundException e ) { _log.warn( "Class '" + prefixHandlers[i].getHandlerClass() + "' not found", e ); } catch ( IllegalAccessException e ) { _log.warn( "Illegal access on Class '" + prefixHandlers[i].getHandlerClass() + "'", e ); } catch ( InstantiationException e ) { _log.warn( "InstantiationException on Class '" + prefixHandlers[i].getHandlerClass() + "'", e.getCause() ); } } }
[ "private", "static", "void", "initPrefixHandlers", "(", ")", "{", "PrefixHandlerConfig", "[", "]", "prefixHandlers", "=", "ConfigUtil", ".", "getConfig", "(", ")", ".", "getPrefixHandlers", "(", ")", ";", "if", "(", "prefixHandlers", "==", "null", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "prefixHandlers", ".", "length", ";", "i", "++", ")", "{", "try", "{", "Class", "prefixClass", "=", "Class", ".", "forName", "(", "prefixHandlers", "[", "i", "]", ".", "getHandlerClass", "(", ")", ")", ";", "String", "name", "=", "prefixHandlers", "[", "i", "]", ".", "getName", "(", ")", ";", "if", "(", "name", "==", "null", "||", "name", ".", "equals", "(", "\"\"", ")", ")", "{", "_log", ".", "warn", "(", "\"The name for the prefix handler '\"", "+", "prefixHandlers", "[", "i", "]", ".", "getHandlerClass", "(", ")", "+", "\"' must not be null\"", ")", ";", "continue", ";", "}", "Object", "o", "=", "prefixClass", ".", "newInstance", "(", ")", ";", "if", "(", "!", "(", "o", "instanceof", "RequestParameterHandler", ")", ")", "{", "_log", ".", "warn", "(", "\"The class '\"", "+", "prefixHandlers", "[", "i", "]", ".", "getHandlerClass", "(", ")", "+", "\"' must be an instance of RequestParameterHandler\"", ")", ";", "continue", ";", "}", "ProcessPopulate", ".", "registerPrefixHandler", "(", "name", ",", "(", "RequestParameterHandler", ")", "o", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "_log", ".", "warn", "(", "\"Class '\"", "+", "prefixHandlers", "[", "i", "]", ".", "getHandlerClass", "(", ")", "+", "\"' not found\"", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "_log", ".", "warn", "(", "\"Illegal access on Class '\"", "+", "prefixHandlers", "[", "i", "]", ".", "getHandlerClass", "(", ")", "+", "\"'\"", ",", "e", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "_log", ".", "warn", "(", "\"InstantiationException on Class '\"", "+", "prefixHandlers", "[", "i", "]", ".", "getHandlerClass", "(", ")", "+", "\"'\"", ",", "e", ".", "getCause", "(", ")", ")", ";", "}", "}", "}" ]
This method will initialize all of the PrefixHandlers registered in the netui config. The prefix handlers are registered with ProcessPopulate and are typically implemented as public inner classes in the tags that require prefix handlers.
[ "This", "method", "will", "initialize", "all", "of", "the", "PrefixHandlers", "registered", "in", "the", "netui", "config", ".", "The", "prefix", "handlers", "are", "registered", "with", "ProcessPopulate", "and", "are", "typically", "implemented", "as", "public", "inner", "classes", "in", "the", "tags", "that", "require", "prefix", "handlers", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/PageFlowInitialization.java#L113-L156
147,004
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java
Select.evaluateDefaultValue
protected Object evaluateDefaultValue() throws JspException { Object val = _defaultValue; List defaults = null; if (val instanceof String) { defaults = new ArrayList(); defaults.add(val); } else { Iterator optionsIterator = null; optionsIterator = IteratorFactory.createIterator(val); // default value is optional so only warn if (optionsIterator == null && _defaultValue != null) logger.warn(Bundle.getString("Tags_IteratorError", new Object[]{getTagName(), "defaultValue", _defaultValue})); if (optionsIterator == null) optionsIterator = IteratorFactory.EMPTY_ITERATOR; defaults = new ArrayList(); while (optionsIterator.hasNext()) { Object o = optionsIterator.next(); defaults.add(o.toString()); } } return defaults; }
java
protected Object evaluateDefaultValue() throws JspException { Object val = _defaultValue; List defaults = null; if (val instanceof String) { defaults = new ArrayList(); defaults.add(val); } else { Iterator optionsIterator = null; optionsIterator = IteratorFactory.createIterator(val); // default value is optional so only warn if (optionsIterator == null && _defaultValue != null) logger.warn(Bundle.getString("Tags_IteratorError", new Object[]{getTagName(), "defaultValue", _defaultValue})); if (optionsIterator == null) optionsIterator = IteratorFactory.EMPTY_ITERATOR; defaults = new ArrayList(); while (optionsIterator.hasNext()) { Object o = optionsIterator.next(); defaults.add(o.toString()); } } return defaults; }
[ "protected", "Object", "evaluateDefaultValue", "(", ")", "throws", "JspException", "{", "Object", "val", "=", "_defaultValue", ";", "List", "defaults", "=", "null", ";", "if", "(", "val", "instanceof", "String", ")", "{", "defaults", "=", "new", "ArrayList", "(", ")", ";", "defaults", ".", "add", "(", "val", ")", ";", "}", "else", "{", "Iterator", "optionsIterator", "=", "null", ";", "optionsIterator", "=", "IteratorFactory", ".", "createIterator", "(", "val", ")", ";", "// default value is optional so only warn", "if", "(", "optionsIterator", "==", "null", "&&", "_defaultValue", "!=", "null", ")", "logger", ".", "warn", "(", "Bundle", ".", "getString", "(", "\"Tags_IteratorError\"", ",", "new", "Object", "[", "]", "{", "getTagName", "(", ")", ",", "\"defaultValue\"", ",", "_defaultValue", "}", ")", ")", ";", "if", "(", "optionsIterator", "==", "null", ")", "optionsIterator", "=", "IteratorFactory", ".", "EMPTY_ITERATOR", ";", "defaults", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "optionsIterator", ".", "hasNext", "(", ")", ")", "{", "Object", "o", "=", "optionsIterator", ".", "next", "(", ")", ";", "defaults", ".", "add", "(", "o", ".", "toString", "(", ")", ")", ";", "}", "}", "return", "defaults", ";", "}" ]
Evaluate the defaultValues
[ "Evaluate", "the", "defaultValues" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java#L456-L486
147,005
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java
Select.doStartTag
public int doStartTag() throws JspException { Object val = evaluateDataSource(); _defaultSelections = (List) evaluateDefaultValue(); // if there were expression errors report them if (hasErrors()) return SKIP_BODY; buildMatch(val); if (hasErrors()) return SKIP_BODY; _formatters = new ArrayList(); _optionList = new ArrayList(); // Walk the options data source _dynamicOptions = evaluateOptionsDataSource(); if (_repeater) { _repCurStage = _order[0]; boolean valid = doRepeaterAfterBody(); if (!valid) return SKIP_BODY; DataAccessProviderStack.addDataAccessProvider(this, pageContext); } // Continue processing this page return EVAL_BODY_BUFFERED; }
java
public int doStartTag() throws JspException { Object val = evaluateDataSource(); _defaultSelections = (List) evaluateDefaultValue(); // if there were expression errors report them if (hasErrors()) return SKIP_BODY; buildMatch(val); if (hasErrors()) return SKIP_BODY; _formatters = new ArrayList(); _optionList = new ArrayList(); // Walk the options data source _dynamicOptions = evaluateOptionsDataSource(); if (_repeater) { _repCurStage = _order[0]; boolean valid = doRepeaterAfterBody(); if (!valid) return SKIP_BODY; DataAccessProviderStack.addDataAccessProvider(this, pageContext); } // Continue processing this page return EVAL_BODY_BUFFERED; }
[ "public", "int", "doStartTag", "(", ")", "throws", "JspException", "{", "Object", "val", "=", "evaluateDataSource", "(", ")", ";", "_defaultSelections", "=", "(", "List", ")", "evaluateDefaultValue", "(", ")", ";", "// if there were expression errors report them", "if", "(", "hasErrors", "(", ")", ")", "return", "SKIP_BODY", ";", "buildMatch", "(", "val", ")", ";", "if", "(", "hasErrors", "(", ")", ")", "return", "SKIP_BODY", ";", "_formatters", "=", "new", "ArrayList", "(", ")", ";", "_optionList", "=", "new", "ArrayList", "(", ")", ";", "// Walk the options data source", "_dynamicOptions", "=", "evaluateOptionsDataSource", "(", ")", ";", "if", "(", "_repeater", ")", "{", "_repCurStage", "=", "_order", "[", "0", "]", ";", "boolean", "valid", "=", "doRepeaterAfterBody", "(", ")", ";", "if", "(", "!", "valid", ")", "return", "SKIP_BODY", ";", "DataAccessProviderStack", ".", "addDataAccessProvider", "(", "this", ",", "pageContext", ")", ";", "}", "// Continue processing this page", "return", "EVAL_BODY_BUFFERED", ";", "}" ]
Render the beginning of this select. @throws JspException if a JSP exception has occurred
[ "Render", "the", "beginning", "of", "this", "select", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java#L778-L807
147,006
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java
Select.buildMatch
private void buildMatch(Object val) { // create the match data if (val != null) { if (val instanceof String) { _match = new String[]{(String) val}; } else if (val instanceof String[]) { String[] s = (String[]) val; int cnt = 0; for (int i = 0; i < s.length; i++) { if (s[i] != null) cnt++; } if (cnt == s.length) _match = s; else { if (cnt > 0) { _match = new String[cnt]; cnt = 0; for (int i = 0; i < s.length; i++) { if (s[i] != null) { _match[cnt++] = s[i]; } } } } } else { Iterator matchIterator = null; // val is never null so this would be an error matchIterator = IteratorFactory.createIterator(val); if (matchIterator == null) { matchIterator = IteratorFactory.EMPTY_ITERATOR; } ArrayList matchList = new ArrayList(); while (matchIterator.hasNext()) { Object o = matchIterator.next(); if (o == null) continue; matchList.add(o); } int size = matchList.size(); _match = new String[size]; for (int i = 0; i < size; i++) { assert (matchList.get(i) != null); assert (matchList.get(i).toString() != null); _match[i] = matchList.get(i).toString(); } } if (logger.isDebugEnabled()) { logger.debug("****** Select Matches ******"); if (_match != null) { for (int i = 0; i < _match.length; i++) { logger.debug(i + ": " + _match[i]); } } } } else { if (_nullable && !isMultiple() && (_defaultSelections == null || _defaultSelections.size() == 0)) { _match = new String[]{NULL_VALUE}; } } }
java
private void buildMatch(Object val) { // create the match data if (val != null) { if (val instanceof String) { _match = new String[]{(String) val}; } else if (val instanceof String[]) { String[] s = (String[]) val; int cnt = 0; for (int i = 0; i < s.length; i++) { if (s[i] != null) cnt++; } if (cnt == s.length) _match = s; else { if (cnt > 0) { _match = new String[cnt]; cnt = 0; for (int i = 0; i < s.length; i++) { if (s[i] != null) { _match[cnt++] = s[i]; } } } } } else { Iterator matchIterator = null; // val is never null so this would be an error matchIterator = IteratorFactory.createIterator(val); if (matchIterator == null) { matchIterator = IteratorFactory.EMPTY_ITERATOR; } ArrayList matchList = new ArrayList(); while (matchIterator.hasNext()) { Object o = matchIterator.next(); if (o == null) continue; matchList.add(o); } int size = matchList.size(); _match = new String[size]; for (int i = 0; i < size; i++) { assert (matchList.get(i) != null); assert (matchList.get(i).toString() != null); _match[i] = matchList.get(i).toString(); } } if (logger.isDebugEnabled()) { logger.debug("****** Select Matches ******"); if (_match != null) { for (int i = 0; i < _match.length; i++) { logger.debug(i + ": " + _match[i]); } } } } else { if (_nullable && !isMultiple() && (_defaultSelections == null || _defaultSelections.size() == 0)) { _match = new String[]{NULL_VALUE}; } } }
[ "private", "void", "buildMatch", "(", "Object", "val", ")", "{", "// create the match data", "if", "(", "val", "!=", "null", ")", "{", "if", "(", "val", "instanceof", "String", ")", "{", "_match", "=", "new", "String", "[", "]", "{", "(", "String", ")", "val", "}", ";", "}", "else", "if", "(", "val", "instanceof", "String", "[", "]", ")", "{", "String", "[", "]", "s", "=", "(", "String", "[", "]", ")", "val", ";", "int", "cnt", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", ";", "i", "++", ")", "{", "if", "(", "s", "[", "i", "]", "!=", "null", ")", "cnt", "++", ";", "}", "if", "(", "cnt", "==", "s", ".", "length", ")", "_match", "=", "s", ";", "else", "{", "if", "(", "cnt", ">", "0", ")", "{", "_match", "=", "new", "String", "[", "cnt", "]", ";", "cnt", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", ";", "i", "++", ")", "{", "if", "(", "s", "[", "i", "]", "!=", "null", ")", "{", "_match", "[", "cnt", "++", "]", "=", "s", "[", "i", "]", ";", "}", "}", "}", "}", "}", "else", "{", "Iterator", "matchIterator", "=", "null", ";", "// val is never null so this would be an error", "matchIterator", "=", "IteratorFactory", ".", "createIterator", "(", "val", ")", ";", "if", "(", "matchIterator", "==", "null", ")", "{", "matchIterator", "=", "IteratorFactory", ".", "EMPTY_ITERATOR", ";", "}", "ArrayList", "matchList", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "matchIterator", ".", "hasNext", "(", ")", ")", "{", "Object", "o", "=", "matchIterator", ".", "next", "(", ")", ";", "if", "(", "o", "==", "null", ")", "continue", ";", "matchList", ".", "add", "(", "o", ")", ";", "}", "int", "size", "=", "matchList", ".", "size", "(", ")", ";", "_match", "=", "new", "String", "[", "size", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "assert", "(", "matchList", ".", "get", "(", "i", ")", "!=", "null", ")", ";", "assert", "(", "matchList", ".", "get", "(", "i", ")", ".", "toString", "(", ")", "!=", "null", ")", ";", "_match", "[", "i", "]", "=", "matchList", ".", "get", "(", "i", ")", ".", "toString", "(", ")", ";", "}", "}", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"****** Select Matches ******\"", ")", ";", "if", "(", "_match", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_match", ".", "length", ";", "i", "++", ")", "{", "logger", ".", "debug", "(", "i", "+", "\": \"", "+", "_match", "[", "i", "]", ")", ";", "}", "}", "}", "}", "else", "{", "if", "(", "_nullable", "&&", "!", "isMultiple", "(", ")", "&&", "(", "_defaultSelections", "==", "null", "||", "_defaultSelections", ".", "size", "(", ")", "==", "0", ")", ")", "{", "_match", "=", "new", "String", "[", "]", "{", "NULL_VALUE", "}", ";", "}", "}", "}" ]
This method builds the list of selected items so that they can be marked as selected. @param val The <code>dataSource</code>
[ "This", "method", "builds", "the", "list", "of", "selected", "items", "so", "that", "they", "can", "be", "marked", "as", "selected", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java#L1125-L1191
147,007
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java
Select.addDefaultsIfNeeded
private void addDefaultsIfNeeded(ServletRequest req) throws JspException { if (_defaultSelections != null) { Iterator iterator = _defaultSelections.iterator(); while (iterator.hasNext()) { Object selection = iterator.next(); if (!_optionList.contains(selection)) { addOption(req, selection.toString(), selection.toString()); } } } }
java
private void addDefaultsIfNeeded(ServletRequest req) throws JspException { if (_defaultSelections != null) { Iterator iterator = _defaultSelections.iterator(); while (iterator.hasNext()) { Object selection = iterator.next(); if (!_optionList.contains(selection)) { addOption(req, selection.toString(), selection.toString()); } } } }
[ "private", "void", "addDefaultsIfNeeded", "(", "ServletRequest", "req", ")", "throws", "JspException", "{", "if", "(", "_defaultSelections", "!=", "null", ")", "{", "Iterator", "iterator", "=", "_defaultSelections", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Object", "selection", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "!", "_optionList", ".", "contains", "(", "selection", ")", ")", "{", "addOption", "(", "req", ",", "selection", ".", "toString", "(", ")", ",", "selection", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "}" ]
add the default values specified in the tag if they are needed.
[ "add", "the", "default", "values", "specified", "in", "the", "tag", "if", "they", "are", "needed", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java#L1194-L1206
147,008
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java
Select.addDatasourceIfNeeded
private void addDatasourceIfNeeded(ServletRequest req) throws JspException { if (_match == null) return; for (int i = 0; i < _match.length; i++) { if (!_optionList.contains(_match[i])) { if (!_match[i].equals(NULL_VALUE)) addOption(req, _match[i], _match[i]); } } }
java
private void addDatasourceIfNeeded(ServletRequest req) throws JspException { if (_match == null) return; for (int i = 0; i < _match.length; i++) { if (!_optionList.contains(_match[i])) { if (!_match[i].equals(NULL_VALUE)) addOption(req, _match[i], _match[i]); } } }
[ "private", "void", "addDatasourceIfNeeded", "(", "ServletRequest", "req", ")", "throws", "JspException", "{", "if", "(", "_match", "==", "null", ")", "return", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_match", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "_optionList", ".", "contains", "(", "_match", "[", "i", "]", ")", ")", "{", "if", "(", "!", "_match", "[", "i", "]", ".", "equals", "(", "NULL_VALUE", ")", ")", "addOption", "(", "req", ",", "_match", "[", "i", "]", ",", "_match", "[", "i", "]", ")", ";", "}", "}", "}" ]
add dthe datasource values if needed.
[ "add", "dthe", "datasource", "values", "if", "needed", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Select.java#L1214-L1226
147,009
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/info/impl/XTimeBoundsImpl.java
XTimeBoundsImpl.register
public void register(XEvent event) { Date date = XTimeExtension.instance().extractTimestamp(event); if(date != null) { register(date); } }
java
public void register(XEvent event) { Date date = XTimeExtension.instance().extractTimestamp(event); if(date != null) { register(date); } }
[ "public", "void", "register", "(", "XEvent", "event", ")", "{", "Date", "date", "=", "XTimeExtension", ".", "instance", "(", ")", ".", "extractTimestamp", "(", "event", ")", ";", "if", "(", "date", "!=", "null", ")", "{", "register", "(", "date", ")", ";", "}", "}" ]
Registers the given event, i.e. if it has a timestamp, the timestamp boundaries will be potentially adjusted to accomodate for inclusion of this event. @param event Event to be registered.
[ "Registers", "the", "given", "event", "i", ".", "e", ".", "if", "it", "has", "a", "timestamp", "the", "timestamp", "boundaries", "will", "be", "potentially", "adjusted", "to", "accomodate", "for", "inclusion", "of", "this", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/info/impl/XTimeBoundsImpl.java#L112-L117
147,010
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/info/impl/XTimeBoundsImpl.java
XTimeBoundsImpl.register
public void register(Date date) { if(date != null) { if(first == null) { // initialization first = date; last = date; } else if(date.before(first)) { first = date; } else if(date.after(last)) { last = date; } } }
java
public void register(Date date) { if(date != null) { if(first == null) { // initialization first = date; last = date; } else if(date.before(first)) { first = date; } else if(date.after(last)) { last = date; } } }
[ "public", "void", "register", "(", "Date", "date", ")", "{", "if", "(", "date", "!=", "null", ")", "{", "if", "(", "first", "==", "null", ")", "{", "// initialization", "first", "=", "date", ";", "last", "=", "date", ";", "}", "else", "if", "(", "date", ".", "before", "(", "first", ")", ")", "{", "first", "=", "date", ";", "}", "else", "if", "(", "date", ".", "after", "(", "last", ")", ")", "{", "last", "=", "date", ";", "}", "}", "}" ]
Registers the given date. The timestamp boundaries will be potentially adjusted to accomodate for inclusion of this date. @param date Date to be registered.
[ "Registers", "the", "given", "date", ".", "The", "timestamp", "boundaries", "will", "be", "potentially", "adjusted", "to", "accomodate", "for", "inclusion", "of", "this", "date", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/info/impl/XTimeBoundsImpl.java#L125-L137
147,011
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/TextBox.java
TextBox.doEndTag
public int doEndTag() throws JspException { ServletRequest req = pageContext.getRequest(); // Create an appropriate "input" element based on our parameters if (_password) { _state.type = INPUT_PASSWORD; } else { _state.type = INPUT_TEXT; } // Create the state for the input tag ByRef ref = new ByRef(); nameHtmlControl(_state, ref); _state.disabled = isDisabled(); // Create the text value of the TextBox Object textObject = evaluateDataSource(); if ((textObject == null) || (textObject.toString().length() == 0)) { textObject = _defaultValue; } // Get the text value for the textbox, the result String text = null; if (textObject != null) { text = formatText(textObject); InternalStringBuilder sb = new InternalStringBuilder(text.length() + 16); StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb); HtmlUtils.filter(text, sbAppend); text = sb.toString(); } _state.value = text; // if there were format errors then report them if (_formatErrors) { if (bodyContent != null) { String value = bodyContent.getString().trim(); bodyContent.clearBody(); write(value); } } if (hasErrors()) return reportAndExit(EVAL_PAGE); // create the input tag. WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_TEXT_TAG, req); assert(br != null); br.doStartTag(writer, _state); br.doEndTag(writer); // write any script that needs to be written if (!ref.isNull()) write((String) ref.getRef()); localRelease(); return EVAL_PAGE; }
java
public int doEndTag() throws JspException { ServletRequest req = pageContext.getRequest(); // Create an appropriate "input" element based on our parameters if (_password) { _state.type = INPUT_PASSWORD; } else { _state.type = INPUT_TEXT; } // Create the state for the input tag ByRef ref = new ByRef(); nameHtmlControl(_state, ref); _state.disabled = isDisabled(); // Create the text value of the TextBox Object textObject = evaluateDataSource(); if ((textObject == null) || (textObject.toString().length() == 0)) { textObject = _defaultValue; } // Get the text value for the textbox, the result String text = null; if (textObject != null) { text = formatText(textObject); InternalStringBuilder sb = new InternalStringBuilder(text.length() + 16); StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb); HtmlUtils.filter(text, sbAppend); text = sb.toString(); } _state.value = text; // if there were format errors then report them if (_formatErrors) { if (bodyContent != null) { String value = bodyContent.getString().trim(); bodyContent.clearBody(); write(value); } } if (hasErrors()) return reportAndExit(EVAL_PAGE); // create the input tag. WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_TEXT_TAG, req); assert(br != null); br.doStartTag(writer, _state); br.doEndTag(writer); // write any script that needs to be written if (!ref.isNull()) write((String) ref.getRef()); localRelease(); return EVAL_PAGE; }
[ "public", "int", "doEndTag", "(", ")", "throws", "JspException", "{", "ServletRequest", "req", "=", "pageContext", ".", "getRequest", "(", ")", ";", "// Create an appropriate \"input\" element based on our parameters", "if", "(", "_password", ")", "{", "_state", ".", "type", "=", "INPUT_PASSWORD", ";", "}", "else", "{", "_state", ".", "type", "=", "INPUT_TEXT", ";", "}", "// Create the state for the input tag", "ByRef", "ref", "=", "new", "ByRef", "(", ")", ";", "nameHtmlControl", "(", "_state", ",", "ref", ")", ";", "_state", ".", "disabled", "=", "isDisabled", "(", ")", ";", "// Create the text value of the TextBox", "Object", "textObject", "=", "evaluateDataSource", "(", ")", ";", "if", "(", "(", "textObject", "==", "null", ")", "||", "(", "textObject", ".", "toString", "(", ")", ".", "length", "(", ")", "==", "0", ")", ")", "{", "textObject", "=", "_defaultValue", ";", "}", "// Get the text value for the textbox, the result", "String", "text", "=", "null", ";", "if", "(", "textObject", "!=", "null", ")", "{", "text", "=", "formatText", "(", "textObject", ")", ";", "InternalStringBuilder", "sb", "=", "new", "InternalStringBuilder", "(", "text", ".", "length", "(", ")", "+", "16", ")", ";", "StringBuilderRenderAppender", "sbAppend", "=", "new", "StringBuilderRenderAppender", "(", "sb", ")", ";", "HtmlUtils", ".", "filter", "(", "text", ",", "sbAppend", ")", ";", "text", "=", "sb", ".", "toString", "(", ")", ";", "}", "_state", ".", "value", "=", "text", ";", "// if there were format errors then report them", "if", "(", "_formatErrors", ")", "{", "if", "(", "bodyContent", "!=", "null", ")", "{", "String", "value", "=", "bodyContent", ".", "getString", "(", ")", ".", "trim", "(", ")", ";", "bodyContent", ".", "clearBody", "(", ")", ";", "write", "(", "value", ")", ";", "}", "}", "if", "(", "hasErrors", "(", ")", ")", "return", "reportAndExit", "(", "EVAL_PAGE", ")", ";", "// create the input tag.", "WriteRenderAppender", "writer", "=", "new", "WriteRenderAppender", "(", "pageContext", ")", ";", "TagRenderingBase", "br", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "INPUT_TEXT_TAG", ",", "req", ")", ";", "assert", "(", "br", "!=", "null", ")", ";", "br", ".", "doStartTag", "(", "writer", ",", "_state", ")", ";", "br", ".", "doEndTag", "(", "writer", ")", ";", "// write any script that needs to be written", "if", "(", "!", "ref", ".", "isNull", "(", ")", ")", "write", "(", "(", "String", ")", "ref", ".", "getRef", "(", ")", ")", ";", "localRelease", "(", ")", ";", "return", "EVAL_PAGE", ";", "}" ]
Render the TextBox. @throws JspException if a JSP exception has occurred
[ "Render", "the", "TextBox", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/TextBox.java#L244-L306
147,012
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java
ServletUtils.dumpRequest
public static void dumpRequest( ServletRequest request, PrintStream output ) { if ( output == null ) { output = System.err; } output.println( "*** ServletRequest " + request ); if ( request instanceof HttpServletRequest ) { output.println( " uri = " + ( ( HttpServletRequest ) request ).getRequestURI() ); } for ( Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " parameter " + name + " = " + request.getParameter( name ) ); } for ( Enumeration e = request.getAttributeNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " attribute " + name + " = " + request.getAttribute( name ) ); } if ( request instanceof HttpServletRequest ) { HttpSession session = ( ( HttpServletRequest ) request ).getSession( false ); if ( session != null ) { for ( Enumeration e = session.getAttributeNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " session attribute " + name + " = " + session.getAttribute( name ) ); } } } }
java
public static void dumpRequest( ServletRequest request, PrintStream output ) { if ( output == null ) { output = System.err; } output.println( "*** ServletRequest " + request ); if ( request instanceof HttpServletRequest ) { output.println( " uri = " + ( ( HttpServletRequest ) request ).getRequestURI() ); } for ( Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " parameter " + name + " = " + request.getParameter( name ) ); } for ( Enumeration e = request.getAttributeNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " attribute " + name + " = " + request.getAttribute( name ) ); } if ( request instanceof HttpServletRequest ) { HttpSession session = ( ( HttpServletRequest ) request ).getSession( false ); if ( session != null ) { for ( Enumeration e = session.getAttributeNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " session attribute " + name + " = " + session.getAttribute( name ) ); } } } }
[ "public", "static", "void", "dumpRequest", "(", "ServletRequest", "request", ",", "PrintStream", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "System", ".", "err", ";", "}", "output", ".", "println", "(", "\"*** ServletRequest \"", "+", "request", ")", ";", "if", "(", "request", "instanceof", "HttpServletRequest", ")", "{", "output", ".", "println", "(", "\" uri = \"", "+", "(", "(", "HttpServletRequest", ")", "request", ")", ".", "getRequestURI", "(", ")", ")", ";", "}", "for", "(", "Enumeration", "e", "=", "request", ".", "getParameterNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "name", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "output", ".", "println", "(", "\" parameter \"", "+", "name", "+", "\" = \"", "+", "request", ".", "getParameter", "(", "name", ")", ")", ";", "}", "for", "(", "Enumeration", "e", "=", "request", ".", "getAttributeNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "name", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "output", ".", "println", "(", "\" attribute \"", "+", "name", "+", "\" = \"", "+", "request", ".", "getAttribute", "(", "name", ")", ")", ";", "}", "if", "(", "request", "instanceof", "HttpServletRequest", ")", "{", "HttpSession", "session", "=", "(", "(", "HttpServletRequest", ")", "request", ")", ".", "getSession", "(", "false", ")", ";", "if", "(", "session", "!=", "null", ")", "{", "for", "(", "Enumeration", "e", "=", "session", ".", "getAttributeNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "name", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "output", ".", "println", "(", "\" session attribute \"", "+", "name", "+", "\" = \"", "+", "session", ".", "getAttribute", "(", "name", ")", ")", ";", "}", "}", "}", "}" ]
Print parameters and attributes in the given request. @param request the current HttpServletRequest. @param output a PrintStream to which to output request parameters and request/session attributes; if <code>null</null>, <code>System.err</code> is used.
[ "Print", "parameters", "and", "attributes", "in", "the", "given", "request", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java#L47-L86
147,013
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java
ServletUtils.dumpServletContext
public static void dumpServletContext( ServletContext context, PrintStream output ) { if ( output == null ) { output = System.err; } output.println( "*** ServletContext " + context ); for ( Enumeration e = context.getAttributeNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " attribute " + name + " = " + context.getAttribute( name ) ); } }
java
public static void dumpServletContext( ServletContext context, PrintStream output ) { if ( output == null ) { output = System.err; } output.println( "*** ServletContext " + context ); for ( Enumeration e = context.getAttributeNames(); e.hasMoreElements(); ) { String name = ( String ) e.nextElement(); output.println( " attribute " + name + " = " + context.getAttribute( name ) ); } }
[ "public", "static", "void", "dumpServletContext", "(", "ServletContext", "context", ",", "PrintStream", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "System", ".", "err", ";", "}", "output", ".", "println", "(", "\"*** ServletContext \"", "+", "context", ")", ";", "for", "(", "Enumeration", "e", "=", "context", ".", "getAttributeNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "name", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "output", ".", "println", "(", "\" attribute \"", "+", "name", "+", "\" = \"", "+", "context", ".", "getAttribute", "(", "name", ")", ")", ";", "}", "}" ]
Print attributes in the given ServletContext. @param context the current ServletContext. @param output a PrintStream to which to output ServletContext attributes; if <code>null</null>, <code>System.err</code> is used.
[ "Print", "attributes", "in", "the", "given", "ServletContext", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java#L96-L110
147,014
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java
ServletUtils.preventCache
public static void preventCache( ServletResponse response ) { if ( response instanceof HttpServletResponse ) { HttpServletResponse httpResponse = ( HttpServletResponse ) response; httpResponse.setHeader( "Pragma", "No-cache" ); httpResponse.setHeader( "Cache-Control", "no-cache,no-store,max-age=0" ); httpResponse.setDateHeader( "Expires", 1 ); } }
java
public static void preventCache( ServletResponse response ) { if ( response instanceof HttpServletResponse ) { HttpServletResponse httpResponse = ( HttpServletResponse ) response; httpResponse.setHeader( "Pragma", "No-cache" ); httpResponse.setHeader( "Cache-Control", "no-cache,no-store,max-age=0" ); httpResponse.setDateHeader( "Expires", 1 ); } }
[ "public", "static", "void", "preventCache", "(", "ServletResponse", "response", ")", "{", "if", "(", "response", "instanceof", "HttpServletResponse", ")", "{", "HttpServletResponse", "httpResponse", "=", "(", "HttpServletResponse", ")", "response", ";", "httpResponse", ".", "setHeader", "(", "\"Pragma\"", ",", "\"No-cache\"", ")", ";", "httpResponse", ".", "setHeader", "(", "\"Cache-Control\"", ",", "\"no-cache,no-store,max-age=0\"", ")", ";", "httpResponse", ".", "setDateHeader", "(", "\"Expires\"", ",", "1", ")", ";", "}", "}" ]
Set response headers to prevent caching of the response by the browser. @param response the current ServletResponse
[ "Set", "response", "headers", "to", "prevent", "caching", "of", "the", "response", "by", "the", "browser", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java#L117-L126
147,015
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java
ServletUtils.getBaseName
public static String getBaseName( String uri ) { int lastSlash = uri.lastIndexOf( '/' ); assert lastSlash != -1 : uri; assert lastSlash < uri.length() - 1 : "URI must not end with a slash: " + uri; return uri.substring( lastSlash + 1 ); }
java
public static String getBaseName( String uri ) { int lastSlash = uri.lastIndexOf( '/' ); assert lastSlash != -1 : uri; assert lastSlash < uri.length() - 1 : "URI must not end with a slash: " + uri; return uri.substring( lastSlash + 1 ); }
[ "public", "static", "String", "getBaseName", "(", "String", "uri", ")", "{", "int", "lastSlash", "=", "uri", ".", "lastIndexOf", "(", "'", "'", ")", ";", "assert", "lastSlash", "!=", "-", "1", ":", "uri", ";", "assert", "lastSlash", "<", "uri", ".", "length", "(", ")", "-", "1", ":", "\"URI must not end with a slash: \"", "+", "uri", ";", "return", "uri", ".", "substring", "(", "lastSlash", "+", "1", ")", ";", "}" ]
Get the base filename of the given URI. @param uri the URI from which to get the base filename. @return a String containing everything after the last slash of the given URI.
[ "Get", "the", "base", "filename", "of", "the", "given", "URI", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java#L134-L140
147,016
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java
ServletUtils.getDirName
public static String getDirName( String uri ) { int lastSlash = uri.lastIndexOf( '/' ); assert lastSlash != -1 : uri; assert uri.length() > 1 : uri; assert lastSlash < uri.length() - 1 : "URI must not end with a slash: " + uri; return uri.substring( 0, lastSlash ); }
java
public static String getDirName( String uri ) { int lastSlash = uri.lastIndexOf( '/' ); assert lastSlash != -1 : uri; assert uri.length() > 1 : uri; assert lastSlash < uri.length() - 1 : "URI must not end with a slash: " + uri; return uri.substring( 0, lastSlash ); }
[ "public", "static", "String", "getDirName", "(", "String", "uri", ")", "{", "int", "lastSlash", "=", "uri", ".", "lastIndexOf", "(", "'", "'", ")", ";", "assert", "lastSlash", "!=", "-", "1", ":", "uri", ";", "assert", "uri", ".", "length", "(", ")", ">", "1", ":", "uri", ";", "assert", "lastSlash", "<", "uri", ".", "length", "(", ")", "-", "1", ":", "\"URI must not end with a slash: \"", "+", "uri", ";", "return", "uri", ".", "substring", "(", "0", ",", "lastSlash", ")", ";", "}" ]
Get the directory path of the given URI. @param uri the URI from which to get the directory path. @return a String containing everything before the last slash of the given URI.
[ "Get", "the", "directory", "path", "of", "the", "given", "URI", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/ServletUtils.java#L148-L155
147,017
tootedom/related
app/web/indexing/src/main/java/org/greencheek/related/indexing/web/RelatedItemIndexOrderServlet.java
RelatedItemIndexOrderServlet.parseContentLength
private int parseContentLength(int maxPostDataSize, String length) { if(length!=null) { try { int size = Integer.parseInt(length); if(size>maxPostDataSize) return -1; else return size; } catch(NumberFormatException e) { // should never occur. invalid content length i.e. abc, is usually // caught by the container. However, a user could specify a Content-Length with // a value larger than an int max size return -1; } } else { return -2; } }
java
private int parseContentLength(int maxPostDataSize, String length) { if(length!=null) { try { int size = Integer.parseInt(length); if(size>maxPostDataSize) return -1; else return size; } catch(NumberFormatException e) { // should never occur. invalid content length i.e. abc, is usually // caught by the container. However, a user could specify a Content-Length with // a value larger than an int max size return -1; } } else { return -2; } }
[ "private", "int", "parseContentLength", "(", "int", "maxPostDataSize", ",", "String", "length", ")", "{", "if", "(", "length", "!=", "null", ")", "{", "try", "{", "int", "size", "=", "Integer", ".", "parseInt", "(", "length", ")", ";", "if", "(", "size", ">", "maxPostDataSize", ")", "return", "-", "1", ";", "else", "return", "size", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// should never occur. invalid content length i.e. abc, is usually", "// caught by the container. However, a user could specify a Content-Length with", "// a value larger than an int max size", "return", "-", "1", ";", "}", "}", "else", "{", "return", "-", "2", ";", "}", "}" ]
If there is a content length header. Check the reported length, making sure it isn't over the max post data size. @param maxPostDataSize @return -1 if size of post data is too large, or corrupt, -2 if we don't have content length (chunked), or the size (this could be 0)
[ "If", "there", "is", "a", "content", "length", "header", ".", "Check", "the", "reported", "length", "making", "sure", "it", "isn", "t", "over", "the", "max", "post", "data", "size", "." ]
3782dd5a839bbcdc15661d598e8b895aae8aabb7
https://github.com/tootedom/related/blob/3782dd5a839bbcdc15661d598e8b895aae8aabb7/app/web/indexing/src/main/java/org/greencheek/related/indexing/web/RelatedItemIndexOrderServlet.java#L123-L138
147,018
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java
URLRewriterService.getNamePrefix
public static String getNamePrefix( ServletContext servletContext, ServletRequest request, String name ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); InternalStringBuilder prefix = new InternalStringBuilder(); if ( rewriters != null ) { for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); String nextPrefix = rewriter.getNamePrefix( servletContext, request, name ); if ( nextPrefix != null ) { prefix.append( nextPrefix ); } } } return prefix.toString(); }
java
public static String getNamePrefix( ServletContext servletContext, ServletRequest request, String name ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); InternalStringBuilder prefix = new InternalStringBuilder(); if ( rewriters != null ) { for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); String nextPrefix = rewriter.getNamePrefix( servletContext, request, name ); if ( nextPrefix != null ) { prefix.append( nextPrefix ); } } } return prefix.toString(); }
[ "public", "static", "String", "getNamePrefix", "(", "ServletContext", "servletContext", ",", "ServletRequest", "request", ",", "String", "name", ")", "{", "ArrayList", "/*< URLRewriter >*/", "rewriters", "=", "getRewriters", "(", "request", ")", ";", "InternalStringBuilder", "prefix", "=", "new", "InternalStringBuilder", "(", ")", ";", "if", "(", "rewriters", "!=", "null", ")", "{", "for", "(", "Iterator", "i", "=", "rewriters", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "URLRewriter", "rewriter", "=", "(", "URLRewriter", ")", "i", ".", "next", "(", ")", ";", "String", "nextPrefix", "=", "rewriter", ".", "getNamePrefix", "(", "servletContext", ",", "request", ",", "name", ")", ";", "if", "(", "nextPrefix", "!=", "null", ")", "{", "prefix", ".", "append", "(", "nextPrefix", ")", ";", "}", "}", "}", "return", "prefix", ".", "toString", "(", ")", ";", "}" ]
Get the prefix to use when rewriting a query parameter name. Loops through the list of registered URLRewriters to build up a the prefix. @param servletContext the current ServletContext. @param request the current ServletRequest. @param name the name of the query parameter. @return a prefix to use to rewrite a query parameter name.
[ "Get", "the", "prefix", "to", "use", "when", "rewriting", "a", "query", "parameter", "name", ".", "Loops", "through", "the", "list", "of", "registered", "URLRewriters", "to", "build", "up", "a", "the", "prefix", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L69-L86
147,019
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java
URLRewriterService.rewriteURL
public static void rewriteURL( ServletContext servletContext, ServletRequest request, ServletResponse response, MutableURI url, URLType type, boolean needsToBeSecure ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); if ( rewriters != null ) { for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); rewriter.rewriteURL( servletContext, request, response, url, type, needsToBeSecure ); } } if ( url instanceof FreezableMutableURI ) { ( ( FreezableMutableURI ) url ).setFrozen( true ); } }
java
public static void rewriteURL( ServletContext servletContext, ServletRequest request, ServletResponse response, MutableURI url, URLType type, boolean needsToBeSecure ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); if ( rewriters != null ) { for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); rewriter.rewriteURL( servletContext, request, response, url, type, needsToBeSecure ); } } if ( url instanceof FreezableMutableURI ) { ( ( FreezableMutableURI ) url ).setFrozen( true ); } }
[ "public", "static", "void", "rewriteURL", "(", "ServletContext", "servletContext", ",", "ServletRequest", "request", ",", "ServletResponse", "response", ",", "MutableURI", "url", ",", "URLType", "type", ",", "boolean", "needsToBeSecure", ")", "{", "ArrayList", "/*< URLRewriter >*/", "rewriters", "=", "getRewriters", "(", "request", ")", ";", "if", "(", "rewriters", "!=", "null", ")", "{", "for", "(", "Iterator", "i", "=", "rewriters", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "URLRewriter", "rewriter", "=", "(", "URLRewriter", ")", "i", ".", "next", "(", ")", ";", "rewriter", ".", "rewriteURL", "(", "servletContext", ",", "request", ",", "response", ",", "url", ",", "type", ",", "needsToBeSecure", ")", ";", "}", "}", "if", "(", "url", "instanceof", "FreezableMutableURI", ")", "{", "(", "(", "FreezableMutableURI", ")", "url", ")", ".", "setFrozen", "(", "true", ")", ";", "}", "}" ]
Rewrite the given URL, looping through the list of registered URLRewriters. <p> Once the MutableURI has been rewritten, and if it is an instance of {@link FreezableMutableURI}, then this method will set the URI to a frozen state. I.e. immutable. If a user then tries to use a setter method on the rewritten URI, the FreezableMutableURI will throw an IllegalStateException. </p> <p> Note that after the rewritting the caller should run the rewritten URI through the templated URI formatting process as the last step in rewriting. See {@link #getTemplatedURL} </p> @param servletContext the current ServletContext. @param request the current ServletRequest. @param response the current ServletResponse. @param url the URL to be rewritten. @param type the type of URL to be rewritten. This is one of the following values: <ul> <li><code>action</code>: a standard (non-resource) URL <li><code>resource</code>: a resource (e.g., image) URL </ul> @param needsToBeSecure a flag indicating whether the URL should be secure (SSL required) or not @see #registerURLRewriter
[ "Rewrite", "the", "given", "URL", "looping", "through", "the", "list", "of", "registered", "URLRewriters", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L139-L158
147,020
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java
URLRewriterService.dumpURLRewriters
public static void dumpURLRewriters( ServletRequest request, PrintStream output ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); if ( output == null ) output = System.err; output.println( "*** List of URLRewriter objects: " + rewriters ); if ( rewriters != null ) { int count = 0; for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); output.println( " " + count++ + ". " + rewriter.getClass().getName() ); output.println( " allows other rewriters: " + rewriter.allowOtherRewriters() ); output.println( " rewriter: " + rewriter ); } } else { output.println( " No URLRewriter objects are registered with this request." ); } }
java
public static void dumpURLRewriters( ServletRequest request, PrintStream output ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); if ( output == null ) output = System.err; output.println( "*** List of URLRewriter objects: " + rewriters ); if ( rewriters != null ) { int count = 0; for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); output.println( " " + count++ + ". " + rewriter.getClass().getName() ); output.println( " allows other rewriters: " + rewriter.allowOtherRewriters() ); output.println( " rewriter: " + rewriter ); } } else { output.println( " No URLRewriter objects are registered with this request." ); } }
[ "public", "static", "void", "dumpURLRewriters", "(", "ServletRequest", "request", ",", "PrintStream", "output", ")", "{", "ArrayList", "/*< URLRewriter >*/", "rewriters", "=", "getRewriters", "(", "request", ")", ";", "if", "(", "output", "==", "null", ")", "output", "=", "System", ".", "err", ";", "output", ".", "println", "(", "\"*** List of URLRewriter objects: \"", "+", "rewriters", ")", ";", "if", "(", "rewriters", "!=", "null", ")", "{", "int", "count", "=", "0", ";", "for", "(", "Iterator", "i", "=", "rewriters", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "URLRewriter", "rewriter", "=", "(", "URLRewriter", ")", "i", ".", "next", "(", ")", ";", "output", ".", "println", "(", "\" \"", "+", "count", "++", "+", "\". \"", "+", "rewriter", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "output", ".", "println", "(", "\" allows other rewriters: \"", "+", "rewriter", ".", "allowOtherRewriters", "(", ")", ")", ";", "output", ".", "println", "(", "\" rewriter: \"", "+", "rewriter", ")", ";", "}", "}", "else", "{", "output", ".", "println", "(", "\" No URLRewriter objects are registered with this request.\"", ")", ";", "}", "}" ]
Print out information about the chain of URLRewriters in this request. @param request the current HttpServletRequest. @param output a PrintStream to output chain of URLRewriters in this request. If <code>null</null>, <code>System.err</code> is used.
[ "Print", "out", "information", "about", "the", "chain", "of", "URLRewriters", "in", "this", "request", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L355-L377
147,021
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEvent.java
AptEvent.getMethodField
public String getMethodField() { // // Both the event set and event name must be used for the generated field to avoid // conflicts between same-named events in different event sets. // StringBuffer sb = new StringBuffer(); sb.append("_"); sb.append(_eventSet.getShortName()); sb.append("_"); sb.append(getName()); int methodIndex = getIndex(); if (methodIndex != -1) sb.append(methodIndex); sb.append("Event"); return sb.toString(); }
java
public String getMethodField() { // // Both the event set and event name must be used for the generated field to avoid // conflicts between same-named events in different event sets. // StringBuffer sb = new StringBuffer(); sb.append("_"); sb.append(_eventSet.getShortName()); sb.append("_"); sb.append(getName()); int methodIndex = getIndex(); if (methodIndex != -1) sb.append(methodIndex); sb.append("Event"); return sb.toString(); }
[ "public", "String", "getMethodField", "(", ")", "{", "//", "// Both the event set and event name must be used for the generated field to avoid", "// conflicts between same-named events in different event sets.", "//", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "\"_\"", ")", ";", "sb", ".", "append", "(", "_eventSet", ".", "getShortName", "(", ")", ")", ";", "sb", ".", "append", "(", "\"_\"", ")", ";", "sb", ".", "append", "(", "getName", "(", ")", ")", ";", "int", "methodIndex", "=", "getIndex", "(", ")", ";", "if", "(", "methodIndex", "!=", "-", "1", ")", "sb", ".", "append", "(", "methodIndex", ")", ";", "sb", ".", "append", "(", "\"Event\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the name of the static field that holds the name of this method.
[ "Returns", "the", "name", "of", "the", "static", "field", "that", "holds", "the", "name", "of", "this", "method", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEvent.java#L57-L73
147,022
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
InterceptorContext.addInterceptor
protected static Interceptor addInterceptor( InterceptorConfig config, Class baseClassOrInterface, List/*< Interceptor >*/ interceptors ) { Interceptor interceptor = createInterceptor( config, baseClassOrInterface ); if ( interceptor != null ) interceptors.add( interceptor ); return interceptor; }
java
protected static Interceptor addInterceptor( InterceptorConfig config, Class baseClassOrInterface, List/*< Interceptor >*/ interceptors ) { Interceptor interceptor = createInterceptor( config, baseClassOrInterface ); if ( interceptor != null ) interceptors.add( interceptor ); return interceptor; }
[ "protected", "static", "Interceptor", "addInterceptor", "(", "InterceptorConfig", "config", ",", "Class", "baseClassOrInterface", ",", "List", "/*< Interceptor >*/", "interceptors", ")", "{", "Interceptor", "interceptor", "=", "createInterceptor", "(", "config", ",", "baseClassOrInterface", ")", ";", "if", "(", "interceptor", "!=", "null", ")", "interceptors", ".", "add", "(", "interceptor", ")", ";", "return", "interceptor", ";", "}" ]
Instantiates an interceptor, based on the class name in the given InterceptorConfig, and adds it to the given collection of interceptors. @param config the InterceptorConfig used to determine the interceptor class. @param baseClassOrInterface the required base class or interface. May be <code>null</code>. @param interceptors the List of interceptors to which to add. @return an initialized Interceptor, or <code>null</code> if an error occurred.
[ "Instantiates", "an", "interceptor", "based", "on", "the", "class", "name", "in", "the", "given", "InterceptorConfig", "and", "adds", "it", "to", "the", "given", "collection", "of", "interceptors", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java#L104-L112
147,023
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java
InterceptorContext.createInterceptor
protected static Interceptor createInterceptor( InterceptorConfig config, Class baseClassOrInterface ) { assert Interceptor.class.isAssignableFrom( baseClassOrInterface ) : baseClassOrInterface.getName() + " cannot be assigned to " + Interceptor.class.getName(); ClassLoader cl = DiscoveryUtils.getClassLoader(); String className = config.getInterceptorClass(); try { Class interceptorClass = cl.loadClass( className ); if ( ! baseClassOrInterface.isAssignableFrom( interceptorClass ) ) { _log.error( "Interceptor " + interceptorClass.getName() + " does not implement or extend " + baseClassOrInterface.getName() ); return null; } Interceptor interceptor = ( Interceptor ) interceptorClass.newInstance(); interceptor.init( config ); return interceptor; } catch ( ClassNotFoundException e ) { _log.error( "Could not find interceptor class " + className, e ); } catch ( InstantiationException e ) { _log.error( "Could not instantiate interceptor class " + className, e ); } catch ( IllegalAccessException e ) { _log.error( "Could not instantiate interceptor class " + className, e ); } return null; }
java
protected static Interceptor createInterceptor( InterceptorConfig config, Class baseClassOrInterface ) { assert Interceptor.class.isAssignableFrom( baseClassOrInterface ) : baseClassOrInterface.getName() + " cannot be assigned to " + Interceptor.class.getName(); ClassLoader cl = DiscoveryUtils.getClassLoader(); String className = config.getInterceptorClass(); try { Class interceptorClass = cl.loadClass( className ); if ( ! baseClassOrInterface.isAssignableFrom( interceptorClass ) ) { _log.error( "Interceptor " + interceptorClass.getName() + " does not implement or extend " + baseClassOrInterface.getName() ); return null; } Interceptor interceptor = ( Interceptor ) interceptorClass.newInstance(); interceptor.init( config ); return interceptor; } catch ( ClassNotFoundException e ) { _log.error( "Could not find interceptor class " + className, e ); } catch ( InstantiationException e ) { _log.error( "Could not instantiate interceptor class " + className, e ); } catch ( IllegalAccessException e ) { _log.error( "Could not instantiate interceptor class " + className, e ); } return null; }
[ "protected", "static", "Interceptor", "createInterceptor", "(", "InterceptorConfig", "config", ",", "Class", "baseClassOrInterface", ")", "{", "assert", "Interceptor", ".", "class", ".", "isAssignableFrom", "(", "baseClassOrInterface", ")", ":", "baseClassOrInterface", ".", "getName", "(", ")", "+", "\" cannot be assigned to \"", "+", "Interceptor", ".", "class", ".", "getName", "(", ")", ";", "ClassLoader", "cl", "=", "DiscoveryUtils", ".", "getClassLoader", "(", ")", ";", "String", "className", "=", "config", ".", "getInterceptorClass", "(", ")", ";", "try", "{", "Class", "interceptorClass", "=", "cl", ".", "loadClass", "(", "className", ")", ";", "if", "(", "!", "baseClassOrInterface", ".", "isAssignableFrom", "(", "interceptorClass", ")", ")", "{", "_log", ".", "error", "(", "\"Interceptor \"", "+", "interceptorClass", ".", "getName", "(", ")", "+", "\" does not implement or extend \"", "+", "baseClassOrInterface", ".", "getName", "(", ")", ")", ";", "return", "null", ";", "}", "Interceptor", "interceptor", "=", "(", "Interceptor", ")", "interceptorClass", ".", "newInstance", "(", ")", ";", "interceptor", ".", "init", "(", "config", ")", ";", "return", "interceptor", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "_log", ".", "error", "(", "\"Could not find interceptor class \"", "+", "className", ",", "e", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "_log", ".", "error", "(", "\"Could not instantiate interceptor class \"", "+", "className", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "_log", ".", "error", "(", "\"Could not instantiate interceptor class \"", "+", "className", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
Instantiates an interceptor using the class name in the given InterceptorConfig. @param config the {@link InterceptorConfig} used to determine the {@link Interceptor} class. @param baseClassOrInterface the required base class or interface. May be <code>null</code>. @return an initialized Interceptor, or <code>null</code> if an error occurred.
[ "Instantiates", "an", "interceptor", "using", "the", "class", "name", "in", "the", "given", "InterceptorConfig", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorContext.java#L121-L158
147,024
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java
InterceptorChain.continueChain
public Object continueChain() throws InterceptorException { if ( ! _chain.isEmpty() ) { return invoke( ( Interceptor ) _chain.removeFirst() ); } else { return null; } }
java
public Object continueChain() throws InterceptorException { if ( ! _chain.isEmpty() ) { return invoke( ( Interceptor ) _chain.removeFirst() ); } else { return null; } }
[ "public", "Object", "continueChain", "(", ")", "throws", "InterceptorException", "{", "if", "(", "!", "_chain", ".", "isEmpty", "(", ")", ")", "{", "return", "invoke", "(", "(", "Interceptor", ")", "_chain", ".", "removeFirst", "(", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Execute the next interceptor in the chain of interceptors. @return the object returned when the interceptor is invoked @throws InterceptorException the exception thrown if an error occurs while invoking the interceptor
[ "Execute", "the", "next", "interceptor", "in", "the", "chain", "of", "interceptors", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/InterceptorChain.java#L53-L64
147,025
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java
PageFlowTagUtils.isAction
public static boolean isAction(HttpServletRequest request, String action) { FlowController flowController = PageFlowUtils.getCurrentPageFlow(request); if (flowController != null) { if (action.endsWith(PageFlowConstants.ACTION_EXTENSION)) { action = action.substring(0, action.length() - PageFlowConstants.ACTION_EXTENSION.length()); } if (getActionMapping(request, flowController, action) != null) return true; FlowController globalApp = PageFlowUtils.getSharedFlow(InternalConstants.GLOBALAPP_CLASSNAME, request); return getActionMapping(request, globalApp, action) != null; } return true; }
java
public static boolean isAction(HttpServletRequest request, String action) { FlowController flowController = PageFlowUtils.getCurrentPageFlow(request); if (flowController != null) { if (action.endsWith(PageFlowConstants.ACTION_EXTENSION)) { action = action.substring(0, action.length() - PageFlowConstants.ACTION_EXTENSION.length()); } if (getActionMapping(request, flowController, action) != null) return true; FlowController globalApp = PageFlowUtils.getSharedFlow(InternalConstants.GLOBALAPP_CLASSNAME, request); return getActionMapping(request, globalApp, action) != null; } return true; }
[ "public", "static", "boolean", "isAction", "(", "HttpServletRequest", "request", ",", "String", "action", ")", "{", "FlowController", "flowController", "=", "PageFlowUtils", ".", "getCurrentPageFlow", "(", "request", ")", ";", "if", "(", "flowController", "!=", "null", ")", "{", "if", "(", "action", ".", "endsWith", "(", "PageFlowConstants", ".", "ACTION_EXTENSION", ")", ")", "{", "action", "=", "action", ".", "substring", "(", "0", ",", "action", ".", "length", "(", ")", "-", "PageFlowConstants", ".", "ACTION_EXTENSION", ".", "length", "(", ")", ")", ";", "}", "if", "(", "getActionMapping", "(", "request", ",", "flowController", ",", "action", ")", "!=", "null", ")", "return", "true", ";", "FlowController", "globalApp", "=", "PageFlowUtils", ".", "getSharedFlow", "(", "InternalConstants", ".", "GLOBALAPP_CLASSNAME", ",", "request", ")", ";", "return", "getActionMapping", "(", "request", ",", "globalApp", ",", "action", ")", "!=", "null", ";", "}", "return", "true", ";", "}" ]
Determine whether a given URI is an Action. @param request the current HttpServletRequest. @param action the URI to check. @return <code>true</code> if the action is defined in the current page flow or in a shared flow. Otherwise, return <code>false</code>.
[ "Determine", "whether", "a", "given", "URI", "is", "an", "Action", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java#L122-L137
147,026
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java
TagRenderingBase.renderGeneral
protected void renderGeneral(HashMap map, AbstractRenderAppender sb, boolean doubleQuote) { if (map == null) return; Iterator iterator = map.keySet().iterator(); for (; iterator.hasNext();) { String key = (String) iterator.next(); if (key == null) continue; String value = (String) map.get(key); if (doubleQuote) renderAttribute(sb, key, value); else renderAttributeSingleQuotes(sb, key, value); } }
java
protected void renderGeneral(HashMap map, AbstractRenderAppender sb, boolean doubleQuote) { if (map == null) return; Iterator iterator = map.keySet().iterator(); for (; iterator.hasNext();) { String key = (String) iterator.next(); if (key == null) continue; String value = (String) map.get(key); if (doubleQuote) renderAttribute(sb, key, value); else renderAttributeSingleQuotes(sb, key, value); } }
[ "protected", "void", "renderGeneral", "(", "HashMap", "map", ",", "AbstractRenderAppender", "sb", ",", "boolean", "doubleQuote", ")", "{", "if", "(", "map", "==", "null", ")", "return", ";", "Iterator", "iterator", "=", "map", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "for", "(", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "String", "key", "=", "(", "String", ")", "iterator", ".", "next", "(", ")", ";", "if", "(", "key", "==", "null", ")", "continue", ";", "String", "value", "=", "(", "String", ")", "map", ".", "get", "(", "key", ")", ";", "if", "(", "doubleQuote", ")", "renderAttribute", "(", "sb", ",", "key", ",", "value", ")", ";", "else", "renderAttributeSingleQuotes", "(", "sb", ",", "key", ",", "value", ")", ";", "}", "}" ]
This method will render all of the general attributes.
[ "This", "method", "will", "render", "all", "of", "the", "general", "attributes", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java#L248-L265
147,027
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlUtils.java
ControlUtils.getDefaultControlBinding
static String getDefaultControlBinding(Class controlIntf) { controlIntf = getMostDerivedInterface(controlIntf); ControlInterface intfAnnot = (ControlInterface)controlIntf.getAnnotation(ControlInterface.class); String implBinding = intfAnnot.defaultBinding(); implBinding = resolveDefaultBinding( implBinding, controlIntf.getName() ); return implBinding; }
java
static String getDefaultControlBinding(Class controlIntf) { controlIntf = getMostDerivedInterface(controlIntf); ControlInterface intfAnnot = (ControlInterface)controlIntf.getAnnotation(ControlInterface.class); String implBinding = intfAnnot.defaultBinding(); implBinding = resolveDefaultBinding( implBinding, controlIntf.getName() ); return implBinding; }
[ "static", "String", "getDefaultControlBinding", "(", "Class", "controlIntf", ")", "{", "controlIntf", "=", "getMostDerivedInterface", "(", "controlIntf", ")", ";", "ControlInterface", "intfAnnot", "=", "(", "ControlInterface", ")", "controlIntf", ".", "getAnnotation", "(", "ControlInterface", ".", "class", ")", ";", "String", "implBinding", "=", "intfAnnot", ".", "defaultBinding", "(", ")", ";", "implBinding", "=", "resolveDefaultBinding", "(", "implBinding", ",", "controlIntf", ".", "getName", "(", ")", ")", ";", "return", "implBinding", ";", "}" ]
Returns the default binding based entirely upon annotations or naming conventions. @param controlIntf the control interface class @return the class name of the default control implementation binding
[ "Returns", "the", "default", "binding", "based", "entirely", "upon", "annotations", "or", "naming", "conventions", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlUtils.java#L57-L67
147,028
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlUtils.java
ControlUtils.getMostDerivedInterface
static Class getMostDerivedInterface(Class controlIntf) { while (controlIntf.isAnnotationPresent(ControlExtension.class)) { Class [] intfs = controlIntf.getInterfaces(); boolean found = false; for (int i = 0; i < intfs.length; i++) { if (intfs[i].isAnnotationPresent(ControlExtension.class) || intfs[i].isAnnotationPresent(ControlInterface.class)) { controlIntf = intfs[i]; found = true; break; } } if (!found) { throw new ControlException("Can't find base control interface for " + controlIntf); } } return controlIntf; }
java
static Class getMostDerivedInterface(Class controlIntf) { while (controlIntf.isAnnotationPresent(ControlExtension.class)) { Class [] intfs = controlIntf.getInterfaces(); boolean found = false; for (int i = 0; i < intfs.length; i++) { if (intfs[i].isAnnotationPresent(ControlExtension.class) || intfs[i].isAnnotationPresent(ControlInterface.class)) { controlIntf = intfs[i]; found = true; break; } } if (!found) { throw new ControlException("Can't find base control interface for " + controlIntf); } } return controlIntf; }
[ "static", "Class", "getMostDerivedInterface", "(", "Class", "controlIntf", ")", "{", "while", "(", "controlIntf", ".", "isAnnotationPresent", "(", "ControlExtension", ".", "class", ")", ")", "{", "Class", "[", "]", "intfs", "=", "controlIntf", ".", "getInterfaces", "(", ")", ";", "boolean", "found", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "intfs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "intfs", "[", "i", "]", ".", "isAnnotationPresent", "(", "ControlExtension", ".", "class", ")", "||", "intfs", "[", "i", "]", ".", "isAnnotationPresent", "(", "ControlInterface", ".", "class", ")", ")", "{", "controlIntf", "=", "intfs", "[", "i", "]", ";", "found", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "found", ")", "{", "throw", "new", "ControlException", "(", "\"Can't find base control interface for \"", "+", "controlIntf", ")", ";", "}", "}", "return", "controlIntf", ";", "}" ]
Computes the most derived ControlInterface for the specified ControlExtension. @param controlIntf @return the most derived ControlInterface
[ "Computes", "the", "most", "derived", "ControlInterface", "for", "the", "specified", "ControlExtension", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlUtils.java#L74-L96
147,029
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/progress/XMonitoredInputStream.java
XMonitoredInputStream.update
protected void update(long readBytes) throws IOException { if (progressListener.isAborted()) { throw new IOException("Reading Cancelled by ProgressListener"); } this.bytesRead += readBytes; int step = (int)(bytesRead / stepSize); if(step > lastStep) { lastStep = step; progressListener.updateProgress(step, stepNumber); } }
java
protected void update(long readBytes) throws IOException { if (progressListener.isAborted()) { throw new IOException("Reading Cancelled by ProgressListener"); } this.bytesRead += readBytes; int step = (int)(bytesRead / stepSize); if(step > lastStep) { lastStep = step; progressListener.updateProgress(step, stepNumber); } }
[ "protected", "void", "update", "(", "long", "readBytes", ")", "throws", "IOException", "{", "if", "(", "progressListener", ".", "isAborted", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Reading Cancelled by ProgressListener\"", ")", ";", "}", "this", ".", "bytesRead", "+=", "readBytes", ";", "int", "step", "=", "(", "int", ")", "(", "bytesRead", "/", "stepSize", ")", ";", "if", "(", "step", ">", "lastStep", ")", "{", "lastStep", "=", "step", ";", "progressListener", ".", "updateProgress", "(", "step", ",", "stepNumber", ")", ";", "}", "}" ]
This method is called by the actual input stream method to provide feedback about the number of read bytes. Notifies the attached progress listener if appropriate. @param readBytes The number of read bytes in this call.
[ "This", "method", "is", "called", "by", "the", "actual", "input", "stream", "method", "to", "provide", "feedback", "about", "the", "number", "of", "read", "bytes", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/progress/XMonitoredInputStream.java#L146-L156
147,030
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.addResourceContext
protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean) { if (!resourceContext.hasResources()) _resourceContexts.push(resourceContext); }
java
protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean) { if (!resourceContext.hasResources()) _resourceContexts.push(resourceContext); }
[ "protected", "synchronized", "void", "addResourceContext", "(", "ResourceContext", "resourceContext", ",", "ControlBean", "bean", ")", "{", "if", "(", "!", "resourceContext", ".", "hasResources", "(", ")", ")", "_resourceContexts", ".", "push", "(", "resourceContext", ")", ";", "}" ]
Adds a new managed ResourceContext to the ControlContainerContext. This method is used to register a resource context that has just acquired resources @param resourceContext the ResourceContext service that has acquired resources @param bean the acquiring ControlBean. Unused by the base implementation, but available so subclassed containers can have access to the bean.
[ "Adds", "a", "new", "managed", "ResourceContext", "to", "the", "ControlContainerContext", ".", "This", "method", "is", "used", "to", "register", "a", "resource", "context", "that", "has", "just", "acquired", "resources" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L99-L103
147,031
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.removeResourceContext
protected synchronized void removeResourceContext(ResourceContext resourceContext, ControlBean bean) { // // Ignore removal requests received within the context of global cleanup. The // stack is already being popped, so these are just requests for resources that // already have in-flight removal taking place. // if (!_releasingAll && resourceContext.hasResources()) _resourceContexts.remove(resourceContext); }
java
protected synchronized void removeResourceContext(ResourceContext resourceContext, ControlBean bean) { // // Ignore removal requests received within the context of global cleanup. The // stack is already being popped, so these are just requests for resources that // already have in-flight removal taking place. // if (!_releasingAll && resourceContext.hasResources()) _resourceContexts.remove(resourceContext); }
[ "protected", "synchronized", "void", "removeResourceContext", "(", "ResourceContext", "resourceContext", ",", "ControlBean", "bean", ")", "{", "//", "// Ignore removal requests received within the context of global cleanup. The", "// stack is already being popped, so these are just requests for resources that", "// already have in-flight removal taking place.", "//", "if", "(", "!", "_releasingAll", "&&", "resourceContext", ".", "hasResources", "(", ")", ")", "_resourceContexts", ".", "remove", "(", "resourceContext", ")", ";", "}" ]
Removes a managed ResourceContext from the ControlContainerContext. This method is used to unregister a resource context that has already acquired resources @param resourceContext the ResourceContext service to be removed @param bean the acquiring ControlBean. Unused by the base implementation, but available so subclassed containers can have access to the bean.
[ "Removes", "a", "managed", "ResourceContext", "from", "the", "ControlContainerContext", ".", "This", "method", "is", "used", "to", "unregister", "a", "resource", "context", "that", "has", "already", "acquired", "resources" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L112-L121
147,032
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.releaseResources
protected synchronized void releaseResources() { // Set the local flag indicating global resource release is occuring _releasingAll = true; // // Iterate through the list of acquired ResourceContexts and release them // while (!_resourceContexts.empty()) { ResourceContext resourceContext = _resourceContexts.pop(); resourceContext.release(); } // Clear the local flag indicating global resource release is occuring _releasingAll = false; }
java
protected synchronized void releaseResources() { // Set the local flag indicating global resource release is occuring _releasingAll = true; // // Iterate through the list of acquired ResourceContexts and release them // while (!_resourceContexts.empty()) { ResourceContext resourceContext = _resourceContexts.pop(); resourceContext.release(); } // Clear the local flag indicating global resource release is occuring _releasingAll = false; }
[ "protected", "synchronized", "void", "releaseResources", "(", ")", "{", "// Set the local flag indicating global resource release is occuring", "_releasingAll", "=", "true", ";", "//", "// Iterate through the list of acquired ResourceContexts and release them", "//", "while", "(", "!", "_resourceContexts", ".", "empty", "(", ")", ")", "{", "ResourceContext", "resourceContext", "=", "_resourceContexts", ".", "pop", "(", ")", ";", "resourceContext", ".", "release", "(", ")", ";", "}", "// Clear the local flag indicating global resource release is occuring", "_releasingAll", "=", "false", ";", "}" ]
Releases all ResourceContexts associated with the current ControlContainerContext. This method is called by the associated container whenever all managed ResourceContexts that have acquired resources should release them.
[ "Releases", "all", "ResourceContexts", "associated", "with", "the", "current", "ControlContainerContext", ".", "This", "method", "is", "called", "by", "the", "associated", "container", "whenever", "all", "managed", "ResourceContexts", "that", "have", "acquired", "resources", "should", "release", "them", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L128-L144
147,033
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.dispatchEvent
public Object dispatchEvent(ControlHandle handle, EventRef event, Object [] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { ControlBean bean = getBean(handle.getControlID()); if (bean == null) throw new IllegalArgumentException("Invalid bean ID: " + handle.getControlID()); return bean.dispatchEvent(event, args); }
java
public Object dispatchEvent(ControlHandle handle, EventRef event, Object [] args) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { ControlBean bean = getBean(handle.getControlID()); if (bean == null) throw new IllegalArgumentException("Invalid bean ID: " + handle.getControlID()); return bean.dispatchEvent(event, args); }
[ "public", "Object", "dispatchEvent", "(", "ControlHandle", "handle", ",", "EventRef", "event", ",", "Object", "[", "]", "args", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "ControlBean", "bean", "=", "getBean", "(", "handle", ".", "getControlID", "(", ")", ")", ";", "if", "(", "bean", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid bean ID: \"", "+", "handle", ".", "getControlID", "(", ")", ")", ";", "return", "bean", ".", "dispatchEvent", "(", "event", ",", "args", ")", ";", "}" ]
Dispatch an operation or an event to a bean within this container bean context. @param handle the control handle identifying the target bean @param event the event to be invoked on the target bean @param args the arguments to be passed to the target method invocation
[ "Dispatch", "an", "operation", "or", "an", "event", "to", "a", "bean", "within", "this", "container", "bean", "context", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L152-L160
147,034
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java
ControlContainerContext.getControlHandle
public ControlHandle getControlHandle(org.apache.beehive.controls.api.bean.ControlBean bean) { // // The base implementation doesn't support dispatch. Containers should override // and return a valid service handle that does component-specific dispatch. // return null; }
java
public ControlHandle getControlHandle(org.apache.beehive.controls.api.bean.ControlBean bean) { // // The base implementation doesn't support dispatch. Containers should override // and return a valid service handle that does component-specific dispatch. // return null; }
[ "public", "ControlHandle", "getControlHandle", "(", "org", ".", "apache", ".", "beehive", ".", "controls", ".", "api", ".", "bean", ".", "ControlBean", "bean", ")", "{", "//", "// The base implementation doesn't support dispatch. Containers should override", "// and return a valid service handle that does component-specific dispatch.", "//", "return", "null", ";", "}" ]
Returns a ControlHandle to the component containing the control. This handle can be used to dispatch events and operations to a control instance. This method will return null if the containing component does not support direct dispatch. @param bean the target control bean
[ "Returns", "a", "ControlHandle", "to", "the", "component", "containing", "the", "control", ".", "This", "handle", "can", "be", "used", "to", "dispatch", "events", "and", "operations", "to", "a", "control", "instance", ".", "This", "method", "will", "return", "null", "if", "the", "containing", "component", "does", "not", "support", "direct", "dispatch", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L169-L176
147,035
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java
URLTemplate.setTemplate
public void setTemplate( String template ) { if ( template == null || template.length() == 0 ) { throw new IllegalStateException( "Template cannot be null or empty." ); } if ( template.equals( _template ) ) { return; } _template = template; _isParsed = false; _parsedTemplate = null; }
java
public void setTemplate( String template ) { if ( template == null || template.length() == 0 ) { throw new IllegalStateException( "Template cannot be null or empty." ); } if ( template.equals( _template ) ) { return; } _template = template; _isParsed = false; _parsedTemplate = null; }
[ "public", "void", "setTemplate", "(", "String", "template", ")", "{", "if", "(", "template", "==", "null", "||", "template", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Template cannot be null or empty.\"", ")", ";", "}", "if", "(", "template", ".", "equals", "(", "_template", ")", ")", "{", "return", ";", "}", "_template", "=", "template", ";", "_isParsed", "=", "false", ";", "_parsedTemplate", "=", "null", ";", "}" ]
Reset the String form of the template. <p> Should call verify after setting a new template. </p> @param template the string form of the template from url-template-config.
[ "Reset", "the", "String", "form", "of", "the", "template", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java#L100-L115
147,036
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java
URLTemplate.verify
public boolean verify( Collection knownTokens, Collection requiredTokens ) { boolean valid = true; // For each known token, make sure there is a leading and trailing brace if ( knownTokens != null ) { for ( java.util.Iterator ii = knownTokens.iterator(); ii.hasNext(); ) { String token = ( String ) ii.next(); if ( token != null && token.length() > 2 ) { // Strip braces from the known token token = token.substring( 1, token.length() - 1 ); int index = _template.indexOf( token ); if ( index != -1 ) { if ( _template.charAt( index - 1 ) != BEGIN_TOKEN_QUALIFIER || _template.charAt( index + token.length() ) != END_TOKEN_QUALIFIER ) { _log.error( "Template token, " + token + ", is not correctly enclosed with braces in template: " + _template ); valid = false; } } } } } // Parse the template into tokens and literals parseTemplate(); // Check if the required tokens are present if ( requiredTokens != null ) { for ( java.util.Iterator ii = requiredTokens.iterator(); ii.hasNext(); ) { String token = ( String ) ii.next(); TemplateItem requiredItem = new TemplateItem( token, true ); if ( !_parsedTemplate.contains( requiredItem ) ) { _log.error( "Required token, " + token + ", not found in template: " + _template ); valid = false; } } } return valid; }
java
public boolean verify( Collection knownTokens, Collection requiredTokens ) { boolean valid = true; // For each known token, make sure there is a leading and trailing brace if ( knownTokens != null ) { for ( java.util.Iterator ii = knownTokens.iterator(); ii.hasNext(); ) { String token = ( String ) ii.next(); if ( token != null && token.length() > 2 ) { // Strip braces from the known token token = token.substring( 1, token.length() - 1 ); int index = _template.indexOf( token ); if ( index != -1 ) { if ( _template.charAt( index - 1 ) != BEGIN_TOKEN_QUALIFIER || _template.charAt( index + token.length() ) != END_TOKEN_QUALIFIER ) { _log.error( "Template token, " + token + ", is not correctly enclosed with braces in template: " + _template ); valid = false; } } } } } // Parse the template into tokens and literals parseTemplate(); // Check if the required tokens are present if ( requiredTokens != null ) { for ( java.util.Iterator ii = requiredTokens.iterator(); ii.hasNext(); ) { String token = ( String ) ii.next(); TemplateItem requiredItem = new TemplateItem( token, true ); if ( !_parsedTemplate.contains( requiredItem ) ) { _log.error( "Required token, " + token + ", not found in template: " + _template ); valid = false; } } } return valid; }
[ "public", "boolean", "verify", "(", "Collection", "knownTokens", ",", "Collection", "requiredTokens", ")", "{", "boolean", "valid", "=", "true", ";", "// For each known token, make sure there is a leading and trailing brace", "if", "(", "knownTokens", "!=", "null", ")", "{", "for", "(", "java", ".", "util", ".", "Iterator", "ii", "=", "knownTokens", ".", "iterator", "(", ")", ";", "ii", ".", "hasNext", "(", ")", ";", ")", "{", "String", "token", "=", "(", "String", ")", "ii", ".", "next", "(", ")", ";", "if", "(", "token", "!=", "null", "&&", "token", ".", "length", "(", ")", ">", "2", ")", "{", "// Strip braces from the known token", "token", "=", "token", ".", "substring", "(", "1", ",", "token", ".", "length", "(", ")", "-", "1", ")", ";", "int", "index", "=", "_template", ".", "indexOf", "(", "token", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "if", "(", "_template", ".", "charAt", "(", "index", "-", "1", ")", "!=", "BEGIN_TOKEN_QUALIFIER", "||", "_template", ".", "charAt", "(", "index", "+", "token", ".", "length", "(", ")", ")", "!=", "END_TOKEN_QUALIFIER", ")", "{", "_log", ".", "error", "(", "\"Template token, \"", "+", "token", "+", "\", is not correctly enclosed with braces in template: \"", "+", "_template", ")", ";", "valid", "=", "false", ";", "}", "}", "}", "}", "}", "// Parse the template into tokens and literals", "parseTemplate", "(", ")", ";", "// Check if the required tokens are present", "if", "(", "requiredTokens", "!=", "null", ")", "{", "for", "(", "java", ".", "util", ".", "Iterator", "ii", "=", "requiredTokens", ".", "iterator", "(", ")", ";", "ii", ".", "hasNext", "(", ")", ";", ")", "{", "String", "token", "=", "(", "String", ")", "ii", ".", "next", "(", ")", ";", "TemplateItem", "requiredItem", "=", "new", "TemplateItem", "(", "token", ",", "true", ")", ";", "if", "(", "!", "_parsedTemplate", ".", "contains", "(", "requiredItem", ")", ")", "{", "_log", ".", "error", "(", "\"Required token, \"", "+", "token", "+", "\", not found in template: \"", "+", "_template", ")", ";", "valid", "=", "false", ";", "}", "}", "}", "return", "valid", ";", "}" ]
Verification will ensure the URL template conforms to a valid format for known tokens and contains the required tokens. It will also parse the tokens and literal data into a list to improve the replacement performance when constructing the final URL string. <p> Allow clients to define a set of required and known tokens for the template verification. Tokens are expected to be qualified in braces. E.g. {url:path} </p> <p> If the template does not contain the required tokens or if the format of a known token is incorrect, this method will log the error and return false. </p> <p> Should call verify after creating a new template. </p> @param knownTokens the collection of known tokens (Strings) for a valid template. @param requiredTokens the collection of required tokens (Strings) in a valid template. @return true if the template conforms to a valid format, otherwise return false.
[ "Verification", "will", "ensure", "the", "URL", "template", "conforms", "to", "a", "valid", "format", "for", "known", "tokens", "and", "contains", "the", "required", "tokens", ".", "It", "will", "also", "parse", "the", "tokens", "and", "literal", "data", "into", "a", "list", "to", "improve", "the", "replacement", "performance", "when", "constructing", "the", "final", "URL", "string", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java#L157-L205
147,037
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java
URLTemplate.appendToResult
protected void appendToResult( InternalStringBuilder result, String value ) { if ( value == null || value.length() == 0 ) { return; } if ( result.length() > 0 && result.charAt( result.length() - 1 ) == '/' && value.charAt( 0 ) == '/' ) { result.deleteCharAt( result.length() - 1 ); } result.append( value ); }
java
protected void appendToResult( InternalStringBuilder result, String value ) { if ( value == null || value.length() == 0 ) { return; } if ( result.length() > 0 && result.charAt( result.length() - 1 ) == '/' && value.charAt( 0 ) == '/' ) { result.deleteCharAt( result.length() - 1 ); } result.append( value ); }
[ "protected", "void", "appendToResult", "(", "InternalStringBuilder", "result", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "length", "(", ")", "==", "0", ")", "{", "return", ";", "}", "if", "(", "result", ".", "length", "(", ")", ">", "0", "&&", "result", ".", "charAt", "(", "result", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", "&&", "value", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "result", ".", "deleteCharAt", "(", "result", ".", "length", "(", ")", "-", "1", ")", ";", "}", "result", ".", "append", "(", "value", ")", ";", "}" ]
of the URL
[ "of", "the", "URL" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplate.java#L346-L359
147,038
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/id/XID.java
XID.parse
public static XID parse(String idString) { UUID uuid = UUID.fromString(idString); return new XID(uuid); }
java
public static XID parse(String idString) { UUID uuid = UUID.fromString(idString); return new XID(uuid); }
[ "public", "static", "XID", "parse", "(", "String", "idString", ")", "{", "UUID", "uuid", "=", "UUID", ".", "fromString", "(", "idString", ")", ";", "return", "new", "XID", "(", "uuid", ")", ";", "}" ]
Parses an XID object from its text representation. @param idString Text representation of an XID. @return The parsed XID.
[ "Parses", "an", "XID", "object", "from", "its", "text", "representation", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/id/XID.java#L63-L66
147,039
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/id/XID.java
XID.read
public static XID read(DataInputStream dis) throws IOException { long msb = dis.readLong(); long lsb = dis.readLong(); return new XID(msb, lsb); }
java
public static XID read(DataInputStream dis) throws IOException { long msb = dis.readLong(); long lsb = dis.readLong(); return new XID(msb, lsb); }
[ "public", "static", "XID", "read", "(", "DataInputStream", "dis", ")", "throws", "IOException", "{", "long", "msb", "=", "dis", ".", "readLong", "(", ")", ";", "long", "lsb", "=", "dis", ".", "readLong", "(", ")", ";", "return", "new", "XID", "(", "msb", ",", "lsb", ")", ";", "}" ]
Reads a binary-serialized XID from a data input stream. @param dis Data input stream to read XID from. @return The read XID object.
[ "Reads", "a", "binary", "-", "serialized", "XID", "from", "a", "data", "input", "stream", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/id/XID.java#L75-L79
147,040
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/id/XID.java
XID.read
public static XID read(DataInput in) throws IOException { long msb = in.readLong(); long lsb = in.readLong(); return new XID(msb, lsb); }
java
public static XID read(DataInput in) throws IOException { long msb = in.readLong(); long lsb = in.readLong(); return new XID(msb, lsb); }
[ "public", "static", "XID", "read", "(", "DataInput", "in", ")", "throws", "IOException", "{", "long", "msb", "=", "in", ".", "readLong", "(", ")", ";", "long", "lsb", "=", "in", ".", "readLong", "(", ")", ";", "return", "new", "XID", "(", "msb", ",", "lsb", ")", ";", "}" ]
Reads a binary-serialized XID from a data input. @param in Data input to read XID from. @return The read XID object.
[ "Reads", "a", "binary", "-", "serialized", "XID", "from", "a", "data", "input", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/id/XID.java#L88-L92
147,041
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/NodeID.java
NodeID.getIRIFromNodeID
@Nonnull public static String getIRIFromNodeID(String nodeID) { if (nodeID.startsWith(PREFIX_SHARED_NODE)) { return nodeID; } return PREFIX_SHARED_NODE + nodeID.replace(NODE_ID_PREFIX, ""); }
java
@Nonnull public static String getIRIFromNodeID(String nodeID) { if (nodeID.startsWith(PREFIX_SHARED_NODE)) { return nodeID; } return PREFIX_SHARED_NODE + nodeID.replace(NODE_ID_PREFIX, ""); }
[ "@", "Nonnull", "public", "static", "String", "getIRIFromNodeID", "(", "String", "nodeID", ")", "{", "if", "(", "nodeID", ".", "startsWith", "(", "PREFIX_SHARED_NODE", ")", ")", "{", "return", "nodeID", ";", "}", "return", "PREFIX_SHARED_NODE", "+", "nodeID", ".", "replace", "(", "NODE_ID_PREFIX", ",", "\"\"", ")", ";", "}" ]
Returns an absolute IRI from a nodeID attribute. @param nodeID the node id @return absolute IRI
[ "Returns", "an", "absolute", "IRI", "from", "a", "nodeID", "attribute", "." ]
7ab975fb6cef3c8947099983551672a3b5d4e2fd
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/NodeID.java#L72-L78
147,042
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/NodeID.java
NodeID.getNodeID
@Nonnull public static NodeID getNodeID(String id) { String nonBlankId = id == null || id.isEmpty() ? nextAnonymousIRI() : id; return new NodeID(nonBlankId); }
java
@Nonnull public static NodeID getNodeID(String id) { String nonBlankId = id == null || id.isEmpty() ? nextAnonymousIRI() : id; return new NodeID(nonBlankId); }
[ "@", "Nonnull", "public", "static", "NodeID", "getNodeID", "(", "String", "id", ")", "{", "String", "nonBlankId", "=", "id", "==", "null", "||", "id", ".", "isEmpty", "(", ")", "?", "nextAnonymousIRI", "(", ")", ":", "id", ";", "return", "new", "NodeID", "(", "nonBlankId", ")", ";", "}" ]
Gets a NodeID with a specific identifier string @param id The String that identifies the node. If the String doesn't start with "_:" then this will be concatenated to the front of the specified id String; if the string is empty or null, an autogenerated id will be used. @return A NodeID
[ "Gets", "a", "NodeID", "with", "a", "specific", "identifier", "string" ]
7ab975fb6cef3c8947099983551672a3b5d4e2fd
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/NodeID.java#L135-L139
147,043
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/URIContextFactory.java
URIContextFactory.getInstance
public static URIContext getInstance() { URIContext uriContext = MutableURI.getDefaultContext(); UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig(); if ( urlConfig != null) { uriContext.setUseAmpEntity( urlConfig.isHtmlAmpEntity() ); } return uriContext; }
java
public static URIContext getInstance() { URIContext uriContext = MutableURI.getDefaultContext(); UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig(); if ( urlConfig != null) { uriContext.setUseAmpEntity( urlConfig.isHtmlAmpEntity() ); } return uriContext; }
[ "public", "static", "URIContext", "getInstance", "(", ")", "{", "URIContext", "uriContext", "=", "MutableURI", ".", "getDefaultContext", "(", ")", ";", "UrlConfig", "urlConfig", "=", "ConfigUtil", ".", "getConfig", "(", ")", ".", "getUrlConfig", "(", ")", ";", "if", "(", "urlConfig", "!=", "null", ")", "{", "uriContext", ".", "setUseAmpEntity", "(", "urlConfig", ".", "isHtmlAmpEntity", "(", ")", ")", ";", "}", "return", "uriContext", ";", "}" ]
Get a URIContext. The context has data used to write a MutableURI as a string. For example, it will indicate that the URI should be written using the &quot;&amp;amp;&quot; entity, rather than the character, '&amp;'. This returns the default context, but also checks for any overriding setting in the NetUI config. @return the URIContext
[ "Get", "a", "URIContext", ".", "The", "context", "has", "data", "used", "to", "write", "a", "MutableURI", "as", "a", "string", ".", "For", "example", "it", "will", "indicate", "that", "the", "URI", "should", "be", "written", "using", "the", "&quot", ";", "&amp", ";", "amp", ";", "&quot", ";", "entity", "rather", "than", "the", "character", "&amp", ";", ".", "This", "returns", "the", "default", "context", "but", "also", "checks", "for", "any", "overriding", "setting", "in", "the", "NetUI", "config", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/URIContextFactory.java#L47-L58
147,044
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/URIContextFactory.java
URIContextFactory.getInstance
public static URIContext getInstance( boolean forXML ) { URIContext uriContext = null; if ( forXML ) { uriContext = new URIContext(); uriContext.setUseAmpEntity( true ); } else { uriContext = getInstance(); } return uriContext; }
java
public static URIContext getInstance( boolean forXML ) { URIContext uriContext = null; if ( forXML ) { uriContext = new URIContext(); uriContext.setUseAmpEntity( true ); } else { uriContext = getInstance(); } return uriContext; }
[ "public", "static", "URIContext", "getInstance", "(", "boolean", "forXML", ")", "{", "URIContext", "uriContext", "=", "null", ";", "if", "(", "forXML", ")", "{", "uriContext", "=", "new", "URIContext", "(", ")", ";", "uriContext", ".", "setUseAmpEntity", "(", "true", ")", ";", "}", "else", "{", "uriContext", "=", "getInstance", "(", ")", ";", "}", "return", "uriContext", ";", "}" ]
Get a URIContext. If it's for an XML document type, the context will indicate that the URI should be written using the &quot;&amp;amp;&quot; entity, rather than the character, '&amp;'. If it's not for an XML doc type, then use the default context, but check for any overriding setting in the NetUI config. @param forXML flag indicating that the URI is for an XML doc type @return the URIContext
[ "Get", "a", "URIContext", ".", "If", "it", "s", "for", "an", "XML", "document", "type", "the", "context", "will", "indicate", "that", "the", "URI", "should", "be", "written", "using", "the", "&quot", ";", "&amp", ";", "amp", ";", "&quot", ";", "entity", "rather", "than", "the", "character", "&amp", ";", ".", "If", "it", "s", "not", "for", "an", "XML", "doc", "type", "then", "use", "the", "default", "context", "but", "check", "for", "any", "overriding", "setting", "in", "the", "NetUI", "config", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/URIContextFactory.java#L70-L85
147,045
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ErrorHandling.java
ErrorHandling.reportCollectedErrors
public static void reportCollectedErrors(PageContext pc, JspTag tag) { IErrorReporter er = getErrorReporter(tag); if (er == null) return; assert (pc != null); ArrayList errors = er.returnErrors(); if (errors == null || errors.size() == 0) return; assert(errors.size() > 0); String s; // write the error header s = Bundle.getString("Footer_Error_Header"); write(pc, s); int cnt = errors.size(); Object[] args = new Object[5]; for (int i = 0; i < cnt; i++) { Object o = errors.get(i); assert (o != null); if (o instanceof EvalErrorInfo) { EvalErrorInfo err = (EvalErrorInfo) o; args[0] = Integer.toString(err.errorNo); args[1] = err.tagType; args[2] = err.attr; args[3] = err.expression; args[4] = err.evalExcp.getMessage(); s = Bundle.getString("Footer_Error_Expr_Body", args); write(pc, s); } else if (o instanceof TagErrorInfo) { TagErrorInfo tei = (TagErrorInfo) o; args[0] = Integer.toString(tei.errorNo); args[1] = tei.tagType; args[2] = tei.message; s = Bundle.getString("Footer_Error_Tag_Body", args); write(pc, s); } } // write the error footer s = Bundle.getString("Footer_Error_Footer"); write(pc, s); }
java
public static void reportCollectedErrors(PageContext pc, JspTag tag) { IErrorReporter er = getErrorReporter(tag); if (er == null) return; assert (pc != null); ArrayList errors = er.returnErrors(); if (errors == null || errors.size() == 0) return; assert(errors.size() > 0); String s; // write the error header s = Bundle.getString("Footer_Error_Header"); write(pc, s); int cnt = errors.size(); Object[] args = new Object[5]; for (int i = 0; i < cnt; i++) { Object o = errors.get(i); assert (o != null); if (o instanceof EvalErrorInfo) { EvalErrorInfo err = (EvalErrorInfo) o; args[0] = Integer.toString(err.errorNo); args[1] = err.tagType; args[2] = err.attr; args[3] = err.expression; args[4] = err.evalExcp.getMessage(); s = Bundle.getString("Footer_Error_Expr_Body", args); write(pc, s); } else if (o instanceof TagErrorInfo) { TagErrorInfo tei = (TagErrorInfo) o; args[0] = Integer.toString(tei.errorNo); args[1] = tei.tagType; args[2] = tei.message; s = Bundle.getString("Footer_Error_Tag_Body", args); write(pc, s); } } // write the error footer s = Bundle.getString("Footer_Error_Footer"); write(pc, s); }
[ "public", "static", "void", "reportCollectedErrors", "(", "PageContext", "pc", ",", "JspTag", "tag", ")", "{", "IErrorReporter", "er", "=", "getErrorReporter", "(", "tag", ")", ";", "if", "(", "er", "==", "null", ")", "return", ";", "assert", "(", "pc", "!=", "null", ")", ";", "ArrayList", "errors", "=", "er", ".", "returnErrors", "(", ")", ";", "if", "(", "errors", "==", "null", "||", "errors", ".", "size", "(", ")", "==", "0", ")", "return", ";", "assert", "(", "errors", ".", "size", "(", ")", ">", "0", ")", ";", "String", "s", ";", "// write the error header", "s", "=", "Bundle", ".", "getString", "(", "\"Footer_Error_Header\"", ")", ";", "write", "(", "pc", ",", "s", ")", ";", "int", "cnt", "=", "errors", ".", "size", "(", ")", ";", "Object", "[", "]", "args", "=", "new", "Object", "[", "5", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cnt", ";", "i", "++", ")", "{", "Object", "o", "=", "errors", ".", "get", "(", "i", ")", ";", "assert", "(", "o", "!=", "null", ")", ";", "if", "(", "o", "instanceof", "EvalErrorInfo", ")", "{", "EvalErrorInfo", "err", "=", "(", "EvalErrorInfo", ")", "o", ";", "args", "[", "0", "]", "=", "Integer", ".", "toString", "(", "err", ".", "errorNo", ")", ";", "args", "[", "1", "]", "=", "err", ".", "tagType", ";", "args", "[", "2", "]", "=", "err", ".", "attr", ";", "args", "[", "3", "]", "=", "err", ".", "expression", ";", "args", "[", "4", "]", "=", "err", ".", "evalExcp", ".", "getMessage", "(", ")", ";", "s", "=", "Bundle", ".", "getString", "(", "\"Footer_Error_Expr_Body\"", ",", "args", ")", ";", "write", "(", "pc", ",", "s", ")", ";", "}", "else", "if", "(", "o", "instanceof", "TagErrorInfo", ")", "{", "TagErrorInfo", "tei", "=", "(", "TagErrorInfo", ")", "o", ";", "args", "[", "0", "]", "=", "Integer", ".", "toString", "(", "tei", ".", "errorNo", ")", ";", "args", "[", "1", "]", "=", "tei", ".", "tagType", ";", "args", "[", "2", "]", "=", "tei", ".", "message", ";", "s", "=", "Bundle", ".", "getString", "(", "\"Footer_Error_Tag_Body\"", ",", "args", ")", ";", "write", "(", "pc", ",", "s", ")", ";", "}", "}", "// write the error footer", "s", "=", "Bundle", ".", "getString", "(", "\"Footer_Error_Footer\"", ")", ";", "write", "(", "pc", ",", "s", ")", ";", "}" ]
This method get the current errors and write the formated output @param pc
[ "This", "method", "get", "the", "current", "errors", "and", "write", "the", "formated", "output" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ErrorHandling.java#L287-L333
147,046
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
JavaControlUtils.initJavaControls
public static void initJavaControls( HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, PageFlowManagedObject controlClient ) throws ControlFieldInitializationException { Class controlClientClass = controlClient.getClass(); // // First, just return if there are no annotated Control fields. This saves us from having to catch a // (wrapped) ClassNotFoundException for the control client initializer if we were to simply call // Controls.initializeClient(). // Map controlFields = getAccessibleControlFieldAnnotations( controlClientClass, servletContext ); if ( controlFields.isEmpty() ) { if(LOG.isTraceEnabled()) LOG.trace("No control field annotations were found for " + controlClient); PageFlowControlContainer pfcc = PageFlowControlContainerFactory.getControlContainer(request,servletContext); pfcc.beginContextOnPageFlow(controlClient,request,response,servletContext); return; } request = PageFlowUtils.unwrapMultipart( request ); PageFlowControlContainer pfcc = PageFlowControlContainerFactory.getControlContainer(request,servletContext); pfcc.createAndBeginControlBeanContext(controlClient,request,response,servletContext); ControlBeanContext beanContext = pfcc.getControlContainerContext(controlClient); assert beanContext != null : "ControlBeanContext was not initialized by PageFlowRequestProcessor"; try { if(LOG.isDebugEnabled()) LOG.debug("Initializing control client " + controlClient); Controls.initializeClient(null, controlClient, beanContext); } catch ( Exception e ) { LOG.error( "Exception occurred while initializing controls", e); throw new ControlFieldInitializationException( controlClientClass.getName(), controlClient, e ); } }
java
public static void initJavaControls( HttpServletRequest request, HttpServletResponse response, ServletContext servletContext, PageFlowManagedObject controlClient ) throws ControlFieldInitializationException { Class controlClientClass = controlClient.getClass(); // // First, just return if there are no annotated Control fields. This saves us from having to catch a // (wrapped) ClassNotFoundException for the control client initializer if we were to simply call // Controls.initializeClient(). // Map controlFields = getAccessibleControlFieldAnnotations( controlClientClass, servletContext ); if ( controlFields.isEmpty() ) { if(LOG.isTraceEnabled()) LOG.trace("No control field annotations were found for " + controlClient); PageFlowControlContainer pfcc = PageFlowControlContainerFactory.getControlContainer(request,servletContext); pfcc.beginContextOnPageFlow(controlClient,request,response,servletContext); return; } request = PageFlowUtils.unwrapMultipart( request ); PageFlowControlContainer pfcc = PageFlowControlContainerFactory.getControlContainer(request,servletContext); pfcc.createAndBeginControlBeanContext(controlClient,request,response,servletContext); ControlBeanContext beanContext = pfcc.getControlContainerContext(controlClient); assert beanContext != null : "ControlBeanContext was not initialized by PageFlowRequestProcessor"; try { if(LOG.isDebugEnabled()) LOG.debug("Initializing control client " + controlClient); Controls.initializeClient(null, controlClient, beanContext); } catch ( Exception e ) { LOG.error( "Exception occurred while initializing controls", e); throw new ControlFieldInitializationException( controlClientClass.getName(), controlClient, e ); } }
[ "public", "static", "void", "initJavaControls", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "ServletContext", "servletContext", ",", "PageFlowManagedObject", "controlClient", ")", "throws", "ControlFieldInitializationException", "{", "Class", "controlClientClass", "=", "controlClient", ".", "getClass", "(", ")", ";", "//", "// First, just return if there are no annotated Control fields. This saves us from having to catch a", "// (wrapped) ClassNotFoundException for the control client initializer if we were to simply call", "// Controls.initializeClient().", "//", "Map", "controlFields", "=", "getAccessibleControlFieldAnnotations", "(", "controlClientClass", ",", "servletContext", ")", ";", "if", "(", "controlFields", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "LOG", ".", "trace", "(", "\"No control field annotations were found for \"", "+", "controlClient", ")", ";", "PageFlowControlContainer", "pfcc", "=", "PageFlowControlContainerFactory", ".", "getControlContainer", "(", "request", ",", "servletContext", ")", ";", "pfcc", ".", "beginContextOnPageFlow", "(", "controlClient", ",", "request", ",", "response", ",", "servletContext", ")", ";", "return", ";", "}", "request", "=", "PageFlowUtils", ".", "unwrapMultipart", "(", "request", ")", ";", "PageFlowControlContainer", "pfcc", "=", "PageFlowControlContainerFactory", ".", "getControlContainer", "(", "request", ",", "servletContext", ")", ";", "pfcc", ".", "createAndBeginControlBeanContext", "(", "controlClient", ",", "request", ",", "response", ",", "servletContext", ")", ";", "ControlBeanContext", "beanContext", "=", "pfcc", ".", "getControlContainerContext", "(", "controlClient", ")", ";", "assert", "beanContext", "!=", "null", ":", "\"ControlBeanContext was not initialized by PageFlowRequestProcessor\"", ";", "try", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "LOG", ".", "debug", "(", "\"Initializing control client \"", "+", "controlClient", ")", ";", "Controls", ".", "initializeClient", "(", "null", ",", "controlClient", ",", "beanContext", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "\"Exception occurred while initializing controls\"", ",", "e", ")", ";", "throw", "new", "ControlFieldInitializationException", "(", "controlClientClass", ".", "getName", "(", ")", ",", "controlClient", ",", "e", ")", ";", "}", "}" ]
Initialize all null member variables that are Java Controls. @param request the current HttpServletRequest @param response the current HttpServletRequest @param servletContext the ServletContext @param controlClient the class with possible annotated Control fields @throws org.apache.beehive.netui.pageflow.ControlFieldInitializationException
[ "Initialize", "all", "null", "member", "variables", "that", "are", "Java", "Controls", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java#L68-L108
147,047
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
JavaControlUtils.uninitJavaControls
public static void uninitJavaControls( ServletContext servletContext, PageFlowManagedObject controlClient ) { Map controlFields = getAccessibleControlFieldAnnotations( controlClient.getClass(), servletContext ); for ( Iterator i = controlFields.keySet().iterator(); i.hasNext(); ) { Field controlField = ( Field ) i.next(); try { Object fieldValue = controlField.get( controlClient ); if ( fieldValue != null ) { controlField.set( controlClient, null ); destroyControl( fieldValue ); } } catch ( IllegalAccessException e ) { LOG.error( "Exception while uninitializing Java Control " + controlField.getName(), e ); } } }
java
public static void uninitJavaControls( ServletContext servletContext, PageFlowManagedObject controlClient ) { Map controlFields = getAccessibleControlFieldAnnotations( controlClient.getClass(), servletContext ); for ( Iterator i = controlFields.keySet().iterator(); i.hasNext(); ) { Field controlField = ( Field ) i.next(); try { Object fieldValue = controlField.get( controlClient ); if ( fieldValue != null ) { controlField.set( controlClient, null ); destroyControl( fieldValue ); } } catch ( IllegalAccessException e ) { LOG.error( "Exception while uninitializing Java Control " + controlField.getName(), e ); } } }
[ "public", "static", "void", "uninitJavaControls", "(", "ServletContext", "servletContext", ",", "PageFlowManagedObject", "controlClient", ")", "{", "Map", "controlFields", "=", "getAccessibleControlFieldAnnotations", "(", "controlClient", ".", "getClass", "(", ")", ",", "servletContext", ")", ";", "for", "(", "Iterator", "i", "=", "controlFields", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Field", "controlField", "=", "(", "Field", ")", "i", ".", "next", "(", ")", ";", "try", "{", "Object", "fieldValue", "=", "controlField", ".", "get", "(", "controlClient", ")", ";", "if", "(", "fieldValue", "!=", "null", ")", "{", "controlField", ".", "set", "(", "controlClient", ",", "null", ")", ";", "destroyControl", "(", "fieldValue", ")", ";", "}", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "LOG", ".", "error", "(", "\"Exception while uninitializing Java Control \"", "+", "controlField", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "}", "}" ]
Clean up all member variables that are Java Controls.
[ "Clean", "up", "all", "member", "variables", "that", "are", "Java", "Controls", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java#L113-L136
147,048
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java
JavaControlUtils.destroyControl
private static void destroyControl( Object controlInstance ) { assert controlInstance instanceof ControlBean : controlInstance.getClass().getName(); BeanContext beanContext = ( ( ControlBean ) controlInstance ).getBeanContext(); if ( beanContext != null ) { if(LOG.isTraceEnabled()) LOG.trace("Removing control " + controlInstance + " from ControlBeanContext " + beanContext); beanContext.remove( controlInstance ); } }
java
private static void destroyControl( Object controlInstance ) { assert controlInstance instanceof ControlBean : controlInstance.getClass().getName(); BeanContext beanContext = ( ( ControlBean ) controlInstance ).getBeanContext(); if ( beanContext != null ) { if(LOG.isTraceEnabled()) LOG.trace("Removing control " + controlInstance + " from ControlBeanContext " + beanContext); beanContext.remove( controlInstance ); } }
[ "private", "static", "void", "destroyControl", "(", "Object", "controlInstance", ")", "{", "assert", "controlInstance", "instanceof", "ControlBean", ":", "controlInstance", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "BeanContext", "beanContext", "=", "(", "(", "ControlBean", ")", "controlInstance", ")", ".", "getBeanContext", "(", ")", ";", "if", "(", "beanContext", "!=", "null", ")", "{", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "LOG", ".", "trace", "(", "\"Removing control \"", "+", "controlInstance", "+", "\" from ControlBeanContext \"", "+", "beanContext", ")", ";", "beanContext", ".", "remove", "(", "controlInstance", ")", ";", "}", "}" ]
Destroy a Beehive Control. @param controlInstance the Control instance
[ "Destroy", "a", "Beehive", "Control", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/JavaControlUtils.java#L143-L152
147,049
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowException.java
PageFlowException.getFlowControllerURI
public String getFlowControllerURI() { FlowController flowController = getFlowController(); return flowController != null ? flowController.getDisplayName() : null; }
java
public String getFlowControllerURI() { FlowController flowController = getFlowController(); return flowController != null ? flowController.getDisplayName() : null; }
[ "public", "String", "getFlowControllerURI", "(", ")", "{", "FlowController", "flowController", "=", "getFlowController", "(", ")", ";", "return", "flowController", "!=", "null", "?", "flowController", ".", "getDisplayName", "(", ")", ":", "null", ";", "}" ]
Get the name of the related FlowController. @return the class name of the {@link FlowController} associated with this exception.
[ "Get", "the", "name", "of", "the", "related", "FlowController", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowException.java#L74-L78
147,050
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java
AnnotationConstraintAptValidator.validate
public static void validate(Declaration d) throws IllegalArgumentException { Collection<AnnotationMirror> mirrors = d.getAnnotationMirrors(); // for each annotations defined on the declaration, if the annotation // is a PropertySet, ensure the values assigned to the properties // satisfy all PropertySet and PropertyType constraints. for (AnnotationMirror m : mirrors) { AnnotationTypeDeclaration decl = m.getAnnotationType().getDeclaration(); /* when embedding this annotation processor in an IDE, the declaration could be null when it doesn't resolve to a valid type. In this case, just continue processing declarations. */ if(decl == null) { continue; } else if (decl.getAnnotation(PropertySet.class) != null) { Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i = m.getElementValues().entrySet().iterator(); while (i.hasNext()) { Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry = i.next(); Collection<Annotation> annotations = getMemberTypeAnnotations(entry.getKey()); if (annotations.size() > 0) { Annotation[] anArray = new Annotation[annotations.size()]; annotations.toArray(anArray); validate(anArray, entry.getValue().getValue()); } } //If a membership rule is defined on the property set, ensure the rule is satisfied. if (decl.getAnnotation(MembershipRule.class) != null) { try { String declClassName = decl.getQualifiedName(); TypeDeclaration owningClass = decl.getDeclaringType(); if (owningClass != null) declClassName = owningClass.getQualifiedName() + "$" + decl.getSimpleName(); Class clazz = Class.forName(declClassName); Annotation a = d.getAnnotation(clazz); validateMembership(a); } catch (ClassNotFoundException cnfe) { //should not happen } } } } // If the declaration is a class or interface, validate its methods // and fields. if (d instanceof TypeDeclaration) { TypeDeclaration td = ((TypeDeclaration) d); for (Declaration md : td.getMethods()) validate(md); for (Declaration fd : td.getFields()) validate(fd); } // If the delcaration is a method, validate its parameters. else if (d instanceof MethodDeclaration) { for (Declaration pd : ((MethodDeclaration) d).getParameters()) validate(pd); } }
java
public static void validate(Declaration d) throws IllegalArgumentException { Collection<AnnotationMirror> mirrors = d.getAnnotationMirrors(); // for each annotations defined on the declaration, if the annotation // is a PropertySet, ensure the values assigned to the properties // satisfy all PropertySet and PropertyType constraints. for (AnnotationMirror m : mirrors) { AnnotationTypeDeclaration decl = m.getAnnotationType().getDeclaration(); /* when embedding this annotation processor in an IDE, the declaration could be null when it doesn't resolve to a valid type. In this case, just continue processing declarations. */ if(decl == null) { continue; } else if (decl.getAnnotation(PropertySet.class) != null) { Iterator<Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue>> i = m.getElementValues().entrySet().iterator(); while (i.hasNext()) { Map.Entry<AnnotationTypeElementDeclaration, AnnotationValue> entry = i.next(); Collection<Annotation> annotations = getMemberTypeAnnotations(entry.getKey()); if (annotations.size() > 0) { Annotation[] anArray = new Annotation[annotations.size()]; annotations.toArray(anArray); validate(anArray, entry.getValue().getValue()); } } //If a membership rule is defined on the property set, ensure the rule is satisfied. if (decl.getAnnotation(MembershipRule.class) != null) { try { String declClassName = decl.getQualifiedName(); TypeDeclaration owningClass = decl.getDeclaringType(); if (owningClass != null) declClassName = owningClass.getQualifiedName() + "$" + decl.getSimpleName(); Class clazz = Class.forName(declClassName); Annotation a = d.getAnnotation(clazz); validateMembership(a); } catch (ClassNotFoundException cnfe) { //should not happen } } } } // If the declaration is a class or interface, validate its methods // and fields. if (d instanceof TypeDeclaration) { TypeDeclaration td = ((TypeDeclaration) d); for (Declaration md : td.getMethods()) validate(md); for (Declaration fd : td.getFields()) validate(fd); } // If the delcaration is a method, validate its parameters. else if (d instanceof MethodDeclaration) { for (Declaration pd : ((MethodDeclaration) d).getParameters()) validate(pd); } }
[ "public", "static", "void", "validate", "(", "Declaration", "d", ")", "throws", "IllegalArgumentException", "{", "Collection", "<", "AnnotationMirror", ">", "mirrors", "=", "d", ".", "getAnnotationMirrors", "(", ")", ";", "// for each annotations defined on the declaration, if the annotation", "// is a PropertySet, ensure the values assigned to the properties", "// satisfy all PropertySet and PropertyType constraints.", "for", "(", "AnnotationMirror", "m", ":", "mirrors", ")", "{", "AnnotationTypeDeclaration", "decl", "=", "m", ".", "getAnnotationType", "(", ")", ".", "getDeclaration", "(", ")", ";", "/*\n when embedding this annotation processor in an IDE, the declaration\n could be null when it doesn't resolve to a valid type. In this case,\n just continue processing declarations.\n */", "if", "(", "decl", "==", "null", ")", "{", "continue", ";", "}", "else", "if", "(", "decl", ".", "getAnnotation", "(", "PropertySet", ".", "class", ")", "!=", "null", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "AnnotationTypeElementDeclaration", ",", "AnnotationValue", ">", ">", "i", "=", "m", ".", "getElementValues", "(", ")", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "AnnotationTypeElementDeclaration", ",", "AnnotationValue", ">", "entry", "=", "i", ".", "next", "(", ")", ";", "Collection", "<", "Annotation", ">", "annotations", "=", "getMemberTypeAnnotations", "(", "entry", ".", "getKey", "(", ")", ")", ";", "if", "(", "annotations", ".", "size", "(", ")", ">", "0", ")", "{", "Annotation", "[", "]", "anArray", "=", "new", "Annotation", "[", "annotations", ".", "size", "(", ")", "]", ";", "annotations", ".", "toArray", "(", "anArray", ")", ";", "validate", "(", "anArray", ",", "entry", ".", "getValue", "(", ")", ".", "getValue", "(", ")", ")", ";", "}", "}", "//If a membership rule is defined on the property set, ensure the rule is satisfied. ", "if", "(", "decl", ".", "getAnnotation", "(", "MembershipRule", ".", "class", ")", "!=", "null", ")", "{", "try", "{", "String", "declClassName", "=", "decl", ".", "getQualifiedName", "(", ")", ";", "TypeDeclaration", "owningClass", "=", "decl", ".", "getDeclaringType", "(", ")", ";", "if", "(", "owningClass", "!=", "null", ")", "declClassName", "=", "owningClass", ".", "getQualifiedName", "(", ")", "+", "\"$\"", "+", "decl", ".", "getSimpleName", "(", ")", ";", "Class", "clazz", "=", "Class", ".", "forName", "(", "declClassName", ")", ";", "Annotation", "a", "=", "d", ".", "getAnnotation", "(", "clazz", ")", ";", "validateMembership", "(", "a", ")", ";", "}", "catch", "(", "ClassNotFoundException", "cnfe", ")", "{", "//should not happen", "}", "}", "}", "}", "// If the declaration is a class or interface, validate its methods", "// and fields.", "if", "(", "d", "instanceof", "TypeDeclaration", ")", "{", "TypeDeclaration", "td", "=", "(", "(", "TypeDeclaration", ")", "d", ")", ";", "for", "(", "Declaration", "md", ":", "td", ".", "getMethods", "(", ")", ")", "validate", "(", "md", ")", ";", "for", "(", "Declaration", "fd", ":", "td", ".", "getFields", "(", ")", ")", "validate", "(", ")", ";", "}", "// If the delcaration is a method, validate its parameters.", "else", "if", "(", "d", "instanceof", "MethodDeclaration", ")", "{", "for", "(", "Declaration", "pd", ":", "(", "(", "MethodDeclaration", ")", "d", ")", ".", "getParameters", "(", ")", ")", "validate", "(", "pd", ")", ";", "}", "}" ]
This method ensures that any control property value assignment satisfies all property constraints. This method should be called from an annotation processor to ensure declarative control property assignment using annotations are validated at build time. This method is currently called from ControlAnnotationProcessor and ControlClientAnnotationProcessor. @param d a declaration which may contain a control property value assignment @throws IllegalArgumentException when the declaration contains a control property value assignment that does not satisfy a property constraint.
[ "This", "method", "ensures", "that", "any", "control", "property", "value", "assignment", "satisfies", "all", "property", "constraints", ".", "This", "method", "should", "be", "called", "from", "an", "annotation", "processor", "to", "ensure", "declarative", "control", "property", "assignment", "using", "annotations", "are", "validated", "at", "build", "time", ".", "This", "method", "is", "currently", "called", "from", "ControlAnnotationProcessor", "and", "ControlClientAnnotationProcessor", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/AnnotationConstraintAptValidator.java#L79-L154
147,051
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java
AptEventSet.initSuperEventSet
public AptEventSet initSuperEventSet() { // This will be common, so short circuit quickly AptControlInterface superControl = _controlIntf.getSuperClass(); if (superControl == null) return null; // Compute a hash set containing the qualified names of all super interfaces // for this EventSet HashSet<String> extendNames = new HashSet<String>(); for (InterfaceType superType: _eventSet.getSuperinterfaces()) { InterfaceDeclaration superDecl = superType.getDeclaration(); if (superDecl != null) extendNames.add(superDecl.getQualifiedName()); } // Starting with the parent of the ControlInterface declaring this EventSet, look // for a parent interface that declares ones of these super interfaces as an event // set while (superControl != null) { Collection<AptEventSet> superEventSets = superControl.getEventSets(); for (AptEventSet superEventSet : superEventSets) { if (extendNames.contains(superEventSet.getClassName())) return superEventSet; } superControl = superControl.getSuperClass(); } // Nothing found, so no super event set return null; }
java
public AptEventSet initSuperEventSet() { // This will be common, so short circuit quickly AptControlInterface superControl = _controlIntf.getSuperClass(); if (superControl == null) return null; // Compute a hash set containing the qualified names of all super interfaces // for this EventSet HashSet<String> extendNames = new HashSet<String>(); for (InterfaceType superType: _eventSet.getSuperinterfaces()) { InterfaceDeclaration superDecl = superType.getDeclaration(); if (superDecl != null) extendNames.add(superDecl.getQualifiedName()); } // Starting with the parent of the ControlInterface declaring this EventSet, look // for a parent interface that declares ones of these super interfaces as an event // set while (superControl != null) { Collection<AptEventSet> superEventSets = superControl.getEventSets(); for (AptEventSet superEventSet : superEventSets) { if (extendNames.contains(superEventSet.getClassName())) return superEventSet; } superControl = superControl.getSuperClass(); } // Nothing found, so no super event set return null; }
[ "public", "AptEventSet", "initSuperEventSet", "(", ")", "{", "// This will be common, so short circuit quickly", "AptControlInterface", "superControl", "=", "_controlIntf", ".", "getSuperClass", "(", ")", ";", "if", "(", "superControl", "==", "null", ")", "return", "null", ";", "// Compute a hash set containing the qualified names of all super interfaces", "// for this EventSet", "HashSet", "<", "String", ">", "extendNames", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "InterfaceType", "superType", ":", "_eventSet", ".", "getSuperinterfaces", "(", ")", ")", "{", "InterfaceDeclaration", "superDecl", "=", "superType", ".", "getDeclaration", "(", ")", ";", "if", "(", "superDecl", "!=", "null", ")", "extendNames", ".", "add", "(", "superDecl", ".", "getQualifiedName", "(", ")", ")", ";", "}", "// Starting with the parent of the ControlInterface declaring this EventSet, look", "// for a parent interface that declares ones of these super interfaces as an event", "// set", "while", "(", "superControl", "!=", "null", ")", "{", "Collection", "<", "AptEventSet", ">", "superEventSets", "=", "superControl", ".", "getEventSets", "(", ")", ";", "for", "(", "AptEventSet", "superEventSet", ":", "superEventSets", ")", "{", "if", "(", "extendNames", ".", "contains", "(", "superEventSet", ".", "getClassName", "(", ")", ")", ")", "return", "superEventSet", ";", "}", "superControl", "=", "superControl", ".", "getSuperClass", "(", ")", ";", "}", "// Nothing found, so no super event set", "return", "null", ";", "}" ]
Checks to see if this EventSet extends an EventSet declared on a parent control interface. If found it will return the parent EventSet, or return null if not found.
[ "Checks", "to", "see", "if", "this", "EventSet", "extends", "an", "EventSet", "declared", "on", "a", "parent", "control", "interface", ".", "If", "found", "it", "will", "return", "the", "parent", "EventSet", "or", "return", "null", "if", "not", "found", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java#L102-L136
147,052
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java
AptEventSet.initEvents
protected AptMethodSet<AptEvent> initEvents() { AptMethodSet<AptEvent> events = new AptMethodSet<AptEvent>(); if ( _eventSet == null || _eventSet.getMethods() == null ) return events; // // Add all of the public methods directly declared and inherited from extended // interfaces, except for the EventSet super interface (if any) // ArrayList<InterfaceDeclaration> intfList = new ArrayList<InterfaceDeclaration>(); intfList.add(_eventSet); for (int i = 0; i < intfList.size(); i++) { InterfaceDeclaration intfDecl = intfList.get(i); // // Don't add events that are derived from a super event set. These are not added because // this class picks a single super interface to extend from when building a hierarchy // of callback notifiers (etc). So, the super event set that was chosen first is left out // of the list of event methods since they're captured in superclasses in the Control's implementation // if (_superEventSet != null && _superEventSet.getClassName().equals(intfDecl.getQualifiedName())) continue; // Add all declared methods, but ignore the mystery <clinit> methods for (MethodDeclaration methodDecl : intfDecl.getMethods()) if (!methodDecl.toString().equals("<clinit>()")) events.add(new AptEvent(this, methodDecl, _ap)); // // Add all superinterfaces of the target interface to the list // for (InterfaceType superType: intfDecl.getSuperinterfaces()) { InterfaceDeclaration superDecl = superType.getDeclaration(); if (superDecl != null && !intfList.contains(superDecl)) intfList.add(superDecl); } } return events; }
java
protected AptMethodSet<AptEvent> initEvents() { AptMethodSet<AptEvent> events = new AptMethodSet<AptEvent>(); if ( _eventSet == null || _eventSet.getMethods() == null ) return events; // // Add all of the public methods directly declared and inherited from extended // interfaces, except for the EventSet super interface (if any) // ArrayList<InterfaceDeclaration> intfList = new ArrayList<InterfaceDeclaration>(); intfList.add(_eventSet); for (int i = 0; i < intfList.size(); i++) { InterfaceDeclaration intfDecl = intfList.get(i); // // Don't add events that are derived from a super event set. These are not added because // this class picks a single super interface to extend from when building a hierarchy // of callback notifiers (etc). So, the super event set that was chosen first is left out // of the list of event methods since they're captured in superclasses in the Control's implementation // if (_superEventSet != null && _superEventSet.getClassName().equals(intfDecl.getQualifiedName())) continue; // Add all declared methods, but ignore the mystery <clinit> methods for (MethodDeclaration methodDecl : intfDecl.getMethods()) if (!methodDecl.toString().equals("<clinit>()")) events.add(new AptEvent(this, methodDecl, _ap)); // // Add all superinterfaces of the target interface to the list // for (InterfaceType superType: intfDecl.getSuperinterfaces()) { InterfaceDeclaration superDecl = superType.getDeclaration(); if (superDecl != null && !intfList.contains(superDecl)) intfList.add(superDecl); } } return events; }
[ "protected", "AptMethodSet", "<", "AptEvent", ">", "initEvents", "(", ")", "{", "AptMethodSet", "<", "AptEvent", ">", "events", "=", "new", "AptMethodSet", "<", "AptEvent", ">", "(", ")", ";", "if", "(", "_eventSet", "==", "null", "||", "_eventSet", ".", "getMethods", "(", ")", "==", "null", ")", "return", "events", ";", "//", "// Add all of the public methods directly declared and inherited from extended", "// interfaces, except for the EventSet super interface (if any)", "//", "ArrayList", "<", "InterfaceDeclaration", ">", "intfList", "=", "new", "ArrayList", "<", "InterfaceDeclaration", ">", "(", ")", ";", "intfList", ".", "add", "(", "_eventSet", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "intfList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "InterfaceDeclaration", "intfDecl", "=", "intfList", ".", "get", "(", "i", ")", ";", "//", "// Don't add events that are derived from a super event set. These are not added because", "// this class picks a single super interface to extend from when building a hierarchy", "// of callback notifiers (etc). So, the super event set that was chosen first is left out", "// of the list of event methods since they're captured in superclasses in the Control's implementation", "//", "if", "(", "_superEventSet", "!=", "null", "&&", "_superEventSet", ".", "getClassName", "(", ")", ".", "equals", "(", "intfDecl", ".", "getQualifiedName", "(", ")", ")", ")", "continue", ";", "// Add all declared methods, but ignore the mystery <clinit> methods", "for", "(", "MethodDeclaration", "methodDecl", ":", "intfDecl", ".", "getMethods", "(", ")", ")", "if", "(", "!", "methodDecl", ".", "toString", "(", ")", ".", "equals", "(", "\"<clinit>()\"", ")", ")", "events", ".", "add", "(", "new", "AptEvent", "(", "this", ",", "methodDecl", ",", "_ap", ")", ")", ";", "//", "// Add all superinterfaces of the target interface to the list", "//", "for", "(", "InterfaceType", "superType", ":", "intfDecl", ".", "getSuperinterfaces", "(", ")", ")", "{", "InterfaceDeclaration", "superDecl", "=", "superType", ".", "getDeclaration", "(", ")", ";", "if", "(", "superDecl", "!=", "null", "&&", "!", "intfList", ".", "contains", "(", "superDecl", ")", ")", "intfList", ".", "add", "(", "superDecl", ")", ";", "}", "}", "return", "events", ";", "}" ]
Initializes the list of Events associated with this EventSet
[ "Initializes", "the", "list", "of", "Events", "associated", "with", "this", "EventSet" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java#L146-L188
147,053
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java
AptEventSet.getEventCount
public int getEventCount() { int count = _events.size(); if (_superEventSet != null) count += _superEventSet.getEventCount(); return count; }
java
public int getEventCount() { int count = _events.size(); if (_superEventSet != null) count += _superEventSet.getEventCount(); return count; }
[ "public", "int", "getEventCount", "(", ")", "{", "int", "count", "=", "_events", ".", "size", "(", ")", ";", "if", "(", "_superEventSet", "!=", "null", ")", "count", "+=", "_superEventSet", ".", "getEventCount", "(", ")", ";", "return", "count", ";", "}" ]
Returns the number of Events for this EventSet and any super event set
[ "Returns", "the", "number", "of", "Events", "for", "this", "EventSet", "and", "any", "super", "event", "set" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java#L207-L213
147,054
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java
AptEventSet.getDescriptorName
public String getDescriptorName() { // // The javadocs for java.beans.EventSetDescriptor suggest that the programmatic name // should start w/ a lowercase letter. So we use the unqualified event set interface // name w/ the first character lowercased. // String name = getShortName(); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }
java
public String getDescriptorName() { // // The javadocs for java.beans.EventSetDescriptor suggest that the programmatic name // should start w/ a lowercase letter. So we use the unqualified event set interface // name w/ the first character lowercased. // String name = getShortName(); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }
[ "public", "String", "getDescriptorName", "(", ")", "{", "//", "// The javadocs for java.beans.EventSetDescriptor suggest that the programmatic name", "// should start w/ a lowercase letter. So we use the unqualified event set interface", "// name w/ the first character lowercased.", "//", "String", "name", "=", "getShortName", "(", ")", ";", "return", "Character", ".", "toLowerCase", "(", "name", ".", "charAt", "(", "0", ")", ")", "+", "name", ".", "substring", "(", "1", ")", ";", "}" ]
Returns the programmatic descriptor name to be returned by the EventDescriptor for the event set.
[ "Returns", "the", "programmatic", "descriptor", "name", "to", "be", "returned", "by", "the", "EventDescriptor", "for", "the", "event", "set", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java#L219-L228
147,055
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java
AptEventSet.getNotifierClass
public String getNotifierClass() { StringBuffer sb = new StringBuffer(getShortName()); sb.append("Notifier"); // // If the event set declaration has any parameterized types, then include them on // the notifier class as well. Currently, these can only be parameterized types // from the outer (control interface), since there is no other mechanism for specifying // type values at notifier construction (other than propagation from the outer type). // sb.append(getFormalTypeParameterNames()); return sb.toString(); }
java
public String getNotifierClass() { StringBuffer sb = new StringBuffer(getShortName()); sb.append("Notifier"); // // If the event set declaration has any parameterized types, then include them on // the notifier class as well. Currently, these can only be parameterized types // from the outer (control interface), since there is no other mechanism for specifying // type values at notifier construction (other than propagation from the outer type). // sb.append(getFormalTypeParameterNames()); return sb.toString(); }
[ "public", "String", "getNotifierClass", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "getShortName", "(", ")", ")", ";", "sb", ".", "append", "(", "\"Notifier\"", ")", ";", "//", "// If the event set declaration has any parameterized types, then include them on", "// the notifier class as well. Currently, these can only be parameterized types", "// from the outer (control interface), since there is no other mechanism for specifying", "// type values at notifier construction (other than propagation from the outer type).", "// ", "sb", ".", "append", "(", "getFormalTypeParameterNames", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the name of the generated notifier class for this ControlEventSet
[ "Returns", "the", "name", "of", "the", "generated", "notifier", "class", "for", "this", "ControlEventSet" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptEventSet.java#L233-L246
147,056
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.initOperations
private AptMethodSet<AptOperation> initOperations() { AptMethodSet<AptOperation> operList = new AptMethodSet<AptOperation>(); if ( _intfDecl == null ) return operList; // // Add the methods from the current interface and all super interfaces *other* // than the one from which control inheritance or extension is defined. These // exceptions are handled on the super ControlInterface (the return value // of AptControlInterface.initSuperClass()) // // Do this by: // - initially populate the check vector with the control interface // - iterate through the check vector, examining each interface to: // * ignore the super interface // * add all declared interface methods to the operations list // * add any super interfaces to the Vector (avoiding recursion) // - the iteration continues until all superinterfaces have been processed // Vector<InterfaceDeclaration> checkIntfs = new Vector<InterfaceDeclaration>(); checkIntfs.add(_intfDecl); for (int i = 0; i < checkIntfs.size(); i++) { InterfaceDeclaration intfDecl = checkIntfs.elementAt(i); if (intfDecl.equals(_superDecl)) continue; if ( intfDecl.getMethods() == null ) continue; // Add all declared methods, but ignore the mystery <clinit> methods for (MethodDeclaration methodDecl : intfDecl.getMethods()) if (!methodDecl.toString().equals("<clinit>()")) operList.add(new AptOperation(this, methodDecl, _ap)); if ( intfDecl.getSuperinterfaces() == null ) continue; for (InterfaceType superType : intfDecl.getSuperinterfaces()) { InterfaceDeclaration superDecl = superType.getDeclaration(); if (superDecl != null && !checkIntfs.contains(superDecl)) checkIntfs.add(superDecl); } } return operList; }
java
private AptMethodSet<AptOperation> initOperations() { AptMethodSet<AptOperation> operList = new AptMethodSet<AptOperation>(); if ( _intfDecl == null ) return operList; // // Add the methods from the current interface and all super interfaces *other* // than the one from which control inheritance or extension is defined. These // exceptions are handled on the super ControlInterface (the return value // of AptControlInterface.initSuperClass()) // // Do this by: // - initially populate the check vector with the control interface // - iterate through the check vector, examining each interface to: // * ignore the super interface // * add all declared interface methods to the operations list // * add any super interfaces to the Vector (avoiding recursion) // - the iteration continues until all superinterfaces have been processed // Vector<InterfaceDeclaration> checkIntfs = new Vector<InterfaceDeclaration>(); checkIntfs.add(_intfDecl); for (int i = 0; i < checkIntfs.size(); i++) { InterfaceDeclaration intfDecl = checkIntfs.elementAt(i); if (intfDecl.equals(_superDecl)) continue; if ( intfDecl.getMethods() == null ) continue; // Add all declared methods, but ignore the mystery <clinit> methods for (MethodDeclaration methodDecl : intfDecl.getMethods()) if (!methodDecl.toString().equals("<clinit>()")) operList.add(new AptOperation(this, methodDecl, _ap)); if ( intfDecl.getSuperinterfaces() == null ) continue; for (InterfaceType superType : intfDecl.getSuperinterfaces()) { InterfaceDeclaration superDecl = superType.getDeclaration(); if (superDecl != null && !checkIntfs.contains(superDecl)) checkIntfs.add(superDecl); } } return operList; }
[ "private", "AptMethodSet", "<", "AptOperation", ">", "initOperations", "(", ")", "{", "AptMethodSet", "<", "AptOperation", ">", "operList", "=", "new", "AptMethodSet", "<", "AptOperation", ">", "(", ")", ";", "if", "(", "_intfDecl", "==", "null", ")", "return", "operList", ";", "//", "// Add the methods from the current interface and all super interfaces *other*", "// than the one from which control inheritance or extension is defined. These", "// exceptions are handled on the super ControlInterface (the return value", "// of AptControlInterface.initSuperClass())", "//", "// Do this by:", "// - initially populate the check vector with the control interface", "// - iterate through the check vector, examining each interface to:", "// * ignore the super interface", "// * add all declared interface methods to the operations list", "// * add any super interfaces to the Vector (avoiding recursion)", "// - the iteration continues until all superinterfaces have been processed", "//", "Vector", "<", "InterfaceDeclaration", ">", "checkIntfs", "=", "new", "Vector", "<", "InterfaceDeclaration", ">", "(", ")", ";", "checkIntfs", ".", "add", "(", "_intfDecl", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "checkIntfs", ".", "size", "(", ")", ";", "i", "++", ")", "{", "InterfaceDeclaration", "intfDecl", "=", "checkIntfs", ".", "elementAt", "(", "i", ")", ";", "if", "(", "intfDecl", ".", "equals", "(", "_superDecl", ")", ")", "continue", ";", "if", "(", "intfDecl", ".", "getMethods", "(", ")", "==", "null", ")", "continue", ";", "// Add all declared methods, but ignore the mystery <clinit> methods", "for", "(", "MethodDeclaration", "methodDecl", ":", "intfDecl", ".", "getMethods", "(", ")", ")", "if", "(", "!", "methodDecl", ".", "toString", "(", ")", ".", "equals", "(", "\"<clinit>()\"", ")", ")", "operList", ".", "add", "(", "new", "AptOperation", "(", "this", ",", "methodDecl", ",", "_ap", ")", ")", ";", "if", "(", "intfDecl", ".", "getSuperinterfaces", "(", ")", "==", "null", ")", "continue", ";", "for", "(", "InterfaceType", "superType", ":", "intfDecl", ".", "getSuperinterfaces", "(", ")", ")", "{", "InterfaceDeclaration", "superDecl", "=", "superType", ".", "getDeclaration", "(", ")", ";", "if", "(", "superDecl", "!=", "null", "&&", "!", "checkIntfs", ".", "contains", "(", "superDecl", ")", ")", "checkIntfs", ".", "add", "(", "superDecl", ")", ";", "}", "}", "return", "operList", ";", "}" ]
Initializes the list of operations declared by this AptControlInterface
[ "Initializes", "the", "list", "of", "operations", "declared", "by", "this", "AptControlInterface" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L207-L257
147,057
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.initPropertySets
private ArrayList<AptPropertySet> initPropertySets() { ArrayList<AptPropertySet> propSets = new ArrayList<AptPropertySet>(); if ( _intfDecl == null ) return propSets; // TODO: enforce presence of prefixes when multiple property sets w/ the same // property name exist // // Add the intrinsic/base property set // TypeDeclaration basePropsDecl = _ap.getAnnotationProcessorEnvironment().getTypeDeclaration( "org.apache.beehive.controls.api.properties.BaseProperties" ); if ( basePropsDecl != null ) { propSets.add( new AptPropertySet( null, basePropsDecl, _ap ) ); } // // Add external property sets // ExternalPropertySets extPropsAnnotation = _intfDecl.getAnnotation(ExternalPropertySets.class); if ( extPropsAnnotation != null ) { if (isExtension()) { _ap.printError( _intfDecl, "extpropertyset.illegal.usage" ); } try { Class[] extProps = extPropsAnnotation.value(); } catch ( MirroredTypesException mte ) { Collection<String> extProps = mte.getQualifiedNames(); for ( String extPropName : extProps ) { TypeDeclaration extPropDecl = _ap.getAnnotationProcessorEnvironment().getTypeDeclaration( extPropName ); if ( extPropDecl != null ) { AptPropertySet extPropSet = new AptPropertySet( null, extPropDecl, _ap ); propSets.add( extPropSet ); } else { _ap.printError( _intfDecl, "extpropertyset.type.not.found", extPropName ); } } } } // // Add nested property sets // if ( _intfDecl.getNestedTypes() == null ) return propSets; for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes()) { boolean fError = false; if (innerDecl.getAnnotation(PropertySet.class) != null) { if (! (innerDecl instanceof AnnotationTypeDeclaration)) { _ap.printError( innerDecl, "propertyset.not.annotation.type" ); fError = true; } Retention ret = innerDecl.getAnnotation(Retention.class); if (ret == null || ret.value() != RetentionPolicy.RUNTIME) { _ap.printError( innerDecl, "propertyset.missing.retention" ); fError = true; } if (isExtension()) { _ap.printError( innerDecl, "propertyset.illegal.usage.2" ); fError = true; } if ( !fError ) propSets.add( new AptPropertySet(this, (AnnotationTypeDeclaration)innerDecl, _ap)); } } // // Detect the presence of locally declared bound or constrained properties // Enforce property name (including prefix) uniqueness across all propertysets on this interface. // Set<String> propertyNames = new HashSet<String>(); for (AptPropertySet propSet : propSets) { for (AptProperty prop : propSet.getProperties()) { if (prop.isBound()) _hasBoundProperties = true; if (prop.isConstrained()) _hasConstrainedProperties = true; String propName = prop.getAccessorName(); if ( propertyNames.contains( propName ) ) { _ap.printError( _intfDecl, "propertyset.duplicate.property.names", propName, propSet.getShortName() ); } else { propertyNames.add( propName ); } } } return propSets; }
java
private ArrayList<AptPropertySet> initPropertySets() { ArrayList<AptPropertySet> propSets = new ArrayList<AptPropertySet>(); if ( _intfDecl == null ) return propSets; // TODO: enforce presence of prefixes when multiple property sets w/ the same // property name exist // // Add the intrinsic/base property set // TypeDeclaration basePropsDecl = _ap.getAnnotationProcessorEnvironment().getTypeDeclaration( "org.apache.beehive.controls.api.properties.BaseProperties" ); if ( basePropsDecl != null ) { propSets.add( new AptPropertySet( null, basePropsDecl, _ap ) ); } // // Add external property sets // ExternalPropertySets extPropsAnnotation = _intfDecl.getAnnotation(ExternalPropertySets.class); if ( extPropsAnnotation != null ) { if (isExtension()) { _ap.printError( _intfDecl, "extpropertyset.illegal.usage" ); } try { Class[] extProps = extPropsAnnotation.value(); } catch ( MirroredTypesException mte ) { Collection<String> extProps = mte.getQualifiedNames(); for ( String extPropName : extProps ) { TypeDeclaration extPropDecl = _ap.getAnnotationProcessorEnvironment().getTypeDeclaration( extPropName ); if ( extPropDecl != null ) { AptPropertySet extPropSet = new AptPropertySet( null, extPropDecl, _ap ); propSets.add( extPropSet ); } else { _ap.printError( _intfDecl, "extpropertyset.type.not.found", extPropName ); } } } } // // Add nested property sets // if ( _intfDecl.getNestedTypes() == null ) return propSets; for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes()) { boolean fError = false; if (innerDecl.getAnnotation(PropertySet.class) != null) { if (! (innerDecl instanceof AnnotationTypeDeclaration)) { _ap.printError( innerDecl, "propertyset.not.annotation.type" ); fError = true; } Retention ret = innerDecl.getAnnotation(Retention.class); if (ret == null || ret.value() != RetentionPolicy.RUNTIME) { _ap.printError( innerDecl, "propertyset.missing.retention" ); fError = true; } if (isExtension()) { _ap.printError( innerDecl, "propertyset.illegal.usage.2" ); fError = true; } if ( !fError ) propSets.add( new AptPropertySet(this, (AnnotationTypeDeclaration)innerDecl, _ap)); } } // // Detect the presence of locally declared bound or constrained properties // Enforce property name (including prefix) uniqueness across all propertysets on this interface. // Set<String> propertyNames = new HashSet<String>(); for (AptPropertySet propSet : propSets) { for (AptProperty prop : propSet.getProperties()) { if (prop.isBound()) _hasBoundProperties = true; if (prop.isConstrained()) _hasConstrainedProperties = true; String propName = prop.getAccessorName(); if ( propertyNames.contains( propName ) ) { _ap.printError( _intfDecl, "propertyset.duplicate.property.names", propName, propSet.getShortName() ); } else { propertyNames.add( propName ); } } } return propSets; }
[ "private", "ArrayList", "<", "AptPropertySet", ">", "initPropertySets", "(", ")", "{", "ArrayList", "<", "AptPropertySet", ">", "propSets", "=", "new", "ArrayList", "<", "AptPropertySet", ">", "(", ")", ";", "if", "(", "_intfDecl", "==", "null", ")", "return", "propSets", ";", "// TODO: enforce presence of prefixes when multiple property sets w/ the same", "// property name exist", "//", "// Add the intrinsic/base property set", "//", "TypeDeclaration", "basePropsDecl", "=", "_ap", ".", "getAnnotationProcessorEnvironment", "(", ")", ".", "getTypeDeclaration", "(", "\"org.apache.beehive.controls.api.properties.BaseProperties\"", ")", ";", "if", "(", "basePropsDecl", "!=", "null", ")", "{", "propSets", ".", "add", "(", "new", "AptPropertySet", "(", "null", ",", "basePropsDecl", ",", "_ap", ")", ")", ";", "}", "//", "// Add external property sets", "//", "ExternalPropertySets", "extPropsAnnotation", "=", "_intfDecl", ".", "getAnnotation", "(", "ExternalPropertySets", ".", "class", ")", ";", "if", "(", "extPropsAnnotation", "!=", "null", ")", "{", "if", "(", "isExtension", "(", ")", ")", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"extpropertyset.illegal.usage\"", ")", ";", "}", "try", "{", "Class", "[", "]", "extProps", "=", "extPropsAnnotation", ".", "value", "(", ")", ";", "}", "catch", "(", "MirroredTypesException", "mte", ")", "{", "Collection", "<", "String", ">", "extProps", "=", "mte", ".", "getQualifiedNames", "(", ")", ";", "for", "(", "String", "extPropName", ":", "extProps", ")", "{", "TypeDeclaration", "extPropDecl", "=", "_ap", ".", "getAnnotationProcessorEnvironment", "(", ")", ".", "getTypeDeclaration", "(", "extPropName", ")", ";", "if", "(", "extPropDecl", "!=", "null", ")", "{", "AptPropertySet", "extPropSet", "=", "new", "AptPropertySet", "(", "null", ",", "extPropDecl", ",", "_ap", ")", ";", "propSets", ".", "add", "(", "extPropSet", ")", ";", "}", "else", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"extpropertyset.type.not.found\"", ",", "extPropName", ")", ";", "}", "}", "}", "}", "//", "// Add nested property sets", "//", "if", "(", "_intfDecl", ".", "getNestedTypes", "(", ")", "==", "null", ")", "return", "propSets", ";", "for", "(", "TypeDeclaration", "innerDecl", ":", "_intfDecl", ".", "getNestedTypes", "(", ")", ")", "{", "boolean", "fError", "=", "false", ";", "if", "(", "innerDecl", ".", "getAnnotation", "(", "PropertySet", ".", "class", ")", "!=", "null", ")", "{", "if", "(", "!", "(", "innerDecl", "instanceof", "AnnotationTypeDeclaration", ")", ")", "{", "_ap", ".", "printError", "(", "innerDecl", ",", "\"propertyset.not.annotation.type\"", ")", ";", "fError", "=", "true", ";", "}", "Retention", "ret", "=", "innerDecl", ".", "getAnnotation", "(", "Retention", ".", "class", ")", ";", "if", "(", "ret", "==", "null", "||", "ret", ".", "value", "(", ")", "!=", "RetentionPolicy", ".", "RUNTIME", ")", "{", "_ap", ".", "printError", "(", "innerDecl", ",", "\"propertyset.missing.retention\"", ")", ";", "fError", "=", "true", ";", "}", "if", "(", "isExtension", "(", ")", ")", "{", "_ap", ".", "printError", "(", "innerDecl", ",", "\"propertyset.illegal.usage.2\"", ")", ";", "fError", "=", "true", ";", "}", "if", "(", "!", "fError", ")", "propSets", ".", "add", "(", "new", "AptPropertySet", "(", "this", ",", "(", "AnnotationTypeDeclaration", ")", "innerDecl", ",", "_ap", ")", ")", ";", "}", "}", "//", "// Detect the presence of locally declared bound or constrained properties", "// Enforce property name (including prefix) uniqueness across all propertysets on this interface.", "//", "Set", "<", "String", ">", "propertyNames", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "AptPropertySet", "propSet", ":", "propSets", ")", "{", "for", "(", "AptProperty", "prop", ":", "propSet", ".", "getProperties", "(", ")", ")", "{", "if", "(", "prop", ".", "isBound", "(", ")", ")", "_hasBoundProperties", "=", "true", ";", "if", "(", "prop", ".", "isConstrained", "(", ")", ")", "_hasConstrainedProperties", "=", "true", ";", "String", "propName", "=", "prop", ".", "getAccessorName", "(", ")", ";", "if", "(", "propertyNames", ".", "contains", "(", "propName", ")", ")", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"propertyset.duplicate.property.names\"", ",", "propName", ",", "propSet", ".", "getShortName", "(", ")", ")", ";", "}", "else", "{", "propertyNames", ".", "add", "(", "propName", ")", ";", "}", "}", "}", "return", "propSets", ";", "}" ]
Initializes the list of PropertySets declared or referenced by this AptControlInterface
[ "Initializes", "the", "list", "of", "PropertySets", "declared", "or", "referenced", "by", "this", "AptControlInterface" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L279-L402
147,058
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getPropertyCount
public int getPropertyCount() { int count; if (_superClass == null) count = 0; else count = _superClass.getPropertyCount(); for (AptPropertySet propertySet : _propertySets) { // if a property set is set to optional and hasSetters is set to false, // there isn't a getter or setter available for that property if (propertySet.hasSetters() || !propertySet.isOptional()) { count += propertySet.getProperties().size(); } } count += _intfProps.size(); return count; }
java
public int getPropertyCount() { int count; if (_superClass == null) count = 0; else count = _superClass.getPropertyCount(); for (AptPropertySet propertySet : _propertySets) { // if a property set is set to optional and hasSetters is set to false, // there isn't a getter or setter available for that property if (propertySet.hasSetters() || !propertySet.isOptional()) { count += propertySet.getProperties().size(); } } count += _intfProps.size(); return count; }
[ "public", "int", "getPropertyCount", "(", ")", "{", "int", "count", ";", "if", "(", "_superClass", "==", "null", ")", "count", "=", "0", ";", "else", "count", "=", "_superClass", ".", "getPropertyCount", "(", ")", ";", "for", "(", "AptPropertySet", "propertySet", ":", "_propertySets", ")", "{", "// if a property set is set to optional and hasSetters is set to false,", "// there isn't a getter or setter available for that property", "if", "(", "propertySet", ".", "hasSetters", "(", ")", "||", "!", "propertySet", ".", "isOptional", "(", ")", ")", "{", "count", "+=", "propertySet", ".", "getProperties", "(", ")", ".", "size", "(", ")", ";", "}", "}", "count", "+=", "_intfProps", ".", "size", "(", ")", ";", "return", "count", ";", "}" ]
Returns the total number of properties for this control interface
[ "Returns", "the", "total", "number", "of", "properties", "for", "this", "control", "interface" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L412-L430
147,059
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.initEventSets
private ArrayList<AptEventSet> initEventSets() { ArrayList<AptEventSet> eventSets = new ArrayList<AptEventSet>(); if ( _intfDecl == null || _intfDecl.getNestedTypes() == null ) return eventSets; for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes()) { // HACKHACK: There appear to be mirror API bugs where calling getAnnotation() // on certain entity types will result in an endless loop. For now, work around // this by a priori filtering... but this mechanism will drop errors that appear // on an inapropriate type (see check below) if (! (innerDecl instanceof InterfaceDeclaration)) continue; if (innerDecl.getAnnotation(EventSet.class) != null) { if (! (innerDecl instanceof InterfaceDeclaration)) { _ap.printError( innerDecl, "eventset.illegal.usage" ); } else { eventSets.add( new AptEventSet(this, (InterfaceDeclaration)innerDecl, _ap)); } } } return eventSets; }
java
private ArrayList<AptEventSet> initEventSets() { ArrayList<AptEventSet> eventSets = new ArrayList<AptEventSet>(); if ( _intfDecl == null || _intfDecl.getNestedTypes() == null ) return eventSets; for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes()) { // HACKHACK: There appear to be mirror API bugs where calling getAnnotation() // on certain entity types will result in an endless loop. For now, work around // this by a priori filtering... but this mechanism will drop errors that appear // on an inapropriate type (see check below) if (! (innerDecl instanceof InterfaceDeclaration)) continue; if (innerDecl.getAnnotation(EventSet.class) != null) { if (! (innerDecl instanceof InterfaceDeclaration)) { _ap.printError( innerDecl, "eventset.illegal.usage" ); } else { eventSets.add( new AptEventSet(this, (InterfaceDeclaration)innerDecl, _ap)); } } } return eventSets; }
[ "private", "ArrayList", "<", "AptEventSet", ">", "initEventSets", "(", ")", "{", "ArrayList", "<", "AptEventSet", ">", "eventSets", "=", "new", "ArrayList", "<", "AptEventSet", ">", "(", ")", ";", "if", "(", "_intfDecl", "==", "null", "||", "_intfDecl", ".", "getNestedTypes", "(", ")", "==", "null", ")", "return", "eventSets", ";", "for", "(", "TypeDeclaration", "innerDecl", ":", "_intfDecl", ".", "getNestedTypes", "(", ")", ")", "{", "// HACKHACK: There appear to be mirror API bugs where calling getAnnotation()", "// on certain entity types will result in an endless loop. For now, work around", "// this by a priori filtering... but this mechanism will drop errors that appear", "// on an inapropriate type (see check below)", "if", "(", "!", "(", "innerDecl", "instanceof", "InterfaceDeclaration", ")", ")", "continue", ";", "if", "(", "innerDecl", ".", "getAnnotation", "(", "EventSet", ".", "class", ")", "!=", "null", ")", "{", "if", "(", "!", "(", "innerDecl", "instanceof", "InterfaceDeclaration", ")", ")", "{", "_ap", ".", "printError", "(", "innerDecl", ",", "\"eventset.illegal.usage\"", ")", ";", "}", "else", "{", "eventSets", ".", "add", "(", "new", "AptEventSet", "(", "this", ",", "(", "InterfaceDeclaration", ")", "innerDecl", ",", "_ap", ")", ")", ";", "}", "}", "}", "return", "eventSets", ";", "}" ]
Initializes the list of EventSets declared by this AptControlInterface
[ "Initializes", "the", "list", "of", "EventSets", "declared", "by", "this", "AptControlInterface" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L496-L527
147,060
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getEventSet
public AptEventSet getEventSet(String name) { for (AptEventSet eventSet: getEventSets()) if (eventSet.getClassName().equals(name)) return eventSet; if (_superClass != null) return _superClass.getEventSet(name); return null; }
java
public AptEventSet getEventSet(String name) { for (AptEventSet eventSet: getEventSets()) if (eventSet.getClassName().equals(name)) return eventSet; if (_superClass != null) return _superClass.getEventSet(name); return null; }
[ "public", "AptEventSet", "getEventSet", "(", "String", "name", ")", "{", "for", "(", "AptEventSet", "eventSet", ":", "getEventSets", "(", ")", ")", "if", "(", "eventSet", ".", "getClassName", "(", ")", ".", "equals", "(", "name", ")", ")", "return", "eventSet", ";", "if", "(", "_superClass", "!=", "null", ")", "return", "_superClass", ".", "getEventSet", "(", "name", ")", ";", "return", "null", ";", "}" ]
Returns the AptEventSet with the specified name
[ "Returns", "the", "AptEventSet", "with", "the", "specified", "name" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L558-L568
147,061
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getCheckOutput
public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException { HashMap<String,Object> map = new HashMap<String,Object>(); map.put("intf", this); // the control interface map.put("bean", _bean); ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(); // // the ControlBean class // Writer beanWriter = new IndentingWriter(filer.createSourceFile(_bean.getClassName())); GeneratorOutput beanSource = new GeneratorOutput(beanWriter, "org/apache/beehive/controls/runtime/generator/ControlBean.vm", map); genList.add(beanSource); // // the ControlBean BeanInfo class // Writer beanInfoWriter = new IndentingWriter(filer.createSourceFile(_bean.getBeanInfoName())); GeneratorOutput beanInfoSource = new GeneratorOutput(beanInfoWriter, "org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm", map); genList.add(beanInfoSource); return genList; }
java
public List<GeneratorOutput> getCheckOutput(Filer filer) throws IOException { HashMap<String,Object> map = new HashMap<String,Object>(); map.put("intf", this); // the control interface map.put("bean", _bean); ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(); // // the ControlBean class // Writer beanWriter = new IndentingWriter(filer.createSourceFile(_bean.getClassName())); GeneratorOutput beanSource = new GeneratorOutput(beanWriter, "org/apache/beehive/controls/runtime/generator/ControlBean.vm", map); genList.add(beanSource); // // the ControlBean BeanInfo class // Writer beanInfoWriter = new IndentingWriter(filer.createSourceFile(_bean.getBeanInfoName())); GeneratorOutput beanInfoSource = new GeneratorOutput(beanInfoWriter, "org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm", map); genList.add(beanInfoSource); return genList; }
[ "public", "List", "<", "GeneratorOutput", ">", "getCheckOutput", "(", "Filer", "filer", ")", "throws", "IOException", "{", "HashMap", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "map", ".", "put", "(", "\"intf\"", ",", "this", ")", ";", "// the control interface", "map", ".", "put", "(", "\"bean\"", ",", "_bean", ")", ";", "ArrayList", "<", "GeneratorOutput", ">", "genList", "=", "new", "ArrayList", "<", "GeneratorOutput", ">", "(", ")", ";", "//", "// the ControlBean class", "//", "Writer", "beanWriter", "=", "new", "IndentingWriter", "(", "filer", ".", "createSourceFile", "(", "_bean", ".", "getClassName", "(", ")", ")", ")", ";", "GeneratorOutput", "beanSource", "=", "new", "GeneratorOutput", "(", "beanWriter", ",", "\"org/apache/beehive/controls/runtime/generator/ControlBean.vm\"", ",", "map", ")", ";", "genList", ".", "add", "(", "beanSource", ")", ";", "//", "// the ControlBean BeanInfo class", "//", "Writer", "beanInfoWriter", "=", "new", "IndentingWriter", "(", "filer", ".", "createSourceFile", "(", "_bean", ".", "getBeanInfoName", "(", ")", ")", ")", ";", "GeneratorOutput", "beanInfoSource", "=", "new", "GeneratorOutput", "(", "beanInfoWriter", ",", "\"org/apache/beehive/controls/runtime/generator/ControlBeanInfo.vm\"", ",", "map", ")", ";", "genList", ".", "add", "(", "beanInfoSource", ")", ";", "return", "genList", ";", "}" ]
Returns the information necessary to generate a ControlBean from this AptControlInterface
[ "Returns", "the", "information", "necessary", "to", "generate", "a", "ControlBean", "from", "this", "AptControlInterface" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L603-L631
147,062
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getGenerateOutput
public List<GeneratorOutput> getGenerateOutput(Filer filer) throws IOException { HashMap<String,Object> map = new HashMap<String,Object>(); map.put("intf", this); // the control interface map.put("bean", _bean); ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(); // // the ControlBean MANIFEST.MF section // Writer manifestWriter = filer.createTextFile(Filer.Location.CLASS_TREE, _bean.getPackage(), new File(_bean.getShortName() + ".class.manifest"), null); GeneratorOutput beanManifest = new GeneratorOutput(manifestWriter, "org/apache/beehive/controls/runtime/generator/ControlManifest.vm", map); genList.add(beanManifest); return genList; }
java
public List<GeneratorOutput> getGenerateOutput(Filer filer) throws IOException { HashMap<String,Object> map = new HashMap<String,Object>(); map.put("intf", this); // the control interface map.put("bean", _bean); ArrayList<GeneratorOutput> genList = new ArrayList<GeneratorOutput>(); // // the ControlBean MANIFEST.MF section // Writer manifestWriter = filer.createTextFile(Filer.Location.CLASS_TREE, _bean.getPackage(), new File(_bean.getShortName() + ".class.manifest"), null); GeneratorOutput beanManifest = new GeneratorOutput(manifestWriter, "org/apache/beehive/controls/runtime/generator/ControlManifest.vm", map); genList.add(beanManifest); return genList; }
[ "public", "List", "<", "GeneratorOutput", ">", "getGenerateOutput", "(", "Filer", "filer", ")", "throws", "IOException", "{", "HashMap", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "map", ".", "put", "(", "\"intf\"", ",", "this", ")", ";", "// the control interface", "map", ".", "put", "(", "\"bean\"", ",", "_bean", ")", ";", "ArrayList", "<", "GeneratorOutput", ">", "genList", "=", "new", "ArrayList", "<", "GeneratorOutput", ">", "(", ")", ";", "//", "// the ControlBean MANIFEST.MF section", "//", "Writer", "manifestWriter", "=", "filer", ".", "createTextFile", "(", "Filer", ".", "Location", ".", "CLASS_TREE", ",", "_bean", ".", "getPackage", "(", ")", ",", "new", "File", "(", "_bean", ".", "getShortName", "(", ")", "+", "\".class.manifest\"", ")", ",", "null", ")", ";", "GeneratorOutput", "beanManifest", "=", "new", "GeneratorOutput", "(", "manifestWriter", ",", "\"org/apache/beehive/controls/runtime/generator/ControlManifest.vm\"", ",", "map", ")", ";", "genList", ".", "add", "(", "beanManifest", ")", ";", "return", "genList", ";", "}" ]
Returns the information necessary to generate a packaging information from this AptControlInterface. Since this information is not needed during type validation, it can be delated until the generate phase.
[ "Returns", "the", "information", "necessary", "to", "generate", "a", "packaging", "information", "from", "this", "AptControlInterface", ".", "Since", "this", "information", "is", "not", "needed", "during", "type", "validation", "it", "can", "be", "delated", "until", "the", "generate", "phase", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L638-L660
147,063
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getMostDerivedInterface
public AptControlInterface getMostDerivedInterface() { // // Walk up ControlInterface chain looking for the 1st instance annotated // w/ @ControlInterface (as opposed to @ControlExtension) // // REVIEW: TBD rules for inheritance of @ControlInterface will affect this. // Probably need to keep walking and examine each @ControlInterface in the chain. // Run all checkers in chain? Make checkers responsible for invoking their base // class-defined checkers? // AptControlInterface ancestor = getSuperClass(); while (ancestor != null) { if (!ancestor.isExtension()) break; ancestor = ancestor.getSuperClass(); } return ancestor; }
java
public AptControlInterface getMostDerivedInterface() { // // Walk up ControlInterface chain looking for the 1st instance annotated // w/ @ControlInterface (as opposed to @ControlExtension) // // REVIEW: TBD rules for inheritance of @ControlInterface will affect this. // Probably need to keep walking and examine each @ControlInterface in the chain. // Run all checkers in chain? Make checkers responsible for invoking their base // class-defined checkers? // AptControlInterface ancestor = getSuperClass(); while (ancestor != null) { if (!ancestor.isExtension()) break; ancestor = ancestor.getSuperClass(); } return ancestor; }
[ "public", "AptControlInterface", "getMostDerivedInterface", "(", ")", "{", "//", "// Walk up ControlInterface chain looking for the 1st instance annotated", "// w/ @ControlInterface (as opposed to @ControlExtension)", "//", "// REVIEW: TBD rules for inheritance of @ControlInterface will affect this.", "// Probably need to keep walking and examine each @ControlInterface in the chain.", "// Run all checkers in chain? Make checkers responsible for invoking their base", "// class-defined checkers?", "//", "AptControlInterface", "ancestor", "=", "getSuperClass", "(", ")", ";", "while", "(", "ancestor", "!=", "null", ")", "{", "if", "(", "!", "ancestor", ".", "isExtension", "(", ")", ")", "break", ";", "ancestor", "=", "ancestor", ".", "getSuperClass", "(", ")", ";", "}", "return", "ancestor", ";", "}" ]
Returns the most-derived interface in the inheritance chain that is annotated with @ControlInterface. It represents the point in the inheritance chain where @ControlInterface becomes @ControlExtension (i.e., anything interface derived from the 'most-derived interface' is annotated with @ControlExtension). May return null if the inheritance chain is malformed.
[ "Returns", "the", "most", "-", "derived", "interface", "in", "the", "inheritance", "chain", "that", "is", "annotated", "with" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L678-L700
147,064
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getExternalClassLoader
public ClassLoader getExternalClassLoader() { Map<String,String> opts = _ap.getAnnotationProcessorEnvironment().getOptions(); String classpath = opts.get("-classpath"); if ( classpath != null ) { String [] cpEntries = classpath.split( File.pathSeparator ); ArrayList a = new ArrayList(); for ( String e : cpEntries ) { try { File f = (new File(e)).getCanonicalFile(); URL u = f.toURL(); a.add(u); } catch (Exception ex) { System.err.println( "getExternalClassLoader(): bad cp entry=" + e ); System.err.println( "Exception processing e=" + ex ); } } URL [] urls = new URL[a.size()]; urls = (URL[]) a.toArray(urls); return new URLClassLoader( urls, ControlChecker.class.getClassLoader() ); } return null; }
java
public ClassLoader getExternalClassLoader() { Map<String,String> opts = _ap.getAnnotationProcessorEnvironment().getOptions(); String classpath = opts.get("-classpath"); if ( classpath != null ) { String [] cpEntries = classpath.split( File.pathSeparator ); ArrayList a = new ArrayList(); for ( String e : cpEntries ) { try { File f = (new File(e)).getCanonicalFile(); URL u = f.toURL(); a.add(u); } catch (Exception ex) { System.err.println( "getExternalClassLoader(): bad cp entry=" + e ); System.err.println( "Exception processing e=" + ex ); } } URL [] urls = new URL[a.size()]; urls = (URL[]) a.toArray(urls); return new URLClassLoader( urls, ControlChecker.class.getClassLoader() ); } return null; }
[ "public", "ClassLoader", "getExternalClassLoader", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "opts", "=", "_ap", ".", "getAnnotationProcessorEnvironment", "(", ")", ".", "getOptions", "(", ")", ";", "String", "classpath", "=", "opts", ".", "get", "(", "\"-classpath\"", ")", ";", "if", "(", "classpath", "!=", "null", ")", "{", "String", "[", "]", "cpEntries", "=", "classpath", ".", "split", "(", "File", ".", "pathSeparator", ")", ";", "ArrayList", "a", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "String", "e", ":", "cpEntries", ")", "{", "try", "{", "File", "f", "=", "(", "new", "File", "(", "e", ")", ")", ".", "getCanonicalFile", "(", ")", ";", "URL", "u", "=", "f", ".", "toURL", "(", ")", ";", "a", ".", "add", "(", "u", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "System", ".", "err", ".", "println", "(", "\"getExternalClassLoader(): bad cp entry=\"", "+", "e", ")", ";", "System", ".", "err", ".", "println", "(", "\"Exception processing e=\"", "+", "ex", ")", ";", "}", "}", "URL", "[", "]", "urls", "=", "new", "URL", "[", "a", ".", "size", "(", ")", "]", ";", "urls", "=", "(", "URL", "[", "]", ")", "a", ".", "toArray", "(", "urls", ")", ";", "return", "new", "URLClassLoader", "(", "urls", ",", "ControlChecker", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
Returns a classloader that can be used to load external classes
[ "Returns", "a", "classloader", "that", "can", "be", "used", "to", "load", "external", "classes" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L705-L735
147,065
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.isValidManifestAttribute
private boolean isValidManifestAttribute(ManifestAttribute attr) { String name = attr.name(); String value = attr.value(); boolean isValid = true; /* Note, the null-check for "name" is necessary when the annotation processor is hosted inside of an IDE where the name attribute of the ManifestAttribute metadata can be null temporarily. In order to "keep going", just report a warning and proceed. */ if (name == null || name.length() == 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.1" ); isValid = false; } else { if (alphaNum.indexOf(name.charAt(0)) < 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.2" ); isValid = false; } for (int i = 1; i < name.length(); i++) { if (headerChar.indexOf(name.charAt(i)) < 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.3", name.charAt(i) ); isValid = false; break; } } } /* Note, the null-check for "value" is necessary when the annotation processor is hosted inside of an IDE where the value attribute of the ManifestAttribute metadata can be null temporarily. In order to "keep going", just report a warning and proceed. */ if (value == null || value.length() == 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.4" ); isValid = false; } else { // TODO: validate string contents are valid UTF-8? } return isValid; }
java
private boolean isValidManifestAttribute(ManifestAttribute attr) { String name = attr.name(); String value = attr.value(); boolean isValid = true; /* Note, the null-check for "name" is necessary when the annotation processor is hosted inside of an IDE where the name attribute of the ManifestAttribute metadata can be null temporarily. In order to "keep going", just report a warning and proceed. */ if (name == null || name.length() == 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.1" ); isValid = false; } else { if (alphaNum.indexOf(name.charAt(0)) < 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.2" ); isValid = false; } for (int i = 1; i < name.length(); i++) { if (headerChar.indexOf(name.charAt(i)) < 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.3", name.charAt(i) ); isValid = false; break; } } } /* Note, the null-check for "value" is necessary when the annotation processor is hosted inside of an IDE where the value attribute of the ManifestAttribute metadata can be null temporarily. In order to "keep going", just report a warning and proceed. */ if (value == null || value.length() == 0) { _ap.printError( _intfDecl, "manifestattribute.illegal.name.4" ); isValid = false; } else { // TODO: validate string contents are valid UTF-8? } return isValid; }
[ "private", "boolean", "isValidManifestAttribute", "(", "ManifestAttribute", "attr", ")", "{", "String", "name", "=", "attr", ".", "name", "(", ")", ";", "String", "value", "=", "attr", ".", "value", "(", ")", ";", "boolean", "isValid", "=", "true", ";", "/*\n Note, the null-check for \"name\" is necessary when the annotation processor is hosted inside\n of an IDE where the name attribute of the ManifestAttribute metadata can be null\n temporarily. In order to \"keep going\", just report a warning and proceed.\n */", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"manifestattribute.illegal.name.1\"", ")", ";", "isValid", "=", "false", ";", "}", "else", "{", "if", "(", "alphaNum", ".", "indexOf", "(", "name", ".", "charAt", "(", "0", ")", ")", "<", "0", ")", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"manifestattribute.illegal.name.2\"", ")", ";", "isValid", "=", "false", ";", "}", "for", "(", "int", "i", "=", "1", ";", "i", "<", "name", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "headerChar", ".", "indexOf", "(", "name", ".", "charAt", "(", "i", ")", ")", "<", "0", ")", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"manifestattribute.illegal.name.3\"", ",", "name", ".", "charAt", "(", "i", ")", ")", ";", "isValid", "=", "false", ";", "break", ";", "}", "}", "}", "/*\n Note, the null-check for \"value\" is necessary when the annotation processor is hosted inside\n of an IDE where the value attribute of the ManifestAttribute metadata can be null\n temporarily. In order to \"keep going\", just report a warning and proceed.\n */", "if", "(", "value", "==", "null", "||", "value", ".", "length", "(", ")", "==", "0", ")", "{", "_ap", ".", "printError", "(", "_intfDecl", ",", "\"manifestattribute.illegal.name.4\"", ")", ";", "isValid", "=", "false", ";", "}", "else", "{", "// TODO: validate string contents are valid UTF-8?", "}", "return", "isValid", ";", "}" ]
Validates a manifest attribute. If the attribute is invalid, it will generate appropriate APT messager entries and return false, else return true.
[ "Validates", "a", "manifest", "attribute", ".", "If", "the", "attribute", "is", "invalid", "it", "will", "generate", "appropriate", "APT", "messager", "entries", "and", "return", "false", "else", "return", "true", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L747-L797
147,066
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getManifestAttributes
public HashMap<String, String> getManifestAttributes() { HashMap<String,String> attributes = new HashMap<String,String>(); if ( _intfDecl == null ) return attributes; try { ManifestAttributes annotAttrs =_intfDecl.getAnnotation(ManifestAttributes.class); if (annotAttrs != null) { ManifestAttribute [] attrs = (ManifestAttribute [])annotAttrs.value(); for (int i = 0; i < attrs.length; i++) { if (isValidManifestAttribute(attrs[i])) attributes.put(attrs[i].name(), attrs[i].value()); } } ManifestAttribute annotAttr = _intfDecl.getAnnotation(ManifestAttribute.class); if (annotAttr != null) { if (isValidManifestAttribute(annotAttr)) attributes.put(annotAttr.name(), annotAttr.value()); } return attributes; } catch (Exception e) { e.printStackTrace(); return attributes; } }
java
public HashMap<String, String> getManifestAttributes() { HashMap<String,String> attributes = new HashMap<String,String>(); if ( _intfDecl == null ) return attributes; try { ManifestAttributes annotAttrs =_intfDecl.getAnnotation(ManifestAttributes.class); if (annotAttrs != null) { ManifestAttribute [] attrs = (ManifestAttribute [])annotAttrs.value(); for (int i = 0; i < attrs.length; i++) { if (isValidManifestAttribute(attrs[i])) attributes.put(attrs[i].name(), attrs[i].value()); } } ManifestAttribute annotAttr = _intfDecl.getAnnotation(ManifestAttribute.class); if (annotAttr != null) { if (isValidManifestAttribute(annotAttr)) attributes.put(annotAttr.name(), annotAttr.value()); } return attributes; } catch (Exception e) { e.printStackTrace(); return attributes; } }
[ "public", "HashMap", "<", "String", ",", "String", ">", "getManifestAttributes", "(", ")", "{", "HashMap", "<", "String", ",", "String", ">", "attributes", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "if", "(", "_intfDecl", "==", "null", ")", "return", "attributes", ";", "try", "{", "ManifestAttributes", "annotAttrs", "=", "_intfDecl", ".", "getAnnotation", "(", "ManifestAttributes", ".", "class", ")", ";", "if", "(", "annotAttrs", "!=", "null", ")", "{", "ManifestAttribute", "[", "]", "attrs", "=", "(", "ManifestAttribute", "[", "]", ")", "annotAttrs", ".", "value", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "attrs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "isValidManifestAttribute", "(", "attrs", "[", "i", "]", ")", ")", "attributes", ".", "put", "(", "attrs", "[", "i", "]", ".", "name", "(", ")", ",", "attrs", "[", "i", "]", ".", "value", "(", ")", ")", ";", "}", "}", "ManifestAttribute", "annotAttr", "=", "_intfDecl", ".", "getAnnotation", "(", "ManifestAttribute", ".", "class", ")", ";", "if", "(", "annotAttr", "!=", "null", ")", "{", "if", "(", "isValidManifestAttribute", "(", "annotAttr", ")", ")", "attributes", ".", "put", "(", "annotAttr", ".", "name", "(", ")", ",", "annotAttr", ".", "value", "(", ")", ")", ";", "}", "return", "attributes", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "attributes", ";", "}", "}" ]
Returns the array of ManifestAttributes associated with the AptControlInterface
[ "Returns", "the", "array", "of", "ManifestAttributes", "associated", "with", "the", "AptControlInterface" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L802-L830
147,067
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.getIntfPropertyName
private String getIntfPropertyName(AptMethod method) { String opName = method.getName(); int prefixIdx = 3; if (opName.startsWith("is")) prefixIdx = 2; if (opName.length() == prefixIdx + 1) return "" + Character.toLowerCase(opName.charAt(prefixIdx)); return Character.toLowerCase(opName.charAt(prefixIdx)) + opName.substring(prefixIdx+1); }
java
private String getIntfPropertyName(AptMethod method) { String opName = method.getName(); int prefixIdx = 3; if (opName.startsWith("is")) prefixIdx = 2; if (opName.length() == prefixIdx + 1) return "" + Character.toLowerCase(opName.charAt(prefixIdx)); return Character.toLowerCase(opName.charAt(prefixIdx)) + opName.substring(prefixIdx+1); }
[ "private", "String", "getIntfPropertyName", "(", "AptMethod", "method", ")", "{", "String", "opName", "=", "method", ".", "getName", "(", ")", ";", "int", "prefixIdx", "=", "3", ";", "if", "(", "opName", ".", "startsWith", "(", "\"is\"", ")", ")", "prefixIdx", "=", "2", ";", "if", "(", "opName", ".", "length", "(", ")", "==", "prefixIdx", "+", "1", ")", "return", "\"\"", "+", "Character", ".", "toLowerCase", "(", "opName", ".", "charAt", "(", "prefixIdx", ")", ")", ";", "return", "Character", ".", "toLowerCase", "(", "opName", ".", "charAt", "(", "prefixIdx", ")", ")", "+", "opName", ".", "substring", "(", "prefixIdx", "+", "1", ")", ";", "}" ]
Generate a property name from a method name. @param method AptMethod instance. @return property name.
[ "Generate", "a", "property", "name", "from", "a", "method", "name", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L1121-L1132
147,068
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/repeater/pad/Pad.java
Pad.renderEndTag
protected int renderEndTag(int state) throws JspException { if(_padText == null && bodyContent != null) { _padText = bodyContent.getString(); } if(hasErrors()) { reportErrors(); localRelease(); return EVAL_PAGE; } PadContext pc = new PadContext(_padText, (_minRepeat != null ? _minRepeat.intValue() : PadContext.DEFAULT_VALUE), (_maxRepeat != null ? _maxRepeat.intValue() : PadContext.DEFAULT_VALUE)); getRepeater().setPadContext(pc); return EVAL_PAGE; }
java
protected int renderEndTag(int state) throws JspException { if(_padText == null && bodyContent != null) { _padText = bodyContent.getString(); } if(hasErrors()) { reportErrors(); localRelease(); return EVAL_PAGE; } PadContext pc = new PadContext(_padText, (_minRepeat != null ? _minRepeat.intValue() : PadContext.DEFAULT_VALUE), (_maxRepeat != null ? _maxRepeat.intValue() : PadContext.DEFAULT_VALUE)); getRepeater().setPadContext(pc); return EVAL_PAGE; }
[ "protected", "int", "renderEndTag", "(", "int", "state", ")", "throws", "JspException", "{", "if", "(", "_padText", "==", "null", "&&", "bodyContent", "!=", "null", ")", "{", "_padText", "=", "bodyContent", ".", "getString", "(", ")", ";", "}", "if", "(", "hasErrors", "(", ")", ")", "{", "reportErrors", "(", ")", ";", "localRelease", "(", ")", ";", "return", "EVAL_PAGE", ";", "}", "PadContext", "pc", "=", "new", "PadContext", "(", "_padText", ",", "(", "_minRepeat", "!=", "null", "?", "_minRepeat", ".", "intValue", "(", ")", ":", "PadContext", ".", "DEFAULT_VALUE", ")", ",", "(", "_maxRepeat", "!=", "null", "?", "_maxRepeat", ".", "intValue", "(", ")", ":", "PadContext", ".", "DEFAULT_VALUE", ")", ")", ";", "getRepeater", "(", ")", ".", "setPadContext", "(", "pc", ")", ";", "return", "EVAL_PAGE", ";", "}" ]
Complete rendering the body of this tag. If the padText property was unset, the body of the tag is used as the pad text. @param state the current render state of the Repeater @return EVAL_PAGE @throws JspException if an error occurs that can not be reported on the page
[ "Complete", "rendering", "the", "body", "of", "this", "tag", ".", "If", "the", "padText", "property", "was", "unset", "the", "body", "of", "the", "tag", "is", "used", "as", "the", "pad", "text", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/repeater/pad/Pad.java#L181-L201
147,069
uservoice/uservoice-java
src/main/java/com/uservoice/Collection.java
Collection.loadPage
public synchronized JSONArray loadPage(int i) { if (pages == null || pages.get(i) == null) { String url; if (path.contains("?")) { url = path + "&"; } else { url = path + "?"; } //System.out.println(url); JSONObject result = client.get(url + "per_page=" + perPage + "&page=" + i); //System.out.println(result); if (result != null && result.names().size() == 2 && !result.getJSONObject("response_data").isNullObject()) { responseData = result.getJSONObject("response_data"); for (Object name : result.names()) { if (!"response_data".equals(name)) { pages.put(i, result.getJSONArray(name.toString())); } } pages.put(i, pages.get(i)); } else { throw new NotFound("The resource you requested is not a collection."); } } return pages.get(i); }
java
public synchronized JSONArray loadPage(int i) { if (pages == null || pages.get(i) == null) { String url; if (path.contains("?")) { url = path + "&"; } else { url = path + "?"; } //System.out.println(url); JSONObject result = client.get(url + "per_page=" + perPage + "&page=" + i); //System.out.println(result); if (result != null && result.names().size() == 2 && !result.getJSONObject("response_data").isNullObject()) { responseData = result.getJSONObject("response_data"); for (Object name : result.names()) { if (!"response_data".equals(name)) { pages.put(i, result.getJSONArray(name.toString())); } } pages.put(i, pages.get(i)); } else { throw new NotFound("The resource you requested is not a collection."); } } return pages.get(i); }
[ "public", "synchronized", "JSONArray", "loadPage", "(", "int", "i", ")", "{", "if", "(", "pages", "==", "null", "||", "pages", ".", "get", "(", "i", ")", "==", "null", ")", "{", "String", "url", ";", "if", "(", "path", ".", "contains", "(", "\"?\"", ")", ")", "{", "url", "=", "path", "+", "\"&\"", ";", "}", "else", "{", "url", "=", "path", "+", "\"?\"", ";", "}", "//System.out.println(url);", "JSONObject", "result", "=", "client", ".", "get", "(", "url", "+", "\"per_page=\"", "+", "perPage", "+", "\"&page=\"", "+", "i", ")", ";", "//System.out.println(result);", "if", "(", "result", "!=", "null", "&&", "result", ".", "names", "(", ")", ".", "size", "(", ")", "==", "2", "&&", "!", "result", ".", "getJSONObject", "(", "\"response_data\"", ")", ".", "isNullObject", "(", ")", ")", "{", "responseData", "=", "result", ".", "getJSONObject", "(", "\"response_data\"", ")", ";", "for", "(", "Object", "name", ":", "result", ".", "names", "(", ")", ")", "{", "if", "(", "!", "\"response_data\"", ".", "equals", "(", "name", ")", ")", "{", "pages", ".", "put", "(", "i", ",", "result", ".", "getJSONArray", "(", "name", ".", "toString", "(", ")", ")", ")", ";", "}", "}", "pages", ".", "put", "(", "i", ",", "pages", ".", "get", "(", "i", ")", ")", ";", "}", "else", "{", "throw", "new", "NotFound", "(", "\"The resource you requested is not a collection.\"", ")", ";", "}", "}", "return", "pages", ".", "get", "(", "i", ")", ";", "}" ]
Requests i'th page from UserVoice. Thread-safe and makes one HTTP connection. @param i and index between 1..(1/PER_PAGE) + 1 @return The page in a JSONArray @throws APIError if something unexpected happened @throws Unauthorized if the user didn't have permissions to request the page
[ "Requests", "i", "th", "page", "from", "UserVoice", ".", "Thread", "-", "safe", "and", "makes", "one", "HTTP", "connection", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Collection.java#L63-L87
147,070
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XTimer.java
XTimer.formatDuration
public static String formatDuration(long millis) { StringBuilder sb = new StringBuilder(); if(millis > DAY_MILLIS) { sb.append(millis / DAY_MILLIS); sb.append(" days, "); millis %= DAY_MILLIS; } if(millis > HOUR_MILLIS) { sb.append(millis / HOUR_MILLIS); sb.append(" hours, "); millis %= HOUR_MILLIS; } if(millis > MINUTE_MILLIS) { sb.append(millis / MINUTE_MILLIS); sb.append(" minutes, "); millis %= MINUTE_MILLIS; } if(millis > SECOND_MILLIS) { sb.append(millis / SECOND_MILLIS); sb.append(" seconds, "); millis %= SECOND_MILLIS; } sb.append(millis); sb.append(" milliseconds"); return sb.toString(); }
java
public static String formatDuration(long millis) { StringBuilder sb = new StringBuilder(); if(millis > DAY_MILLIS) { sb.append(millis / DAY_MILLIS); sb.append(" days, "); millis %= DAY_MILLIS; } if(millis > HOUR_MILLIS) { sb.append(millis / HOUR_MILLIS); sb.append(" hours, "); millis %= HOUR_MILLIS; } if(millis > MINUTE_MILLIS) { sb.append(millis / MINUTE_MILLIS); sb.append(" minutes, "); millis %= MINUTE_MILLIS; } if(millis > SECOND_MILLIS) { sb.append(millis / SECOND_MILLIS); sb.append(" seconds, "); millis %= SECOND_MILLIS; } sb.append(millis); sb.append(" milliseconds"); return sb.toString(); }
[ "public", "static", "String", "formatDuration", "(", "long", "millis", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "millis", ">", "DAY_MILLIS", ")", "{", "sb", ".", "append", "(", "millis", "/", "DAY_MILLIS", ")", ";", "sb", ".", "append", "(", "\" days, \"", ")", ";", "millis", "%=", "DAY_MILLIS", ";", "}", "if", "(", "millis", ">", "HOUR_MILLIS", ")", "{", "sb", ".", "append", "(", "millis", "/", "HOUR_MILLIS", ")", ";", "sb", ".", "append", "(", "\" hours, \"", ")", ";", "millis", "%=", "HOUR_MILLIS", ";", "}", "if", "(", "millis", ">", "MINUTE_MILLIS", ")", "{", "sb", ".", "append", "(", "millis", "/", "MINUTE_MILLIS", ")", ";", "sb", ".", "append", "(", "\" minutes, \"", ")", ";", "millis", "%=", "MINUTE_MILLIS", ";", "}", "if", "(", "millis", ">", "SECOND_MILLIS", ")", "{", "sb", ".", "append", "(", "millis", "/", "SECOND_MILLIS", ")", ";", "sb", ".", "append", "(", "\" seconds, \"", ")", ";", "millis", "%=", "SECOND_MILLIS", ";", "}", "sb", ".", "append", "(", "millis", ")", ";", "sb", ".", "append", "(", "\" milliseconds\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Formats a duration in milliseconds as a pretty-print string. @param millis Duration in milliseconds. @return Given duration as a pretty-print string.
[ "Formats", "a", "duration", "in", "milliseconds", "as", "a", "pretty", "-", "print", "string", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XTimer.java#L137-L162
147,071
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/in/XMxmlParser.java
XMxmlParser.parse
public List<XLog> parse(InputStream is) throws Exception { BufferedInputStream bis = new BufferedInputStream(is); // set up a specialized SAX2 handler to fill the container MxmlHandler handler = new MxmlHandler(); // set up SAX parser and parse provided log file into the container SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(bis, handler); bis.close(); return handler.getLogs(); }
java
public List<XLog> parse(InputStream is) throws Exception { BufferedInputStream bis = new BufferedInputStream(is); // set up a specialized SAX2 handler to fill the container MxmlHandler handler = new MxmlHandler(); // set up SAX parser and parse provided log file into the container SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(bis, handler); bis.close(); return handler.getLogs(); }
[ "public", "List", "<", "XLog", ">", "parse", "(", "InputStream", "is", ")", "throws", "Exception", "{", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "is", ")", ";", "// set up a specialized SAX2 handler to fill the container", "MxmlHandler", "handler", "=", "new", "MxmlHandler", "(", ")", ";", "// set up SAX parser and parse provided log file into the container", "SAXParserFactory", "parserFactory", "=", "SAXParserFactory", ".", "newInstance", "(", ")", ";", "SAXParser", "parser", "=", "parserFactory", ".", "newSAXParser", "(", ")", ";", "parser", ".", "parse", "(", "bis", ",", "handler", ")", ";", "bis", ".", "close", "(", ")", ";", "return", "handler", ".", "getLogs", "(", ")", ";", "}" ]
Parses a set of logs from the given input stream, which is supposed to deliver an MXML serialization. @param is Input stream, which is supposed to deliver an MXML serialization. @return The parsed list of logs.
[ "Parses", "a", "set", "of", "logs", "from", "the", "given", "input", "stream", "which", "is", "supposed", "to", "deliver", "an", "MXML", "serialization", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/in/XMxmlParser.java#L191-L201
147,072
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/EventNotifier.java
EventNotifier.removeListener
synchronized public void removeListener(Object listener) { if (!_listeners.contains(listener)) throw new IllegalStateException("Invalid listener, not currently registered"); _listeners.remove(listener); }
java
synchronized public void removeListener(Object listener) { if (!_listeners.contains(listener)) throw new IllegalStateException("Invalid listener, not currently registered"); _listeners.remove(listener); }
[ "synchronized", "public", "void", "removeListener", "(", "Object", "listener", ")", "{", "if", "(", "!", "_listeners", ".", "contains", "(", "listener", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Invalid listener, not currently registered\"", ")", ";", "_listeners", ".", "remove", "(", "listener", ")", ";", "}" ]
Remove an existing callback event listener for this EventNotifier
[ "Remove", "an", "existing", "callback", "event", "listener", "for", "this", "EventNotifier" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/EventNotifier.java#L41-L47
147,073
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextChildSupport.java
ControlBeanContextChildSupport.firePropertyChange
protected void firePropertyChange(String name, Object oldValue, Object newValue) { _propertyChangeSupport.firePropertyChange(name, oldValue, newValue); }
java
protected void firePropertyChange(String name, Object oldValue, Object newValue) { _propertyChangeSupport.firePropertyChange(name, oldValue, newValue); }
[ "protected", "void", "firePropertyChange", "(", "String", "name", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "_propertyChangeSupport", ".", "firePropertyChange", "(", "name", ",", "oldValue", ",", "newValue", ")", ";", "}" ]
Fire a property change event. @param name @param oldValue @param newValue
[ "Fire", "a", "property", "change", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextChildSupport.java#L216-L218
147,074
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java
SqlFragmentContainer.getChildren
SqlFragment[] getChildren() { SqlFragment[] fragments = new SqlFragment[_children.size()]; return _children.toArray(fragments); }
java
SqlFragment[] getChildren() { SqlFragment[] fragments = new SqlFragment[_children.size()]; return _children.toArray(fragments); }
[ "SqlFragment", "[", "]", "getChildren", "(", ")", "{", "SqlFragment", "[", "]", "fragments", "=", "new", "SqlFragment", "[", "_children", ".", "size", "(", ")", "]", ";", "return", "_children", ".", "toArray", "(", "fragments", ")", ";", "}" ]
Return the array of children. @return An array of SqlFragments.
[ "Return", "the", "array", "of", "children", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java#L67-L70
147,075
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java
SqlFragmentContainer.getPreparedStatementText
String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) { StringBuilder sb = new StringBuilder(); for (SqlFragment sf : _children) { sb.append(sf.getPreparedStatementText(context, m, args)); } return sb.toString(); }
java
String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) { StringBuilder sb = new StringBuilder(); for (SqlFragment sf : _children) { sb.append(sf.getPreparedStatementText(context, m, args)); } return sb.toString(); }
[ "String", "getPreparedStatementText", "(", "ControlBeanContext", "context", ",", "Method", "m", ",", "Object", "[", "]", "args", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "SqlFragment", "sf", ":", "_children", ")", "{", "sb", ".", "append", "(", "sf", ".", "getPreparedStatementText", "(", "context", ",", "m", ",", "args", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
builds the text of the prepared statement @param context A ControlBeanContext instance. @param m The annotated method. @param args The method's parameters. @return The PreparedStatement text generated by this fragment and its children.
[ "builds", "the", "text", "of", "the", "prepared", "statement" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlFragmentContainer.java#L92-L98
147,076
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Image.java
Image.doEndTag
public int doEndTag() throws JspException { ServletRequest req = pageContext.getRequest(); String scriptId = null; // report errors that may have occurred if (hasErrors()) return reportAndExit(EVAL_PAGE); // Generate the name definition or image element String uri = null; if (_state.src != null) { try { uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _state.src, _params, _location); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Image_URLException", new Object[]{_state.src, e.getMessage()}); registerTagError(s, e); } } if (uri != null) { _state.src = ((HttpServletResponse) pageContext.getResponse()).encodeURL(uri); } // we assume that tagId will over have override id if both // are defined. if (_state.id != null) { scriptId = renderNameAndId((HttpServletRequest) req, _state, null); } WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.IMAGE_TAG, req); br.doStartTag(writer, _state); br.doEndTag(writer); if (scriptId != null) write(scriptId); // Evaluate the remainder of this page localRelease(); return EVAL_PAGE; }
java
public int doEndTag() throws JspException { ServletRequest req = pageContext.getRequest(); String scriptId = null; // report errors that may have occurred if (hasErrors()) return reportAndExit(EVAL_PAGE); // Generate the name definition or image element String uri = null; if (_state.src != null) { try { uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _state.src, _params, _location); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Image_URLException", new Object[]{_state.src, e.getMessage()}); registerTagError(s, e); } } if (uri != null) { _state.src = ((HttpServletResponse) pageContext.getResponse()).encodeURL(uri); } // we assume that tagId will over have override id if both // are defined. if (_state.id != null) { scriptId = renderNameAndId((HttpServletRequest) req, _state, null); } WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.IMAGE_TAG, req); br.doStartTag(writer, _state); br.doEndTag(writer); if (scriptId != null) write(scriptId); // Evaluate the remainder of this page localRelease(); return EVAL_PAGE; }
[ "public", "int", "doEndTag", "(", ")", "throws", "JspException", "{", "ServletRequest", "req", "=", "pageContext", ".", "getRequest", "(", ")", ";", "String", "scriptId", "=", "null", ";", "// report errors that may have occurred", "if", "(", "hasErrors", "(", ")", ")", "return", "reportAndExit", "(", "EVAL_PAGE", ")", ";", "// Generate the name definition or image element", "String", "uri", "=", "null", ";", "if", "(", "_state", ".", "src", "!=", "null", ")", "{", "try", "{", "uri", "=", "PageFlowTagUtils", ".", "rewriteResourceURL", "(", "pageContext", ",", "_state", ".", "src", ",", "_params", ",", "_location", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "// report the error...", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_Image_URLException\"", ",", "new", "Object", "[", "]", "{", "_state", ".", "src", ",", "e", ".", "getMessage", "(", ")", "}", ")", ";", "registerTagError", "(", "s", ",", "e", ")", ";", "}", "}", "if", "(", "uri", "!=", "null", ")", "{", "_state", ".", "src", "=", "(", "(", "HttpServletResponse", ")", "pageContext", ".", "getResponse", "(", ")", ")", ".", "encodeURL", "(", "uri", ")", ";", "}", "// we assume that tagId will over have override id if both", "// are defined.", "if", "(", "_state", ".", "id", "!=", "null", ")", "{", "scriptId", "=", "renderNameAndId", "(", "(", "HttpServletRequest", ")", "req", ",", "_state", ",", "null", ")", ";", "}", "WriteRenderAppender", "writer", "=", "new", "WriteRenderAppender", "(", "pageContext", ")", ";", "TagRenderingBase", "br", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "IMAGE_TAG", ",", "req", ")", ";", "br", ".", "doStartTag", "(", "writer", ",", "_state", ")", ";", "br", ".", "doEndTag", "(", "writer", ")", ";", "if", "(", "scriptId", "!=", "null", ")", "write", "(", "scriptId", ")", ";", "// Evaluate the remainder of this page", "localRelease", "(", ")", ";", "return", "EVAL_PAGE", ";", "}" ]
Render the end of the IMG tag. @throws JspException if a JSP exception has occurred
[ "Render", "the", "end", "of", "the", "IMG", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Image.java#L289-L334
147,077
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
PageFlowPageFilter.continueChainNoWrapper
private static void continueChainNoWrapper( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { // // Remove our request wrapper -- the page doesn't need to see this. // if ( request instanceof PageFlowRequestWrapper ) request = ((PageFlowRequestWrapper)request).getHttpRequest(); chain.doFilter( request, response ); }
java
private static void continueChainNoWrapper( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { // // Remove our request wrapper -- the page doesn't need to see this. // if ( request instanceof PageFlowRequestWrapper ) request = ((PageFlowRequestWrapper)request).getHttpRequest(); chain.doFilter( request, response ); }
[ "private", "static", "void", "continueChainNoWrapper", "(", "ServletRequest", "request", ",", "ServletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "//", "// Remove our request wrapper -- the page doesn't need to see this.", "//", "if", "(", "request", "instanceof", "PageFlowRequestWrapper", ")", "request", "=", "(", "(", "PageFlowRequestWrapper", ")", "request", ")", ".", "getHttpRequest", "(", ")", ";", "chain", ".", "doFilter", "(", "request", ",", "response", ")", ";", "}" ]
Internal method used to handle cases where the filter should continue without processing the request by rendering a page associated with a page flow. @param request the request @param response the response @param chain the filter chain @throws IOException @throws ServletException
[ "Internal", "method", "used", "to", "handle", "cases", "where", "the", "filter", "should", "continue", "without", "processing", "the", "request", "by", "rendering", "a", "page", "associated", "with", "a", "page", "flow", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java#L459-L469
147,078
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setStyle
public void setStyle(String style) { if ("".equals(style)) return; AbstractHtmlState tsh = getState(); tsh.style = style; }
java
public void setStyle(String style) { if ("".equals(style)) return; AbstractHtmlState tsh = getState(); tsh.style = style; }
[ "public", "void", "setStyle", "(", "String", "style", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "style", ")", ")", "return", ";", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "style", "=", "style", ";", "}" ]
Sets the style of the rendered html tag. @param style the html style. @jsptagref.attributedescription Specifies style information for the current element. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_style</i> @netui:attribute required="false" rtexprvalue="true" description="Specifies style information for the current element."
[ "Sets", "the", "style", "of", "the", "rendered", "html", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L64-L70
147,079
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setStyleClass
public void setStyleClass(String styleClass) { if ("".equals(styleClass)) return; AbstractHtmlState tsh = getState(); tsh.styleClass = styleClass; }
java
public void setStyleClass(String styleClass) { if ("".equals(styleClass)) return; AbstractHtmlState tsh = getState(); tsh.styleClass = styleClass; }
[ "public", "void", "setStyleClass", "(", "String", "styleClass", ")", "{", "if", "(", "\"\"", ".", "equals", "(", "styleClass", ")", ")", "return", ";", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "styleClass", "=", "styleClass", ";", "}" ]
Sets the style class of the rendered html tag. @param styleClass the html style class. @jsptagref.attributedescription The style class (a style sheet selector). @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_styleClass</i> @netui:attribute required="false" rtexprvalue="true" description="The style class (a style sheet selector)."
[ "Sets", "the", "style", "class", "of", "the", "rendered", "html", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L81-L87
147,080
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setTitle
public void setTitle(String title) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TITLE, title); }
java
public void setTitle(String title) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TITLE, title); }
[ "public", "void", "setTitle", "(", "String", "title", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "TITLE", ",", "title", ")", ";", "}" ]
Sets the value of the title attribute. @param title @jsptagref.attributedescription The title. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_title</i> @netui:attribute required="false" rtexprvalue="true" description="The title. "
[ "Sets", "the", "value", "of", "the", "title", "attribute", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L230-L234
147,081
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setLang
public void setLang(String lang) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, LANG, lang); }
java
public void setLang(String lang) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, LANG, lang); }
[ "public", "void", "setLang", "(", "String", "lang", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "LANG", ",", "lang", ")", ";", "}" ]
Sets the lang attribute for the HTML element. @param lang @jsptagref.attributedescription Sets the language code for the base language of an element's attribute values and text content. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_lang</i> @netui:attribute required="false" rtexprvalue="true" description="Sets the language code for the base language of an element's attribute values and text content."
[ "Sets", "the", "lang", "attribute", "for", "the", "HTML", "element", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L247-L251
147,082
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setDir
public void setDir(String dir) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, DIR, dir); }
java
public void setDir(String dir) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, DIR, dir); }
[ "public", "void", "setDir", "(", "String", "dir", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "DIR", ",", "dir", ")", ";", "}" ]
Sets the dir attribute for the HTML element. @param dir @jsptagref.attributedescription Specifies the direction of text. (<code>LTR | RTL</code>) @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_dir</i> @netui:attribute required="false" rtexprvalue="true" description="Specifies the direction of text. (LTR | RTL)"
[ "Sets", "the", "dir", "attribute", "for", "the", "HTML", "element", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L262-L266
147,083
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.getOnClick
public String getOnClick() { AbstractHtmlState tsh = getState(); return tsh.getAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK); }
java
public String getOnClick() { AbstractHtmlState tsh = getState(); return tsh.getAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK); }
[ "public", "String", "getOnClick", "(", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "return", "tsh", ".", "getAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONCLICK", ")", ";", "}" ]
Gets the onClick javascript event. @return the onClick event.
[ "Gets", "the", "onClick", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L273-L277
147,084
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnDblClick
public void setOnDblClick(String ondblclick) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONDBLCLICK, ondblclick); }
java
public void setOnDblClick(String ondblclick) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONDBLCLICK, ondblclick); }
[ "public", "void", "setOnDblClick", "(", "String", "ondblclick", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONDBLCLICK", ",", "ondblclick", ")", ";", "}" ]
Sets the onDblClick javascript event. @param ondblclick the onDblClick event. @jsptagref.attributedescription The onDblClick JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onDblClick</i> @netui:attribute required="false" rtexprvalue="true" description="The onDblClick JavaScript event."
[ "Sets", "the", "onDblClick", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L303-L307
147,085
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnKeyDown
public void setOnKeyDown(String onkeydown) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONKEYDOWN, onkeydown); }
java
public void setOnKeyDown(String onkeydown) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONKEYDOWN, onkeydown); }
[ "public", "void", "setOnKeyDown", "(", "String", "onkeydown", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONKEYDOWN", ",", "onkeydown", ")", ";", "}" ]
Sets the onKeyDown javascript event. @param onkeydown the onKeyDown event. @jsptagref.attributedescription The onKeyDown JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onKeyDown</i> @netui:attribute required="false" rtexprvalue="true" description="The onKeyDown JavaScript event."
[ "Sets", "the", "onKeyDown", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L318-L322
147,086
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnKeyPress
public void setOnKeyPress(String onkeypress) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONKEYPRESS, onkeypress); }
java
public void setOnKeyPress(String onkeypress) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONKEYPRESS, onkeypress); }
[ "public", "void", "setOnKeyPress", "(", "String", "onkeypress", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONKEYPRESS", ",", "onkeypress", ")", ";", "}" ]
Sets the onKeyPress javascript event. @param onkeypress the onKeyPress event. @jsptagref.attributedescription The onKeyPress JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onKeyPress</i> @netui:attribute required="false" rtexprvalue="true" description="The onKeyPress JavaScript event."
[ "Sets", "the", "onKeyPress", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L333-L337
147,087
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnKeyUp
public void setOnKeyUp(String onkeyup) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONKEYUP, onkeyup); }
java
public void setOnKeyUp(String onkeyup) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONKEYUP, onkeyup); }
[ "public", "void", "setOnKeyUp", "(", "String", "onkeyup", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONKEYUP", ",", "onkeyup", ")", ";", "}" ]
Sets the onKeyUp javascript event. @param onkeyup the onKeyUp event. @jsptagref.attributedescription The onKeyUp JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onKeyUp</i> @netui:attribute required="false" rtexprvalue="true" description="The onKeyUp JavaScript event."
[ "Sets", "the", "onKeyUp", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L348-L352
147,088
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnMouseDown
public void setOnMouseDown(String onmousedown) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEDOWN, onmousedown); }
java
public void setOnMouseDown(String onmousedown) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEDOWN, onmousedown); }
[ "public", "void", "setOnMouseDown", "(", "String", "onmousedown", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEDOWN", ",", "onmousedown", ")", ";", "}" ]
Sets the onMouseDown javascript event. @param onmousedown the onMouseDown event. @jsptagref.attributedescription The onMouseDown JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onMouseDown</i> @netui:attribute required="false" rtexprvalue="true" description="The onMouseDown JavaScript event."
[ "Sets", "the", "onMouseDown", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L363-L367
147,089
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnMouseMove
public void setOnMouseMove(String onmousemove) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEMOVE, onmousemove); }
java
public void setOnMouseMove(String onmousemove) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEMOVE, onmousemove); }
[ "public", "void", "setOnMouseMove", "(", "String", "onmousemove", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEMOVE", ",", "onmousemove", ")", ";", "}" ]
Sets the onMouseMove javascript event. @param onmousemove the onMouseMove event. @jsptagref.attributedescription The onMouseMove JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onMouseMove</i> @netui:attribute required="false" rtexprvalue="true" description="The onMouseMove JavaScript event."
[ "Sets", "the", "onMouseMove", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L378-L382
147,090
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnMouseOut
public void setOnMouseOut(String onmouseout) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOUT, onmouseout); }
java
public void setOnMouseOut(String onmouseout) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOUT, onmouseout); }
[ "public", "void", "setOnMouseOut", "(", "String", "onmouseout", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEOUT", ",", "onmouseout", ")", ";", "}" ]
Sets the onMouseOut javascript event. @param onmouseout the onMouseOut event. @jsptagref.attributedescription The onMouseOut JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onMouseOut</i> @netui:attribute required="false" rtexprvalue="true" description="The onMouseOut JavaScript event."
[ "Sets", "the", "onMouseOut", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L393-L397
147,091
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnMouseOver
public void setOnMouseOver(String onmouseover) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOVER, onmouseover); }
java
public void setOnMouseOver(String onmouseover) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOVER, onmouseover); }
[ "public", "void", "setOnMouseOver", "(", "String", "onmouseover", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEOVER", ",", "onmouseover", ")", ";", "}" ]
Sets the onMouseOver javascript event. @param onmouseover the onMouseOver event. @jsptagref.attributedescription The onMouseOver JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onMouseOver</i> @netui:attribute required="false" rtexprvalue="true" description="The onMouseOver JavaScript event."
[ "Sets", "the", "onMouseOver", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L408-L412
147,092
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setOnMouseUp
public void setOnMouseUp(String onmouseup) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEUP, onmouseup); }
java
public void setOnMouseUp(String onmouseup) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEUP, onmouseup); }
[ "public", "void", "setOnMouseUp", "(", "String", "onmouseup", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEUP", ",", "onmouseup", ")", ";", "}" ]
Sets the onMouseUp javascript event. @param onmouseup the onMouseUp event. @jsptagref.attributedescription The onMouseUp JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onMouseUp</i> @netui:attribute required="false" rtexprvalue="true" description="The onMouseUp JavaScript event."
[ "Sets", "the", "onMouseUp", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L423-L427
147,093
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java
HtmlBaseTag.setStateAttribute
protected void setStateAttribute(String name, String value, AbstractHtmlState tsh) throws JspException { boolean error = false; // validate the name attribute, in the case of an error simply return. if (name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); registerTagError(s, null); error = true; } // it's not legal to set the id or name attributes this way if (name != null && (name.equals(ID) || name.equals(NAME))) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); registerTagError(s, null); } if (error) return; // if there is a style or class we will let them override the base if (name.equals(CLASS)) { tsh.styleClass = value; return; } else if (name.equals(STYLE)) { tsh.style = value; return; } tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value); }
java
protected void setStateAttribute(String name, String value, AbstractHtmlState tsh) throws JspException { boolean error = false; // validate the name attribute, in the case of an error simply return. if (name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); registerTagError(s, null); error = true; } // it's not legal to set the id or name attributes this way if (name != null && (name.equals(ID) || name.equals(NAME))) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); registerTagError(s, null); } if (error) return; // if there is a style or class we will let them override the base if (name.equals(CLASS)) { tsh.styleClass = value; return; } else if (name.equals(STYLE)) { tsh.style = value; return; } tsh.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value); }
[ "protected", "void", "setStateAttribute", "(", "String", "name", ",", "String", "value", ",", "AbstractHtmlState", "tsh", ")", "throws", "JspException", "{", "boolean", "error", "=", "false", ";", "// validate the name attribute, in the case of an error simply return.", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "<=", "0", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_AttributeNameNotSet\"", ")", ";", "registerTagError", "(", "s", ",", "null", ")", ";", "error", "=", "true", ";", "}", "// it's not legal to set the id or name attributes this way", "if", "(", "name", "!=", "null", "&&", "(", "name", ".", "equals", "(", "ID", ")", "||", "name", ".", "equals", "(", "NAME", ")", ")", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_AttributeMayNotBeSet\"", ",", "new", "Object", "[", "]", "{", "name", "}", ")", ";", "registerTagError", "(", "s", ",", "null", ")", ";", "}", "if", "(", "error", ")", "return", ";", "// if there is a style or class we will let them override the base", "if", "(", "name", ".", "equals", "(", "CLASS", ")", ")", "{", "tsh", ".", "styleClass", "=", "value", ";", "return", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "STYLE", ")", ")", "{", "tsh", ".", "style", "=", "value", ";", "return", ";", "}", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "name", ",", "value", ")", ";", "}" ]
Attribute implementation. @param name @param value @param tsh @throws JspException
[ "Attribute", "implementation", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlBaseTag.java#L445-L475
147,094
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/logging/Logger.java
Logger.getInstance
public static Logger getInstance(Class loggerClient) { return new Logger(org.apache.commons.logging.LogFactory.getLog(loggerClient.getName())); }
java
public static Logger getInstance(Class loggerClient) { return new Logger(org.apache.commons.logging.LogFactory.getLog(loggerClient.getName())); }
[ "public", "static", "Logger", "getInstance", "(", "Class", "loggerClient", ")", "{", "return", "new", "Logger", "(", "org", ".", "apache", ".", "commons", ".", "logging", ".", "LogFactory", ".", "getLog", "(", "loggerClient", ".", "getName", "(", ")", ")", ")", ";", "}" ]
Factory method for creating NetUI Logger instances. @param loggerClient the class whose logger to create @return a {@link Logger} instance for the given class
[ "Factory", "method", "for", "creating", "NetUI", "Logger", "instances", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/logging/Logger.java#L44-L46
147,095
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/chain/impl/ChainBase.java
ChainBase.addCommand
public void addCommand(Command command) { if(command == null) throw new IllegalArgumentException(); if(_frozen) throw new IllegalStateException(); Command[] results = new Command[_commands.length + 1]; System.arraycopy(_commands, 0, results, 0, _commands.length); results[_commands.length] = command; _commands = results; }
java
public void addCommand(Command command) { if(command == null) throw new IllegalArgumentException(); if(_frozen) throw new IllegalStateException(); Command[] results = new Command[_commands.length + 1]; System.arraycopy(_commands, 0, results, 0, _commands.length); results[_commands.length] = command; _commands = results; }
[ "public", "void", "addCommand", "(", "Command", "command", ")", "{", "if", "(", "command", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "_frozen", ")", "throw", "new", "IllegalStateException", "(", ")", ";", "Command", "[", "]", "results", "=", "new", "Command", "[", "_commands", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "_commands", ",", "0", ",", "results", ",", "0", ",", "_commands", ".", "length", ")", ";", "results", "[", "_commands", ".", "length", "]", "=", "command", ";", "_commands", "=", "results", ";", "}" ]
Add a command to the chian. @param command the new command
[ "Add", "a", "command", "to", "the", "chian", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/chain/impl/ChainBase.java#L41-L52
147,096
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/naming/IndexedNameInterceptor.java
IndexedNameInterceptor.rewriteName
public final String rewriteName(String name, Tag currentTag) throws ExpressionEvaluationException { if (_logger.isDebugEnabled()) _logger.debug("rewrite expression \"" + name + "\""); IDataAccessProvider dap = getCurrentProvider(currentTag); // if the DAP is null, there is no rewriting to do if (dap == null) return name; // given a hierarchy of "container.container.container.item.someProp", the correct parent needs // to be found so that expression rewriting can happen correctly. // // ensure that this expression contains container.item Expression parsed = getExpressionEvaluator().parseExpression(name); assert parsed != null; int containerCount = 0; List tokens = parsed.getTokens(); for (int i = 0; i < tokens.size(); i++) { String tok = tokens.get(i).toString(); if (i == 0) { if (!tok.equals("container")) break; else continue; } // this skips the "current" IDataAccessProvider else if (tok.equals("container")) containerCount++; else if (tok.equals("item")) break; } if (_logger.isDebugEnabled()) _logger.debug("container parent count: " + containerCount); // now walk up the DataAccessProvier hierarchy until the top-most parent is found // the top-most parent is the first one that does not reference "container.item" but // is bound directly to a specific object such as "actionForm" or "pageFlow". This // handles the case where a set of nested IDataAccessProvider tags are "skipped" by // an expression like "container.container.container.item.foo". In order to find // the correct root to start rewriting the names, one needs to walk up three // DAPs in order to find the correct root from which to start. // // In general, containerCount is zero here for the "container.item.foo" case. for (int i = 0; i < containerCount; i++) { dap = dap.getProviderParent(); } // now, the top-most DAP parent is known assert dap != null; // strip off the "container.item" from the expression that is being rewritten // this should be two tokens into the expression. if (containerCount > 0) { name = parsed.getExpression(containerCount); } // now, change the binding context of the parent DAP hierarchy to create a // String that looks like "actionForm.customers[42].order[12].lineItem[2].name" // note, this is done without using the expression that was passed-in and // is derived entirely from the IDataAccessProvider parent hierarchy. String parentNames = rewriteNameInternal(dap); if (_logger.isDebugEnabled()) _logger.debug("name hierarchy: " + parentNames + " name: " + name); // with a newly re-written expression prefix, substitute this fully-qualified binding // string into the given expression for "container.item". String newName = changeContext(name, "container.item", parentNames, dap.getCurrentIndex()); if (_logger.isDebugEnabled()) _logger.debug("rewrittenName: " + newName); return newName; }
java
public final String rewriteName(String name, Tag currentTag) throws ExpressionEvaluationException { if (_logger.isDebugEnabled()) _logger.debug("rewrite expression \"" + name + "\""); IDataAccessProvider dap = getCurrentProvider(currentTag); // if the DAP is null, there is no rewriting to do if (dap == null) return name; // given a hierarchy of "container.container.container.item.someProp", the correct parent needs // to be found so that expression rewriting can happen correctly. // // ensure that this expression contains container.item Expression parsed = getExpressionEvaluator().parseExpression(name); assert parsed != null; int containerCount = 0; List tokens = parsed.getTokens(); for (int i = 0; i < tokens.size(); i++) { String tok = tokens.get(i).toString(); if (i == 0) { if (!tok.equals("container")) break; else continue; } // this skips the "current" IDataAccessProvider else if (tok.equals("container")) containerCount++; else if (tok.equals("item")) break; } if (_logger.isDebugEnabled()) _logger.debug("container parent count: " + containerCount); // now walk up the DataAccessProvier hierarchy until the top-most parent is found // the top-most parent is the first one that does not reference "container.item" but // is bound directly to a specific object such as "actionForm" or "pageFlow". This // handles the case where a set of nested IDataAccessProvider tags are "skipped" by // an expression like "container.container.container.item.foo". In order to find // the correct root to start rewriting the names, one needs to walk up three // DAPs in order to find the correct root from which to start. // // In general, containerCount is zero here for the "container.item.foo" case. for (int i = 0; i < containerCount; i++) { dap = dap.getProviderParent(); } // now, the top-most DAP parent is known assert dap != null; // strip off the "container.item" from the expression that is being rewritten // this should be two tokens into the expression. if (containerCount > 0) { name = parsed.getExpression(containerCount); } // now, change the binding context of the parent DAP hierarchy to create a // String that looks like "actionForm.customers[42].order[12].lineItem[2].name" // note, this is done without using the expression that was passed-in and // is derived entirely from the IDataAccessProvider parent hierarchy. String parentNames = rewriteNameInternal(dap); if (_logger.isDebugEnabled()) _logger.debug("name hierarchy: " + parentNames + " name: " + name); // with a newly re-written expression prefix, substitute this fully-qualified binding // string into the given expression for "container.item". String newName = changeContext(name, "container.item", parentNames, dap.getCurrentIndex()); if (_logger.isDebugEnabled()) _logger.debug("rewrittenName: " + newName); return newName; }
[ "public", "final", "String", "rewriteName", "(", "String", "name", ",", "Tag", "currentTag", ")", "throws", "ExpressionEvaluationException", "{", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "_logger", ".", "debug", "(", "\"rewrite expression \\\"\"", "+", "name", "+", "\"\\\"\"", ")", ";", "IDataAccessProvider", "dap", "=", "getCurrentProvider", "(", "currentTag", ")", ";", "// if the DAP is null, there is no rewriting to do", "if", "(", "dap", "==", "null", ")", "return", "name", ";", "// given a hierarchy of \"container.container.container.item.someProp\", the correct parent needs", "// to be found so that expression rewriting can happen correctly.", "//", "// ensure that this expression contains container.item", "Expression", "parsed", "=", "getExpressionEvaluator", "(", ")", ".", "parseExpression", "(", "name", ")", ";", "assert", "parsed", "!=", "null", ";", "int", "containerCount", "=", "0", ";", "List", "tokens", "=", "parsed", ".", "getTokens", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tokens", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "tok", "=", "tokens", ".", "get", "(", "i", ")", ".", "toString", "(", ")", ";", "if", "(", "i", "==", "0", ")", "{", "if", "(", "!", "tok", ".", "equals", "(", "\"container\"", ")", ")", "break", ";", "else", "continue", ";", "}", "// this skips the \"current\" IDataAccessProvider", "else", "if", "(", "tok", ".", "equals", "(", "\"container\"", ")", ")", "containerCount", "++", ";", "else", "if", "(", "tok", ".", "equals", "(", "\"item\"", ")", ")", "break", ";", "}", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "_logger", ".", "debug", "(", "\"container parent count: \"", "+", "containerCount", ")", ";", "// now walk up the DataAccessProvier hierarchy until the top-most parent is found", "// the top-most parent is the first one that does not reference \"container.item\" but", "// is bound directly to a specific object such as \"actionForm\" or \"pageFlow\". This ", "// handles the case where a set of nested IDataAccessProvider tags are \"skipped\" by", "// an expression like \"container.container.container.item.foo\". In order to find", "// the correct root to start rewriting the names, one needs to walk up three ", "// DAPs in order to find the correct root from which to start. ", "//", "// In general, containerCount is zero here for the \"container.item.foo\" case.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "containerCount", ";", "i", "++", ")", "{", "dap", "=", "dap", ".", "getProviderParent", "(", ")", ";", "}", "// now, the top-most DAP parent is known", "assert", "dap", "!=", "null", ";", "// strip off the \"container.item\" from the expression that is being rewritten", "// this should be two tokens into the expression.", "if", "(", "containerCount", ">", "0", ")", "{", "name", "=", "parsed", ".", "getExpression", "(", "containerCount", ")", ";", "}", "// now, change the binding context of the parent DAP hierarchy to create a ", "// String that looks like \"actionForm.customers[42].order[12].lineItem[2].name\"", "// note, this is done without using the expression that was passed-in and ", "// is derived entirely from the IDataAccessProvider parent hierarchy.", "String", "parentNames", "=", "rewriteNameInternal", "(", "dap", ")", ";", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "_logger", ".", "debug", "(", "\"name hierarchy: \"", "+", "parentNames", "+", "\" name: \"", "+", "name", ")", ";", "// with a newly re-written expression prefix, substitute this fully-qualified binding", "// string into the given expression for \"container.item\".", "String", "newName", "=", "changeContext", "(", "name", ",", "\"container.item\"", ",", "parentNames", ",", "dap", ".", "getCurrentIndex", "(", ")", ")", ";", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "_logger", ".", "debug", "(", "\"rewrittenName: \"", "+", "newName", ")", ";", "return", "newName", ";", "}" ]
Rewrite an expression into a fully-qualified reference to a specific JavaBean property on an object. @param name the expression to rewrite @param currentTag the current JSP tag that can be used as the leaf for walking up to find parent tags that provide information used to rewrite the expression.
[ "Rewrite", "an", "expression", "into", "a", "fully", "-", "qualified", "reference", "to", "a", "specific", "JavaBean", "property", "on", "an", "object", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/naming/IndexedNameInterceptor.java#L60-L133
147,097
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/naming/IndexedNameInterceptor.java
IndexedNameInterceptor.rewriteNameInternal
private final String rewriteNameInternal(IDataAccessProvider dap) throws ExpressionEvaluationException { if (_logger.isDebugEnabled()) _logger.debug("assign index to name: " + dap.getDataSource()); Expression parsedDataSource = getExpressionEvaluator().parseExpression(dap.getDataSource()); assert parsedDataSource != null; // @todo: perf boolean isContainerBound = (parsedDataSource.getTokens().get(0)).toString().equals("container"); // rewrite the name of the current IDataAccessProvider. String parentName = null; // if the current DAP has a parent IDataAccessProvider, rewrite the name of the parent if (dap.getProviderParent() != null) parentName = rewriteNameInternal(dap.getProviderParent()); // if the current DAP has no parent, or it does not reference the "container." binding context, // we've found the "root" IDataAccessProvider else if (dap.getProviderParent() == null || (dap.getProviderParent() != null && !isContainerBound)) { return dap.getDataSource(); } // now, we've found the root and can start rewriting the expressions throughout // the rest of the DAP hierarchy if (_logger.isDebugEnabled()) { _logger.debug("changeContext: DAP.dataSource=" + dap.getDataSource() + " oldContext=container newContext=" + parentName + " currentIndex=" + dap.getProviderParent().getCurrentIndex() + " parentName is container: " + isContainerBound); } String retVal = null; String ds = dap.getDataSource(); // If the current DAP's dataSource is "container.item", the binding context needs to change to that // of the parent. This case should only occur for the last token -- the "name" passed into // the method. Oterwise, just replace the "container" to that of the parent. Both are // qualified with the DAP's current index so that "actionForm.customers" becomes // "actionForm.customers[12]". boolean isContainerItemBound = false; if (isContainerBound && (parsedDataSource.getTokens().get(1)).toString().equals("item")) isContainerItemBound = true; if (isContainerItemBound) retVal = changeContext(ds, "container.item", parentName, dap.getProviderParent().getCurrentIndex()); else retVal = changeContext(ds, "container", parentName, dap.getProviderParent().getCurrentIndex()); if (_logger.isDebugEnabled()) _logger.debug("fully-qualified binding expression: \"" + retVal + "\""); return retVal; }
java
private final String rewriteNameInternal(IDataAccessProvider dap) throws ExpressionEvaluationException { if (_logger.isDebugEnabled()) _logger.debug("assign index to name: " + dap.getDataSource()); Expression parsedDataSource = getExpressionEvaluator().parseExpression(dap.getDataSource()); assert parsedDataSource != null; // @todo: perf boolean isContainerBound = (parsedDataSource.getTokens().get(0)).toString().equals("container"); // rewrite the name of the current IDataAccessProvider. String parentName = null; // if the current DAP has a parent IDataAccessProvider, rewrite the name of the parent if (dap.getProviderParent() != null) parentName = rewriteNameInternal(dap.getProviderParent()); // if the current DAP has no parent, or it does not reference the "container." binding context, // we've found the "root" IDataAccessProvider else if (dap.getProviderParent() == null || (dap.getProviderParent() != null && !isContainerBound)) { return dap.getDataSource(); } // now, we've found the root and can start rewriting the expressions throughout // the rest of the DAP hierarchy if (_logger.isDebugEnabled()) { _logger.debug("changeContext: DAP.dataSource=" + dap.getDataSource() + " oldContext=container newContext=" + parentName + " currentIndex=" + dap.getProviderParent().getCurrentIndex() + " parentName is container: " + isContainerBound); } String retVal = null; String ds = dap.getDataSource(); // If the current DAP's dataSource is "container.item", the binding context needs to change to that // of the parent. This case should only occur for the last token -- the "name" passed into // the method. Oterwise, just replace the "container" to that of the parent. Both are // qualified with the DAP's current index so that "actionForm.customers" becomes // "actionForm.customers[12]". boolean isContainerItemBound = false; if (isContainerBound && (parsedDataSource.getTokens().get(1)).toString().equals("item")) isContainerItemBound = true; if (isContainerItemBound) retVal = changeContext(ds, "container.item", parentName, dap.getProviderParent().getCurrentIndex()); else retVal = changeContext(ds, "container", parentName, dap.getProviderParent().getCurrentIndex()); if (_logger.isDebugEnabled()) _logger.debug("fully-qualified binding expression: \"" + retVal + "\""); return retVal; }
[ "private", "final", "String", "rewriteNameInternal", "(", "IDataAccessProvider", "dap", ")", "throws", "ExpressionEvaluationException", "{", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "_logger", ".", "debug", "(", "\"assign index to name: \"", "+", "dap", ".", "getDataSource", "(", ")", ")", ";", "Expression", "parsedDataSource", "=", "getExpressionEvaluator", "(", ")", ".", "parseExpression", "(", "dap", ".", "getDataSource", "(", ")", ")", ";", "assert", "parsedDataSource", "!=", "null", ";", "// @todo: perf", "boolean", "isContainerBound", "=", "(", "parsedDataSource", ".", "getTokens", "(", ")", ".", "get", "(", "0", ")", ")", ".", "toString", "(", ")", ".", "equals", "(", "\"container\"", ")", ";", "// rewrite the name of the current IDataAccessProvider.", "String", "parentName", "=", "null", ";", "// if the current DAP has a parent IDataAccessProvider, rewrite the name of the parent", "if", "(", "dap", ".", "getProviderParent", "(", ")", "!=", "null", ")", "parentName", "=", "rewriteNameInternal", "(", "dap", ".", "getProviderParent", "(", ")", ")", ";", "// if the current DAP has no parent, or it does not reference the \"container.\" binding context,", "// we've found the \"root\" IDataAccessProvider", "else", "if", "(", "dap", ".", "getProviderParent", "(", ")", "==", "null", "||", "(", "dap", ".", "getProviderParent", "(", ")", "!=", "null", "&&", "!", "isContainerBound", ")", ")", "{", "return", "dap", ".", "getDataSource", "(", ")", ";", "}", "// now, we've found the root and can start rewriting the expressions throughout ", "// the rest of the DAP hierarchy", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "{", "_logger", ".", "debug", "(", "\"changeContext: DAP.dataSource=\"", "+", "dap", ".", "getDataSource", "(", ")", "+", "\" oldContext=container newContext=\"", "+", "parentName", "+", "\" currentIndex=\"", "+", "dap", ".", "getProviderParent", "(", ")", ".", "getCurrentIndex", "(", ")", "+", "\" parentName is container: \"", "+", "isContainerBound", ")", ";", "}", "String", "retVal", "=", "null", ";", "String", "ds", "=", "dap", ".", "getDataSource", "(", ")", ";", "// If the current DAP's dataSource is \"container.item\", the binding context needs to change to that", "// of the parent. This case should only occur for the last token -- the \"name\" passed into", "// the method. Oterwise, just replace the \"container\" to that of the parent. Both are ", "// qualified with the DAP's current index so that \"actionForm.customers\" becomes ", "// \"actionForm.customers[12]\". ", "boolean", "isContainerItemBound", "=", "false", ";", "if", "(", "isContainerBound", "&&", "(", "parsedDataSource", ".", "getTokens", "(", ")", ".", "get", "(", "1", ")", ")", ".", "toString", "(", ")", ".", "equals", "(", "\"item\"", ")", ")", "isContainerItemBound", "=", "true", ";", "if", "(", "isContainerItemBound", ")", "retVal", "=", "changeContext", "(", "ds", ",", "\"container.item\"", ",", "parentName", ",", "dap", ".", "getProviderParent", "(", ")", ".", "getCurrentIndex", "(", ")", ")", ";", "else", "retVal", "=", "changeContext", "(", "ds", ",", "\"container\"", ",", "parentName", ",", "dap", ".", "getProviderParent", "(", ")", ".", "getCurrentIndex", "(", ")", ")", ";", "if", "(", "_logger", ".", "isDebugEnabled", "(", ")", ")", "_logger", ".", "debug", "(", "\"fully-qualified binding expression: \\\"\"", "+", "retVal", "+", "\"\\\"\"", ")", ";", "return", "retVal", ";", "}" ]
Rewrite a parent IDataAccessProvider's dataSource to be fully qualified. "container.container.container.container.item.foo" -> "DS1.DS2.DS3.DS4.foo"
[ "Rewrite", "a", "parent", "IDataAccessProvider", "s", "dataSource", "to", "be", "fully", "qualified", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/naming/IndexedNameInterceptor.java#L150-L202
147,098
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
BackingClassMethodBinding.invoke
public Object invoke( FacesContext context, Object params[] ) throws EvaluationException, MethodNotFoundException { Object result = _delegate.invoke( context, params ); if ( result instanceof String ) { String action = ( String ) result; ExternalContext externalContext = context.getExternalContext(); Object request = externalContext.getRequest(); Object servletContextObject = externalContext.getContext(); assert request != null; if (request instanceof HttpServletRequest && servletContextObject instanceof ServletContext) { ServletContext servletContext = (ServletContext) servletContextObject; HttpServletRequest httpRequest = (HttpServletRequest) request; Object backingBean = InternalUtils.getFacesBackingBean(httpRequest, servletContext); if (backingBean != null) { Class backingClass = backingBean.getClass(); Method method = _methodCache.getMethod(backingClass, _methodName, _params); if (method == null) { throw new MethodNotFoundException(_methodName); } AnnotationReader annReader = AnnotationReader.getAnnotationReader(backingClass, servletContext); ProcessedAnnotation ann = annReader.getJpfAnnotation(method, "CommandHandler"); if (ann != null) { ProcessedAnnotation[] raiseActions = AnnotationReader.getAnnotationArrayAttribute(ann, "raiseActions"); if (raiseActions != null) { setOutputFormBeans(raiseActions, backingClass, backingBean, action, httpRequest); } } } } } return result; }
java
public Object invoke( FacesContext context, Object params[] ) throws EvaluationException, MethodNotFoundException { Object result = _delegate.invoke( context, params ); if ( result instanceof String ) { String action = ( String ) result; ExternalContext externalContext = context.getExternalContext(); Object request = externalContext.getRequest(); Object servletContextObject = externalContext.getContext(); assert request != null; if (request instanceof HttpServletRequest && servletContextObject instanceof ServletContext) { ServletContext servletContext = (ServletContext) servletContextObject; HttpServletRequest httpRequest = (HttpServletRequest) request; Object backingBean = InternalUtils.getFacesBackingBean(httpRequest, servletContext); if (backingBean != null) { Class backingClass = backingBean.getClass(); Method method = _methodCache.getMethod(backingClass, _methodName, _params); if (method == null) { throw new MethodNotFoundException(_methodName); } AnnotationReader annReader = AnnotationReader.getAnnotationReader(backingClass, servletContext); ProcessedAnnotation ann = annReader.getJpfAnnotation(method, "CommandHandler"); if (ann != null) { ProcessedAnnotation[] raiseActions = AnnotationReader.getAnnotationArrayAttribute(ann, "raiseActions"); if (raiseActions != null) { setOutputFormBeans(raiseActions, backingClass, backingBean, action, httpRequest); } } } } } return result; }
[ "public", "Object", "invoke", "(", "FacesContext", "context", ",", "Object", "params", "[", "]", ")", "throws", "EvaluationException", ",", "MethodNotFoundException", "{", "Object", "result", "=", "_delegate", ".", "invoke", "(", "context", ",", "params", ")", ";", "if", "(", "result", "instanceof", "String", ")", "{", "String", "action", "=", "(", "String", ")", "result", ";", "ExternalContext", "externalContext", "=", "context", ".", "getExternalContext", "(", ")", ";", "Object", "request", "=", "externalContext", ".", "getRequest", "(", ")", ";", "Object", "servletContextObject", "=", "externalContext", ".", "getContext", "(", ")", ";", "assert", "request", "!=", "null", ";", "if", "(", "request", "instanceof", "HttpServletRequest", "&&", "servletContextObject", "instanceof", "ServletContext", ")", "{", "ServletContext", "servletContext", "=", "(", "ServletContext", ")", "servletContextObject", ";", "HttpServletRequest", "httpRequest", "=", "(", "HttpServletRequest", ")", "request", ";", "Object", "backingBean", "=", "InternalUtils", ".", "getFacesBackingBean", "(", "httpRequest", ",", "servletContext", ")", ";", "if", "(", "backingBean", "!=", "null", ")", "{", "Class", "backingClass", "=", "backingBean", ".", "getClass", "(", ")", ";", "Method", "method", "=", "_methodCache", ".", "getMethod", "(", "backingClass", ",", "_methodName", ",", "_params", ")", ";", "if", "(", "method", "==", "null", ")", "{", "throw", "new", "MethodNotFoundException", "(", "_methodName", ")", ";", "}", "AnnotationReader", "annReader", "=", "AnnotationReader", ".", "getAnnotationReader", "(", "backingClass", ",", "servletContext", ")", ";", "ProcessedAnnotation", "ann", "=", "annReader", ".", "getJpfAnnotation", "(", "method", ",", "\"CommandHandler\"", ")", ";", "if", "(", "ann", "!=", "null", ")", "{", "ProcessedAnnotation", "[", "]", "raiseActions", "=", "AnnotationReader", ".", "getAnnotationArrayAttribute", "(", "ann", ",", "\"raiseActions\"", ")", ";", "if", "(", "raiseActions", "!=", "null", ")", "{", "setOutputFormBeans", "(", "raiseActions", ",", "backingClass", ",", "backingBean", ",", "action", ",", "httpRequest", ")", ";", "}", "}", "}", "}", "}", "return", "result", ";", "}" ]
Before returning the result from the base MethodBinding, see if the bound method is annotated with Jpf.CommandHandler. If it is, look through the "raiseActions" annotation array for a form bean member variable associated with the action being raised. If one is found, set it in the request so it gets passed to the action.
[ "Before", "returning", "the", "result", "from", "the", "base", "MethodBinding", "see", "if", "the", "bound", "method", "is", "annotated", "with", "Jpf", ".", "CommandHandler", ".", "If", "it", "is", "look", "through", "the", "raiseActions", "annotation", "array", "for", "a", "form", "bean", "member", "variable", "associated", "with", "the", "action", "being", "raised", ".", "If", "one", "is", "found", "set", "it", "in", "the", "request", "so", "it", "gets", "passed", "to", "the", "action", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java#L84-L125
147,099
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/ControlClientManifest.java
ControlClientManifest.emit
public void emit( Filer f, String pkg, File mf, String csn ) throws IOException { PrintWriter pw = f.createTextFile( Filer.Location.CLASS_TREE, pkg, mf, csn ); pw.println( "# Apache Beehive Controls client manifest (auto-generated, do not edit!)"); Set props = _properties.keySet(); for ( Object p : props ) { String name = (String)p; String value = _properties.getProperty(name); /* convert the name and value to a format excpected by the Properties.load() method */ name = escapeJava(name); if (value != null) value = escapeJava(value); pw.println( name + "=" + value ); } pw.flush(); pw.close(); }
java
public void emit( Filer f, String pkg, File mf, String csn ) throws IOException { PrintWriter pw = f.createTextFile( Filer.Location.CLASS_TREE, pkg, mf, csn ); pw.println( "# Apache Beehive Controls client manifest (auto-generated, do not edit!)"); Set props = _properties.keySet(); for ( Object p : props ) { String name = (String)p; String value = _properties.getProperty(name); /* convert the name and value to a format excpected by the Properties.load() method */ name = escapeJava(name); if (value != null) value = escapeJava(value); pw.println( name + "=" + value ); } pw.flush(); pw.close(); }
[ "public", "void", "emit", "(", "Filer", "f", ",", "String", "pkg", ",", "File", "mf", ",", "String", "csn", ")", "throws", "IOException", "{", "PrintWriter", "pw", "=", "f", ".", "createTextFile", "(", "Filer", ".", "Location", ".", "CLASS_TREE", ",", "pkg", ",", "mf", ",", "csn", ")", ";", "pw", ".", "println", "(", "\"# Apache Beehive Controls client manifest (auto-generated, do not edit!)\"", ")", ";", "Set", "props", "=", "_properties", ".", "keySet", "(", ")", ";", "for", "(", "Object", "p", ":", "props", ")", "{", "String", "name", "=", "(", "String", ")", "p", ";", "String", "value", "=", "_properties", ".", "getProperty", "(", "name", ")", ";", "/* convert the name and value to a format excpected by the Properties.load() method */", "name", "=", "escapeJava", "(", "name", ")", ";", "if", "(", "value", "!=", "null", ")", "value", "=", "escapeJava", "(", "value", ")", ";", "pw", ".", "println", "(", "name", "+", "\"=\"", "+", "value", ")", ";", "}", "pw", ".", "flush", "(", ")", ";", "pw", ".", "close", "(", ")", ";", "}" ]
Emits the manifest via an apt Filer implementation @param f an apt Filer @param pkg the package structure to place the manifest in @param mf the name of the manifest @throws IOException
[ "Emits", "the", "manifest", "via", "an", "apt", "Filer", "implementation" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/ControlClientManifest.java#L142-L163