private boolean openSeekable() { final Info initialInfo = new Info(); final Comment initialComment = new Comment(); this.m_chunkSize = Math.min(8500, (int) length(this.m_vorbisStream)); final Page page = new Page(); final int[] testSerialno = {0}; final int ret = this.fetchHeaders(initialInfo, initialComment, testSerialno, null); final int serialno = testSerialno[0]; final int dataOffset = (int) this.m_offset; this.m_oggStreamState.clear(); if (ret < 0) { return false; } seek(this.m_vorbisStream, 0L, 1); this.m_offset = tell(this.m_vorbisStream); final long end = this.getPreviousPage(page); if (page.serialno() != serialno) { if (this.bisectForwardSerialno(0L, 0L, end + 1L, serialno, 0) < 0) { return false; } } else if (this.bisectForwardSerialno(0L, end, end + 1L, serialno, 0) < 0) { return false; } this.prefetchAllHeaders(initialInfo, initialComment, dataOffset); this.rawSeek(this.m_dataOffsets[0]); return true; }
/** * Set <code>Page</code> parent. Called from <code>Page</code> when added to <code>Page</code> * object. * * @param page Page */ public void setPage(Page page) { if (this.page != null) removePropertyChangeListener(this.page); this.page = page; addPropertyChangeListener(this.page); page.addComponentListener(this); page.addPropertyChangeListener(this); pageSize = page.getSize(); }
private void displayPage() throws IOException { Page page = newPage(); layoutErrorBlock(page); ServletUtil.layoutExplanationBlock(page, "Debug Actions"); page.add(makeForm()); page.add("<br>"); endPage(page); }
protected Page addBarePageHeading(Page page) { // FIXME: Move the following fragment elsewhere // It causes the doctype statement to appear in the middle, // after the <body> tag. page.add("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">"); page.addHeader("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"); page.addHeader("<meta http-equiv=\"content-type\" content=\"text/html;charset=ISO-8859-1\">"); page.addHeader("<link rel=\"shortcut icon\" href=\"/favicon.ico\" type=\"image/x-icon\" />"); return page; }
// Called when a servlet doesn't get the parameters it expects/needs protected void paramError() throws IOException { // FIXME: As of 2006-03-15 this method and its only caller checkParam() are not called from // anywhere PrintWriter wrtr = resp.getWriter(); Page page = new Page(); // add referer, params, msg to contact lockss unless from old bookmark // or manually entered url page.add("Parameter error"); page.write(wrtr); }
/** Display a message in lieu of the normal page */ protected void displayMsgInLieuOfPage(String msg) throws IOException { // TODO: Look at HTML Page page = newPage(); Composite warning = new Composite(); warning.add(msg); warning.add("<br>"); page.add(warning); layoutFooter(page); page.write(resp.getWriter()); }
// see DbFile.java for javadocs public void writePage(Page page) throws IOException { // some code goes here long offset = page.getId().pageNumber() * BufferPool.PAGE_SIZE; byte[] data = page.getPageData(); try { raf.seek(offset); for (int i = 0; i < data.length; i++) { raf.writeByte(data[i]); } } catch (FileNotFoundException e) { e.printStackTrace(); } }
public int fetchHeaders(final Info info, final Comment comment, final int[] serialno, Page page) { if (page == null) { page = new Page(); final int retValue = this.getNextPage(page, this.m_chunkSize); if (retValue == -128) { return -128; } if (retValue < 0) { return -130; } } if (serialno != null) { serialno[0] = page.serialno(); } this.m_oggStreamState.init(page.serialno()); info.init(); comment.init(); final Packet packet = new Packet(); int i = 0; while (i < 3) { this.m_oggStreamState.pagein(page); while (i < 3) { final int result = this.m_oggStreamState.packetout(packet); if (result == 0) { break; } if (result == -1) { info.clear(); this.m_oggStreamState.clear(); return -1; } if (info.synthesis_headerin(comment, packet) != 0) { info.clear(); this.m_oggStreamState.clear(); return -1; } ++i; } if (i < 3 && this.getNextPage(page, 1L) < 0) { info.clear(); this.m_oggStreamState.clear(); return -1; } } return 0; }
private int bisectForwardSerialno( final long begin, long searched, final long end, final int currentno, final int m) { long endsearched = end; long next = end; final Page page = new Page(); while (searched < endsearched) { long bisect; if (endsearched - searched < this.m_chunkSize) { bisect = searched; } else { bisect = (searched + endsearched) / 2L; } this.seekHelper(bisect); final int ret = this.getNextPage(page, -1L); if (ret == -128) { return -128; } if (ret < 0 || page.serialno() != currentno) { endsearched = bisect; if (ret < 0) { continue; } next = ret; } else { searched = ret + page.header_len + page.body_len; } } this.seekHelper(next); int ret = this.getNextPage(page, -1L); if (ret == -128) { return -128; } if (searched >= end || ret == -1) { this.m_links = m + 1; (this.m_offsets = new long[m + 2])[m + 1] = searched; } else { ret = this.bisectForwardSerialno(next, this.m_offset, end, page.serialno(), m + 1); if (ret == -128) { return -128; } } this.m_offsets[m] = begin; return 0; }
/** Common page setup. */ protected Page newPage() { // Compute heading String heading = getHeading(); if (heading == null) { heading = "Box Administration"; } // Create page and layout header Page page = ServletUtil.doNewPage(getPageTitle(), isFramed()); Iterator inNavIterator; if (myServletDescr().hasNoNavTable()) { inNavIterator = CollectionUtil.EMPTY_ITERATOR; } else { inNavIterator = new FilterIterator( new ObjectArrayIterator(getServletDescrs()), new Predicate() { public boolean evaluate(Object obj) { return isServletInNav((ServletDescr) obj); } }); } ServletUtil.layoutHeader( this, page, heading, isLargeLogo(), getMachineName(), getLockssApp().getStartDate(), inNavIterator); String warnMsg = CurrentConfig.getParam(PARAM_UI_WARNING); if (warnMsg != null) { Composite warning = new Composite(); warning.add("<center><font color=red size=+1>"); warning.add(warnMsg); warning.add("</font></center><br>"); page.add(warning); } return page; }
private void prefetchAllHeaders( final Info firstInfo, final Comment firstComment, final int dataoffset) { final Page page = new Page(); this.m_info = new Info[this.m_links]; this.m_comments = new Comment[this.m_links]; this.m_dataOffsets = new long[this.m_links]; this.m_pcmLengths = new long[this.m_links]; this.m_serialnos = new int[this.m_links]; for (int i = 0; i < this.m_links; ++i) { if (firstInfo != null && firstComment != null && i == 0) { this.m_info[i] = firstInfo; this.m_comments[i] = firstComment; this.m_dataOffsets[i] = dataoffset; } else { this.seekHelper(this.m_offsets[i]); this.m_info[i] = new Info(); this.m_comments[i] = new Comment(); if (this.fetchHeaders(this.m_info[i], this.m_comments[i], null, null) == -1) { this.m_dataOffsets[i] = -1L; } else { this.m_dataOffsets[i] = this.m_offset; this.m_oggStreamState.clear(); } } final long end = this.m_offsets[i + 1]; this.seekHelper(end); while (true) { final int ret = this.getPreviousPage(page); if (ret == -1) { this.m_info[i].clear(); break; } if (page.granulepos() != -1L) { this.m_serialnos[i] = page.serialno(); this.m_pcmLengths[i] = page.granulepos(); break; } } } }
public boolean hasNext() throws DbException, TransactionAbortedException, IOException { // System.out.println("hf has next: " + _currentPageId +_numPages); if (_tupleIterator == null) return false; if (_tupleIterator.hasNext()) return true; // If we have more pages // System.out.println(_currentPageId+" llllll "+_numPages); while (_currentPageId < (_numPages)) { _currentPage = readPage(_currentPageId++); _tupleIterator = _currentPage.iterator(); if (_tupleIterator.hasNext()) { _pagesRead++; return true; } } return false; }
public Tuple previous() throws DbException, TransactionAbortedException, IOException { // System.out.println("previous "); if (_tupleIterator == null) { throw new NoSuchElementException("Tuple iterator not opened"); } if (((HeapPageIterator) _tupleIterator).hasPrevious()) { return ((HeapPageIterator) _tupleIterator).previous(); } else { if (_currentPageId > 1) { // System.out.println("CUURENT PAGEID "+_currentPageId); _currentPageId = _currentPageId - 2; _currentPage = readPage(_currentPageId++); // System.out.println("NOW "+_currentPageId); _pagesRead++; _tupleIterator = _currentPage.iterator(); ((HeapPageIterator) _tupleIterator).setLast(); if (((HeapPageIterator) _tupleIterator).hasPrevious()) { return ((HeapPageIterator) _tupleIterator).previous(); } } else return null; } return null; }
/** * overrides the test1 function in TestDriver. It tests some simple normal buffer manager * operations. * * @return whether test1 has passed */ protected boolean test1() { System.out.print("\n Test 1 does a simple test of normal buffer "); System.out.print("manager operations:\n"); // We choose this number to ensure that at least one page will have to be // written during this test. boolean status = OK; int numPages = SystemDefs.JavabaseBM.getNumUnpinnedBuffers() + 1; Page pg = new Page(); PageId pid; PageId lastPid; PageId firstPid = new PageId(); System.out.print(" - Allocate a bunch of new pages\n"); try { firstPid = SystemDefs.JavabaseBM.newPage(pg, numPages); } catch (Exception e) { System.err.print("*** Could not allocate " + numPages); System.err.print(" new pages in the database.\n"); e.printStackTrace(); return false; } // Unpin that first page... to simplify our loop. try { SystemDefs.JavabaseBM.unpinPage(firstPid, false /*not dirty*/); } catch (Exception e) { System.err.print("*** Could not unpin the first new page.\n"); e.printStackTrace(); status = FAIL; } System.out.print(" - Write something on each one\n"); pid = new PageId(); lastPid = new PageId(); for (pid.pid = firstPid.pid, lastPid.pid = pid.pid + numPages; status == OK && pid.pid < lastPid.pid; pid.pid = pid.pid + 1) { try { SystemDefs.JavabaseBM.pinPage(pid, pg, /*emptyPage:*/ true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not pin new page " + pid.pid + "\n"); e.printStackTrace(); } if (status == OK) { // Copy the page number + 99999 onto each page. It seems // unlikely that this bit pattern would show up there by // coincidence. int data = pid.pid + 99999; try { Convert.setIntValue(data, 0, pg.getpage()); } catch (IOException e) { System.err.print("*** Convert value failed\n"); status = FAIL; } if (status == OK) { try { SystemDefs.JavabaseBM.unpinPage(pid, /*dirty:*/ true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin dirty page " + pid.pid + "\n"); e.printStackTrace(); } } } } if (status == OK) System.out.print( " - Read that something back from each one\n" + " (because we're buffering, this is where " + "most of the writes happen)\n"); for (pid.pid = firstPid.pid; status == OK && pid.pid < lastPid.pid; pid.pid = pid.pid + 1) { try { SystemDefs.JavabaseBM.pinPage(pid, pg, /*emptyPage:*/ false); } catch (Exception e) { status = FAIL; System.err.print("*** Could not pin page " + pid.pid + "\n"); e.printStackTrace(); } if (status == OK) { int data = 0; try { data = Convert.getIntValue(0, pg.getpage()); } catch (IOException e) { System.err.print("*** Convert value failed \n"); status = FAIL; } if (status == OK) { if (data != (pid.pid) + 99999) { status = FAIL; System.err.print("*** Read wrong data back from page " + pid.pid + "\n"); } } if (status == OK) { try { SystemDefs.JavabaseBM.unpinPage(pid, /*dirty:*/ true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin page " + pid.pid + "\n"); e.printStackTrace(); } } } } if (status == OK) System.out.print(" - Free the pages again\n"); for (pid.pid = firstPid.pid; pid.pid < lastPid.pid; pid.pid = pid.pid + 1) { try { SystemDefs.JavabaseBM.freePage(pid); } catch (Exception e) { status = FAIL; System.err.print("*** Error freeing page " + pid.pid + "\n"); e.printStackTrace(); } } if (status == OK) System.out.print(" Test 1 completed successfully.\n"); return status; }
public void open() throws DbException, TransactionAbortedException, IOException { _currentPage = readPage(_currentPageId++); _pagesRead++; _tupleIterator = _currentPage.iterator(); }
/** * overrides the test4 function in TestDriver * * @return whether test4 has passed */ protected boolean test4() { System.out.print("\n Test 4 exercises some of the internals " + "of the buffer manager\n"); int index; int numPages = NUMBUF + 10; Page pg = new Page(); PageId pid = new PageId(); PageId[] pids = new PageId[numPages]; boolean status = OK; System.out.print(" - Allocate bunch of pages together \n"); for (int i = 0; i < numPages / NUMBUF; i++) { for (index = i * NUMBUF; status == OK && index < (i + 1) * NUMBUF; ++index) { pg = new Page(); try { pid = SystemDefs.JavabaseBM.newPage(pg, 1); } catch (Exception e) { status = FAIL; System.err.print("*** Could not allocate new page number " + index + 1 + "\n"); e.printStackTrace(); } if (status == OK) { pids[index] = pid; } if (status == OK) { // Copy the page number + 99999 onto each page. It seems // unlikely that this bit pattern would show up there by // coincidence. int data = pid.pid + 99999; try { Convert.setIntValue(data, 0, pg.getpage()); } catch (IOException e) { System.err.print("*** Convert value failed\n"); status = FAIL; e.printStackTrace(); } } } for (index = i * NUMBUF; status == OK && index < (i + 1) * NUMBUF; ++index) { try { SystemDefs.JavabaseBM.unpinPage(pids[index], true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin page " + pids[index].pid + "\n"); e.printStackTrace(); } } } if (status == OK) { System.out.print(" - Read the pages\n"); for (int i = 0; i < numPages / NUMBUF; i++) { for (index = i * NUMBUF; status == OK && index < (i + 1) * NUMBUF; ++index) { pg = new Page(); pid = pids[index]; try { SystemDefs.JavabaseBM.pinPage(pid, pg, false); } catch (Exception e) { status = FAIL; System.err.print("*** Could not pin page " + pid.pid + "\n"); e.printStackTrace(); } if (status == OK) { int data = 0; try { data = Convert.getIntValue(0, pg.getpage()); } catch (IOException e) { System.err.print("*** Convert value failed \n"); status = FAIL; } if (data != pid.pid + 99999) { status = FAIL; System.err.print("*** Read wrong data back from page " + pid.pid + "\n"); } } } for (index = i * NUMBUF; status == OK && index < (i + 1) * NUMBUF; ++index) { try { SystemDefs.JavabaseBM.unpinPage(pids[index], true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin page " + pids[index].pid + "\n"); e.printStackTrace(); } } } } if (status == OK) { System.out.print(" Test 4 completed successfully.\n"); } return status; }
/** @param el */ public BookImage(Books el, String user) { super(); this.Book = el; this.setStyleName("cells"); this.setHeight("250px"); this.setWidth("200px"); rating.setAnimated(true); rating.setCaption(null); rating.setMaxValue(5); rating.setStyleName("rating"); rating.setReadOnly(true); rating_my.setAnimated(true); rating_my.setCaption(null); rating_my.setMaxValue(5); rating_my.setStyleName("rating_my"); IRaitingService iRaitingService = new IRaitingService(); try { double rate = iRaitingService.getRaiting(el.getId()); rating.setReadOnly(false); rating.setValue(rate); rating.setReadOnly(true); double myrate = iRaitingService.getRaiting(user, el.getId()); rating_my.setValue(myrate); } catch (SQLException e) { e.printStackTrace(); } rating_my.addValueChangeListener( e -> { try { Rating rat = iRaitingService.getUser( getUI().getSession().getAttribute("user").toString(), el.getId()); rat.setRaiting(rating_my.getValue()); iRaitingService.update(rat); double rate = iRaitingService.getRaiting(el.getId()); rating.setReadOnly(false); rating.setValue(rate); rating.setReadOnly(true); new Notification(String.valueOf(rate), Notification.Type.TRAY_NOTIFICATION) .show(Page.getCurrent()); } catch (SQLException e1) { e1.printStackTrace(); } }); rating_layout.addComponent(rating); rating_layout.addComponent(rating_my); rating_layout.setComponentAlignment(rating, Alignment.MIDDLE_LEFT); rating_layout.setComponentAlignment(rating_my, Alignment.MIDDLE_LEFT); rating_layout.setStyleName("ratinglayout"); imageEmbedded.setSource(new FileResource(new File(Book.getImage()))); title.setValue(Book.getTitle()); author.setValue(Book.getAuthor()); if (Book.getFile().isEmpty()) buttonDownload.setEnabled(false); buttonDownload.setWidth("80%"); imageEmbedded.setWidth("100%"); imageEmbedded.setHeight("100%"); title.setWidth(null); author.setWidth(null); VerticalLayout bodyLayout = new VerticalLayout(title, author, imageEmbedded); bodyLayout.setExpandRatio(title, 12); bodyLayout.setExpandRatio(author, 8); bodyLayout.setExpandRatio(imageEmbedded, 80); bodyLayout.setSizeFull(); bodyLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER); bodyLayout.setComponentAlignment(author, Alignment.MIDDLE_CENTER); bodyLayout.setComponentAlignment(imageEmbedded, Alignment.MIDDLE_CENTER); buttonDownload.setStyleName("super-button"); title.setStyleName("name-label"); author.setStyleName("author-label"); this.addComponent(rating_layout); this.addComponent(bodyLayout); this.addComponent(buttonDownload); this.setComponentAlignment(rating_layout, Alignment.TOP_CENTER); this.setComponentAlignment(bodyLayout, Alignment.TOP_CENTER); this.setComponentAlignment(buttonDownload, Alignment.BOTTOM_CENTER); this.setExpandRatio(rating_layout, 5); this.setExpandRatio(bodyLayout, 85); this.setExpandRatio(buttonDownload, 10); StreamResource sr = getStream(); FileDownloader fileDownloader = new FileDownloader(sr); fileDownloader.extend(buttonDownload); bodyLayout.addLayoutClickListener( e -> { BookWin win = new BookWin(this.Book); UI.getCurrent().addWindow(win); }); }
@Override public int pcmSeek(final long pos) { if (!this.m_vorbisStream.isSeekable()) { return -1; } long total = this.pcmTotal(-1); if (pos < 0L || pos > total) { this.m_pcmOffset = -1L; this.decodeClear(); return -1; } int link; for (link = this.m_links - 1; link >= 0; --link) { total -= this.m_pcmLengths[link]; if (pos >= total) { break; } } final long target = pos - total; long end = this.m_offsets[link + 1]; long begin = this.m_offsets[link]; int best = (int) begin; final Page page = new Page(); while (begin < end) { long bisect; if (end - begin < this.m_chunkSize) { bisect = begin; } else { bisect = (end + begin) / 2L; } this.seekHelper(bisect); final int ret = this.getNextPage(page, end - bisect); if (ret == -1) { end = bisect; } else { final long granulepos = page.granulepos(); if (granulepos < target) { best = ret; begin = this.m_offset; } else { end = bisect; } } } if (this.rawSeek(best) != 0) { this.m_pcmOffset = -1L; this.decodeClear(); return -1; } if (this.m_pcmOffset >= pos) { this.m_pcmOffset = -1L; this.decodeClear(); return -1; } if (pos > this.pcmTotal(-1)) { this.m_pcmOffset = -1L; this.decodeClear(); return -1; } while (this.m_pcmOffset < pos) { final int target2 = (int) (pos - this.m_pcmOffset); final int[] _index = new int[this.m_info[this.m_currentLink].channelsCount]; int samples = this.m_dspState.synthesis_pcmout(this.m_pcmf_buffer, _index); if (samples > target2) { samples = target2; } this.m_dspState.synthesis_read(samples); this.m_pcmOffset += samples; if (samples < target2 && this.processPacket(true) == 0) { this.m_pcmOffset = this.pcmTotal(-1); } } return 0; }
@Override public void execute() { if (USE_OMETA) { try { exportWithOmeta(); } catch (Exception e) { e.printStackTrace(); } return; } try { File dir = new File("/Users/josh/projects/Leo/t2"); File html = new File(dir, "foo.html"); File templatedir = new File("resources/"); if (useRandomFile) { } else { // get a file to write to if (document.getExportFile() != null) { html = document.getExportFile(); dir = html.getParentFile(); } else { java.awt.FileDialog fd = new java.awt.FileDialog((Frame) null); fd.setMode(FileDialog.SAVE); fd.setVisible(true); if (fd.getFile() == null) { return; } String filename = fd.getFile(); if (!filename.toLowerCase().endsWith(".html")) { filename += ".html"; } html = new File(fd.getDirectory(), filename); dir = html.getParentFile(); } } // File file = File.createTempFile("foo",".html"); // file.deleteOnExit(); StringWriter treeContent = new StringWriter(); PrintWriter treeOut = new PrintWriter(treeContent); PropWriter treeWriter = new PropWriter(treeOut); StringWriter setupContent = new StringWriter(); for (Layer layer : page.children()) { treeWriter.p("//layer"); treeWriter.indent(); for (SketchNode node : layer.children()) { DynamicNode dnode = (DynamicNode) node; exportNode(treeWriter, dnode, true, dir); if (node.isVisual() && AminoAdapter.shouldAddToScene(node, document.getBindings())) { setupContent.append("root.add(" + node.getId() + ");\n"); } if (AminoAdapter.useSetup(dnode)) { setupContent.append(node.getId() + ".setup(root);\n"); } doExtensions(setupContent, dnode); } treeWriter.outdent(); } for (Binding binding : document.getBindings()) { exportBinding(new PrintWriter(setupContent), binding); } treeOut.close(); setupContent.close(); Map<String, String> subs = new HashMap<String, String>(); subs.put("tree", treeContent.toString()); subs.put("setup", setupContent.toString()); if (!html.exists()) { StringUtils.applyTemplate(new File(templatedir, "index_template.html"), html, subs); } File js = new File(dir, "generated.js"); StringUtils.applyTemplate(new File(templatedir, "generated_template.js"), js, subs); StringUtils.copyFile(new File(templatedir, "amino.js"), new File(dir, "amino.js")); StringUtils.copyFile(new File(templatedir, "jquery.js"), new File(dir, "jquery.js")); StringUtils.copyFile(new File(templatedir, "controls.js"), new File(dir, "controls.js")); File trimfile = new File("/Users/josh/"); String partialPath = dir.getAbsolutePath().substring((int) trimfile.getAbsolutePath().length()); OSUtil.openBrowser("http://localhost/~josh/" + partialPath + "/" + html.getName()); document.setExportFile(html); } catch (Exception e) { e.printStackTrace(); } }
/** * overrides the test3 function in TestDriver. It exercises some of the internal of the buffer * manager * * @return whether test3 has passed */ protected boolean test3() { System.out.print("\n Test 3 exercises some of the internals " + "of the buffer manager\n"); int index; int numPages = NUMBUF + 10; Page pg = new Page(); PageId pid = new PageId(); PageId[] pids = new PageId[numPages]; boolean status = OK; System.out.print( " - Allocate and dirty some new pages, one at " + "a time, and leave some pinned\n"); for (index = 0; status == OK && index < numPages; ++index) { try { pid = SystemDefs.JavabaseBM.newPage(pg, 1); } catch (Exception e) { status = FAIL; System.err.print("*** Could not allocate new page number " + index + 1 + "\n"); e.printStackTrace(); } if (status == OK) pids[index] = pid; if (status == OK) { // Copy the page number + 99999 onto each page. It seems // unlikely that this bit pattern would show up there by // coincidence. int data = pid.pid + 99999; try { Convert.setIntValue(data, 0, pg.getpage()); } catch (IOException e) { System.err.print("*** Convert value failed\n"); status = FAIL; e.printStackTrace(); } // Leave the page pinned if it equals 12 mod 20. This is a // random number based loosely on a bug report. if (status == OK) { if (pid.pid % 20 != 12) { try { SystemDefs.JavabaseBM.unpinPage(pid, /*dirty:*/ true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin dirty page " + pid.pid + "\n"); } } } } } if (status == OK) { System.out.print(" - Read the pages\n"); for (index = 0; status == OK && index < numPages; ++index) { pid = pids[index]; try { SystemDefs.JavabaseBM.pinPage(pid, pg, false); } catch (Exception e) { status = FAIL; System.err.print("*** Could not pin page " + pid.pid + "\n"); e.printStackTrace(); } if (status == OK) { int data = 0; try { data = Convert.getIntValue(0, pg.getpage()); } catch (IOException e) { System.err.print("*** Convert value failed \n"); status = FAIL; } if (data != pid.pid + 99999) { status = FAIL; System.err.print("*** Read wrong data back from page " + pid.pid + "\n"); } } if (status == OK) { try { SystemDefs.JavabaseBM.unpinPage(pid, true); // might not be dirty } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin page " + pid.pid + "\n"); e.printStackTrace(); } } if (status == OK && (pid.pid % 20 == 12)) { try { SystemDefs.JavabaseBM.unpinPage(pid, /*dirty:*/ true); } catch (Exception e) { status = FAIL; System.err.print("*** Could not unpin page " + pid.pid + "\n"); e.printStackTrace(); } } } } if (status == OK) System.out.print(" Test 3 completed successfully.\n"); return status; }
/** * Listener to update <code>Page</code> size if it changes. * * @param e ComponentEvent */ public void componentResized(ComponentEvent e) { pageSize = page.getSize(); }