Exemplo n.º 1
0
    def __init__(self, blob_host_uri):
        """Initialize GridFS blob host.

        Args:
            blob_host_uri: MongoDB uri (mongodb://username:password@host:port/database)
        """
        BLOBHost.__init__(self, blob_host_uri)

        try:
            # connect to mongo instance
            self.client = MongoClient(
                self.blob_host_uri,
                serverSelectionTimeoutMS=CONNECTION_TIMEOUT)
            # check connection
            self.client.server_info()
            # get database name from uri
            database_name = blob_host_uri.split("/")[-1]
            # connect to database
            self.database = self.client[database_name]
            # connect to gridfs
            self.fs = gridfs.GridFS(self.database)
        except Exception as e:
            raise BLOBError(
                "Unable to create the connection to the GridFS collection: %s"
                % str(e))
Exemplo n.º 2
0
    def __init__(self, blob_host_uri, blob_host_user, blob_host_password):
        """Initializes DSpace blob host

        Args:
            blob_host_uri:
            blob_host_user:
            blob_host_password:
        """
        BLOBHost.__init__(self, blob_host_uri, blob_host_user,
                          blob_host_password)
Exemplo n.º 3
0
    def query(self, query):
        """Query the blob collection - not implemented

        Args:
            query:

        Returns:

        """
        BLOBHost.query(self)
Exemplo n.º 4
0
    def query(self, query):
        """Query the blob collection. Not yet implemented.

        Args:
            query:

        Returns:

        """
        BLOBHost.query(self, query)
Exemplo n.º 5
0
 def query(self, query):
     BLOBHost.query(self)
Exemplo n.º 6
0
 def delete(self, handle):
     BLOBHost.delete(self)
Exemplo n.º 7
0
 def save(self, blob, filename=None):
     BLOBHost.save(self)
Exemplo n.º 8
0
 def list(self):
     BLOBHost.list(self)
Exemplo n.º 9
0
 def get(self, handle):
     BLOBHost.get(self)