Esempio n. 1
0
 private void lazilyResolveExtensionPoint() {
   if (extensionPoint == null) {
     ModuleRegistry registry = declaringModule.getRegistry();
     if (registry != null) {
       extensionPoint = registry.getExtensionPoint(point, declaringModule);
       if (extensionPoint != null) {
         // Set root of all schema elements
         configurationElement.setSchemaElement(
             (ConfigurationSchemaElementImpl) extensionPoint.getConfigurationSchemaElement());
       }
     }
   }
 }
Esempio n. 2
0
  private AppContext(
      String root, File rootFile, String name, String environment, AppContext nonAdminParent) {
    super(name + ":" + environment);
    if (root == null) throw new NullPointerException("AppContext root can't be null");

    if (rootFile == null) throw new NullPointerException("AppContext rootFile can't be null");

    if (name == null) name = guessNameAndEnv(root).name;

    if (name == null) throw new NullPointerException("how could name be null");

    _root = root;
    _rootFile = rootFile;
    _git = new GitDir(_rootFile);
    _name = name;

    _environment = environment;
    _nonAdminParent = nonAdminParent;
    _admin = _nonAdminParent != null;
    _codePrefix = _admin ? "/~~/modules/admin/" : "";
    _moduleRegistry = ModuleRegistry.getNewGlobalChild();

    if (_git.isValid()) {
      _gitBranch = _git.getBranchOrTagName();
      _gitHash = _git.getCurrentHash();
    }

    _isGrid = name.equals("grid");

    _scope =
        new Scope(
            "AppContext:" + root + (_admin ? ":admin" : ""),
            _isGrid ? ed.cloud.Cloud.getInstance().getScope() : Scope.newGlobal(),
            null,
            Language.JS(),
            _rootFile);
    _scope.setGlobal(true);
    _initScope = _scope.child("_init");

    _usage = new UsageTracker(this);

    _baseScopeInit();

    _adminContext = _admin ? null : new AppContext(root, rootFile, name, environment, this);

    _rootContextReachable = new SeenPath();

    if (!_admin)
      _logger.info(
          "Started Context.  root:"
              + _root
              + " environment:"
              + environment
              + " git branch: "
              + _gitBranch);
  }
 public Set<Module> getPluginModules() {
   Set<Module> modules = new LinkedHashSet<Module>();
   Properties properties = loadPluginProperties();
   for (String pluginModule : properties.getProperty("plugins").split(",")) {
     try {
       modules.add(moduleRegistry.getModule(pluginModule));
     } catch (UnknownModuleException e) {
       // Ignore
       LOGGER.debug("Cannot find module for plugin {}. Ignoring.", pluginModule);
     }
   }
   return modules;
 }
  public Boolean isDependencySatisfied(Stage stage, ActiveInterviewService activeInterviewService) {
    // every other stages need to be completed except itself
    for (Module module : moduleRegistry.getModules()) {
      for (Stage oneStage : module.getStages()) {
        if (!stage.equals(oneStage)) {
          IStageExecution stageExecution =
              activeInterviewService.getStageExecution(oneStage.getName());
          if (!stageExecution.isCompleted()) {
            // At least one stage is not complete, return null since
            log.debug(
                "Dependendant module {} not complete due to stage {}",
                module.getName(),
                oneStage.getName());
            return null;
          }
        }
      }
    }

    return true;
  }