Package org.apache.geronimo.kernel.repository

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


    }

    public void execute() throws MissingDependencyException, IOException {
        Artifact configId = new Artifact(groupId, artifactId, version, type);
        Repository sourceRepository = new Maven1Repository(sourceRepositoryFile);
        WriteableRepository targetRepository = new Maven2Repository(targetRepositoryFile);
        if (!sourceRepository.contains(configId)) {
            throw new MissingDependencyException("source repository at " + sourceRepositoryFile + " does not contain artifact " + configId);
        }
        if (!targetRepository.contains(configId)) {
            File sourceFile = sourceRepository.getLocation(configId);
            targetRepository.copyToRepository(sourceFile, configId, BaseConfigInstaller.LOG_COPY_START);
        }
    }
View Full Code Here


                    break;
                }
            }
            if(found != null) {
                data.jars = new String[] {found.getRepositoryURI()};
                WriteableRepository repo = PortletManager.getCurrentServer(actionRequest).getWritableRepositories()[0];
                final PortletSession session = actionRequest.getPortletSession();
                ProgressInfo progressInfo = new ProgressInfo();
                progressInfo.setMainMessage("Downloading " + found.getName());
                session.setAttribute(ProgressInfo.PROGRESS_INFO_KEY, progressInfo, PortletSession.APPLICATION_SCOPE);
                // Start the download monitoring
View Full Code Here

                    break;
                }
            }
            if (found != null) {
                data.jars = new String[]{found.getRepositoryURI()};
                WriteableRepository repo = PortletManager.getCurrentServer(actionRequest).getWritableRepositories()[0];
                final PortletSession session = actionRequest.getPortletSession();
                ProgressInfo progressInfo = new ProgressInfo();
                progressInfo.setMainMessage("Downloading " + found.getName());
                session.setAttribute(ProgressInfo.PROGRESS_INFO_KEY, progressInfo, PortletSession.APPLICATION_SCOPE);
                // Start the download monitoring
View Full Code Here

        try {


            List list = new ArrayList();
            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

        }
        else if (!repositoryDirectory.isDirectory()) {
            throw new MojoExecutionException("Invalid reposiory directory: " + repositoryDirectory);
        }

        WriteableRepository repository = new Maven2Repository(repositoryDirectory);

        // Install all of the artifacts we were asked to...
        for (int i=0; i<artifacts.length; i++) {
            Artifact artifact = getArtifact(artifacts[i]);
            log.info("Installing: " + artifact);

            org.apache.geronimo.kernel.repository.Artifact gartifact = mavenArtifactToGeronimo(artifact);
            if (repository.contains(gartifact)) {
                if (force) {
                    File file = repository.getLocation(gartifact);
                    log.debug("Force deletion of: " + file);

                    if (!file.delete()) {
                        throw new MojoExecutionException("Failed to delete artifact from repository: " + artifacts[i]);
                    }
                }
                else {
                    throw new MojoExecutionException("Artifact already exists in repository: " + artifacts[i]);
                }
            }

            repository.copyToRepository(artifact.getFile(), gartifact, null);
        }
    }
View Full Code Here

                    break;
                }
            }
            if (found != null) {
                data.jars = new String[]{found.getRepositoryURI()};
                WriteableRepository repo = PortletManager.getCurrentServer(actionRequest).getWritableRepositories()[0];
                final PortletSession session = actionRequest.getPortletSession();
                ProgressInfo progressInfo = new ProgressInfo();
                progressInfo.setMainMessage("Downloading " + found.getName());
                session.setAttribute(ProgressInfo.PROGRESS_INFO_KEY, progressInfo, PortletSession.APPLICATION_SCOPE);
                // Start the download monitoring
View Full Code Here

        }

        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

                    break;
                }
            }
            if (found != null) {
                data.jars = new String[]{found.getRepositoryURI()};
                WriteableRepository repo = PortletManager.getCurrentServer(actionRequest).getWritableRepositories()[0];
                final PortletSession session = actionRequest.getPortletSession();
                ProgressInfo progressInfo = new ProgressInfo();
                progressInfo.setMainMessage("Downloading " + found.getName());
                session.setAttribute(ProgressInfo.PROGRESS_INFO_KEY, progressInfo, PortletSession.APPLICATION_SCOPE);
                // Start the download monitoring
View Full Code Here

                    break;
                }
            }
            if (found != null) {
                data.jars = new String[]{found.getRepositoryURI()};
                WriteableRepository repo = PortletManager.getCurrentServer(actionRequest).getWritableRepositories()[0];
                final PortletSession session = actionRequest.getPortletSession();
                ProgressInfo progressInfo = new ProgressInfo();
                progressInfo.setMainMessage("Downloading " + found.getName());
                session.setAttribute(ProgressInfo.PROGRESS_INFO_KEY, progressInfo, PortletSession.APPLICATION_SCOPE);
                // Start the download monitoring
View Full Code Here

        try {


            List list = new ArrayList();
            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;

            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();
                        }
                    }
                }


                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

TOP

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

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.