@Override public void onReceive(Context context, Intent intent) { ExtensionManager extensionManager = ExtensionManager.getInstance(context); if (extensionManager.cleanupExtensions()) { LOGD(TAG, "Extension cleanup performed and action taken."); Intent widgetUpdateIntent = new Intent(context, DashClockService.class); widgetUpdateIntent.setAction(DashClockService.ACTION_UPDATE_WIDGETS); context.startService(widgetUpdateIntent); } // If this is a replacement or change in the package, update all active extensions from // this package. String action = intent.getAction(); if (Intent.ACTION_PACKAGE_CHANGED.equals(action) || Intent.ACTION_PACKAGE_REPLACED.equals(action)) { String packageName = intent.getData().getSchemeSpecificPart(); if (TextUtils.isEmpty(packageName)) { return; } List<ComponentName> activeExtensions = extensionManager.getActiveExtensionNames(); for (ComponentName cn : activeExtensions) { if (packageName.equals(cn.getPackageName())) { Intent extensionUpdateIntent = new Intent(context, DashClockService.class); extensionUpdateIntent.setAction(DashClockService.ACTION_UPDATE_EXTENSIONS); extensionUpdateIntent.putExtra( DashClockService.EXTRA_COMPONENT_NAME, cn.flattenToShortString()); context.startService(extensionUpdateIntent); } } } }
public void initialize() { this.sourceType = ExtensionManager.getInstance().getType(this.sourceTypeName); if (this.sourceType == null) throw new RuntimeException("Unknown source type '" + this.sourceType + "'"); this.resultType = ExtensionManager.getInstance().getType(this.resultTypeName); if (this.resultType == null) throw new RuntimeException("Unknown result type '" + this.resultType + "'"); for (Parameter par : this.parameter) { par.setType(ExtensionManager.getInstance().getType(par.getTypeName())); if (par.getType() == null) throw new RuntimeException("Unknown parameter type '" + this.resultType + "'"); } }
public void postPurge(Session session, String fldPath) throws AccessDeniedException, RepositoryException, PathNotFoundException, DatabaseException { log.debug("postPurge({}, {})", new Object[] {session, fldPath}); try { ExtensionManager em = ExtensionManager.getInstance(); List<FolderExtension> col = em.getPlugins(FolderExtension.class); Collections.sort(col, new OrderComparator<FolderExtension>()); for (FolderExtension ext : col) { log.debug("Extension class: {}", ext.getClass().getCanonicalName()); ext.postPurge(session, fldPath); } } catch (ServiceConfigurationError e) { log.error(e.getMessage(), e); } }
public void postCopy(XASession session, Ref<Node> refSrcFolderNode, Ref<Node> refNewFolderNode) throws AccessDeniedException, RepositoryException, PathNotFoundException, ItemExistsException, IOException, DatabaseException, UserQuotaExceededException { log.debug("postCopy({}, {}, {})", new Object[] {session, refSrcFolderNode, refNewFolderNode}); try { ExtensionManager em = ExtensionManager.getInstance(); List<FolderExtension> col = em.getPlugins(FolderExtension.class); Collections.sort(col, new OrderComparator<FolderExtension>()); for (FolderExtension ext : col) { log.debug("Extension class: {}", ext.getClass().getCanonicalName()); ext.postCopy(session, refSrcFolderNode, refNewFolderNode); } } catch (ServiceConfigurationError e) { log.error(e.getMessage(), e); } }