本文整理汇总了Java中org.osgi.framework.BundleEvent.INSTALLED属性的典型用法代码示例。如果您正苦于以下问题:Java BundleEvent.INSTALLED属性的具体用法?Java BundleEvent.INSTALLED怎么用?Java BundleEvent.INSTALLED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.osgi.framework.BundleEvent
的用法示例。
在下文中一共展示了BundleEvent.INSTALLED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: stopBundle
public synchronized void stopBundle() throws BundleException {
if (this.state == BundleEvent.INSTALLED) {
throw new IllegalStateException("Cannot stop uninstalled bundle "
+ toString());
} else if (this.state == BundleEvent.RESOLVED) {
this.state = BundleEvent.UNINSTALLED;
try {
if (Framework.DEBUG_BUNDLES && log.isInfoEnabled()) {
log.info("Framework: Bundle " + toString() + " stopped.");
}
Framework.clearBundleTrace(this);
this.state = BundleEvent.STOPPED;
Framework.notifyBundleListeners(BundleEvent.STOPPED, this);
isValid = false;
} catch (Throwable th) {
Framework.clearBundleTrace(this);
this.state = BundleEvent.STOPPED;
Framework.notifyBundleListeners(BundleEvent.STOPPED, this);
isValid = false;
}
}
}
示例3: uninstall
@Override
public synchronized void uninstall() throws BundleException {
if (this.state == BundleEvent.INSTALLED) {
throw new IllegalStateException("Bundle " + toString() + " is already uninstalled.");
}
if (this.state == BundleEvent.RESOLVED) {
try {
stopBundle();
} catch (Throwable th) {
Framework.notifyFrameworkListeners(BundleEvent.STARTED, this, th);
}
}
this.state = BundleEvent.INSTALLED;
new File(this.bundleDir, "meta").delete();
this.classloader.cleanup(true);
this.classloader = null;
Framework.bundles.remove(this);
Framework.notifyBundleListeners(BundleEvent.UNINSTALLED, this);
isValid = false;
}
示例4: shutdown
static void shutdown(boolean restart) {
System.out.println("---------------------------------------------------------");
System.out.println(" ACDD OSGi shutting down ...");
System.out.println(" Bye !");
System.out.println("---------------------------------------------------------");
systemBundle.state = BundleEvent.UNINSTALLED;
systemBundle.setLevel(getBundles().toArray(new Bundle[bundles.size()]), 0, true);
bundles.clear();
systemBundle.state = BundleEvent.INSTALLED;
if (restart) {
try {
startup();
} catch (Throwable th) {
th.printStackTrace();
}
}
}
示例5: 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 + " ???";
}
}
示例6: 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;
}
}
示例7: 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;
}
}
示例8: bundleChanged
@SuppressLint("NewApi") @Override
public void bundleChanged(final BundleEvent event){
switch (event.getType()) {
case 0:/* LOADED */
loaded(event.getBundle());
break;
case BundleEvent.INSTALLED:
//todo 注意主dex bundle
installed(event.getBundle());
break;
case BundleEvent.UPDATED:
updated(event.getBundle());
break;
case BundleEvent.UNINSTALLED:
uninstalled(event.getBundle());
break;
case BundleEvent.STARTED:
if(isLewaOS()){
if(Looper.myLooper() == null){
Looper.prepare();
}
started(event.getBundle());
}else{
started(event.getBundle());
}
break;
case BundleEvent.STOPPED:
stopped(event.getBundle());
break;
}
}
示例9: bundleChanged
@Override
public void bundleChanged(BundleEvent event) {
int mask = BundleEvent.INSTALLED | BundleEvent.RESOLVED | BundleEvent.UNRESOLVED | BundleEvent.UPDATED | BundleEvent.UNINSTALLED;
if ((mask & event.getType()) > 0) {
invalidateAllUnits(String.format("Bundle %s entered state %s", event.getBundle().getSymbolicName(), bundleEventToString(event.getType())));
}
}
示例10: bundleEventToString
private static String bundleEventToString(int type) {
String s;
switch (type) {
case BundleEvent.INSTALLED:
s = "INSTALLED";
break;
case BundleEvent.RESOLVED:
s = "RESOLVED";
break;
case BundleEvent.STARTING:
s = "STARTING";
break;
case BundleEvent.STARTED:
s = "STARTED";
break;
case BundleEvent.STOPPING:
s = "STOPPING";
break;
case BundleEvent.STOPPED:
s = "STOPPED";
break;
case BundleEvent.UNRESOLVED:
s = "UNRESOLVED";
break;
case BundleEvent.UPDATED:
s = "UPDATED";
break;
case BundleEvent.UNINSTALLED:
s = "UNINSTALLED";
break;
case BundleEvent.LAZY_ACTIVATION:
s = "LAZY_ACTIVATION";
break;
default:
s = "UNKNOWN";
}
return s;
}
示例11: bundleChanged
public void bundleChanged(BundleEvent bundleEvent) {
switch (bundleEvent.getType()) {
case BundleEvent.INSTALLED:
case BundleEvent.UPDATED:
Message obtain = Message.obtain();
obtain.obj = bundleEvent.getBundle().getLocation();
this.mSecurityCheckHandler.sendMessage(obtain);
return;
default:
return;
}
}
示例12: getResource
@Override
public URL getResource(String name) {
if (this.state != BundleEvent.INSTALLED) {
return this.classloader.getResource(name);
}
throw new IllegalStateException("Bundle " + toString()
+ " has been uninstalled");
}
示例13: hasPermission
@Override
public boolean hasPermission(Object permission) {
if (this.state != BundleEvent.INSTALLED) {
return true;
}
throw new IllegalStateException("Bundle " + toString()
+ "has been unregistered.");
}
示例14: update
@Override
public synchronized void update(InputStream inputStream)
throws BundleException {
if (this.state == BundleEvent.INSTALLED) {
throw new IllegalStateException("Cannot update uninstalled bundle "
+ toString());
}
try {
this.archive
.newRevision(this.location, this.bundleDir, inputStream);
} catch (Throwable e) {
throw new BundleException("Could not update bundle " + toString(),
e);
}
}
示例15: getBundleStartLevel
@Override
public int getBundleStartLevel(Bundle bundle) {
if (bundle == this) {
return 0;
}
BundleImpl bundleImpl = (BundleImpl) bundle;
if (bundleImpl.state != BundleEvent.INSTALLED) {
return bundleImpl.currentStartlevel;
}
throw new IllegalArgumentException("Bundle " + bundle + " has been uninstalled");
}