CIFSPrintQueue.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * Copyright (C) 2006-2010 Alfresco Software Limited.
  3. *
  4. * This file is part of Alfresco
  5. *
  6. * Alfresco is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Alfresco is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package org.alfresco.jlan.client;
  20. import org.alfresco.jlan.client.info.PrintJob;
  21. import org.alfresco.jlan.client.info.PrintQueueEnumerator;
  22. /**
  23. * SMB CIFS protocol print queue class
  24. *
  25. * @author gkspencer
  26. */
  27. class CIFSPrintQueue implements PrintQueueEnumerator {
  28. // Print session that this search is associated with
  29. private PrintSession m_sess;
  30. // SMB packet used for the print queue list
  31. private SMBPacket m_pkt;
  32. // Number of queue elements to return, per packet.
  33. private int m_qcnt;
  34. /**
  35. * Class constructor.
  36. *
  37. * @param sess SMBPrintSession that this queue is associated with.
  38. */
  39. protected CIFSPrintQueue(PrintSession sess) {
  40. m_sess = sess;
  41. }
  42. /**
  43. * Continue the queue search, get the next block of queue elements.
  44. *
  45. * @param stidx Starting index for the next block of elements to be returned.
  46. * @return true if more elements were returned, else false.
  47. * @exception java.io.IOException If an I/O error occurs.
  48. */
  49. protected final boolean ContinueQueueSearch(int stidx)
  50. throws java.io.IOException {
  51. return false;
  52. }
  53. /**
  54. * Return the number if queue elements in the current SMB packet.
  55. *
  56. * @return Number of queue elements in the current packet.
  57. */
  58. protected final int getNumberOfQueueElements() {
  59. return m_pkt.getParameter(0);
  60. }
  61. /**
  62. * Return the offset of the specified print queue element within the current packet.
  63. *
  64. * @param idx Index of the specified print queue element.
  65. * @return Offset of the print queue element within the packet buffer.
  66. */
  67. protected final int getPrintEntryOffset(int idx) {
  68. return 0;
  69. }
  70. /**
  71. * Return the queue list restart index.
  72. *
  73. * @return Queue list restart index.
  74. */
  75. protected final int getRestartIndex() {
  76. return m_pkt.getParameter(1);
  77. }
  78. /**
  79. * Return the next print queue entry.
  80. *
  81. * @return Next SMBPrintJob in this print queue.
  82. * @exception java.io.IOException If an I/O error occurs.
  83. */
  84. public PrintJob nextEntry()
  85. throws java.io.IOException {
  86. return null;
  87. }
  88. /**
  89. * Start a new scan of the print servers queue.
  90. *
  91. * @param idx Starting index for the first queue entry to return.
  92. * @param cnt Number of queue entries to return. A positive value indicates a forward search,
  93. * and a negative value indicates a reverse search.
  94. * @exception java.io.IOException If an I/O error occurs.
  95. */
  96. public void StartQueueSearch(int idx, int cnt)
  97. throws java.io.IOException {
  98. // Save the number of queue elements to return
  99. m_qcnt = cnt;
  100. // Start the print queue search
  101. ContinueQueueSearch(idx);
  102. }
  103. }