Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.MetadataException


                proxyFactoryClass = getProxyConfiguration().getProxyFactoryClass();
                singleton = (ProxyFactory) proxyFactoryClass.newInstance();
            }
            catch(InstantiationException e)
            {
                throw new MetadataException("Illegal class " + proxyFactoryClass.getName() + " specified for ProxyFactoryClass.");
            }
            catch(IllegalAccessException e)
            {
                throw new MetadataException("Illegal class " + proxyFactoryClass.getName() + " specified for ProxyFactoryClass.");
            }
        }
        return singleton;
    }
View Full Code Here


        {
            collType = fieldType;
        }
        else
        {
            throw new MetadataException("Cannot determine a default collection type for collection "+cds.getAttributeName()+" in type "+cds.getClassDescriptor().getClassNameOfObject());
        }
        return collType;
    }
View Full Code Here

                    {
                        attribute = ClassHelper.newInstance(pd.getPropertyType());
                    }
                    catch (Exception e)
                    {
                        throw new MetadataException("Can't instantiate nested object of type '"
                                + pd.getPropertyType() + "' for field '"
                                + pd.getName() + "'", e);
                    }
                }
                setValueFor(pd, target, attribute);
View Full Code Here

                return m.invoke(ProxyHelper.getRealObject(target), null);
            }
            catch (Throwable e)
            {
                logProblem(pd, target, null, "Can't read value from given object");
                throw new MetadataException("Error invoking method:" + m.getName() + " in object " + target.getClass().getName(), e);
            }
        }
        else
        {
            throw new MetadataException("Can't get ReadMethod for property:" + pd.getName() + " in object " + target.getClass().getName());
        }
    }
View Full Code Here

                }
            }
            catch (Throwable e)
            {
                logProblem(pd, target, value, "Can't set value on given object.");
                throw new MetadataException("Error invoking method:" + m.getName() + " in object:" + target.getClass().getName(), e);
            }
        }
        else
        {
            throw new MetadataException("Can't get WriteMethod for property:" + pd.getName() + " in object:" + target.getClass().getName());
        }
    }
View Full Code Here

            {
                /*
         * Daren Drummond:   Throw here so we are consistent
         *           with PersistentFieldDefaultImpl.
         */
                throw new MetadataException("Can't find property " + aPropertyName + " in " + aClass.getName());
            }
            return descriptor;
        }
        catch (IntrospectionException ex)
        {
            /*
       * Daren Drummond:   Throw here so we are consistent
       *           with PersistentFieldDefaultImpl.
       */
            throw new MetadataException("Can't find property " + aPropertyName + " in " + aClass.getName(), ex);
        }
    }
View Full Code Here

                {
                    attribute = getValueFrom(field, current);
                }
                catch (Exception e)
                {
                    throw new MetadataException("Can't read field '" + field.getName() + "' of type " + field.getType().getName(), e);
                }
                if (attribute != null || value != null)
                {
                    // if the intermediary nested object is null, we have to create
                    // a new instance to set the value
                    if (attribute == null)
                    {
                        try
                        {
                            attribute = ClassHelper.newInstance(field.getType());
                        }
                        catch (Exception e)
                        {
                            throw new MetadataException("Can't create nested object of type '"
                                    + field.getType() + "' for field '"
                                    + field.getName() + "'", e);
                        }
                    }
                    try
                    {
                        //field.set(current, attribute);
                        setValueFor(field, current, attribute);
                    }
                    //catch (IllegalAccessException e)
                    catch (Exception e)
                    {
                        throw new MetadataException("Can't set nested object of type '"
                                    + field.getType() + "' for field '"
                                    + field.getName() + "'", e);
                    }
                }
                else
View Full Code Here

            // TODO: don't make costly proxy test on field level use
            // return field.get(target);
        }
        catch (IllegalAccessException e)
        {
            throw new MetadataException(
                    "IllegalAccess error reading field: " +
                    (field != null ? field.getName() : null) + " from object: "
                    + (target != null ? target.getClass().getName() : null), e);
        }
        catch (IllegalArgumentException e)
        {
            throw new MetadataException(
                    "IllegalArgument error reading field: " +
                    buildErrorGetMsg(target, field), e);
        }
    }
View Full Code Here

                    + "' seems to be null. Can't write into null.", ignored);
        }
        catch (Exception e)
        {
            getLog().error("while set field: " + buildErrorSetMsg(target, value, field));
            throw new MetadataException("IllegalAccess error setting field:" +
                    (field != null ? field.getName() : null) + " in object:" + target.getClass().getName(), e);
        }
    }
View Full Code Here

    private void checkNested(String fieldName)
    {
        if(fieldName.indexOf(PATH_TOKEN) > -1)
        {
            throw new MetadataException("This implementation does not support nested fields");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.MetadataException

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.