Package org.apache.geronimo.kernel.repository

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


                    break;
                }
            }
            if(found != null) {
                DriverDownloader downloader = new DriverDownloader();
                WriteableRepository repo = PortletManager.getWritableRepositories(actionRequest)[0];
                try {
                    downloader.loadDriver(repo, found, new FileWriteMonitor() {
                        public void writeStarted(String fileDescription) {
                            System.out.println("Downloading "+fileDescription);
                        }
View Full Code Here


        try {



            List list = new ArrayList();
            WriteableRepository repo = PortletManager.getWritableRepositories(actionRequest)[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();
                        }
                    }
                }

                String uri = group + "/" + artifact + "/" + version + "/" + fileType;

                repo.copyToRepository(file, new URI(uri), new FileWriteMonitor() {
                    public void writeStarted(String fileDescription) {
                        System.out.print("Copying into repository "+fileDescription+"...");
                        System.out.flush();
                    }
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

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.