private static void setUserProperty( BundleDescription desc, String name, Object value ) { Object userObject = desc.getUserObject(); if ( userObject != null && !( userObject instanceof Map ) ) { throw new IllegalStateException( "Unexpected user object " + desc.toString() ); } Map props = (Map) userObject; if ( props == null ) { props = new HashMap(); desc.setUserObject( props ); } props.put( name, value ); }
public static BundleDescription createBundleDescription(Dictionary<String, String> enhancedManifest, File bundleLocation) { try { BundleDescription descriptor = StateObjectFactory.defaultFactory.createBundleDescription(null, enhancedManifest, bundleLocation == null ? null : bundleLocation.getAbsolutePath(), 1); //TODO Do we need to have a real bundle id descriptor.setUserObject(enhancedManifest); return descriptor; } catch (BundleException e) { String message = NLS.bind(Messages.exception_stateAddition, bundleLocation == null ? null : bundleLocation.getAbsoluteFile()); IStatus status = new Status(IStatus.WARNING, Activator.ID, message, e); LogHelper.log(status); return null; } }
public static BundleDescription createBundleDescription(Dictionary<String, String> enhancedManifest, File bundleLocation) { try { BundleDescription descriptor = StateObjectFactory.defaultFactory.createBundleDescription(null, enhancedManifest, bundleLocation == null ? null : bundleLocation.getAbsolutePath(), 1); //TODO Do we need to have a real bundle id descriptor.setUserObject(enhancedManifest); return descriptor; } catch (BundleException e) { String message = NLS.bind(Messages.exception_stateAddition, bundleLocation == null ? null : bundleLocation.getAbsoluteFile()); IStatus status = new Status(IStatus.WARNING, Activator.ID, message, e); LogHelper.log(status); return null; } }
public static BundleDescription createBundleDescription(Dictionary<String, String> enhancedManifest, File bundleLocation) { try { BundleDescription descriptor = StateObjectFactory.defaultFactory.createBundleDescription(null, enhancedManifest, bundleLocation == null ? null : bundleLocation.getAbsolutePath(), 1); //TODO Do we need to have a real bundle id descriptor.setUserObject(enhancedManifest); return descriptor; } catch (BundleException e) { String message = NLS.bind(Messages.exception_stateAddition, bundleLocation == null ? null : bundleLocation.getAbsoluteFile()); IStatus status = new Status(IStatus.WARNING, Activator.ID, message, e); LogHelper.log(status); return null; } }
public synchronized BundleLoaderProxy getLoaderProxy() { if (proxy != null) return proxy; BundleDescription bundleDescription = getBundleDescription(); if (bundleDescription == null) return null; proxy = new BundleLoaderProxy(this, bundleDescription); // Note that BundleLoaderProxy is a BundleReference // this is necessary to ensure the resolver can continue // to provide BundleRevision objects to resolver hooks. bundleDescription.setUserObject(proxy); return proxy; }
public synchronized BundleLoaderProxy getLoaderProxy() { if (proxy != null) return proxy; BundleDescription bundleDescription = getBundleDescription(); if (bundleDescription == null) return null; proxy = new BundleLoaderProxy(this, bundleDescription); // Note that BundleLoaderProxy is a BundleReference // this is necessary to ensure the resolver can continue // to provide BundleRevision objects to resolver hooks. bundleDescription.setUserObject(proxy); return proxy; }
BundleDescription bundleDescription = factory.createBundleDescription(factory.createState(false), manifest, artifact.getLocation().getAbsolutePath(), createId(sourceBundleSymbolicName, version)); bundleDescription.setUserObject(manifest); actions.add(new BundlesAction(new BundleDescription[] { bundleDescription }) { @Override
result.setUserObject(resource); GenericDescription[] genericDescs = result.getGenericCapabilities(); for (GenericDescription genericDesc : genericDescs) {
result.setUserObject(resource); GenericDescription[] genericDescs = result.getGenericCapabilities(); for (GenericDescription genericDesc : genericDescs) {
@Override boolean basicAddBundle(BundleDescription description) { if (framework != null && description.getUserObject() == null) { // We always set the user object to a BundleReference object; // This allows the resolver to implement BundleRevisions for // the resolver hooks. AbstractBundle bundle = framework.getBundle(description.getBundleId()); description.setUserObject(bundle != null ? bundle.getBundleData() : null); } return super.basicAddBundle(description); }
@Override boolean basicAddBundle(BundleDescription description) { if (framework != null && description.getUserObject() == null) { // We always set the user object to a BundleReference object; // This allows the resolver to implement BundleRevisions for // the resolver hooks. AbstractBundle bundle = framework.getBundle(description.getBundleId()); description.setUserObject(bundle != null ? bundle.getBundleData() : null); } return super.basicAddBundle(description); }
static public void closeBundleLoader(BundleLoaderProxy proxy) { if (proxy == null) return; // First close the BundleLoader BundleLoader loader = proxy.getBasicBundleLoader(); if (loader != null) loader.close(); proxy.setStale(); // if proxy is not null then make sure to unset user object // associated with the proxy in the state BundleDescription description = proxy.getBundleDescription(); // must set it back to the bundle object; not null // need to make sure the user object is a BundleReference description.setUserObject(proxy.getBundleData()); } }
static public void closeBundleLoader(BundleLoaderProxy proxy) { if (proxy == null) return; // First close the BundleLoader BundleLoader loader = proxy.getBasicBundleLoader(); if (loader != null) loader.close(); proxy.setStale(); // if proxy is not null then make sure to unset user object // associated with the proxy in the state BundleDescription description = proxy.getBundleDescription(); // must set it back to the bundle object; not null // need to make sure the user object is a BundleReference description.setUserObject(proxy.getBundleData()); } }
newDescription.setUserObject(bundleData); if (oldDescription == null) systemState.addBundle(newDescription);
newDescription.setUserObject(bundleData); if (oldDescription == null) systemState.addBundle(newDescription);