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

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


        }
        return treeListFile;
    }

    private PluginArtifactType toPluginArtifactType(Collection<DependencyType> dependencies) throws IOException, XMLStreamException, JAXBException {
        PluginArtifactType pluginArtifactType = new PluginArtifactType();
        for (DependencyType dependency: dependencies) {
            pluginArtifactType.getDependency().add(dependency);
        }
        return pluginArtifactType;
    }
View Full Code Here


        assertEquals(1, list.getDefaultRepository().size());
        assertEquals(fakeRepo, list.getDefaultRepository().get(0));
        assertTrue(list.getPlugin().size() > 0);
        int prereqCount = 0;
        for (PluginType metadata: list.getPlugin()) {
            PluginArtifactType instance = metadata.getPluginArtifact().get(0);
            prereqCount += instance.getPrerequisite().size();
//            for (PrerequisiteType prerequisite: instance.getPrerequisite()) {
//                assertFalse(prerequisite.getId());
//            }
        }
        assertTrue(prereqCount > 0);
View Full Code Here

            "                            <config-substitution key=\"providerURL\">ou=system</config-substitution>\n" +
            "                        </plugin-artifact>";
   
    public void testReadNoNS() throws Exception {
        Reader in = new StringReader(INSTANCE);
        PluginArtifactType instance = PluginXmlUtil.loadPluginArtifactMetadata(in);
        assertEquals("DirectoryService", instance.getConfigXmlContent().get(0).getGbean().get(0).getName());
        assertEquals("default", instance.getConfigXmlContent().get(0).getServer());
    }
View Full Code Here

            "                                            </environment:dependencies>\n" +
            "                                        </environment:environment>";
   
    public void testXmlAttribute() throws Exception {
        Reader in = new StringReader(INSTANCE2);
        PluginArtifactType instance = PluginXmlUtil.loadPluginArtifactMetadata(in);
        List<GbeanType> gbeans = instance.getConfigXmlContent().get(0).getGbean();
        assertEquals(3, gbeans.size());
        List contents = gbeans.get(0).getAttributeOrReference();
        assertEquals(2, contents.size());
        AttributeType attr = (AttributeType) contents.get(1);
        String value = AttributesXmlUtil.extractAttributeValue(attr);
View Full Code Here

        }
    }

    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;
View Full Code Here

            " <config-substitution key=\"key1\">value1</config-substitution>\n" +
            "</plugin-artifact>";

    //TODO test #{ to ${ replacement
    public void testReadInstance() throws Exception {
        PluginArtifactType instance = PluginXmlUtil.loadPluginArtifactMetadata(new StringReader(INSTANCE1));
        assertEquals(2, instance.getConfigSubstitution().size());
    }
View Full Code Here

    public void updatePluginMetadata(Bundle bundle) {
        Long bundleId = bundle.getBundleId();
        dependentBundleIdsMap.remove(bundleId);
        fullDependentBundleIdsMap.remove(bundleId);
        pluginMap.remove(bundleId);
        PluginArtifactType pluginArtifactType = getCachedPluginMetadata(bundle);
        if (pluginArtifactType != null) {
            List<DependencyType> dependencies = pluginArtifactType.getDependency();
            Set<Long> dependentBundleIds = new HashSet<Long>();
            Set<Long> fullDependentBundleIds = new HashSet<Long>();
            try {
                for (DependencyType dependencyType : dependencies) {
                    Artifact artifact = dependencyType.toArtifact();
View Full Code Here

            }
        }
    }

    private PluginArtifactType getPluginMetadata(Bundle bundle) {
        PluginArtifactType pluginArtifactType = null;
        InputStream in = null;
        try {
            URL info = bundle.getEntry("META-INF/geronimo-plugin.xml");
            if (info != null) {
                if (log.isDebugEnabled()) {
View Full Code Here

    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");
            }
            if (licenses.size() > 1) {
                log.warn(
                        "Unable to edit plugin metadata containing more than one license!  Additional license data will not be editable.");
            }
        }
        //Choose the first geronimo-versions element and set the config version element to that version number.
        List<String> gerVers = instance.getGeronimoVersion();
        if (gerVers != null && gerVers.size() > 0) {
            request.setAttribute("geronimoVersion", gerVers.get(0));
        }
        request.setAttribute("jvmVersions", combine(instance.getJvmVersion()));
        request.setAttribute("dependencies", toString(instance.getDependency()));
        request.setAttribute("obsoletes", toString(instance.getObsoletes()));
        List<PrerequisiteType> reqs = instance.getPrerequisite();
        if (reqs != null && reqs.size() > 0) {
            int i = 1;
            for (PrerequisiteType prereq: reqs) {
                String prefix = "prereq" + i;
                request.setAttribute(prefix, PluginInstallerGBean.toArtifact(prereq.getId()).toString());
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();
            license.setValue(licenseString.trim());
            license.setOsiApproved(osi != null && !osi.equals(""));
            licenses.add(0, license);
        }

        String jvmsString = request.getParameter("jvmVersions");
        split(jvmsString, instance.getJvmVersion());

        String deps = request.getParameter("dependencies");
        toDependencies(split(deps), instance.getDependency());

        String obsoletes = request.getParameter("obsoletes");
        toArtifacts(split(obsoletes), instance.getObsoletes());

        String repo = request.getParameter("repository");
        split(repo, instance.getSourceRepository());

        //TODO this is wrong, we are only supplying one version to the UI
        String version = request.getParameter("geronimoVersion");
        split(version, instance.getGeronimoVersion());

        List<PrerequisiteType> prereqs = instance.getPrerequisite();
        //TODO this is probably wrong if # of prereqs is changed.
        for (int i = 0; i < 3 && !prereqs.isEmpty(); i++) {
            prereqs.remove(0);
        }
        int counter = 1;
View Full Code Here

TOP

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

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.