|
Glassfish example source code file (CMP11Templates.properties)
The Glassfish CMP11Templates.properties source code# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # # Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. # # The contents of this file are subject to the terms of either the GNU # General Public License Version 2 only ("GPL") or the Common Development # and Distribution License("CDDL") (collectively, the "License"). You # may not use this file except in compliance with the License. You can # obtain a copy of the License at # https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html # or packager/legal/LICENSE.txt. See the License for the specific # language governing permissions and limitations under the License. # # When distributing the software, include this License Header Notice in each # file and include the License file at packager/legal/LICENSE.txt. # # GPL Classpath Exception: # Oracle designates this particular file as subject to the "Classpath" # exception as provided by Oracle in the GPL Version 2 section of the License # file that accompanied this code. # # Modifications: # If applicable, add the following below the License Header, with the fields # enclosed by brackets [] replaced by your own identifying information: # "Portions Copyright [year] [name of copyright owner]" # # Contributor(s): # If you wish your version of this file to be governed by only the CDDL or # only the GPL Version 2, indicate your decision by adding "[Contributor] # elects to include this software in this distribution under the [CDDL or GPL # Version 2] license." If you don't indicate a single choice of license, a # recipient has the option to distribute your version of this file under # either the CDDL, the GPL Version 2 or to extend the choice of license to # its licensees as provided above. However, if you add GPL Version 2 code # and therefore, elected the GPL Version 2 license, then the option applies # only if the new code is made subject to such option by the copyright # holder. # # # ----------------------------------------------------------------------------- # CMP1.1 specific properties # ----------------------------------------------------------------------------- # # # Code Signature via CVS keyword substitution # signature1_1 = $RCSfile: CMP11Templates.properties,v $ $Revision: 1.2 $ # # Variables: # # PLEASE NOTE, all internal variables should start with _jdo # to avoid name clashes with CMR variables. # one_oneVariables=\ boolean _jdoIsContainerTransaction true\n ############################### # finder method bodies ############################### # Set the ignoreCache flag to true (EJB1.1 finders only) # {0} - ignore cache value (true/false) ejbQuerySetIgnoreCache=\ \t\t\tq.setIgnoreCache({0});\n ############################### # other method bodies ############################### # ejbCreate1.1 # {0} - PC Class. # {1} - param list. # {2} - PK Class. # {3} - Concrete Impl name # {4} - Exception type: DuplicateKeyException if it (or CreateException) is in the # throws clause of the abstract's bean ejbCreate method, EJBException otherwise. # {5} - Concatenated parameter list # # Note: super.ejbCreate must be called BEFORE acquiring a new PersistenceManager. # CMP1.1 can execute a create() method in a non-transactional context, which # will require beginning a JDO transaction. This transaction must be rolled # back in case of any exception. If an exception is thrown from super.ejbCreate # (before beginning the JDO transaction), the _jdoInstance reference should be set to # null, but no other processing is needed. ejbCreate1_1=\ if(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbCreate - begin: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ assertPersistenceManagerIsNull();\n\ boolean success = false;\n\ try '{'\n\ \t_jdoInstance = new {0}();\n\ \tjdoLoadFields();\n\ \tsuper.ejbCreate({1});\n\ \tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbCreate - jdoGetPersistenceManager: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ \t_jdoPersistenceManager = jdoGetPersistenceManager();\n\ \tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbCreate - jdoGetPersistenceManager: " + this + ":: " + _jdoPersistenceManager);\n\ \t_jdoIsContainerTransaction = _jdoPersistenceManager.currentTransaction().isActive();\n\ \tif (!_jdoIsContainerTransaction) '{'\n\ \t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.beginInternalTransaction(_jdoPersistenceManager);\n\ \t'}' \n\ \tjdoStoreFields();\n\ \t_jdoPersistenceManager.makePersistent(_jdoInstance);\n\ \tsuccess = true;\n\ \treturn ({2}){3}_JDOHelper.getHelperInstance().convertPCToPrimaryKey(\n\ \t\t_jdoInstance, _jdoPersistenceManager);\n\ '}' catch (com.sun.jdo.api.persistence.support.JDODuplicateObjectIdException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.handleJDODuplicateObjectIdAs{4}(_jdoBeanName, {5}, ex);\n\ \treturn null; // this is for compilation only - an exception will be thrown \n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t"GEN.ejbcreate_exception_othr", _jdoBeanName, {5}, ex);\n\ \tthrow ex;\n\ '}' finally '{'\n\ \tif (success) '{'\n\ \t\tif (_jdoIsContainerTransaction) '{'\n\ \t\t\tcom.sun.jdo.api.persistence.support.SynchronizationManager.registerSynchronization(this, _jdoPersistenceManager);\n\ \t\t\tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbCreate - register: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ \t\t'}'\n\ \t'}' else '{'\n\ \t\tif (_jdoPersistenceManager == null) '{'\n\ \t\t\t_jdoInstance = null;\n\ \t\t'}' else '{'\n\ \t\t\tif (!_jdoIsContainerTransaction && _jdoPersistenceManager.currentTransaction().isActive()) '{'\n\ \t\t\t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.rollbackInternalTransaction(_jdoPersistenceManager);\n\ \t\t\t'}'\n\ \t\t\tjdoClosePersistenceManager();\n\ \t\t'}'\n\ \t'}'\n\ '}' # ejbCreate1.1 in case of unknown PK Class # {0} - PC Class. # {1} - param list. # {2} - setter for the PK field. # {3} - Concrete Impl name # {4} - Concatenated parameter list # This bean version never throws DuplicateKeyException because key value is generated. # # Note: super.ejbCreate must be called BEFORE acquiring a new PersistenceManager. # CMP1.1 can execute a create() method in a non-transactional context, which # will require beginning a JDO transaction. This transaction must be rolled # back in case of any exception. If an exception is thrown from super.ejbCreate # (before beginning the JDO transaction), the _jdoInstance reference should be set to # null, but no other processing is needed. ejbCreateUnknownPK1_1=\ assertPersistenceManagerIsNull();\n\ boolean success = false;\n\ try '{'\n\ \t_jdoInstance = new {0}();\n\ \tjdoLoadFields();\n\ \tsuper.ejbCreate({1});\n\ \t_jdoInstance.{2}(new Long(com.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.getNextId()));\n\ \t_jdoPersistenceManager = jdoGetPersistenceManager();\n\ \t_jdoIsContainerTransaction = _jdoPersistenceManager.currentTransaction().isActive();\n\ \tif (!_jdoIsContainerTransaction) '{'\n\ \t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.beginInternalTransaction(_jdoPersistenceManager);\n\ \t'}' \n\ \tjdoStoreFields();\n\ \t_jdoPersistenceManager.makePersistent(_jdoInstance);\n\ \tsuccess = true;\n\ \treturn {3}_JDOHelper.getHelperInstance().convertPCToPrimaryKey(\n\ \t\t_jdoInstance, _jdoPersistenceManager);\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t"GEN.ejbcreate_exception_othr", _jdoBeanName, {4}, ex);\n\ \tthrow ex;\n\ '}' finally '{'\n\ \tif (success) '{'\n\ \t\tif (_jdoIsContainerTransaction) '{'\n\ \t\t\tcom.sun.jdo.api.persistence.support.SynchronizationManager.registerSynchronization(this, _jdoPersistenceManager);\n\ \t\t'}'\n\ \t'}' else '{'\n\ \t\tif (_jdoPersistenceManager == null) '{'\n\ \t\t\t_jdoInstance = null;\n\ \t\t'}' else '{'\n\ \t\t\tif (!_jdoIsContainerTransaction && _jdoPersistenceManager.currentTransaction().isActive()) '{'\n\ \t\t\t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.rollbackInternalTransaction(_jdoPersistenceManager);\n\ \t\t\t'}'\n\ \t\t\tjdoClosePersistenceManager();\n\ \t\t'}'\n\ \t'}'\n\ '}' # {0} - param list. # {1} - Contatenated parameter list ejbPostCreate1_1=\ boolean success = true;\n\ if(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbPostCreate : " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ try '{'\n\ \tsuper.ejbPostCreate({0});\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t"GEN.generic_method_exception", _jdoBeanName, {1}, ex);\n\ \tsuccess = false;\n\ \tthrow ex;\n\ '}' catch (RuntimeException ex) '{'\n\ \tsuccess = false;\n\ \tthrow ex;\n\ '}' catch (Error e) '{'\n\ \tsuccess = false;\n\ \tthrow e;\n\ '}' finally '{'\n\ \tif (!_jdoIsContainerTransaction) '{'\n\ \t\tif (success) '{'\n\ \t\t\ttry '{' \n\ \t\t\t\tjdoStoreFields();\n\ \t\t\t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.commitInternalTransaction(_jdoPersistenceManager);\n\ \t\t\t'}' catch (com.sun.jdo.api.persistence.support.JDOException x) '{'\n\ \t\t\t\tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t\t\t"GEN.generic_method_exception", _jdoBeanName, x);\n\ \t\t\t'}'\n\ \t\t'}'\n\ \t\tif (_jdoPersistenceManager.currentTransaction().isActive())\n\ \t\t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.rollbackInternalTransaction(_jdoPersistenceManager);\n\ \t\tjdoClosePersistenceManager();\n\ \t'}'\n\ '}' #ejbRemove for CMP1.1 ejbRemove1_1=\ if(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbRemove : " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ try {\n\ \tif (_jdoPersistenceManager == null) {\n\ \t\tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.assertNotContainerTransaction(this);\n\ \t\t_jdoIsContainerTransaction = false;\n\ \t\t_jdoPersistenceManager = jdoGetPersistenceManager();\n\ \t\tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbRemove - jdoGetPersistenceManager: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ \t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.beginInternalTransaction(_jdoPersistenceManager);\n\ \t\tjdoGetInstance();\n\ \t} \n\ \tsuper.ejbRemove();\n\ \tjdoStoreFields();\n\ \t_jdoPersistenceManager.deletePersistent(_jdoInstance);\n\ \tif (!_jdoIsContainerTransaction) {\n\ \t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.commitInternalTransaction(_jdoPersistenceManager);\n\ \t} \n\ } catch (com.sun.jdo.api.persistence.support.JDOException ex) {\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t"GEN.generic_method_exception", _jdoBeanName, ex);\n\ \tthrow ex;\n\ } finally {\n\ \tif (!_jdoIsContainerTransaction) {\n\ \t\tif (_jdoPersistenceManager.currentTransaction().isActive()) {\n\ \t\t\tcom.sun.jdo.spi.persistence.support.sqlstore.ejb.CMPHelper.rollbackInternalTransaction(_jdoPersistenceManager);\n\ \t\t}\n\ \t\tjdoClosePersistenceManager();\n\ \t}\n\ } # ejbLoad for CMP1.1 ejbLoad1_1=\ if(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbLoad - begin: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ assertPersistenceManagerIsNull();\n\ boolean success = false;\n\ try {\n\ \tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbLoad - jdoGetPersistenceManager: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ \t_jdoPersistenceManager = jdoGetPersistenceManager();\n\ \tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbLoad - jdoGetPersistenceManager: " + this + ":: " + _jdoPersistenceManager);\n\ \tjdoGetInstance();\n\ \tjdoLoadFields();\n\ \tsuper.ejbLoad();\n\ \tsuccess = true;\n\ } catch (com.sun.jdo.api.persistence.support.JDOException ex) {\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t"GEN.generic_method_exception", _jdoBeanName, ex);\n\ \tthrow (ex instanceof com.sun.jdo.api.persistence.support.JDOObjectNotFoundException) ? \n\ \t\t(RuntimeException) new NoSuchEntityException(ex) : ex;\n\ } finally {\n\ \tif (success && _jdoPersistenceManager.currentTransaction().isActive()) {\n\ \t\tcom.sun.jdo.api.persistence.support.SynchronizationManager.registerSynchronization(this, _jdoPersistenceManager);\n\ \t\tif(_logUsage)__state.append("\\n" + Thread.currentThread() + " IN ejbLoad - register: " + this + ":: " + com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getTransaction());\n\ \t} else jdoClosePersistenceManager();\n\ } # ejbStore for CMP1.1 ejbStore1_1=\ if (_jdoPersistenceManager == null) {\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.assertNotContainerTransaction(this);\n\ \treturn;\n\ }\n\ if (com.sun.jdo.api.persistence.support.JDOHelper.isDeleted(_jdoInstance)) {\n\ \treturn;\n\ }\n\ try {\n\ \tsuper.ejbStore();\n\ \tjdoStoreFields();\n\ } catch (com.sun.jdo.api.persistence.support.JDOException ex) {\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithLifecycleLogger(\n\ \t\t"GEN.generic_method_exception", _jdoBeanName, ex);\n\ \tthrow ex;\n\ } # Helper methods for CMP1.1 concrete impl class. # {0} - field name. # {1} - getter name. load1_1=\ this.{0} = _jdoInstance.{1}();\n # {0} - getter name. # {1} - field name. # {2} - setter name. store1_1=\ if(_jdoInstance.{0}() != this.{1}) _jdoInstance.{2}(this.{1});\n # {0} - Concrete Impl name # {1} - field name. assertPKStore1_1=\ {0}_JDOHelper.getHelperInstance().assertPrimaryKeyFieldNotNull(this.{1}, "{1}", _jdoBeanName);\n # {0} - getter name. # {1} - field name. # {2} - setter name. pkstore1_1=\ try '{'\n\ \tif(_jdoInstance.{0}() != this.{1}) _jdoInstance.{2}(this.{1});\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{' \n\ \tString msg = com.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionFromPKSetter(_jdoBeanName, ex);\n\ \tthrow new IllegalStateException(msg);\n\ '}'\n # {0} - getter name. # {1} - field name. # {2} - setter name. pkstringstore1_1=\ try '{'\n\ \tif(!this.{1}.equals(_jdoInstance.{0}())) _jdoInstance.{2}(this.{1}.trim());\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{' \n\ \tString msg = com.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionFromPKSetter(_jdoBeanName, ex);\n\ \tthrow new IllegalStateException(msg);\n\ '}'\n # {0} - getter name. # {1} - field name. # {2} - setter name. # {3} - CMP field type. pkcopystore1_1=\ try '{'\n\ \tif(!this.{1}.equals(_jdoInstance.{0}())) _jdoInstance.{2}(({3})this.{1}.clone());\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{' \n\ \tString msg = com.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionFromPKSetter(_jdoBeanName, ex);\n\ \tthrow new IllegalStateException(msg);\n\ '}'\n # {0} - getter name. # {1} - field type. # {2} - field name. copyload1_1=\ try '{'\n\ \t{1} rc = _jdoInstance.{0}();\n\ \tthis.{2} = (rc == null) ? null : ({1})rc.clone();\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithInternalLogger(_jdoBeanName, ex);\n\ \tthrow ex;\n\ '}'\n # {0} - getter name. # {1} - field name. # {2} - setter name. # {3} - CMP field type. copystore1_1=\ try '{'\n\ \t{3} rc = _jdoInstance.{0}();\n\ \tif(this.{1} == null) '{' \n\ \t\tif (rc != null) _jdoInstance.{2}(null);\n\ \t'}' else if(!this.{1}.equals(rc)) '{' \n\ \t\t_jdoInstance.{2}(({3})this.{1}.clone());\n\ \t'}'\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithInternalLogger(_jdoBeanName, ex);\n\ \tthrow ex;\n\ '}'\n # {0} - field name. # {1} - getter name. arrayload1_1=\ try '{'\n\ \tthis.{0} = jdoArrayCopy(_jdoInstance.{1}());\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithInternalLogger(_jdoBeanName, ex);\n\ \tthrow ex;\n\ '}'\n # {0} - getter name. # {1} - field name. # {2} - setter name. arraystore1_1=\ try '{'\n\ \tif(!java.util.Arrays.equals(_jdoInstance.{0}(), this.{1})) \n\ \t_jdoInstance.{2}(jdoArrayCopy(this.{1}));\n\ '}' catch (com.sun.jdo.api.persistence.support.JDOException ex) '{'\n\ \tcom.sun.jdo.spi.persistence.support.ejb.cmp.CMPBeanHelper.logJDOExceptionWithInternalLogger(_jdoBeanName, ex);\n\ \tthrow ex;\n\ '}'\n # {0} - field name. # {1} - getter name. # {2} - field Type. # {3} - Concrete Impl name loadSerializable1_1=\ this.{0} = ({2})\n\ \t{3}_JDOHelper.getHelperInstance().readSerializableObjectFromByteArray( _jdoInstance.{1}() );\n # {0} - getter name. # {1} - field name. # {2} - setter name. # {3} - Concrete Impl name storeSerializable1_1=\ byte[] byteValue{1} = {3}_JDOHelper.getHelperInstance().writeSerializableObjectToByteArray(this.{1});\n\ if( !java.util.Arrays.equals(_jdoInstance.{0}(), byteValue{1} ) )\n\ \t_jdoInstance.{2}(byteValue{1});\n jdoCleanAllRefs1_1=\ _jdoInstance = null;\n\ _jdoPersistenceManager = null;\n\ _jdoIsContainerTransaction = true; # # ----------------------------------------------------------------------------- # End of CMP1.1 specific properties # ----------------------------------------------------------------------------- # Other Glassfish examples (source code examples)Here is a short list of links related to this Glassfish CMP11Templates.properties source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.