當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。