Package org.apache.cayenne.di

Examples of org.apache.cayenne.di.AdhocObjectFactory


        binder.bindList(Constants.SERVER_DEFAULT_TYPES_LIST);
        binder.bindList(Constants.SERVER_USER_TYPES_LIST);
        binder.bindList(Constants.SERVER_TYPE_FACTORIES_LIST);

        AdhocObjectFactory objectFactory = new DefaultAdhocObjectFactory();
        binder.bind(AdhocObjectFactory.class).toInstance(objectFactory);

        binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
        binder.bind(BatchQueryBuilderFactory.class).to(DefaultBatchQueryBuilderFactory.class);
        binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
View Full Code Here


        final EventManager eventManager = new MockEventManager();

        Module testModule = new Module() {

            public void configure(Binder binder) {
                final AdhocObjectFactory objectFactory = new DefaultAdhocObjectFactory();
                binder.bind(AdhocObjectFactory.class).toInstance(objectFactory);
               
                binder.bindMap(Constants.PROPERTIES_MAP);
               
                binder
View Full Code Here

    public void execute() throws MojoExecutionException, MojoFailureException {

        Log logger = new MavenLogger(this);
        Injector injector = DIBootstrap.createInjector(new ToolsModule(logger));
        AdhocObjectFactory objectFactory = injector.getInstance(AdhocObjectFactory.class);

        logger.info(String.format("connection settings - [driver: %s, url: %s, username: %s]", driver, url, username));

        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());
            generator.setShouldCreateFKConstraints(createFK);
View Full Code Here

        binder.bindMap(Constants.PROPERTIES_MAP)
            .put(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, String.valueOf(DEFAULT_MAX_ID_QUALIFIER_SIZE));

        binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
       
        AdhocObjectFactory objectFactory = new DefaultAdhocObjectFactory();
        binder.bind(AdhocObjectFactory.class).toInstance(objectFactory);

        // configure known DbAdapter detectors in reverse order of popularity. Users can
        // add their own to install custom adapters automatically
        binder
View Full Code Here

    @Override
    public void execute() {
       
        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

     * @param adapter The db adapter to set.
     */
    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);
        }
    }
View Full Code Here

        final EventManager eventManager = new MockEventManager();

        Module testModule = new Module() {

            public void configure(Binder binder) {
                final AdhocObjectFactory objectFactory = new DefaultAdhocObjectFactory();
                binder.bind(AdhocObjectFactory.class).toInstance(objectFactory);
               
                binder.bindMap(Constants.PROPERTIES_MAP);
               
                binder
View Full Code Here

        binder.bindMap(Constants.PROPERTIES_MAP)
            .put(Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY, String.valueOf(DEFAULT_MAX_ID_QUALIFIER_SIZE));

        binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
       
        AdhocObjectFactory objectFactory = new DefaultAdhocObjectFactory();
        binder.bind(AdhocObjectFactory.class).toInstance(objectFactory);

        // configure known DbAdapter detectors in reverse order of popularity. Users can
        // add their own to install custom adapters automatically
        binder
View Full Code Here

  private Log logger;

  public void execute() throws MojoExecutionException, MojoFailureException {

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

    logger = new MavenLogger(this);

    logger.debug(String
        .format("connection settings - [driver: %s, url: %s, username: %s, password: %s]",
            driver, url, username, password));

    logger.info(String
        .format("importer options - [map: %s, overwriteExisting: %s, schemaName: %s, tablePattern: %s, importProcedures: %s, procedurePattern: %s, meaningfulPk: %s, namingStrategy: %s]",
            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...
      DriverDataSource dataSource = new DriverDataSource((Driver) Class
          .forName(driver).newInstance(), url, username, password);
View Full Code Here


    public void execute() throws MojoExecutionException, MojoFailureException {
     
      Injector injector = DIBootstrap.createInjector(new ToolModule());
      AdhocObjectFactory objectFactory = injector.getInstance(AdhocObjectFactory.class);

    Log logger = new MavenLogger(this);

        logger.info(String.format("connection settings - [driver: %s, url: %s, username: %s]", driver, url, username));

        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);
            generator.setShouldCreateFKConstraints(createFK);
View Full Code Here

TOP

Related Classes of org.apache.cayenne.di.AdhocObjectFactory

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.