Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
This file is part of the Eclipse Virgo project. Copyright (c) 2011 copyright_holder All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: cgfrost - initial contribution /
package org.eclipse.virgo.kernel.model.internal;
StandardSpringContextAccessor avoids issues of multiple Spring frameworks being present by not using any spring types.

Concurrent Semantics
Thread-safe

    
    private static final String APPLICATION_CONTEXT_CLASS_NAME = "org.springframework.context.ApplicationContext";
    
    
    @Override
    public boolean isSpringPowered(@NonNull Bundle bundle){
        BundleContext bundleContext = bundle.getBundleContext();
        if (bundleContext != null) {
            String symbolicName = bundle.getSymbolicName();
            try {
                ServiceReference<?>[] refs = bundleContext.getAllServiceReferences("(Bundle-SymbolicName=" + symbolicName + ")");
                if (refs != null && refs.length > 0) {
                    return true;
                }
            } catch (InvalidSyntaxException e) {
                Assert.isFalse(true"Unexpected exception %s"e.getMessage());
            }
        }
        return false;      
    }
    
New to GrepCode? Check out our FAQ X