private static Element createLibraryElement(AntProjectHelper antProjectHelper, Document doc, Item item, String includedLibrariesElement) { Element libraryElement = doc.createElementNS( EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, includedLibrariesElement ); // ejbjar is different from other j2ee projects - it stores reference without ${ and } libraryElement.appendChild( doc.createTextNode( CommonProjectUtils.getAntPropertyName(item.getReference()) ) ); AntProjectUtil.updateDirsAttributeInCPSItem(item, libraryElement); return libraryElement; }
/** * Updates the project helper with the list of classpath items which are to be * included in deployment. */ private static void putIncludedLibraries( List<Item> classpath, AntProjectHelper antProjectHelper, String webModuleLibraries ) { assert antProjectHelper != null; assert webModuleLibraries != null; Element data = antProjectHelper.getPrimaryConfigurationData( true ); Document doc = data.getOwnerDocument(); Element webModuleLibs = (Element) data.getElementsByTagNameNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, webModuleLibraries).item(0); if (webModuleLibs == null) { webModuleLibs = doc.createElementNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, webModuleLibraries); //NOI18N data.appendChild(webModuleLibs); } while (webModuleLibs.hasChildNodes()) { webModuleLibs.removeChild(webModuleLibs.getChildNodes().item(0)); } for (Item item : classpath) { webModuleLibs.appendChild(createLibraryElement(antProjectHelper, doc, CommonProjectUtils.getAntPropertyName( item.getReference() ), item)); } antProjectHelper.putPrimaryConfigurationData( data, true ); }
private static Element createLibraryElement(AntProjectHelper antProjectHelper, Document doc, Item item, String includedLibrariesElement) { Element libraryElement = doc.createElementNS( AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE, includedLibrariesElement ); // appclient is different from other j2ee projects - it stores reference without ${ and } libraryElement.appendChild( doc.createTextNode( CommonProjectUtils.getAntPropertyName(item.getReference()) ) ); AntProjectUtil.updateDirsAttributeInCPSItem(item, libraryElement); return libraryElement; }
while(items.hasNext()) { ClassPathSupport.Item cpti = items.next(); String propertyName = cpti.getReference(); if(propertyName != null) { String libname = propertyName.substring("${libs.".length());
if ( item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT || item.getType() == ClassPathSupport.Item.TYPE_JAR ) { refHelper.destroyReference(item.getReference()); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { item.removeSourceAndJavadoc(updateHelper); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { String prop = item.getReference(); prop = prop.substring(2, prop.length()-1); ep.remove(prop);
if ( item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT || item.getType() == ClassPathSupport.Item.TYPE_JAR ) { refHelper.destroyReference(item.getReference()); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { item.removeSourceAndJavadoc(updateHelper); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { String prop = item.getReference(); prop = prop.substring(2, prop.length()-1); ep.remove(prop);
if ( item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT || item.getType() == ClassPathSupport.Item.TYPE_JAR ) { refHelper.destroyReference(item.getReference()); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { item.removeSourceAndJavadoc(updateHelper); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { String prop = item.getReference(); prop = prop.substring(2, prop.length()-1); ep.remove(prop);
if ( item.getType() == ClassPathSupport.Item.TYPE_ARTIFACT || item.getType() == ClassPathSupport.Item.TYPE_JAR ) { refHelper.destroyReference(item.getReference()); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { item.removeSourceAndJavadoc(updateHelper); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { String prop = item.getReference(); prop = CommonProjectUtils.getAntPropertyName(prop); ep.remove(prop);
private List<ClassPathSupport.Item> filterBrokenLibraryItems(List<ClassPathSupport.Item> items) { List<ClassPathSupport.Item> toRemove = new LinkedList<ClassPathSupport.Item>(); Collection<? extends BrokenLibraryRefFilter> filters = null; for (ClassPathSupport.Item item : items) { if (!item.isBroken() || item.getType() != ClassPathSupport.Item.TYPE_LIBRARY) { continue; } String libraryName = ClassPathSupport.getLibraryNameFromReference(item.getReference()); LOGGER.log(Level.FINE, "Broken reference to library: " + libraryName); if (filters == null) { // initializing the filters lazily because usually they will not be needed anyway // (most projects have no broken references) filters = createFilters(WebProject.this); } for (BrokenLibraryRefFilter filter : filters) { if (filter.removeLibraryReference(libraryName)) { LOGGER.log(Level.FINE, "Will remove broken reference to library " + libraryName + " because of filter " + filter.getClass().getName()); toRemove.add(item); break; } } } return toRemove; }
private static void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private static void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private static void collectLibs(DefaultListModel model, List<String> libs, List<String> jarReferences) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_LIBRARY) { if (!item.isBroken() && !libs.contains(item.getLibrary().getName())) { libs.add(item.getLibrary().getName()); } } if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null && item.getVariableBasedProperty() == null && !jarReferences.contains(item.getReference())) { //TODO reference is null for not yet persisted items. // there seems to be no way to generate a reference string without actually // creating and writing the property.. jarReferences.add(item.getReference()); } } } }
private void updateJars(DefaultListModel model) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null) { item.updateJarReference(uiProperties.getProject().getAntProjectHelper()); } } } }
private void updateJars(DefaultListModel model) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null) { item.updateJarReference(uiProperties.getProject().getAntProjectHelper()); } } } }
public void readAdditionalProperties(List<Item> items, String projectXMLElement) { Map<String, String> destination = new HashMap<String, String>(); List<String> l = getIncludedLibraries(helper, projectXMLElement, destination); for (Item item : items) { boolean b = l.contains(item.getReference()); item.setAdditionalProperty(INCLUDE_IN_DEPLOYMENT, Boolean.toString(b)); String dest = destination.get(item.getReference()); if (b && dest != null) { item.setAdditionalProperty(AntProjectConstants.DESTINATION_DIRECTORY, dest); } } }
public void readAdditionalProperties(List<Item> items, String projectXMLElement) { Map<String, String> destination = new HashMap<String, String>(); List<String> l = getIncludedLibraries(antProjectHelper, projectXMLElement, destination); for (Item item : items) { boolean b = l.contains(item.getReference()); item.setAdditionalProperty(INCLUDE_IN_DEPLOYMENT, Boolean.toString(b)); String dest = destination.get(item.getReference()); if (b && dest != null) { item.setAdditionalProperty(AntProjectConstants.DESTINATION_DIRECTORY, dest); } } }
private void updateJars(DefaultListModel model) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null) { item.updateJarReference(uiProperties.getProject().getAntProjectHelper()); } } } }
public void readAdditionalProperties(List<Item> items, String projectXMLElement) { Map<String, String> warIncludesMap = createWarIncludesMap(helper, projectXMLElement); for (Item item : items) { String property = CommonProjectUtils.getAntPropertyName( item.getReference() ); String deploymentPath = warIncludesMap.get(property); item.setAdditionalProperty(PATH_IN_DEPLOYMENT, deploymentPath); item.setAdditionalProperty(AntProjectConstants.DESTINATION_DIRECTORY, warIncludesMap.get(property+"."+AntProjectConstants.DESTINATION_DIRECTORY)); } }
private void updateJars(DefaultListModel model) { for (int i = 0; i < model.size(); i++) { ClassPathSupport.Item item = (ClassPathSupport.Item) model.get(i); if (item.getType() == ClassPathSupport.Item.TYPE_JAR) { if (item.getReference() != null) { item.updateJarReference(uiProperties.getProject().getAntProjectHelper()); } } } }