当前位置: 首页>>代码示例>>Java>>正文


Java BundleEvent.getBundle方法代码示例

本文整理汇总了Java中org.osgi.framework.BundleEvent.getBundle方法的典型用法代码示例。如果您正苦于以下问题:Java BundleEvent.getBundle方法的具体用法?Java BundleEvent.getBundle怎么用?Java BundleEvent.getBundle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.framework.BundleEvent的用法示例。


在下文中一共展示了BundleEvent.getBundle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
public @Override void bundleChanged(BundleEvent event) {
        Bundle bundle = event.getBundle();
        switch (event.getType()) {
        case BundleEvent.STARTED:
//            System.err.println("started " + bundle.getSymbolicName());
            Dictionary<?,?> headers = bundle.getHeaders();
            load(queue.offer(bundle, provides(headers), requires(headers), needs(headers)));
            break;
        case BundleEvent.STOPPED:
//            System.err.println("stopped " + bundle.getSymbolicName());
            if (framework.getState() == Bundle.STOPPING) {
//                System.err.println("fwork stopping during " + bundle.getSymbolicName());
//                ActiveQueue.stop();
            } else {
                unload(queue.retract(bundle));
            }
            break;
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Activator.java

示例2: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
@Override
public void bundleChanged(BundleEvent event) {
    logger.debug("Bundle changed: {}", event);
    if (stopped) {
        return;
    }
    Bundle bundle = event.getBundle();
    if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
        // The bundle is not in STARTING or ACTIVE state anymore
        // so destroy the bundleContext. Ignore our own bundle since it
        // needs to kick the orderly shutdown.
        if (bundle != this.bundleContext.getBundle()) {
            destroyExtension(bundle);
        }
    }
}
 
开发者ID:ANierbeck,项目名称:Karaf-Vertx,代码行数:17,代码来源:Activator.java

示例3: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
@Override
public void bundleChanged(BundleEvent event) {
    Bundle bundle = event.getBundle();
    try {
        PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
        carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);

        if (event.getType() == BundleEvent.STARTED) {
            addUIPermissionFromBundle(bundle);
        }
    } catch (Exception e) {
        log.error("Error occured when processing component xml in bundle " +
                bundle.getSymbolicName(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:17,代码来源:ManagementPermissionsAdder.java

示例4: handleEvent

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
protected void handleEvent(BundleEvent event) {

			Bundle bundle = event.getBundle();

			switch (event.getType()) {
				case BundleEvent.STARTED: {
					maybeAddNamespaceHandlerFor(bundle);
					break;
				}
				case BundleEvent.STOPPED: {
					maybeRemoveNameSpaceHandlerFor(bundle);
					break;
				}
				default:
					break;
			}
		}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:18,代码来源:ContextLoaderListener.java

示例5: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
@Override
public void bundleChanged(BundleEvent event) {

	Bundle bundle = event.getBundle();

	if (!bundleManager.isRegisterable(job, bundle.getSymbolicName()))
		return;

	switch (event.getType()) {

	case BundleEvent.STARTED:
		bundleManager.register(job, bundle.getSymbolicName());
		break;

	case BundleEvent.STOPPED:
		bundleManager.unregister(job, bundle.getSymbolicName());
		break;

	default:
		break;
	}
}
 
开发者ID:asupdev,项目名称:asup,代码行数:23,代码来源:E4BundleListener.java

示例6: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void bundleChanged(BundleEvent bundleEvent) {
    final Bundle bundle = bundleEvent.getBundle();
    final String bundleName = bundle.getSymbolicName();
    if (bundleName != null && shouldProcessBundle(bundle)) {
        switch (bundleEvent.getType()) {
        case BundleEvent.STARTED:
            LOG.debug("The bundlde " + bundleName
                    + " has been activated and will be scanned for struts configuration");
            loadConfigFromBundle(bundle);
            break;
        case BundleEvent.STOPPED:
            onBundleStopped(bundle);
            break;
        default:
            break;
        }
    }
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:23,代码来源:OsgiConfigurationProvider.java

示例7: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
@Override
public void bundleChanged(BundleEvent event) {
	
	Bundle bundle = event.getBundle();
	if (this.debug==true) {
		String symbolicName = bundle.getSymbolicName();
		String type = this.getBundleEventAsString(event);
		System.out.println(this.getClass().getSimpleName() + "#bundleChanged(event): " + symbolicName + ", event.type: " + type);
	}
	
	// --- Make sure that only external bundles will be considered ------------------
	if (bundle.getSymbolicName().equals(PLUGIN_ID)==false) {
		switch (event.getType()) {
		case BundleEvent.STARTED:
			// --- Start searching for specific classes with the BundleEvaluator ----
			BundleEvaluator.getInstance().setBundleAdded(bundle);
			break;
			
		case BundleEvent.STOPPED:
			// --- Remove search results from the BundleEvaluator -------------------
			BundleEvaluator.getInstance().setBundleRemoved(bundle);
			break;

		default:
			break;
		}
	}
			
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:30,代码来源:PlugInActivator.java

示例8: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
@Override
public void bundleChanged(BundleEvent event) {
    switch (event.getType()) {
        case BundleEvent.INSTALLED:
        case BundleEvent.UPDATED:
            Message msg = Message.obtain();
            msg.obj = event.getBundle();
            mHandler.sendMessageDelayed(msg,3000);
            break;
        case BundleEvent.STARTED:
        case BundleEvent.STOPPED:
        case BundleEvent.UNINSTALLED:
            break;
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:16,代码来源:SecurityHandler.java

示例9: handleEvent

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
protected void handleEvent(BundleEvent event) {
    Bundle bundle = event.getBundle();

    switch (event.getType()) {

        case BundleEvent.RESOLVED:
            if (resolved) {
                this.namespaceHandlerActivator.maybeAddNamespaceHandlerFor(bundle, false);
            }
            break;

        case LAZY_ACTIVATION_EVENT_TYPE: {
            if (!resolved) {
                push(bundle);
                this.namespaceHandlerActivator.maybeAddNamespaceHandlerFor(bundle, true);
            }
            break;
        }
        case BundleEvent.STARTED: {
            if (!resolved) {
                if (!pop(bundle)) {
                    this.namespaceHandlerActivator.maybeAddNamespaceHandlerFor(bundle, false);
                }
            }
            break;
        }
        case BundleEvent.STOPPED: {
            pop(bundle);
            this.namespaceHandlerActivator.maybeRemoveNameSpaceHandlerFor(bundle);
            break;
        }
        default:
            break;
    }
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:36,代码来源:NamespaceBundleLister.java

示例10: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
public void bundleChanged(BundleEvent event) {
    Bundle bundle = event.getBundle();
    if (event.getType() == BundleEvent.RESOLVED) {
        checkBundle(bundle);
    } else if (event.getType() == BundleEvent.STARTED) {
        checkBundleScriptEngines(bundle);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:9,代码来源:Extender.java

示例11: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
/**
 * <code>BundleListener</code> method for the <code>BundleTracker</code>
 * class. This method must NOT be synchronized to avoid deadlock
 * potential.
 * 
 * @param event <code>BundleEvent</code> object from the framework.
 */
public void bundleChanged(final BundleEvent event) {
    /*
     * Check if we had a delayed call (which could happen when we
     * close).
     */
    if (closed) {
        return;
    }
    final Bundle bundle = event.getBundle();
    final int state = bundle.getState();
    if (DEBUG) {
        System.out.println("BundleTracker.Tracked.bundleChanged[" + state + "]: " + bundle);
    }

    if ((state & mask) != 0) {
        track(bundle, event);
        /*
         * If the customizer throws an unchecked exception, it is safe
         * to let it propagate
         */
    } else {
        untrack(bundle, event);
        /*
         * If the customizer throws an unchecked exception, it is safe
         * to let it propagate
         */
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:36,代码来源:BundleTracker.java

示例12: exists

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
boolean exists(String bundleName) {
    for (int i = 0; i < eventList.size(); i++) {
        BundleEvent fe = (BundleEvent) eventList.get(i);
        Bundle b = fe.getBundle();
        System.out.println("===[" + b + "]");
        if (bundleName.equals(b.getSymbolicName())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:12,代码来源:CheckingBundleListener.java

示例13: exists

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
boolean exists(String bundleName) {
  for (int i = 0; i < eventList.size(); i++) {
    BundleEvent fe = (BundleEvent) eventList.get(i);
    Bundle b = fe.getBundle();
    System.out.println("===["+b+"]");
    if (bundleName.equals(b.getSymbolicName())) {
      return true;
    }
  }
  return false;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:12,代码来源:CheckingBundleListener.java

示例14: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
/**
 * Invoked, when an event about bundle change is received. In case a new bundle gets installed
 * or an existing bundle is updated, we need to scan that bundle for MDS annotations and process them.
 *
 * @param event BundleEvent, generated by the OSGi framework
 */
@Override
public void bundleChanged(BundleEvent event) {
    final Bundle bundle = event.getBundle();

    final int eventType = event.getType();

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Bundle event of type {} received from {}: {} -> {}", OsgiStringUtils.nullSafeBundleEventToString(event.getType()),
                bundle.getSymbolicName(), String.valueOf(eventType), String.valueOf(bundle.getState()));
    }

    handleBundleEvent(bundle, eventType);
}
 
开发者ID:motech,项目名称:motech,代码行数:20,代码来源:MdsBundleWatcher.java

示例15: bundleChanged

import org.osgi.framework.BundleEvent; //导入方法依赖的package包/类
public void bundleChanged(BundleEvent event) {
    Bundle bundle = event.getBundle();
    if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
        // The bundle is not in STARTING or ACTIVE state anymore
        // so destroy the context.  Ignore our own bundle since it
        // needs to kick the orderly shutdown.
        if (bundle != _context.getBundle()) {
            destroyExtension(bundle);
        }
    }
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:12,代码来源:AbstractExtender.java


注:本文中的org.osgi.framework.BundleEvent.getBundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。