public boolean addMaster(File file, int resID)
    {
        if (file == null || resID == -1) {
            return false;
        }

        int fileSize = file.getSizeInByte();
        Object[] packet = new Object[2];
        packet[0] = file;
        packet[1] = myID_;

        int tag = DataGridTags.FILE_ADD_MASTER;
        super.send(super.output, 0.0, tag, new IO_data(packet,fileSize,resID));

        // wait for the result back
        tag = DataGridTags.FILE_ADD_MASTER_RESULT;
        FilterDataResult type = new FilterDataResult(file.getName(), tag);
        Sim_event ev = new Sim_event();
        super.sim_get_next(type, ev);

        boolean result = false;
        try
        {
            packet = (Object[]) ev.get_data();              // get the data
            String resName = GridSim.getEntityName(resID);  // resource name
            int msg = ((Integer) packet[2]).intValue();     // get the result
            if (msg == DataGridTags.FILE_ADD_SUCCESSFUL)
            {
                result = true;
                System.out.println(super.get_name() + ".addMaster(): " +
                        file.getName() + " has been added to " + resName);
            }
            else {
                System.out.println(super.get_name() + ".addMaster(): " +
                        "Error in adding " + file.getName() + " to " + resName);
            }
        }
        catch (Exception e)
        {
            result = false;
            System.out.println(super.get_name() + ".addMaster(): Exception");
        }

        return result;
    }