Examples of OpenJPAConfiguration


Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     */
    public static boolean run(final String[] args, Options opts) {
        return Configurations.runAgainstAllAnchors(opts,
            new Configurations.Runnable() {
            public boolean run(Options opts) throws IOException {
                OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
                try {
                    return PCEnhancer.run(conf, args, opts);
                } finally {
                    conf.close();
                }
            }
        });
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        private final ClassFileTransformer _trans;

        private ClassTransformerImpl(ConfigurationProvider cp, String props,
            final ClassLoader tmpLoader) {
            // create an independent conf for enhancement
            OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
            cp.setInto(conf);
            // don't allow connections
            conf.setConnectionUserName(null);
            conf.setConnectionPassword(null);
            conf.setConnectionURL(null);
            conf.setConnectionDriverName(null);
            conf.setConnectionFactoryName(null);
            // use the tmp loader for everything
            conf.setClassResolver(new ClassResolver() {
                public ClassLoader getClassLoader(Class context,
                    ClassLoader env) {
                    return tmpLoader;
                }
            });
            conf.setReadOnly(true);

            MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
            repos.setResolve(MetaDataModes.MODE_MAPPING, false);
            _trans = new PCClassFileTransformer(repos,
                Configurations.parseProperties(props), tmpLoader);
        }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        _state.ctx = ctx;
        if (ctx == null)
            return;

        // initialize to conf info
        OpenJPAConfiguration conf = ctx.getConfiguration();
        setFetchBatchSize(conf.getFetchBatchSize());
        setFlushBeforeQueries(conf.getFlushBeforeQueriesConstant());
        clearFetchGroups();
        addFetchGroups(Arrays.asList(conf.getFetchGroupsList()));
        setMaxFetchDepth(conf.getMaxFetchDepth());
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

        }

        @Override
        public void setInto(Configuration conf) {
            if (conf instanceof OpenJPAConfiguration) {
                OpenJPAConfiguration oconf = (OpenJPAConfiguration) conf;
                oconf.setSpecification(SPEC_JPA);

                // we merge several persistence.xml elements into the
                // MetaDataFactory property implicitly.  if the user has a
                // global openjpa.xml with this property set, its value will
                // get overwritten by our implicit setting.  so instead, combine
                // the global value with our settings
                String orig = oconf.getMetaDataFactory();
                if (!StringUtils.isEmpty(orig)) {
                    String key = ProductDerivations.getConfigurationKey
                        ("MetaDataFactory", getProperties());
                    Object override = getProperties().get(key);
                    if (override instanceof String)
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     */
    public static void main(String[] args)
        throws IOException {
        Options opts = new Options();
        args = opts.setFromCmdLine(args);
        OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
        try {
            if (!run(conf, args, opts))
                System.err.println(_loc.get("tool-usage"));
        } finally {
            conf.close();
        }
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     */
    public static void main(String[] args)
        throws IOException, ClassNotFoundException {
        Options opts = new Options();
        args = opts.setFromCmdLine(args);
        OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
        try {
            if (!run(conf, args, opts))
                System.err.println(_loc.get("appid-usage"));
        } finally {
            conf.close();
        }
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     */
    public static void main(String[] args)
        throws IOException {
        Options opts = new Options();
        args = opts.setFromCmdLine(args);
        OpenJPAConfiguration conf = new OpenJPAConfigurationImpl();
        try {
            if (!run(conf, args, opts))
                System.err.println(_loc.get("enhance-usage"));
        } finally {
            conf.close();
        }
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

     */
    private JDBCConfiguration getJDBCConfiguration() {
        StoreContext ctx = getContext();
        if (ctx == null)
            return null;
        OpenJPAConfiguration conf = ctx.getConfiguration();
        if (!(conf instanceof JDBCConfiguration))
            return null;
        return (JDBCConfiguration) conf;
    }
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    /**
     * Validate that this field is supported by the runtime.
     */
    private void validateSupportedType() {
        // log warnings about things we don't handle
        OpenJPAConfiguration conf = getRepository().getConfiguration();
        Collection opts = conf.supportedOptions();
        Log log = conf.getLog(conf.LOG_METADATA);
        switch (getTypeCode()) {
            case JavaTypes.PC:
                if (isEmbedded() &&
                    !opts.contains(conf.OPTION_EMBEDDED_RELATION)) {
                    setEmbedded(false);
View Full Code Here

Examples of org.apache.openjpa.conf.OpenJPAConfiguration

    /**
     * Assert that the given strategy is supported by the current runtime.
     */
    public static void assertSupported(int strategy, MetaDataContext context,
        String attributeName) {
        OpenJPAConfiguration conf = context.getRepository().getConfiguration();
        boolean supported = true;
        switch (strategy) {
            case AUTOASSIGN:
                supported = conf.supportedOptions().contains
                    (OpenJPAConfiguration.OPTION_VALUE_AUTOASSIGN);
                break;
            case INCREMENT:
                supported = conf.supportedOptions().contains
                    (OpenJPAConfiguration.OPTION_VALUE_INCREMENT);
                break;
            case NATIVE:
                supported = context instanceof ClassMetaData;
                break;
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.