Beispiel #1
0
  void Command::FirePostExecuteSuccess(const Object::Pointer returnValue) {
    // Debugging output
    if (DEBUG_COMMAND_EXECUTION) {
      CommandTracing::PrintTrace("COMMANDS", "execute" + CommandTracing::SEPARATOR
          + "success: id=" + this->GetId() + "; returnValue=" + returnValue->ToString());
    }

    executionEvents.postExecuteSuccess(this->GetId(), returnValue);
  }
  /*synchronized*/Property::Pointer
  TypeExtensionManager::GetProperty(
      Object::Pointer receiver, const std::string& namespaze,
      const std::string& method, bool forcePluginActivation)
  {
    std::clock_t start= 0;
    if (Expressions::TRACING)
    start = std::clock();

    // if we call a static method than the receiver is the class object
    //Class clazz= receiver instanceof Class ? (Class)receiver : receiver.getClass();

    Property::Pointer result(new Property(receiver, namespaze, method));
    Property::Pointer cached(fPropertyCache->Get(result));
    if (!cached.isNull())
    {
      if (cached->IsValidCacheEntry(forcePluginActivation))
      {
        if (Expressions::TRACING)
        {
          BERRY_INFO << "[Type Extension] - method " <<
          receiver->ToString() << "#" << method <<
          " found in cache: " <<
          (double(std::clock() - start))/(CLOCKS_PER_SEC/1000) << " ms.";
        }
        return cached;
      }
      // The type extender isn't loaded in the cached method but can be loaded
      // now. So remove method from cache and do the normal look up so that the
      // implementation class gets loaded.
      fPropertyCache->Remove(cached);
    }
    TypeExtension::Pointer extension(this->Get(receiver->GetClassName()));
    IPropertyTester::Pointer extender(extension->FindTypeExtender(*this, namespaze, method, false /*receiver instanceof Class*/, forcePluginActivation));
    if (!extender.Cast<TypeExtension::CONTINUE_>().IsNull() || extender.IsNull())
    {
      std::string msg("Unknown method for ");
      msg.append(receiver->GetClassName());
      throw CoreException(msg, method);
    }
    result->SetPropertyTester(extender);
    fPropertyCache->Put(result);
    if (Expressions::TRACING)
    {
      BERRY_INFO << "[Type Extension] - method " <<
      typeid(receiver).name() << "#" << method <<
      " not found in cache: " <<
      (double(std::clock() - start))/(CLOCKS_PER_SEC/1000) << " ms.";
    }
    return result;
  }