karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: Issue in the code - help requested
Date Fri, 16 Jul 2010 11:53:37 GMT
Are you sure they aren't added to the map ? I don't see how that could not work.

On Fri, Jul 16, 2010 at 11:02, Charles Moulliard <cmoulliard@gmail.com> wrote:
> Hi,
>
> In debug mode, I see that something is wrong in my code :
>
> public class FeaturesServiceImpl implements FeaturesService {
> ...
>
>    protected static class InstallationState {
>        final Set<Bundle> installed = new HashSet<Bundle>();
>        final List<Bundle> bundles = new ArrayList<Bundle>();
>        final Map<Long, BundleInfo> bundleInfos = new HashMap<Long,
> BundleInfo>();
>        final Map<Feature, Set<Long>> features = new HashMap<Feature,
> Set<Long>>();
>    }
>
>   protected void doInstallFeature(InstallationState state, Feature feature)
> throws Exception {
> ...
>        Set<Long> bundles = new TreeSet<Long>();
>        for (BundleInfo bInfo : resolve(feature)) {
>            Bundle b = installBundleIfNeeded(state, bInfo);
>            bundles.add(b.getBundleId());
>            state.bundleInfos.put(b.getBundleId(), bInfo);
>        }
>        state.features.put(feature, bundles);
>    }
>
>    public void installFeatures(Set<Feature> features, EnumSet<Option>
> options) throws Exception {
>        InstallationState state = new InstallationState();
>        InstallationState failure = new InstallationState();
>        try {
>            // Install everything
>            for (Feature f : features) {
>                InstallationState s = new InstallationState();
>                try {
>                    doInstallFeature(s, f);
>                     state.bundles.addAll(s.bundles); // Ok --> ArrayList
of
> BundleImpl is well copied in state.bundles
>                     state.bundleInfos.putAll(s.bundleInfos); // NOK -->
> HashMap of s.bundleInfos is not copied to state.bundleInfos and
> s.bundleInfos contains well in the HashMap BundleInfo objects
>                     ...
>                } catch (Exception e) {
>
> What is wrong in the java code (the fact that we use a HashMap defined in
> InstallationState to copy it from object s to object state, ...) ?
>
> Help is welcome ?
>
> Kind regards,
>
>
> Charles Moulliard
>
> Senior Enterprise Architect (J2EE, .NET, SOA)
> Apache Camel - ServiceMix Committer
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Blog : http://cmoulliard.blogspot.com |  Twitter :
> http://twitter.com/cmoulliard
> Linkedin : http://www.linkedin.com/in/charlesmoulliard | Skype: cmoulliard
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Mime
View raw message