Package org.evolizer.versioncontrol.svn.importer.exceptions

Examples of org.evolizer.versioncontrol.svn.importer.exceptions.SVNImporterException


        if (isContinuation) {
            LOGGER.info(ImporterMessages.EvolizerSVNImporter_startingUpdate);
            fMonitor.subTask(ImporterMessages.EvolizerSVNImporter_startingUpdate);
            fBeginImport = fModelMapper.getLastRevisionNum();
            if (fBeginImport == -1) {
                throw new SVNImporterException(ImporterMessages.EvolizerSVNImporter_noHistoryYet);
            }
            if (fConnector.getLatestRevision() == fBeginImport) {
                throw new SVNImporterException(ImporterMessages.EvolizerSVNImporter_historyUpToDate);
            }
            fModelMapper.restoreContents(fTags);
        } else {
            LOGGER.info(ImporterMessages.EvolizerSVNImporter_startingImport);
            fMonitor.subTask(ImporterMessages.EvolizerSVNImporter_startingImport);
        }
        // Now I create the representation
        // I try to import the history and save into an instance of a Version Control model
        try {
            createRepresentation(isContinuation);
        } catch (SVNException e) {
            // If it fails, if it was due to some common network problems, I try to resume the import for as many times
            // as the user requested
            if (e.getMessage().contains(ImporterMessages.EvolizerSVNImporter_svnReset)
                    || e.getMessage().contains(ImporterMessages.EvolizerSVNImporter_svnTimeOut)
                    || e.getMessage().contains(ImporterMessages.EvolizerSVNImporter_svnWaiting)
                    && fFailureCount <= fMaxFailures) {
                while (++fFailureCount <= fMaxFailures) {
                    LOGGER.error(NLS.bind(ImporterMessages.EvolizerSVNImporter_importError, fCurrRev, fSVNBaseURL)
                            + NLS.bind(ImporterMessages.EvolizerSVNImporter_resuming, fFailureCount, fMaxFailures) + e);
                    try {
                        this.resumeImport();
                        break;
                    } catch (SVNException e2) {
                        if (e2.getMessage().contains(ImporterMessages.EvolizerSVNImporter_svnReset)
                                || e2.getMessage().contains(ImporterMessages.EvolizerSVNImporter_svnTimeOut)
                                || e2.getMessage().contains(ImporterMessages.EvolizerSVNImporter_svnWaiting)) {
                            if (fFailureCount + 1 > fMaxFailures) {
                                LOGGER.error(NLS.bind(
                                        ImporterMessages.EvolizerSVNImporter_importError,
                                        fCurrRev,
                                        fSVNBaseURL)
                                        + ImporterMessages.EvolizerSVNImporter_stopImport, e2);
                                throw new SVNImporterException(NLS.bind(
                                        ImporterMessages.EvolizerSVNImporter_networkProbs,
                                        fSVNBaseURL,
                                        fCurrRev), e2);
                            }
                        } else {
                            throw e2;
                        }
                    }
                }
            } else {
                throw new SVNImporterException(NLS.bind(
                        ImporterMessages.EvolizerSVNImporter_networkProbs,
                        fSVNBaseURL,
                        fCurrRev), e);
            }
View Full Code Here


        fMonitor.subTask(NLS.bind(ImporterMessages.EvolizerSVNImporter_performingRollback, fCurrRev));
        SVNLogEntry entry = null;
        try {
            entry = fConnector.getRevision(fCurrRev);
        } catch (NoSuchElementException e) {
            throw new SVNImporterException(NLS.bind(
                    ImporterMessages.EvolizerSVNImporter_problemResumingFromRevision,
                    fCurrRev));
        }
        /*
         * I proceed to clean up the data of the last revision found, so I don't run into inconsistencies.
View Full Code Here

                                r.setSource(contents);
                                persistenceProvider.update(r);
                            }
                        }
                    } catch (NumberFormatException e) {
                        throw new SVNImporterException(NLS.bind(
                                ImporterMessages.EvolizerSVNImporter_invalidRevisionNumber,
                                r.getNumber()));
                    }
                    /*
                     *  now we can release the revision to the garbage
                     *  collector, since it was made persistent.
                     */
                    revisionsArray[i] = null;

                    if ((i % 24 == 0) && (i != 0)) {
                        persistenceProvider.flush();
                        persistenceProvider.clear();
                    }
                    i++;
                }
                persistenceProvider.flush();
                persistenceProvider.clear();
                persistenceProvider.endTransaction();
                fMonitor.worked(1);
            }

            fConnector.disconnectSVN();
            LOGGER.info(ImporterMessages.EvolizerSVNImporter_disconnected);
        } catch (SVNException e) {
            throw new SVNImporterException(ImporterMessages.EvolizerSVNImporter_connectionProbs, e);
        }
        fMonitor.done();
    }
View Full Code Here

                            if (contents != null) {
                                rev.setSource(contents);
                            }
                        }
                    } catch (NumberFormatException e) {
                        throw new SVNImporterException(NLS.bind(
                                ImporterMessages.EvolizerSVNImporter_invalidRevisionNumber,
                                rev.getNumber()));
                    }

                    // now we can release the revision to the garbage
                    // collector,
                    // since it was made persistent.
                    revisionsArray[i] = null;

                    if ((i % 24 == 0) && (i != 0)) {
                        persistenceProvider.flush();
                        persistenceProvider.clear();
                    }
                    i++;
                }
                persistenceProvider.update(r);
                persistenceProvider.flush();
                fMonitor.worked(1);

                persistenceProvider.endTransaction();
                releasesArray[j] = null;
                j++;
            }

            fConnector.disconnectSVN();
            LOGGER.info(ImporterMessages.EvolizerSVNImporter_disconnected);
        } catch (SVNException e) {
            throw new SVNImporterException(ImporterMessages.EvolizerSVNImporter_connectionProbs, e);
        }
        fMonitor.done();
    }
View Full Code Here

    public void connectSVN() throws SVNImporterException, SVNException {
        try {

            if ((fSVNBaseURL == null) || fSVNBaseURL.equals("")) {
                throw new SVNImporterException(SVNConnectorMessages.SVNConnector_noURL);
            }

            // initialize the library (it must be done before ever using the library itself)
            setupLibrary();
            fRepository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(fSVNBaseURL));

        } catch (SVNException e) {
            LOGGER.error(NLS.bind(SVNConnectorMessages.SVNConnector_repoCreationError, fSVNBaseURL), e);
            throw e;
        }

        // Create Authentication manager
        ISVNAuthenticationManager authManager;
        if ((fSVNUserName == null) && (fSVNUserPassword == null)) {
            authManager = SVNWCUtil.createDefaultAuthenticationManager();
        } else {
            authManager = SVNWCUtil.createDefaultAuthenticationManager(fSVNUserName, fSVNUserPassword);
        }
        fRepository.setAuthenticationManager(authManager);

        try {
            /*
             * Checks up if the specified path/to/repository part of the URL
             * really corresponds to a directory.
             */
            SVNNodeKind nodeKind = fRepository.checkPath("", -1); // -1 corresponds to latest revision
            if (nodeKind == SVNNodeKind.NONE) {
                throw new SVNImporterException(NLS.bind(SVNConnectorMessages.SVNConnector_noEntry, fSVNBaseURL));
            } else if (nodeKind == SVNNodeKind.FILE) {
                throw new SVNImporterException(NLS.bind(SVNConnectorMessages.SVNConnector_unexpectedEntry, fSVNBaseURL));
            }
        } catch (SVNImporterException e) {
            LOGGER.error(SVNConnectorMessages.SVNConnector_connectionError, e);
            throw e;
        }
View Full Code Here

                }
            } else {
                LOGGER.debug(NLS.bind(SVNConnectorMessages.SVNConnector_noTextFile, filePath));
            }
        } catch (SVNException e) {
            SVNImporterException e1 =
                    new SVNImporterException(NLS.bind(SVNConnectorMessages.SVNConnector_fetchFileError, filePath, revisionNumber));
            e1.setStackTrace(e.getStackTrace());
            throw e1;
        }
        return content;
    }
View Full Code Here

                            toRevNum,
                            fromRevNum,
                            this.createDirectory(toPath));
                }
            } else {
                throw new SVNImporterException(NLS.bind(
                        MapperMessages.SVNModelMapper_copiedPathNotExists,
                        fromPath,
                        toPath));
            }
        }
View Full Code Here

        if ((release != null) && (branch == null)) {
            release.addReleaseRevision(newRevision);
        } else if ((branch != null) && (release == null)) {
            branch.addRevision(newRevision); // Branch -> SVNRevision
        } else {
            throw new SVNImporterException(MapperMessages.SVNModelMapper_addFileMisuse);
        }
    }
View Full Code Here

        newRevision.setFile(file); // SVNRevision -> File
        newRevision.setReport(report); // SVNRevision -> ModificationReport
       
        if (deleted && (copyPath != null)) {
            // If this SVNRevision is actually the deletion of the related file, I set its state as deleted
            throw new SVNImporterException(MapperMessages.SVNModelMapper_cannotCreateRevision);
        } else if (deleted) {
            newRevision.setState(MapperMessages.SVNModelMapper_DELETED);
        } else if (copyPath != null) {
            // If copy path is not null, it means that the current file version is a copy from a preexisting file
            SVNVersionedFile originalFile = fFiles.get(copyPath);
View Full Code Here

                LOGGER.debug(NLS.bind(MapperMessages.SVNModelMapper_addedFileToBranch, new String[]{
                        toUpdate.getPath(),
                        toUpdate.getLatestRevision().getNumber(),
                        branch.getName()}));
            } else {
                throw new SVNImporterException(MapperMessages.SVNModelMapper_misuse);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.evolizer.versioncontrol.svn.importer.exceptions.SVNImporterException

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.