Package org.jboss.shrinkwrap.descriptor.api.spec.jpa.persistence

Examples of org.jboss.shrinkwrap.descriptor.api.spec.jpa.persistence.PersistenceDescriptor


         FileResource<?> descriptor = getConfigFile();
         if (!descriptor.exists())
         {

            PersistenceDescriptor descriptorContents = Descriptors.create(PersistenceDescriptor.class)
                     .version("2.0");
            descriptor.setContents(descriptorContents.exportAsString());

         }
      }
      return true;
   }
View Full Code Here


   public void show(final PipeOut out, @Option(name = "all", shortName = "a") final boolean showAll)
   {
      if (project.hasFacet(PersistenceFacet.class))
      {
         PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
         PersistenceDescriptor config = jpa.getConfig();

         ShellMessages.info(out, "Displaying current JPA configuration:");

         if (!config.listUnits().isEmpty())
            out.println();

         for (PersistenceUnitDef unit : config.listUnits())
         {
            out.println(out.renderColor(ShellColor.BOLD, "Unit: ") + unit.getName() + "\t"
                     + out.renderColor(ShellColor.BOLD, "transaction-type: ") + unit.getTransactionType());
            out.println("description:\t" + unit.getDescription());
            out.println("provider:\t" + unit.getProvider());
View Full Code Here

            @Option(name = "named", defaultValue = DEFAULT_UNIT_NAME) final String unitName,
            final PipeOut out)
   {
      installPersistence();
      PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
      PersistenceDescriptor config = jpa.getConfig();

      PersistenceUnitDef unit = config.persistenceUnit(unitName);

      unit.name(unitName).description(DEFAULT_UNIT_DESC);

      JPADataSource ds = new JPADataSource()
               .setJndiDataSource(jtaDataSource)
View Full Code Here

   private String getPersistenceUnitName()
   {
      // This is currently limited to accessing the persistence units of the current project only, and not of
      // dependencies (like an EJB module with a PU that is accessible on the classpath, but not in WEB-INF/lib).
      PersistenceFacet persistence = project.getFacet(PersistenceFacet.class);
      PersistenceDescriptor persistenceDescriptor = persistence.getConfig();
      List<PersistenceUnitDef> units = persistenceDescriptor.listUnits();
     
      // If there is only one PU, then use it irrespective of whether it excludes unlisted classes or not.
      if (units.size() == 1)
      {
         return units.get(0).getName();
View Full Code Here

   public void show(final PipeOut out, @Option(name = "all", shortName = "a") final boolean showAll)
   {
      if (project.hasFacet(PersistenceFacet.class))
      {
         PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
         PersistenceDescriptor config = jpa.getConfig();

         ShellMessages.info(out, "Displaying current JPA configuration:");

         if (!config.listUnits().isEmpty())
            out.println();

         for (PersistenceUnitDef unit : config.listUnits())
         {
            out.println(out.renderColor(ShellColor.BOLD, "Unit: ") + unit.getName() + "\t"
                     + out.renderColor(ShellColor.BOLD, "transaction-type: ") + unit.getTransactionType());
            out.println("description:\t" + unit.getDescription());
            out.println("provider:\t" + unit.getProvider());
View Full Code Here

            @Option(name = "named", defaultValue = DEFAULT_UNIT_NAME) final String unitName,
            final PipeOut out)
   {
      installPersistence();
      PersistenceFacet jpa = project.getFacet(PersistenceFacet.class);
      PersistenceDescriptor config = jpa.getConfig();

      PersistenceUnitDef unit = config.persistenceUnit(unitName);

      unit.name(unitName).description(DEFAULT_UNIT_DESC);

      PersistenceContainer container = jpac.getContainer(manager);
      PersistenceProvider provider = jpap.getProvider(manager);
View Full Code Here

   @Override
   public PersistenceDescriptor getConfig()
   {
      DescriptorImporter<PersistenceDescriptor> importer = Descriptors.importAs(PersistenceDescriptor.class);
      PersistenceDescriptor descriptor = importer.from(getConfigFile().getResourceInputStream());
      return descriptor;
   }
View Full Code Here

         FileResource<?> descriptor = getConfigFile();
         if (!descriptor.exists())
         {

            PersistenceDescriptor descriptorContents = Descriptors.create(PersistenceDescriptor.class)
                     .version("2.0");
            descriptor.setContents(descriptorContents.exportAsString());

         }
      }
      return true;
   }
View Full Code Here

   public String getPersistenceUnitName()
   {
      // This is currently limited to accessing the persistence units of the current project only, and not of
      // dependencies (like an EJB module with a PU that is accessible on the classpath, but not in WEB-INF/lib).
      PersistenceFacet persistence = project.getFacet(PersistenceFacet.class);
      PersistenceDescriptor persistenceDescriptor = persistence.getConfig();
      List<PersistenceUnitDef> units = persistenceDescriptor.listUnits();

      // If there is only one PU, then use it irrespective of whether it excludes unlisted classes or not.
      if (units.size() == 1)
      {
         return units.get(0).getName();
View Full Code Here

      final FileResource<?> configFile = getConfigFile();
      if (!configFile.exists())
      {
         createDefaultConfig(configFile);
      }
      PersistenceDescriptor descriptor = importer.from(configFile.getResourceInputStream());
      return descriptor;
   }
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.descriptor.api.spec.jpa.persistence.PersistenceDescriptor

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.