def set_data(self, data=None):
def has_secondary_storage():<EOL><INDENT>return '<STR_LIT>' in self._config_map<EOL><DEDENT>extension = data.name.split('<STR_LIT:.>')[-<NUM_LIT:1>]<EOL>data_store_path = self._config_map['<STR_LIT>']<EOL>if has_secondary_storage():<EOL><INDENT>secondary_data_store_path = self._config_map['<STR_LIT>']<EOL><DEDENT>if '<STR_LIT>' in self._my_map:<EOL><INDENT>filename = self._my_map['<STR_LIT>']<EOL>if str(self._my_map['<STR_LIT>']) not in self._my_map['<STR_LIT:url>']:<EOL><INDENT>os.remove(self._my_map['<STR_LIT:url>'])<EOL>if has_secondary_storage():<EOL><INDENT>old_path = '<STR_LIT>'.format(data_store_path)<EOL>secondary_file_location = self._my_map['<STR_LIT:url>'].replace(old_path,<EOL>secondary_data_store_path)<EOL>os.remove(secondary_file_location)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>filename = ObjectId()<EOL><DEDENT>filesystem_location = '<STR_LIT>'.format(data_store_path)<EOL>if not os.path.isdir(filesystem_location):<EOL><INDENT>os.makedirs(filesystem_location)<EOL><DEDENT>file_location = '<STR_LIT>'.format(filesystem_location,<EOL>str(filename),<EOL>extension)<EOL>data.seek(<NUM_LIT:0>)<EOL>with open(file_location, '<STR_LIT:wb>') as file_handle:<EOL><INDENT>file_handle.write(data.read())<EOL><DEDENT>self._payload.set_url(file_location)<EOL>if has_secondary_storage():<EOL><INDENT>data.seek(<NUM_LIT:0>)<EOL>if not os.path.isdir(secondary_data_store_path):<EOL><INDENT>os.makedirs(secondary_data_store_path)<EOL><DEDENT>file_location = '<STR_LIT>'.format(secondary_data_store_path,<EOL>str(filename),<EOL>extension)<EOL>with open(file_location, '<STR_LIT:wb>') as file_handle:<EOL><INDENT>file_handle.write(data.read())<EOL><DEDENT><DEDENT>
Sets the content data.

        arg:    data (osid.transport.DataInputStream): the content data
        raise:  InvalidArgument - ``data`` is invalid
        raise:  NoAccess - ``Metadata.isReadOnly()`` is ``true``
        raise:  NullArgument - ``data`` is ``null``
        *compliance: mandatory -- This method must be implemented.*