bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
public void processAction(ActionEvent event) { String id = event.getComponent().getId(); UIComponent rootParent = rootParent = event.getComponent().getParent().getParent().getParent(); EditArticleView ab = (EditArticleView) rootParent.findComponent(EDIT_ARTICLE_BLOCK_ID); if (id.equals(SAVE_ID)) { //We have the save button pressed boolean saveSuccessful=false; saveSuccessful = ab.storeArticle(); if(saveSuccessful){ ArticleItemBean articleItemBean = getArticleItemBean(); String fileResourcePath = articleItemBean.getLocalizedArticle().getResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) ab.getCategoryEditor(); if(categoriesUI!=null){ categoriesUI.setResourcePath(fileResourcePath); categoriesUI.saveCategoriesSettings(fileResourcePath, categoriesUI); } } clearOnInit=false; } else if (id.equals(DELETE_ID)) { //we are deleting ArticleItemBean articleItemBean = getArticleItemBean(); articleItemBean.delete(); WFUtil.addMessageVB(ab.findComponent(DELETE_ID),ArticleUtil.IW_BUNDLE_IDENTIFIER, "delete_successful"); } /* else if (id.equals(FOR_REVIEW_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_READY_FOR_REVIEW); ab.storeArticle(); } else if (id.equals(PUBLISH_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_PUBLISHED); ab.storeArticle(); } else if (id.equals(REWRITE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_REWRITE); ab.storeArticle(); } else if (id.equals(REJECT_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(DELETE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(ADD_IMAGE_ID)) { ab.setEditView(FILE_UPLOAD_FORM_ID); } else if (id.equals(FILE_UPLOAD_CANCEL_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(FILE_UPLOAD_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(CaseListBean.CASE_ID)){ String itemId = WFUtil.getParameter(event.getComponent(), "id"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "addRelatedContentItem", new Integer(itemId)); ab.setEditView(ARTICLE_EDITOR_ID); }*/ }
|
public void processAction(ActionEvent event) { String id = event.getComponent().getId(); UIComponent rootParent = rootParent = event.getComponent().getParent().getParent().getParent(); EditArticleView ab = (EditArticleView) rootParent.findComponent(EDIT_ARTICLE_BLOCK_ID); if (id.equals(SAVE_ID)) { //We have the save button pressed boolean saveSuccessful=false; saveSuccessful = ab.storeArticle(); if(saveSuccessful){ ArticleItemBean articleItemBean = getArticleItemBean(); String fileResourcePath = articleItemBean.getLocalizedArticle().getResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) ab.getCategoryEditor(); if(categoriesUI!=null){ categoriesUI.setResourcePath(fileResourcePath); categoriesUI.saveCategoriesSettings(fileResourcePath, categoriesUI); } } clearOnInit=false; } else if (id.equals(DELETE_ID)) { //we are deleting ArticleItemBean articleItemBean = getArticleItemBean(); articleItemBean.delete(); WFUtil.addMessageVB(ab.findComponent(DELETE_ID),ArticleUtil.IW_BUNDLE_IDENTIFIER, "delete_successful"); } /* else if (id.equals(FOR_REVIEW_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_READY_FOR_REVIEW); ab.storeArticle(); } else if (id.equals(PUBLISH_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_PUBLISHED); ab.storeArticle(); } else if (id.equals(REWRITE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_REWRITE); ab.storeArticle(); } else if (id.equals(REJECT_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(DELETE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(ADD_IMAGE_ID)) { ab.setEditView(FILE_UPLOAD_FORM_ID); } else if (id.equals(FILE_UPLOAD_CANCEL_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(FILE_UPLOAD_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(CaseListBean.CASE_ID)){ String itemId = WFUtil.getParameter(event.getComponent(), "id"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "addRelatedContentItem", new Integer(itemId)); ab.setEditView(ARTICLE_EDITOR_ID); }*/ }
| 3,231,656
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } if(arg0.getNewValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); ArticleItemBean bean = getArticleItemBean(); //String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String articlePath = bean.getResourcePath(); //String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); //String language = bean.getContentLanguage(); if(null==articlePath) { //Article has not been stored previously, so nothing has to be done return; } System.out.println("processValueChange: Article path: "+articlePath); //boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //System.out.println("loading other language "+result); //if(result) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); String langChange = arg0.getNewValue().toString(); bean.setLanguageChange(langChange); Locale locale = new Locale(langChange); bean.setLocale(locale); System.out.println("processValueChange: changint to other language "+langChange); //}else { //if(null!=language) { //result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //bean.setLanguageChange(language); //bean.setLocale(new Locale(language)); //System.out.println("loading other language "+result); //} //} }
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } if(arg0.getNewValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); ArticleItemBean bean = getArticleItemBean(); //String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String articlePath = bean.getResourcePath(); //String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); //String language = bean.getContentLanguage(); if(null==articlePath) { //Article has not been stored previously, so nothing has to be done return; } System.out.println("processValueChange: Article path: "+articlePath); //boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //System.out.println("loading other language "+result); //if(result) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); String langChange = arg0.getNewValue().toString(); bean.setLanguageChange(langChange); Locale locale = new Locale(langChange); bean.setLocale(locale); System.out.println("processValueChange: changint to other language "+langChange); //}else { //if(null!=language) { //result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //bean.setLanguageChange(language); //bean.setLocale(new Locale(language)); //System.out.println("loading other language "+result); //} //} }
| 3,231,657
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } if(arg0.getNewValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); ArticleItemBean bean = getArticleItemBean(); //String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String articlePath = bean.getResourcePath(); //String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); //String language = bean.getContentLanguage(); if(null==articlePath) { //Article has not been stored previously, so nothing has to be done return; } System.out.println("processValueChange: Article path: "+articlePath); //boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //System.out.println("loading other language "+result); //if(result) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); String langChange = arg0.getNewValue().toString(); bean.setLanguageChange(langChange); Locale locale = new Locale(langChange); bean.setLocale(locale); System.out.println("processValueChange: changint to other language "+langChange); //}else { //if(null!=language) { //result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //bean.setLanguageChange(language); //bean.setLocale(new Locale(language)); //System.out.println("loading other language "+result); //} //} }
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } if(arg0.getNewValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); ArticleItemBean bean = getArticleItemBean(); //String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String articlePath = bean.getResourcePath(); //String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); //String language = bean.getContentLanguage(); if(null==articlePath) { //Article has not been stored previously, so nothing has to be done return; } System.out.println("processValueChange: Article path: "+articlePath); //boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //System.out.println("loading other language "+result); //if(result) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); String langChange = arg0.getNewValue().toString(); bean.setLanguageChange(langChange); Locale locale = new Locale(langChange); bean.setLocale(locale); System.out.println("processValueChange: changint to other language "+langChange); //}else { //if(null!=language) { //result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //bean.setLanguageChange(language); //bean.setLocale(new Locale(language)); //System.out.println("loading other language "+result); //} //} }
| 3,231,658
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } if(arg0.getNewValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); ArticleItemBean bean = getArticleItemBean(); //String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String articlePath = bean.getResourcePath(); //String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); //String language = bean.getContentLanguage(); if(null==articlePath) { //Article has not been stored previously, so nothing has to be done return; } System.out.println("processValueChange: Article path: "+articlePath); //boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //System.out.println("loading other language "+result); //if(result) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); String langChange = arg0.getNewValue().toString(); bean.setLanguageChange(langChange); Locale locale = new Locale(langChange); bean.setLocale(locale); System.out.println("processValueChange: changint to other language "+langChange); //}else { //if(null!=language) { //result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //bean.setLanguageChange(language); //bean.setLocale(new Locale(language)); //System.out.println("loading other language "+result); //} //} }
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } if(arg0.getNewValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); ArticleItemBean bean = getArticleItemBean(); //String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String articlePath = bean.getResourcePath(); //String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); //String language = bean.getContentLanguage(); if(null==articlePath) { //Article has not been stored previously, so nothing has to be done return; } System.out.println("processValueChange: Article path: "+articlePath); //boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //System.out.println("loading other language "+result); //if(result) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); String langChange = arg0.getNewValue().toString(); bean.setLanguageChange(langChange); Locale locale = new Locale(langChange); bean.setLocale(locale); System.out.println("processValueChange: changint to other language "+langChange); //}else { //if(null!=language) { //result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); //bean.setLanguageChange(language); //bean.setLocale(new Locale(language)); //System.out.println("loading other language "+result); //} //} }
| 3,231,659
|
private void handleBrowserSelectedDisplay(PropertyChangeEvent pce) { if (!(pce.getNewValue().equals(pce.getOldValue())) && pce.getNewValue() != null) { ImageDisplay oldNode, newNode; Colors colors = Colors.getInstance(); newNode = (ImageDisplay) pce.getNewValue(); newNode.setHighlight(colors.getSelectedHighLight(newNode)); if (pce.getOldValue() != null) { oldNode = (ImageDisplay) pce.getOldValue(); oldNode.setHighlight( colors.getDeselectedHighLight(oldNode)); } } view.onDisplayChange( model.getParentModel().getBrowser().getSelectedDisplay()); }
|
private void handleBrowserSelectedDisplay(PropertyChangeEvent pce) { if (!(pce.getNewValue().equals(pce.getOldValue())) && pce.getNewValue() != null) { ImageDisplay oldNode, newNode; Colors colors = Colors.getInstance(); newNode = (ImageDisplay) pce.getNewValue(); newNode.setHighlight(colors.getSelectedHighLight(newNode)); if (pce.getOldValue() != null) { oldNode = (ImageDisplay) pce.getOldValue(); oldNode.setHighlight( colors.getDeselectedHighLight(oldNode)); } } view.onDisplayChange( model.getParentModel().getBrowser().getSelectedDisplay()); }
| 3,231,661
|
public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (propName.equals(Browser.SELECTED_DISPLAY_PROPERTY)) handleBrowserSelectedDisplay(pce); else if (propName.equals(SearchResultsPane.LOCALIZE_IMAGE_DISPLAY)) { ImageDisplay node = (ImageDisplay) pce.getNewValue(); ImageDisplay parent = node.getParentDisplay(); scrollToNode(node.getBounds(), parent, (parent.getParentDisplay() == null)); } }
|
public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (propName.equals(Browser.SELECTED_DISPLAY_PROPERTY)) handleBrowserSelectedDisplay(pce); else if (propName.equals(ClipBoard.LOCALIZE_IMAGE_DISPLAY)) { ImageDisplay node = (ImageDisplay) pce.getNewValue(); ImageDisplay parent = node.getParentDisplay(); scrollToNode(node.getBounds(), parent, (parent.getParentDisplay() == null)); } }
| 3,231,662
|
void setPaneIndex(int index) { component.setPaneIndex(index); }
|
void setPaneIndex(int index) { component.setPaneIndex(index); }
| 3,231,663
|
void changePanelSize() { wheelwidth = this.getWidth(); radius = wheelwidth/2; puckColour = Color.black; puckfillColour = Color.white; img = new BufferedImage((int) wheelwidth,(int) wheelwidth, BufferedImage.TYPE_INT_ARGB); buildLUT(); createColourWheelFromLUT(); findPuck(); }
|
void changePanelSize() { wheelwidth = this.getWidth(); radius = wheelwidth/2; puckColour = Color.black; puckfillColour = Color.white; img = new BufferedImage((int) wheelwidth,(int) wheelwidth, BufferedImage.TYPE_INT_ARGB); buildLUT(); createColourWheelFromLUT(); findPuck(); }
| 3,231,664
|
void render(Graphics2D g) { wheelwidth = this.getWidth() < this.getHeight() ? this.getWidth() : this.getHeight(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.drawImage(img, 0, 0, (int) wheelwidth, (int) wheelwidth, null); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); if (puck != null) { g.setStroke(new BasicStroke(1.0f)); g.setPaint(puckfillColour); g.fillRect((int) puck.x1-2, (int) puck.x2-2, 4, 4); g.setPaint(puckColour); g.drawRect((int) puck.x1-2, (int) puck.x2-2, 4, 4); } }
|
void render(Graphics2D g) { wheelwidth = this.getWidth() < this.getHeight() ? this.getWidth() : this.getHeight(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.drawImage(img, 0, 0, (int) wheelwidth, (int) wheelwidth, null); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); if (puck != null) { g.setStroke(new BasicStroke(1.0f)); g.setPaint(puckfillColour); g.fillRect((int) puck.x1-2, (int) puck.x2-2, 4, 4); g.setPaint(puckColour); g.drawRect((int) puck.x1-2, (int) puck.x2-2, 4, 4); } }
| 3,231,665
|
public static RubyClass createStringClass(Ruby ruby) { RubyClass stringClass = ruby.defineClass("String", ruby.getClasses().getObjectClass()); stringClass.includeModule(ruby.getClasses().getComparableModule()); stringClass.includeModule(ruby.getClasses().getEnumerableModule()); stringClass.defineSingletonMethod("new", CallbackFactory.getOptSingletonMethod(RubyString.class, "newInstance")); stringClass.defineMethod("initialize", CallbackFactory.getMethod(RubyString.class, "replace", RubyObject.class)); stringClass.defineMethod("clone", CallbackFactory.getMethod(RubyString.class, "rbClone")); stringClass.defineMethod("dup", CallbackFactory.getMethod(RubyString.class, "dup")); stringClass.defineMethod("<=>", CallbackFactory.getMethod(RubyString.class, "op_cmp", RubyObject.class)); stringClass.defineMethod("==", CallbackFactory.getMethod(RubyString.class, "equal", RubyObject.class)); stringClass.defineMethod("===", CallbackFactory.getMethod(RubyString.class, "equal", RubyObject.class)); stringClass.defineMethod("eql?", CallbackFactory.getMethod(RubyString.class, "equal", RubyObject.class)); stringClass.defineMethod("hash", CallbackFactory.getMethod(RubyString.class, "hash")); stringClass.defineMethod("+", CallbackFactory.getMethod(RubyString.class, "op_plus", RubyObject.class)); stringClass.defineMethod("*", CallbackFactory.getMethod(RubyString.class, "op_mul", RubyInteger.class)); stringClass.defineMethod("%", CallbackFactory.getMethod(RubyString.class, "format", RubyObject.class)); stringClass.defineMethod("[]", CallbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("[]=", CallbackFactory.getOptMethod(RubyString.class, "aset")); stringClass.defineMethod("length", CallbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("size", CallbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("empty?", CallbackFactory.getMethod(RubyString.class, "empty")); stringClass.defineMethod("=~", CallbackFactory.getMethod(RubyString.class, "match", RubyObject.class)); stringClass.defineMethod("~", CallbackFactory.getMethod(RubyString.class, "match2")); stringClass.defineMethod("succ", CallbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("succ!", CallbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("next", CallbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("next!", CallbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("upto", CallbackFactory.getMethod(RubyString.class, "upto", RubyObject.class)); stringClass.defineMethod("index", CallbackFactory.getOptMethod(RubyString.class, "index")); stringClass.defineMethod("rindex", CallbackFactory.getOptMethod(RubyString.class, "rindex")); stringClass.defineMethod("replace", CallbackFactory.getMethod(RubyString.class, "replace", RubyObject.class)); stringClass.defineMethod("to_i", CallbackFactory.getMethod(RubyString.class, "to_i")); stringClass.defineMethod("to_f", CallbackFactory.getMethod(RubyString.class, "to_f")); stringClass.defineMethod("to_s", CallbackFactory.getSelfMethod()); stringClass.defineMethod("to_str", CallbackFactory.getSelfMethod()); stringClass.defineMethod("inspect", CallbackFactory.getMethod(RubyString.class, "inspect")); stringClass.defineMethod("dump", CallbackFactory.getMethod(RubyString.class, "dump")); stringClass.defineMethod("upcase", CallbackFactory.getMethod(RubyString.class, "upcase")); stringClass.defineMethod("downcase", CallbackFactory.getMethod(RubyString.class, "downcase")); stringClass.defineMethod("capitalize", CallbackFactory.getMethod(RubyString.class, "capitalize")); stringClass.defineMethod("swapcase", CallbackFactory.getMethod(RubyString.class, "swapcase")); stringClass.defineMethod("upcase!", CallbackFactory.getMethod(RubyString.class, "upcase_bang")); stringClass.defineMethod("downcase!", CallbackFactory.getMethod(RubyString.class, "downcase_bang")); stringClass.defineMethod("capitalize!", CallbackFactory.getMethod(RubyString.class, "capitalize_bang")); stringClass.defineMethod("swapcase!", CallbackFactory.getMethod(RubyString.class, "swapcase_bang")); stringClass.defineMethod("hex", CallbackFactory.getMethod(RubyString.class, "hex")); stringClass.defineMethod("oct", CallbackFactory.getMethod(RubyString.class, "oct")); stringClass.defineMethod("split", CallbackFactory.getOptMethod(RubyString.class, "split")); stringClass.defineMethod("reverse", CallbackFactory.getMethod(RubyString.class, "reverse")); stringClass.defineMethod("reverse!", CallbackFactory.getMethod(RubyString.class, "reverse_bang")); stringClass.defineMethod("concat", CallbackFactory.getMethod(RubyString.class, "concat", RubyObject.class)); stringClass.defineMethod("<<", CallbackFactory.getMethod(RubyString.class, "concat", RubyObject.class)); // rb_define_method(rb_cString, "crypt", rb_str_crypt, 1); stringClass.defineMethod("intern", CallbackFactory.getMethod(RubyString.class, "intern")); stringClass.defineMethod("include?", CallbackFactory.getMethod(RubyString.class, "include", RubyObject.class)); stringClass.defineMethod("scan", CallbackFactory.getMethod(RubyString.class, "scan", RubyObject.class)); stringClass.defineMethod("ljust", CallbackFactory.getMethod(RubyString.class, "ljust", RubyObject.class)); stringClass.defineMethod("rjust", CallbackFactory.getMethod(RubyString.class, "rjust", RubyObject.class)); stringClass.defineMethod("center", CallbackFactory.getMethod(RubyString.class, "center", RubyObject.class)); stringClass.defineMethod("sub", CallbackFactory.getOptMethod(RubyString.class, "sub")); stringClass.defineMethod("gsub", CallbackFactory.getOptMethod(RubyString.class, "gsub")); stringClass.defineMethod("chop", CallbackFactory.getMethod(RubyString.class, "chop")); stringClass.defineMethod("chomp", CallbackFactory.getOptMethod(RubyString.class, "chomp")); stringClass.defineMethod("strip", CallbackFactory.getMethod(RubyString.class, "strip")); stringClass.defineMethod("sub!", CallbackFactory.getOptMethod(RubyString.class, "sub_bang")); stringClass.defineMethod("gsub!", CallbackFactory.getOptMethod(RubyString.class, "gsub_bang")); stringClass.defineMethod("chop!", CallbackFactory.getMethod(RubyString.class, "chop_bang")); stringClass.defineMethod("chomp!", CallbackFactory.getOptMethod(RubyString.class, "chomp_bang")); stringClass.defineMethod("strip!", CallbackFactory.getMethod(RubyString.class, "strip_bang")); stringClass.defineMethod("tr", CallbackFactory.getOptMethod(RubyString.class, "tr")); stringClass.defineMethod("tr_s", CallbackFactory.getOptMethod(RubyString.class, "tr_s")); stringClass.defineMethod("delete", CallbackFactory.getOptMethod(RubyString.class, "delete")); stringClass.defineMethod("squeeze", CallbackFactory.getOptMethod(RubyString.class, "squeeze")); stringClass.defineMethod("count", CallbackFactory.getOptMethod(RubyString.class, "count")); stringClass.defineMethod("tr!", CallbackFactory.getOptMethod(RubyString.class, "tr_bang")); stringClass.defineMethod("tr_s!", CallbackFactory.getOptMethod(RubyString.class, "tr_s_bang")); stringClass.defineMethod("delete!", CallbackFactory.getOptMethod(RubyString.class, "delete_bang")); stringClass.defineMethod("squeeze!", CallbackFactory.getOptMethod(RubyString.class, "squeeze_bang")); stringClass.defineMethod("each_line", CallbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each", CallbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each_byte", CallbackFactory.getMethod(RubyString.class, "each_byte")); // rb_define_method(rb_cString, "sum", rb_str_sum, -1); stringClass.defineMethod("slice", CallbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("slice!", CallbackFactory.getOptMethod(RubyString.class, "slice_bang")); // id_to_s = rb_intern("to_s"); // rb_fs = Qnil; // rb_define_hooked_variable("$;", &rb_fs, 0, rb_str_setter); // rb_define_hooked_variable("$-F", &rb_fs, 0, rb_str_setter); stringClass.defineMethod("unpack", CallbackFactory.getMethod(RubyString.class, "unpack", RubyString.class)); return stringClass; }
|
public static RubyClass createStringClass(Ruby ruby) { RubyClass stringClass = ruby.defineClass("String", ruby.getClasses().getObjectClass()); stringClass.includeModule(ruby.getClasses().getComparableModule()); stringClass.includeModule(ruby.getClasses().getEnumerableModule()); stringClass.defineSingletonMethod("new", CallbackFactory.getOptSingletonMethod(RubyString.class, "newInstance")); stringClass.defineMethod("initialize", CallbackFactory.getMethod(RubyString.class, "replace", RubyObject.class)); stringClass.defineMethod("clone", CallbackFactory.getMethod(RubyString.class, "rbClone")); stringClass.defineMethod("dup", CallbackFactory.getMethod(RubyString.class, "dup")); stringClass.defineMethod("<=>", CallbackFactory.getMethod(RubyString.class, "op_cmp", RubyObject.class)); stringClass.defineMethod("==", CallbackFactory.getMethod(RubyString.class, "equal", RubyObject.class)); stringClass.defineMethod("===", CallbackFactory.getMethod(RubyString.class, "equal", RubyObject.class)); stringClass.defineMethod("eql?", CallbackFactory.getMethod(RubyString.class, "equal", RubyObject.class)); stringClass.defineMethod("hash", CallbackFactory.getMethod(RubyString.class, "hash")); stringClass.defineMethod("+", CallbackFactory.getMethod(RubyString.class, "op_plus", RubyObject.class)); stringClass.defineMethod("*", CallbackFactory.getMethod(RubyString.class, "op_mul", RubyInteger.class)); stringClass.defineMethod("%", CallbackFactory.getMethod(RubyString.class, "format", RubyObject.class)); stringClass.defineMethod("[]", CallbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("[]=", CallbackFactory.getOptMethod(RubyString.class, "aset")); stringClass.defineMethod("length", CallbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("size", CallbackFactory.getMethod(RubyString.class, "length")); stringClass.defineMethod("empty?", CallbackFactory.getMethod(RubyString.class, "empty")); stringClass.defineMethod("=~", CallbackFactory.getMethod(RubyString.class, "match", RubyObject.class)); stringClass.defineMethod("~", CallbackFactory.getMethod(RubyString.class, "match2")); stringClass.defineMethod("succ", CallbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("succ!", CallbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("next", CallbackFactory.getMethod(RubyString.class, "succ")); stringClass.defineMethod("next!", CallbackFactory.getMethod(RubyString.class, "succ_bang")); stringClass.defineMethod("upto", CallbackFactory.getMethod(RubyString.class, "upto", RubyObject.class)); stringClass.defineMethod("index", CallbackFactory.getOptMethod(RubyString.class, "index")); stringClass.defineMethod("rindex", CallbackFactory.getOptMethod(RubyString.class, "rindex")); stringClass.defineMethod("replace", CallbackFactory.getMethod(RubyString.class, "replace", RubyObject.class)); stringClass.defineMethod("to_i", CallbackFactory.getMethod(RubyString.class, "to_i")); stringClass.defineMethod("to_f", CallbackFactory.getMethod(RubyString.class, "to_f")); stringClass.defineMethod("to_s", CallbackFactory.getSelfMethod()); stringClass.defineMethod("to_str", CallbackFactory.getSelfMethod()); stringClass.defineMethod("inspect", CallbackFactory.getMethod(RubyString.class, "inspect")); stringClass.defineMethod("dump", CallbackFactory.getMethod(RubyString.class, "dump")); stringClass.defineMethod("upcase", CallbackFactory.getMethod(RubyString.class, "upcase")); stringClass.defineMethod("downcase", CallbackFactory.getMethod(RubyString.class, "downcase")); stringClass.defineMethod("capitalize", CallbackFactory.getMethod(RubyString.class, "capitalize")); stringClass.defineMethod("swapcase", CallbackFactory.getMethod(RubyString.class, "swapcase")); stringClass.defineMethod("upcase!", CallbackFactory.getMethod(RubyString.class, "upcase_bang")); stringClass.defineMethod("downcase!", CallbackFactory.getMethod(RubyString.class, "downcase_bang")); stringClass.defineMethod("capitalize!", CallbackFactory.getMethod(RubyString.class, "capitalize_bang")); stringClass.defineMethod("swapcase!", CallbackFactory.getMethod(RubyString.class, "swapcase_bang")); stringClass.defineMethod("hex", CallbackFactory.getMethod(RubyString.class, "hex")); stringClass.defineMethod("oct", CallbackFactory.getMethod(RubyString.class, "oct")); stringClass.defineMethod("split", CallbackFactory.getOptMethod(RubyString.class, "split")); stringClass.defineMethod("reverse", CallbackFactory.getMethod(RubyString.class, "reverse")); stringClass.defineMethod("reverse!", CallbackFactory.getMethod(RubyString.class, "reverse_bang")); stringClass.defineMethod("concat", CallbackFactory.getMethod(RubyString.class, "concat", RubyObject.class)); stringClass.defineMethod("<<", CallbackFactory.getMethod(RubyString.class, "concat", RubyObject.class)); // rb_define_method(rb_cString, "crypt", rb_str_crypt, 1); stringClass.defineMethod("intern", CallbackFactory.getMethod(RubyString.class, "intern")); stringClass.defineMethod("include?", CallbackFactory.getMethod(RubyString.class, "include", RubyObject.class)); stringClass.defineMethod("scan", CallbackFactory.getMethod(RubyString.class, "scan", RubyObject.class)); stringClass.defineMethod("ljust", CallbackFactory.getMethod(RubyString.class, "ljust", RubyObject.class)); stringClass.defineMethod("rjust", CallbackFactory.getMethod(RubyString.class, "rjust", RubyObject.class)); stringClass.defineMethod("center", CallbackFactory.getMethod(RubyString.class, "center", RubyObject.class)); stringClass.defineMethod("sub", CallbackFactory.getOptMethod(RubyString.class, "sub")); stringClass.defineMethod("gsub", CallbackFactory.getOptMethod(RubyString.class, "gsub")); stringClass.defineMethod("chop", CallbackFactory.getMethod(RubyString.class, "chop")); stringClass.defineMethod("chomp", CallbackFactory.getOptMethod(RubyString.class, "chomp")); stringClass.defineMethod("strip", CallbackFactory.getMethod(RubyString.class, "strip")); stringClass.defineMethod("sub!", CallbackFactory.getOptMethod(RubyString.class, "sub_bang")); stringClass.defineMethod("gsub!", CallbackFactory.getOptMethod(RubyString.class, "gsub_bang")); stringClass.defineMethod("chop!", CallbackFactory.getMethod(RubyString.class, "chop_bang")); stringClass.defineMethod("chomp!", CallbackFactory.getOptMethod(RubyString.class, "chomp_bang")); stringClass.defineMethod("strip!", CallbackFactory.getMethod(RubyString.class, "strip_bang")); stringClass.defineMethod("tr", CallbackFactory.getOptMethod(RubyString.class, "tr")); stringClass.defineMethod("tr_s", CallbackFactory.getOptMethod(RubyString.class, "tr_s")); stringClass.defineMethod("delete", CallbackFactory.getOptMethod(RubyString.class, "delete")); stringClass.defineMethod("squeeze", CallbackFactory.getOptMethod(RubyString.class, "squeeze")); stringClass.defineMethod("count", CallbackFactory.getOptMethod(RubyString.class, "count")); stringClass.defineMethod("tr!", CallbackFactory.getOptMethod(RubyString.class, "tr_bang")); stringClass.defineMethod("tr_s!", CallbackFactory.getOptMethod(RubyString.class, "tr_s_bang")); stringClass.defineMethod("delete!", CallbackFactory.getOptMethod(RubyString.class, "delete_bang")); stringClass.defineMethod("squeeze!", CallbackFactory.getOptMethod(RubyString.class, "squeeze_bang")); stringClass.defineMethod("each_line", CallbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each", CallbackFactory.getOptMethod(RubyString.class, "each_line")); stringClass.defineMethod("each_byte", CallbackFactory.getMethod(RubyString.class, "each_byte")); // rb_define_method(rb_cString, "sum", rb_str_sum, -1); stringClass.defineMethod("slice", CallbackFactory.getOptMethod(RubyString.class, "aref")); stringClass.defineMethod("slice!", CallbackFactory.getOptMethod(RubyString.class, "slice_bang")); // id_to_s = rb_intern("to_s"); // rb_fs = Qnil; // rb_define_hooked_variable("$;", &rb_fs, 0, rb_str_setter); // rb_define_hooked_variable("$-F", &rb_fs, 0, rb_str_setter); stringClass.defineMethod("unpack", CallbackFactory.getMethod(RubyString.class, "unpack", RubyString.class)); return stringClass; }
| 3,231,666
|
public static IRubyObject foreach(IRubyObject recv, RubyString path) { path.checkSafeString(); List contents = getContents(getDir(recv.getRuntime(), path.getValue())); for (Iterator i=contents.iterator(); i.hasNext();) { String name = (String) i.next(); recv.getRuntime().yield(new RubyString(recv.getRuntime(), name)); } return recv.getRuntime().getNil(); }
|
public static IRubyObject foreach(IRubyObject recv, RubyString path) { path.checkSafeString(); List contents = getContents(getDir(recv.getRuntime(), path.getValue())); for (Iterator i=contents.iterator(); i.hasNext();) { String name = (String) i.next(); recv.getRuntime().yield(new RubyString(recv.getRuntime(), name)); } return recv.getRuntime().getNil(); }
| 3,231,667
|
public void initialize() { // Create IQ Filter PacketFilter packetFilter = new PacketTypeFilter(IQ.class); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { IQ iq = (IQ)packet; // Handle Version Request if (iq instanceof Version && iq.getType() == IQ.Type.GET) { // Send Version Version version = new Version(); version.setName("Spark IM Client"); version.setOs(JiveInfo.getOS()); version.setVersion(JiveInfo.getVersion()); // Send back as a reply version.setPacketID(iq.getPacketID()); version.setType(IQ.Type.RESULT); version.setTo(iq.getFrom()); version.setFrom(iq.getTo()); SparkManager.getConnection().sendPacket(version); } // Send time else if (iq instanceof Time && iq.getType() == IQ.Type.GET) { Time time = new Time(); time.setPacketID(iq.getPacketID()); time.setFrom(iq.getTo()); time.setTo(iq.getFrom()); time.setTime(new Date()); time.setType(IQ.Type.RESULT); // Send Time SparkManager.getConnection().sendPacket(time); } } }, packetFilter); final ContactList contactList = SparkManager.getWorkspace().getContactList(); contactList.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("Ctrl F11"), "viewClient"); contactList.addContextMenuListener(new ContextMenuListener() { public void poppingUp(final Object component, JPopupMenu popup) { if (!(component instanceof ContactItem)) { return; } Action versionRequest = new AbstractAction() { public void actionPerformed(ActionEvent e) { viewClient(); } }; versionRequest.putValue(Action.NAME, Res.getString("menuitem.view.client.version")); popup.add(versionRequest); } public void poppingDown(JPopupMenu popup) { } public boolean handleDefaultAction(MouseEvent e) { return false; } }); contactList.getActionMap().put("viewClient", new AbstractAction("viewClient") { public void actionPerformed(ActionEvent evt) { viewClient(); } }); }
|
public void initialize() { // Create IQ Filter PacketFilter packetFilter = new PacketTypeFilter(IQ.class); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { IQ iq = (IQ)packet; // Handle Version Request if (iq instanceof Version && iq.getType() == IQ.Type.GET) { // Send Version Version version = new Version(); version.setName("Spark IM Client"); version.setOs(JiveInfo.getOS()); version.setVersion(JiveInfo.getVersion()); // Send back as a reply version.setPacketID(iq.getPacketID()); version.setType(IQ.Type.RESULT); version.setTo(iq.getFrom()); version.setFrom(iq.getTo()); SparkManager.getConnection().sendPacket(version); } // Send time else if (iq instanceof Time && iq.getType() == IQ.Type.GET) { Time time = new Time(); time.setPacketID(iq.getPacketID()); time.setFrom(iq.getTo()); time.setTo(iq.getFrom()); time.setTime(new Date()); time.setType(IQ.Type.RESULT); // Send Time SparkManager.getConnection().sendPacket(time); } } }, packetFilter); final ContactList contactList = SparkManager.getWorkspace().getContactList(); contactList.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control F11"), "viewClient"); contactList.addContextMenuListener(new ContextMenuListener() { public void poppingUp(final Object component, JPopupMenu popup) { if (!(component instanceof ContactItem)) { return; } Action versionRequest = new AbstractAction() { public void actionPerformed(ActionEvent e) { viewClient(); } }; versionRequest.putValue(Action.NAME, Res.getString("menuitem.view.client.version")); popup.add(versionRequest); } public void poppingDown(JPopupMenu popup) { } public boolean handleDefaultAction(MouseEvent e) { return false; } }); contactList.getActionMap().put("viewClient", new AbstractAction("viewClient") { public void actionPerformed(ActionEvent evt) { viewClient(); } }); }
| 3,231,668
|
private ImagesTableModel() { ImageSummary is; for (int i = 0; i < images.length; i++) { is = (ImageSummary) images[i]; data[i][0] = is.getName(); data[i][1] = is.getDate(); //TODO } }
|
private ImagesTableModel() { ImageSummary is; for (int i = 0; i < images.length; i++) { is = (ImageSummary) images[i]; data[i][0] = is.getName(); data[i][1] = ""; //TODO } }
| 3,231,669
|
public Image(Integer imageId, Date inserted, String name, String description, Date created, String imageGuid, org.openmicroscopy.omero.model.ImagePixel imagePixel, org.openmicroscopy.omero.model.Group group, org.openmicroscopy.omero.model.Experimenter experimenter, Set thumbnails, Set classifications, Set displayRois, Set imageInfos, Set imagePixels, Set imagePlates, Set features, Set imageAnnotations, Set moduleExecutions, Set imageDimensions, Set channelComponents, Set displayOptions, Set datasets) { this.imageId = imageId; this.inserted = inserted; this.name = name; this.description = description; this.created = created; this.imageGuid = imageGuid; this.imagePixel = imagePixel; this.group = group; this.experimenter = experimenter; this.thumbnails = thumbnails; this.classifications = classifications; this.displayRois = displayRois; this.imageInfos = imageInfos; this.imagePixels = imagePixels; this.imagePlates = imagePlates; this.features = features; this.imageAnnotations = imageAnnotations; this.moduleExecutions = moduleExecutions; this.imageDimensions = imageDimensions; this.channelComponents = channelComponents; this.displayOptions = displayOptions; this.datasets = datasets; }
|
public Image(Integer imageId, Date inserted, String name, String description, Date created, String imageGuid, org.openmicroscopy.omero.model.ImagePixel imagePixel, org.openmicroscopy.omero.model.Group group, org.openmicroscopy.omero.model.Experimenter experimenter, Set thumbnails, Set classifications, Set displayRois, Set imageInfos, Set imagePixels, Set imagePlates, Set features, Set imageAnnotations, Set moduleExecutions, Set imageDimensions, Set channelComponents, Set displayOptions, Set datasets) { this.imageId = imageId; this.inserted = inserted; this.name = name; this.description = description; this.created = created; this.imageGuid = imageGuid; this.imagePixel = imagePixel; this.group = group; this.experimenter = experimenter; this.thumbnails = thumbnails; this.classifications = classifications; this.displayRois = displayRois; this.imageInfos = imageInfos; this.imagePixels = imagePixels; this.imagePlates = imagePlates; this.features = features; this.imageAnnotations = imageAnnotations; this.moduleExecutions = moduleExecutions; this.imageDimensions = imageDimensions; this.channelComponents = channelComponents; this.displayOptions = displayOptions; this.datasets = datasets; }
| 3,231,670
|
public org.openmicroscopy.omero.model.Experimenter getExperimenter() { return this.experimenter; }
|
public Experimenter getExperimenter() { return this.experimenter; }
| 3,231,671
|
public org.openmicroscopy.omero.model.Group getGroup() { return this.group; }
|
public Group getGroup() { return this.group; }
| 3,231,672
|
public org.openmicroscopy.omero.model.ImagePixel getImagePixel() { return this.imagePixel; }
|
public ImagePixel getImagePixel() { return this.imagePixel; }
| 3,231,673
|
public void setExperimenter(org.openmicroscopy.omero.model.Experimenter experimenter) { this.experimenter = experimenter; }
|
public void setExperimenter(Experimenter experimenter) { this.experimenter = experimenter; }
| 3,231,674
|
public void setGroup(org.openmicroscopy.omero.model.Group group) { this.group = group; }
|
public void setGroup(Group group) { this.group = group; }
| 3,231,675
|
public void setImagePixel(org.openmicroscopy.omero.model.ImagePixel imagePixel) { this.imagePixel = imagePixel; }
|
public void setImagePixel(ImagePixel imagePixel) { this.imagePixel = imagePixel; }
| 3,231,676
|
private void destroy() throws UnsatisfiedConditionsException, IllegalServiceStateException { serviceMonitor.reset(); serviceManager.destroy(StopStrategies.SYNCHRONOUS); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); }
|
private void destroy(StopStrategy stopStrategy) { ServiceState initialState = serviceManager.getState(); serviceMonitor.reset(); serviceManager.destroy(StopStrategies.SYNCHRONOUS); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); }
| 3,231,679
|
private void destroy() throws UnsatisfiedConditionsException, IllegalServiceStateException { serviceMonitor.reset(); serviceManager.destroy(StopStrategies.SYNCHRONOUS); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); }
|
private void destroy() throws UnsatisfiedConditionsException, IllegalServiceStateException { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.destroy(stopStrategy); } catch (IllegalServiceStateException e) { assertFalse(stopCondition.satisfied); assertSame(StopStrategies.ASYNCHRONOUS, stopStrategy); } catch (UnsatisfiedConditionsException e) { assertFalse(stopCondition.satisfied); assertSame(StopStrategies.SYNCHRONOUS, stopStrategy); assertTrue(e.getUnsatisfiedConditions().contains(stopCondition)); } assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); }
| 3,231,680
|
private void destroy() throws UnsatisfiedConditionsException, IllegalServiceStateException { serviceMonitor.reset(); serviceManager.destroy(StopStrategies.SYNCHRONOUS); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); }
|
private void destroy() throws UnsatisfiedConditionsException, IllegalServiceStateException { serviceMonitor.reset(); serviceManager.destroy(StopStrategies.SYNCHRONOUS); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); }
| 3,231,681
|
private void disabledStart(StartStrategy startStrategy) throws Exception { serviceFactory.setEnabled(false); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } // move to starting disable, move to running, and try to restart serviceFactory.setEnabled(true); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); serviceFactory.setEnabled(false);// try {// start(false, startStrategy);// } catch (IllegalServiceStateException e) {// assertTrue(startStrategy == StartStrategies.UNREGISTER);// } catch (UnsatisfiedConditionsException e) {// assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);// assertTrue(e.getUnsatisfiedConditions().contains(startCondition));// } catch (UnregisterServiceException e) {// assertEquals(StartStrategies.UNREGISTER, startStrategy);// UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();// assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));// } startCondition.satisfied = true; try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } }
|
private void disabledStart(StartStrategy startStrategy) throws Exception { serviceFactory.setEnabled(false); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } // move to starting disable, move to running, and try to restart serviceFactory.setEnabled(true); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); serviceFactory.setEnabled(false);// try {// start(false, startStrategy);// } catch (IllegalServiceStateException e) {// assertTrue(startStrategy == StartStrategies.UNREGISTER);// } catch (UnsatisfiedConditionsException e) {// assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);// assertTrue(e.getUnsatisfiedConditions().contains(startCondition));// } catch (UnregisterServiceException e) {// assertEquals(StartStrategies.UNREGISTER, startStrategy);// UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();// assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));// } startCondition.satisfied = true; try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } }
| 3,231,682
|
private void disabledStart(StartStrategy startStrategy) throws Exception { serviceFactory.setEnabled(false); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } // move to starting disable, move to running, and try to restart serviceFactory.setEnabled(true); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); serviceFactory.setEnabled(false);// try {// start(false, startStrategy);// } catch (IllegalServiceStateException e) {// assertTrue(startStrategy == StartStrategies.UNREGISTER);// } catch (UnsatisfiedConditionsException e) {// assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);// assertTrue(e.getUnsatisfiedConditions().contains(startCondition));// } catch (UnregisterServiceException e) {// assertEquals(StartStrategies.UNREGISTER, startStrategy);// UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();// assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));// } startCondition.satisfied = true; try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } }
|
private void disabledStart(StartStrategy startStrategy) throws Exception { serviceFactory.setEnabled(false); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } // move to starting disable, move to running, and try to restart serviceFactory.setEnabled(true); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); serviceFactory.setEnabled(false);// try {// start(false, startStrategy);// } catch (IllegalServiceStateException e) {// assertTrue(startStrategy == StartStrategies.UNREGISTER);// } catch (UnsatisfiedConditionsException e) {// assertTrue(startStrategy == StartStrategies.SYNCHRONOUS);// assertTrue(e.getUnsatisfiedConditions().contains(startCondition));// } catch (UnregisterServiceException e) {// assertEquals(StartStrategies.UNREGISTER, startStrategy);// UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause();// assertTrue(cause.getUnsatisfiedConditions().contains(startCondition));// } startCondition.satisfied = true; try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } try { start(false, startStrategy); } catch (IllegalServiceStateException e) { assertTrue(startStrategy == StartStrategies.UNREGISTER); } stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } }
| 3,231,683
|
private void initialize() throws Exception { serviceMonitor.reset(); serviceManager.initialize(); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); }
|
private void initialize() throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.initialize(); } catch (MockCreateException e) { assertTrue(serviceFactory.throwExceptionFromCreate == true); assertSame(serviceFactory.createException, e); } catch (UnsatisfiedConditionsException e) { assertTrue(startCondition.satisfied == false); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (IllegalServiceStateException e) { assertFalse(serviceFactory.isEnabled()); } assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); }
| 3,231,684
|
private void initialize() throws Exception { serviceMonitor.reset(); serviceManager.initialize(); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); }
|
private void initialize() throws Exception { serviceMonitor.reset(); serviceManager.initialize(); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); }
| 3,231,685
|
private void startException(StartStrategy startStrategy) throws Exception { serviceFactory.throwExceptionFromCreate = true; try { start(false, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK); assertEquals(serviceFactory.createException, e); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); assertSame(serviceFactory.createException, e.getCause()); } stop(StopStrategies.SYNCHRONOUS); }
|
private void startException(StartStrategy startStrategy, boolean recursive) throws Exception { serviceFactory.throwExceptionFromCreate = true; try { start(false, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK); assertEquals(serviceFactory.createException, e); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); assertSame(serviceFactory.createException, e.getCause()); } stop(StopStrategies.SYNCHRONOUS); }
| 3,231,686
|
private void startException(StartStrategy startStrategy) throws Exception { serviceFactory.throwExceptionFromCreate = true; try { start(false, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK); assertEquals(serviceFactory.createException, e); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); assertSame(serviceFactory.createException, e.getCause()); } stop(StopStrategies.SYNCHRONOUS); }
|
private void startException(StartStrategy startStrategy) throws Exception { serviceFactory.throwExceptionFromCreate = true; try { start(recursive, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK); assertEquals(serviceFactory.createException, e); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); assertSame(serviceFactory.createException, e.getCause()); } stop(StopStrategies.SYNCHRONOUS); }
| 3,231,687
|
private void startStop(StartStrategy startStrategy) throws Exception { start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); start(false, startStrategy); start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); stop(StopStrategies.SYNCHRONOUS); }
|
private void startStop(StartStrategy startStrategy) throws Exception { start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); start(false, startStrategy); start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); stop(StopStrategies.SYNCHRONOUS); }
| 3,231,688
|
private void startStop(StartStrategy startStrategy) throws Exception { start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); start(false, startStrategy); start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); stop(StopStrategies.SYNCHRONOUS); }
|
private void startStop(StartStrategy startStrategy) throws Exception { start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); start(false, startStrategy); start(false, startStrategy); stop(StopStrategies.SYNCHRONOUS); stop(StopStrategies.SYNCHRONOUS); }
| 3,231,689
|
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
|
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied && stopStrategy != StopStrategies.FORCE) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
| 3,231,690
|
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
|
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); if (stopStrategy == StopStrategies.FORCE) { assertNotNull(serviceMonitor.stopError); ForcedStopException cause = (ForcedStopException) serviceMonitor.stopError.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(stopCondition)); } else { assertNull(serviceMonitor.stopError); } assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); if (stopStrategy == StopStrategies.FORCE) { assertNotNull(serviceMonitor.stopError); ForcedStopException cause = (ForcedStopException) serviceMonitor.stopError.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(stopCondition)); } else { assertNull(serviceMonitor.stopError); } assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); if (stopStrategy == StopStrategies.FORCE) { assertNotNull(serviceMonitor.stopError); ForcedStopException cause = (ForcedStopException) serviceMonitor.stopError.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(stopCondition)); } else { assertNull(serviceMonitor.stopError); } assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
| 3,231,691
|
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
|
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
| 3,231,692
|
public void testInitializeDestroy() throws Exception { initialize(); destroy(); initialize(); destroy(); }
|
public void testInitializeDestroy() throws Exception { initialize(); destroy(StopStrategies.SYNCHRONOUS); initialize(); destroy(StopStrategies.SYNCHRONOUS); }
| 3,231,693
|
public void testInitializeDestroy() throws Exception { initialize(); destroy(); initialize(); destroy(); }
|
public void testInitializeDestroy() throws Exception { initialize(); destroy(StopStrategies.SYNCHRONOUS); initialize(); destroy(StopStrategies.SYNCHRONOUS); }
| 3,231,694
|
public void testStartException() throws Exception { startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); }
|
public void testStartException() throws Exception { startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); }
| 3,231,695
|
public void testStartException() throws Exception { startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); }
|
public void testStartException() throws Exception { startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); startException(StartStrategies.ASYNCHRONOUS); startException(StartStrategies.SYNCHRONOUS); startException(StartStrategies.UNREGISTER); startException(StartStrategies.BLOCK); }
| 3,231,696
|
public void testStartRecursive() throws Exception { startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); }
|
public void testStartRecursive() throws Exception { startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); }
| 3,231,697
|
public void testStartRecursive() throws Exception { startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); }
|
public void testStartRecursive() throws Exception { startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); startRecursive(StartStrategies.ASYNCHRONOUS); startRecursive(StartStrategies.SYNCHRONOUS); startRecursive(StartStrategies.UNREGISTER); startRecursive(StartStrategies.BLOCK); }
| 3,231,698
|
public void testStartStop() throws Exception { startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); }
|
public void testStartStop() throws Exception { startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); }
| 3,231,699
|
public void testStartStop() throws Exception { startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); }
|
public void testStartStop() throws Exception { startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); startStop(StartStrategies.ASYNCHRONOUS); startStop(StartStrategies.SYNCHRONOUS); startStop(StartStrategies.UNREGISTER); startStop(StartStrategies.BLOCK); }
| 3,231,700
|
public void testStartWaiting() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
|
public void testStartWaiting() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
| 3,231,701
|
public void testStartWaiting() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
|
public void testStartWaiting() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
| 3,231,702
|
public void testStartWaitingStart() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
|
public void testStartWaitingStart() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
| 3,231,703
|
public void testStartWaitingStart() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
|
public void testStartWaitingStart() throws Exception { startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); startCondition.satisfied = true; start(false, StartStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); }
| 3,231,704
|
public void testWaitingStop() throws Exception { start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); stopCondition.satisfied = true; stop(StopStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); stopCondition.satisfied = true; stop(StopStrategies.ASYNCHRONOUS); }
|
public void testWaitingStop() throws Exception { start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); stopCondition.satisfied = true; stop(StopStrategies.ASYNCHRONOUS); start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); stop(StopStrategies.ASYNCHRONOUS); stopCondition.satisfied = true; stop(StopStrategies.ASYNCHRONOUS); }
| 3,231,705
|
public void stateChanged(ChangeEvent ce) { int state = model.getState(); switch (state) { case HiViewer.LOADING_THUMBNAILS: Browser browser = model.getBrowser(); browser.addPropertyChangeListener(Browser.POPUP_POINT_PROPERTY, this); browser.addPropertyChangeListener( Browser.THUMB_SELECTED_PROPERTY, this); view.setBrowserView(browser.getUI()); view.setViewTitle(); break; case HiViewer.DISCARDED: view.setVisible(false); view.dispose(); break; } }
|
public void stateChanged(ChangeEvent ce) { int state = model.getState(); switch (state) { case HiViewer.LOADING_THUMBNAILS: Browser browser = model.getBrowser(); browser.addPropertyChangeListener(Browser.POPUP_POINT_PROPERTY, this); browser.addPropertyChangeListener( Browser.THUMB_SELECTED_PROPERTY, this); view.setBrowserView(browser.getUI()); view.setViewTitle(); break; case HiViewer.DISCARDED: view.setVisible(false); view.dispose(); break; } }
| 3,231,707
|
public final RubyFixnum hash() { return RubyFixnum.newFixnum(getRuby(), hashCode()); }
|
public final RubyFixnum hash() { return RubyFixnum.newFixnum(getRuby(), hashCode()); }
| 3,231,709
|
private void configureMenu() { // setup file menu JMenuItem exitMenuItem = new JMenuItem("Exit"); // Setup ResourceUtils ResourceUtils.resButton(connectMenu, "&" + Default.getString(Default.APPLICATION_NAME)); ResourceUtils.resButton(contactsMenu, "Con&tacts"); ResourceUtils.resButton(actionsMenu, "&Actions"); ResourceUtils.resButton(exitMenuItem, "&Exit"); ResourceUtils.resButton(pluginsMenu, "&Plugins"); exitMenuItem.setIcon(null); mainWindowBar.add(connectMenu); mainWindowBar.add(contactsMenu); mainWindowBar.add(actionsMenu); //mainWindowBar.add(pluginsMenu); mainWindowBar.add(helpMenu); preferenceMenuItem = new JMenuItem(SparkRes.getImageIcon(SparkRes.PREFERENCES_IMAGE)); preferenceMenuItem.setText("Spark Preferences"); preferenceMenuItem.addActionListener(this); connectMenu.add(preferenceMenuItem); connectMenu.addSeparator(); JMenuItem logoutMenuItem = new JMenuItem("Log Out"); ResourceUtils.resButton(logoutMenuItem, "L&og Out"); logoutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(false); } }); JMenuItem logoutWithStatus = new JMenuItem("Log Out"); ResourceUtils.resButton(logoutWithStatus, "Log out with status"); logoutWithStatus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(true); } }); if (Spark.isWindows()) { connectMenu.add(logoutMenuItem); connectMenu.add(logoutWithStatus); } connectMenu.addSeparator(); connectMenu.add(exitMenuItem); Action showTrafficAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { EnhancedDebuggerWindow window = EnhancedDebuggerWindow.getInstance(); window.setVisible(true); } }; showTrafficAction.putValue(Action.NAME, "Show Traffic Window"); showTrafficAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.TRAFFIC_LIGHT_IMAGE)); Action updateAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { checkUpdate(true); } }; updateAction.putValue(Action.NAME, "Check For Updates"); updateAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16)); // Build Help Menu helpMenu.setText("Help"); //s helpMenu.add(helpMenuItem); helpMenu.add(showTrafficAction); helpMenu.add(updateAction); helpMenu.addSeparator(); helpMenu.add(menuAbout); // ResourceUtils - Adds mnemonics ResourceUtils.resButton(preferenceMenuItem, "&Preferences"); ResourceUtils.resButton(helpMenu, "&Help"); ResourceUtils.resButton(menuAbout, "&About"); ResourceUtils.resButton(helpMenuItem, "&Online Help"); // Register shutdown with the exit menu. exitMenuItem.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { shutdown(); } }); helpMenuItem.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { try { BrowserLauncher.openURL("http://www.jivesoftware.org/community/kbcategory.jspa?categoryID=23"); } catch (IOException browserException) { Log.error("Error launching browser:", browserException); } } }); // Show About Box menuAbout.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { showAboutBox(); } }); int delay = 15000; // 15 sec Date timeToRun = new Date(System.currentTimeMillis() + delay); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { checkUpdate(false); } }, timeToRun); }
|
private void configureMenu() { // setup file menu JMenuItem exitMenuItem = new JMenuItem("Exit"); // Setup ResourceUtils ResourceUtils.resButton(connectMenu, "&" + Default.getString(Default.APPLICATION_NAME)); ResourceUtils.resButton(contactsMenu, "Con&tacts"); ResourceUtils.resButton(actionsMenu, "&Actions"); ResourceUtils.resButton(exitMenuItem, "&Exit"); ResourceUtils.resButton(pluginsMenu, "&Plugins"); exitMenuItem.setIcon(null); mainWindowBar.add(connectMenu); mainWindowBar.add(contactsMenu); mainWindowBar.add(actionsMenu); //mainWindowBar.add(pluginsMenu); mainWindowBar.add(helpMenu); preferenceMenuItem = new JMenuItem(SparkRes.getImageIcon(SparkRes.PREFERENCES_IMAGE)); preferenceMenuItem.setText("Spark Preferences"); preferenceMenuItem.addActionListener(this); connectMenu.add(preferenceMenuItem); connectMenu.addSeparator(); JMenuItem logoutMenuItem = new JMenuItem("Log Out"); ResourceUtils.resButton(logoutMenuItem, "L&og Out"); logoutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(false); } }); JMenuItem logoutWithStatus = new JMenuItem("Log Out"); ResourceUtils.resButton(logoutWithStatus, "Log Out with &status"); logoutWithStatus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(true); } }); if (Spark.isWindows()) { connectMenu.add(logoutMenuItem); connectMenu.add(logoutWithStatus); } connectMenu.addSeparator(); connectMenu.add(exitMenuItem); Action showTrafficAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { EnhancedDebuggerWindow window = EnhancedDebuggerWindow.getInstance(); window.setVisible(true); } }; showTrafficAction.putValue(Action.NAME, "Show Traffic Window"); showTrafficAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.TRAFFIC_LIGHT_IMAGE)); Action updateAction = new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { checkUpdate(true); } }; updateAction.putValue(Action.NAME, "Check For Updates"); updateAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16)); // Build Help Menu helpMenu.setText("Help"); //s helpMenu.add(helpMenuItem); helpMenu.add(showTrafficAction); helpMenu.add(updateAction); helpMenu.addSeparator(); helpMenu.add(menuAbout); // ResourceUtils - Adds mnemonics ResourceUtils.resButton(preferenceMenuItem, "&Preferences"); ResourceUtils.resButton(helpMenu, "&Help"); ResourceUtils.resButton(menuAbout, "&About"); ResourceUtils.resButton(helpMenuItem, "&Online Help"); // Register shutdown with the exit menu. exitMenuItem.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { shutdown(); } }); helpMenuItem.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { try { BrowserLauncher.openURL("http://www.jivesoftware.org/community/kbcategory.jspa?categoryID=23"); } catch (IOException browserException) { Log.error("Error launching browser:", browserException); } } }); // Show About Box menuAbout.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { showAboutBox(); } }); int delay = 15000; // 15 sec Date timeToRun = new Date(System.currentTimeMillis() + delay); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { checkUpdate(false); } }, timeToRun); }
| 3,231,710
|
public CheckUpdates() { // Set the Jabber IQ Provider for Jabber:iq:spark ProviderManager.addIQProvider("query", "jabber:iq:spark", new SparkVersion.Provider()); // For simplicity, use an alias for the root xml tag xstream.alias("Version", SparkVersion.class); // Specify the main update url for JiveSoftware this.mainUpdateURL = "http://www.jivesoftware.org/updater/updater"; sparkPluginInstalled = isSparkPluginInstalled(SparkManager.getConnection()); }
|
public CheckUpdates() { // Set the Jabber IQ Provider for Jabber:iq:spark ProviderManager.addIQProvider("query", "jabber:iq:spark", new SparkVersion.Provider()); // For simplicity, use an alias for the root xml tag xstream.alias("Version", SparkVersion.class); // Specify the main update url for JiveSoftware this.mainUpdateURL = "http://www.jivesoftware.org/updater/updater"; sparkPluginInstalled = isSparkPluginInstalled(SparkManager.getConnection()); }
| 3,231,711
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); subjectField = new JTextField(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); final JPanel centerPanel = new JPanel(new GridBagLayout()); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); subjectField = new JTextField(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); final JPanel centerPanel = new JPanel(new GridBagLayout()); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
| 3,231,712
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); subjectField = new JTextField(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); final JPanel centerPanel = new JPanel(new GridBagLayout()); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); subjectField = new JTextField(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); final JPanel centerPanel = new JPanel(new GridBagLayout()); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
| 3,231,713
|
public void push(NODE v, NODE b, RubyObject newSelf) { RubyBlock oldBlock = new RubyBlock(var, body, self, frame, scope, klass, iter, vmode, flags, dynamicVars, origThread, prev, ruby); var = v; body = b; self = newSelf; frame = ruby.getInterpreter().getRubyFrame(); klass = ruby.getRubyClass(); frame.setFile(ruby.getSourceFile()); frame.setLine(ruby.getSourceLine()); scope = ruby.getRubyScope(); prev = oldBlock; iter = ruby.getInterpreter().getRubyIter().getIter(); vmode = ruby.getInterpreter().getActMethodScope(); flags = BLOCK_D_SCOPE; dynamicVars = ruby.getDynamicVars(); }
|
public void push(NODE v, NODE b, RubyObject newSelf) { RubyBlock oldBlock = new RubyBlock(var, body, self, frame, scope, klass, iter, vmode, flags, dynamicVars, origThread, prev, ruby); var = v; body = b; self = newSelf; frame = ruby.getRubyFrame(); klass = ruby.getRubyClass(); frame.setFile(ruby.getSourceFile()); frame.setLine(ruby.getSourceLine()); scope = ruby.getRubyScope(); prev = oldBlock; iter = ruby.getInterpreter().getRubyIter().getIter(); vmode = ruby.getInterpreter().getActMethodScope(); flags = BLOCK_D_SCOPE; dynamicVars = ruby.getDynamicVars(); }
| 3,231,714
|
public final void parse() throws IOException, TemplateException { // thread policy: // // unsynchronized code elsewhere will access _content. We must // ensure that any data copied into _content is ready for public // use--which means dealing with two subtle issues. First, the Block // created by this method must be written back to main memory BEFORE // being referenced by _content. Second, once we add it to _content, // our copy of _content has to be copied back to main memory as well. // // Therefore we synchronize around the access to _content so as to // accomplish both these things. newContent will be written to main // memory at the start of the synchronized block, and _content will // be written to main memory at the close. Block newContent = null; Map newParameters = null; Reader source = null; Map newFilters = null; try { Parser parser = getParser(); Reader in = getReader(); BlockBuilder bb = parser.parseBlock(toString(),in); in.close(); BuildContext bc = new BuildContext(_broker); newParameters = bc.getLocalVariables(); newFilters = bc.getFilters(); newContent = (Block) bb.build(bc); } catch (BuildException be) { newContent = null; _log.error("Template contained invalid data: " + be); throw be; } catch (IOException e) { newContent = null; // don't let the old one survive _log.error("Template: Could not read template: " + this); throw e; } finally { try { source.close(); } catch (Exception e) { } synchronized(this) { _parameters = newParameters; _filters = newFilters; _content = newContent; } } }
|
public final void parse() throws IOException, TemplateException { // thread policy: // // unsynchronized code elsewhere will access _content. We must // ensure that any data copied into _content is ready for public // use--which means dealing with two subtle issues. First, the Block // created by this method must be written back to main memory BEFORE // being referenced by _content. Second, once we add it to _content, // our copy of _content has to be copied back to main memory as well. // // Therefore we synchronize around the access to _content so as to // accomplish both these things. newContent will be written to main // memory at the start of the synchronized block, and _content will // be written to main memory at the close. Block newContent = null; Map newParameters = null; Reader source = null; Map newFilters = null; try { Parser parser = getParser(); source = getReader(); BlockBuilder bb = parser.parseBlock(toString(),in); in.close(); BuildContext bc = new BuildContext(_broker); newParameters = bc.getLocalVariables(); newFilters = bc.getFilters(); newContent = (Block) bb.build(bc); } catch (BuildException be) { newContent = null; _log.error("Template contained invalid data: " + be); throw be; } catch (IOException e) { newContent = null; // don't let the old one survive _log.error("Template: Could not read template: " + this); throw e; } finally { try { source.close(); } catch (Exception e) { } synchronized(this) { _parameters = newParameters; _filters = newFilters; _content = newContent; } } }
| 3,231,715
|
public void initializeContent(){ //TODO Remove this and use newer localization system: FacesContext context = FacesContext.getCurrentInstance(); WFPage.loadResourceBundles(context); super.initializeContent(); String bref = WFPage.CONTENT_BUNDLE + "."; WFTabbedPane tb = new WFTabbedPane(); //tb.setMainAreaStyleClass(WFContainer.DEFAULT_STYLE_CLASS); tb.setId(TASKBAR_ID); add(tb); EditArticleView editArticleBlock = new EditArticleView(); tb.addTabVB(TASK_ID_EDIT, bref + "edit", editArticleBlock); tb.addTabVB(TASK_ID_DETAILS, bref + "details", new ArticleDetailView());// tb.addTabVB(TASK_ID_LIST, bref + "list", new ListArticlesBlock()); tb.addTabVB(TASK_ID_PREVIEW, bref + "preview", new ArticlePreview()); tb.setSelectedMenuItemId(TASK_ID_EDIT); //if (taskbarListener != null) { // tb.addTabListener(taskbarListener); //} String editMode = getEditMode(); if(editMode!=null){ editArticleBlock.setEditView(editMode); } }
|
public void initializeContent(){ //TODO Remove this and use newer localization system: FacesContext context = FacesContext.getCurrentInstance(); WFPage.loadResourceBundles(context); super.initializeContent(); String bref = WFPage.CONTENT_BUNDLE + "."; WFTabbedPane tb = new WFTabbedPane(); //tb.setMainAreaStyleClass(WFContainer.DEFAULT_STYLE_CLASS); tb.setId(TASKBAR_ID); add(tb); EditArticleView editArticleBlock = new EditArticleView(); tb.addTabVB(TASK_ID_EDIT, bref + "edit", editArticleBlock); tb.addTabVB(TASK_ID_DETAILS, bref + "details", new ArticleDetailView());// tb.addTabVB(TASK_ID_LIST, bref + "list", new ListArticlesBlock()); tb.addTabVB(TASK_ID_PREVIEW, bref + "preview", new ArticlePreview()); tb.setSelectedMenuItemId(TASK_ID_EDIT); //if (taskbarListener != null) { // tb.addTabListener(taskbarListener); //} String editMode = getEditMode(); if(editMode!=null){ editArticleBlock.setEditView(editMode); } }
| 3,231,716
|
public void serviceRegistered(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceRegistered(serviceEvent); } catch (Throwable e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceRegistered(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceRegistered(serviceEvent); } catch (Throwable e) { errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,717
|
public void serviceStarting(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStarting(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceStarting(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStarting(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,718
|
public void serviceWaitingToStart(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceWaitingToStart(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceWaitingToStart(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceWaitingToStart(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,719
|
public void serviceStartError(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStartError(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceStartError(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStartError(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,720
|
public void serviceRunning(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceRunning(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceRunning(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceRunning(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,721
|
public void serviceStopping(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStopping(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceStopping(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStopping(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,722
|
public void serviceWaitingToStop(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceWaitingToStop(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceWaitingToStop(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceWaitingToStop(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,723
|
public void serviceStopError(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStopError(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceStopError(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStopError(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,724
|
public void serviceStopped(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStopped(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceStopped(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceStopped(serviceEvent); } catch (Exception e) { errors.add(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,725
|
public void serviceUnregistered(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceUnregistered(serviceEvent); } catch (Exception e) { errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
|
public void serviceUnregistered(ServiceEvent serviceEvent) { List errors = new ArrayList(); Set serviceMonitors = getServiceMonitors(serviceEvent.getServiceName()); for (Iterator iterator = serviceMonitors.iterator(); iterator.hasNext();) { ServiceMonitor serviceMonitor = (ServiceMonitor) iterator.next(); try { serviceMonitor.serviceUnregistered(serviceEvent); } catch (Throwable e) { errors.addAll(fireServiceNotificationError(serviceMonitor, serviceEvent, e)); } } if (!errors.isEmpty()) { throw new KernelErrorsError(errors); } }
| 3,231,726
|
public void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName) { synchronized (serviceMonitors) { Set monitors = (Set) serviceMonitors.get(serviceName); if (monitors == null) { monitors = new LinkedHashSet(); serviceMonitors.put(serviceName, serviceMonitor); } monitors.add(serviceMonitor); } }
|
public void addServiceMonitor(ServiceMonitor serviceMonitor, ServiceName serviceName) { synchronized (serviceMonitors) { Set monitors = (Set) serviceMonitors.get(serviceName); if (monitors == null) { monitors = new LinkedHashSet(); serviceMonitors.put(serviceName, monitors); } monitors.add(serviceMonitor); } }
| 3,231,727
|
DataHandler annotateDataObjects(Set nodes) { Object uo; Set toAnnotate = new HashSet(); Iterator i = nodes.iterator(); while (i.hasNext()) { uo = ((ImageDisplay) i.next()).getHierarchyObject(); if (uo instanceof DataObject) toAnnotate.add(uo); } dataHandler = AnnotatorFactory.getAnnotator(toAnnotate, HiViewerAgent.getRegistry()); return dataHandler; }
|
DataHandler annotateDataObjects(Set nodes) { Object uo; Set toAnnotate = new HashSet(); Iterator i = nodes.iterator(); while (i.hasNext()) { uo = ((ImageDisplay) i.next()).getHierarchyObject(); if (uo instanceof DataObject) toAnnotate.add(uo); } dataHandler = AnnotatorFactory.getAnnotator(toAnnotate, HiViewerAgent.getRegistry()); return dataHandler; }
| 3,231,728
|
DataHandler annotateDataObjects(Set nodes) { Object uo; Set toAnnotate = new HashSet(); Iterator i = nodes.iterator(); while (i.hasNext()) { uo = ((ImageDisplay) i.next()).getHierarchyObject(); if (uo instanceof DataObject) toAnnotate.add(uo); } dataHandler = AnnotatorFactory.getAnnotator(toAnnotate, HiViewerAgent.getRegistry()); return dataHandler; }
|
DataHandler annotateDataObjects(Set nodes) { Object uo; Set toAnnotate = new HashSet(); Iterator i = nodes.iterator(); while (i.hasNext()) { uo = ((ImageDisplay) i.next()).getHierarchyObject(); if (uo instanceof DataObject) toAnnotate.add(uo); } dataHandler = AnnotatorFactory.getAnnotator(toAnnotate, HiViewerAgent.getRegistry()); return dataHandler; }
| 3,231,729
|
DataHandler classifyImageObjects(ImageData[] nodes, int mode) { Set images = new HashSet(nodes.length); for (int i = 0; i < nodes.length; i++) images.add(nodes[i]); dataHandler = ClassifierFactory.getClassifier(images, getRootLevel(), getRootID(), mode, HiViewerAgent.getRegistry()); return dataHandler; }
|
DataHandler classifyImageObjects(ImageData[] nodes, int mode) { Set images = new HashSet(nodes.length); for (int i = 0; i < nodes.length; i++) images.add(nodes[i]); dataHandler = ClassifierFactory.getClassifier(images, getRootLevel(), getRootID(), mode, HiViewerAgent.getRegistry()); return dataHandler; }
| 3,231,730
|
DataHandler classifyImageObjects(ImageData[] nodes, int mode) { Set images = new HashSet(nodes.length); for (int i = 0; i < nodes.length; i++) images.add(nodes[i]); dataHandler = ClassifierFactory.getClassifier(images, getRootLevel(), getRootID(), mode, HiViewerAgent.getRegistry()); return dataHandler; }
|
DataHandler classifyImageObjects(ImageData[] nodes, int mode) { Set images = new HashSet(nodes.length); for (int i = 0; i < nodes.length; i++) images.add(nodes[i]); dataHandler = ClassifierFactory.getClassifier(images, getRootLevel(), getRootID(), mode, HiViewerAgent.getRegistry()); return dataHandler; }
| 3,231,731
|
public static RubyString m_new(Ruby ruby, RubyObject[] args) { RubyString newString = m_newString(ruby, ""); newString.callInit(args); return newString; }
|
public static RubyString m_new(Ruby ruby, RubyObject recv, RubyObject[] args) { RubyString newString = m_newString(ruby, ""); newString.callInit(args); return newString; }
| 3,231,732
|
private void buildMagnifiedLabel() { // set up the magnified version of the module name zoomName = new PText(getName()); //zoomName.setGreekThreshold(0); zoomName.setFont(Constants.NAME_FONT); zoomName.setPickable(false); zoomName.setConstrainWidthToTextWidth(false); double zwidth; double zheight; //float scale = ZOOM_MAG; //zoomName.setScale(scale); overview.addChild(zoomName); zoomName.setBounds(new PBounds(NAME_LABEL_OFFSET,NAME_LABEL_OFFSET, width-2*NAME_LABEL_OFFSET,height)); zoomName.setVisible(true); }
|
privatezoomName.setGreekThreshold(0); voidzoomName.setGreekThreshold(0); buildMagnifiedLabel()zoomName.setGreekThreshold(0); { //zoomName.setGreekThreshold(0); setzoomName.setGreekThreshold(0); upzoomName.setGreekThreshold(0); thezoomName.setGreekThreshold(0); magnifiedzoomName.setGreekThreshold(0); versionzoomName.setGreekThreshold(0); ofzoomName.setGreekThreshold(0); thezoomName.setGreekThreshold(0); modulezoomName.setGreekThreshold(0); name zoomNamezoomName.setGreekThreshold(0); =zoomName.setGreekThreshold(0); newzoomName.setGreekThreshold(0); PText(getName()); //zoomName.setGreekThreshold(0); zoomName.setFont(Constants.NAME_FONT); zoomName.setPickable(false); zoomName.setConstrainWidthToTextWidth(false);zoomName.setGreekThreshold(0); doublezoomName.setGreekThreshold(0); zwidth; doublezoomName.setGreekThreshold(0); zheight; //floatzoomName.setGreekThreshold(0); scalezoomName.setGreekThreshold(0); =zoomName.setGreekThreshold(0); ZOOM_MAG; //zoomName.setScale(scale); overview.addChild(zoomName); zoomName.setBounds(newzoomName.setGreekThreshold(0); PBounds(NAME_LABEL_OFFSET,NAME_LABEL_OFFSET, width-2*NAME_LABEL_OFFSET,height)); zoomName.setVisible(true); }
| 3,231,734
|
public static RubyObject puts(Ruby ruby, RubyObject recv, RubyObject args[]) { if (args.length == 0) { ruby.getRuntime().getOutputStream().println(); return ruby.getNil(); } for (int i = 0; i < args.length; i++) { if (args[i] != null) { if (args[i] instanceof RubyArray) { puts(ruby, recv, ((RubyArray) args[i]).toJavaArray()); } else { ruby.getRuntime().getOutputStream().println( args[i].isNil() ? "nil" : ((RubyString) args[i].funcall("to_s")).getValue()); } } } return ruby.getNil(); }
|
public static RubyObject puts(Ruby ruby, RubyObject recv, RubyObject args[]) { if (args.length == 0) { ruby.getRuntime().getOutputStream().println(); return ruby.getNil(); } for (int i = 0; i < args.length; i++) { if (args[i] != null) { if (args[i] instanceof RubyArray) { puts(ruby, recv, ((RubyArray) args[i]).toJavaArray()); } else { ruby.getRuntime().getOutputStream().println( args[i].isNil() ? "nil" : ((RubyString) args[i].funcall("to_s")).getValue()); } } } return ruby.getNil(); }
| 3,231,735
|
AnnotatorControl(Annotator model) { if (model == null) throw new NullPointerException("No model."); this.model = model; actionsMap = new HashMap(); }
|
AnnotatorControl(Annotator model) { if (model == null) throw new NullPointerException("No model."); this.model = model; actionsMap = new HashMap(); }
| 3,231,736
|
AnnotatorView() { super(); setProperties(); }
|
AnnotatorView() { super(); setProperties(); }
| 3,231,737
|
void discard() { cancel(); state = Annotator.DISCARDED; }
|
void discard() { cancel(); state = Annotator.DISCARDED; }
| 3,231,738
|
AnnotationData getAnnotationType() { if (type.equals(DatasetData.class)) return new AnnotationData(AnnotationData.DATASET_ANNOTATION); return new AnnotationData(AnnotationData.IMAGE_ANNOTATION); }
|
AnnotationDatagetAnnotationType() { if(type.equals(DatasetData.class)) returnnewAnnotationData(AnnotationData.DATASET_ANNOTATION); returnnewAnnotationData(AnnotationData.IMAGE_ANNOTATION); }
| 3,231,739
|
void initialize(AnnotatorView view) { if (view == null) throw new NullPointerException("No view."); this.view = view; createActions(); attachListeners(); }
|
void initialize(AnnotatorView view) { if (view == null) throw new NullPointerException("No view."); this.view = view; createActions(); attachListeners(); }
| 3,231,740
|
void initialize(AnnotatorModel model, AnnotatorControl controller) { if (model == null) throw new IllegalArgumentException("No model."); if (controller == null) throw new IllegalArgumentException("No control."); this.controller = controller; statusBar = new StatusBar(); annotatorUI = new AnnotatorUI(model, controller); buildGUI(); }
|
void initialize(AnnotatorModel model, AnnotatorControl controller) { if (model == null) throw new IllegalArgumentException("No model."); if (controller == null) throw new IllegalArgumentException("No control."); this.controller = controller; statusBar = new StatusBar(); annotatorUI = new AnnotatorUI(model, controller); buildGUI(); }
| 3,231,741
|
void setAnnotations(Map map) { ViewerSorter sorter = new ViewerSorter(); sorter.setAscending(false); HashMap sortedAnnotations = new HashMap(); Set set; Long index; Iterator i = map.keySet().iterator(), l; Iterator j; AnnotationData data; HashMap m; List timestamps, results, list; while (i.hasNext()) { index = (Long) i.next(); set = (Set) map.get(index); j = set.iterator(); m = new HashMap(set.size()); timestamps = new ArrayList(set.size()); while (j.hasNext()) { data = (AnnotationData) j.next(); m.put(data.getLastModified(), data); timestamps.add(data.getLastModified()); } results = sorter.sort(timestamps); l = results.iterator(); list = new ArrayList(results.size()); while (l.hasNext()) list.add(m.get(l.next())); sortedAnnotations.put(index, list); } this.annotations = sortedAnnotations; state = Annotator.READY; }
|
void setAnnotations(Map map) { ViewerSorter sorter = new ViewerSorter(); sorter.setAscending(false); HashMap sortedAnnotations = new HashMap(); Set set; Long index; Iterator i = map.keySet().iterator(), l; Iterator j; AnnotationData data; HashMap m; List timestamps, results, list; while (i.hasNext()) { index = (Long) i.next(); set = (Set) map.get(index); j = set.iterator(); m = new HashMap(set.size()); timestamps = new ArrayList(set.size()); while (j.hasNext()) { data = (AnnotationData) j.next(); m.put(data.getLastModified(), data); timestamps.add(data.getLastModified()); } results = sorter.sort(timestamps); l = results.iterator(); list = new ArrayList(results.size()); while (l.hasNext()) list.add(m.get(l.next())); sortedAnnotations.put(index, list); } this.annotations = sortedAnnotations; state = Annotator.READY; }
| 3,231,742
|
public RubyFixnum op_cmp(IRubyObject other) { if (! (other instanceof JavaClassClass)) { throw new TypeError(getRuntime(), "<=> requires JavaClass (" + other.getType() + " given)"); } JavaClassClass otherClass = (JavaClassClass) other; if (this.javaClass == otherClass.javaClass) { return RubyFixnum.newFixnum(getRuntime(), 0); } if (this.javaClass.isAssignableFrom(otherClass.javaClass)) { return RubyFixnum.newFixnum(getRuntime(), -1); } return RubyFixnum.newFixnum(getRuntime(), 1); }
|
public RubyFixnum op_cmp(IRubyObject other) { if (! (other instanceof JavaClassClass)) { throw new TypeError(getRuntime(), "<=> requires JavaClass (" + other.getType() + " given)"); } JavaClassClass otherClass = (JavaClassClass) other; if (this.javaClass == otherClass.javaClass) { return RubyFixnum.newFixnum(getRuntime(), 0); } if (otherClass.javaClass.isAssignableFrom(this.javaClass)) { return RubyFixnum.newFixnum(getRuntime(), -1); } return RubyFixnum.newFixnum(getRuntime(), 1); }
| 3,231,743
|
StatusBar() { initComponents(); buildUI(); }
|
StatusBar() { initComponents(); buildUI(); }
| 3,231,744
|
private void buildUI() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBorder(BorderFactory.createEtchedBorder()); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(statusButton); p.add(status); add(UIUtilities.buildComponentPanel(p)); JPanel progress = new JPanel(); progress.setLayout(new BoxLayout(progress, BoxLayout.X_AXIS)); progress.add(progressBar); IconManager icons = IconManager.getInstance(); progressLabel = new JLabel(icons.getIcon(IconManager.PROGRESS)); progress.add(progressLabel); add(UIUtilities.buildComponentPanelRight(progress)); }
|
private void buildUI() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBorder(BorderFactory.createEtchedBorder()); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(statusButton); p.add(status); add(UIUtilities.buildComponentPanel(p)); JPanel progress = new JPanel(); progress.setLayout(new BoxLayout(progress, BoxLayout.X_AXIS)); progress.add(progressBar); IconManager icons = IconManager.getInstance(); progressLabel = new JLabel(icons.getIcon(IconManager.PROGRESS)); progress.add(progressLabel); add(UIUtilities.buildComponentPanelRight(progress)); }
| 3,231,745
|
private void initComponents() { IconManager icons = IconManager.getInstance(); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); status = new JLabel(); statusButton = new JButton(icons.getIcon(IconManager.INFO)); statusButton.setBorder(null); statusButton.setBorderPainted(false); statusButton.setFocusPainted(false); statusButton.setOpaque(false); }
|
private void initComponents() { IconManager icons = IconManager.getInstance(); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); status = new JLabel(); statusButton = new JButton(icons.getIcon(IconManager.INFO)); statusButton.setBorder(null); statusButton.setBorderPainted(false); statusButton.setFocusPainted(false); statusButton.setOpaque(false); }
| 3,231,746
|
void setProgress(boolean hide) { progressBar.setVisible(!hide); }
|
void setProgress(boolean hide) { progressBar.setVisible(!hide); }
| 3,231,747
|
private void softWareUpdates() { SoftwareUpdateDialog d = new SoftwareUpdateDialog(view); UIUtilities.centerAndShow(d); }
|
private void softWareUpdates() { String message = loadAbout(container.resolveConfigFile(ABOUT_FILE)); SoftwareUpdateDialog d = new SoftwareUpdateDialog(view, message); UIUtilities.centerAndShow(d); }
| 3,231,748
|
private void buildLUT() { LUT = new int[intervalEnd-intervalStart+1]; CodomainMap map; CodomainMapContext ctx; int v; Iterator i = chain.iterator(); for (int x = intervalStart; x <= intervalEnd; ++x) { v = x; while (i.hasNext()) { ctx = (CodomainMapContext) i.next(); map = ctx.getCodomainMap(); map.setContext(ctx); v = map.transform(v); } LUT[x-intervalStart] = v; } }
|
private void buildLUT() { LUT = new int[intervalEnd-intervalStart+1]; CodomainMap map; CodomainMapContext ctx; int v; Iterator i = chain.iterator(); for (int x = intervalStart; x <= intervalEnd; ++x) { v = x; while (i.hasNext()) { ctx = (CodomainMapContext) i.next(); map = ctx.getCodomainMap(); map.setContext(ctx); v = map.transform(v); } LUT[x-intervalStart] = v; } }
| 3,231,749
|
public int transform(int x) { verifyInput(x); return LUT[x-intervalStart]; }
|
public int transform(int x) { verifyInput(x); return LUT[x-intervalStart]; }
| 3,231,751
|
private void verifyInput(int x) { if (x < intervalStart || x > intervalEnd) throw new IllegalArgumentException( "Value not in the codomain interval: "+x); }
|
private void verifyInput(int x) { if (x < intervalStart || x > intervalEnd) throw new IllegalArgumentException( "Value not in the codomain interval: "+x); }
| 3,231,752
|
private void verifyInput(int x) { if (x < intervalStart || x > intervalEnd) throw new IllegalArgumentException( "Value not in the codomain interval: "+x); }
|
private void verifyInput(int x) { if (x < intervalStart || x > intervalEnd) throw new IllegalArgumentException( "Value not in the codomain interval: "+x); }
| 3,231,753
|
public void replace(long beg, long len, RubyObject repl) { int length = getLength(); if (len < 0) { throw new RubyIndexException(getRuby(), "Negative array length: " + len); } if (beg < 0) { beg += length; } if (beg < 0) { throw new RubyIndexException(getRuby(), "Index out of bounds: " + beg); } modify(); for (int i = 0; beg < getLength() && i < len; i++) { list.remove((int) beg); } autoExpand(beg); if (repl instanceof RubyArray) { List repList = ((RubyArray) repl).getList(); list.ensureCapacity(length + repList.size()); list.addAll((int) beg, new ArrayList(repList)); } else if (!repl.isNil()) { list.add((int) beg, repl); } }
|
public void replace(long beg, long len, RubyObject repl) { int length = getLength(); if (len < 0) { throw new RubyIndexException(getRuby(), "Negative array length: " + len); } if (beg < 0) { beg += length; } if (beg < 0) { throw new RubyIndexException(getRuby(), "Index out of bounds: " + beg); } modify(); for (int i = 0; beg < getLength() && i < len; i++) { list.remove((int) beg); } autoExpand(beg); if (repl instanceof RubyArray) { List repList = ((RubyArray) repl).getList(); list.ensureCapacity(getLength() + repList.size()); list.addAll((int) beg, new ArrayList(repList)); } else if (!repl.isNil()) { list.add((int) beg, repl); } }
| 3,231,754
|
public void actionPerformed(ActionEvent e) { String s = (String) e.getActionCommand(); try { int index = Integer.parseInt(s); switch (index) { case R_VISIBLE: abstraction.showPresentation(); break; case SAVE: saveDisplayOptions(); break; case GREY: case RGB: case HSB: activateRenderingModel(index); break; } } catch(NumberFormatException nfe) { throw nfe; //just to be on the safe side... } }
|
public void actionPerformed(ActionEvent e) { String s = (String) e.getActionCommand(); try { int index = Integer.parseInt(s); switch (index) { case R_VISIBLE: abstraction.showPresentation(); break; case SAVE: saveDisplayOptions(); break; case GREY: case RGB: case HSB: activateRenderingModel(index); break; } } catch(NumberFormatException nfe) { throw nfe; //just to be on the safe side... } }
| 3,231,755
|
private Principal clearAndCheckPrincipal() { // clear even if this fails. (make SecuritySystem unusable) cd.clear(); final Principal p = principalHolder.get(); if (p == null) throw new SecurityViolation( "Principal is null. Not logged in to SecuritySystem."); if (p.getName() == null) throw new InternalException( "Principal.name is null. Security system failure."); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); return p; }
|
private Principal clearAndCheckPrincipal() { // clear even if this fails. (make SecuritySystem unusable) cd.clear(); final Principal p = principalHolder.get(); if (p == null) throw new SecurityViolation( "Principal is null. Not logged in to SecuritySystem."); if (p.getName() == null) throw new InternalException( "Principal.name is null. Security system failure."); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); return p; }
| 3,231,756
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
| 3,231,759
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
| 3,231,760
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
| 3,231,761
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
| 3,231,762
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
|
private static Vector getListOfFiles(File file, boolean recursive) { Vector ret = new Vector(); if (file.isFile()) { ret.add(file.getAbsolutePath()); } else if (file.isDirectory()) { File[] files = file.listFiles(new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); } }); for (int i = 0; i < files.length; i++) { if (recursive) { ret.addAll(getListOfFiles(files[i], true)); } else { if (files[i].isFile()) { ret.add(files[i].getAbsolutePath()); } } } } return ret; }
| 3,231,763
|
public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); }
|
public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getAbsolutePath().endsWith(".java"); }
| 3,231,764
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.