コード例 #1
0
 @Override
 public TaskRepository createRepository() {
   Document document;
   try {
     String configFileName = myName.toLowerCase() + ".xml";
     // URL resourceUrl = ResourceUtil.getResource(GenericRepositoryType.class, "connectors",
     // configFileName);
     URL resourceUrl = GenericRepository.class.getResource("connectors/" + configFileName);
     if (resourceUrl == null) {
       throw new AssertionError(
           "Repository configuration file '" + configFileName + "' not found");
     }
     document = JDOMUtil.loadResourceDocument(resourceUrl);
   } catch (Exception e) {
     throw new AssertionError(e);
   }
   GenericRepository repository =
       XmlSerializer.deserialize(document.getRootElement(), GenericRepository.class);
   if (repository != null) {
     repository.setRepositoryType(GenericRepositoryType.this);
     repository.setSubtypeName(getName());
   }
   return repository;
 }