Package gettasky.storage

Source Code of gettasky.storage.StorageFactory

package gettasky.storage;

import gettasky.storage.mongodb.MongoTaskStorage;

/**
* Factory for storage objects.
* Abstracts away which underlying storage mechanism is in use.
*/
public class StorageFactory
{
    private static TaskStorage taskStorageInstance;
   
    /**
     * Return the task storage singleton instance.
     */
    public static TaskStorage getTaskStorage()
    {
        if (taskStorageInstance == null)
        {
            // Eventually the storage mechanism would be configurable, rather than hard-coded.
            taskStorageInstance = new MongoTaskStorage();
        }
        return taskStorageInstance;
    }
}
TOP

Related Classes of gettasky.storage.StorageFactory

TOP
Copyright © 2018 www.massapi.com. 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.