Ejemplo n.º 1
0
  private void deleteServiceShallow(String serviceId) throws IOException {
    Folder classesFolder = getProjectWebAppRoot().getFolder("WEB-INF/classes");
    File springConfig = classesFolder.getFile(serviceId + ".spring.xml");
    springConfig.delete();
    File dbProperty = classesFolder.getFile(serviceId + ".properties");
    if (dbProperty.exists()) {
      dbProperty.delete();
    }
    Service service = getService(serviceId);
    if (service != null) {
      com.wavemaker.tools.io.Resource target;
      if (service.getType().equals("JavaService")) {
        target = classesFolder.getFile(StringUtils.classNameToClassFilePath(service.getClazz()));
      } else {
        String packageName = StringUtils.getPackage(service.getClazz());
        target = classesFolder.getFolder(StringUtils.packageToSrcFilePath(packageName));
      }
      target.delete();
    }

    Map<String, Service> serviceDefs = getCurrentServiceDefinitions();
    serviceDefs.remove(serviceId);

    Folder serviceHome = getServiceFolder(serviceId);
    Project project = this.projectManager.getCurrentProject();
    project.deleteFile(serviceHome);
    project.deleteFile(ConfigurationCompiler.getSmdFile(project, serviceId));
  }
Ejemplo n.º 2
0
 /**
  * Delete a file or folder
  *
  * @param name the complete path of the folder or file
  * @return <tt>true<tt> if the file/folder was deleted
  */
 public boolean deleteFile(@ParamName(name = "name") String name) {
   Resource resource = getResource(name, Resource.class);
   resource.delete();
   return !resource.exists();
 }