Initiates default storage
@param $baseStorageDefaultPath
@param $baseStorageSqlPath
486071
public function init($baseStorageDefaultPath, $baseStorageSqlPath)
    {
        $storageDefaultPath = realpath($baseStorageDefaultPath);
        $contentSqlPath = realpath($baseStorageSqlPath);

        $this->initConfigStorage($storageDefaultPath);
        $this->initContentDb($contentSqlPath);

        $this->save();
    }
613273
public static function init($storePath, $autoloaderPath = null)
  {
    self::$storePath  = $storePath;

    if ($autoloaderPath === null) {
      $autoloaderPath = preg_replace('#^(.*\\'. DIRECTORY_SEPARATOR .'vendor\\'. DIRECTORY_SEPARATOR .').*$#', '$1', realpath(__DIR__)) . 'autoload.php';
    }
    if (!file_exists($autoloaderPath)) {
      throw new \Exception('Autoloader introuvable. Veuillez renseigner le chemin du fichier autoload.php en second paramètre lors de l\'appel à PublicSecuredFile::init()');
      return null;
    }

    self::$autoloaderPath = $autoloaderPath;
  }
310608
private static function init(): void
    {
        if (!static::$initialized) {
            $baseClass = Base::getInstance();
            static::$initialized = true;
            static::$backend = (string)$baseClass->Session->Backend;
            static::$savePath = $baseClass->parsePath($baseClass->Session->SavePath);
            static::$savePath = \trim(\session_save_path()) != '' ? \session_save_path() : static::$savePath;

            Directory::create(static::$savePath);
        }
    }
1287817
public static ArchivePath create(String basePath, String context) {
        return createInstance(new Class<?>[] { String.class, String.class }, new Object[] { basePath, context });
    }
310581
protected function initDefaultInitialContext()
    {

        // initialize the configuration values for the initial context
        $description = new DescriptionNode(new NodeValue('The initial context configuration.'));
        $storage = new StorageNode('AppserverIo\Storage\StackableStorage');

        // set the default initial context configuration
        $this->initialContext = new InitialContextNode('AppserverIo\Appserver\Core\InitialContext', $description, $storage);
    }
347196
public static void setBaseDirectory(@NonNull File f){
        Preconditions.checkState(f.exists() && f.isDirectory(), "Specified base directory does not exist and/or is not a directory: %s", f.getAbsolutePath());
        baseDirectory = f;
    }
632390
public function store($storagePath = '', $filename = '')
    {
        $path     = $this->getPath();
        $pathinfo = pathinfo($path);
        $data     = file_get_contents($path);

        // Use Original Filename if no specific filename is set
        if (empty($filename)) {
            $filename = $pathinfo['filename'] . '.jpg';
        }

        file_put_contents($storagePath . $filename, $data);

        $this->setLocalStoragePath($storagePath);
        $this->setLocalFilename($filename);

        return $storagePath . $filename;
    }
137714
public static function normalizeDataSource($dataSource, $basePath = null)
    {
        if (!empty($basePath) && !Utils::isHttpSource($dataSource)) {
            // TODO: support JSON pointers
            $absPath = $basePath.DIRECTORY_SEPARATOR.$dataSource;
            if (file_exists($absPath)) {
                $dataSource = $absPath;
            }
        }

        return $dataSource;
    }
301679
public static function createRoot(UrlGeneratorInterface $urlGenerator, $basePath)
    {
        $root = new static('root', $basePath);
        $root->urlGenerator = $urlGenerator;

        return $root;
    }
1308464
public function basePath(?string $basePath = null) {
        if ($basePath != null) {
            $this->basePath = $basePath;
        }
        return $this->basePath;
    }
1192098
public function requireDefaultRecords()
    {
        // Require Default Records (from parent):
        
        parent::requireDefaultRecords();
        
        // Create Default Folders:
        
        Folder::singleton()->createDefaultFolders();
        
        // Obtain App Instance:
        
        $app = self::instance();
        
        // Load Defaults:
        
        $app->loadDefaults();
        
        // Load Fixtures:
        
        $app->loadFixtures();
    }
950788
public static StoreConfig newInstance(File filePath) throws IOException {
        File homeDir;
        Properties p = new Properties();
        if(filePath.exists()) {
            if(filePath.isDirectory()) {
                homeDir = filePath;
                File propertiesFile = new File(filePath, CONFIG_PROPERTIES_FILE);
                if(propertiesFile.exists()) {
                    FileReader reader = new FileReader(propertiesFile);
                    p.load(reader);
                    reader.close();
                } else {
                    throw new FileNotFoundException(propertiesFile.toString());
                }
            } else {
                homeDir = filePath.getParentFile();
                FileReader reader = new FileReader(filePath);
                p.load(reader);
                reader.close();
            }
        } else {
            throw new FileNotFoundException(filePath.toString());
        }
        
        int initialCapacity = -1;
        String initialCapacityStr = p.getProperty(StoreParams.PARAM_INITIAL_CAPACITY);
        if(initialCapacityStr == null) {
            throw new InvalidStoreConfigException(StoreParams.PARAM_INITIAL_CAPACITY + " not found");
        } else if((initialCapacity = parseInt(StoreParams.PARAM_INITIAL_CAPACITY, initialCapacityStr, -1)) < 1) {
            throw new InvalidStoreConfigException(StoreParams.PARAM_INITIAL_CAPACITY + "=" + initialCapacityStr);
        }
        
        int partitionStart = -1;
        int partitionCount = -1;
        String partitionStartStr = p.getProperty(StoreParams.PARAM_PARTITION_START);
        String partitionCountStr = p.getProperty(StoreParams.PARAM_PARTITION_COUNT);
        if(partitionStartStr != null && partitionCountStr != null) {
            if((partitionStart = parseInt(StoreParams.PARAM_PARTITION_START, partitionStartStr, -1)) < 0) {
                throw new InvalidStoreConfigException(StoreParams.PARAM_PARTITION_START + "=" + partitionStartStr);
            }
            
            if((partitionCount = parseInt(StoreParams.PARAM_PARTITION_COUNT, partitionCountStr, -1)) < 1) {
                throw new InvalidStoreConfigException(StoreParams.PARAM_PARTITION_COUNT + "=" + partitionCountStr);
            }
        } else {
            return new StoreConfig(homeDir, initialCapacity);
        }
        
        return new StorePartitionConfig(homeDir, partitionStart, partitionCount);
    }
537710
public function getBasedir()
    {
        if ($this->basedir === null) {
            try { // try to set it
                $this->setBasedir(".");
            } catch (BuildException $exc) {
                throw new BuildException("Can not set default basedir. " . $exc->getMessage());
            }
        }

        return $this->basedir;
    }
193679
public function basePath($basePath = null)
    {
        if (null === $basePath) {
            return $this->basePath;
        }

        $this->basePath = $basePath;
        return $this;
    }
132434
private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
    {
        if ($basePath && $baseUrls) {
            throw new \LogicException('An asset package cannot have base URLs and base paths.');
        }

        $package = new ChildDefinition($baseUrls ? 'assets.url_package' : 'assets.path_package');
        $package
            ->setPublic(false)
            ->replaceArgument(0, $baseUrls ?: $basePath)
            ->replaceArgument(1, $version)
        ;

        return $package;
    }
1165659
public function initializeObject()
    {
        if (!is_writable($this->path)) {
            Files::createDirectoryRecursively($this->path);
        }
        if (!is_dir($this->path) && !is_link($this->path)) {
            throw new StorageException('The directory "' . $this->path . '" which was configured as a resource storage does not exist.', 1361533189);
        }
        if (!is_writable($this->path)) {
            throw new StorageException('The directory "' . $this->path . '" which was configured as a resource storage is not writable.', 1361533190);
        }
    }
81476
private function registerDirectory($basePath, $prefix = '') {
		$basePath = str_replace('\\', '/', $basePath);
		$basePath = rtrim($basePath, '/') . '/';
		$prefix = ($prefix ? $prefix . '_' : '' );
		$files = scandir($basePath);
		foreach ($files as $file) {
			if ($file[0] == '.') {
				continue;
			}
			$path = $basePath . $file;
			if (is_dir($path)) {
				$this->registerDirectory($path, $prefix . pathinfo($path, PATHINFO_FILENAME));
			} elseif (strtolower(pathinfo($path, PATHINFO_EXTENSION)) == 'php') {
				$name = $prefix . pathinfo($path, PATHINFO_FILENAME);
				$this->classMap[$name] = $path;
				$name = str_replace('_', '\\', $name); // register again in case it was namespaced
				$this->classMap[$name] = $path;
			}
		}
	}