public void unpublish(IProject project, IServer server, File serverHome, File deployLocation)
      throws Exception {
    URL serverURL = CarbonServerManager.getServerURL(server);
    ICredentials serverCredentials = CarbonServerManager.getServerCredentials(server);

    String cappName = project.getName();

    /*CAppDeployer cappDeployer = new CAppDeployer();
    Artifact superArtifact = CAppEnvironment.getcAppManager().getSuperArtifact(project);
    CarExportHandler handler=new CarExportHandler();
    List<IResource> exportArtifact = handler.exportArtifact(project);
    File carFile = ((IFile)exportArtifact.get(0)).getLocation().toFile();*/
    CAppDeployer.unDeployCAR(
        serverURL.toString(),
        serverCredentials.getUsername(),
        serverCredentials.getPassword(),
        cappName);
  }
  public void publish(IProject project, IServer server, File serverHome, File deployLocation)
      throws Exception {
    if (project.hasNature("org.wso2.developerstudio.eclipse.distribution.project.nature")) {

      URL serverURL = CarbonServerManager.getServerURL(server);
      ICredentials serverCredentials = CarbonServerManager.getServerCredentials(server);
      File tempDir = FileUtils.createTempDirectory();
      CAppDeployer cappDeployer = new CAppDeployer();
      //	        File carFile = CAppUtils.generateCAR(tempDir.getPath(), project, false);
      CarExportHandler handler = new CarExportHandler();
      List<IResource> exportArtifact = handler.exportArtifact(project);
      cappDeployer.deployCApp(
          serverCredentials.getUsername(),
          serverCredentials.getPassword(),
          serverURL.toString(),
          ((IFile) exportArtifact.get(0)).getLocation().toFile());
    }
  }