Package org.apache.geronimo.system.plugin.model

Examples of org.apache.geronimo.system.plugin.model.PluginType


    public void renderView(RenderRequest request, RenderResponse response, MultiPageModel model) throws PortletException, IOException {
        String configId = request.getParameter("configId");
        PluginInstaller pluginInstaller = ManagementHelper.getManagementHelper(request).getPluginInstaller();
        Artifact newArtifact = Artifact.create(configId)
        PluginType metadata = pluginInstaller.getPluginMetadata(newArtifact)
        PluginArtifactType instance = metadata.getPluginArtifact().get(0);
        request.setAttribute("configId", PluginInstallerGBean.toArtifact(instance.getModuleId()).toString());
        request.setAttribute("name", metadata.getName());
        request.setAttribute("repository", combine(instance.getSourceRepository()));
        request.setAttribute("category", metadata.getCategory());
        request.setAttribute("url", metadata.getUrl());
        request.setAttribute("author", metadata.getAuthor());
        request.setAttribute("description", metadata.getDescription());
        List<LicenseType> licenses = metadata.getLicense();
        if (licenses != null && licenses.size() > 0) {
            request.setAttribute("license", licenses.get(0).getValue());
            if (licenses.get(0).isOsiApproved()) {
                request.setAttribute("licenseOSI", "true");
            }
View Full Code Here


    }

    public String actionAfterView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
        String configId = request.getParameter("configId");
        PluginInstaller pluginInstaller = ManagementHelper.getManagementHelper(request).getPluginInstaller();
        PluginType metadata = pluginInstaller.getPluginMetadata(Artifact.create(configId));
        PluginArtifactType instance = metadata.getPluginArtifact().get(0);

        String name = request.getParameter("name");
        metadata.setName(name);
        metadata.setCategory(request.getParameter("category"));
        metadata.setUrl(request.getParameter("url"));
        metadata.setAuthor(request.getParameter("author"));
        metadata.setDescription(request.getParameter("description"));
        String licenseString = request.getParameter("license");
        String osi = request.getParameter("licenseOSI");
        List<LicenseType> licenses = metadata.getLicense();
        if (!licenses.isEmpty()) {
            licenses.remove(0);
        }
        if (licenseString != null && !licenseString.trim().equals("")) {
            LicenseType license = new LicenseType();
View Full Code Here

        cleanup();
    }


    private PluginType toPluginType(Artifact artifact) {
        PluginType plugin = new PluginType();
        PluginArtifactType instance = new PluginArtifactType();
        ArtifactType artifactType = PluginInstallerGBean.toArtifactType(artifact);
        instance.setModuleId(artifactType);
        plugin.getPluginArtifact().add(instance);
        return plugin;
    }
View Full Code Here

        if (defaultGeronimoRepository != null) {
            pluginListType.getDefaultRepository().add(defaultGeronimoRepository);
            defaultRepository = defaultGeronimoRepository;
        }
        pluginListType.getDefaultRepository().add(artifactRepository.getBasedir());
        PluginType pluginType = new PluginType();
        pluginListType.getPlugin().add(pluginType);
        PluginArtifactType instance = new PluginArtifactType();
        pluginType.getPluginArtifact().add(instance);
        ArtifactType artifactType = PluginInstallerGBean.toArtifactType(geronimoArtifact);
        instance.setModuleId(artifactType);

        GeronimoDeploymentManager mgr = getDeploymentManager2();
        Object key = mgr.startInstall(pluginListType, defaultRepository, false, null, null);
View Full Code Here

            "                    </environment:dependencies>\n" +
            "                </environment:environment>";

    public void testCopyConfig() throws Exception {
        InputStream in = new ByteArrayInputStream(CONFIG.getBytes());
        PluginType pluginType = PluginXmlUtil.loadPluginMetadata(in);
        List<GbeanType> gbeans = pluginType.getPluginArtifact().get(0).getConfigXmlContent().get(0).getGbean();
        assertEquals(2, gbeans.size());
        GBeanOverride override = new GBeanOverride(gbeans.get(0), new JexlExpressionParser());
        String attributeValue = override.getAttribute("defaultEnvironment");
       
        Document expectedDoc = DOMUtils.load(ATTRIBUTE_VALUE);
View Full Code Here

    protected File targetFile;

    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            InputStream min = new FileInputStream(targetFile);
            PluginType plugin;
            try {
                plugin = PluginXmlUtil.loadPluginMetadata(min);
            } finally {
                min.close();
            }
View Full Code Here

            throw new MojoExecutionException("Could not update plugin list", e);
        }
    }

    public void updatePluginList(PluginType plugin, PluginListType pluginList) throws NoSuchStoreException {
        PluginType key = PluginInstallerGBean.toKey(plugin);
        PluginArtifactType instance = plugin.getPluginArtifact().get(0);
        Artifact id = PluginInstallerGBean.toArtifact(instance.getModuleId());
        boolean foundKey = false;
        boolean foundModule = false;
        for (Iterator<PluginType> pit = pluginList.getPlugin().iterator(); pit.hasNext();) {
            PluginType test = pit.next();
            for (Iterator<PluginArtifactType> it = test.getPluginArtifact().iterator(); it.hasNext();) {
                PluginArtifactType testInstance = it.next();
                Artifact testId = PluginInstallerGBean.toArtifact(testInstance.getModuleId());
                if (id.equals(testId)) {
                    //if the module id appears anywhere, remove that instance
                    //however, this would cause plugin without plugin artifact
                    it.remove();
                    foundModule = true;
                }
            }
            PluginType testKey = PluginInstallerGBean.toKey(test);
            if (key.equals(testKey)) {
                foundKey = true;
                //if the name, category, author, description, pluginGroup, licence, url match, then add this instance to current pluginType
                test.getPluginArtifact().add(instance);
            }
View Full Code Here

    public PluginListType createPluginListForRepositories(ListableRepository repository, String repoName) throws NoSuchStoreException {
        Map<PluginType, PluginType> pluginMap = new HashMap<PluginType, PluginType>();
        SortedSet<Artifact> configs = repository.list();
        for (Artifact configId : configs) {
            PluginType data = getPluginMetadata(repository, configId);

            if (data != null) {
                PluginType key = PluginInstallerGBean.toKey(data);
                PluginType existing = pluginMap.get(key);
                if (existing == null) {
                    pluginMap.put(key, data);
                } else {
                    existing.getPluginArtifact().addAll(data.getPluginArtifact());
                }
            }
        }
        PluginListType pluginList = new PluginListType();
        pluginList.getPlugin().addAll(pluginMap.values());
View Full Code Here

                if (entry == null) {
                    return null;
                }
                InputStream in = jar.getInputStream(entry);
                try {
                    PluginType pluginType = PluginXmlUtil.loadPluginMetadata(in);
                    if (pluginType.getPluginArtifact().isEmpty()) {
                        return null;
                    }
                    return pluginType;
                } finally {
                    in.close();
View Full Code Here

        boolean allInstallable = true;
        // see if the plugin is installable.  if not then provide the details
        String validationOk = "All requirements for this plugin have been met.";
        for (PluginInfoBean plugin : plugins) {
            StringBuilder validationNotOk = new StringBuilder();
            PluginType holder = PluginInstallerGBean.copy(plugin.getPlugin(), plugin.getPluginArtifact());
            try {
                plugin.setInstallable(pluginInstaller.validatePlugin(holder));
            } catch (Exception e) {
                plugin.setInstallable(false);
                validationNotOk.append(e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.geronimo.system.plugin.model.PluginType

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.