private void init() throws Exception
    {
        // If this resource doesn't have any PEs then no useful at all
        if (resource_.getNumPE() == 0)
        {
            throw new Exception(super.get_name() + " : Error - this entity " +
                    "has no PEs. Therefore, can't process any Gridlets.");
        }

        // stores id of this class
        resource_.setResourceID( super.get_id() );

        // if internal allocation policy is used
        policyType_ = resource_.getResourceAllocationPolicy();
        if (policy_ == null)
        {
            switch (policyType_)
            {
                case ResourceCharacteristics.TIME_SHARED:
                    policy_ = new TimeSharedWithFailure(super.get_name(), "TimeShared");
                    break;

                case ResourceCharacteristics.SPACE_SHARED:
                    policy_ = new SpaceSharedWithFailure(super.get_name(), "SpaceShared");
                    break;

                default:
                    throw new Exception(super.get_name()+" : Error - supports"+
                            " only TimeShared or SpaceShared policy.");
            }
        }

        policy_.init(resource_, resCalendar_, super.output);
        record_ = false;
    }