public void setOrder(String order) throws NavigatorRuntimeException { if (!order.equals(DEF_ORDER_DESCENDING) && !order.equals(DEF_ORDER_ASCENDING)) throw new NavigatorRuntimeException("Non-supported value ('" + order + "') given for attribute 'order' in element 'foreach'."); this.sortOrder = order; this.sortItemsFlag = (order != null); }
private TopicIndexIF getTopicIndex(String[] tmids) throws RAPServletException { NavigatorApplicationIF navApp = NavigatorUtils.getNavigatorApplication(getServletContext()); if (tmids == null || tmids.length == 0) return new RegistryTopicIndex(navApp.getTopicMapRepository(), true, rapconfig.getEditURI(), rapconfig.getViewURI()); List<TopicIndexIF> topicIndexes = new ArrayList<TopicIndexIF>(); for (int i = 0; i < tmids.length; i++) { TopicMapIF topicmap; try { topicmap = navApp.getTopicMapById(tmids[i], true); } catch (NavigatorRuntimeException e) { log.warn("Couldn't open topic map " + tmids[i] + " because of " + e.getClass().getName() + " with message: " + e.getMessage()); throw new RAPServletException("Couldn't open topic map " + tmids[i]); } TopicIndexIF currentIndex = new TopicMapTopicIndex(topicmap, rapconfig.getEditURI(), rapconfig.getViewURI(), tmids[i]); topicIndexes.add(currentIndex); } return new FederatedTopicIndex(topicIndexes); }
private TopicIndexIF getTopicIndex(String[] tmids) throws RAPServletException { NavigatorApplicationIF navApp = NavigatorUtils.getNavigatorApplication(getServletContext()); if (tmids == null || tmids.length == 0) return new RegistryTopicIndex(navApp.getTopicMapRepository(), true, rapconfig.getEditURI(), rapconfig.getViewURI()); List<TopicIndexIF> topicIndexes = new ArrayList<TopicIndexIF>(); for (int i = 0; i < tmids.length; i++) { TopicMapIF topicmap; try { topicmap = navApp.getTopicMapById(tmids[i], true); } catch (NavigatorRuntimeException e) { log.warn("Couldn't open topic map " + tmids[i] + " because of " + e.getClass().getName() + " with message: " + e.getMessage()); throw new RAPServletException("Couldn't open topic map " + tmids[i]); } TopicIndexIF currentIndex = new TopicMapTopicIndex(topicmap, rapconfig.getEditURI(), rapconfig.getViewURI(), tmids[i]); topicIndexes.add(currentIndex); } return new FederatedTopicIndex(topicIndexes); }
public void setAs(String as) throws NavigatorRuntimeException { if (!as.equals(KIND_SUBJECT) && !as.equals(KIND_INDICATOR) && !as.equals(KIND_SOURCE)) throw new NavigatorRuntimeException("Non-supported value ('" + as + "') given for attribute 'as' in element 'lookup'."); this.lookupAs = as; }
null : navApp.getTopicMapById(topicmapId, false)); } catch (NavigatorRuntimeException e) { throw new UnavailableException(e.getMessage());
public void setContext(String var) throws NavigatorRuntimeException { context = var; if (!"basename".equals(context) && !"variant".equals(context) && !"occurrence".equals(context) && !"association".equals(context)) throw new NavigatorRuntimeException("Incorrect value ('" + var + "')" + " given for attribute 'context' in" + " element 'getcontext'."); }
public void setAs(String as) throws NavigatorRuntimeException { if (!as.equals(KIND_ALL) && !as.equals(KIND_TOPIC) && !as.equals(KIND_OCC) && !as.equals(KIND_ASSOC) && !as.equals(KIND_ROLE)) throw new NavigatorRuntimeException("Not supported value ('" + as + "')" + " given for attribute 'as' in" + " element 'instances'."); this.instancesAs = as; }
/** * Sets type of wanted occurrences: The following values are * allowed: * <ul> * <li><code>internal</code>, * <li><code>external</code>, * <li><code>all</code> (default). * </ul> */ public void setType(String typeString) throws NavigatorRuntimeException { if (typeString.equals(TYPE_NAME_INTERNAL)) type = TYPE_INTERNAL; else if (typeString.equals(TYPE_NAME_EXTERNAL)) type = TYPE_EXTERNAL; else if (typeString.equals(TYPE_NAME_ALL)) type = TYPE_ALL; else throw new NavigatorRuntimeException("Occurrences tag got invalid value for 'type' attribute: " + typeString); }
public ParsedQueryIF parseQuery() throws NavigatorRuntimeException { ParsedQueryIF parsedQuery; DeclarationContextIF declarationContext = contextTag .getDeclarationContext(); if (declarationContext == null) throw new NavigatorRuntimeException("QueryWrapper found no" + " DeclaractionContextIF on the ContextTag"); try { parsedQuery = queryProcessor.parse(query, declarationContext); } catch (InvalidQueryException e) { throw new NavigatorRuntimeException(e); } return parsedQuery; }
instances.put(fqcn, instance); } catch (ClassNotFoundException e) { throw new NavigatorRuntimeException("Class '" + fqcn + "' not found.", e); } catch (LinkageError e) { String msg = "Unable to create instance of class '" + fqcn + "': " + e; throw new NavigatorRuntimeException(msg, e); } catch (InstantiationException e) { String msg = "Unable to create instance of class '" + fqcn + "': " + e; throw new NavigatorRuntimeException(msg, e); } catch (IllegalAccessException e) { String msg = "Unable to create instance of class '" + fqcn + "': " + e; throw new NavigatorRuntimeException(msg, e);
@Override public int doEndTag() throws JspException { try { if (log.isDebugEnabled()) log.debug("doEndTag, template: '" + template + "'."); pageContext.include(template); } catch(java.io.IOException ex) { throw new NavigatorRuntimeException("InsertTag: I/O Error while including " + "template '" + template + "'", ex); } catch(javax.servlet.ServletException ex) { throw new NavigatorRuntimeException("InsertTag: while including " + "template '" + template + "'", ex); } stack.pop(); releaseMembers(); return EVAL_PAGE; }
@Override public Collection process(Collection topics) throws JspTagException { // Find all topics which are reified by topic map objects in collection if (topics == null) return Collections.EMPTY_SET; else { ArrayList reifiedObjects = new ArrayList(); Iterator iter = topics.iterator(); ReifiableIF reifiedObject; // Loop over the topic map objects while (iter.hasNext()) { // Get the topic map object that is reified by the given topic try { TopicIF topic = (TopicIF) iter.next(); reifiedObject = topic.getReified(); // If an object was found add it to the result list. if (reifiedObject != null) reifiedObjects.add(reifiedObject); } catch (ClassCastException e) { throw new NavigatorRuntimeException("'reified' tag got a collection containing non-topic objects."); } } // while // Return all reified objects found. return reifiedObjects; } }
" function " + functionFQCN + " with name '" + functionName + "'. Does it have a default constructor?"; throw new NavigatorRuntimeException(msg, e); } catch (ClassNotFoundException e) { String msg = "ExternalFunctionTag function " + functionFQCN + " with name '" + functionName + "': " + e.getMessage() + " not found."; throw new NavigatorRuntimeException(msg, e); } catch (IllegalAccessException e) { String msg = "ExternalFunctionTag function " + functionFQCN + " with name '" + functionName + "': " + e.getMessage() + " can't be accessed."; throw new NavigatorRuntimeException(msg, e); throw new NavigatorRuntimeException("ExternalFunctionTag: function with name '" + functionName + "' not found.");
@Override public TopicMapIF getTopicMapById(String topicmapId, boolean readonly) throws NavigatorRuntimeException { // use local or jndi repository (for backwards compatibility); TopicMapReferenceIF ref = repository.getReferenceByKey(topicmapId); if (ref == null) throw new NavigatorRuntimeException("Topic map with id '" + topicmapId + "' not found."); TopicMapStoreIF store; try { store = ref.createStore(readonly); } catch (java.io.IOException e) { throw new NavigatorRuntimeException("Problems occurred when creating topic map store '" + topicmapId + "'", e); } if (readonly) log.debug("Got RO store: " + store); else log.debug("Got RW store: " + store); return store.getTopicMap(); }
@Override public Collection process(Collection topics) throws JspTagException { // find all subclasses of all topics in collection if (topics == null || topics.isEmpty()) return Collections.EMPTY_SET; else { HashSet subclasses = new HashSet(); Iterator iter = topics.iterator(); TopicIF topic = null; Object obj = null; while (iter.hasNext()) { obj = iter.next(); try { topic = (TopicIF) obj; } catch (ClassCastException e) { throw new NavigatorRuntimeException("SubclassesTag expected to get a input collection of " + "topic instances, but got instance of class " + obj.getClass().getName()); } // the topic casting succeeded, now find the subclasses if (levelNumber == null) subclasses.addAll( hierUtils.getSubclasses(topic) ); else subclasses.addAll( hierUtils.getSubclasses(topic, levelNumber.intValue())); } // while return subclasses; } }
@Override public Collection process(Collection topics) throws JspTagException { // find all superclasses of all topics in collection if (topics == null || topics.isEmpty()) return Collections.EMPTY_SET; else { HashSet superclasses = new HashSet(); Iterator iter = topics.iterator(); TopicIF topic = null; Object obj = null; while (iter.hasNext()) { obj = iter.next(); try { topic = (TopicIF)obj; } catch (ClassCastException e) { String msg = "SubclassesTag expected to get a input collection of " + "topic instances, " + "but got instance of class " + obj.getClass().getName(); throw new NavigatorRuntimeException(msg); } // ok, the topic cast succeeded, now continue if (levelNumber == null) // if no level is specified get all of them. superclasses.addAll(hierUtils.getSuperclasses(topic)); else superclasses.addAll(hierUtils.getSuperclasses(topic, levelNumber.intValue())); } // while return superclasses; } }
/** * Process the start tag for this instance. */ @Override public int doStartTag() throws JspTagException { try { Object outObject = generateOutputObject(); JspWriter out = pageContext.getOut(); generateOutput(out, outObject); } catch (IOException ioe) { String msg = "Error in " + getName() + ": " + ioe.getMessage(); log.error(msg); throw new NavigatorRuntimeException(msg, ioe); } return SKIP_BODY; }
@Override public int doStartTag() throws JspException { if (log.isDebugEnabled()) log.debug("doStartTag, name: " + name); PageParameter param = getParameter(); if (param == null) return fallback ? EVAL_BODY_BUFFERED : SKIP_BODY; String content = param.getContent(); if (content == null) content = ""; int splitpos = content.indexOf(SplitTag.TOKEN); if (splitpos != -1) { try { pageContext.getOut().print(content.substring(0, splitpos)); if (log.isDebugEnabled()) log.debug(name + ": wrote " + splitpos + " chars"); } catch(java.io.IOException ex) { throw new NavigatorRuntimeException("Exception occurred when writing content.", ex); } return EVAL_BODY_BUFFERED; } else return SKIP_BODY; }
throw new NavigatorRuntimeException("TaglibTagFactory - " + "Unknown tag: " + tagname); String msg = "TaglibTagFactory - unable to create instance of class " + classname + " for tag " + tagname; throw new NavigatorRuntimeException(msg, e);
/** * Process the start tag for this instance. */ @Override public int doStartTag() throws JspTagException { // get Context Tag ContextTag contextTag = FrameworkUtils.getContextTag(pageContext); // read in function from file JSPTreeNodeIF root = null; try { root = readinFunction(fileName); } catch (IOException ioe) { String msg = "FunctionTag: error while reading in function file from " + fileName + ": " + ioe.getMessage(); throw new NavigatorRuntimeException(msg, ioe); } catch (SAXException saxe) { String msg = "FunctionTag: error while parsing function file (" + fileName + "): " + saxe.getMessage(); throw new NavigatorRuntimeException(msg, saxe); } // construct new function object and register it FunctionIF function = new Function(functionName, root, params); contextTag.registerFunction(function); log.debug("registered function: " + function.toString()); // empty tag return SKIP_BODY; }