/** * Gets the version of the Fiji instance format installed on the HBase cluster. * * <p>The instance format describes the layout of the global metadata state of * a Fiji instance.</p> * * @param fiji An open fiji instance. * @return A parsed version of the storage format protocol version string. * @throws IOException on I/O error. */ public static ProtocolVersion getClusterDataVersion(Fiji fiji) throws IOException { return getClusterDataVersion(fiji.getSystemTable()); }
/** * Validates that the client instance format version is compatible with the instance * format version installed on a Fiji instance. * Returns true if they are compatible, false otherwise. * "Compatible" versions have the same major version digit (e.g., <tt>system-1.1</tt> * and <tt>system-1.0</tt> are compatible; <tt>system-2.5</tt> and <tt>system-1.0</tt> are not). * * <p>Older instances (installed with FijiSchema 1.0.0-rc3 and prior) will use an instance * format version of <tt>fiji-1.0</tt>. This is treated as an alias for <tt>system-1.0</tt>. * No other versions associated with the <tt>"fiji"</tt> protocol are supported.</p> * * @param fiji An open fiji instance. * @throws IOException on I/O error reading the Fiji version from the system. * @return true if the installed instance format * version is compatible with this client, false otherwise. */ public static boolean isFijiVersionCompatible(Fiji fiji) throws IOException { final ProtocolVersion clientVersion = VersionInfo.getClientDataVersion(); final ProtocolVersion clusterVersion = VersionInfo.getClusterDataVersion(fiji); return areInstanceVersionsCompatible(clientVersion, clusterVersion); }
/** * Validates that the client instance format version is compatible with the instance * format version installed on a Fiji instance. * Returns true if they are compatible, false otherwise. * "Compatible" versions have the same major version digit (e.g., <tt>system-1.1</tt> * and <tt>system-1.0</tt> are compatible; <tt>system-2.5</tt> and <tt>system-1.0</tt> are not). * * <p>Older instances (installed with FijiSchema 1.0.0-rc3 and prior) will use an instance * format version of <tt>fiji-1.0</tt>. This is treated as an alias for <tt>system-1.0</tt>. * No other versions associated with the <tt>"fiji"</tt> protocol are supported.</p> * * @param systemTable An open FijiSystemTable. * @throws IOException on I/O error reading the Fiji version from the system. * @return true if the installed instance format * version is compatible with this client, false otherwise. */ private static boolean isFijiVersionCompatible(FijiSystemTable systemTable) throws IOException { final ProtocolVersion clientVersion = VersionInfo.getClientDataVersion(); final ProtocolVersion clusterVersion = VersionInfo.getClusterDataVersion(systemTable); return areInstanceVersionsCompatible(clientVersion, clusterVersion); }
/** * Validates that the client instance format version is compatible with the instance * format version installed on a Fiji instance. * Throws IncompatibleFijiVersionException if not. * * This method may be useful if a Fiji is not fully constructed, but the FijiSystemTable exists, * such as during construction of a Fiji. This method should only be used by framework-level * applications, since FijiSystemTable is a framework-level class. * * <p>For the definition of compatibility used in this method, see {@link * #isFijiVersionCompatible}</p> * * @param systemTable An open FijiSystemTable. * @throws IOException on I/O error reading the data version from the cluster, * or throws IncompatibleFijiVersionException if the installed instance format version * is incompatible with the version supported by the client. */ public static void validateVersion(FijiSystemTable systemTable) throws IOException { if (isFijiVersionCompatible(systemTable)) { return; // valid. } else { final ProtocolVersion clientVersion = VersionInfo.getClientDataVersion(); final ProtocolVersion clusterVersion = VersionInfo.getClusterDataVersion(systemTable); throw new IncompatibleFijiVersionException(String.format( "Data format of Fiji instance (%s) cannot operate with client (%s)", clusterVersion, clientVersion)); } }
/** {@inheritDoc} */ @Override protected int run(List<String> nonFlagArgs) throws Exception { final String clientSoftwareVersion = VersionInfo.getSoftwareVersion(); getPrintStream().println("fiji client software version: " + clientSoftwareVersion); final ProtocolVersion clientDataVersion = VersionInfo.getClientDataVersion(); getPrintStream().println("fiji client data version: " + clientDataVersion); final Fiji fiji = Fiji.Factory.open(mFijiURI, getConf()); try { final ProtocolVersion clusterDataVersion = VersionInfo.getClusterDataVersion(fiji); getPrintStream().println("fiji cluster data version: " + clusterDataVersion); } finally { fiji.release(); } ProtocolVersion minimumLayoutVersion = FijiTableLayout.getMinSupportedLayoutVersion(); ProtocolVersion maximumLayoutVersion = FijiTableLayout.getMaxSupportedLayoutVersion(); getPrintStream().println("layout versions supported: " + minimumLayoutVersion + " to " + maximumLayoutVersion); return SUCCESS; }