Package org.apache.openjpa.lib.util

Examples of org.apache.openjpa.lib.util.Options


     * <li><i>get</i>: Print the next sequence value.</li>
     * </ul>
     */
    public static void main(String[] args)
        throws Exception {
        Options opts = new Options();
        final String[] arguments = opts.setFromCmdLine(args);
        boolean ret = Configurations.runAgainstAllAnchors(opts,
            new Configurations.Runnable() {
            public boolean run(Options opts) throws Exception {
                JDBCConfiguration conf = new JDBCConfigurationImpl();
                try {
View Full Code Here


            _fieldValues = null;
            return;
        }

        // parse string into options; this takes care of proper trimming etc
        Options values = Configurations.parseProperties(_extString);
        if (values.isEmpty())
            throw new MetaDataException(_loc.get("no-external-values", this,
                _extString));

        Map extValues = new HashMap((int) (values.size() * 1.33 + 1));
        Map fieldValues = new HashMap((int) (values.size() * 1.33 + 1));
        Map.Entry entry;
        Object extValue, fieldValue;
        for (Iterator itr = values.entrySet().iterator(); itr.hasNext();) {
            entry = (Map.Entry) itr.next();
            fieldValue = transform((String) entry.getKey(),
                getDeclaredTypeCode());
            extValue = transform((String) entry.getValue(), getTypeCode());

View Full Code Here

     * explicitly declares the persistence-capable interface, it will
     * not be enhanced. Thus, it is safe to invoke the enhancer on classes
     * that are already enhanced.
     */
    public static void main(String[] args) {
        Options opts = new Options();
        args = opts.setFromCmdLine(args);
        if (!run(args, opts)) {
            // START - ALLOW PRINT STATEMENTS
            System.err.println(_loc.get("enhance-usage"));
            // STOP - ALLOW PRINT STATEMENTS
        }
View Full Code Here

        File dir = Files.getClassFile(ProxyManagerImpl.class);
        dir = (dir == null) ? new File(AccessController.doPrivileged(
            J2DoPrivHelper.getPropertyAction("user.dir")))
            : dir.getParentFile();

        Options opts = new Options();
        args = opts.setFromCmdLine(args);

        List types = new ArrayList();
        types.addAll(Arrays.asList(args));
        int utils = opts.removeIntProperty("utils", "u", 0);
        if (utils >= 4) {
            types.addAll(Arrays.asList(new String[] {
                java.sql.Date.class.getName(),
                java.sql.Time.class.getName(),
                java.sql.Timestamp.class.getName(),
View Full Code Here

        if (_conf.isInitializeEagerly()) {
            newBroker(_conf.getConnectionUserName(), _conf.getConnectionPassword(),
                _conf.isConnectionFactoryModeManaged(), _conf.getConnectionRetainModeConstant(), false).close();
        }
        // Don't catch any exceptions here because we want to fail-fast if something bad happens when we're preloading.
        Options o = Configurations.parseProperties(Configurations.getProperties(_conf.getMetaDataRepository()));
        if (MetaDataRepository.needsPreload(o) == true) {
            MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance();
            mdr.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            mdr.setResolve(MetaDataRepository.MODE_MAPPING_INIT, true);
View Full Code Here

            "openjpa.DetachState", "DetachedStateField=true",
        });
        OpenJPAConfiguration conf = new OpenJPAConfigurationImpl(true, false);
        conf.fromProperties(props);

        Options opts = new Options();
        opts.put("jdo", "true");
        PCEnhancer.run(conf, new String[]{
            "org.apache.openjpa.persistence.kernel.noenhance.DetachSMPC" }, opts);
    }
View Full Code Here

     * <li><i>get</i>: Print the next sequence value.</li>
     * </ul>
     */
    public static void main(String[] args)
        throws Exception {
        Options opts = new Options();
        final String[] arguments = opts.setFromCmdLine(args);
        boolean ret = Configurations.runAgainstAllAnchors(opts,
            new Configurations.Runnable() {
            public boolean run(Options opts) throws Exception {
                JDBCConfiguration conf = new JDBCConfigurationImpl();
                try {
View Full Code Here

public class TestAnchorParsing extends TestCase {

    public void testFQAnchor() {
        String fqLoc = "META-INF/persistence.xml#test";
        Options opts = new Options();
        opts.setProperty("p", fqLoc);
        List locs =
            Configurations.getFullyQualifiedAnchorsInPropertiesLocation(opts);
        assertNotNull(locs);
        assertEquals(1, locs.size());
        assertEquals(fqLoc, locs.get(0));
View Full Code Here

    public void testNoAnchor() {
        allHelper("META-INF/persistence.xml");
    }

    private void allHelper(String resource) {
        Options opts = new Options();
        if (resource != null)
            opts.setProperty("p", resource);
        List locs =
            Configurations.getFullyQualifiedAnchorsInPropertiesLocation(opts);
        assertNotNull(locs);
        // approximate so that if someone adds more units, this doesn't break
        assertTrue(locs.size() >= 4);
View Full Code Here

        // BrokerFactory. This is because it is possible that someone has extended OpenJPA
        // functions and they need to be allowed time to configure themselves before we go off and
        // start instanting configurable objects (ie:openjpa.MetaDataRepository). Don't catch
        // any exceptions here because we want to fail-fast.
        OpenJPAConfiguration conf = factory.getConfiguration();
        Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository()));
        if (MetaDataRepository.needsPreload(o) == true) {
            MetaDataRepository mdr = conf.getMetaDataRepositoryInstance();
            mdr.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            mdr.setResolve(MetaDataRepository.MODE_MAPPING_INIT, true);
           
View Full Code Here

TOP

Related Classes of org.apache.openjpa.lib.util.Options

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.