Package io.lumify.core.exception

Examples of io.lumify.core.exception.LumifyException


        if (dateString != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(DATE_PROPERTY_FORMAT);
            try {
                date = sdf.parse(dateString);
            } catch (ParseException e) {
                throw new LumifyException("unable to parse " + DATE_PROPERTY + " property with format " + DATE_PROPERTY_FORMAT, e);
            }
        }

        termsJson = new JSONObject();
        termsJson.put("title", title);
View Full Code Here


            AccumuloVertexInputFormat.setInputInfo(job, graph, getInstanceName(), getZooKeepers(), getPrincipal(), getAuthorizationToken(), authorizations);
        } else if (elementType == ElementType.EDGE) {
            job.setInputFormatClass(AccumuloEdgeInputFormat.class);
            AccumuloEdgeInputFormat.setInputInfo(job, graph, getInstanceName(), getZooKeepers(), getPrincipal(), getAuthorizationToken(), authorizations);
        } else {
            throw new LumifyException("Unhandled element type: " + elementType);
        }
    }
View Full Code Here

        try {
            MessageDigest digest = MessageDigest.getInstance("MD5");
            byte[] md5 = digest.digest(s.getBytes());
            return Hex.encodeHexString(md5);
        } catch (NoSuchAlgorithmException e) {
            throw new LumifyException("Could not find MD5", e);
        }
    }
View Full Code Here

        this.visibilityTranslator = visibilityTranslator;
        this.workspaceRepository = workspaceRepository;

        this.artifactContainsImageOfEntityIri = this.getConfiguration().get(Configuration.ONTOLOGY_IRI_ARTIFACT_CONTAINS_IMAGE_OF_ENTITY);
        if (this.artifactContainsImageOfEntityIri == null) {
            throw new LumifyException("Could not find configuration for " + Configuration.ONTOLOGY_IRI_ARTIFACT_CONTAINS_IMAGE_OF_ENTITY);
        }
    }
View Full Code Here

    }

    public void registerResourceBundle(String resourceBundleResourceName) {
        InputStream stream = WebApp.class.getResourceAsStream(resourceBundleResourceName);
        if (stream == null) {
            throw new LumifyException("Could not find resource bundle resource: " + resourceBundleResourceName);
        }
        try {
            Pattern pattern = Pattern.compile(".*_([a-z]{2})(?:_([A-Z]{2}))?(?:_(.+))?\\.properties");
            Matcher matcher = pattern.matcher(resourceBundleResourceName);
            if (matcher.matches()) {
                String language = matcher.group(1);
                String country = matcher.group(2);
                String variant = matcher.group(3);
                Locale locale = getLocal(language, country, variant);
                LOGGER.info("registering ResourceBundle plugin file: %s with locale: %s", resourceBundleResourceName, locale);
                lumifyResourceBundleManager.register(stream, locale);
            } else {
                LOGGER.info("registering ResourceBundle plugin file: %s", resourceBundleResourceName);
                lumifyResourceBundleManager.register(stream);
            }
        } catch (IOException e) {
            throw new LumifyException("Could not read resource bundle resource: " + resourceBundleResourceName);
        } finally {
            closeQuietly(stream);
        }
    }
View Full Code Here

        StringBuffer temp = new StringBuffer();
        Matcher m = PATTERN_PROPERTY.matcher(workingString);
        while (m.find()) {
            if (!"NONE".equals(m.group(1))) {
                throw new LumifyException("Unhandled title formula property: " + arg);
            }
            String iri = uriToIri(m.group(2));
            m.appendReplacement(temp, "' + prop('" + iri + "') + '");
        }
        m.appendTail(temp);
View Full Code Here

    @Override
    protected void processRow(PtPropertyAndValue row) {
        PtPropertyType propertyType = getDataImporter().getPropertyTypes().get(row.getType());
        if (propertyType == null) {
            throw new LumifyException("Could not find property type: " + row.getType());
        }

        String propertyKey = getDataImporter().getIdPrefix() + row.getPropertyValueId();
        String propertyName = getPropertyName(propertyType.getUri());
        Object propertyValue = propertyType.getDisplayFormula().toValue(row.getValue());
View Full Code Here

                .setParameter("username", username)
                .list();
        if (users.size() == 0) {
            return null;
        } else if (users.size() > 1) {
            throw new LumifyException("more than one user was returned");
        } else {
            return users.get(0);
        }
    }
View Full Code Here

                .setParameter("id", userId)
                .list();
        if (users.size() == 0) {
            return null;
        } else if (users.size() > 1) {
            throw new LumifyException("more than one user was returned");
        } else {
            return users.get(0);
        }
    }
View Full Code Here

    public User addUser(String username, String displayName, String emailAddress, String password, String[] userAuthorizations) {
        username = formatUsername(username);
        displayName = displayName.trim();
        Session session = sessionManager.getSession();
        if (findByUsername(username) != null) {
            throw new LumifyException("User already exists");
        }

        Transaction transaction = null;
        SqlUser newUser = null;
        try {
            transaction = session.beginTransaction();
            newUser = new SqlUser();
            String id = "USER_" + graph.getIdGenerator().nextId();
            newUser.setUserId(id);
            newUser.setUsername(username);
            newUser.setDisplayName(displayName);
            newUser.setCreateDate(new Date());
            newUser.setEmailAddress(emailAddress);
            if (password != null && !password.equals("")) {
                byte[] salt = UserPasswordUtil.getSalt();
                byte[] passwordHash = UserPasswordUtil.hashPassword(password, salt);
                newUser.setPassword(salt, passwordHash);
            }
            newUser.setUserStatus(UserStatus.OFFLINE);
            newUser.setPrivilegesString(Privilege.toString(getDefaultPrivileges()));
            LOGGER.debug("add %s to user table", displayName);
            session.save(newUser);
            transaction.commit();
        } catch (HibernateException e) {
            if (transaction != null) {
                transaction.rollback();
            }
            throw new LumifyException("HibernateException while adding user", e);
        }

        userListenerUtil.fireNewUserAddedEvent(newUser);

        return newUser;
View Full Code Here

TOP

Related Classes of io.lumify.core.exception.LumifyException

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.