Example #1
0
 String getGroupName() {
   if (m_parent.isRoot()) {
     return null;
   } else {
     return m_parent.getResourcePath();
   }
 }
  // Add modules in flash (or on UMD) that aren't loaded by default on this firmwareVersion
  private void initialiseFlash0PRXMap() {
    flash0prxMap = new HashMap<String, List<HLEModule>>();

    for (DefaultModule defaultModule : DefaultModule.values()) {
      if (!defaultModule.isLoadedByDefault(firmwareVersion)) {
        String[] prxNames = defaultModule.getPrxNames();
        for (int i = 0; prxNames != null && i < prxNames.length; i++) {
          addToFlash0PRXMap(prxNames[i], defaultModule.getModule());
        }
      }
    }
  }
Example #3
0
 DefaultModule getDefaultParent() {
   if (null != m_parent) {
     if (m_parent.isRoot()) {
       return null;
     }
   }
   return m_parent;
 }
Example #4
0
 private File getAnchor() {
   if (null != m_parent) {
     File anchor = m_parent.getBaseDir();
     if (null != anchor) {
       return anchor;
     }
   }
   return m_library.getRootDirectory();
 }
  public void stopModules() {
    if (!modulesStarted) {
      return;
    }

    for (DefaultModule defaultModule : DefaultModule.values()) {
      defaultModule.module.stop();
    }

    modulesStarted = false;
  }
Example #6
0
 /**
  * Return an array of filters associated with the resource.
  *
  * @return the array of filters
  */
 public Filter[] getFilters() {
   DefaultModule module = getDefaultParent();
   if (null != module) {
     Map<String, Filter> map = new Hashtable<String, Filter>();
     Filter[] filters = module.getFilters();
     for (int i = 0; i < filters.length; i++) {
       Filter filter = filters[i];
       String token = filter.getToken();
       map.put(token, filter);
     }
     Filter[] local = getLocalFilters();
     for (int i = 0; i < local.length; i++) {
       Filter filter = local[i];
       String token = filter.getToken();
       map.put(token, filter);
     }
     return map.values().toArray(new Filter[0]);
   } else {
     return getLocalFilters();
   }
 }
Example #7
0
 boolean isaDescendant(final DefaultModule module) {
   if (module == this) {
     return true;
   }
   if (m_parent == null) {
     return false;
   } else {
     if (m_parent == module) {
       return true;
     } else {
       return m_parent.isaDescendant(module);
     }
   }
 }
  public void startModules(boolean startFromSyscall) {
    if (modulesStarted) {
      return;
    }

    this.startFromSyscall = startFromSyscall;

    for (DefaultModule defaultModule : DefaultModule.values()) {
      defaultModule.module.start();
    }

    this.startFromSyscall = false;
    modulesStarted = true;
  }
Example #9
0
 private String getIncludeReference(final IncludeDirective directive) {
   if (null == m_parent) {
     return directive.getValue();
   } else {
     if (IncludeDirective.REF.equals(directive.getMode())) {
       return directive.getValue();
     } else {
       String path = m_parent.getResourcePath();
       if ("".equals(path)) {
         return directive.getValue();
       } else {
         String key = directive.getValue();
         return path + "/" + key;
       }
     }
   }
 }
  @Override
  public void init(
      ModuleType moduleType,
      _ComponentPositionType componentPosition,
      ApplicationContainer<T> appCont,
      IModule<T> parent,
      Map<String, String> initParams) {
    super.init(moduleType, componentPosition, appCont, parent, initParams);

    this.mapModule = appContainer.getActiveMapModule();
    if (this.mapModule == null) {
      LOG.logError("no map module found ");
      return;
    }

    this.mapModule.getMapTool().addChangeListener(this);
  }
Example #11
0
 /**
  * Return the declard resource version.
  *
  * @return the statutory version
  */
 public String getStatutoryVersion() {
   if (null == m_directive) {
     return null;
   } else {
     String version = m_directive.getVersion();
     if ((null != version) || m_directive.isAnonymous()) {
       return version;
     } else {
       if (null != m_parent) {
         return m_parent.getStatutoryVersion();
       } else if (!m_directive.getClassifier().equals(Classifier.LOCAL)) {
         return ANONYMOUS;
       } else {
         return null;
       }
     }
   }
 }
  /** Install the modules that are loaded by default on the current firmware version. */
  private void installDefaultModules() {
    if (log.isDebugEnabled()) {
      log.debug(String.format("Loading HLE firmware up to version %d", firmwareVersion));
    }

    for (DefaultModule defaultModule : DefaultModule.values()) {
      if (defaultModule.isLoadedByDefault(firmwareVersion)) {
        installModuleWithAnnotations(defaultModule.getModule(), firmwareVersion);
      } else {
        // This module is not loaded by default on this firmware version.
        // Install and Uninstall the module to register the module syscalls
        // so that the loader can still resolve the imports for this module.
        installModuleWithAnnotations(defaultModule.getModule(), firmwareVersion);
        uninstallModuleWithAnnotations(defaultModule.getModule(), firmwareVersion);
      }
    }
  }
Example #13
0
  /**
   * Creation of a new default resource.
   *
   * @param library the reference library
   * @param module the parent module
   * @param directive the resource directive
   */
  DefaultResource(
      final DefaultLibrary library, final DefaultModule module, final ResourceDirective directive) {
    super(module, directive);
    if (null == directive) {
      throw new NullPointerException("directive");
    }

    m_library = library;
    m_directive = directive;
    m_parent = module;

    if (module.isRoot()) {
      m_path = directive.getName();
    } else {
      m_path = module.getResourcePath() + "/" + directive.getName();
    }

    // setup produced types

    TypeDirective[] types = directive.getTypeDirectives();
    m_types = new Type[types.length];
    m_typeNames = new String[types.length];
    for (int i = 0; i < types.length; i++) {
      TypeDirective type = types[i];
      m_types[i] = new DefaultType(this, type);
      m_typeNames[i] = type.getID();
    }

    // setup the resource basedir

    File anchor = getAnchor();
    String filename = m_directive.getBasedir();
    if (null != filename) {
      String spec = resolve(filename);
      File file = new File(spec);
      if (file.isAbsolute()) {
        m_basedir = getCanonicalFile(file);
      } else {
        File basedir = new File(anchor, spec);
        m_basedir = getCanonicalFile(basedir);
        setProperty("basedir", m_basedir.toString());
      }
    } else {
      if (!m_directive.getClassifier().equals(Classifier.LOCAL)) {
        m_basedir = null;
      } else {
        final String error = "Missing base directory declaration in resource [" + m_path + "].";
        throw new ValidationException(error);
      }
    }

    // setup the default properties

    setProperty("project.name", getName());
    if (null != m_parent) {
      setProperty("project.group", m_parent.getResourcePath());
    } else {
      setProperty("project.group", "");
    }
    String version = getVersion();
    if (null != version) {
      setProperty("project.version", version);
    }

    // setup filters

    FilterDirective[] filters = directive.getFilterDirectives();
    for (int i = 0; i < filters.length; i++) {
      FilterDirective filter = filters[i];
      String token = filter.getToken();
      m_filters.put(token, filter);
    }
  }