Exemplo n.º 1
0
  @Override
  public void load(Class<? extends AEntity> cls, String alias) {
    if (!versionChecked) checkVersion();

    aliases.put(cls, alias);

    Map<String, AEntity> entities = new HashMap<String, AEntity>();
    data.put((Class<AEntity>) cls, entities);

    beanSerializer.setAlias(alias, cls);

    File f = new File(dir + "/" + alias);
    LOG.info("Loading entities:", alias);
    File[] files = f.listFiles();
    if (files != null) {
      for (int i = 0; i < files.length; i++) {
        File file = files[i];
        if (file.getName().equals(CLUSTER_FILE_NAME)) continue;
        try {
          loadObject(file, entities, cls, alias);
        } catch (Throwable ex) {
          throw new RuntimeException("Loading object from " + file + " failed", ex);
        }
      }
    }
    // LOG.info(" Loaded entities:", alias, count);
  }
Exemplo n.º 2
0
 @Override
 public void setAlias(String alias, Class cls) {
   aliases.put(cls, alias);
   beanSerializer.setAlias(alias, cls);
 }