Package org.apache.cayenne.di

Examples of org.apache.cayenne.di.Injector


                        DefaultObjectMapRetainStrategy.class);
                binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        DataContextFactory factory = new DataContextFactory();
        injector.injectMembers(factory);

        DataContext c1 = (DataContext) factory.createContext();
        assertTrue(c1.isValidatingObjectsOnCommit());

        domain.setValidatingObjectsOnCommit(false);
View Full Code Here


                        DefaultConfigurationNameMapper.class);
            }
        };

        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(url);
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        assertNotNull(handler);
View Full Code Here

                        DefaultConfigurationNameMapper.class);
            }
        };

        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(url);
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        assertNotNull(handler);
View Full Code Here

                        DefaultConfigurationNameMapper.class);
            }
        };

        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(url);
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        assertNotNull(handler);
View Full Code Here

                        DefaultConfigurationNameMapper.class);
            }
        };

        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(targetsBefore.get(0).toURL());
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        Resource upgraded = handler.performUpgrade();
View Full Code Here

     *             objects based JAXB, XStream or other similar frameworks.
     */
    @Deprecated
    public void decodeFromXML(XMLDecoder decoder) {

        Injector injector = CayenneRuntime.getThreadInjector();
        if (injector == null) {
            throw new IllegalStateException("Can't perform deserialization - "
                    + "no Injector bound to the current thread.");
        }

        EntityResolver resolver = injector
                .getInstance(DataChannel.class)
                .getEntityResolver();
        ObjEntity objectEntity = resolver.lookupObjEntity(getClass());

        for (final ObjAttribute att : objectEntity.getDeclaredAttributes()) {
View Full Code Here

                binder.bind(DataChannel.class).toInstance(channel);
                binder.bind(QueryCache.class).toInstance(cache);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        BaseContext context = new MockBaseContext();
        assertNull(context.channel);
        assertNull(context.queryCache);

        Injector oldInjector = CayenneRuntime.getThreadInjector();
        try {

            CayenneRuntime.bindThreadInjector(injector);

            assertTrue(context.attachToRuntimeIfNeeded());
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
View Full Code Here

    private boolean createFK;


    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));
View Full Code Here

    protected boolean attachToRuntimeIfNeeded() {
        if (channel != null) {
            return false;
        }

        Injector injector = CayenneRuntime.getThreadInjector();
        if (injector == null) {
            throw new CayenneRuntimeException("Can't attach to Cayenne runtime. "
                    + "Null injector returned from CayenneRuntime.getThreadInjector()");
        }
View Full Code Here

TOP

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

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.