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


Java BundleEvent.STARTED属性代码示例

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


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

示例1: bundleChanged

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,代码行数:19,代码来源:Activator.java

示例2: BundleImpl

BundleImpl(File file) throws Exception {
    long currentTimeMillis = System.currentTimeMillis();
    DataInputStream dataInputStream = new DataInputStream(new FileInputStream(new File(file, "meta")));
    this.location = dataInputStream.readUTF();
    this.currentStartlevel = dataInputStream.readInt();
    this.persistently = dataInputStream.readBoolean();
    dataInputStream.close();

    this.bundleDir = file;
    this.state = BundleEvent.STARTED;
    try {
        this.archive = new BundleArchive(this.location, file);
        resolveBundle(false);
        Framework.bundles.put(this.location, this);
        Framework.notifyBundleListeners(BundleEvent.INSTALLED, this);
        if (Framework.DEBUG_BUNDLES && log.isInfoEnabled()) {
            log.info("Framework: Bundle " + toString() + " loaded. " + (System.currentTimeMillis() - currentTimeMillis) + " ms");
        }
    } catch (Exception e) {
        throw new BundleException("Could not load bundle " + this.location, e.getCause());
    }
}
 
开发者ID:bunnyblue,项目名称:ACDD,代码行数:22,代码来源:BundleImpl.java

示例3: startBundle

public synchronized void startBundle() throws BundleException {
    if (this.state == BundleEvent.INSTALLED) {
        throw new IllegalStateException("Cannot start uninstalled bundle "
                + toString());
    } else if (this.state != BundleEvent.RESOLVED) {
        if (this.state == BundleEvent.STARTED) {
            resolveBundle(true);
        }
        this.state = BundleEvent.UPDATED;
        try {

            isValid = true;
            this.state = BundleEvent.RESOLVED;
            Framework.notifyBundleListeners(BundleEvent.STARTED, this);
            if (Framework.DEBUG_BUNDLES && log.isInfoEnabled()) {
                log.info("Framework: Bundle " + toString() + " started.");
            }
        } catch (Throwable th) {

            Framework.clearBundleTrace(this);
            this.state = BundleEvent.STOPPED;
            String msg = "Error starting bundle " + toString();
            log.error(msg,th);
        }
    }
}
 
开发者ID:bunnyblue,项目名称:ACDD,代码行数:26,代码来源:BundleImpl.java

示例4: bundleChanged

@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,代码行数:16,代码来源:ManagementPermissionsAdder.java

示例5: bundleChanged

@Override
public void bundleChanged(BundleEvent bundleEvent) {
    if (providerBaseClassName == null || objectMapperClassName == null) {
        return;
    }

    if (bundleEvent.getBundle().getState() == Bundle.UNINSTALLED) return;

    Set<String> classNamesOfCurrentBundle = JacksonManagerService.getClassNames(bundleEvent.getBundle());

    if (classNamesOfCurrentBundle.contains(objectMapperClassName) || classNamesOfCurrentBundle.contains(providerBaseClassName)) {
        if (bundleEvent.getType() == BundleEvent.STARTED && isValid()) {
            jacksonServiceController = true;
        }
        if (bundleEvent.getType() == BundleEvent.STOPPED) {
            jacksonServiceController = false;
        }
    }
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:19,代码来源:JacksonJaxrsProvider.java

示例6: bundleChanged

@Override
public void bundleChanged(BundleEvent bundleEvent) {
    if (moduleClassNames == null) {
        return;
    }


    Set<String> classNamesOfCurrentBundle = JacksonManagerService.getClassNames(bundleEvent.getBundle());

    boolean found = false;
    for (String className : moduleClassNames) {
        if (classNamesOfCurrentBundle.contains(className)) {
            found = true;
            break;
        }
    }
    if (found) {
        if (bundleEvent.getType() == BundleEvent.STARTED && isValid()) {
            jacksonServiceController = true;
        }
        if (bundleEvent.getType() == BundleEvent.STOPPED) {
            jacksonServiceController = false;
        }
    }
}
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:25,代码来源:JacksonModulesProvider.java

示例7: getBundleEventTypeText

private String getBundleEventTypeText(int type) {
    switch (type) {
        case BundleEvent.INSTALLED:
            return "Installed";
        case BundleEvent.RESOLVED:
            return "Resolved";
        case BundleEvent.LAZY_ACTIVATION:
            return "Lazy Activation";
        case BundleEvent.STARTING:
            return "Starting";
        case BundleEvent.STARTED:
            return "Started";
        case BundleEvent.STOPPING:
            return "Stopping";
        case BundleEvent.STOPPED:
            return "Stopped";
        case BundleEvent.UPDATED:
            return "Updated";
        case BundleEvent.UNRESOLVED:
            return "Unresolved";
        case BundleEvent.UNINSTALLED:
            return "Uninstalled";
        default:
            return type + " ???";
        }
}
 
开发者ID:vorburger,项目名称:ch.vorburger.minecraft.osgi,代码行数:26,代码来源:LoggingBundleListener.java

示例8: bundleChanged

/**
 *
 * @param event
 */
@Override
public void bundleChanged(BundleEvent event) {
    switch (event.getType()) {
        case BundleEvent.STARTED:
            if(isBundleEligible(event.getBundle())) {
                m_classLoader.addBundle(event.getBundle());
            }
            break;
        case BundleEvent.STOPPED:
            if(isBundleEligible(event.getBundle())) {
                m_classLoader.removeBundle(event.getBundle());
            }
            break;
    }
}
 
开发者ID:lburgazzoli,项目名称:lb-karaf,代码行数:19,代码来源:CombinedClassLoaderHelper.java

示例9: handleEvent

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,代码行数:17,代码来源:ContextLoaderListener.java

示例10: bundleChanged

@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,代码行数:22,代码来源:E4BundleListener.java

示例11: bundleChanged

/**
 * {@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,代码行数:22,代码来源:OsgiConfigurationProvider.java

示例12: bundleChanged

@Override
public void bundleChanged(final BundleEvent event) {
    switch (event.getType()) {
        // FIXME: STARTING instead of STARTED?
        case BundleEvent.STARTED:
            scanBundleForPlugins(event.getBundle());
            break;

        case BundleEvent.STOPPING:
            stopBundlePlugins(event.getBundle());
            break;

        default:
            break;
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:16,代码来源:Activator.java

示例13: bundleChanged

@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,代码行数:29,代码来源:PlugInActivator.java

示例14: getBundleEventAsString

/**
 * Returns the specified bundle event as string.
 * @param event the bundle event
 * @return the bundle event as string
 */
private String getBundleEventAsString(BundleEvent event) {
	
	if (event == null) return "null";
	
	int type = event.getType();
	switch (type) {
	case BundleEvent.INSTALLED:
		return "INSTALLED";
	case BundleEvent.LAZY_ACTIVATION:
		return "LAZY_ACTIVATION";
	case BundleEvent.RESOLVED:
		return "RESOLVED";
	case BundleEvent.STARTED:
		return "STARTED";
	case BundleEvent.STARTING:
		return "STARTING";
	case BundleEvent.STOPPED:
		return "STOPPED";
	case BundleEvent.UNINSTALLED:
		return "UNINSTALLED";
	case BundleEvent.UNRESOLVED:
		return "UNRESOLVED";
	case BundleEvent.UPDATED:
		return "UPDATED";
	default:
		return "unknown event type: " + type;
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:33,代码来源:PlugInActivator.java

示例15: bundleChanged

@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,代码行数:15,代码来源:SecurityHandler.java


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