/** * Method checks type of project and returns corresponding as name with proper extension. * * @param path * @return String */ private String getAsNameFrmProject(String path) { String name = ""; ProjExportType type = ProjectNatureHelper.getProjectNature(getProjectFrmPath(path)); File file = new File(path); if (file.exists() && file.isDirectory()) { name = file.getName(); if (type.equals(ProjExportType.EAR)) { name = name.concat(".ear"); } else if (type.equals(ProjExportType.WAR)) { name = name.concat(".war"); } else { name = name.concat(".jar"); } } return name; }
/** * This method returns the deployment name of any component it also prepares the name if name is * not specified. * * @param path * @param method * @param asName * @return */ public static String getAsName( String path, WindowsAzureRoleComponentImportMethod method, String asName) { String name; if (asName.isEmpty()) { name = new File(path).getName(); if (method == WindowsAzureRoleComponentImportMethod.auto) { ProjExportType type = ProjectNatureHelper.getProjectNature(findProjectFromWorkSpace(convertPath(path))); name = String.format("%s%s%s", name, ".", type.name().toLowerCase()); } else if (method == WindowsAzureRoleComponentImportMethod.zip) { name = String.format("%s%s", name, ".zip"); } } else { name = asName; } return name; }