@Override public final int getStartLevel() { checkValid(); return this.startlevel; }
boolean removeRevision(ModuleRevision revision) { try { synchronized (monitor) { return revisions.remove(revision); } } finally { module.cleanup(revision); } }
ResolutionReport resolve() { if (!Module.RESOLVED_SET.contains(module.getState())) { return module.getContainer().resolve(Arrays.asList(module), true); } return null; }
revisions.getContainer().checkAdminPermission(getBundle(), AdminPermission.EXECUTE); if (options == null) { options = new StartOptions[0]; setTrigger(); if (stateChangeLock.getHoldCount() > 0 && stateTransitionEvents.contains(ModuleEvent.STARTED)) { lockStateChange(ModuleEvent.STARTED); try { lockedStarted = true; checkValid(); if (StartOptions.TRANSIENT_IF_AUTO_START.isContained(options) && !settings.contains(Settings.AUTO_START)) { checkFragment(); persistStartOptions(options); if (getStartLevel() > getRevisions().getContainer().getStartLevel()) { if (StartOptions.TRANSIENT.isContained(options)) { throw new BundleException(Msg.Module_Transient_StartError, BundleException.START_TRANSIENT_ERROR); if (State.ACTIVE.equals(getState())) return; if (getState().equals(State.INSTALLED)) { unlockStateChange(ModuleEvent.STARTED); lockedStarted = false; ResolutionReport report; try { inStartResolve.set(Boolean.TRUE); report = getRevisions().getContainer().resolve(Arrays.asList(this), true);
revisions.getContainer().checkAdminPermission(getBundle(), AdminPermission.EXECUTE); if (options == null) options = new StopOptions[0]; ModuleEvent event; BundleException stopError = null; lockStateChange(ModuleEvent.STOPPED); try { checkValid(); checkFragment(); persistStopOptions(options); if (!Module.ACTIVE_SET.contains(getState())) return; try { event = doStop(); } catch (BundleException e) { stopError = e; unlockStateChange(ModuleEvent.STOPPED); if (!ModuleEvent.STOPPED.equals(event)) throw new IllegalStateException("Wrong event type: " + event); //$NON-NLS-1$ publishEvent(event);
protected BundleEntry findBundleEntry(URL url, Module module) throws IOException { ModuleRevision revision = module.getCurrentRevision(); BundleInfo.Generation revisionInfo = (BundleInfo.Generation) revision.getRevisionInfo(); BundleEntry entry = revisionInfo == null ? null : revisionInfo.getBundleFile().getEntry(url.getPath()); if (entry == null) throw new FileNotFoundException(url.getPath()); return entry; } }
private void setTrigger() { ModuleLoader loader = getCurrentLoader(); if (loader != null) { loader.getAndSetTrigger(); } }
@Override public Bundle getBundle() { return module.getBundle(); }
public boolean hasAuthority(Class<?> clazz) { Bundle b = FrameworkUtil.getBundle(clazz); if (!(b instanceof EquinoxBundle)) { return false; } return (container.getStorage().getModuleContainer() == ((EquinoxBundle) b).getModule().getContainer()); }
final void setStartLevel(Module module, int startlevel) { writeLock(); try { module.checkValid(); module.storeStartLevel(startlevel); incrementTimestamps(false); } finally { writeUnlock(); } }
revisions.getContainer().checkAdminPermission(getBundle(), AdminPermission.EXECUTE); if (options == null) { options = new StartOptions[0]; setTrigger(); if (stateChangeLock.getHoldCount() > 0 && stateTransitionEvents.contains(ModuleEvent.STARTED)) { lockStateChange(ModuleEvent.STARTED); lockedStarted = true; checkValid(); if (StartOptions.TRANSIENT_IF_AUTO_START.isContained(options) && !settings.contains(Settings.AUTO_START)) { checkFragment(); persistStartOptions(options); if (getStartLevel() > getRevisions().getContainer().getStartLevel()) { if (StartOptions.TRANSIENT.isContained(options)) { if (State.ACTIVE.equals(getState())) return; if (getState().equals(State.INSTALLED)) { ResolutionReport report; unlockStateChange(ModuleEvent.STARTED); lockedStarted = false; try { report = getRevisions().getContainer().resolve(Collections.singletonList(this), true); } finally { lockStateChange(ModuleEvent.STARTED); lockedStarted = true;
revisions.getContainer().checkAdminPermission(getBundle(), AdminPermission.EXECUTE); if (options == null) options = new StopOptions[0]; ModuleEvent event; BundleException stopError = null; lockStateChange(ModuleEvent.STOPPED); try { checkValid(); checkFragment(); persistStopOptions(options); if (!Module.ACTIVE_SET.contains(getState())) return; try { event = doStop(); } catch (BundleException e) { stopError = e; unlockStateChange(ModuleEvent.STOPPED); if (!ModuleEvent.STOPPED.equals(event)) throw new IllegalStateException("Wrong event type: " + event); //$NON-NLS-1$ publishEvent(event);
private void checkFragment() throws BundleException { ModuleRevision current = getCurrentRevision(); if ((current.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) { throw new BundleException(Msg.Module_Fragment_InvalidOperation, BundleException.INVALID_OPERATION); } }
ResolutionReport resolve() { if (!Module.RESOLVED_SET.contains(module.getState())) { return module.getContainer().resolve(Arrays.asList(module), true); } return null; }
private void setTrigger() { ModuleLoader loader = getCurrentLoader(); if (loader != null) { loader.getAndSetTrigger(); } }
protected boolean checkAuthorization(Module module) { SecurityManager sm = System.getSecurityManager(); if (sm == null) return true; Bundle bundle = module == null ? null : module.getBundle(); if (bundle == null) return false; sm.checkPermission(new AdminPermission(bundle, AdminPermission.RESOURCE)); return true; }
public boolean hasAuthority(Class<?> clazz) { Bundle b = FrameworkUtil.getBundle(clazz); if (!(b instanceof EquinoxBundle)) { return false; } return (container.getStorage().getModuleContainer() == ((EquinoxBundle) b).getModule().getContainer()); }