Karaf update bundles via xml feature file - osgi

Scenario:
a feature xml file that describe an application (V1.0) with a bundle (suppose gson) version 2.2.3
A second feature file with a newer application (V1.1) version and with a gson bundle version 2.2.4
they will install gson 2.2.3 and 2.2.4 side-by-side.
Question:
is it possible by means of xml file (i've seen the xsd and no hints for me there) to UPGRADE from V1.0 to V1.1 AND uninstall at same time the unnecessary gson 2.2.3

Short answer no, there is no upgrade. You might install the new and uninstall the old this way unneeded bundles might be uninstalled. Still If your dependencies are right your bundle should pick-up only the new version and not the old.

I've found a solution with some limitations. Using a KAR file for the whole project as a unique artifact will do the trick. Limitation is that KAR files/url repositories must have same name.

Related

sdk is not pulling down gradle

I'm looking to develop an application using gradle, groovy, maven other other products supported by sdkman. I'm using cygwin on a windows 10 machine. All seems good and updates most software packages that are needed. When I get to the point of installing gradle, sdk simply can't download ANY version of gradle. Is this a bug or am I missing something. Here's what I'm getting from my cygwin console.
Admin#Dale-PC ~
$ sdk install gradle
Downloading: gradle 2.14.1
In progress...
######################################################################## 100.0%
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /home/Admin/.sdkman/archives/gradle-2.14.1.zip or
/home/Admin/.sdkman/archives/gradle-2.14.1.zip.zip, and cannot find /home/Admin/.sdkman/archives/gradle-2.14.1.zip.ZIP, period.
Stop! The archive was corrupt and has been removed! Please try installing again.
Admin#Dale-PC ~
It seems as though sdk thinks it knows where it is however when it goes to pull it down, it doesn't pull down. Then sdk goes to unpack it and it can't find it. Any advice would be appreciated. Btw, I'm not going through a proxy and everything else seems to install just fine. It is just gradle that has the issue. Also, why is it trying to pull down an old version of gradle (2.14.1)?
I've downloaded the v2.14.1-all version, renamed the file to be gradle-2.14.1.zip.zip and placed it in the /home/Admin/.sdkman/archives/ directory and then did the install for gradle again. This time it found it and installed it as though it had downloaded the correct version. It's a solution for now.
v2.14.1 is the newest version of gradle. See here and here (3 is currently in beta-ish)
The filename .zip.zip seems erroneous. Possibly a defect in sdkman. Unsure if it was you who reported this on github, but: https://github.com/sdkman/sdkman-cli/issues/445

upgrade kura installation without losing configuration

I'm currently running Kura 1.1.1 on a beagle bone black running debian linux with some custom packages and some altered configuration.
I would like to upgrade to the latest Kura release without losing the configuration and packages.
How do you upgrade while maintaining the state of a kura installation?
AFAIK there is not an official way to do this yet.
You can backup the following files and include them again after upgrading:
data/snapshots/snapshot_14xxx.xml this is the file containing your bundles' configuration. Most recent changes have a higher timestamp.
kura/dpa.properties this files contains a list of deployed Deployment Packages, installed through web-ui or DEPLOY-V1 cloudlet.
*.dp the actual Deployment Packages installed.
If you manually added jars or edited start scripts, you must copy/edit them again
Depending on how you upgrade, you may or may not have the previous installation deleted. Shell script installer for example changes /opt/eclipse/kura/ symlink to the version it installs, without deleting the old one.

Cannot run Spring Roo solely from Windows command line as guided in the manual

I'm new to Spring Roo and follow the manual in the downloaded package officially provided by springsource at http://projects.spring.io/spring-roo/
Though, I cannot run roo from Windows command line window. The error when I run roo from cmd window can be viewed here.
Having STS downloaded, installing Roo plugin, creating a Spring Roo Project, starting Roo console will get me there.
So, my question is, the manual is outdated/incorrect for Windows OS or I missunderstand something here?
In the errors throws by Roo I can see that some system required packages are missing:
javax.imageio
javax.xml.namespace
javax.xml.parsers
So, I think you're right: the manual is outdated and should remove IBM Java from supported JDK.
I you want, you could report it in Spring-Roo Jira
The workaround could be install a Oracle standard JDK.
Good luck!
Thanks to #jmvivo idea, we found the cause - imcompatible between Java 8 and Spring Roo 1.2.5 RELEASE. The issue is officially known and report on Spring Roo Jira here.
So make sure your roo is running java.exe from Java 7 or lower.
java -version
Then you can call roo as guided.
p.s.
When editing %PATH% system variable, **make sure
You have %JAVA_HOME pointing to JDK 7
You put %JAVA_HOME%\bin on top** so that the java location you define in %JAVA_HOME% is applied.
Otherwise C:\ProgramData\Oracle\Java\javapath, or %SystemRoot%\system32 may have higher priority to your %JAVA_HOME%

How to uninstall old OSGI bundle version upon installation of a new version?

I am using the CQ Blueprints maven archetype for Adobe CQ to deploy OSGi bundles into CQ5.6.1. This archetype uses the Maven Sling Plugin to deploy the bundles by copying them into an install directory of my content repository.
I am changing the version numbers of my bundles upon every build using the maven versions plugin. Therefore, upon each deployment, a bundle jar with a new filename is installed, like commons-services-1.0.30.jar. My problem is, currently the older bundle versions, like commons-services-1.0.29.jar, are not removed upon installation of a newer version.
I would like to avoid old bundle versions piling up in my install folders. Therefore my question is: What is the best way to uninstall/delete these older versions upon installation of a new version?
Bundles piling up in an install folder are not really a problem - they will only use the space, but they are ignored by the Apache Sling OSGI installer that CQ uses to detect and install the bundles. The installer only considers the latest version of the bundle (based on its OSGi version header), and ignores older versions.
If you really want to remove the older bundle files, best is probably to create a small tool that finds them by walking the JCR tree under which they are installed (/apps I assume), and delete all but the latest version. If the bundle filenames consistently include the version number you can probably just sort their names with the right comparator and remove all but the last one. If you want to be really robust you'll need to read the bundle metadata to find out about its version number.
If you want to run your tool automatically at regular intervals you could register an OSGi EventHook to detect when new bundles are installed, and trigger a cleanup run when that happens.
Sorry if this sounds a bit complicated - but again leftover bundle files are not really problematic.
I solved the problem by configuring the filter.xml in my myproject-all module (see CQBlueprints description for the purpose of this module) to delete the contents of my bundle install folder. This way, old bundles are always deleted before new bundles are installed.
To delete the contents of my install folder, I added the following line to my filter.xml file:
<filter root="/apps/myapp/install">
use curl command to delete the specific bundle version.
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Edit: Removed purging as that was not applicable to the osgi bundle.

How to install an updated version of a Dart package?

When a new Dart package is published, how can I install the updated version?
The DartEditor calls pub get automatically when the file pubspec.yaml is updated.
You may call it manually (e.g. when you for example checked out a project from GitHub without modifying any file)
by using the context menu Pub Get in DartEditor on the file pubspec.yaml
by calling pub get on the command line in the package directory where the file pubspec.yaml is stored.
pub get downloads the package version noted in the file pubspec.lock (in the package root directory) or the most recent version that fulfills your version constraint (0.0.1 in your example could be any for 'most recent') if pubspec.lock doesn't exist. pub get/pub upgrade create the file pubspec.lock if it doesn't yet exist and save the versions of the downloaded packages it just downloaded.
Check for updated packages and download them using
context menu Pub Upgrade in DartEditor on the file pubspec.yaml
pub upgrade on the command line in the package directory where the file pubspec.yaml is stored.
pub upgrade downloads the most recent version that fulfills your version constraints and stores the downloaded version in the file pubspec.lock.
pub get/pub upgrade prefers stable releases (version numbers that don't contain a -) like 0.0.1 or 1.2.0+1 over pre-releases like 0.0.2-1 or 1.2.1-1 if any is available that fulfulls your version constraint.
If you want a pre-release you have to tighten the version constraint so that only the pre-release fulfills your constraints (like angular: '>=1.2.1')
pub upgrade may show an output like
analyzer 0.10.5 (9 newer versions available)
Which indicates that there are 9 prerelease builds available that are newer than the downloaded stable build.
The version constraint for your dependency needs to fulfill the version constraints of all your dependencies dependencies (E.g. if you add the dependencies observe and polymer where polymer depends on observe itself).
You can force pub get/pub upgrade to a version that violates your dependencies dependency by defining the dependency with a version constraint under dependencies_override: instead of dependencies: in pubspec.yaml.
You may also add dev_dependencies (e.g. unittest) which are only downloaded when they are defined in your package but ignored when they are only defined in one of your dependencies.
You see, this is an advanced topic even for seasoned Dart developers.
If you are a seasoned Dartisan, this question might seem so trivial to not be worth asking, but coming from a Java world (where my students and I are used to downloading .jars manually and then (sometimes) having to copy them over into our projects) it is a greenhorn question that is natural to ask. Here is the context: two days ago v0.9.5 of angular came out and so I made a mental note to upload the libraries in our local projects.
Well, it seems that all we need is an appropriately defined pubspec.yaml file, and the Dart pub package manager does the rest. In the Dart Editor, I guess that dependencies get updated on a project refresh or when it is (re-)built. In our projects we happened to have, e.g., a pubspec.yaml file like this:
name: angular_dart_demo
version: 0.0.1
dependencies:
angular: any
(as opposed to, say, angular: ">=0.9.0 <0.10.0") which allowed the Pub manager to go fetch the latest angular. Effortless. Nice.

Resources