Package org.jscsi.exception

Examples of org.jscsi.exception.InternetSCSIException


            // message is checked correctly
            return;
        } while (false);

        throw new InternetSCSIException(exceptionMessage);
    }
View Full Code Here


            // message is checked correctly
            return;
        } while (false);

        throw new InternetSCSIException(exceptionMessage);
    }
View Full Code Here

            }
            // message is checked correctly
            return;
        } while (false);

        throw new InternetSCSIException(exceptionMessage);
    }
View Full Code Here

            // message is checked correctly
            return;

        } while (false);

        throw new InternetSCSIException(exceptionMessage);
    }
View Full Code Here

            // message is checked correctly
            return;
        } while (false);

        throw new InternetSCSIException(exceptionMessage);
    }
View Full Code Here

        final ProtocolDataUnit protocolDataUnit = protocolDataUnitFactory.create(connection.getSetting(OperationalTextKey.HEADER_DIGEST), connection.getSetting(OperationalTextKey.DATA_DIGEST));

        try {
            protocolDataUnit.read(socketChannel);
        } catch (ClosedChannelException e) {
            throw new InternetSCSIException(e);
        }

        LOGGER.debug("Receiving this PDU: " + protocolDataUnit);

        final Exception isCorrect = connection.getState().isCorrect(protocolDataUnit);
        if (isCorrect == null) {
            LOGGER.trace("Adding PDU to Receiving Queue.");

            final TargetMessageParser parser = (TargetMessageParser) protocolDataUnit.getBasicHeaderSegment().getParser();
            final Session session = connection.getSession();

            // the PDU maxCmdSN is greater than the local maxCmdSN, so we
            // have to update the local one
            if (session.getMaximumCommandSequenceNumber().compareTo(parser.getMaximumCommandSequenceNumber()) < 0) {
                session.setMaximumCommandSequenceNumber(parser.getMaximumCommandSequenceNumber());
            }

            // the PDU expCmdSN is greater than the local expCmdSN, so we
            // have to update the local one
            if (parser.incrementSequenceNumber()) {
                if (connection.getExpectedStatusSequenceNumber().compareTo(parser.getStatusSequenceNumber()) >= 0) {
                    connection.incrementExpectedStatusSequenceNumber();
                } else {
                    LOGGER.error("Status Sequence Number Mismatch (received, expected): " + parser.getStatusSequenceNumber() + ", " + (connection.getExpectedStatusSequenceNumber().getValue() - 1));
                }

            }

        } else {
            throw new InternetSCSIException(isCorrect);
        }
        return protocolDataUnit;
    }
View Full Code Here

                            LOGGER.error("Unsupported SCSI OpCode 0x" + Integer.toHexString(parser.getCDB().get(0) & 255) + " in SCSI Command PDU.");
                            stage = new UnsupportedOpCodeStage(this);
                        }

                    } else {// session is discovery session
                        throw new InternetSCSIException("received SCSI command in discovery session");
                    }
                    break; // SCSI_COMMAND

                case SCSI_TM_REQUEST :
                    stage = new TMStage(this);
View Full Code Here

            cdb = new ReadCapacity10Cdb(parser.getCDB());
        else if (opCode == ScsiOperationCode.READ_CAPACITY_16)
            cdb = new ReadCapacity16Cdb(parser.getCDB());
        else {
            // programmer error, we should not be here, close the connection
            throw new InternetSCSIException("wrong SCSI Operation Code " + opCode + " in ReadCapacityStage");
        }

        /*
         * Everything is fine, carry on. The PMI bit of the command descriptor block is ignored, since there is no way
         * to know if "substantial vendor specific delay in data transfer may be encountered" after the address in the
View Full Code Here

                    case DEVICE_IDENTIFICATION :
                        responseData = session.getTargetServer().getDeviceIdentificationVpdPage();
                        break;
                    default :
                        // The initiator must not request unsupported mode pages.
                        throw new InternetSCSIException();
                }
            }

            // send response
            sendResponse(bhs.getInitiatorTaskTag(), parser.getExpectedDataTransferLength(), responseData);
View Full Code Here

            if (protocolDataUnit.getBasicHeaderSegment().getParser() instanceof SCSIResponseParser) {
                connection.nextState(new CapacityRequestState(connection, capacityInformation, TaskAttributes.SIMPLE));
                super.stateFollowing = true;
                return;
            } else {
                throw new InternetSCSIException(protocolDataUnit.getBasicHeaderSegment().getParser().getClass().getSimpleName() + " is not the expected type of PDU.");
            }
        }

        /**
         * The server responded using the data-in-parser.
         */
        final DataInParser parser = (DataInParser) protocolDataUnit.getBasicHeaderSegment().getParser();

        capacityInformation.deserialize(protocolDataUnit.getDataSegment());

        if (!parser.isStatusFlag() || parser.getStatus() != SCSIStatus.GOOD) {
            // receive SCSI Response PDU and check status (no phase
            // collapse)
            final ProtocolDataUnit scsiPdu = connection.receive();
            if (scsiPdu.getBasicHeaderSegment().getOpCode() == OperationCode.SCSI_RESPONSE) {
                final SCSIResponseParser scsiParser = (SCSIResponseParser) scsiPdu.getBasicHeaderSegment().getParser();
                if (scsiParser.getStatus() == SCSIStatus.GOOD) return;// done
            }
            throw new InternetSCSIException("Error: Task did not finish successfully.");
        }

    }
View Full Code Here

TOP

Related Classes of org.jscsi.exception.InternetSCSIException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.