Package org.eclipse.persistence.sessions.server

Examples of org.eclipse.persistence.sessions.server.ServerSession


     * We preserve state from each processor run by holding static references
     * to projects.
     */
    public MetadataProject getMetadataProject(SEPersistenceUnitInfo puInfo) {
        if (! metadataProjects.containsKey(puInfo.getPersistenceUnitName())) {
            MetadataProject project = new MetadataProject(puInfo, new ServerSession(new Project(new DatabaseLogin())), false, false);
            metadataProjects.put(puInfo.getPersistenceUnitName(), project);
            return project;
        } else {
            return metadataProjects.get(puInfo.getPersistenceUnitName());
        }
View Full Code Here


          // keep only non server session properties - the rest will be either cached in the server session or ignored
          properties = splitProperties[0];
          Map serverSessionProperties = splitProperties[1];
          // the call top setupImpl.deploy() finishes the session
          // creation
          ServerSession tempServerSession = setupImpl.deploy(realLoader, serverSessionProperties);
          // discard all but non server session properties from server session properties.
          Map tempProperties = EntityManagerFactoryProvider.keepSpecifiedProperties(tempServerSession.getProperties(), supportedNonServerSessionProperties);
          // properties override server session properties
          Map propertiesToProcess = EntityManagerFactoryProvider.mergeMaps(properties, tempProperties);
          processProperties(propertiesToProcess);
          this.serverSession = tempServerSession;
        }
View Full Code Here

    return createEntityManagerImpl(properties);
  }

  protected EntityManagerImpl createEntityManagerImpl(Map properties) {
    verifyOpen();
    ServerSession session = getServerSession();
    if (!session.isLoggedIn()) {
      // PERF: Avoid synchronization.
      synchronized (session) {
        // DCL ok as isLoggedIn is volatile boolean, set after login is
        // complete.
        if (!session.isLoggedIn()) {
          session.login();
        }
      }
    }
    return new EntityManagerImpl(this, properties);
  }
View Full Code Here

  }

  public Cache getCache() {
    verifyOpen();
    if (myCache == null) {
      ServerSession session = this.getServerSession();
      myCache = new CacheImpl(this, session.getIdentityMapAccessor());
    }
    return myCache;
  }
View Full Code Here

                    // parent class we need to know about this class, so the
                    // factory will also hang onto static projects for each
                    // persistence unit. Doing this is going to need careful
                    // cleanup thoughts though. Adding classes ok, but what
                    // about removing some?
                    MetadataLogger logger = new MetadataLogger(new ServerSession(new Project(new DatabaseLogin())));
                    factory = new MetadataMirrorFactory(logger, Thread.currentThread().getContextClassLoader());
                    processingEnv.getMessager().printMessage(Kind.NOTE, "Creating the metadata factory ...");
                }
               
                // Step 1 - The factory is passed around so those who want the
View Full Code Here

    private ClassTransformer buildTransformer(PersistenceUnitInfo unitInfo, Writer logWriter, int logLevel) {
        //persistenceUnitInfo = unitInfo;
        ClassLoader privateClassLoader = unitInfo.getNewTempClassLoader();

        // create server session (it should be done before initializing ServerPlatform)
        ServerSession session = new ServerSession(new Project(new DatabaseLogin()));
        session.setLogLevel(logLevel);
        if(logWriter!=null){
            ((DefaultSessionLog)session.getSessionLog()).setWriter(logWriter);
         }
       
        session.getPlatform().setConversionManager(new JPAConversionManager());

        boolean weaveEager = false;
        String weaveEagerString = (String)unitInfo.getProperties().get(PersistenceUnitProperties.WEAVING_EAGER);
        if (weaveEagerString != null && weaveEagerString.equalsIgnoreCase("true")) {
            weaveEager = true;
View Full Code Here

                        throw EntityManagerSetupException.compositeIncompatibleWithSessionsXml(persistenceUnitInfo.getPersistenceUnitName());
                    }
                    session = new SessionBroker();
                    ((SessionBroker)session).setShouldUseDescriptorAliases(true);
                } else {
                    session = new ServerSession(new Project(new DatabaseLogin()));

                    //set the listener to process RCM metadata refresh commands
                    session.setRefreshMetadataListener(this);
                }
                session.setName(this.sessionName);
View Full Code Here

        delegate = new EntityManagerFactoryDelegate(newSetupImpl, deployProperties, this);
        // This code has been added to allow validation to occur without actually calling createEntityManager
        // RCM refresh command requires the DEPLOY_ON_STARTUP property is set to true so the listener can be added to the session.
        try{
            if (newSetupImpl.shouldGetSessionOnCreateFactory(deployProperties)) {
                ServerSession session = getServerSession();
                CommandManager rcm = session.getCommandManager();
                if (rcm != null && newSetupImpl.shouldSendMetadataRefreshCommand(deployProperties)) {
                    MetadataRefreshCommand command = new MetadataRefreshCommand(properties);
                    rcm.propagateCommand(command);
                }
                session.setRefreshMetadataListener(newSetupImpl);
            }
        } catch (RuntimeException ex) {
            if(delegate != null) {
                delegate.close();
            } else {
View Full Code Here

        delegate = new EntityManagerFactoryDelegate(newSetupImpl, deployProperties, this);
        // This code has been added to allow validation to occur without actually calling createEntityManager
        // RCM refresh command requires the DEPLOY_ON_STARTUP property is set to true so the listener can be added to the session.
        try{
            if (newSetupImpl.shouldGetSessionOnCreateFactory(deployProperties)) {
                ServerSession session = getServerSession();
                CommandManager rcm = session.getCommandManager();
                if (rcm != null && newSetupImpl.shouldSendMetadataRefreshCommand(deployProperties)) {
                    MetadataRefreshCommand command = new MetadataRefreshCommand(properties);
                    rcm.propagateCommand(command);
                }
                session.setRefreshMetadataListener(newSetupImpl);
            }
        } catch (RuntimeException ex) {
            if(delegate != null) {
                delegate.close();
            } else {
View Full Code Here

                isSessionLoadedFromSessionsXML = true;
            }
           
            // Create server session (it needs to be done before initializing ServerPlatform and logging).
            // If a sessions-xml is used this will get replaced later, but is required for logging.
            session = new ServerSession(new Project(new DatabaseLogin()));           
            // ServerSession name and ServerPlatform must be set prior to setting the loggers.
            session.setName(this.sessionName);
            ClassLoader realClassLoader = persistenceUnitInfo.getClassLoader();
            updateServerPlatform(predeployProperties, realClassLoader);
            // Update loggers and settings for the singleton logger and the session logger.
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.sessions.server.ServerSession

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.