Package org.eclipse.persistence.dynamic

Examples of org.eclipse.persistence.dynamic.DynamicClassLoader


     * at deploy time after all metadata processing has completed.
     */
    public void createDynamicClasses(ClassLoader loader) {
        if (! m_virtualClasses.isEmpty()) {
            if (DynamicClassLoader.class.isAssignableFrom(loader.getClass())) {
                DynamicClassLoader dcl = (DynamicClassLoader) loader;
           
                // Create the dynamic classes.
                Map<String, MetadataDescriptor> dynamicClasses = new HashMap<String, MetadataDescriptor>();
                for (ClassAccessor accessor : m_virtualClasses.values()) {
                    createDynamicClass(accessor.getDescriptor(), dynamicClasses, dcl);
View Full Code Here


  public DataStoreModule(ViewInstanceEntity viewInstanceEntity) {
    ViewEntity view = viewInstanceEntity.getViewEntity();

    this.viewInstanceEntity   = viewInstanceEntity;
    this.classLoader          = new DynamicClassLoader(view.getClassLoader());
    this.entityManagerFactory = getEntityManagerFactory(view.getAmbariConfiguration());
    this.jpaDynamicHelper     = new JPADynamicHelper(entityManagerFactory.createEntityManager());
  }
View Full Code Here

      "    </persistence>" +
      "</view>";

  @Test
  public void testStore_create() throws Exception {
    DynamicClassLoader classLoader = new DynamicClassLoader(DataStoreImplTest.class.getClassLoader());

    // create mocks
    EntityManagerFactory entityManagerFactory = createMock(EntityManagerFactory.class);
    EntityManager entityManager = createMock(EntityManager.class);
    JPADynamicHelper jpaDynamicHelper = createNiceMock(JPADynamicHelper.class);
View Full Code Here

    verify(entityManagerFactory, entityManager, jpaDynamicHelper, transaction, schemaManager);
  }

  @Test
  public void testStore_update() throws Exception {
    DynamicClassLoader classLoader = new DynamicClassLoader(DataStoreImplTest.class.getClassLoader());

    // create mocks
    EntityManagerFactory entityManagerFactory = createMock(EntityManagerFactory.class);
    EntityManager entityManager = createMock(EntityManager.class);
    JPADynamicHelper jpaDynamicHelper = createNiceMock(JPADynamicHelper.class);
View Full Code Here

    verify(entityManagerFactory, entityManager, jpaDynamicHelper, transaction, schemaManager, dynamicEntity);
  }

  @Test
  public void testRemove() throws Exception {
    DynamicClassLoader classLoader = new DynamicClassLoader(DataStoreImplTest.class.getClassLoader());

    // create mocks
    EntityManagerFactory entityManagerFactory = createMock(EntityManagerFactory.class);
    EntityManager entityManager = createMock(EntityManager.class);
    JPADynamicHelper jpaDynamicHelper = createNiceMock(JPADynamicHelper.class);
View Full Code Here

    verify(entityManagerFactory, entityManager, jpaDynamicHelper, transaction, schemaManager, dynamicEntity);
  }

  @Test
  public void testFind() throws Exception {
    DynamicClassLoader classLoader = new DynamicClassLoader(DataStoreImplTest.class.getClassLoader());

    // create mocks
    EntityManagerFactory entityManagerFactory = createMock(EntityManagerFactory.class);
    EntityManager entityManager = createMock(EntityManager.class);
    JPADynamicHelper jpaDynamicHelper = createNiceMock(JPADynamicHelper.class);
View Full Code Here

    verify(entityManagerFactory, entityManager, jpaDynamicHelper, dynamicEntity, schemaManager);
  }

  @Test
  public void testFindAll() throws Exception {
    DynamicClassLoader classLoader = new DynamicClassLoader(DataStoreImplTest.class.getClassLoader());

    // create mocks
    EntityManagerFactory entityManagerFactory = createMock(EntityManagerFactory.class);
    EntityManager entityManager = createMock(EntityManager.class);
    JPADynamicHelper jpaDynamicHelper = createNiceMock(JPADynamicHelper.class);
View Full Code Here

    verify(entityManagerFactory, entityManager, jpaDynamicHelper, dynamicEntity, query, schemaManager);
  }

  @Test
  public void testFindAll_multiple() throws Exception {
    DynamicClassLoader classLoader = new DynamicClassLoader(DataStoreImplTest.class.getClassLoader());

    // create mocks
    EntityManagerFactory entityManagerFactory = createMock(EntityManagerFactory.class);
    EntityManager entityManager = createMock(EntityManager.class);
    JPADynamicHelper jpaDynamicHelper = createNiceMock(JPADynamicHelper.class);
View Full Code Here

    public PersistenceContext get(String persistenceUnit, URI defaultURI, String version, Map<String, Object> initializationProperties) {
        PersistenceContext app = getDynamicPersistenceContext(persistenceUnit);
        if (app == null){
            try{
                DynamicClassLoader dcl = new DynamicClassLoader(Thread.currentThread().getContextClassLoader());
                Map<String, Object> properties = new HashMap<String, Object>();
                properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
                if (initializationProperties != null){
                    properties.putAll(initializationProperties);
                }
               
                EntityManagerFactoryImpl factory = (EntityManagerFactoryImpl) Persistence.createEntityManagerFactory(persistenceUnit, properties);
                ClassLoader sessionLoader = factory.getServerSession().getLoader();
                if (!DynamicClassLoader.class.isAssignableFrom(sessionLoader.getClass()) ) {
                    properties = new HashMap<String, Object>();
                    dcl = new DynamicClassLoader(sessionLoader);
                    properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
                    if (initializationProperties != null){
                        properties.putAll(initializationProperties);
                    }
                    factory.refreshMetadata(properties);
View Full Code Here

    // persistence unit (unless they exclude them).
    private Set<EntityListenerMetadata> m_defaultListeners;
   
    public void createRestInterfaces(ClassLoader loader) {
        if (DynamicClassLoader.class.isAssignableFrom(loader.getClass())) {
            DynamicClassLoader dcl = (DynamicClassLoader) loader;
            for (EntityAccessor accessor : getEntityAccessors()) {
                String className = accessor.getParentClassName();
                if (className == null || getEntityAccessor(className) == null) {
                    RestAdapterClassWriter restAdapter = new RestAdapterClassWriter(
                            accessor.getJavaClassName());
                    dcl.addClass(restAdapter.getClassName(), restAdapter);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.dynamic.DynamicClassLoader

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.