bda-datastore/src/main/java/gr/ntua/ece/cslab/selis/bda/datastore/beans/Recipe.java
public static void ensureStorageForSlug(String slug) 
        throws IOException, SystemConnectorException  {

        // Get the recipe storage location for this SCN.
        String storageLocationForSlug = Recipe.getStorageForSlug(slug);

        Configuration configuration = Configuration.getInstance();

        if (configuration.execEngine.getRecipeStorageType().startsWith("hdfs")) {
            // Use HDFS storage for recipes.

            HDFSConnector connector = (HDFSConnector )
                SystemConnector.getInstance().getHDFSConnector();

            org.apache.hadoop.fs.FileSystem fs = connector.getFileSystem();

            // Check if the `storageLocationForSlug` exists, if not create it.
            org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(
                storageLocationForSlug
            );

            if (!fs.exists(path)) {
                try {
                    fs.mkdirs(
                        new org.apache.hadoop.fs.Path(storageLocationForSlug)
                    );
                } catch (IOException e) {
                    e.printStackTrace();
                    throw e;
                }
            }
        } else {
            // Use local storage for recipes.

            // Check if the `storageLocationForSlug` exists, if not create it.
            File path = new File(storageLocationForSlug);
            if (!path.exists()) {
                path.mkdir();
            }
        }
    }
/**
     * Checks that the recipe storage location for a given SCN exists, if not creates it.
     *
     * Uses `Recipe.getStorageForSlug()` to get the recipe storage location for this SCN.
     * If the location does not exist creates it.
     *
     * Supports HDFS and local storage backends.
     *
     * TODO: Tests.
     *
     * @param slug The SCN's slug.
     * @throws IOException
     */
Checks that the recipe storage location for a given SCN exists, if not creates it.
Uses `Recipe.getStorageForSlug()` to get the recipe storage location for this SCN.
If the location does not exist creates it.

Supports HDFS and local storage backends.

Tests.

@param slug The SCN's slug.
Checks that the recipe storage location for a given SCN exists if not creates it . Uses ` Recipe . getStorageForSlug () ` to get the recipe storage location for this SCN . If the location does not exist creates it . Supports HDFS and local storage backends . Tests . @param slug The SCN ' s slug .
public static void ensureStorageForSlug(String slug) 
        throws IOException, SystemConnectorException  {
        String storageLocationForSlug = Recipe.getStorageForSlug(slug);
        Configuration configuration = Configuration.getInstance();
        if (configuration.execEngine.getRecipeStorageType().startsWith("hdfs")) {
            HDFSConnector connector = (HDFSConnector )
                SystemConnector.getInstance().getHDFSConnector();
            org.apache.hadoop.fs.FileSystem fs = connector.getFileSystem();
            org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(
                storageLocationForSlug
            );
            if (!fs.exists(path)) {
                try {
                    fs.mkdirs(
                        new org.apache.hadoop.fs.Path(storageLocationForSlug)
                    );
                } catch (IOException e) {
                    e.printStackTrace();
                    throw e;
                }
            }
        } else {
            File path = new File(storageLocationForSlug);
            if (!path.exists()) {
                path.mkdir();
            }
        }
    }
public static void ensureStorageForSlug ( String slug ) throws IOException , SystemConnectorException { String storageLocationForSlug = Recipe . getStorageForSlug ( slug ) ; Configuration configuration = Configuration . getInstance ( ) ; if ( configuration . execEngine . getRecipeStorageType ( ) . startsWith ( "hdfs" ) ) { HDFSConnector connector = ( HDFSConnector ) SystemConnector . getInstance ( ) . getHDFSConnector ( ) ; org . apache . hadoop . fs . FileSystem fs = connector . getFileSystem ( ) ; org . apache . hadoop . fs . Path path = new org . apache . hadoop . fs . Path ( storageLocationForSlug ) ; if ( ! fs . exists ( path ) ) { try { fs . mkdirs ( new org . apache . hadoop . fs . Path ( storageLocationForSlug ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw e ; } } } else { File path = new File ( storageLocationForSlug ) ; if ( ! path . exists ( ) ) { path . mkdir ( ) ; } } }
Checks that the recipe storage location for a given SCN exists, if not creates it.
Checks that the recipe storage location for a given SCN exists if not creates it .
// Get the recipe storage location for this SCN. // Use HDFS storage for recipes. // Check if the `storageLocationForSlug` exists, if not create it. // Use local storage for recipes. // Check if the `storageLocationForSlug` exists, if not create it.