Package javax.jdo

Examples of javax.jdo.PersistenceManagerFactory


                System.out.println();
            }
        }

        // Create a PMF for use with this mode
        PersistenceManagerFactory pmf = null;
        try
        {
            if (tool.getPropsFileName() != null)
            {
                pmf = getPMFForMode(mode, tool.getApi(), tool.getOptions(), tool.getStringProperty("org.jpox.PersistenceUnitName"),
                    ddlFilename, tool.isVerbose());
            }
            else
            {
                pmf = getPMFForMode(mode, tool.getApi(), null, tool.getStringProperty("org.jpox.PersistenceUnitName"), ddlFilename,
                    tool.isVerbose());
            }
        }
        catch (Exception e)
        {
            // Unable to create a PMF so likely input errors
            JPOXLogger.SCHEMATOOL.error("Error creating PMF", e);
            System.out.println(LOCALISER.msg(false, "014008", e.getMessage()));
            System.exit(1);
            return;
        }

        List classNames = null;
        if (mode != SCHEMATOOL_SCHEMA_INFO_MODE && mode != SCHEMATOOL_DATABASE_INFO_MODE)
        {
            // Find the names of the classes to be processed
            // This will load up all MetaData for the specified input and throw exceptions where errors are found
            try
            {
                MetaDataManager metaDataMgr = ((ObjectManagerFactoryImpl)pmf).getOMFContext().getMetaDataManager();
                ClassLoaderResolver clr = ((ObjectManagerFactoryImpl)pmf).getOMFContext().getClassLoaderResolver(null);

                FileMetaData[] filemds = getFileMetaDataForInput(metaDataMgr, clr, tool.isVerbose(),
                    tool.getStringProperty("org.jpox.PersistenceUnitName"), tool.getDefaultArgs());
                classNames = new ArrayList();
                if (filemds == null)
                {
                    msg = LOCALISER.msg(false, "014021");
                    JPOXLogger.SCHEMATOOL.error(msg);
                    System.out.println(msg);
                    System.exit(2);
                    return;
                }
                for (int i=0;i<filemds.length;i++)
                {
                    for (int j=0;j<filemds[i].getNoOfPackages();j++)
                    {
                        for (int k=0;k<filemds[i].getPackage(j).getNoOfClasses();k++)
                        {
                            classNames.add(filemds[i].getPackage(j).getClass(k).getFullClassName());
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // Exception will have been logged and sent to System.out in "getFileMetaDataForInput()"
                System.exit(2);
                return;
            }
        }

        // Run SchemaTool
        try
        {
            if (mode == SCHEMATOOL_CREATE_MODE)
            {
                createSchema(pmf, classNames, ddlFilename, tool.getCompleteDdl());
            }
            else if (mode == SCHEMATOOL_DELETE_MODE)
            {
                deleteSchema(pmf, classNames);
            }
            else if (mode == SCHEMATOOL_VALIDATE_MODE)
            {
                validateSchema(pmf, classNames);
            }
            else if (mode == SCHEMATOOL_DATABASE_INFO_MODE)
            {
                StoreManager srm = ((AbstractPersistenceManager) pmf.getPersistenceManager()).getObjectManager().getStoreManager();
                srm.outputDatastoreInformation(System.out);
            }
            else if (mode == SCHEMATOOL_SCHEMA_INFO_MODE)
            {
                StoreManager srm = ((AbstractPersistenceManager) pmf.getPersistenceManager()).getObjectManager().getStoreManager();
                srm.outputSchemaInformation(System.out);
            }

            msg = LOCALISER.msg(false, "014043");
            JPOXLogger.SCHEMATOOL.info(msg);
View Full Code Here


    sum.setScholarOrCraftsmanScore(con.getScholarOrCraftsmanScore());
    sum.setKingScore(con.getKingScore());
    sum.setSolderScore(con.getSolderScore());
    sum.setScholarScore(con.getScholarScore());
    sum.setCraftsmanScore(con.getCraftsmanScore());
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = pmf.getPersistenceManager();
    try{
      pm.makePersistent(sum);
      //log.info("Result:" +sum.toString());
    }finally{
      pm.close();
View Full Code Here

      pm.close();
    }
  }

  public Count getCount(WorkoutContext con){
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = null;
    try{
      pm = pmf.getPersistenceManager();
      Transaction tx = pm.currentTransaction();
      Count c = null;
      try{
        tx.begin();
        try{
View Full Code Here

      if(pm!=null) pm.close();
    }
  }
 
  public Count getCount(){
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = null;
    try{
      pm = pmf.getPersistenceManager();
      Transaction tx = pm.currentTransaction();
      Count c = null;
      try{
        tx.begin();
        try{
View Full Code Here

    if(sum==null){
      log.info("[SummaryCronService#execute()] no-summary/end: " +
          (System.currentTimeMillis() - elapse) + "mSec.");
      return;
    }
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = null;
    try{
      pm = pmf.getPersistenceManager();
      Transaction tx = pm.currentTransaction();
      try{
        tx.begin();
        pm.makePersistent(sum);
        tx.commit();
View Full Code Here

      log.info("[ResultsCronService#execute()] no-results/end: " +
          (System.currentTimeMillis() - elapse) + "mSec.");
      return;
    }
    List<Result> resultList = results.getResultList();
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = null;
    try{
      pm = pmf.getPersistenceManager();
      Transaction tx = pm.currentTransaction();
      try{
        for(Result r: resultList){
          tx.begin();
          log.info("[ResultsCronService#execute()] " +
View Full Code Here

   */
  private Summary retrieveSummary(){
    long elapse = System.currentTimeMillis();
    log.info("[StatisticsManager#retrieveSummary()] start");
    Summary summary = null;
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = null;
    try{
      pm = pmf.getPersistenceManager();
      Transaction tx = pm.currentTransaction();
      try{
        tx.begin();
        summary =
            pm.getObjectById(Summary.class, Summary.DBKEY_SUMMARY);
View Full Code Here

    protected DefaultConfigurableJdoFactory factory;

    public void backupDatabase( File backupDirectory )
        throws IOException
    {
        PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdo109" );

        ContinuumDatabase database = new ContinuumDatabase();
        try
        {
            database.setSystemConfiguration( retrieveSystemConfiguration( pmf ) );
View Full Code Here

    }

    @SuppressWarnings({"OverlyCoupledMethod"})
    public void eraseDatabase()
    {
        PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdo109" );
        PersistenceManager persistenceManager = getPersistenceManager( pmf );
        PlexusJdoUtils.removeAll( persistenceManager, ProjectGroup.class );
        PlexusJdoUtils.removeAll( persistenceManager, Project.class );
        PlexusJdoUtils.removeAll( persistenceManager, Schedule.class );
        PlexusJdoUtils.removeAll( persistenceManager, ScmResult.class );
View Full Code Here

        finally
        {
            IOUtil.close( fileReader );
        }

        PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdorepl109" );

        PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration() );

        Map<Integer, Schedule> schedules = new HashMap<Integer, Schedule>();
        for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); )
        {
            Schedule schedule = (Schedule) i.next();

            schedule = (Schedule) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), schedule );
            schedules.put( Integer.valueOf( schedule.getId() ), schedule );
        }

        for ( Iterator i = database.getProjectGroups().iterator(); i.hasNext(); )
        {
            ProjectGroup projectGroup = (ProjectGroup) i.next();

            // first, we must map up any schedules, etc.
            processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules );

            for ( Iterator j = projectGroup.getProjects().iterator(); j.hasNext(); )
            {
                Project project = (Project) j.next();

                processBuildDefinitions( project.getBuildDefinitions(), schedules );
            }

            PlexusJdoUtils.addObject( pmf.getPersistenceManager(), projectGroup );
        }
        pmf.close();
    }
View Full Code Here

TOP

Related Classes of javax.jdo.PersistenceManagerFactory

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.