Package org.apache.geronimo.kernel.repository

Examples of org.apache.geronimo.kernel.repository.Maven2Repository


        System.exit( (rs) ? 0 : 1 );
    }
   
    static boolean run(Command cmd, String geronimoHome, String[] args, OutputStream out) throws Exception {                       
        String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
        Maven2Repository mavenRepository = new Maven2Repository((new File(geronimoHome, repository)).getCanonicalFile());
        ArrayList<ListableRepository> repositories = new ArrayList<ListableRepository>(1);
        repositories.add(mavenRepository);

        JAXWSTools tools = new JAXWSTools();
        tools.setUseSunSAAJ();
View Full Code Here


       
        Collection repositories = null;
        ArtifactResolver artifactResolver = null;
        if (enableBootRepo) {
            String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
            Maven2Repository bootRepository = new Maven2Repository(new File(getBootDirectory(), repository));
            repositories = Collections.singleton(bootRepository);
            artifactResolver = new DefaultArtifactResolver(new DefaultArtifactManager(), bootRepository);
        } else {
            // a bootstrap configuration can not have any dependencies
            List dependencies = configurationData.getEnvironment().getDependencies();
View Full Code Here

       
        Collection repositories = null;
        ArtifactResolver artifactResolver = null;
        if (enableBootRepo) {
            String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
            Maven2Repository bootRepository = new Maven2Repository(new File(bootDirectory, repository));
            repositories = Collections.singleton(bootRepository);
            artifactResolver = new DefaultArtifactResolver(new DefaultArtifactManager(), bootRepository);
        } else {
            // a bootstrap configuration can not have any dependencies
            List dependencies = configurationData.getEnvironment().getDependencies();
View Full Code Here

            // User clicked on a repository remove
            String res = actionRequest.getParameter("res");
            actionResponse.setRenderParameter("mode", "remove");
            actionResponse.setRenderParameter("res", res);
           
            Maven2Repository repo = (Maven2Repository) PortletManager.getCurrentServer(actionRequest).getRepositories()[0];
            Artifact artifact = Artifact.create(res);
            File location = repo.getLocation(artifact);
            if (location == null) {
                addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.errorMsg26"));
                return;
            }
            if (location.isDirectory()) {
                addInfoMessage(actionRequest,getLocalizedString(actionRequest, "consolebase.infoMsg20"));
                return;
            }
            boolean result=location.delete();
            if(!result){//can not delete the file maybe the jar is using in the JVM
                addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.errorMsg25")+artifact.toString()+showReason(artifact));
                return;
            }else{//delete parent folder
                File versionDir=location.getParentFile();
                File[] contents=versionDir.listFiles();
                for(File content:contents){
                    if(!content.delete()){
                        addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.errorMsg25")+artifact.toString()+showReason(artifact));
                        return;
                    }
                }
                versionDir.delete();
                addInfoMessage(actionRequest,artifact.toString()+getLocalizedString(actionRequest,"consolebase.infoMsg19"));
                return;
           
            }
        }

        try {
            WriteableRepository repo = PortletManager.getCurrentServer(actionRequest).getWritableRepositories()[0];

            File uploadFile = null;
            File file = null;
            String name = null;
            String basename = null;
            String fileType = null;
            String artifact = null;
            String version = null;
            String group = null;
            String jarName = null;

            PortletFileUpload uploader = new PortletFileUpload(new DiskFileItemFactory());
            try {
                List items = uploader.parseRequest(actionRequest);
                for (Iterator i = items.iterator(); i.hasNext();) {
                    FileItem item = (FileItem) i.next();
                    if (!item.isFormField()) {
                        String fieldName = item.getFieldName().trim();
                        name = item.getName().trim();

                        if (name.length() == 0) {
                            file = null;
                        } else {
                            // IE sends full path while Firefox sends just basename
                            // in the case of "FullName" we may be able to infer the group
                            // Note, we can't use File.separatorChar because the file separator
                            // is dependent upon the client and not the server.
                            String fileChar = "\\";
                            int fileNameIndex = name.lastIndexOf(fileChar);
                            if (fileNameIndex == -1) {
                                fileChar = "/";
                                fileNameIndex = name.lastIndexOf(fileChar);
                            }
                            if (fileNameIndex != -1) {
                                basename = name.substring(fileNameIndex + 1);
                            } else {
                                basename = name;
                            }

                            // Create the temporary file to be used for import to the server
                            file = File.createTempFile("geronimo-import", "");
                            file.deleteOnExit();
                            log.debug("Writing repository import file to " + file.getAbsolutePath());
                        }

                        if ("local".equals(fieldName)) {
                            uploadFile = file;
                        }

                        if (file != null) {
                            try {
                                item.write(file);
                            } catch (Exception e) {
                                throw new PortletException(e);
                            }
                        }
                        // This is not the file itself, but one of the form fields for the URI
                    } else {
                        String fieldName = item.getFieldName().trim();
                        if ("group".equals(fieldName)) {
                            group = item.getString().trim();
                        } else if ("artifact".equals(fieldName)) {
                            artifact = item.getString().trim();
                        } else if ("version".equals(fieldName)) {
                            version = item.getString().trim();
                        } else if ("fileType".equals(fieldName)) {
                            fileType = item.getString().trim();
                        } else if ("jarName".equals(fieldName)) {
                            jarName = item.getString().trim();
                        }
                    }
                }
                if (jarName != null && jarName.length() > 0) {
                    ExplicitDefaultArtifactResolver instance = KernelRegistry.getSingleKernel().getGBean(ExplicitDefaultArtifactResolver.class);
                    Properties set = new Properties();
                    set.put(jarName, group + "/" + artifact + "/" + version + "/" + fileType);
                    instance.addAliases(set);
                }
                repo.copyToRepository(file, new Artifact(group, artifact, version, fileType), new FileWriteMonitor() {
                    public void writeStarted(String fileDescription, int fileSize) {
                        log.info("Copying into repository " + fileDescription + "...");
                    }

                    public void writeProgress(int bytes) {
View Full Code Here

    public void execute() throws MojoExecutionException, MojoFailureException {
        String path = getArtifactRepository().getBasedir();
        File baseDir = new File(path);

        ListableRepository repository = new Maven2Repository(baseDir);
        try {
            PluginListType pluginList = createPluginListForRepositories(repository,  path);
            File outFile = new File(baseDir, "geronimo-plugins.xml");
            Writer out = new FileWriter(outFile, false);
            try {
View Full Code Here

        resolveTmpDir(geronimoHome);
        // disable fastinfoset support
        System.setProperty("org.apache.cxf.nofastinfoset", "true");

        String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
        Maven2Repository bootRepository = new Maven2Repository(new File(geronimoHome, repository));
        Collection<Repository> repositories = Collections.<Repository>singleton(bootRepository);
        ArtifactResolver artifactResolver = new DefaultArtifactResolver(new DefaultArtifactManager(), bootRepository);
        RepositoryConfigurationStore repositoryStore = new RepositoryConfigurationStore(bootRepository);
        Collection<ConfigurationStore> repositoryStores = Collections.<ConfigurationStore>singleton(repositoryStore);
        SimpleConfigurationManager manager = new SimpleConfigurationManager(repositoryStores, artifactResolver, repositories);
View Full Code Here

        Collection repositories = null;
        ArtifactResolver artifactResolver = null;
        if (enableBootRepo) {
            String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
            Maven2Repository bootRepository = new Maven2Repository(new File(getBootDirectory(), repository));
            repositories = Collections.singleton(bootRepository);
            artifactResolver = new DefaultArtifactResolver(new DefaultArtifactManager(), bootRepository);
        } else {
            // a bootstrap configuration can not have any dependencies
            List dependencies = configurationData.getEnvironment().getDependencies();
View Full Code Here

        System.exit( (rs) ? 0 : 1 );
    }
   
    static boolean run(Command cmd, String geronimoHome, String[] args, OutputStream out) throws Exception {                       
        String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
        Maven2Repository mavenRepository = new Maven2Repository((new File(geronimoHome, repository)).getCanonicalFile());
        ArrayList<ListableRepository> repositories = new ArrayList<ListableRepository>(1);
        repositories.add(mavenRepository);

        JAXWSTools tools = new JAXWSTools();
        tools.setUseSunSAAJ();
View Full Code Here

            obr.getParentFile().mkdirs();
            Set<Artifact> artifacts = new HashSet<Artifact>();
            for (org.apache.maven.artifact.Artifact artifact: localDependencies) {
                artifacts.add(mavenToGeronimoArtifact(artifact));
            }
            Repository repo = new Maven2Repository(new File(getArtifactRepository().getBasedir()));
            GeronimoOBRGBean.generateOBR(project.getName(), artifacts, repo, obr);
        } catch (Exception e) {
            throw new MojoExecutionException("Could not construct obr repository.xml", e);
        }
    }
View Full Code Here

       
        Collection repositories = null;
        ArtifactResolver artifactResolver = null;
        if (enableBootRepo) {
            String repository = System.getProperty("Xorg.apache.geronimo.repository.boot.path", "repository");
            Maven2Repository bootRepository = new Maven2Repository(new File(getBootDirectory(), repository));
            repositories = Collections.singleton(bootRepository);
            artifactResolver = new DefaultArtifactResolver(new DefaultArtifactManager(), bootRepository);
        } else {
            // a bootstrap configuration can not have any dependencies
            List dependencies = configurationData.getEnvironment().getDependencies();
View Full Code Here

TOP

Related Classes of org.apache.geronimo.kernel.repository.Maven2Repository

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.