Examples of SynchronizationException


Examples of com.sun.enterprise.ee.synchronization.SynchronizationException

            }

            return config.getName();

        } catch (ConfigException ce) {
            throw new SynchronizationException("Unable to resolve configuration name");
        }

    }
View Full Code Here

Examples of com.sun.enterprise.ee.synchronization.SynchronizationException

            // sets the config context
            sCtx.setConfigContext(ctx);

        } catch (Exception e) {
            String msg = _localStrMgr.getString("SynchCtxCreationError");
            throw new SynchronizationException(msg, e);
        }

        return sCtx;
    }
View Full Code Here

Examples of com.sun.enterprise.ee.synchronization.SynchronizationException

            client = (SynchronizationClient)
                constructor.newInstance(new Object[] {remoteServerName});

        } catch (Exception e) {
            String msg = _localStrMgr.getString("SynchClientCreationError");
            throw new SynchronizationException(msg, e);
        }

        return client;
    }
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.SynchronizationException

     * @throws SynchronizationException
     */
    protected void checkPush(Ref ref, Optional<Ref> remoteRef) throws SynchronizationException {
        if (remoteRef.isPresent()) {
            if (remoteRef.get() instanceof SymRef) {
                throw new SynchronizationException(StatusCode.CANNOT_PUSH_TO_SYMBOLIC_REF);
            }
            ObjectId mappedId = localRepository.graphDatabase().getMapping(
                    remoteRef.get().getObjectId());
            if (mappedId.equals(ref.getObjectId())) {
                // The branches are equal, no need to push.
                throw new SynchronizationException(StatusCode.NOTHING_TO_PUSH);
            } else if (localRepository.blobExists(mappedId)) {
                Optional<ObjectId> ancestor = localRepository.command(FindCommonAncestor.class)
                        .setLeftId(mappedId).setRightId(ref.getObjectId()).call();
                if (!ancestor.isPresent()) {
                    // There is no common ancestor, a push will overwrite history
                    throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES);
                } else if (ancestor.get().equals(ref.getObjectId())) {
                    // My last commit is the common ancestor, the remote already has my data.
                    throw new SynchronizationException(StatusCode.NOTHING_TO_PUSH);
                } else if (!ancestor.get().equals(mappedId)) {
                    // The remote branch's latest commit is not my ancestor, a push will cause a
                    // loss of history.
                    throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES);
                }
            } else {
                // The remote has data that I do not, a push will cause this data to be lost.
                throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES);
            }
        }
    }
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.SynchronizationException

        if (!remoteRefOpt.isPresent()) {
            return;// safe to push
        }
        final Ref remoteRef = remoteRefOpt.get();
        if (remoteRef instanceof SymRef) {
            throw new SynchronizationException(StatusCode.CANNOT_PUSH_TO_SYMBOLIC_REF);
        }
        final ObjectId remoteObjectId = remoteRef.getObjectId();
        final ObjectId localObjectId = ref.getObjectId();
        if (remoteObjectId.equals(localObjectId)) {
            // The branches are equal, no need to push.
            throw new SynchronizationException(StatusCode.NOTHING_TO_PUSH);
        } else if (localRepository.blobExists(remoteObjectId)) {
            Optional<ObjectId> ancestor = localRepository.command(FindCommonAncestor.class)
                    .setLeftId(remoteObjectId).setRightId(localObjectId).call();
            if (!ancestor.isPresent()) {
                // There is no common ancestor, a push will overwrite history
                throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES);
            } else if (ancestor.get().equals(localObjectId)) {
                // My last commit is the common ancestor, the remote already has my data.
                throw new SynchronizationException(StatusCode.NOTHING_TO_PUSH);
            } else if (!ancestor.get().equals(remoteObjectId)) {
                // The remote branch's latest commit is not my ancestor, a push will cause a
                // loss of history.
                throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES);
            }
        } else if (!remoteObjectId.isNull()) {
            // The remote has data that I do not, a push will cause this data to be lost.
            throw new SynchronizationException(StatusCode.REMOTE_HAS_CHANGES);
        }
    }
View Full Code Here

Examples of org.locationtech.geogig.api.porcelain.SynchronizationException

            }

            if (!commitNode.getObjectId().equals(ObjectId.NULL)
                    && !source.objectExists(commitNode.getObjectId())) {
                // Source is too shallow
                throw new SynchronizationException(StatusCode.HISTORY_TOO_SHALLOW);
            }

            return Evaluation.INCLUDE_AND_CONTINUE;
        }
View Full Code Here

Examples of org.wso2.carbon.registry.synchronization.SynchronizationException

                this.testContentChanged = false;
                checkInPath = suggestedCheckInPath;
            }
        } else {
            if (metaOMElement == null) {
                throw new SynchronizationException(MessageCode.CHECKOUT_BEFORE_CHECK_IN);
            }
            registryUrl = metaOMElement.getAttributeValue(new QName("registryUrl"));
        }
    }
View Full Code Here

Examples of org.wso2.carbon.registry.synchronization.SynchronizationException

            ZipInputStream zis = new ZipInputStream(new FileInputStream(inputFile));
            zis.getNextEntry();
            Reader reader = new InputStreamReader(zis);
            registry.restore(checkInPath, reader);
        } catch (FileNotFoundException e) {
            throw new SynchronizationException(MessageCode.FILE_DOES_NOT_EXIST, e,
                    new String[]{"Output file" + inputFile});
        } catch (Exception e) {
            throw new SynchronizationException(MessageCode.ERROR_IN_RESTORING, e,
                    new String[]{"path: " + checkInPath,
                            "registry url: " + registryUrl,
                            "username: " + username});
        }
View Full Code Here

Examples of org.wso2.carbon.registry.synchronization.SynchronizationException

                            writer.close();
                        }
                    }
                }
            } catch (IOException e) {
                throw new SynchronizationException(
                        MessageCode.ERROR_IN_CREATING_TEMP_FILE_FOR_DUMP,
                        e);
            } catch (XMLStreamException e) {
                throw new SynchronizationException(
                        MessageCode.ERROR_IN_CREATING_XML_STREAM_WRITER, e);
            }

            // do the restoring
            try {
                Reader reader = null;
                try {
                    reader = new FileReader(tempFile);
                    registry.restore(checkInPath, reader);
                } finally {
                    if (reader != null) {
                        reader.close();
                    }
                }
            } catch (IOException e) {
                throw new SynchronizationException(
                        MessageCode.ERROR_IN_READING_TEMP_FILE_OF_DUMP, e);
            } catch (RegistryException e) {
                throw new SynchronizationException(MessageCode.ERROR_IN_RESTORING, e,
                        new String[]{"path: " + checkInPath,
                                "registry url: " + registryUrl,
                                "username: " + username});
            }
        } finally {
            if (tempFile != null) {
                // Our intention here is to delete the temporary file. We are not bothered whether
                // this operation fails.
                deleteTempFileFailed = !tempFile.delete();
            }
        }
        if (deleteTempFileFailed) {
            throw new SynchronizationException(MessageCode.ERROR_IN_CLEANING_UP,
                    new String[]{"file path: " + tempFile.getAbsolutePath()});
        }

        if (cleanRegistry && registryUrl == null) {
            Utils.cleanEmbeddedRegistry();
        }

        // clean all the dangling meta files.
        if (filesToClean != null && filesToClean.size() > 0) {
            for (String filePath : filesToClean) {
                if (!Utils.deleteFile(new File(filePath))) {
                    throw new SynchronizationException(MessageCode.ERROR_IN_CLEANING_UP,
                            new String[]{"file path: " + filePath});
                }
            }
        }
View Full Code Here

Examples of org.wso2.carbon.registry.synchronization.SynchronizationException

        }

        // alerting non-backward compatibility...
        String checkoutPathAttribute = metaElement.getAttributeValue(new QName("checkoutPath"));
        if (checkoutPathAttribute != null) {
            throw new SynchronizationException(MessageCode.CHECKOUT_OLD_VERSION);
        }

        // we are re-adjusting the name of the resource to make sure the file name and the resource
        // name is equal
        String resourceName = RegistryUtils.getResourceName(path);
        metaElement.addAttribute("name", resourceName, null);

        // now write the meta data of the meta element to the writer (except children)
        Utils.writeMetaElement(xmlWriter, metaElement);

        // now add the child element to the meta element
        xmlWriter.writeStartElement("children");

        File directory = new File(filePath);
        String[] childrenNames = directory.list();
        List<String> filesToPreserve = new LinkedList<String>();
        if (childrenNames != null) {
            for (String childFileName : childrenNames) {
                // Get childFileName of file or directory
                String childResourceName = Utils.decodeFilename(childFileName);

                if (childResourceName.equals(SynchronizationConstants.META_DIRECTORY)) {
                    continue;
                }
                if (childResourceName.endsWith(SynchronizationConstants.MINE_FILE_POSTFIX) ||
                        childResourceName.endsWith(SynchronizationConstants.SERVER_FILE_POSTFIX)) {
                    // there is an conflicts
                    throw new SynchronizationException(MessageCode.RESOLVE_CONFLICTS);
                }

                String childPath;
                String childFilePath;
                if (path.equals("/")) {
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.