Search in sources :

Example 1 with OsgiBundleApplicationContextEvent

use of org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent in project karaf by apache.

the class SpringStateService method getState.

public BundleState getState(Bundle bundle) {
    OsgiBundleApplicationContextEvent event = states.get(bundle.getBundleId());
    BundleState state = mapEventToState(event);
    return (bundle.getState() != Bundle.ACTIVE) ? BundleState.Unknown : state;
}
Also used : OsgiBundleApplicationContextEvent(org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent) BundleState(org.apache.karaf.bundle.core.BundleState)

Example 2 with OsgiBundleApplicationContextEvent

use of org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent in project karaf by apache.

the class SpringStateService method getDiag.

public String getDiag(Bundle bundle) {
    OsgiBundleApplicationContextEvent event = states.get(bundle.getBundleId());
    if (event == null) {
        return null;
    }
    StringBuilder message = new StringBuilder();
    Date date = new Date(event.getTimestamp());
    SimpleDateFormat df = new SimpleDateFormat();
    message.append(df.format(date) + "\n");
    if (event instanceof BootstrappingDependencyEvent) {
        message.append(getServiceInfo((BootstrappingDependencyEvent) event));
    }
    Throwable ex = getException(event);
    if (ex != null) {
        message.append("Exception: \n");
        addMessages(message, ex);
    }
    return message.toString();
}
Also used : OsgiBundleApplicationContextEvent(org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) BootstrappingDependencyEvent(org.springframework.osgi.extender.event.BootstrappingDependencyEvent)

Aggregations

OsgiBundleApplicationContextEvent (org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 BundleState (org.apache.karaf.bundle.core.BundleState)1 BootstrappingDependencyEvent (org.springframework.osgi.extender.event.BootstrappingDependencyEvent)1