Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.UserException


        } catch (NoSuchMethodException e) {
            throw new InternalException(e);
        } catch (IllegalAccessException e) {
            throw new InternalException(e);
        } catch (InvocationTargetException e) {
            throw new UserException(e.getCause());
        } catch (IOException e) {
            throw new InternalException(e);
        } catch (ClassNotFoundException e) {
            throw new InternalException(e);
        } catch (UnmodifiableClassException e) {
View Full Code Here


                    unenhanced);
                if (conf.getRuntimeUnenhancedClassesConstant()
                    == RuntimeUnenhancedClasssesModes.WARN)
                    log.warn(msg);
                else
                    throw new UserException(msg);
            }
            return null;
        }

        boolean redefine = ClassRedefiner.canRedefineClasses();
        if (redefine)
            log.info(_loc.get("enhance-and-subclass-no-redef-start",
                classes));
        else
            log.info(_loc.get("enhance-and-subclass-and-redef-start",
                classes));

        final Map<Class, byte[]> map = new HashMap<Class, byte[]>();
        final List subs = new ArrayList(classes.size());
        final List ints = new ArrayList(classes.size());
        Set<Class> unspecified = null;
        for (Iterator iter = classes.iterator(); iter.hasNext(); ) {
            final Class cls = (Class) iter.next();
            final PCEnhancer enhancer = new PCEnhancer(conf, cls);

            enhancer.setBytecodeWriter(new BytecodeWriter() {
                public void write(BCClass bc) throws IOException {
                    ManagedClassSubclasser.write(bc, enhancer, map,
                        cls, subs, ints);
                }
            });
            if (redefine)
                enhancer.setRedefine(true);
            enhancer.setCreateSubclass(true);
            enhancer.setAddDefaultConstructor(true);

            // set this before enhancement as well as after since enhancement
            // uses a different metadata repository, and the metadata config
            // matters in the enhancement contract. Don't do any warning here,
            // since we'll issue warnings when we do the final metadata
            // reconfiguration at the end of this method.
            configureMetaData(enhancer.getMetaData(), conf, redefine, false);

            unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(),
                classes, unspecified);

            enhancer.run();
            try {
                enhancer.record();
            } catch (IOException e) {
                // our impl of BytecodeWriter doesn't throw IOException
                throw new InternalException(e);
            }
        }

        if (unspecified != null && !unspecified.isEmpty())
            throw new UserException(_loc.get("unspecified-unenhanced-types",
                classes, unspecified));

        ClassRedefiner.redefineClasses(conf, map);
        for (Class cls : map.keySet()) {
            setIntercepting(conf, envLoader, cls);
View Full Code Here

                J2DoPrivHelper.getClassLoaderAction(
                    AbstractStoreManager.class)));
        Configurations.configureInstance(store, null, props,
            PROP_ABSTRACT_STORE);
        if (store == null)
            throw new UserException(s_loc.get("no-store-manager",
                PROP_ABSTRACT_STORE)).setFatal(true);

        return store;
  }
View Full Code Here

            switch (JavaTypes.getTypeCode(type)) {
                case JavaTypes.ARRAY:
                case JavaTypes.COLLECTION:
                case JavaTypes.MAP:
                    throw new UserException(_loc.get("container-projection",
                        q.getContext().getQueryString()));
            }
        }
View Full Code Here

                    // fall through to exception below
                } catch (NullPointerException npe) {
                    // fall through to exception below
                }
            }
            throw new UserException(_loc.get("only-range-constants",
                q.getContext().getQueryString()));
        }
View Full Code Here

                } else if (_agg == null) {
                    if (val.isAggregate())
                        _agg = val;
                    else if (val instanceof Path
                        && (_grouped == null || !_grouped.contains(val))) {
                        throw new UserException(_loc.get("bad-grouping",
                            _ctx.getCandidateType(), _ctx.getQueryString()));
                    }
                }
            }
View Full Code Here

        public DataStoreExecutor(ExpressionStoreQuery q,
            ClassMetaData meta, boolean subclasses,
            ExpressionParser parser, Object parsed) {
            _metas = q.getIndependentExpressionCandidates(meta, subclasses);
            if (_metas.length == 0)
                throw new UserException(_loc.get("query-unmapped", meta));
            _meta = meta;
            _subs = subclasses;
            _parser = parser;

            _facts = new ExpressionFactory[_metas.length];
View Full Code Here

        final int[] min;

        public Schedule(String date) {
            StringTokenizer token = new StringTokenizer(date, " \t");
            if (token.countTokens() != 5)
                throw new UserException(_loc.get("bad-count", date)).
                    setFatal(true);
            try {
                min = parse(token.nextToken(), 0, 60);
                hour = parse(token.nextToken(), 0, 24);
                dayOfMonth = parse(token.nextToken(), 1, 31);
                month = parse(token.nextToken(), 1, 13);
                dayOfWeek = parse(token.nextToken(), 1, 8);
            } catch (Throwable t) {
                throw new UserException(_loc.get("bad-schedule", date), t).
                    setFatal(true);
            }
        }
View Full Code Here

            int [] times = new int[tokens.length];
            for (int i = 0; i < tokens.length; i++) {
                try {
                    times[i] = Integer.parseInt(tokens[i]);
                } catch (Throwable t) {
                    throw new UserException(_loc.get("not-number", token)).
                        setFatal(true);
                }
                if (times[i] < min || times[i] >= max)
                    throw new UserException(_loc.get("not-range", token,
                        String.valueOf(min), String.valueOf(max))).
                        setFatal(true);
            }
            return times;
        }
View Full Code Here

            this.urls = new HashSet((int) (strs.length * 1.33 + 1));
            try {
                for (int i = 0; i < strs.length; i++)
                    this.urls.add(new URL(strs[i]));
            } catch (MalformedURLException mue) {
                throw new UserException(mue);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.util.UserException

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.