diff --git a/bundles/commons/src/main/java/org/jscsi/parser/login/ISID.java b/bundles/commons/src/main/java/org/jscsi/parser/login/ISID.java index aaa5b6372..9aeb11416 100644 --- a/bundles/commons/src/main/java/org/jscsi/parser/login/ISID.java +++ b/bundles/commons/src/main/java/org/jscsi/parser/login/ISID.java @@ -1,13 +1,13 @@ /** * Copyright (c) 2012, University of Konstanz, Distributed Systems Group All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the * distribution. * Neither the name of the University of Konstanz nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -147,7 +147,7 @@ * it is installed (see Section 9.1.1 Conservative Reuse of ISIDs and Section 9.1.2 iSCSI Name, ISID, and TPGT Use). The * resultant ISID MUST also be persistent over power cycles, reboot, card swap, etc. For details have a look in the * [RFC3721]. - * + * * @author Volker Wildi */ public final class ISID { @@ -186,7 +186,7 @@ private Format (final byte newValue) { /** * Returns the value of this enumeration. - * + * * @return The value of this enumeration. */ public final byte value () { @@ -196,7 +196,7 @@ public final byte value () { /** * Returns the constant defined for the given value. - * + * * @param value The value to search for. * @return The constant defined for the given value. Or null, if this value is not * defined by this enumeration. @@ -209,6 +209,7 @@ public static final Format valueOf (final byte value) { } /** Bit mask to extract the first int out from a long. */ + @SuppressWarnings("unused") private static final long FIRST_LINE_FLAG_MASK = 0xFFFFFFFF00000000L; /** Bit flag mask to get the field A in this ISID. */ @@ -247,7 +248,7 @@ public ISID () { /** * This constructor creates a new ISID object with the given settings. - * + * * @param initT The new T-Value. * @param initA The new A-Value. * @param initB The new B-Value. @@ -266,7 +267,7 @@ public ISID (final Format initT, final byte initA, final short initB, final byte /** * This method creates an Initiator Session ID of the Random format defined in the iSCSI Standard * (RFC3720). - * + * * @param seed The initialization seed for random generator. * @return A instance of an ISID. */ @@ -285,7 +286,7 @@ public static final ISID createRandom (final long seed) { /** * Serializes this ISID object ot its byte representation. - * + * * @return The byte representation of this ISID object. * @throws InternetSCSIException If any violation of the iSCSI-Standard emerge. */ @@ -300,7 +301,7 @@ public final long serialize () throws InternetSCSIException { firstLine |= a << Constants.THREE_BYTES_SHIFT; firstLine &= 0x00ffffff; firstLine |= t.value() << T_FIELD_SHIFT; - + isid = Utils.getUnsignedLong(firstLine) << Constants.FOUR_BYTES_SHIFT; isid |= Utils.getUnsignedLong(d) << Constants.TWO_BYTES_SHIFT; @@ -309,13 +310,13 @@ public final long serialize () throws InternetSCSIException { /** * Parses a given ISID in this ISID obejct. - * + * * @param isid The byte representation of a ISID to parse. * @throws InternetSCSIException If any violation of the iSCSI-Standard emerge. */ final void deserialize ( long isid) throws InternetSCSIException { int line = (int) (isid >>> Constants.FOUR_BYTES_SHIFT); - + t = Format.valueOf((byte) (line >>> T_FIELD_SHIFT)); a = (byte) ((line & A_FIELD_FLAG_MASK) >>> Constants.THREE_BYTES_SHIFT); b = (short) ((line & Constants.MIDDLE_TWO_BYTES_SHIFT) >>> Constants.ONE_BYTE_SHIFT); @@ -332,9 +333,10 @@ final void deserialize ( long isid) throws InternetSCSIException { /** * Creates a string with all fields of this ISID object. - * + * * @return The string representation. */ + @Override public final String toString () { final StringBuilder sb = new StringBuilder(Constants.LOG_INITIAL_SIZE); @@ -351,7 +353,7 @@ public final String toString () { /** * This method compares a given ISID object with this object for value equality. - * + * * @param isid The given ISID object to check. * @return True, if the values of the two ISID objects are equal. Else false. */ @@ -408,7 +410,7 @@ public final void clear () { /** * Returns the value of the field A. - * + * * @return The value of the field A. */ public final byte getA () { @@ -418,7 +420,7 @@ public final byte getA () { /** * Returns the value of the field B. - * + * * @return The value of the field B. */ public final short getB () { @@ -428,7 +430,7 @@ public final short getB () { /** * Returns the value of the field C. - * + * * @return The value of the field C. */ public final byte getC () { @@ -438,7 +440,7 @@ public final byte getC () { /** * Returns the value of the field D. - * + * * @return The value of the field D. */ public final short getD () { @@ -448,7 +450,7 @@ public final short getD () { /** * Returns the value of the field T. - * + * * @return The value of the field T. */ public final Format getT () { @@ -461,7 +463,7 @@ public final Format getT () { /** * This method checks, if all fields are valid. In these cases an exception will be thrown. - * + * * @throws InternetSCSIException If the integrity is violated. */ protected final void checkIntegrity () throws InternetSCSIException { diff --git a/bundles/commons/src/main/java/org/jscsi/parser/tmf/TaskManagementFunctionResponseParser.java b/bundles/commons/src/main/java/org/jscsi/parser/tmf/TaskManagementFunctionResponseParser.java index c8507ad38..3a031d9ff 100644 --- a/bundles/commons/src/main/java/org/jscsi/parser/tmf/TaskManagementFunctionResponseParser.java +++ b/bundles/commons/src/main/java/org/jscsi/parser/tmf/TaskManagementFunctionResponseParser.java @@ -1,13 +1,13 @@ /** * Copyright (c) 2012, University of Konstanz, Distributed Systems Group All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the * distribution. * Neither the name of the University of Konstanz nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -28,7 +28,6 @@ import org.jscsi.parser.ProtocolDataUnit; import org.jscsi.parser.TargetMessageParser; import org.jscsi.parser.datasegment.DataSegmentFactory.DataSegmentFormat; -import org.jscsi.parser.logout.LogoutResponse; import org.jscsi.utils.Utils; @@ -63,14 +62,14 @@ *

*

TotalAHSLength and DataSegmentLength

For this PDU TotalAHSLength and DataSegmentLength MUST be * 0. - * + * * @author Volker Wildi */ public final class TaskManagementFunctionResponseParser extends TargetMessageParser { /** * This enumeration defines all valid response code, which are defined in the iSCSI Standard (RFC 3720). - * + * * @author Volker Wildi */ public static enum ResponseCode { @@ -110,7 +109,7 @@ private ResponseCode (final byte newValue) { /** * Returns the value of this enumeration. - * + * * @return The value of this enumeration. */ public final byte value () { @@ -120,7 +119,7 @@ public final byte value () { /** * Returns the constant defined for the given value. - * + * * @param value The value to search for. * @return The constant defined for the given value. Or null, if this value is not * defined by this enumeration. @@ -142,7 +141,7 @@ public static final ResponseCode valueOf (final byte value) { /** * Default constructor, creates a new, empty TaskManagementFunctionResponseParser object. - * + * * @param initProtocolDataUnit The reference ProtocolDataUnit instance, which contains this * TaskManagementFunctionResponseParser subclass object. */ @@ -260,7 +259,7 @@ public final void clear () { * field in the Task Management function request is outside the valid CmdSN window, then targets must return the * "Task does not exist" response. * - * + * * @return The response code of this TaskManagementFunctionResponseParser object. */ public final ResponseCode getResponse () { diff --git a/bundles/commons/src/main/java/org/jscsi/utils/SerialArithmeticNumber.java b/bundles/commons/src/main/java/org/jscsi/utils/SerialArithmeticNumber.java index 1fc67bea6..25b900ca8 100644 --- a/bundles/commons/src/main/java/org/jscsi/utils/SerialArithmeticNumber.java +++ b/bundles/commons/src/main/java/org/jscsi/utils/SerialArithmeticNumber.java @@ -1,13 +1,13 @@ /** * Copyright (c) 2012, University of Konstanz, Distributed Systems Group All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the * distribution. * Neither the name of the University of Konstanz nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -23,7 +23,7 @@ *

* This class encapsulate the behavior of how to compare and increment a number in Serial Number Arithmetic, which is * defined in [RFC1982]. - * + * * @author Volker Wildi, University of Konstanz */ public final class SerialArithmeticNumber implements Comparable { @@ -57,7 +57,7 @@ public SerialArithmeticNumber () { /** * Constructor to create a new SerialArithmeticNumber instance, which is initialized to * startValue. - * + * * @param startValue The start value. */ public SerialArithmeticNumber (final int startValue) { @@ -72,17 +72,17 @@ public SerialArithmeticNumber (final int startValue) { /** * Same as the compareTo method only with the exception of another parameter type. - * + * * @param anotherSerialNumber The number to compare with. * @return a negative integer, zero, or a positive integer as this SerialArithmeticNumber is less than, * equal to, or greater than the given number. */ public final int compareTo (final int anotherSerialNumber) { - - return compareTo(new Integer(anotherSerialNumber)); + return compareTo(anotherSerialNumber); } /** {@inheritDoc} */ + @Override public final synchronized int compareTo (final Integer anotherSerialNumber) { long diff = serialNumber - Utils.getUnsignedLong(anotherSerialNumber.intValue()); @@ -99,7 +99,7 @@ public final synchronized int compareTo (final Integer anotherSerialNumber) { /** * Returns the current value of this SerialArithmeticNumber instance. - * + * * @return The current value of this SerialArithmeticNumber instance. */ public final synchronized int getValue () { @@ -121,7 +121,7 @@ public final synchronized void increment () { /** * Updates the value of this SerialArithmeticNumber instance to the given one. - * + * * @param newValue The new value. */ public final synchronized void setValue (final int newValue) { diff --git a/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java b/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java index 6f608afb4..fa6abb4a5 100644 --- a/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java +++ b/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java @@ -1,13 +1,13 @@ /** * Copyright (c) 2012, University of Konstanz, Distributed Systems Group All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation and/or other materials provided with the * distribution. * Neither the name of the University of Konstanz nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, @@ -61,7 +61,7 @@ *

* This class stores all informations, which are set during an iSCSI Session, Connection or are set as the default * values. Therefore, this class was implemented as a Singleton Pattern. - * + * * @author Volker Wildi, University of Konstanz */ public final class Configuration { @@ -164,7 +164,7 @@ public Configuration (final Hashtable paramGl /** * Creates a instance of a Configuration object, which is initialized with the settings from the * system-wide configuration file. - * + * * @return A Configuration instance with all settings. * @throws ConfigurationException If this operation is supported but failed for some reason. */ @@ -176,12 +176,12 @@ public static final Configuration create () throws ConfigurationException { /** * Creates a instance of a Configuration object, which is initialized with the settings from the * system-wide configuration file. - * + * * @param configSchemaFileName The file name of the schema to check the configuration file against.s * @param configFileName The file name of the configuration file to use. * @return A Configuration instance with all settings. * @throws ConfigurationException If this operation is supported but failed for some reason. - * + * */ public static final Configuration create (final File configSchemaFileName, final File configFileName) throws ConfigurationException { @@ -195,7 +195,7 @@ public static final Configuration create (final File configSchemaFileName, final /** * Returns the value of a single parameter, instead of all values. - * + * * @param targetName Name of the iSCSI Target to connect. * @param connectionID The ID of the connection to retrieve. * @param textKey The name of the parameter. @@ -225,10 +225,7 @@ public final String getSetting (final String targetName, final int connectionID, final SettingEntry se; synchronized (globalConfig) { se = globalConfig.get(textKey); - - synchronized (se) { - if (se != null) { return se.getValue(); } - } + if (se != null) { return se.getValue(); } } throw new OperationalTextKeyException("No OperationalTextKey entry found for key: " + textKey.value()); @@ -237,7 +234,7 @@ public final String getSetting (final String targetName, final int connectionID, /** * Unifies all parameters (in the right precedence) and returns one SettingsMap. Right order means: * default, then the session-wide, and finally the connection-wide valid parameters. - * + * * @param targetName Name of the iSCSI Target to connect. * @param connectionID The ID of the connection to retrieve. * @return All unified parameters in one single SettingsMap. @@ -273,7 +270,7 @@ public final SettingsMap getSettings (final String targetName, final int connect /** * Returns the value of a single parameter. It can only return session and global parameters. - * + * * @param targetName Name of the iSCSI Target to connect. * @param textKey The name of the parameter. * @return The value of the given parameter. @@ -287,7 +284,7 @@ public final String getSessionSetting (final String targetName, final Operationa /** * Returns the InetAddress instance of the connected iSCSI Target. - * + * * @param targetName The name of the iSCSI Target. * @return The InetAddress instance of the requested iSCSI Target. * @throws NoSuchSessionException if a session with this target name is not open. @@ -303,7 +300,7 @@ public final InetSocketAddress getTargetAddress (final String targetName) throws /** * Updates the stored settings of a connection with these values from the response of the iSCSI Target. - * + * * @param targetName The name of the iSCSI Target. * @param connectionID The ID of the connection within this iSCSI Target. * @param response The response settings. @@ -314,10 +311,9 @@ public final void update (final String targetName, final int connectionID, final final SessionConfiguration sc; synchronized (sessionConfigs) { sc = sessionConfigs.get(targetName); + if (sc == null) { throw new NoSuchSessionException("A session with the ID '" + targetName + "' does not exist."); } synchronized (sc) { - if (sc == null) { throw new NoSuchSessionException("A session with the ID '" + targetName + "' does not exist."); } - synchronized (response) { SettingEntry se; for (Map.Entry e : response.entrySet()) { @@ -350,7 +346,7 @@ public final void update (final String targetName, final int connectionID, final /** * Reads the given configuration file in memory and creates a DOM representation. - * + * * @throws SAXException If this operation is supported but failed for some reason. * @throws ParserConfigurationException If a DocumentBuilder cannot be created which satisfies the * configuration requested. @@ -386,7 +382,7 @@ private final Document parse (final File schemaLocation, final File configFile) /** * Parses all settings form the main configuration file. - * + * * @param root The root element of the configuration. */ private final void parseSettings (final Element root) { @@ -400,7 +396,7 @@ private final void parseSettings (final Element root) { /** * Parses all global settings form the main configuration file. - * + * * @param root The root element of the configuration. */ private final void parseGlobalSettings (final Element root) { @@ -438,7 +434,7 @@ private final void parseGlobalSettings (final Element root) { /** * Parses all target-specific settings form the main configuration file. - * + * * @param root The root element of the configuration. */ private final void parseTargetSpecificSettings (final Element root) { @@ -505,7 +501,7 @@ private final void clear () { /** * This class contains a session-wide SettingsMap with one or more connection-specific * SettingsMap. - * + * * @author Volker Wildi */ private final class SessionConfiguration { @@ -530,7 +526,7 @@ private final class SessionConfiguration { /** * Adds a session-wide parameter to this SessionConfiguration object. - * + * * @param textKey The name of the parameter to add * @param textValue The value of the parameter to add. */ @@ -542,7 +538,7 @@ final void addSessionSetting (final OperationalTextKey textKey, final String tex /** * Updates the value of the given OperationTextKey of this session with the response key * textValue and the result function. - * + * * @param textKey The OperationalTextKey to update. * @param textValue The value of the response. * @param resultFunction The IResultFunction instance to use to obtain the result. @@ -580,7 +576,7 @@ final void updateSessionSetting (final OperationalTextKey textKey, final String /** * Updates the value of the given OperationTextKey of the given connection within this session with * the response key textValue and the result function. - * + * * @param connectionID The ID of the connection. * @param textKey The OperationalTextKey to update. * @param textValue The value of the response. @@ -663,7 +659,7 @@ final void updateConnectionSetting (final int connectionID, final OperationalTex /** * Returns a single setting value of a connection (specified by the ID). - * + * * @param connectionID The ID of the connection. * @param textKey The name of the parameter. * @return the value of the given parameter of the connection. @@ -685,7 +681,7 @@ final String getSetting (final int connectionID, final OperationalTextKey textKe /** * Returns all settings of a connection (specified by the ID). - * + * * @param connectionID The ID of the connection. * @return All session-wide and connection-specific settings of the connection. */ @@ -711,7 +707,7 @@ final SettingsMap getSettings (final int connectionID) { /** * Returns the InetAddress of the leading connection of the session. - * + * * @return An InetAddress instance. */ final InetSocketAddress getInetSocketAddress () { @@ -721,7 +717,7 @@ final InetSocketAddress getInetSocketAddress () { /** * Sets the InetAddress of the leading connection to the given value. - * + * * @param newInetAddress The new InetAddress of the leading connection. * @param port The new Port of the leading connection; * @throws UnknownHostException This exception is thrown, when the host with the given InetAddress diff --git a/bundles/target/src/main/java/org/jscsi/target/Configuration.java b/bundles/target/src/main/java/org/jscsi/target/Configuration.java index baf042f36..73cf77b02 100644 --- a/bundles/target/src/main/java/org/jscsi/target/Configuration.java +++ b/bundles/target/src/main/java/org/jscsi/target/Configuration.java @@ -34,13 +34,15 @@ import org.w3c.dom.Text; import org.xml.sax.SAXException; +import com.google.common.base.Strings; + /** * Instances of {@link Configuration} provides access target-wide parameters, variables that are the same across all * sessions and connections that do not change after initialization and which play a role during text parameter * negotiation. Some of these parameters are provided or can be overridden by the content of an XML file - * jscsi-target.xml. - * + * * @author Andreas Ergenzinger, University of Konstanz */ public class Configuration { @@ -66,6 +68,7 @@ public class Configuration { public static final String ELEMENT_ALLOWSLOPPYNEGOTIATION = "AllowSloppyNegotiation"; public static final String ELEMENT_PORT = "Port"; public static final String ELEMENT_EXTERNAL_PORT = "ExternalPort"; + public static final String ELEMENT_ADDRESS = "Address"; public static final String ELEMENT_EXTERNAL_ADDRESS = "ExternalAddress"; // -------------------------------------------------------------------------- @@ -173,7 +176,7 @@ public Configuration (final String pTargetAddress) throws IOException { } private static String defaultTargetAddress(String pTargetAddress) throws UnknownHostException { - if (pTargetAddress.equals("")) { + if (Strings.isNullOrEmpty (pTargetAddress)) { return InetAddress.getLocalHost().getHostAddress(); } else { @@ -237,7 +240,19 @@ public static Configuration create (final File schemaLocation, final File config * configuration requested. * @throws IOException If any IO errors occur. */ - public static Configuration create (final InputStream schemaLocation, final InputStream configFile, final String pTargetAddress) throws SAXException , ParserConfigurationException , IOException { + public static Configuration create (final File schemaLocation, final File configFile) throws SAXException , ParserConfigurationException , IOException { + return create(new FileInputStream(schemaLocation), new FileInputStream(configFile), null); + } + + /** + * Reads the given configuration file in memory and creates a DOM representation. + * + * @throws SAXException If this operation is supported but failed for some reason. + * @throws ParserConfigurationException If a {@link DocumentBuilder} cannot be created which satisfies the + * configuration requested. + * @throws IOException If any IO errors occur. + */ + public static Configuration create (final InputStream schemaLocation, final InputStream configFile, String pTargetAddress) throws SAXException , ParserConfigurationException , IOException { final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); final Schema schema = schemaFactory.newSchema(new StreamSource(schemaLocation)); @@ -255,6 +270,14 @@ public static Configuration create (final InputStream schemaLocation, final Inpu validator.validate(source, result); Document root = (Document) result.getNode(); + // target address + if (Strings.isNullOrEmpty (pTargetAddress)) { + NodeList tagsAddress = root.getElementsByTagName(ELEMENT_ADDRESS); + if (tagsAddress.getLength() > 0) { + pTargetAddress = tagsAddress.item(0).getTextContent(); + } + } + // TargetName Configuration returnConfiguration = new Configuration(pTargetAddress); Element targetListNode = (Element) root.getElementsByTagName(ELEMENT_TARGET_LIST).item(0); diff --git a/bundles/target/src/main/java/org/jscsi/target/TargetServer.java b/bundles/target/src/main/java/org/jscsi/target/TargetServer.java index d41af596a..bbd0c94c3 100644 --- a/bundles/target/src/main/java/org/jscsi/target/TargetServer.java +++ b/bundles/target/src/main/java/org/jscsi/target/TargetServer.java @@ -28,7 +28,6 @@ import org.jscsi.parser.ProtocolDataUnit; import org.jscsi.parser.login.ISID; import org.jscsi.parser.login.LoginRequestParser; -import org.jscsi.target.connection.Connection; import org.jscsi.target.connection.Connection.TargetConnection; import org.jscsi.target.connection.TargetSession; import org.jscsi.target.scsi.inquiry.DeviceIdentificationVpdPage; @@ -96,6 +95,7 @@ public TargetServer (final Configuration conf) { // read target settings from configuration file + LOGGER.debug(" target address: " + getConfig().getTargetAddress()); LOGGER.debug(" port: " + getConfig().getPort()); LOGGER.debug(" loading targets."); // open the storage medium @@ -200,7 +200,7 @@ public static void main (String[] args) throws Exception { target.call(); } - private class ConnectionHandler implements Callable { + private class ConnectionHandler implements Callable { private final TargetConnection targetConnection; diff --git a/bundles/target/src/main/java/org/jscsi/target/storage/JCloudsStorageModule.java b/bundles/target/src/main/java/org/jscsi/target/storage/JCloudsStorageModule.java index 7bd84f3a0..e0a9c812b 100644 --- a/bundles/target/src/main/java/org/jscsi/target/storage/JCloudsStorageModule.java +++ b/bundles/target/src/main/java/org/jscsi/target/storage/JCloudsStorageModule.java @@ -1,5 +1,5 @@ /** - * + * */ package org.jscsi.target.storage; @@ -45,9 +45,9 @@ /** * JClouds-Binding to store blocks as buckets in clouds-backends. This class utilizes caching as well as multithreaded * writing to improve performance. - * + * * @author Sebastian Graf, University of Konstanz - * + * */ @Beta public class JCloudsStorageModule implements IStorageModule { @@ -114,10 +114,10 @@ public class JCloudsStorageModule implements IStorageModule { /** * Creates a new {@link JCloudsStorageModule} backed by the specified file. If no such file exists, a * {@link FileNotFoundException} will be thrown. - * + * * @param pSizeInBlocks blocksize for this module * @param pFile local storage, not used over here - * + * */ public JCloudsStorageModule (final long pSizeInBlocks, final File pFile) { // number * 512 = size in bytes @@ -273,7 +273,7 @@ private final void storeBucket (int pBucketId, byte[] pData) throws InterruptedE /** * {@inheritDoc} - * + * * @throws Exception */ @Override @@ -328,7 +328,7 @@ public int getBlockSize() { /** * Getting credentials for aws from homedir/.credentials - * + * * @return a two-dimensional String[] with login and password */ private static String[] getCredentials () { @@ -353,9 +353,9 @@ private static String[] getCredentials () { /** * Single task to write data to the cloud. - * + * * @author Sebastian Graf, University of Konstanz - * + * */ class ReadTask implements Callable> { @@ -393,7 +393,7 @@ class ReadTask implements Callable> { // + (System.currentTimeMillis() - time) + "\n"); // download.flush(); } else { - try (InputStream is = blob.getPayload().getInput()) { + try (InputStream is = blob.getPayload().openStream()) { data = ByteStreams.toByteArray(is); } // download.write(Integer.toString(mBucketId) + "," + @@ -402,7 +402,7 @@ class ReadTask implements Callable> { // download.flush(); while (data.length < SIZE_PER_BUCKET) { blob = mStore.getBlob(mContainerName, Integer.toString(mBucketId)); - try (InputStream is = blob.getPayload().getInput()) { + try (InputStream is = blob.getPayload().openStream()) { data = ByteStreams.toByteArray(is); } // // DEBUG CODE @@ -444,9 +444,9 @@ public Integer getKey () { /** * Single task to write data to the cloud. - * + * * @author Sebastian Graf, University of Konstanz - * + * */ class WriteTask implements Callable { /** @@ -504,6 +504,7 @@ public Integer call () throws Exception { class ReadFutureCleaner extends Thread { + @Override public void run () { while (true) { try { @@ -520,6 +521,7 @@ public void run () { class WriteFutureCleaner extends Thread { + @Override public void run () { while (true) { try { diff --git a/bundles/target/src/main/resources/jscsi-target.xml b/bundles/target/src/main/resources/jscsi-target.xml index ae890c70e..e8405ace1 100644 --- a/bundles/target/src/main/resources/jscsi-target.xml +++ b/bundles/target/src/main/resources/jscsi-target.xml @@ -52,6 +52,7 @@ true +

0.0.0.0
3260 diff --git a/bundles/target/src/main/resources/jscsi-target.xsd b/bundles/target/src/main/resources/jscsi-target.xsd index 83fc3fef4..7440f62e3 100644 --- a/bundles/target/src/main/resources/jscsi-target.xsd +++ b/bundles/target/src/main/resources/jscsi-target.xsd @@ -90,6 +90,8 @@ +