/** * Declare the explicit parameters to be used in the query. * This implementation always throws a NucleusUserException since this concept doesn't apply to SQL queries. * @param parameters the parameters separated by semicolons. * @exception NucleusUserException Always thrown. */ public void declareExplicitParameters(String parameters) { throw new NucleusUserException(Localiser.msg("059016")); }
/** * Method to close the definition of the class method. * This implementation simply logs a debug message to category ENHANCER. */ public void close() { if (DataNucleusEnhancer.LOGGER.isDebugEnabled()) { String msg = getMethodAdditionMessage(methodName, returnType, argTypes, argNames); DataNucleusEnhancer.LOGGER.debug(LOCALISER.msg("Enhancer.AddMethod", msg)); } }
/** * Assert that the mechanism is open from writings */ private void assertIsOpen() { if (mconn == null) { throw new NucleusException(Localiser.msg("049008")).setFatal(); } }
/** * Method to add fields to match the PK fields of the persistable class * @param cw The ClassWriter to use */ protected void addFields(ClassWriter cw) { int[] pkPositions = cmd.getPKMemberPositions(); for (int i=0;i<pkPositions.length;i++) { AbstractMemberMetaData mmd = cmd.getMetaDataForManagedMemberAtPosition(pkPositions[i]); String fieldTypeName = getTypeNameForField(mmd); if (DataNucleusEnhancer.LOGGER.isDebugEnabled()) { DataNucleusEnhancer.LOGGER.debug(LOCALISER.msg("Enhancer.AddField", fieldTypeName + " " + pkClassName + " " + mmd.getName())); } FieldVisitor fv = cw.visitField(Opcodes.ACC_PUBLIC, mmd.getName(), ASMUtils.getTypeDescriptorForType(fieldTypeName), null, null); fv.visitEnd(); } }
/** * Constructor. * @param ownerTable Table of the owner member, for linking back * @param tableName The Table SQL identifier * @param mmd Member meta data for the owner field/property * @param storeMgr Manager for the datastore. */ protected JoinTable(Table ownerTable, DatastoreIdentifier tableName, AbstractMemberMetaData mmd, RDBMSStoreManager storeMgr) { super(tableName, storeMgr); this.ownerTable = ownerTable; this.mmd = mmd; this.ownerType = mmd.getClassName(true); if (mmd.getPersistenceModifier() == FieldPersistenceModifier.NONE) { throw new NucleusException(Localiser.msg("057006", mmd.getName())).setFatal(); } }
public FKListStore(AbstractMemberMetaData ownerMmd, DatastoreManager storeMgr, ClassLoaderResolver clr) { super(ownerMmd, storeMgr, clr); orderMapping = elementTable.getExternalMapping(ownerMemberMetaData, MappingConsumer.MAPPING_TYPE_EXTERNAL_INDEX); if (ownerMemberMetaData.getOrderMetaData() != null && !ownerMemberMetaData.getOrderMetaData().isIndexedList()) { indexedList = false; } if (!storeMgr.storageVersionAtLeast(StorageVersion.READ_OWNED_CHILD_KEYS_FROM_PARENTS) && orderMapping == null && indexedList) { // Early storage version requires that indexedList has an order mapping in the element throw new NucleusUserException(LOCALISER.msg("056041", ownerMemberMetaData.getAbstractClassMetaData().getFullClassName(), ownerMemberMetaData.getName(), elementType)); } }
public void commit(Xid xid, boolean onePhase) throws XAException { super.commit(xid, onePhase); try { NucleusLogger.CONNECTION.debug(Localiser.msg("009015", mconn.toString())); conn.commit(); ((ManagedConnectionImpl)mconn).xaRes = null; } catch (SQLException e) { NucleusLogger.CONNECTION.debug(Localiser.msg("009020", mconn.toString(), xid.toString(), onePhase)); XAException xe = new XAException(StringUtils.getStringFromStackTrace(e)); xe.initCause(e); throw xe; } }
void handleIgnorableMapping(AbstractClassMetaData acmd, AbstractMemberMetaData ammd, String localiserKey, String warningOnlyMsg) { switch (getIgnorableMetaDataBehavior()) { case WARN: if (ammd == null) { warn(String.format( "Meta-data warning for %s: %s %s %s", acmd.getFullClassName(), GAE_LOCALISER.msg(localiserKey), warningOnlyMsg, ADJUST_WARNING_MSG)); } else { warn(String.format( "Meta-data warning for %s.%s: %s %s %s", acmd.getFullClassName(), ammd.getName(), GAE_LOCALISER.msg(localiserKey, ammd.getFullFieldName()), warningOnlyMsg, ADJUST_WARNING_MSG)); } break; case ERROR: if (ammd == null) { throw new InvalidMetaDataException(GAE_LOCALISER, localiserKey, acmd.getFullClassName()); } throw new InvalidMetaDataException(GAE_LOCALISER, localiserKey, ammd.getFullFieldName()); // We swallow both null and NONE } }
/** * Method called at the end of visiting the setXXX method. * This is used to add the aaaSetXXX method with the same code as is present originally in the setXXX method. */ public void visitEnd() { visitor.visitEnd(); if (DataNucleusEnhancer.LOGGER.isDebugEnabled()) { String msg = ClassMethod.getMethodAdditionMessage(ASMClassEnhancer.MN_SetterPrefix + mmd.getName(), null, new Object[]{mmd.getType()}, new String[] {"val"}); DataNucleusEnhancer.LOGGER.debug(LOCALISER.msg("Enhancer.AddMethod", msg)); } if (!mmd.isAbstract()) { // Property is not abstract so generate the setXXX method to use the aaaSetXXX we just added generateSetXXXMethod(mv, mmd, enhancer.getASMClassName(), enhancer.getClassDescriptor(), ASMClassEnhancer.useFrames()); } }
/** * Close the method */ public void close() { // Override the log message if (DataNucleusEnhancer.LOGGER.isDebugEnabled()) { DataNucleusEnhancer.LOGGER.debug(LOCALISER.msg("Enhancer.AddConstructor", getClassEnhancer().className + "()")); } } }
/** * Assert that the mechanism is closed from writing. */ private void assertIsClosed() { if (mconn != null) { throw new NucleusException(Localiser.msg("049009")).setFatal(); } }
/** * Set the import statements to be used to identify the fully qualified name of variables or parameters. * This implementation always throws a NucleusUserException since this concept doesn't apply to SQL queries. * @param imports import statements separated by semicolons. * @exception NucleusUserException Always thrown. */ public void declareImports(String imports) { throw new NucleusUserException(Localiser.msg("059026")); }
public void rollback(Xid xid) throws XAException { super.rollback(xid); try { NucleusLogger.CONNECTION.debug(Localiser.msg("009016", mconn.toString())); conn.rollback(); ((ManagedConnectionImpl)mconn).xaRes = null; } catch (SQLException e) { NucleusLogger.CONNECTION.debug(Localiser.msg("009022", mconn.toString(), xid.toString())); XAException xe = new XAException(StringUtils.getStringFromStackTrace(e)); xe.initCause(e); throw xe; } }
if (DataNucleusEnhancer.LOGGER.isDebugEnabled()) DataNucleusEnhancer.LOGGER.debug(LOCALISER.msg("Enhancer.AddMethod", "int " + pkClassName + ".hashCode()")); mv.visitFieldInsn(Opcodes.GETFIELD, className_ASM, mmd.getName(), ASMUtils.getTypeDescriptorForType(mmd.getTypeName())); if (mmd.getType() == long.class)
public void commit(Xid xid, boolean onePhase) throws XAException { if (NucleusLogger.CONNECTION.isDebugEnabled()) { NucleusLogger.CONNECTION.debug(Localiser.msg("009015", this.toString())); } super.commit(xid, onePhase); }
public SQLExpression getExpression(SQLStatement stmt, SQLExpression expr, List<SQLExpression> args) { if (args == null || args.size() != 1) { throw new NucleusException(Localiser.msg("060003", "endsWith", "StringExpression", 0, "StringExpression/CharacterExpression/ParameterLiteral")); } StringExpression strExpr1 = (StringExpression)expr; StringExpression strExpr2 = (StringExpression)args.get(0); return strExpr1.eq(strExpr2); } }
/** * Method to throw an exception if the query is currently not modifiable. * @throws NucleusUserException Thrown when it is unmodifiable */ protected void assertIsModifiable() { if (unmodifiable) { throw new NucleusUserException(Localiser.msg("021014")); } }
protected boolean addColumnFamilyForColumn(Column col, HTableDescriptor htable, String tableName, Set<String> familyNames, boolean validateOnly) { boolean modified = false; String familyName = HBaseUtils.getFamilyNameForColumn(col); if (!familyNames.contains(familyName)) { familyNames.add(familyName); if (!htable.hasFamily(familyName.getBytes())) { if (validateOnly) { NucleusLogger.DATASTORE_SCHEMA.debug(Localiser.msg("HBase.SchemaValidate.Class.Family", tableName, familyName)); } else if (storeMgr.getSchemaHandler().isAutoCreateColumns()) { NucleusLogger.DATASTORE_SCHEMA.debug(Localiser.msg("HBase.SchemaCreate.Class.Family", tableName, familyName)); HColumnDescriptor hColumn = new HColumnDescriptor(familyName); htable.addFamily(hColumn); modified = true; } } } return modified; }
/** * Method called at the end of visiting the getXXX method. * This is used to add the aaaGetXXX method with the same code as is present originally in the getXXX method. */ public void visitEnd() { visitor.visitEnd(); if (DataNucleusEnhancer.LOGGER.isDebugEnabled()) { String msg = ClassMethod.getMethodAdditionMessage(enhancer.getGetMethodPrefixMethodName() + mmd.getName(), mmd.getType(), null, null); DataNucleusEnhancer.LOGGER.debug(LOCALISER.msg("Enhancer.AddMethod", msg)); } if (!mmd.isAbstract()) { // Property is not abstract so generate the getXXX method to use the aaaGetXXX we just added generateGetXXXMethod(mv, mmd, enhancer.getASMClassName(), enhancer.getClassDescriptor(), false, ASMClassEnhancer.useFrames()); } }
public void rollback(Xid xid) throws XAException { if (NucleusLogger.CONNECTION.isDebugEnabled()) { NucleusLogger.CONNECTION.debug(Localiser.msg("009016", this.toString())); } super.rollback(xid); } }