Return-Path: X-Original-To: apmail-onami-commits-archive@minotaur.apache.org Delivered-To: apmail-onami-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A64C410C93 for ; Wed, 19 Mar 2014 11:00:00 +0000 (UTC) Received: (qmail 72963 invoked by uid 500); 19 Mar 2014 10:59:59 -0000 Delivered-To: apmail-onami-commits-archive@onami.apache.org Received: (qmail 72922 invoked by uid 500); 19 Mar 2014 10:59:59 -0000 Mailing-List: contact commits-help@onami.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@onami.apache.org Delivered-To: mailing list commits@onami.apache.org Received: (qmail 72914 invoked by uid 99); 19 Mar 2014 10:59:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Mar 2014 10:59:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Mar 2014 10:59:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DE4532388C6D; Wed, 19 Mar 2014 10:59:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1579191 [13/32] - in /onami/site/persist: ./ apidocs/ apidocs/assets/ apidocs/assets/images/ apidocs/reference/ apidocs/reference/org/ apidocs/reference/org/apache/ apidocs/reference/org/apache/onami/ apidocs/reference/org/apache/onami/per... Date: Wed, 19 Mar 2014 10:58:54 -0000 To: commits@onami.apache.org From: olamy@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140319105901.DE4532388C6D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: onami/site/persist/cobertura/org.apache.onami.persist.ApplicationManagedPersistenceUnitModule.html URL: http://svn.apache.org/viewvc/onami/site/persist/cobertura/org.apache.onami.persist.ApplicationManagedPersistenceUnitModule.html?rev=1579191&view=auto ============================================================================== --- onami/site/persist/cobertura/org.apache.onami.persist.ApplicationManagedPersistenceUnitModule.html (added) +++ onami/site/persist/cobertura/org.apache.onami.persist.ApplicationManagedPersistenceUnitModule.html Wed Mar 19 10:58:49 2014 @@ -0,0 +1,220 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.onami.persist.ApplicationManagedPersistenceUnitModule
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
ApplicationManagedPersistenceUnitModule
100%
10/10
N/A
1
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.onami.persist;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import javax.persistence.EntityManagerFactory;
 23  
 import java.util.Properties;
 24  
 
 25  
 import static org.apache.onami.persist.Preconditions.checkNotNull;
 26  
 
 27  
 /**
 28  
  * Persistence module for an application managed persistence unit.
 29  
  * <p/>
 30  
  * Use the {@link PersistenceUnitBuilder} to configure an instance of this class.
 31  
  * <p/>
 32  
  * This is a guice private module which will expose the following bindings:
 33  
  * <ul>
 34  
  * <li>{@link UnitOfWork}</li>
 35  
  * <li>{@link EntityManagerProvider}</li>
 36  
  * <li>{@link PersistenceService}</li>
 37  
  * </ul>
 38  
  * If an annotation has been defined for this module the above classes are exposed with this
 39  
  * annotation. Within the private module the above classes are also binded without any annotation.
 40  
  * <p/>
 41  
  * You can extend this class and override {@link #configurePersistence()} to bind and expose
 42  
  * additional classes within this private module. This is useful if you require injection of the
 43  
  * above classes without annotation.
 44  
  */
 45  
 public class ApplicationManagedPersistenceUnitModule
 46  
     extends AbstractPersistenceUnitModule
 47  
 {
 48  
 
 49  
     // ---- Members
 50  
 
 51  
     /**
 52  
      * Provider for {@link EntityManagerFactory}
 53  
      */
 54  
     private final ApplicationManagedEntityManagerFactoryProvider emfProvider;
 55  
 
 56  
     // ---- Constructors
 57  
 
 58  
     /**
 59  
      * Constructor.
 60  
      *
 61  
      * @param puName the name of the persistence unit as defined in the persistence.xml. Must not be {@code null}.
 62  
      */
 63  
     public ApplicationManagedPersistenceUnitModule( String puName )
 64  
     {
 65  156
         this( puName, new Properties() );
 66  156
     }
 67  
 
 68  
     /**
 69  
      * Constructor.
 70  
      *
 71  
      * @param puName     the name of the persistence unit as defined in the persistence.xml. Must not be {@code null}.
 72  
      * @param properties the additional properties. Theses override the ones defined in the persistence.xml. Must not be {@code null}.
 73  
      */
 74  
     public ApplicationManagedPersistenceUnitModule( String puName, Properties properties )
 75  
     {
 76  156
         this( new ApplicationManagedEntityManagerFactoryProvider( puName, properties ) );
 77  156
         checkNotNull( puName );
 78  156
         checkNotNull( properties );
 79  156
     }
 80  
 
 81  
     /**
 82  
      * Constructor.
 83  
      *
 84  
      * @param emfProvider the provider for {@link EntityManagerFactory}.
 85  
      */
 86  
     private ApplicationManagedPersistenceUnitModule( ApplicationManagedEntityManagerFactoryProvider emfProvider )
 87  
     {
 88  156
         super( new EntityManagerProviderImpl( emfProvider ) );
 89  156
         this.emfProvider = emfProvider;
 90  156
     }
 91  
 
 92  
     // ---- Methods
 93  
 
 94  
     /**
 95  
      * {@inheritDoc}
 96  
      */
 97  
     @Override
 98  
     final PersistenceService getPersistenceService()
 99  
     {
 100  312
         return emfProvider;
 101  
     }
 102  
 
 103  
 }
+ + + + \ No newline at end of file Propchange: onami/site/persist/cobertura/org.apache.onami.persist.ApplicationManagedPersistenceUnitModule.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: onami/site/persist/cobertura/org.apache.onami.persist.ApplicationManagedPersistenceUnitModule.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider.html URL: http://svn.apache.org/viewvc/onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider.html?rev=1579191&view=auto ============================================================================== --- onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider.html (added) +++ onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider.html Wed Mar 19 10:58:49 2014 @@ -0,0 +1,240 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
ContainerManagedEntityManagerFactoryProvider
0%
0/18
0%
0/6
2.4
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.onami.persist;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import javax.naming.InitialContext;
 23  
 import javax.naming.NamingException;
 24  
 import javax.persistence.EntityManagerFactory;
 25  
 
 26  
 import static org.apache.onami.persist.Preconditions.checkNotNull;
 27  
 
 28  
 /**
 29  
  * Implementation of {@link PersistenceService} and {@link EntityManagerFactoryProvider} for
 30  
  * container managed entity manager factories.
 31  
  */
 32  
 final class ContainerManagedEntityManagerFactoryProvider
 33  
     implements EntityManagerFactoryProvider, PersistenceService
 34  
 {
 35  
 
 36  
     // ---- Members
 37  
 
 38  
     /**
 39  
      * The JNDI name of the {@link EntityManagerFactory}.
 40  
      */
 41  
     private final String emfJndiName;
 42  
 
 43  
     /**
 44  
      * The {@link EntityManagerFactory}.
 45  
      */
 46  
     private EntityManagerFactory emf;
 47  
 
 48  
     // ---- Constructor
 49  
 
 50  
     /**
 51  
      * Constructor.
 52  
      *
 53  
      * @param emfJndiName the JNDI name of the {@link EntityManagerFactory}. Must not be {@code null}.
 54  
      */
 55  
     public ContainerManagedEntityManagerFactoryProvider( String emfJndiName )
 56  0
     {
 57  0
         checkNotNull( emfJndiName );
 58  0
         this.emfJndiName = emfJndiName;
 59  0
     }
 60  
 
 61  
     // ---- Methods
 62  
 
 63  
     /**
 64  
      * {@inheritDoc}
 65  
      */
 66  
     // @Override
 67  
     public EntityManagerFactory get()
 68  
     {
 69  0
         if ( isRunning() )
 70  
         {
 71  0
             return emf;
 72  
         }
 73  
 
 74  0
         throw new IllegalStateException( "PersistenceService is not running." );
 75  
     }
 76  
 
 77  
     /**
 78  
      * {@inheritDoc}
 79  
      */
 80  
     // @Override
 81  
     public void start()
 82  
     {
 83  0
         if ( isRunning() )
 84  
         {
 85  0
             throw new IllegalStateException( "PersistenceService is already running." );
 86  
         }
 87  
         try
 88  
         {
 89  0
             final InitialContext ctx = new InitialContext();
 90  0
             emf = (EntityManagerFactory) ctx.lookup( emfJndiName );
 91  
         }
 92  0
         catch ( NamingException e )
 93  
         {
 94  0
             throw new RuntimeException( "lookup for EntityManagerFactory with JNDI name '" + emfJndiName + "' failed",
 95  
                                         e );
 96  0
         }
 97  0
     }
 98  
 
 99  
     /**
 100  
      * {@inheritDoc}
 101  
      */
 102  
     // @Override
 103  
     public boolean isRunning()
 104  
     {
 105  0
         return null != emf;
 106  
     }
 107  
 
 108  
     /**
 109  
      * {@inheritDoc}
 110  
      */
 111  
     // @Override
 112  
     public void stop()
 113  
     {
 114  0
         emf = null;
 115  0
     }
 116  
 
 117  
 }
+ + + + \ No newline at end of file Propchange: onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedEntityManagerFactoryProvider.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedPersistenceUnitModule.html URL: http://svn.apache.org/viewvc/onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedPersistenceUnitModule.html?rev=1579191&view=auto ============================================================================== --- onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedPersistenceUnitModule.html (added) +++ onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedPersistenceUnitModule.html Wed Mar 19 10:58:49 2014 @@ -0,0 +1,224 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.onami.persist.ContainerManagedPersistenceUnitModule
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
ContainerManagedPersistenceUnitModule
0%
0/10
N/A
1
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.onami.persist;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import javax.persistence.EntityManagerFactory;
 23  
 import java.util.Properties;
 24  
 
 25  
 import static org.apache.onami.persist.Preconditions.checkNotNull;
 26  
 
 27  
 /**
 28  
  * Persistence module for an container managed persistence unit.
 29  
  * <p/>
 30  
  * Use the {@link PersistenceUnitBuilder} to configure an instance of this class.
 31  
  * <p/>
 32  
  * This is a private module which will expose the following bindings:
 33  
  * <ul>
 34  
  * <li>{@link UnitOfWork}</li>
 35  
  * <li>{@link EntityManagerProvider}</li>
 36  
  * <li>{@link PersistenceService}</li>
 37  
  * </ul>
 38  
  * If an annotation has been defined for this module the above classes are exposed with this
 39  
  * annotation. Within the private module the above classes are also binded without any annotation.
 40  
  * <p/>
 41  
  * You can extend this class and override {@link #configurePersistence()} to bind and expose
 42  
  * additional classes within this private module. This is useful if you require injection of the
 43  
  * above classes without annotation.
 44  
  */
 45  
 public class ContainerManagedPersistenceUnitModule
 46  
     extends AbstractPersistenceUnitModule
 47  
 {
 48  
 
 49  
     // ---- Members
 50  
 
 51  
     /**
 52  
      * Provider for {@link EntityManagerFactory}
 53  
      */
 54  
     private final ContainerManagedEntityManagerFactoryProvider emfProvider;
 55  
 
 56  
     // ---- Constructors
 57  
 
 58  
     /**
 59  
      * Constructor.
 60  
      *
 61  
      * @param emfJndiName the JNDI name of the {@link EntityManagerFactory}.
 62  
      */
 63  
     public ContainerManagedPersistenceUnitModule( String emfJndiName )
 64  
     {
 65  0
         this( emfJndiName, new Properties() );
 66  0
     }
 67  
 
 68  
     /**
 69  
      * Constructor.
 70  
      *
 71  
      * @param emfJndiName the JNDI name of the {@link EntityManagerFactory}. Must not be {@code null}.
 72  
      * @param properties  the additional properties. Theses override the ones defined in the persistence.xml. Must not be {@code null}.
 73  
      */
 74  
     public ContainerManagedPersistenceUnitModule( String emfJndiName, Properties properties )
 75  
     {
 76  0
         this( new ContainerManagedEntityManagerFactoryProvider( emfJndiName ), properties );
 77  0
         checkNotNull( emfJndiName );
 78  0
         checkNotNull( properties );
 79  0
     }
 80  
 
 81  
     /**
 82  
      * Constructor.
 83  
      *
 84  
      * @param emfProvider the provider for {@link EntityManagerFactory}.
 85  
      * @param properties  the additional properties. Theses override the ones defined in the persistence.xml.
 86  
      */
 87  
     private ContainerManagedPersistenceUnitModule( ContainerManagedEntityManagerFactoryProvider emfProvider,
 88  
                                                    Properties properties )
 89  
     {
 90  0
         super( new EntityManagerProviderImpl( emfProvider, properties ) );
 91  0
         this.emfProvider = emfProvider;
 92  0
     }
 93  
 
 94  
     // ---- Methods
 95  
 
 96  
     /**
 97  
      * {@inheritDoc}
 98  
      */
 99  
     @Override
 100  
     PersistenceService getPersistenceService()
 101  
     {
 102  0
         return emfProvider;
 103  
     }
 104  
 
 105  
 }
+ + + + \ No newline at end of file Propchange: onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedPersistenceUnitModule.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: onami/site/persist/cobertura/org.apache.onami.persist.ContainerManagedPersistenceUnitModule.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Added: onami/site/persist/cobertura/org.apache.onami.persist.EntityManagerFactoryProvider.html URL: http://svn.apache.org/viewvc/onami/site/persist/cobertura/org.apache.onami.persist.EntityManagerFactoryProvider.html?rev=1579191&view=auto ============================================================================== --- onami/site/persist/cobertura/org.apache.onami.persist.EntityManagerFactoryProvider.html (added) +++ onami/site/persist/cobertura/org.apache.onami.persist.EntityManagerFactoryProvider.html Wed Mar 19 10:58:49 2014 @@ -0,0 +1,98 @@ + + + + +Coverage Report + + + + +
Coverage Report - org.apache.onami.persist.EntityManagerFactoryProvider
+
 
+ + + + +
Classes in this File Line Coverage Branch Coverage Complexity
EntityManagerFactoryProvider
N/A
N/A
1
+
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1  
 package org.apache.onami.persist;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import javax.persistence.EntityManagerFactory;
 23  
 
 24  
 /**
 25  
  * Provider for {@link EntityManagerFactoryProvider}.
 26  
  */
 27  
 interface EntityManagerFactoryProvider
 28  
 {
 29  
 
 30  
     /**
 31  
      * @return the provider for {@link EntityManagerFactory}.
 32  
      * @throws IllegalStateException if {@link PersistenceService#isRunning()} returns {@code false}.
 33  
      */
 34  
     EntityManagerFactory get()
 35  
         throws IllegalStateException;
 36  
 
 37  
 }
+ + + + \ No newline at end of file Propchange: onami/site/persist/cobertura/org.apache.onami.persist.EntityManagerFactoryProvider.html ------------------------------------------------------------------------------ svn:eol-style = native Propchange: onami/site/persist/cobertura/org.apache.onami.persist.EntityManagerFactoryProvider.html ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision