--- a/autoupdate.services/apichanges.xml Thu May 10 15:11:55 2012 +0200 +++ a/autoupdate.services/apichanges.xml Thu May 10 15:14:17 2012 +0200 @@ -2,7 +2,7 @@ + + + Mark an update as preferred just if needed + + + + + +

+ Added a preferredupdate attribute into Update Center Descriptor + to specify if an update has to be installed before other updates or not. This flag is off as default. +

+
+ + +
+ + + Added a method to get a descprition of content of Upadate Center + + + + + +

+ {@link org.netbeans.api.autoupdate.UpdateUnitProvider#getContentDescription} returns + a description of content staging by this provider. The description might contains HTML tags e.g. HTML Links. +

+
+ + +
+ + + Added a method to get ID of license agreement + + + + + +

+ Added a method {@link org.netbeans.api.autoupdate.UpdateElement#getLicenseId} + to get ID of license agreement if the UpdateElement has a copyright. +

+

+ This ID could be stored somewhere once an user approves the license and + will not be asked for approval again the same license ID. +

+
+ + +
+ + + Check write permissions to installation directory + + + + + +

+ InstallSupport find out the right directory where a plugin + should be installed. After that it checks if an user has privilege to write there. + In the case a lack of write permission, throws + {@link org.netbeans.api.autoupdate.OperationException.WRITE_PERMISSION}. +

+

+ Beside this it allows to write into + userdir as a fallback in the case of insufficient privilege. +

+
+ + + +
External NBM contents --- a/autoupdate.services/src/org/netbeans/api/autoupdate/InstallSupport.java Thu May 10 15:11:55 2012 +0200 +++ a/autoupdate.services/src/org/netbeans/api/autoupdate/InstallSupport.java Thu May 10 15:14:17 2012 +0200 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -44,9 +44,9 @@ package org.netbeans.api.autoupdate; +import org.netbeans.api.autoupdate.OperationSupport.Restarter; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.modules.autoupdate.services.InstallSupportImpl; -import org.netbeans.api.autoupdate.OperationSupport.Restarter; /** * Performs all operations scheduled on instance of OperationContainer. @@ -86,15 +86,34 @@ impl = new InstallSupportImpl (this); } - /** Downloads all instances i.e. UpdateElements in corresponing OperationContainer. + /** Downloads all instances i.e. UpdateElements in corresponding OperationContainer. * * @param progress ProgressHandle for notification progress in downloading, can be null * @param isGlobal if true then forces download instances into shared directories i.e. installation directory * @return Validator an instance of Validator which allows to verify downloaded instances in the next step * @throws org.netbeans.api.autoupdate.OperationException + * @deprecated Use {@link #doDownload(ProgressHandle, Boolean, boolean)} instead. */ public Validator doDownload(ProgressHandle progress/*or null*/, boolean isGlobal) throws OperationException { - if (impl.doDownload (progress, isGlobal)) { + if (impl.doDownload (progress, isGlobal ? Boolean.TRUE : null, false)) { + return new Validator (); + } else { + return null; + } + } + + /** Downloads all instances i.e. UpdateElements in corresponding OperationContainer. + * + * @param progress ProgressHandle for notification progress in downloading, can be null + * @param isGlobal if true then forces download plugins into shared directories i.e. installation directory, + * if false then download plugins into userdir. If null then download plugins in a default place. + * @param useUserdirAsFallback if true then download plugins into userdir if no permission to write in shared directories + * @return Validator an instance of Validator which allows to verify downloaded instances in the next step + * @throws org.netbeans.api.autoupdate.OperationException + * @since 1.33 + */ + public Validator doDownload(ProgressHandle progress/*or null*/, Boolean isGlobal/*or null*/, boolean useUserdirAsFallback) throws OperationException { + if (impl.doDownload (progress, isGlobal, useUserdirAsFallback)) { return new Validator (); } else { return null; --- a/autoupdate.services/src/org/netbeans/api/autoupdate/OperationException.java Thu May 10 15:11:55 2012 +0200 +++ a/autoupdate.services/src/org/netbeans/api/autoupdate/OperationException.java Thu May 10 15:14:17 2012 +0200 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -77,6 +77,11 @@ * Uninstallation of plugin failed */ UNINSTALL, + /** + * Lack of write permission to write in installation directory + * @since 1.33 + */ + WRITE_PERMISSION } /** --- a/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateElement.java Thu May 10 15:11:55 2012 +0200 +++ a/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateElement.java Thu May 10 15:14:17 2012 +0200 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2011 Oracle and/or its affiliates. All rights reserved. + * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -45,8 +45,8 @@ package org.netbeans.api.autoupdate; import java.awt.Image; +import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY; import org.netbeans.modules.autoupdate.services.UpdateElementImpl; -import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY; import org.netbeans.modules.autoupdate.services.UpdateManagerImpl; import org.netbeans.modules.autoupdate.updateprovider.ProviderCategory; @@ -208,6 +208,15 @@ return impl.getDate (); } + /** Returns ID of license agreement if the UpdateElement has a copyright. + * + * @return String or null + * @since 1.33 + */ + public String getLicenseId () { + return impl.getLicenseId (); + } + /** Returns text of license agreement if the UpdateElement has a copyright. * * @return String or null @@ -243,5 +252,6 @@ public String toString () { return impl.getDisplayName() + "[" + impl.getCodeName () + "/" + impl.getSpecificationVersion () + "]"; } + } --- a/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnitProvider.java Thu May 10 15:11:55 2012 +0200 +++ a/autoupdate.services/src/org/netbeans/api/autoupdate/UpdateUnitProvider.java Thu May 10 15:14:17 2012 +0200 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -45,13 +45,13 @@ package org.netbeans.api.autoupdate; import java.awt.Image; -import org.netbeans.spi.autoupdate.*; import java.io.IOException; import java.net.URL; import java.util.List; import org.netbeans.api.autoupdate.UpdateManager.TYPE; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.modules.autoupdate.services.UpdateUnitProviderImpl; +import org.netbeans.spi.autoupdate.*; /**UpdateUnitProvider providers UpdateUnit. The units @@ -136,6 +136,16 @@ return impl.getSourceDescription(); } + /** A description of content staging by this provider. The description might contains + * HTML tags e.g. HTML Links. + * + * @return textual description of content or null + * @since 1.33 + */ + public String getContentDescription() { + return impl.getContentDescription(); + } + /** It's special support for UpdateProvider based on Autoupdate Catalog. * It's most kind of Update Providers and have a special support in UI. * --- a/autoupdate.services/src/org/netbeans/spi/autoupdate/UpdateItem.java Thu May 10 15:11:55 2012 +0200 +++ a/autoupdate.services/src/org/netbeans/spi/autoupdate/UpdateItem.java Thu May 10 15:14:17 2012 +0200 @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. + * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. @@ -48,11 +48,11 @@ import java.util.Locale; import java.util.Set; import java.util.jar.Manifest; +import org.netbeans.modules.autoupdate.services.Trampoline; +import org.netbeans.modules.autoupdate.updateprovider.FeatureItem; import org.netbeans.modules.autoupdate.updateprovider.LocalizationItem; -import org.netbeans.modules.autoupdate.updateprovider.FeatureItem; import org.netbeans.modules.autoupdate.updateprovider.ModuleItem; import org.netbeans.modules.autoupdate.updateprovider.NativeComponentItem; -import org.netbeans.modules.autoupdate.services.Trampoline; import org.netbeans.modules.autoupdate.updateprovider.UpdateItemImpl; /** Represents a item of content provider by UpdateProvider. These items are exposed to @@ -69,6 +69,7 @@ UpdateItem original; /** Creates a new instance of UpdateItem */ + @SuppressWarnings("LeakingThisInConstructor") UpdateItem (UpdateItemImpl item) { impl = item; item.setUpdateItem (this); @@ -94,7 +95,7 @@ * @param license UpdateLicense represents license name and text of license agreement * @return UpdateItem */ - public static final UpdateItem createModule ( + public static UpdateItem createModule ( String codeName, String specificationVersion, URL distribution, @@ -113,7 +114,53 @@ ModuleItem item = new ModuleItem (codeName, specificationVersion, distribution, author, publishDate, downloadSize, homepage, category, manifest, isEager, isAutoload, - needsRestart, isGlobal, targetCluster, license.impl); + needsRestart, isGlobal, false, targetCluster, license.impl); + return new UpdateItem (item); + } + + /** Creates UpdateItem/code> which represents NetBeans Module in Autoupdate infrastructure. + * UpdateItem is identify by codeName and specificationVersion. + * + * @param codeName code name of module + * @param specificationVersion specification version of module + * @param distribution URL to NBM file + * @param author name of module author or null + * @param downloadSize size of NBM file in bytes + * @param homepage homepage of module or null + * @param publishDate date of publish of item, in date format "yyyy/MM/dd" + * @param category name of category + * @param manifest java.util.jar.Manifest describes the module in NetBeans module system + * @param isEager says if the module is eager or not + * @param isAutoload says if the module is autoload or not + * @param needsRestart if true then IDE must be restarted after module installation + * @param isGlobal control if the module will be installed into the installation directory or into user's dir + * @param isPreferedUpdate if true will be handled in exclusive mode before other updates + * @param targetCluster name of cluster where new module will be installed if installation isGlobal + * @param license UpdateLicense represents license name and text of license agreement + * @return UpdateItem + * @since 1.33 + */ + public static UpdateItem createModule ( + String codeName, + String specificationVersion, + URL distribution, + String author, + String downloadSize, + String homepage, + String publishDate, + String category, + Manifest manifest, + Boolean isEager, + Boolean isAutoload, + Boolean needsRestart, + Boolean isGlobal, + Boolean isPreferedUpdate, + String targetCluster, + UpdateLicense license) { + ModuleItem item = new ModuleItem (codeName, specificationVersion, distribution, + author, publishDate, downloadSize, homepage, category, + manifest, isEager, isAutoload, + needsRestart, isGlobal, isPreferedUpdate, targetCluster, license.impl); return new UpdateItem (item); } @@ -130,7 +177,7 @@ * @param category name of category * @return UpdateItem */ - public static final UpdateItem createFeature ( + public static UpdateItem createFeature ( String codeName, String specificationVersion, Set dependencies, @@ -158,7 +205,7 @@ * @param license UpdateLicense represents license name and text of license agreement * @return UpdateItem */ - public static final UpdateItem createNativeComponent ( + public static UpdateItem createNativeComponent ( String codeName, String specificationVersion, String downloadSize, @@ -188,7 +235,7 @@ * @param uninstaller CustomUninstaller call-back interface * @return UpdateItem */ - public static final UpdateItem createInstalledNativeComponent ( + public static UpdateItem createInstalledNativeComponent ( String codeName, String specificationVersion, Set dependencies, @@ -218,7 +265,7 @@ * @param license UpdateLicense represents license name and text of license agreement * @return UpdateItem */ - public static final UpdateItem createLocalization ( + public static UpdateItem createLocalization ( String codeName, String specificationVersion, String moduleSpecificationVersion, --- a/openide.awt/apichanges.xml Thu May 10 15:11:55 2012 +0200 +++ a/openide.awt/apichanges.xml Thu May 10 15:14:17 2012 +0200 @@ -2,7 +2,7 @@