Package org.apache.cayenne.di

Examples of org.apache.cayenne.di.AdhocObjectFactory.newInstance()


        logger.info(String.format(
                "generator options - [dropTables: %s, dropPK: %s, createTables: %s, createPK: %s, createFK: %s]",
                dropTables, dropPK, createTables, createPK, createFK));

        try {
            final DbAdapter adapterInst = (adapter == null) ? (DbAdapter) objectFactory.newInstance(DbAdapter.class,
                    JdbcAdapter.class.getName()) : (DbAdapter) objectFactory.newInstance(DbAdapter.class, adapter);

            // Load the data map and run the db generator.
            DataMap dataMap = loadDataMap();
            DbGenerator generator = new DbGenerator(adapterInst, dataMap, NoopJdbcEventLogger.getInstance());
View Full Code Here


                "generator options - [dropTables: %s, dropPK: %s, createTables: %s, createPK: %s, createFK: %s]",
                dropTables, dropPK, createTables, createPK, createFK));

        try {
            final DbAdapter adapterInst = (adapter == null) ? (DbAdapter) objectFactory.newInstance(DbAdapter.class,
                    JdbcAdapter.class.getName()) : (DbAdapter) objectFactory.newInstance(DbAdapter.class, adapter);

            // Load the data map and run the db generator.
            DataMap dataMap = loadDataMap();
            DbGenerator generator = new DbGenerator(adapterInst, dataMap, NoopJdbcEventLogger.getInstance());
            generator.setShouldCreateFKConstraints(createFK);
View Full Code Here

        Injector injector = DIBootstrap.createInjector(new ToolModule());
        AdhocObjectFactory objectFactory = injector.getInstance(AdhocObjectFactory.class);

        // prepare defaults
        if (adapter == null) {
            adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
        }
       
        log(String.format("connection settings - [driver: %s, url: %s, username: %s]", driver, url, userName), Project.MSG_VERBOSE);

        log(String.format("generator options - [dropTables: %s, dropPK: %s, createTables: %s, createPK: %s, createFK: %s]",
View Full Code Here

    public void setAdapter(String adapter) {
        if (adapter != null) {
            Injector injector = DIBootstrap.createInjector(new ToolModule());
            AdhocObjectFactory objectFactory = injector.getInstance(AdhocObjectFactory.class);
           
            this.adapter = objectFactory.newInstance(DbAdapter.class, adapter);
        }
    }

    /**
     * Sets the JDBC driver used to connect to the database server.
View Full Code Here

            map, overwriteExisting, schemaName, tablePattern,
            importProcedures, procedurePattern, meaningfulPk,
            namingStrategy));

    try {
      final DbAdapter adapterInst = (adapter == null) ? (DbAdapter) objectFactory
          .newInstance(DbAdapter.class, JdbcAdapter.class.getName())
          : (DbAdapter) objectFactory.newInstance(DbAdapter.class,
              adapter);

      // load driver taking custom CLASSPATH into account...
View Full Code Here

            namingStrategy));

    try {
      final DbAdapter adapterInst = (adapter == null) ? (DbAdapter) objectFactory
          .newInstance(DbAdapter.class, JdbcAdapter.class.getName())
          : (DbAdapter) objectFactory.newInstance(DbAdapter.class,
              adapter);

      // load driver taking custom CLASSPATH into account...
      DriverDataSource dataSource = new DriverDataSource((Driver) Class
          .forName(driver).newInstance(), url, username, password);
View Full Code Here

        logger.info(String.format("generator options - [dropTables: %s, dropPK: %s, createTables: %s, createPK: %s, createFK: %s]",
                dropTables, dropPK, createTables, createPK, createFK));

        try {
            final DbAdapter adapterInst = (adapter == null) ?
                (DbAdapter)objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName()) :
                (DbAdapter)objectFactory.newInstance(DbAdapter.class, adapter);

            // Load the data map and run the db generator.
            DataMap dataMap = loadDataMap();
            DbGenerator generator = new DbGenerator(adapterInst, dataMap);
View Full Code Here

                dropTables, dropPK, createTables, createPK, createFK));

        try {
            final DbAdapter adapterInst = (adapter == null) ?
                (DbAdapter)objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName()) :
                (DbAdapter)objectFactory.newInstance(DbAdapter.class, adapter);

            // Load the data map and run the db generator.
            DataMap dataMap = loadDataMap();
            DbGenerator generator = new DbGenerator(adapterInst, dataMap);
            generator.setShouldCreateFKConstraints(createFK);
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.