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))
Beispiel #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)
    def query(self, query):
        """Query the blob collection - not implemented

        Args:
            query:

        Returns:

        """
        BLOBHost.query(self)
    def query(self, query):
        """Query the blob collection. Not yet implemented.

        Args:
            query:

        Returns:

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