Package com.atlassian.plugin

Examples of com.atlassian.plugin.ModuleDescriptor


    }

    @Test
    public void testPureSpeakeasyInvalidDescriptor()
    {
        ModuleDescriptor descriptor = mock(ModuleDescriptor.class);
        when(descriptor.getKey()).thenReturn("bar");
        when(plugin.getModuleDescriptors()).thenReturn(Lists.<ModuleDescriptor<?>>newArrayList(descriptor));
        assertFalse(tryKey("foo"));
    }
View Full Code Here


    }

    @Test
    public void testPureSpeakeasyScreenshotDescriptor()
    {
        ModuleDescriptor descriptor = mock(ModuleDescriptor.class);
        when(descriptor.getKey()).thenReturn("screenshot");
        when(plugin.getModuleDescriptors()).thenReturn(Lists.<ModuleDescriptor<?>>newArrayList(descriptor));
        assertTrue(tryKey("foo"));
    }
View Full Code Here

    private Set<ServiceRegistration> registerEachModuleDescriptor()
    {
        Set<ServiceRegistration> registrations = new HashSet<ServiceRegistration>();
        for (String id : modules.getModuleIds())
        {
            ModuleDescriptor webResourceModuleDescriptor = descriptor.createIndividualModuleDescriptor();

            Element root = createElement("web-resource");
            Element dep = root.addElement("dependency");
            dep.setText(descriptor.getCompleteKey() + "-modules");
            JsDoc jsDoc = modules.getModule(id).getJsDoc();
            addAnnotatedContext(root, jsDoc);
            Element jsTransform = getJsTransformation(root);
            Element trans = jsTransform.addElement("transformer");
            trans.addAttribute("key", "commonjs-module-entry");
            trans.addAttribute("moduleId", id);
            trans.addAttribute("fullModuleKey", descriptor.getCompleteKey());

            Element res = root.addElement("resource");
            res.addAttribute("type", "download");
            res.addAttribute("name", id + ".js");
            res.addAttribute("location", modules.getModulePath(id));

            webResourceModuleDescriptor.init(descriptor.getPlugin(), createDescriptorElement(id, root));

            ServiceRegistration reg =
                    pluginBundle.getBundleContext().registerService(ModuleDescriptor.class.getName(), webResourceModuleDescriptor, null);
            registrations.add(reg);
        }
View Full Code Here

        return root;
    }

    private ServiceRegistration registerBatchedModulesDescriptor()
    {
        ModuleDescriptor webResourceModuleDescriptor = descriptor.createIndividualModuleDescriptor();

        Element root = createElement("web-resource");
        for (Element child : new HashSet<Element>(descriptor.getOriginalElement().elements()))
        {
            root.add(child.createCopy());
        }
        Element depElement = root.addElement("dependency");
        depElement.setText("com.atlassian.labs.speakeasy-plugin:yabble");
        Element jsTransform = getJsTransformation(root);
        Element trans = jsTransform.addElement("transformer");
        trans.addAttribute("key", "commonjs-module");
        trans.addAttribute("fullModuleKey", descriptor.getCompleteKey());

        for (String id : modules.getModuleIds())
        {
            Element res = root.addElement("resource");
            res.addAttribute("type", "download");
            res.addAttribute("name", id + ".js");
            res.addAttribute("location", modules.getModulePath(id));
            JsDoc jsDoc = modules.getModule(id).getJsDoc();
            addAnnotatedDependencies(root, descriptor.getPluginKey(), jsDoc);
        }


        for (String dep : resolvedExternalModules)
        {
            Element extDep = root.addElement("dependency");
            extDep.setText(dep);
        }
       
        for (String resourcePath : modules.getResources())
        {
            Element res = root.addElement("resource");
            res.addAttribute("type", "download");
            res.addAttribute("name", resourcePath);
            res.addAttribute("location", descriptor.getLocation() + "/" + resourcePath);
        }

        Element muTrans = root.addElement("transformation");
        muTrans.addAttribute("extension", "mu");
        trans = muTrans.addElement("transformer");
        trans.addAttribute("key", "template");

        String generatedModuleKey = descriptor.getKey() + "-modules";

        Element cssTrans = root.addElement("transformation");
        cssTrans.addAttribute("extension", "css");
        trans = cssTrans.addElement("transformer");
        trans.addAttribute("key", "cssVariables");
        trans.addAttribute("fullModuleKey", descriptor.getPluginKey() + ":" + generatedModuleKey);
       
        webResourceModuleDescriptor.init(descriptor.getPlugin(),
                createDescriptorElement(generatedModuleKey, root));
        return pluginBundle.getBundleContext().registerService(ModuleDescriptor.class.getName(), webResourceModuleDescriptor, null);
    }
View Full Code Here

  }

  @PluginEventListener
  public void onModuleDisabled(PluginModuleDisabledEvent event) {
    if (event == null) return;
    ModuleDescriptor module = event.getModule();
    if (module == null) return;
    Plugin plugin = module.getPlugin();
    if (plugin == null) return;
    if (myPluginKey.equals(plugin.getKey()) && myModuleKey.equals(module.getKey())) {
      stop();
    }
  }
View Full Code Here

  }

  @PluginEventListener
  public void onModuleDisabled(PluginModuleDisabledEvent event) {
    if (event == null) return;
    ModuleDescriptor module = event.getModule();
    if (module == null) return;
    Plugin plugin = module.getPlugin();
    if (plugin == null) return;
    if (myPluginKey.equals(plugin.getKey()) && myModuleKey.equals(module.getKey())) {
      stop();
    }
  }
View Full Code Here

TOP

Related Classes of com.atlassian.plugin.ModuleDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.