Exemple #1
0
MethodResponse
   Dispatcher::system_methodHelp(const MethodCall &calldata,
                                 const Dispatcher *disp)
{
  ULXR_TRACE("system_methodHelp");
  if (calldata.numParams() != 1)
    throw ParameterException(InvalidMethodParameterError,
                             "Exactly 1 parameter allowed for \"system.methodHelp\"");

  if (calldata.getParam(0).getType() != RpcStrType)
    throw ParameterException(InvalidMethodParameterError,
                             "Parameter 1 not of type \"String\" \"system.listMethods\"");

  RpcString vs = calldata.getParam(0);
  std::string name = vs.getString();
  std::string s;

  MethodCallMap::const_iterator it;
  std::string s_prev;
  for (it = disp->methodcalls.begin(); it != disp->methodcalls.end(); ++it)
    if (name == (*it).first.method_name && (*it).first.documentation.length() != 0)
    {
      if (   s_prev != (*it).first.documentation
          && (*it).first.documentation.length() != 0)
      {
        if (s.length() != 0)
          s = "* " +s + "\n* ";
        s += (*it).first.documentation;
      }
      s_prev = (*it).first.documentation;
    }

  return MethodResponse (RpcString(s));
}
Exemple #2
0
//---------------------------------------------------------------------------
void ObjectPropertyWrapper::SetupWrapper()
{
   wxString type, owner, depobj;
   GmatStringUtil::ParseParameter(description, type, owner, depobj);
   
   #ifdef DEBUG_OPW
   MessageInterface::ShowMessage
      (wxT("In ObjPropWrapper::SetupWrapper, desc='%s'\n   owner='%s', depobj='%s', ")
       wxT("type='%s'\n"), description.c_str(), owner.c_str(), depobj.c_str(), type.c_str());
   #endif
   //if (depobj != wxT(""))
   //{
   //   throw ParameterException(
   //   wxT("Dependent objects not yet supported for the object property wrapper \"") +
   //   description + wxT("\".\n"));
   //   /// @todo Handle object properties that use dependent objects here
   //}   
   if (owner == wxT(""))
   {
      throw ParameterException(
      wxT("Owner object name is empty for the object property wrapper \"") +
      description + wxT("\".\n"));
   }
   if (type == wxT(""))
   {
      throw ParameterException(
      wxT("Property ID string is empty for the object property wrapper \"") +
      description + wxT("\".\n"));
   }
   refObjectNames.push_back(owner);
   propIDNames.push_back(type);   
   ownedObjName = depobj;
}
Exemple #3
0
//---------------------------------------------------------------------------
Real ObjectPropertyWrapper::EvaluateReal() const
{
   if (object == NULL)
      throw ParameterException(
      wxT("Cannot return value of ObjectProperty - object pointer is NULL\n"));
   Real itsValue;
   try
   {
      itsValue = object->GetRealParameter(propID);
      #ifdef DEBUG_OPW
         MessageInterface::ShowMessage(
         wxT("In ObjPropWrapper::EvaluateReal, value = %.12f\n"), itsValue);
      #endif
   }
   catch (BaseException &be)
   {
      wxString errmsg;
//      errmsg << wxT("Cannot return Real value for id \"") << propID;
//      errmsg << wxT("\" for object \"") << object->GetName();
//      errmsg << wxT("\" - exception thrown: ")<< be.GetFullMessage() << std::endl;
      errmsg << be.GetFullMessage() << wxT("\n");
      throw ParameterException(errmsg);
  }
   
   return itsValue;
}
Exemple #4
0
MethodResponse
   Dispatcher::system_listMethods(const MethodCall &calldata,
                                  const Dispatcher *disp)
{
  ULXR_TRACE("system_listMethods");
  if (calldata.numParams() > 1)
    throw ParameterException(InvalidMethodParameterError,
                             "At most 1 parameter allowed for \"system.listMethods\"");

  if (   calldata.numParams() == 1
      && calldata.getParam(0).getType() != RpcStrType)
    throw ParameterException(InvalidMethodParameterError,
                             "Parameter 1 not of type \"String\" \"system.listMethods\"");

// FIXME: what to do with param 1 if present ??

  Array arr;
  std::string m_prev;

  MethodCallMap::const_iterator it;
  for (it = disp->methodcalls.begin(); it != disp->methodcalls.end(); ++it)
    if (   m_prev != (*it).first.method_name
        && (*it).first.method_name.length() != 0)
    {
      arr.addItem(RpcString((*it).first.method_name));
      m_prev = (*it).first.method_name;
    }
  return MethodResponse (arr);
}
Exemple #5
0
//---------------------------------------------------------------------------
bool ObjectPropertyWrapper::SetReal(const Real toValue)
{
   if (object == NULL)
      throw ParameterException(
      wxT("Cannot set value of ObjectProperty - object pointer is NULL\n"));

   try
   {
      #ifdef DEBUG_OPW
         MessageInterface::ShowMessage(
         wxT("In ObjPropWrapper::SetReal, about to set value to %.12f\n"), toValue);
      #endif
      object->SetRealParameter(propID, toValue);
      #ifdef DEBUG_OPW
         MessageInterface::ShowMessage(
         wxT("In ObjPropWrapper::SetReal, value has been set to %.12f\n"), toValue);
      #endif
   }
   catch (BaseException &be)
   {
      #ifdef DEBUG_OPW
         MessageInterface::ShowMessage(
         wxT("   exception thrown!  msg = %s\n"), (be.GetFullMessage()).c_str());
      #endif
      wxString errmsg;
//      errmsg << wxT("Cannot set Real value for id \"") << propID;
//      errmsg << wxT("\" for object \"") << object->GetName();
//      errmsg << wxT("\" - exception thrown: ")<< be.GetFullMessage() << std::endl;
      errmsg << be.GetFullMessage() << wxT("\n");
      throw ParameterException(errmsg);
   }
   
   return true;
}
Exemple #6
0
//------------------------------------------------------------------------------
// void SetRvector(Integer item, const Rvector &value)
//------------------------------------------------------------------------------
void AttitudeData::SetRvector(Integer item, const Rvector &value)
{
   #ifdef DEBUG_SET_RVECTOR
   MessageInterface::ShowMessage
      ("AttitudeData::SetRvector() entered, item = %d, value = '%s'\n",
       item, value.c_str());
   #endif
   
   if (mSpacecraft == NULL)
      InitializeRefObjects();
   
   Attitude *attitude = (Attitude*)mSpacecraft->GetRefObject(Gmat::ATTITUDE, "");
   if (attitude == NULL)
      throw ParameterException
         ("AttitudeData::SetRvector() Attitude of the Spacecraft \"" +
          mSpacecraft->GetName() + "\" is NULL\n");
   
   switch (item)
   {
   case QUATERNION:
      attitude->SetRvectorParameter("Quaternion", value);
      break;
   default:
      // otherwise, there is an error   
      throw ParameterException
         ("AttitudeData::SetString() Unknown item id: " +
          GmatRealUtil::ToString(item));
   }
}
Exemple #7
0
//------------------------------------------------------------------------------
Real Variable::EvaluateReal()
{
   #ifdef DEBUG_VARIABLE_EVAL
   MessageInterface::ShowMessage
      (wxT("Variable::EvaluateReal() this=<%p>'%s', mExpr=%s, mIsNumber=%d\n"),
       this, GetName().c_str(), mExpr.c_str(), mIsNumber);
   #endif
   
   if (mIsNumber)
   {      
      #ifdef DEBUG_VARIABLE_EVAL
      MessageInterface::ShowMessage
         (wxT("Variable::EvaluateReal() Returning just a number: mRealValue=%f\n"),
          mRealValue);
      #endif
      
      return mRealValue;
   }
   else
   {
      //=======================================================
      #ifdef __ALLOW_SIMPLE_VAR_EXP__
      //=======================================================
      try
      {         
         // Evaluate the expression
         mRealValue = mExpParser->EvalExp(mExpr.c_str());
         
         #ifdef DEBUG_VARIABLE_EVAL
         MessageInterface::ShowMessage
            (wxT("Variable::EvaluateReal() Returning expression evaluation: ")
             wxT("mRealValue=%f\n"), mRealValue);
         #endif
         
         return mRealValue;
      }
      catch (BaseException &e)
      {
         throw ParameterException
            (e.GetFullMessage() + wxT(" for the Variable \"") + GetName() + wxT("\""));
      }
      //=======================================================
      #endif
      //=======================================================
   }

   // If you get here, the evaluation failed
   throw ParameterException(wxT("Variable::EvaluateReal() failed for the Variable \"") + 
      GetName() + wxT("\""));
}
Exemple #8
0
//------------------------------------------------------------------------------
Integer Array::SetIntegerParameter(const Integer id, const Integer value)
{
   switch (id)
   {
   case NUM_ROWS:
      if (value > MAX_ROWS)
      {
         std::stringstream errmsg("");
         errmsg << "Row value for Array " << instanceName << " is too large.  Arrays are currently limited to ";
         errmsg << MAX_ROWS << " rows." << std::endl;
         throw ParameterException(errmsg.str());
      }
      if (mNumRows == 0)
         mNumRows = value;
      else
         throw ParameterException("Row has already been set for " + GetName());

      if (mNumCols > 0 && !mSizeSet)
      {
         mRmatValue.SetSize(mNumRows, mNumCols);
         mSizeSet = true;
      }
      return value;
   case NUM_COLS:
      if (value > MAX_COLS)
      {
         std::stringstream errmsg("");
         errmsg << "Column value for Array " << instanceName << " is too large.  Arrays are currently limited to ";
         errmsg << MAX_COLS << " columns." << std::endl;
         throw ParameterException(errmsg.str());
      }
      if (mNumCols == 0)
         mNumCols = value;
      else
         throw ParameterException("Column has already been set for " + GetName());
      
      if (mNumRows > 0 && !mSizeSet)
      {
         mRmatValue.SetSize(mNumRows, mNumCols);
         mSizeSet = true;
      }
      return value;
   case INITIAL_VALUE_TYPE:
      mInitialValueType = value;
      return value;
   default:
      return Parameter::SetIntegerParameter(id, value);
   }
}
ResultStatus SessionInfoCube::setCellValue(PServer server, PDatabase db, PCubeArea cellPath, CellValue value, PLockedCells lockedCells, PUser user, boost::shared_ptr<PaloSession> session, bool checkArea, bool addValue, SplashMode splashMode, bool bWriteToJournal, User::RightSetting* checkRights, set<PCube> &changedCubes, bool possibleCommit, CubeArea::CellType ct)
{
	if (User::checkUser(user) && user->getRoleRight(User::sysOpRight) < RIGHT_DELETE) {
		throw ParameterException(ErrorException::ERROR_NOT_AUTHORIZED, "insufficient access rights to terminate session!", "user", user ? (int)user->getId() : 0);
	}
	if (value.isString()) {
		ResultStatus result = RESULT_FAILED;
		WriteLocker paloSessionLock(&PaloSession::m_main_Lock);
		IdentifiersType key = *cellPath->pathBegin();
		// find session
		map<IdentifierType, boost::shared_ptr<PaloSession> >::iterator sessionIt = PaloSession::sessionIds.find(key[0]);
		if (sessionIt != PaloSession::sessionIds.end()) {
			string command = value;
			if (command == string("close")) {
				boost::shared_ptr<PaloSession> session = sessionIt->second;
				if (session->isWorker()) {
					session->command = "Invalid command:\""+command+"\"\nSVS session can't be closed";
					throw ErrorException(ErrorException::ERROR_NOT_AUTHORIZED, "SVS session can't be closed");
				}
				session->command = command;
				// terminate all session jobs
				WriteLocker wl(&sessionIt->second->thisLock);
				for (set<const PaloJob *>::iterator jit = sessionIt->second->activeJobs.begin(); jit != sessionIt->second->activeJobs.end(); ++jit) {
					if (*jit) {
						Context *jobContext = const_cast<Context *>((*jit)->getContext());
						if (jobContext) {
							jobContext->stop();
						}
					}
				}
				PaloSession::deleteSession(session, true);
			} else {
#ifdef _DEBUG
				session->command = "Invalid command:\""+command+"\"\nCommands: close - close this session";
#endif
				Logger::warning << "Invalid session command. User: "******"System") << " Command: '" << command << "'" << endl;
				throw ParameterException(ErrorException::ERROR_INVALID_COMMAND, "Invalid command received", "value", command);
			}
			Logger::info << "Session command accepted. User: "******"System") << " Command: '" << command << "'" << endl;
			result = RESULT_OK;
		} else {
			throw ParameterException(ErrorException::ERROR_ELEMENT_NOT_FOUND, "session element not found", "element", key[0]);
		}
		return result;
	} else {
		throw ParameterException(ErrorException::ERROR_NOT_AUTHORIZED, "session info cube cannot be modified", "user", user ? (int)user->getId() : 0);
	}
}
Exemple #10
0
void RightsDimension::checkElementAccessRight(const User *user, CPDatabase db, RightsType minimumRight) const
{
	RightsType rt = getElementAccessRight(user, db);
	if (rt < minimumRight && (getDimensionType() != Dimension::CONFIG || minimumRight > RIGHT_READ)) {
		throw ParameterException(ErrorException::ERROR_NOT_AUTHORIZED, "insufficient access rights", "user", (int)user->getId());
	}
}
Exemple #11
0
LegacyRule::LegacyRule(PEngineBase engine, CPPlanNode node) :
	engine(engine), isValidPath(false), node(node)
{
	Context *context = Context::getContext();
	const LegacyRulePlanNode *legacyRulePlanNode = dynamic_cast<const LegacyRulePlanNode *>(node.get());
	cube = legacyRulePlanNode->getCube();
	db = CONST_COMMITABLE_CAST(Database, context->getParent(cube));
	mem_context = context->getRulesContext();
	ECube *ecube = NewEntryCube(*cube, *db, *engine, context);
	CPRule rule = legacyRulePlanNode->getRule();
	generateEmptyResults = node->getDefaultValue() != 0;

	area.reset(new CubeArea(db, cube, *node->getArea().get()));
	erule = ecube->findRule(rule->getId());
	if (erule && erule->arule) {
		generateSources();
	} else {
		stringstream msg;
		msg << "rule " << rule->getId() << " not found in database " <<  db->getName() << ", cube " << cube->getName() << ", erule";
		if (erule) {
			msg << "->nr_rule: " << erule->nr_rule << ", erule->arule: NULL";
		} else {
			msg << ": NULL";
		}
		Logger::error << msg.str() << endl;
		throw ParameterException(ErrorException::ERROR_RULE_NOT_FOUND, "rule not found in cube", "cube", (int)cube->getId(), "rule", (int)(erule ? erule->nr_rule : NO_IDENTIFIER));
	}
}
Exemple #12
0
//------------------------------------------------------------------------------
Gmat::ParameterType ObjectPropertyWrapper::GetDataType() const
{
   #ifdef DEBUG_OPW
   MessageInterface::ShowMessage
      (wxT("ObjectPropertyWrapper::GetDataType() entered, propID = %d\n"), propID);
   #endif
   
   if (object == NULL)
      throw ParameterException
         (wxT("ObjectPropertyWrapper::GetDataType() The object is NULL, ")
          wxT("so cannot get data type"));
   
   Gmat::ParameterType propType = object->GetParameterType(propID);
   
   #ifdef DEBUG_OPW
   MessageInterface::ShowMessage
      (wxT("ObjectPropertyWrapper::GetDataType() returning %d\n"), propType);
   #endif
   
   #ifdef DEBUG_OPW
   MessageInterface::ShowMessage
      (wxT("ObjectPropertyWrapper::GetDataType() returning %d\n"), propType);
   #endif
   
   return propType;
}
void CubeDimension::changeElementName(PServer server, PDatabase db, Element * element, const string& name, PUser user, bool useJournal, bool useDimWorker)
{
	if (user) {
		throw ParameterException(ErrorException::ERROR_DIMENSION_UNCHANGABLE, "dimension is not changable", "user", (int)user->getId());
	}
	return SystemDimension::changeElementName(server, db, element, name, user, useJournal, useDimWorker);
}
Element* CubeDimension::addElement(PServer server, PDatabase db, IdentifierType idElement, const string& name, Element::Type elementType, PUser user, bool useJournal)
{
	if (user) {
		throw ParameterException(ErrorException::ERROR_DIMENSION_UNCHANGABLE, "dimension is not changable", "user", (int)user->getId());
	}
	return SystemDimension::addElement(server, db, idElement, name, Element::STRING, user, useJournal);
}
Exemple #15
0
//------------------------------------------------------------------------------
// virtual void InitializeRefObjects()
//------------------------------------------------------------------------------
void TimeData::InitializeRefObjects()
{
    mSpacecraft = (Spacecraft*)FindFirstObject(VALID_OBJECT_TYPE_LIST[SPACECRAFT]);
    if (mSpacecraft == NULL)
    {
        wxString scName = GetRefObjectName(Gmat::SPACECRAFT);
#ifdef DEBUG_TIMEDATA
        MessageInterface::ShowMessage
        (wxT("TimeData::InitializeRefObjects() Cannot find Spacecraft object named ")
         wxT("\"%s\"\n"), scName.c_str());
#endif

        throw ParameterException
        (wxT("TimeData::InitializeRefObjects() Cannot find Spacecraft object named \"") +
         scName + wxT("\"\n"));
    }
    else
    {
        if (!mIsInitialEpochSet)
        {
            mInitialEpoch = mSpacecraft->GetEpoch();
            mIsInitialEpochSet = true;

#ifdef DEBUG_TIMEDATA
            MessageInterface::ShowMessage
            (wxT("TimeData::InitializeRefObjects() set mInitialEpoch to %f\n"), mInitialEpoch);
#endif
        }
    }
}
Exemple #16
0
//------------------------------------------------------------------------------
// Rvector GetRvector(Integer item)
//------------------------------------------------------------------------------
Rvector AttitudeData::GetRvector(Integer item)
{
   #ifdef DEBUG_GET_RVECTOR
   MessageInterface::ShowMessage
      ("AttitudeData::GetRvector() entered, item = %d\n", item);
   #endif
   
   if (mSpacecraft == NULL)
      InitializeRefObjects();
   
   Real epoch = mSpacecraft->GetEpoch();
   
   // Get cosine matrix which is internal representation and always gets updated
   Rmatrix33 cosMat = mSpacecraft->GetAttitude(epoch);
   Rvector quat = AttitudeConversionUtility::ToQuaternion(cosMat);
   
   switch (item)
   {
   case QUATERNION:
   {
      return quat;
   }
   default:
      // otherwise, there is an error   
      throw ParameterException
         ("AttitudeData::SetString() Not redable or unknown item id: " +
          GmatRealUtil::ToString(item));
   }
}
Exemple #17
0
//------------------------------------------------------------------------------
// Rvector GetRvectorParameter(const Integer id, const Integer index) const
//------------------------------------------------------------------------------
Rvector Array::GetRvectorParameter(const Integer id, const Integer index) const
{
   switch (id)
   {
   case ROW_VALUE:
      {
         Rvector rvec(mNumCols);
      
         for (int i=0; i<mNumCols; i++)
            rvec.SetElement(i, mRmatValue.GetElement(index, i));

         return rvec;
      }
   case COL_VALUE:
      {
         Rvector rvec(mNumRows);
      
         for (int i=0; i<mNumRows; i++)
            rvec.SetElement(i, mRmatValue.GetElement(i, index));

         return rvec;
      }
   default:
      throw ParameterException
         ("Array::GetRvectorParameter() Unknown Parameter Name" + PARAMETER_TEXT[id]);
      //return Parameter::GetRvectorParameter(id, index);
   }
}
Exemple #18
0
//---------------------------------------------------------------------------
void ArrayElementWrapper::SetupWrapper()
{
   try
   {
      GmatStringUtil::GetArrayIndexVar(description, rowName, columnName,
                                       arrayName);
   }
   catch (UtilityException &)
   {
      wxString errmsg = wxT("Unable to set up ArrayElementWrapper \"") +
                           description;
      errmsg += wxT("\" - does not parse correctly as an array.\n");
      throw ParameterException(errmsg);
   }
   #ifdef DEBUG_AE_WRAPPER
      MessageInterface::ShowMessage(
         wxT("AEWrapper::SetupWrapper for array named '%s' \n"), arrayName.c_str());
      MessageInterface::ShowMessage(wxT("   description = %s\n"), description.c_str());
      MessageInterface::ShowMessage(wxT("   rowName     = %s\n"), rowName.c_str());
      MessageInterface::ShowMessage(wxT("   columnName  = %s\n"), columnName.c_str());
      MessageInterface::ShowMessage(wxT("   arrayName   = %s\n"), arrayName.c_str());
   #endif
   // for now, put the array name in the list of reference objects - add
   // all the other stuff when GetRefObjectNames is called
   refObjectNames.push_back(arrayName);
}
Exemple #19
0
//---------------------------------------------------------------------------
bool ObjectPropertyWrapper::RenameObject(const wxString &oldName, 
                                         const wxString &newName)
{
   ElementWrapper::RenameObject(oldName, newName);
   // now rebuild the description string from the refObjectNames
   Integer pos = description.find(wxT("."));
   if (description.find(wxT(".")) != wxString::npos)
   {
      #ifdef DEBUG_RENAME_OBJ_PROP
         MessageInterface::ShowMessage(
         wxT("Found a dot at position %d in the description string %s\n"),
         (Integer) pos, description.c_str());
      #endif
      description.replace(0,pos,refObjectNames[0]);
      #ifdef DEBUG_RENAME_OBJ_PROP
         MessageInterface::ShowMessage(
         wxT("--- replacing with %s\n"), (refObjectNames[0]).c_str());
         MessageInterface::ShowMessage(
         wxT("--- and now description is %s\n"), description.c_str());
      #endif
   }
   else // this shouldn't happen, but ...
   {
      wxString errmsg = 
         wxT("Expecting a \".\" in the description for object property \"");
      errmsg += description + wxT(" \"");
      throw ParameterException(errmsg);
   }
   return true;
}
Exemple #20
0
//------------------------------------------------------------------------------
bool Variable::SetRefObjectName(const Gmat::ObjectType type,
                                const wxString &name)
{
   #ifdef DEBUG_VARIABLE_SET
   MessageInterface::ShowMessage
      (wxT("Variable::SetRefObjectName() this=<%p>'%s', type=%d, name=%s\n"), this,
       GetName().c_str(), type, name.c_str());
   #endif
   
   if (type != Gmat::PARAMETER)
   {
      throw ParameterException
         (wxT("Variable::SetRefObjectName() ") + GmatBase::GetObjectTypeString(type) +
          wxT(" is not valid object type of ") + this->GetTypeName() + wxT("\n"));
   }
   
   #ifdef DEBUG_VARIABLE_SET
   MessageInterface::ShowMessage
      (wxT("   Adding '%s' to '%s' parameter database\n"), name.c_str(), GetName().c_str());
   #endif
   
   #ifdef __ALLOW_SIMPLE_VAR_EXP__
   mParamDb->Add(name);
   #endif
   
   return true;
}
void CubeDimension::deleteElement(PServer server, PDatabase db, Element * element, PUser user, bool useJournal, CubeRulesArray* disabledRules, bool useDimWorker)
{
	if (user) {
		throw ParameterException(ErrorException::ERROR_DIMENSION_UNCHANGABLE, "dimension is not changable", "user", (int)user->getId());
	}
	return SystemDimension::deleteElement(server, db, element, user, useJournal, disabledRules, useDimWorker);
}
Exemple #22
0
//------------------------------------------------------------------------------
// const StringArray& GetRefObjectNameArray(const Gmat::ObjectType type)
//------------------------------------------------------------------------------
const StringArray& Variable::GetRefObjectNameArray(const Gmat::ObjectType type)
{
   //=======================================================
   #ifdef __ALLOW_SIMPLE_VAR_EXP__
   //=======================================================
      if (mParamDb == NULL)
         throw ParameterException
            (wxT("Variable::GetRefObjectNameArray() mParamDb is NULL\n"));
      
      #ifdef DEBUG_REF_OBJ
      MessageInterface::ShowMessage
         (wxT("Variable::GetRefObjectNameArray() type=%d\n"), type);
      StringArray paramNames = mParamDb->GetNamesOfParameters();
      MessageInterface::ShowMessage
         (wxT("Variable::GetStringArrayParameter() mParamDb->GetNamesOfParameters() ")
          wxT("size=%d\n"), paramNames.size());
      for (unsigned int i=0; i<paramNames.size(); i++)
         MessageInterface::ShowMessage
            (wxT("Variable::GetStringArrayParameter() ")
             wxT("paramNames[%d]=%s\n"), i, paramNames[i].c_str());
      #endif
      
      return mParamDb->GetNamesOfParameters();
   //=======================================================
   #else
   //=======================================================
      static StringArray objectNames;
      return objectNames;
   //=======================================================
   #endif
   //=======================================================
}
void CubeDimension::changeElementType(PServer server, PDatabase db, Element * element, Element::Type elementType, PUser user, bool setConsolidated, CubeRulesArray* disabledRules, IdentifiersType *elemsToDeleteFromCubes, bool doRemove)
{
	if (user) {
		throw ParameterException(ErrorException::ERROR_DIMENSION_UNCHANGABLE, "dimension is not changable", "user", (int)user->getId());
	}
	return SystemDimension::changeElementType(server, db, element, Element::STRING, user, setConsolidated, disabledRules, elemsToDeleteFromCubes, doRemove);
}
void FlowManager::set_scheduler_type(const PortId port, const std::string type)
{
    std::unique_lock<std::mutex> lock(mutex_);
    if (port != DEFAULT_BELOW_PORT_ID)
        throw ParameterException("Defining a scheduler for given lower layer port is not supported at the moment.");

    schedulers_[port] = SchedulerFactory::make_scheduler(type);
}
Exemple #25
0
Value MethodCall::getParam(unsigned ind) const
{
  if (ind < params.size() )
    return params[ind];

  throw ParameterException(InvalidMethodParameterError,
                           "MethodCall::getParam: Parameter index " + toString(ind) + " in " + getSignature() + " method is out-of-range.");
}
Exemple #26
0
MethodResponse
   Dispatcher::xml_pretty_print(const MethodCall &calldata,
                                const Dispatcher *disp)
{
  ULXR_TRACE("xml_pretty_print");
  if (calldata.numParams() > 1)
    throw ParameterException(InvalidMethodParameterError,
                             "At most 1 parameter allowed for \"system.listMethods\"");

  if (   calldata.numParams() == 1
      && calldata.getParam(0).getType() != RpcBoolean)
    throw ParameterException(InvalidMethodParameterError,
                             "Parameter 1 not of type \"Boolean\" \"ulxmlrpcpp.xml_pretty_print\"");

  bool enable = Boolean(calldata.getParam(0)).getBoolean();
  enableXmlPrettyPrint(enable);
  return MethodResponse (Void());
}
Exemple #27
0
ULXR_API_IMPL(Value) MethodCall::getParam(unsigned ind) const
{
  if (ind < params.size() )
    return params[ind];

  throw ParameterException(InvalidMethodParameterError,
                           ulxr_i18n(ULXR_PCHAR("Not enough actual parameters for call to method: ")
                               +getSignature()));
}
Exemple #28
0
//------------------------------------------------------------------------------
void BooleanWrapper::SetupWrapper()
{
   if (GmatStringUtil::ToBoolean(description, value) == false)
   {
      std::string errmsg = "For Boolean wrapper \"";
      errmsg += description;
      errmsg += "\", the description string does not evaluate to Boolean\n"; 
      throw ParameterException(errmsg);
   }
}
Exemple #29
0
//------------------------------------------------------------------------------
// Real GetRealParameter(const Integer id, const Integer index)
//------------------------------------------------------------------------------
Real Array::GetRealParameter(const Integer id, const Integer index) const
{
   switch (id)
   {
   case SINGLE_VALUE:
      return mRmatValue.GetElement(0, index);
   default:
      throw ParameterException
         ("Array::GetRealParameter() Unknown Parameter Name" + PARAMETER_TEXT[id]);
   }
}
Exemple #30
0
MethodCall&  /**/ MethodCall::setParam (unsigned ind, const Value &val)
{
  if (ind < params.size() )
  {
    params[ind] = val;
    return *this;
  }

  throw ParameterException(InvalidMethodParameterError,
                           "MethodCall::setParam: Parameter index " + toString(ind) + " in " + getSignature() + " method is out-of-range");
}