Examples of PluginType


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

    }

    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

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

        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) {
            StringBuffer validationNotOk = new StringBuffer();
            PluginType holder = PluginInstallerGBean.copy(plugin.getPlugin(), plugin.getPluginArtifact());
            try {
                pluginInstaller.validatePlugin(holder);
            } catch (Exception e) {
                plugin.setInstallable(false);
                validationNotOk.append(e.getMessage());
View Full Code Here

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

                plugin.setPlugin(metadata);
                plugin.setPluginArtifact(artifact);

                if (validate) {
                    // determine if the plugin is installable
                    PluginType holder = PluginInstallerGBean.copy(metadata, artifact);
                    try {
                        pluginInstaller.validatePlugin(holder);
                    } catch (Exception e) {
                        plugin.setInstallable(false);
                    }
View Full Code Here

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

     * since maven will not merge them correctly.  Actually we have to fish this out of the model since maven mangles the xml for us.
     */
//    private PlexusConfiguration instance;
    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            PluginType metadata = new PluginType();
            metadata.setName(project.getName());
            metadata.setAuthor(project.getOrganization() == null? "unknown": project.getOrganization().getName());
            metadata.setUrl(project.getOrganization() == null? "unknown": project.getOrganization().getUrl());
            metadata.setDescription(project.getDescription());
            metadata.setCategory(category);
            metadata.setPluginGroup(pluginGroup);

            if (project.getLicenses() != null) {
                for (Object licenseObj : project.getLicenses()) {
                    License license = (License) licenseObj;
                    LicenseType licenseType = new LicenseType();
                    licenseType.setValue(license.getName());
                    licenseType.setOsiApproved(osiApproved);
                    metadata.getLicense().add(licenseType);
                }
            }

            PluginArtifactType instance;
            Plugin plugin = (Plugin) project.getModel().getBuild().getPluginsAsMap().get("org.apache.geronimo.buildsupport:car-maven-plugin");
            if (plugin == null) {
                throw new Error("Unable to resolve car plugin");
            }

            Xpp3Dom dom;
            if (plugin.getExecutions().isEmpty()) {
                dom = (Xpp3Dom) plugin.getConfiguration();
            } else {
                if (plugin.getExecutions().size() > 1) {
                    throw new IllegalStateException("Cannot determine correct configuration for PluginMetadataGeneratorMojo: " + plugin.getExecutionsAsMap().keySet());
                }
                dom = (Xpp3Dom) ((PluginExecution) plugin.getExecutions().get(0)).getConfiguration();
            }
            Xpp3Dom instanceDom = dom.getChild("instance");

            if (instanceDom == null || instanceDom.getChild("plugin-artifact") == null) {
                instance = new PluginArtifactType();
            } else {
                String instanceString = instanceDom.getChild("plugin-artifact").toString();
                instance = PluginXmlUtil.loadPluginArtifactMetadata(new StringReader(instanceString.replace("#{", "${")));
            }
            if (this.commonInstance != null && this.commonInstance.getChild("plugin-artifact") != null) {
                PluginArtifactType commonInstance = PluginXmlUtil.loadPluginArtifactMetadata(new StringReader(this.commonInstance.getChild("plugin-artifact").toString().replace("#{", "${")));
                //merge
                if (instance.getArtifactAlias().isEmpty()) {
                    instance.getArtifactAlias().addAll(commonInstance.getArtifactAlias());
                }
                if (instance.getConfigSubstitution().isEmpty()) {
                    instance.getConfigSubstitution().addAll(commonInstance.getConfigSubstitution());
                }
                //it doesn't make sense to copy a "generic" config.xml content into a specific module.
    //            if ((instance.getConfigXmlContent() == null || instance.getConfigXmlContent().getGbean().isEmpty())
    //                    && (commonInstance.getConfigXmlContent() != null && !commonInstance.getConfigXmlContent().getGbean().isEmpty())) {
    //                instance.setConfigXmlContent(new ConfigXmlContentType());
    //                instance.getConfigXmlContent().getGbean().addAll(commonInstance.getConfigXmlContent().getGbean());
    //            }
                if (instance.getCopyFile().isEmpty()) {
                    instance.getCopyFile().addAll(commonInstance.getCopyFile());
                }
                if (instance.getDependency().isEmpty()) {
                    instance.getDependency().addAll(commonInstance.getDependency());
                }
                if (instance.getGeronimoVersion().isEmpty()) {
                    instance.getGeronimoVersion().addAll(commonInstance.getGeronimoVersion());
                }
                if (instance.getJvmVersion().isEmpty()) {
                    instance.getJvmVersion().addAll(commonInstance.getJvmVersion());
                }
                if (instance.getObsoletes().isEmpty()) {
                    instance.getObsoletes().addAll(commonInstance.getObsoletes());
                }
                if (instance.getPrerequisite().isEmpty()) {
                    instance.getPrerequisite().addAll(commonInstance.getPrerequisite());
                }
                if (instance.getSourceRepository().isEmpty()) {
                    instance.getSourceRepository().addAll(commonInstance.getSourceRepository());
                }
            }
            metadata.getPluginArtifact().add(instance);

            ArtifactType artifactType = getModuleId();
            ArtifactType existingArtifact = instance.getModuleId();
            if (existingArtifact != null && existingArtifact.getType() != null) {
                artifactType.setType(existingArtifact.getType());
View Full Code Here

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

    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

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

            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

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

    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

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

                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

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

     * @param moduleId Identifies the configuration.  This must match a
     *                 configuration currently installed in the local server.
     *                 The configId must be fully resolved (isResolved() == true)
     */
    public PluginType getPluginMetadata(Artifact moduleId) {
        PluginType type = localSourceRepository.extractPluginMetadata(moduleId);
        if (null == type) {
            try {
                type = createDefaultMetadata(moduleId);
            } catch (InvalidConfigException e) {
                log.warn("Unable to generate metadata for " + moduleId, e);
View Full Code Here

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

     * @param poller                      monitor for reporting progress
     */
    public void install(File carFile, String defaultRepository, boolean restrictToDefaultRepository, String username, String password, DownloadPoller poller) {
        try {
            // 1. Extract the configuration metadata
            PluginType data = GeronimoSourceRepository.extractPluginMetadata(carFile);
            if (data == null) {
                log.error("Invalid Configuration Archive " + carFile.getAbsolutePath() + " no plugin metadata found");
                throw new IllegalArgumentException(
                        "Invalid Configuration Archive " + carFile.getAbsolutePath() + " no plugin metadata found");
            }

            // 2. Validate that we can install this
            validatePlugin(data);
            verifyPrerequisites(data);
           
            PluginArtifactType instance = data.getPluginArtifact().get(0);
            // 3. Install the CAR into the repository (it shouldn't be re-downloaded)
            if (instance.getModuleId() != null) {
                Artifact pluginArtifact = toArtifact(instance.getModuleId());
                ResultsFileWriteMonitor monitor = new ResultsFileWriteMonitor(poller);
                writeableRepo.copyToRepository(carFile, pluginArtifact, monitor);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.