/** * INTERNAL: * Exception when acquiring the SDOHelperContext cache key for WLS. This method should be * used when an attempt to create an InitialContext fails. */ public static SDOException errorCreatingWLSInitialContext(Exception nestedException) { Object[] args = {}; SDOException exception = new SDOException(ExceptionMessageGenerator.buildMessage(// SDOException.class, ERROR_CREATING_INITIAL_CONTEXT, args), nestedException); exception.setErrorCode(ERROR_CREATING_INITIAL_CONTEXT); return exception; }
@Override public void unset(Property property) { if (null == property) { throw SDOException.cannotPerformOperationOnNullArgument("unset"); } unset(property, false); }
public DataObject create(Type type) { if (type == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("create", "type")); throw new IllegalArgumentException(SDOException.errorCreatingDataObjectForType(sdoType.getURI(), sdoType.getName())); throw new IllegalArgumentException(SDOException.errorCreatingDataObjectForClass(e, (sdoType).getInstanceClassName(), sdoType.getURI(), sdoType.getName())); } catch (IllegalAccessException e) { throw new IllegalArgumentException(SDOException.errorCreatingDataObjectForClass(e, (sdoType).getInstanceClassName(), sdoType.getURI(), sdoType.getName()));
/** * Define the list of DataObjects as Types. * The Types are available through TypeHelper and DataGraph getType() methods. * @param types a List of DataObjects representing the Types. * @return the defined Types. * @throws IllegalArgumentException if the Types could not be defined. */ public synchronized List define(List types) { if (types == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("define", "types")); } List definedTypes = new ArrayList(); for (int i = 0; i < types.size(); i++) { Type definedType = define((DataObject)types.get(i)); definedTypes.add(definedType); } return definedTypes; }
public DataObject create(Class interfaceClass) { if (interfaceClass == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("create", "interfaceClass")); throw new IllegalArgumentException(SDOException.typeNotFoundForInterface(interfaceClass.getName(), loadersAreRelated));
private void save(XMLDocument xmlDocument, Writer outputWriter, XMLMarshaller anXMLMarshaller) throws IOException { if (xmlDocument == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("save", "xmlDocument")); if(xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT){ if(aHelperContext != ((SDOType)xmlDocument.getRootObject().getType()).getHelperContext()){ throw SDOException.dataObjectNotFromHelperContext();
throw new IllegalArgumentException(SDOException.conversionError(null)); return null; } else if (!(value instanceof List)) { throw new IllegalArgumentException(SDOException.conversionError(null)); } else { List theList = (List) value; throw SDOException.invalidPropertyValue(property.getName(), property.getType().getURI() + '#' + property.getType().getName(), value.getClass().getName(), value.toString(), e);
public Class getInstanceClass() { if ((javaClass == null) && (javaClassName != null)) { try { SDOClassLoader loader = ((SDOXMLHelper)aHelperContext.getXMLHelper()).getLoader(); Class clazz = loader.getParent().loadClass(javaClassName); if(isValidInstanceClass(clazz)) { javaClass = clazz; } else { javaClass = getClass(); } } catch (ClassNotFoundException e) { javaClass = getClass(); } catch (SecurityException e) { throw SDOException.classNotFound(e, getURI(), getName()); } } if(javaClass == getClass()) { return null; } return javaClass; }
private void setDelegate(Resolvable resolvable) { try { Field delegateField = (Field) privilegedGetDelegateField.run(); PrivilegedSetValueInField privilegedSetValueInDelegateField = new PrivilegedSetValueInField(delegateField, this, resolvable); privilegedSetValueInDelegateField.run(); } catch (NoSuchFieldException nsfException){ throw SDOException.errorAccessingExternalizableDelegator("delegate", nsfException); } catch (IllegalAccessException iaException){ throw SDOException.errorAccessingExternalizableDelegator("delegate", iaException); } } }
/** * Convert the specified value to an {@link Type#getInstanceClass() * instance} of the specified type. Supported conversions are listed in * Section 14 of the SDO specification. * * @param type the target {@link Type#isDataType() data type}. * @param value the value to convert * @return a value of the specified type's instance class * @throws IllegalArgumentException if the value could not be converted * @see #convert(Property, Object) */ public Object convert(Type type, Object value) { Class convertClass = null; if (((SDOType) type).isDataType()) { convertClass = type.getInstanceClass(); } /*else { convertClass = ((org.eclipse.persistence.sdo.SDOType) type).getImplClass(); }*/ if (value.getClass() == ClassConstants.STRING) { return convertFromStringValue((String) value, type); } else if (convertClass == ClassConstants.STRING) { return convertToStringValue(value, type); } else { try { return getXMLConversionManager().convertObject(value, convertClass); } catch (ConversionException e) { throw new IllegalArgumentException(SDOException.conversionError(e)); } } }
/** * ADVANCED: * Used to set an ApplicationResolver instance that will be used to retrieve * info pertaining to a given application, such as the application name, in * the case where our logic fails. * * This method can be called once and only once per active server instance. * * @param aResolver the ApplicationResolver instance that will be used to retrieve * info pertaining to a given application. Note that null is * considered a valid set operation. * @throws SDOException if more than one call is made to this method * in an active server instance. */ public static void setApplicationResolver(ApplicationResolver aResolver) { // we only allow one set operation per running server instance if (isApplicationResolverSet()) { throw SDOException.attemptToResetApplicationResolver(); } appResolver = aResolver; isAppResolverSet = true; }
if(xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT){ if(aHelperContext != ((SDOType)rootObject.getType()).getHelperContext()){ throw SDOException.dataObjectNotFromHelperContext();
throw SDOException.cannotPerformOperationOnProperty(lastPropertyName, path);
public DataObject create(Type type) { if (type == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("create", "type")); throw new IllegalArgumentException(SDOException.errorCreatingDataObjectForType(sdoType.getURI(), sdoType.getName())); throw new IllegalArgumentException(SDOException.errorCreatingDataObjectForClass(e, (sdoType).getInstanceClassName(), sdoType.getURI(), sdoType.getName())); } catch (IllegalAccessException e) { throw new IllegalArgumentException(SDOException.errorCreatingDataObjectForClass(e, (sdoType).getInstanceClassName(), sdoType.getURI(), sdoType.getName()));
/** * Define the list of DataObjects as Types. * The Types are available through TypeHelper and DataGraph getType() methods. * @param types a List of DataObjects representing the Types. * @return the defined Types. * @throws IllegalArgumentException if the Types could not be defined. */ public synchronized List define(List types) { if (types == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("define", "types")); } List definedTypes = new ArrayList(); for (int i = 0; i < types.size(); i++) { Type definedType = define((DataObject)types.get(i)); definedTypes.add(definedType); } return definedTypes; }
public DataObject create(Class interfaceClass) { if (interfaceClass == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("create", "interfaceClass")); throw new IllegalArgumentException(SDOException.typeNotFoundForInterface(interfaceClass.getName(), loadersAreRelated));
private void save(XMLDocument xmlDocument, Writer outputWriter, XMLMarshaller anXMLMarshaller) throws IOException { if (xmlDocument == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("save", "xmlDocument")); if(xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT){ if(aHelperContext != ((SDOType)xmlDocument.getRootObject().getType()).getHelperContext()){ throw SDOException.dataObjectNotFromHelperContext();
throw new IllegalArgumentException(SDOException.conversionError(null)); return null; } else if (!(value instanceof List)) { throw new IllegalArgumentException(SDOException.conversionError(null)); } else { List theList = (List) value; throw SDOException.invalidPropertyValue(property.getName(), property.getType().getURI() + '#' + property.getType().getName(), value.getClass().getName(), value.toString(), e);
public Class getInstanceClass() { if ((javaClass == null) && (javaClassName != null)) { try { SDOClassLoader loader = ((SDOXMLHelper)aHelperContext.getXMLHelper()).getLoader(); Class clazz = loader.getParent().loadClass(javaClassName); if(isValidInstanceClass(clazz)) { javaClass = clazz; } else { javaClass = getClass(); } } catch (ClassNotFoundException e) { javaClass = getClass(); } catch (SecurityException e) { throw SDOException.classNotFound(e, getURI(), getName()); } } if(javaClass == getClass()) { return null; } return javaClass; }
private void setDelegate(Resolvable resolvable) { try { Field delegateField = (Field) privilegedGetDelegateField.run(); PrivilegedSetValueInField privilegedSetValueInDelegateField = new PrivilegedSetValueInField(delegateField, this, resolvable); privilegedSetValueInDelegateField.run(); } catch (NoSuchFieldException nsfException){ throw SDOException.errorAccessingExternalizableDelegator("delegate", nsfException); } catch (IllegalAccessException iaException){ throw SDOException.errorAccessingExternalizableDelegator("delegate", iaException); } } }